@arcware-cloud/pixelstreaming-websdk 0.1.2 → 0.1.3

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/index.cjs.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var commonjsGlobal="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function commonjsRequire(e){throw new Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var sdp={exports:{}};!function(e){const t={generateIdentifier:function(){return Math.random().toString(36).substring(2,12)}};t.localCName=t.generateIdentifier(),t.splitLines=function(e){return e.trim().split("\n").map((e=>e.trim()))},t.splitSections=function(e){return e.split("\nm=").map(((e,t)=>(t>0?"m="+e:e).trim()+"\r\n"))},t.getDescription=function(e){const r=t.splitSections(e);return r&&r[0]},t.getMediaSections=function(e){const r=t.splitSections(e);return r.shift(),r},t.matchPrefix=function(e,r){return t.splitLines(e).filter((e=>0===e.indexOf(r)))},t.parseCandidate=function(e){let t;t=0===e.indexOf("a=candidate:")?e.substring(12).split(" "):e.substring(10).split(" ");const r={foundation:t[0],component:{1:"rtp",2:"rtcp"}[t[1]]||t[1],protocol:t[2].toLowerCase(),priority:parseInt(t[3],10),ip:t[4],address:t[4],port:parseInt(t[5],10),type:t[7]};for(let e=8;e<t.length;e+=2)switch(t[e]){case"raddr":r.relatedAddress=t[e+1];break;case"rport":r.relatedPort=parseInt(t[e+1],10);break;case"tcptype":r.tcpType=t[e+1];break;case"ufrag":r.ufrag=t[e+1],r.usernameFragment=t[e+1];break;default:void 0===r[t[e]]&&(r[t[e]]=t[e+1])}return r},t.writeCandidate=function(e){const t=[];t.push(e.foundation);const r=e.component;"rtp"===r?t.push(1):"rtcp"===r?t.push(2):t.push(r),t.push(e.protocol.toUpperCase()),t.push(e.priority),t.push(e.address||e.ip),t.push(e.port);const n=e.type;return t.push("typ"),t.push(n),"host"!==n&&e.relatedAddress&&e.relatedPort&&(t.push("raddr"),t.push(e.relatedAddress),t.push("rport"),t.push(e.relatedPort)),e.tcpType&&"tcp"===e.protocol.toLowerCase()&&(t.push("tcptype"),t.push(e.tcpType)),(e.usernameFragment||e.ufrag)&&(t.push("ufrag"),t.push(e.usernameFragment||e.ufrag)),"candidate:"+t.join(" ")},t.parseIceOptions=function(e){return e.substring(14).split(" ")},t.parseRtpMap=function(e){let t=e.substring(9).split(" ");const r={payloadType:parseInt(t.shift(),10)};return t=t[0].split("/"),r.name=t[0],r.clockRate=parseInt(t[1],10),r.channels=3===t.length?parseInt(t[2],10):1,r.numChannels=r.channels,r},t.writeRtpMap=function(e){let t=e.payloadType;void 0!==e.preferredPayloadType&&(t=e.preferredPayloadType);const r=e.channels||e.numChannels||1;return"a=rtpmap:"+t+" "+e.name+"/"+e.clockRate+(1!==r?"/"+r:"")+"\r\n"},t.parseExtmap=function(e){const t=e.substring(9).split(" ");return{id:parseInt(t[0],10),direction:t[0].indexOf("/")>0?t[0].split("/")[1]:"sendrecv",uri:t[1],attributes:t.slice(2).join(" ")}},t.writeExtmap=function(e){return"a=extmap:"+(e.id||e.preferredId)+(e.direction&&"sendrecv"!==e.direction?"/"+e.direction:"")+" "+e.uri+(e.attributes?" "+e.attributes:"")+"\r\n"},t.parseFmtp=function(e){const t={};let r;const n=e.substring(e.indexOf(" ")+1).split(";");for(let e=0;e<n.length;e++)r=n[e].trim().split("="),t[r[0].trim()]=r[1];return t},t.writeFmtp=function(e){let t="",r=e.payloadType;if(void 0!==e.preferredPayloadType&&(r=e.preferredPayloadType),e.parameters&&Object.keys(e.parameters).length){const n=[];Object.keys(e.parameters).forEach((t=>{void 0!==e.parameters[t]?n.push(t+"="+e.parameters[t]):n.push(t)})),t+="a=fmtp:"+r+" "+n.join(";")+"\r\n"}return t},t.parseRtcpFb=function(e){const t=e.substring(e.indexOf(" ")+1).split(" ");return{type:t.shift(),parameter:t.join(" ")}},t.writeRtcpFb=function(e){let t="",r=e.payloadType;return void 0!==e.preferredPayloadType&&(r=e.preferredPayloadType),e.rtcpFeedback&&e.rtcpFeedback.length&&e.rtcpFeedback.forEach((e=>{t+="a=rtcp-fb:"+r+" "+e.type+(e.parameter&&e.parameter.length?" "+e.parameter:"")+"\r\n"})),t},t.parseSsrcMedia=function(e){const t=e.indexOf(" "),r={ssrc:parseInt(e.substring(7,t),10)},n=e.indexOf(":",t);return n>-1?(r.attribute=e.substring(t+1,n),r.value=e.substring(n+1)):r.attribute=e.substring(t+1),r},t.parseSsrcGroup=function(e){const t=e.substring(13).split(" ");return{semantics:t.shift(),ssrcs:t.map((e=>parseInt(e,10)))}},t.getMid=function(e){const r=t.matchPrefix(e,"a=mid:")[0];if(r)return r.substring(6)},t.parseFingerprint=function(e){const t=e.substring(14).split(" ");return{algorithm:t[0].toLowerCase(),value:t[1].toUpperCase()}},t.getDtlsParameters=function(e,r){return{role:"auto",fingerprints:t.matchPrefix(e+r,"a=fingerprint:").map(t.parseFingerprint)}},t.writeDtlsParameters=function(e,t){let r="a=setup:"+t+"\r\n";return e.fingerprints.forEach((e=>{r+="a=fingerprint:"+e.algorithm+" "+e.value+"\r\n"})),r},t.parseCryptoLine=function(e){const t=e.substring(9).split(" ");return{tag:parseInt(t[0],10),cryptoSuite:t[1],keyParams:t[2],sessionParams:t.slice(3)}},t.writeCryptoLine=function(e){return"a=crypto:"+e.tag+" "+e.cryptoSuite+" "+("object"==typeof e.keyParams?t.writeCryptoKeyParams(e.keyParams):e.keyParams)+(e.sessionParams?" "+e.sessionParams.join(" "):"")+"\r\n"},t.parseCryptoKeyParams=function(e){if(0!==e.indexOf("inline:"))return null;const t=e.substring(7).split("|");return{keyMethod:"inline",keySalt:t[0],lifeTime:t[1],mkiValue:t[2]?t[2].split(":")[0]:void 0,mkiLength:t[2]?t[2].split(":")[1]:void 0}},t.writeCryptoKeyParams=function(e){return e.keyMethod+":"+e.keySalt+(e.lifeTime?"|"+e.lifeTime:"")+(e.mkiValue&&e.mkiLength?"|"+e.mkiValue+":"+e.mkiLength:"")},t.getCryptoParameters=function(e,r){return t.matchPrefix(e+r,"a=crypto:").map(t.parseCryptoLine)},t.getIceParameters=function(e,r){const n=t.matchPrefix(e+r,"a=ice-ufrag:")[0],i=t.matchPrefix(e+r,"a=ice-pwd:")[0];return n&&i?{usernameFragment:n.substring(12),password:i.substring(10)}:null},t.writeIceParameters=function(e){let t="a=ice-ufrag:"+e.usernameFragment+"\r\na=ice-pwd:"+e.password+"\r\n";return e.iceLite&&(t+="a=ice-lite\r\n"),t},t.parseRtpParameters=function(e){const r={codecs:[],headerExtensions:[],fecMechanisms:[],rtcp:[]},n=t.splitLines(e)[0].split(" ");r.profile=n[2];for(let i=3;i<n.length;i++){const s=n[i],a=t.matchPrefix(e,"a=rtpmap:"+s+" ")[0];if(a){const n=t.parseRtpMap(a),i=t.matchPrefix(e,"a=fmtp:"+s+" ");switch(n.parameters=i.length?t.parseFmtp(i[0]):{},n.rtcpFeedback=t.matchPrefix(e,"a=rtcp-fb:"+s+" ").map(t.parseRtcpFb),r.codecs.push(n),n.name.toUpperCase()){case"RED":case"ULPFEC":r.fecMechanisms.push(n.name.toUpperCase())}}}t.matchPrefix(e,"a=extmap:").forEach((e=>{r.headerExtensions.push(t.parseExtmap(e))}));const i=t.matchPrefix(e,"a=rtcp-fb:* ").map(t.parseRtcpFb);return r.codecs.forEach((e=>{i.forEach((t=>{e.rtcpFeedback.find((e=>e.type===t.type&&e.parameter===t.parameter))||e.rtcpFeedback.push(t)}))})),r},t.writeRtpDescription=function(e,r){let n="";n+="m="+e+" ",n+=r.codecs.length>0?"9":"0",n+=" "+(r.profile||"UDP/TLS/RTP/SAVPF")+" ",n+=r.codecs.map((e=>void 0!==e.preferredPayloadType?e.preferredPayloadType:e.payloadType)).join(" ")+"\r\n",n+="c=IN IP4 0.0.0.0\r\n",n+="a=rtcp:9 IN IP4 0.0.0.0\r\n",r.codecs.forEach((e=>{n+=t.writeRtpMap(e),n+=t.writeFmtp(e),n+=t.writeRtcpFb(e)}));let i=0;return r.codecs.forEach((e=>{e.maxptime>i&&(i=e.maxptime)})),i>0&&(n+="a=maxptime:"+i+"\r\n"),r.headerExtensions&&r.headerExtensions.forEach((e=>{n+=t.writeExtmap(e)})),n},t.parseRtpEncodingParameters=function(e){const r=[],n=t.parseRtpParameters(e),i=-1!==n.fecMechanisms.indexOf("RED"),s=-1!==n.fecMechanisms.indexOf("ULPFEC"),a=t.matchPrefix(e,"a=ssrc:").map((e=>t.parseSsrcMedia(e))).filter((e=>"cname"===e.attribute)),o=a.length>0&&a[0].ssrc;let l;const c=t.matchPrefix(e,"a=ssrc-group:FID").map((e=>e.substring(17).split(" ").map((e=>parseInt(e,10)))));c.length>0&&c[0].length>1&&c[0][0]===o&&(l=c[0][1]),n.codecs.forEach((e=>{if("RTX"===e.name.toUpperCase()&&e.parameters.apt){let t={ssrc:o,codecPayloadType:parseInt(e.parameters.apt,10)};o&&l&&(t.rtx={ssrc:l}),r.push(t),i&&(t=JSON.parse(JSON.stringify(t)),t.fec={ssrc:o,mechanism:s?"red+ulpfec":"red"},r.push(t))}})),0===r.length&&o&&r.push({ssrc:o});let h=t.matchPrefix(e,"b=");return h.length&&(h=0===h[0].indexOf("b=TIAS:")?parseInt(h[0].substring(7),10):0===h[0].indexOf("b=AS:")?1e3*parseInt(h[0].substring(5),10)*.95-16e3:void 0,r.forEach((e=>{e.maxBitrate=h}))),r},t.parseRtcpParameters=function(e){const r={},n=t.matchPrefix(e,"a=ssrc:").map((e=>t.parseSsrcMedia(e))).filter((e=>"cname"===e.attribute))[0];n&&(r.cname=n.value,r.ssrc=n.ssrc);const i=t.matchPrefix(e,"a=rtcp-rsize");r.reducedSize=i.length>0,r.compound=0===i.length;const s=t.matchPrefix(e,"a=rtcp-mux");return r.mux=s.length>0,r},t.writeRtcpParameters=function(e){let t="";return e.reducedSize&&(t+="a=rtcp-rsize\r\n"),e.mux&&(t+="a=rtcp-mux\r\n"),void 0!==e.ssrc&&e.cname&&(t+="a=ssrc:"+e.ssrc+" cname:"+e.cname+"\r\n"),t},t.parseMsid=function(e){let r;const n=t.matchPrefix(e,"a=msid:");if(1===n.length)return r=n[0].substring(7).split(" "),{stream:r[0],track:r[1]};const i=t.matchPrefix(e,"a=ssrc:").map((e=>t.parseSsrcMedia(e))).filter((e=>"msid"===e.attribute));return i.length>0?(r=i[0].value.split(" "),{stream:r[0],track:r[1]}):void 0},t.parseSctpDescription=function(e){const r=t.parseMLine(e),n=t.matchPrefix(e,"a=max-message-size:");let i;n.length>0&&(i=parseInt(n[0].substring(19),10)),isNaN(i)&&(i=65536);const s=t.matchPrefix(e,"a=sctp-port:");if(s.length>0)return{port:parseInt(s[0].substring(12),10),protocol:r.fmt,maxMessageSize:i};const a=t.matchPrefix(e,"a=sctpmap:");if(a.length>0){const e=a[0].substring(10).split(" ");return{port:parseInt(e[0],10),protocol:e[1],maxMessageSize:i}}},t.writeSctpDescription=function(e,t){let r=[];return r="DTLS/SCTP"!==e.protocol?["m="+e.kind+" 9 "+e.protocol+" "+t.protocol+"\r\n","c=IN IP4 0.0.0.0\r\n","a=sctp-port:"+t.port+"\r\n"]:["m="+e.kind+" 9 "+e.protocol+" "+t.port+"\r\n","c=IN IP4 0.0.0.0\r\n","a=sctpmap:"+t.port+" "+t.protocol+" 65535\r\n"],void 0!==t.maxMessageSize&&r.push("a=max-message-size:"+t.maxMessageSize+"\r\n"),r.join("")},t.generateSessionId=function(){return Math.random().toString().substr(2,22)},t.writeSessionBoilerplate=function(e,r,n){let i;const s=void 0!==r?r:2;i=e||t.generateSessionId();return"v=0\r\no="+(n||"thisisadapterortc")+" "+i+" "+s+" IN IP4 127.0.0.1\r\ns=-\r\nt=0 0\r\n"},t.getDirection=function(e,r){const n=t.splitLines(e);for(let e=0;e<n.length;e++)switch(n[e]){case"a=sendrecv":case"a=sendonly":case"a=recvonly":case"a=inactive":return n[e].substring(2)}return r?t.getDirection(r):"sendrecv"},t.getKind=function(e){return t.splitLines(e)[0].split(" ")[0].substring(2)},t.isRejected=function(e){return"0"===e.split(" ",2)[1]},t.parseMLine=function(e){const r=t.splitLines(e)[0].substring(2).split(" ");return{kind:r[0],port:parseInt(r[1],10),protocol:r[2],fmt:r.slice(3).join(" ")}},t.parseOLine=function(e){const r=t.matchPrefix(e,"o=")[0].substring(2).split(" ");return{username:r[0],sessionId:r[1],sessionVersion:parseInt(r[2],10),netType:r[3],addressType:r[4],address:r[5]}},t.isValidSDP=function(e){if("string"!=typeof e||0===e.length)return!1;const r=t.splitLines(e);for(let e=0;e<r.length;e++)if(r[e].length<2||"="!==r[e].charAt(1))return!1;return!0},e.exports=t}(sdp);var t,s,n$1={d:(e,t)=>{for(var r in t)n$1.o(t,r)&&!n$1.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t)},r$1={},e;n$1.d(r$1,{Dz:()=>me,g$:()=>A$1,Lt:()=>R$1,Q9:()=>x$1,qf:()=>L$1,hV:()=>Me,z$:()=>Te,J0:()=>fe,De:()=>ge,$C:()=>ue,al:()=>_$1,_W:()=>W$1,tz:()=>B$1,Nu:()=>Ce,zg:()=>Oe,vp:()=>ne,vU:()=>re,wF:()=>q$1,rv:()=>pe,Nh:()=>ve,ss:()=>Fe,qW:()=>J$1,QL:()=>Y$1,cf:()=>Ie,eM:()=>$$9,Yd:()=>i,iM:()=>p$1,qy:()=>o$1,ce:()=>v$2,sK:()=>oe,Ok:()=>ce,q5:()=>Ee,g:()=>vt,xl:()=>N$1,I:()=>K$1,bx:()=>Q$1,Ib:()=>b$1,Az:()=>M$1,Iw:()=>w$2,qY:()=>k$1,db:()=>P$1,mR:()=>Z$1,Tn:()=>C$1,rV:()=>X$1,gh:()=>V$1,i5:()=>j$1,x_:()=>de,Am:()=>lt$1,eR:()=>F$1,r8:()=>H$1,u3:()=>Ue,vd:()=>O$1,iV:()=>I$1,jZ:()=>U$1,SW:()=>z$2,ZH:()=>G$1,Ni:()=>ht,lh:()=>D$1,bq:()=>f$1,$f:()=>St,eu:()=>se,Ax:()=>te,Mc:()=>ee});class i{static GetStackTrace(){const e=new Error;let t="No Stack Available for this browser";return e.stack&&(t=e.stack.toString().replace(/Error/g,"")),t}static SetLoggerVerbosity(e){null!=this.verboseLogLevel&&(this.verboseLogLevel=e)}static Log(e,t,r){if(r>this.verboseLogLevel)return;const n=`Level: Log\nMsg: ${t}\nCaller: ${e}`;console.log(n)}static Info(e,t,r){if(r>this.verboseLogLevel)return;const n=`Level: Info\nMsg: ${t}`;console.info(n)}static Error(e,t){const r=`Level: Error\nMsg: ${t}\nCaller: ${e}`;console.error(r)}static Warning(e,t){const r=`Level: Warning\nCaller: ${e}\nMsg: ${t}`;console.warn(r)}}i.verboseLogLevel=5,e=t||(t={}),e.LIST_STREAMERS="listStreamers",e.SUBSCRIBE="subscribe",e.UNSUBSCRIBE="unsubscribe",e.ICE_CANDIDATE="iceCandidate",e.OFFER="offer",e.ANSWER="answer",e.DATACHANNELREQUEST="dataChannelRequest",e.SFURECVDATACHANNELREADY="peerDataChannelsReady",e.PONG="pong";class o$1{payload(){return i.Log(i.GetStackTrace(),"Sending => \n"+JSON.stringify(this,void 0,4),6),JSON.stringify(this)}}class a$1 extends o$1{constructor(){super(),this.type=t.LIST_STREAMERS}}class d$1 extends o$1{constructor(e){super(),this.type=t.SUBSCRIBE,this.streamerId=e}}class l$1 extends o$1{constructor(){super(),this.type=t.UNSUBSCRIBE}}class c$1 extends o$1{constructor(e){super(),this.type=t.PONG,this.time=e}}class h$2 extends o$1{constructor(e){super(),this.type=t.OFFER,e&&(this.type=e.type,this.sdp=e.sdp)}}class g$1 extends o$1{constructor(e){super(),this.type=t.ANSWER,e&&(this.type=e.type,this.sdp=e.sdp)}}class u$1 extends o$1{constructor(){super(),this.type=t.DATACHANNELREQUEST}}class m$1 extends o$1{constructor(){super(),this.type=t.SFURECVDATACHANNELREADY}}class S$1{constructor(e){this.type=t.ICE_CANDIDATE,this.candidate=e}payload(){return i.Log(i.GetStackTrace(),"Sending => \n"+JSON.stringify(this,void 0,4),6),JSON.stringify(this)}}!function(e){e.CONFIG="config",e.STREAMER_LIST="streamerList",e.PLAYER_COUNT="playerCount",e.OFFER="offer",e.ANSWER="answer",e.ICE_CANDIDATE="iceCandidate",e.PEER_DATA_CHANNELS="peerDataChannels",e.PING="ping",e.WARNING="warning"}(s||(s={}));class p$1{}class v$2 extends p$1{}class C$1{constructor(){this.FromUEMessageHandlers=new Map}addMessageHandler(e,t){this.FromUEMessageHandlers.set(e,t)}handleMessage(e,t){this.FromUEMessageHandlers.has(e)?this.FromUEMessageHandlers.get(e)(t):i.Error(i.GetStackTrace(),`Message type of ${e} does not have a message handler registered on the frontend - ignoring message.`)}static setupDefaultHandlers(e){e.signallingProtocol.addMessageHandler(s.PING,(t=>{const r=new c$1((new Date).getTime()).payload();i.Log(i.GetStackTrace(),s.PING+": "+t,6),e.webSocket.send(r)})),e.signallingProtocol.addMessageHandler(s.CONFIG,(t=>{i.Log(i.GetStackTrace(),s.CONFIG,6);const r=JSON.parse(t);e.onConfig(r)})),e.signallingProtocol.addMessageHandler(s.STREAMER_LIST,(t=>{i.Log(i.GetStackTrace(),s.STREAMER_LIST,6);const r=JSON.parse(t);e.onStreamerList(r)})),e.signallingProtocol.addMessageHandler(s.PLAYER_COUNT,(e=>{i.Log(i.GetStackTrace(),s.PLAYER_COUNT,6);const t=JSON.parse(e);i.Log(i.GetStackTrace(),"Player Count: "+t.count,6)})),e.signallingProtocol.addMessageHandler(s.ANSWER,(t=>{i.Log(i.GetStackTrace(),s.ANSWER,6);const r=JSON.parse(t);e.onWebRtcAnswer(r)})),e.signallingProtocol.addMessageHandler(s.OFFER,(t=>{i.Log(i.GetStackTrace(),s.OFFER,6);const r=JSON.parse(t);e.onWebRtcOffer(r)})),e.signallingProtocol.addMessageHandler(s.ICE_CANDIDATE,(t=>{i.Log(i.GetStackTrace(),s.ICE_CANDIDATE,6);const r=JSON.parse(t);e.onIceCandidate(r.candidate)})),e.signallingProtocol.addMessageHandler(s.WARNING,(e=>{i.Warning(i.GetStackTrace(),`Warning received: ${e}`)})),e.signallingProtocol.addMessageHandler(s.PEER_DATA_CHANNELS,(t=>{i.Log(i.GetStackTrace(),s.PEER_DATA_CHANNELS,6);const r=JSON.parse(t);e.onWebRtcPeerDataChannels(r)}))}}class f$1{constructor(){this.WS_OPEN_STATE=1,this.onOpen=new EventTarget,this.onClose=new EventTarget,this.signallingProtocol=new C$1,C$1.setupDefaultHandlers(this)}connect(e){i.Log(i.GetStackTrace(),e,6);try{return this.webSocket=new WebSocket(e),this.webSocket.onopen=e=>this.handleOnOpen(e),this.webSocket.onerror=()=>this.handleOnError(),this.webSocket.onclose=e=>this.handleOnClose(e),this.webSocket.onmessage=e=>this.handleOnMessage(e),this.webSocket.onmessagebinary=e=>this.handleOnMessageBinary(e),!0}catch(e){return i.Error(e,e),!1}}handleOnMessageBinary(e){e&&e.data&&e.data.text().then((e=>{const t=new MessageEvent("messageFromBinary",{data:e});this.handleOnMessage(t)})).catch((e=>{i.Error(i.GetStackTrace(),`Failed to parse binary blob from websocket, reason: ${e}`)}))}handleOnMessage(e){if(e.data&&e.data instanceof Blob)return void this.handleOnMessageBinary(e);const t=JSON.parse(e.data);i.Log(i.GetStackTrace(),"received => \n"+JSON.stringify(JSON.parse(e.data),void 0,4),6),this.signallingProtocol.handleMessage(t.type,e.data)}handleOnOpen(e){i.Log(i.GetStackTrace(),"Connected to the signalling server via WebSocket",6),this.onOpen.dispatchEvent(new Event("open"))}handleOnError(){i.Error(i.GetStackTrace(),"WebSocket error")}handleOnClose(e){this.onWebSocketOncloseOverlayMessage(e),i.Log(i.GetStackTrace(),"Disconnected to the signalling server via WebSocket: "+JSON.stringify(e.code)+" - "+e.reason),this.onClose.dispatchEvent(new Event("close"))}requestStreamerList(){const e=new a$1;this.webSocket.send(e.payload())}sendSubscribe(e){const t=new d$1(e);this.webSocket.send(t.payload())}sendUnsubscribe(){const e=new l$1;this.webSocket.send(e.payload())}sendWebRtcOffer(e){const t=new h$2(e);this.webSocket.send(t.payload())}sendWebRtcAnswer(e){const t=new g$1(e);this.webSocket.send(t.payload())}sendWebRtcDatachannelRequest(){const e=new u$1;this.webSocket.send(e.payload())}sendSFURecvDataChannelReady(){const e=new m$1;this.webSocket.send(e.payload())}sendIceCandidate(e){if(i.Log(i.GetStackTrace(),"Sending Ice Candidate"),this.webSocket&&this.webSocket.readyState===this.WS_OPEN_STATE){const t=new S$1(e);this.webSocket.send(t.payload())}}close(){var e;null===(e=this.webSocket)||void 0===e||e.close()}onWebSocketOncloseOverlayMessage(e){}onConfig(e){}onStreamerList(e){}onIceCandidate(e){}onWebRtcAnswer(e){}onWebRtcOffer(e){}onWebRtcPeerDataChannels(e){}}class T$1{constructor(e){this.videoElementProvider=e,this.audioElement=document.createElement("Audio")}handleOnTrack(e){i.Log(i.GetStackTrace(),"handleOnTrack "+JSON.stringify(e.streams),6);const t=this.videoElementProvider.getVideoElement();if(e.track&&i.Log(i.GetStackTrace(),"Got track - "+e.track.kind+" id="+e.track.id+" readyState="+e.track.readyState,6),"audio"!=e.track.kind)return"video"==e.track.kind&&t.srcObject!==e.streams[0]?(t.srcObject=e.streams[0],void i.Log(i.GetStackTrace(),"Set video source from video track ontrack.")):void 0;this.CreateAudioTrack(e.streams[0])}CreateAudioTrack(e){const t=this.videoElementProvider.getVideoElement();t.srcObject!=e&&t.srcObject&&t.srcObject!==e&&(this.audioElement.srcObject=e,i.Log(i.GetStackTrace(),"Created new audio element to play separate audio stream."))}}class E$1{constructor(e){this.freezeFrameHeight=0,this.freezeFrameWidth=0,this.rootDiv=e,this.rootElement=document.createElement("div"),this.rootElement.id="freezeFrame",this.rootElement.style.display="none",this.rootElement.style.pointerEvents="none",this.rootElement.style.position="absolute",this.rootElement.style.zIndex="20",this.imageElement=document.createElement("img"),this.imageElement.style.position="absolute",this.rootElement.appendChild(this.imageElement),this.rootDiv.appendChild(this.rootElement)}setElementForShow(){this.rootElement.style.display="block"}setElementForHide(){this.rootElement.style.display="none"}updateImageElementSource(e){const t=btoa(e.reduce(((e,t)=>e+String.fromCharCode(t)),""));this.imageElement.src="data:image/jpeg;base64,"+t}setDimensionsFromElementAndResize(){this.freezeFrameHeight=this.imageElement.naturalHeight,this.freezeFrameWidth=this.imageElement.naturalWidth,this.resize()}resize(){if(0!==this.freezeFrameWidth&&0!==this.freezeFrameHeight){let e=0,t=0,r=0,n=0;const i=this.rootDiv.clientWidth/this.rootDiv.clientHeight,s=this.freezeFrameWidth/this.freezeFrameHeight;i<s?(e=this.rootDiv.clientWidth,t=Math.floor(this.rootDiv.clientWidth/s),r=Math.floor(.5*(this.rootDiv.clientHeight-t)),n=0):(e=Math.floor(this.rootDiv.clientHeight*s),t=this.rootDiv.clientHeight,r=0,n=Math.floor(.5*(this.rootDiv.clientWidth-e))),this.rootElement.style.width=this.rootDiv.offsetWidth+"px",this.rootElement.style.height=this.rootDiv.offsetHeight+"px",this.rootElement.style.left="0px",this.rootElement.style.top="0px",this.imageElement.style.width=e+"px",this.imageElement.style.height=t+"px",this.imageElement.style.left=n+"px",this.imageElement.style.top=r+"px"}}}class y$1{constructor(e){this.receiving=!1,this.size=0,this.jpeg=void 0,this.valid=!1,this.freezeFrameDelay=50,this.freezeFrame=new E$1(e)}showFreezeFrame(){this.valid&&this.freezeFrame.setElementForShow()}hideFreezeFrame(){this.valid=!1,this.freezeFrame.setElementForHide()}updateFreezeFrameAndShow(e,t){this.freezeFrame.updateImageElementSource(e),this.freezeFrame.imageElement.onload=()=>{this.freezeFrame.setDimensionsFromElementAndResize(),t()}}processFreezeFrameMessage(e,t){this.receiving||(this.receiving=!0,this.valid=!1,this.size=0,this.jpeg=void 0),this.size=new DataView(e.slice(1,5).buffer).getInt32(0,!0);const r=e.slice(5);if(this.jpeg){const e=new Uint8Array(this.jpeg.length+r.length);e.set(this.jpeg,0),e.set(r,this.jpeg.length),this.jpeg=e}else this.jpeg=r,this.receiving=!0,i.Log(i.GetStackTrace(),`received first chunk of freeze frame: ${this.jpeg.length}/${this.size}`,6);this.jpeg.length===this.size?(this.receiving=!1,this.valid=!0,i.Log(i.GetStackTrace(),`received complete freeze frame ${this.size}`,6),this.updateFreezeFrameAndShow(this.jpeg,t)):this.jpeg.length>this.size&&(i.Error(i.GetStackTrace(),`received bigger freeze frame than advertised: ${this.jpeg.length}/${this.size}`),this.jpeg=void 0,this.receiving=!1)}}class b$1{constructor(e,t,r,n,i=(()=>{})){this.onChange=i,this.onChangeEmit=()=>{},this.id=e,this.description=r,this.label=t,this.value=n}set label(e){this._label=e,this.onChangeEmit(this._value)}get label(){return this._label}get value(){return this._value}set value(e){this._value=e,this.onChange(this._value,this),this.onChangeEmit(this._value)}}class M$1 extends b$1{constructor(e,t,r,n,i,s=(()=>{})){super(e,t,r,n,s);const a=new URLSearchParams(window.location.search);if(i&&a.has(this.id)){const e=this.getUrlParamFlag();this.flag=e}else this.flag=n;this.useUrlParams=i}getUrlParamFlag(){const e=new URLSearchParams(window.location.search);return!!e.has(this.id)&&"false"!==e.get(this.id)&&"False"!==e.get(this.id)}updateURLParams(){if(this.useUrlParams){const e=new URLSearchParams(window.location.search);!0===this.flag?e.set(this.id,"true"):e.set(this.id,"false"),window.history.replaceState({},"",""!==e.toString()?`${location.pathname}?${e}`:`${location.pathname}`)}}enable(){this.flag=!0}get flag(){return!!this.value}set flag(e){this.value=e}}class w$2 extends b$1{constructor(e,t,r,n,i,s,a,o=(()=>{})){super(e,t,r,s,o),this._min=n,this._max=i;const l=new URLSearchParams(window.location.search);if(a&&l.has(this.id)){const e=Number.parseInt(l.get(this.id));this.number=Number.isNaN(e)?s:e}else this.number=s;this.useUrlParams=a}updateURLParams(){if(this.useUrlParams){const e=new URLSearchParams(window.location.search);e.set(this.id,this.number.toString()),window.history.replaceState({},"",""!==e.toString()?`${location.pathname}?${e}`:`${location.pathname}`)}}set number(e){this.value=this.clamp(e)}get number(){return this.value}clamp(e){return Math.max(Math.min(this._max,e),this._min)}get min(){return this._min}get max(){return this._max}addOnChangedListener(e){this.onChange=e}}class P$1 extends b$1{constructor(e,t,r,n,i,s=(()=>{})){super(e,t,r,n,s);const a=new URLSearchParams(window.location.search);if(i&&a.has(this.id)){const e=this.getUrlParamText();this.text=e}else this.text=n;this.useUrlParams=i}getUrlParamText(){var e;const t=new URLSearchParams(window.location.search);return t.has(this.id)&&null!==(e=t.get(this.id))&&void 0!==e?e:""}updateURLParams(){if(this.useUrlParams){const e=new URLSearchParams(window.location.search);e.set(this.id,this.text),window.history.replaceState({},"",""!==e.toString()?`${location.pathname}?${e}`:`${location.pathname}`)}}get text(){return this.value}set text(e){this.value=e}}class k$1 extends b$1{constructor(e,t,r,n,i,s,a=(()=>{})){super(e,t,r,[n,n],a),this.options=i;const o=new URLSearchParams(window.location.search),l=s&&o.has(this.id)?this.getUrlParamText():n;this.selected=l,this.useUrlParams=s}getUrlParamText(){var e;const t=new URLSearchParams(window.location.search);return t.has(this.id)&&null!==(e=t.get(this.id))&&void 0!==e?e:""}updateURLParams(){if(this.useUrlParams){const e=new URLSearchParams(window.location.search);e.set(this.id,this.selected),window.history.replaceState({},"",""!==e.toString()?`${location.pathname}?${e}`:`${location.pathname}`)}}addOnChangedListener(e){this.onChange=e}get options(){return this._options}set options(e){this._options=e,this.onChangeEmit(this.selected)}get selected(){return this.value}set selected(e){const t=this.options.filter((t=>-1!==t.indexOf(e)));t.length&&(this.value=t[0])}}class R$1 extends Event{constructor(e){super("afkWarningActivate"),this.data=e}}class L$1 extends Event{constructor(e){super("afkWarningUpdate"),this.data=e}}class x$1 extends Event{constructor(){super("afkWarningDeactivate")}}class A$1 extends Event{constructor(){super("afkTimedOut")}}class F$1 extends Event{constructor(e){super("videoEncoderAvgQP"),this.data=e}}class D$1 extends Event{constructor(){super("webRtcSdp")}}class O$1 extends Event{constructor(){super("webRtcAutoConnect")}}class U$1 extends Event{constructor(){super("webRtcConnecting")}}class I$1 extends Event{constructor(){super("webRtcConnected")}}class G$1 extends Event{constructor(){super("webRtcFailed")}}class z$2 extends Event{constructor(e){super("webRtcDisconnected"),this.data=e}}class B$1 extends Event{constructor(e){super("dataChannelOpen"),this.data=e}}class _$1 extends Event{constructor(e){super("dataChannelClose"),this.data=e}}class W$1 extends Event{constructor(e){super("dataChannelError"),this.data=e}}class H$1 extends Event{constructor(){super("videoInitialized")}}class V$1 extends Event{constructor(){super("streamLoading")}}class N$1 extends Event{constructor(e){super("playStreamError"),this.data=e}}class K$1 extends Event{constructor(){super("playStream")}}class Q$1 extends Event{constructor(e){super("playStreamRejected"),this.data=e}}class $$9 extends Event{constructor(e){super("loadFreezeFrame"),this.data=e}}class q$1 extends Event{constructor(){super("hideFreezeFrame")}}class X$1 extends Event{constructor(e){super("statsReceived"),this.data=e}}class j$1 extends Event{constructor(e){super("streamerListMessage"),this.data=e}}class Y$1 extends Event{constructor(e){super("latencyTestResult"),this.data=e}}class J$1 extends Event{constructor(e){super("initialSettings"),this.data=e}}class Z$1 extends Event{constructor(e){super("settingsChanged"),this.data=e}}class ee extends Event{constructor(){super("xrSessionStarted")}}class te extends Event{constructor(){super("xrSessionEnded")}}class se extends Event{constructor(e){super("xrFrame"),this.data=e}}class ne extends EventTarget{dispatchEvent(e){return super.dispatchEvent(e)}addEventListener(e,t){super.addEventListener(e,t)}removeEventListener(e,t){super.removeEventListener(e,t)}}class re{}re.AutoConnect="AutoConnect",re.AutoPlayVideo="AutoPlayVideo",re.AFKDetection="TimeoutIfIdle",re.BrowserSendOffer="OfferToReceive",re.HoveringMouseMode="HoveringMouse",re.ForceMonoAudio="ForceMonoAudio",re.ForceTURN="ForceTURN",re.FakeMouseWithTouches="FakeMouseWithTouches",re.IsQualityController="ControlsQuality",re.MatchViewportResolution="MatchViewportRes",re.PreferSFU="preferSFU",re.StartVideoMuted="StartVideoMuted",re.SuppressBrowserKeys="SuppressBrowserKeys",re.UseMic="UseMic",re.KeyboardInput="KeyboardInput",re.MouseInput="MouseInput",re.TouchInput="TouchInput",re.GamepadInput="GamepadInput",re.XRControllerInput="XRControllerInput";const ie=e=>Object.getOwnPropertyNames(re).some((t=>re[t]===e));class oe{}oe.AFKTimeoutSecs="AFKTimeout",oe.MinQP="MinQP",oe.MaxQP="MaxQP",oe.WebRTCFPS="WebRTCFPS",oe.WebRTCMinBitrate="WebRTCMinBitrate",oe.WebRTCMaxBitrate="WebRTCMaxBitrate";const ae=e=>Object.getOwnPropertyNames(oe).some((t=>oe[t]===e));class de{}de.SignallingServerUrl="ss";const le=e=>Object.getOwnPropertyNames(de).some((t=>de[t]===e));class ce{}ce.PreferredCodec="PreferredCodec",ce.StreamerId="StreamerId";const he=e=>Object.getOwnPropertyNames(ce).some((t=>ce[t]===e));class ge{constructor(e={}){this.flags=new Map,this.numericParameters=new Map,this.textParameters=new Map,this.optionParameters=new Map;const{initialSettings:t,useUrlParams:r}=e;this._useUrlParams=!!r,this.populateDefaultSettings(this._useUrlParams),t&&this.setSettings(t)}get useUrlParams(){return this._useUrlParams}populateDefaultSettings(e){this.textParameters.set(de.SignallingServerUrl,new P$1(de.SignallingServerUrl,"Signalling url","Url of the signalling server",("https:"===location.protocol?"wss://":"ws://")+window.location.hostname+("80"===window.location.port||""===window.location.port?"":`:${window.location.port}`),e)),this.optionParameters.set(ce.StreamerId,new k$1(ce.StreamerId,"Streamer ID","The ID of the streamer to stream.","",[],e)),this.optionParameters.set(ce.PreferredCodec,new k$1(ce.PreferredCodec,"Preferred Codec","The preferred codec to be used during codec negotiation","H264 level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=42e01f",function(){const e=[];if(!RTCRtpReceiver.getCapabilities)return e.push("Only available on Chrome"),e;const t=/(VP\d|H26\d|AV1).*/;return RTCRtpReceiver.getCapabilities("video").codecs.forEach((r=>{const n=r.mimeType.split("/")[1]+" "+(r.sdpFmtpLine||"");null!==t.exec(n)&&e.push(n)})),e}(),e)),this.flags.set(re.AutoConnect,new M$1(re.AutoConnect,"Auto connect to stream","Whether we should attempt to auto connect to the signalling server or show a click to start prompt.",!1,e)),this.flags.set(re.AutoPlayVideo,new M$1(re.AutoPlayVideo,"Auto play video","When video is ready automatically start playing it as opposed to showing a play button.",!0,e)),this.flags.set(re.BrowserSendOffer,new M$1(re.BrowserSendOffer,"Browser send offer","Browser will initiate the WebRTC handshake by sending the offer to the streamer",!1,e)),this.flags.set(re.UseMic,new M$1(re.UseMic,"Use microphone","Make browser request microphone access and open an input audio track.",!1,e)),this.flags.set(re.StartVideoMuted,new M$1(re.StartVideoMuted,"Start video muted","Video will start muted if true.",!1,e)),this.flags.set(re.SuppressBrowserKeys,new M$1(re.SuppressBrowserKeys,"Suppress browser keys","Suppress certain browser keys that we use in UE, for example F5 to show shader complexity instead of refresh the page.",!0,e)),this.flags.set(re.PreferSFU,new M$1(re.PreferSFU,"Prefer SFU","Try to connect to the SFU instead of P2P.",!1,e)),this.flags.set(re.IsQualityController,new M$1(re.IsQualityController,"Is quality controller?","True if this peer controls stream quality",!0,e)),this.flags.set(re.ForceMonoAudio,new M$1(re.ForceMonoAudio,"Force mono audio","Force browser to request mono audio in the SDP",!1,e)),this.flags.set(re.ForceTURN,new M$1(re.ForceTURN,"Force TURN","Only generate TURN/Relayed ICE candidates.",!1,e)),this.flags.set(re.AFKDetection,new M$1(re.AFKDetection,"AFK if idle","Timeout the experience if user is AFK for a period.",!1,e)),this.flags.set(re.MatchViewportResolution,new M$1(re.MatchViewportResolution,"Match viewport resolution","Pixel Streaming will be instructed to dynamically resize the video stream to match the size of the video element.",!1,e)),this.flags.set(re.HoveringMouseMode,new M$1(re.HoveringMouseMode,"Control Scheme: Locked Mouse","Either locked mouse, where the pointer is consumed by the video and locked to it, or hovering mouse, where the mouse is not consumed.",!1,e,((e,t)=>{t.label=`Control Scheme: ${e?"Hovering":"Locked"} Mouse`}))),this.flags.set(re.FakeMouseWithTouches,new M$1(re.FakeMouseWithTouches,"Fake mouse with touches","A single finger touch is converted into a mouse event. This allows a non-touch application to be controlled partially via a touch device.",!1,e)),this.flags.set(re.KeyboardInput,new M$1(re.KeyboardInput,"Keyboard input","If enabled, send keyboard events to streamer",!0,e)),this.flags.set(re.MouseInput,new M$1(re.MouseInput,"Mouse input","If enabled, send mouse events to streamer",!0,e)),this.flags.set(re.TouchInput,new M$1(re.TouchInput,"Touch input","If enabled, send touch events to streamer",!0,e)),this.flags.set(re.GamepadInput,new M$1(re.GamepadInput,"Gamepad input","If enabled, send gamepad events to streamer",!0,e)),this.flags.set(re.XRControllerInput,new M$1(re.XRControllerInput,"XR controller input","If enabled, send XR controller events to streamer",!0,e)),this.numericParameters.set(oe.AFKTimeoutSecs,new w$2(oe.AFKTimeoutSecs,"AFK timeout","The time (in seconds) it takes for the application to time out if AFK timeout is enabled.",0,600,120,e)),this.numericParameters.set(oe.MinQP,new w$2(oe.MinQP,"Min QP","The lower bound for the quantization parameter (QP) of the encoder. 0 = Best quality, 51 = worst quality.",0,51,0,e)),this.numericParameters.set(oe.MaxQP,new w$2(oe.MaxQP,"Max QP","The upper bound for the quantization parameter (QP) of the encoder. 0 = Best quality, 51 = worst quality.",0,51,51,e)),this.numericParameters.set(oe.WebRTCFPS,new w$2(oe.WebRTCFPS,"Max FPS","The maximum FPS that WebRTC will try to transmit frames at.",1,999,60,e)),this.numericParameters.set(oe.WebRTCMinBitrate,new w$2(oe.WebRTCMinBitrate,"Min Bitrate (kbps)","The minimum bitrate that WebRTC should use.",0,5e5,0,e)),this.numericParameters.set(oe.WebRTCMaxBitrate,new w$2(oe.WebRTCMaxBitrate,"Max Bitrate (kbps)","The maximum bitrate that WebRTC should use.",0,5e5,0,e))}_addOnNumericSettingChangedListener(e,t){this.numericParameters.has(e)&&this.numericParameters.get(e).addOnChangedListener(t)}_addOnOptionSettingChangedListener(e,t){this.optionParameters.has(e)&&this.optionParameters.get(e).addOnChangedListener(t)}getNumericSettingValue(e){if(this.numericParameters.has(e))return this.numericParameters.get(e).number;throw new Error(`There is no numeric setting with the id of ${e}`)}getTextSettingValue(e){if(this.textParameters.has(e))return this.textParameters.get(e).value;throw new Error(`There is no numeric setting with the id of ${e}`)}setNumericSetting(e,t){if(!this.numericParameters.has(e))throw new Error(`There is no numeric setting with the id of ${e}`);this.numericParameters.get(e).number=t}_addOnSettingChangedListener(e,t){this.flags.has(e)&&(this.flags.get(e).onChange=t)}_addOnTextSettingChangedListener(e,t){this.textParameters.has(e)&&(this.textParameters.get(e).onChange=t)}getSettingOption(e){return this.optionParameters.get(e)}isFlagEnabled(e){return this.flags.get(e).flag}setFlagEnabled(e,t){this.flags.has(e)?this.flags.get(e).flag=t:i.Warning(i.GetStackTrace(),`Cannot toggle flag called ${e} - it does not exist in the Config.flags map.`)}setTextSetting(e,t){this.textParameters.has(e)?this.textParameters.get(e).text=t:i.Warning(i.GetStackTrace(),`Cannot set text setting called ${e} - it does not exist in the Config.textParameters map.`)}setOptionSettingOptions(e,t){this.optionParameters.has(e)?this.optionParameters.get(e).options=t:i.Warning(i.GetStackTrace(),`Cannot set text setting called ${e} - it does not exist in the Config.optionParameters map.`)}setOptionSettingValue(e,t){this.optionParameters.has(e)?this.optionParameters.get(e).selected=t:i.Warning(i.GetStackTrace(),`Cannot set text setting called ${e} - it does not exist in the Config.enumParameters map.`)}setFlagLabel(e,t){this.flags.has(e)?this.flags.get(e).label=t:i.Warning(i.GetStackTrace(),`Cannot set label for flag called ${e} - it does not exist in the Config.flags map.`)}setSettings(e){for(const t of Object.keys(e))ie(t)?this.setFlagEnabled(t,e[t]):ae(t)?this.setNumericSetting(t,e[t]):le(t)?this.setTextSetting(t,e[t]):he(t)&&this.setOptionSettingValue(t,e[t])}getSettings(){const e={};for(const[t,r]of this.flags.entries())e[t]=r.flag;for(const[t,r]of this.numericParameters.entries())e[t]=r.number;for(const[t,r]of this.textParameters.entries())e[t]=r.text;for(const[t,r]of this.optionParameters.entries())e[t]=r.selected;return e}getFlags(){return Array.from(this.flags.values())}getTextSettings(){return Array.from(this.textParameters.values())}getNumericSettings(){return Array.from(this.numericParameters.values())}getOptionSettings(){return Array.from(this.optionParameters.values())}_registerOnChangeEvents(e){for(const t of this.flags.keys()){const r=this.flags.get(t);r&&(r.onChangeEmit=t=>e.dispatchEvent(new Z$1({id:r.id,type:"flag",value:t,target:r})))}for(const t of this.numericParameters.keys()){const r=this.numericParameters.get(t);r&&(r.onChangeEmit=t=>e.dispatchEvent(new Z$1({id:r.id,type:"number",value:t,target:r})))}for(const t of this.textParameters.keys()){const r=this.textParameters.get(t);r&&(r.onChangeEmit=t=>e.dispatchEvent(new Z$1({id:r.id,type:"text",value:t,target:r})))}for(const t of this.optionParameters.keys()){const r=this.optionParameters.get(t);r&&(r.onChangeEmit=t=>e.dispatchEvent(new Z$1({id:r.id,type:"option",value:t,target:r})))}}}var ue;!function(e){e[e.LockedMouse=0]="LockedMouse",e[e.HoveringMouse=1]="HoveringMouse"}(ue||(ue={}));class me{constructor(e,t,r){this.closeTimeout=10,this.active=!1,this.countdownActive=!1,this.warnTimer=void 0,this.countDown=0,this.countDownTimer=void 0,this.config=e,this.pixelStreaming=t,this.onDismissAfk=r,this.onAFKTimedOutCallback=()=>{console.log("AFK timed out, did you want to override this callback?")}}onAfkClick(){clearInterval(this.countDownTimer),(this.active||this.countdownActive)&&(this.startAfkWarningTimer(),this.pixelStreaming.dispatchEvent(new x$1))}startAfkWarningTimer(){this.config.getNumericSettingValue(oe.AFKTimeoutSecs)>0&&this.config.isFlagEnabled(re.AFKDetection)?this.active=!0:this.active=!1,this.resetAfkWarningTimer()}stopAfkWarningTimer(){this.active=!1,this.countdownActive=!1,clearTimeout(this.warnTimer),clearInterval(this.countDownTimer)}pauseAfkWarningTimer(){this.active=!1}resetAfkWarningTimer(){this.active&&this.config.isFlagEnabled(re.AFKDetection)&&(clearTimeout(this.warnTimer),this.warnTimer=setTimeout((()=>this.activateAfkEvent()),1e3*this.config.getNumericSettingValue(oe.AFKTimeoutSecs)))}activateAfkEvent(){this.pauseAfkWarningTimer(),this.pixelStreaming.dispatchEvent(new R$1({countDown:this.countDown,dismissAfk:this.onDismissAfk})),this.countDown=this.closeTimeout,this.countdownActive=!0,this.pixelStreaming.dispatchEvent(new L$1({countDown:this.countDown})),this.config.isFlagEnabled(re.HoveringMouseMode)||document.exitPointerLock&&document.exitPointerLock(),this.countDownTimer=setInterval((()=>{this.countDown--,0==this.countDown?(this.pixelStreaming.dispatchEvent(new A$1),this.onAFKTimedOutCallback(),i.Log(i.GetStackTrace(),"You have been disconnected due to inactivity"),this.stopAfkWarningTimer()):this.pixelStreaming.dispatchEvent(new L$1({countDown:this.countDown}))}),1e3)}}class Se{constructor(){this.isReceivingFreezeFrame=!1}getDataChannelInstance(){return this}createDataChannel(e,t,r){this.peerConnection=e,this.label=t,this.datachannelOptions=r,null==r&&(this.datachannelOptions={},this.datachannelOptions.ordered=!0),this.dataChannel=this.peerConnection.createDataChannel(this.label,this.datachannelOptions),this.setupDataChannel()}setupDataChannel(){this.dataChannel.binaryType="arraybuffer",this.dataChannel.onopen=e=>this.handleOnOpen(e),this.dataChannel.onclose=e=>this.handleOnClose(e),this.dataChannel.onmessage=e=>this.handleOnMessage(e),this.dataChannel.onerror=e=>this.handleOnError(e)}handleOnOpen(e){var t;i.Log(i.GetStackTrace(),`Data Channel (${this.label}) opened.`,7),this.onOpen(null===(t=this.dataChannel)||void 0===t?void 0:t.label,e)}handleOnClose(e){var t;i.Log(i.GetStackTrace(),`Data Channel (${this.label}) closed.`,7),this.onClose(null===(t=this.dataChannel)||void 0===t?void 0:t.label,e)}handleOnMessage(e){i.Log(i.GetStackTrace(),`Data Channel (${this.label}) message: ${e}`,8)}handleOnError(e){var t;i.Log(i.GetStackTrace(),`Data Channel (${this.label}) error: ${e}`,7),this.onError(null===(t=this.dataChannel)||void 0===t?void 0:t.label,e)}onOpen(e,t){}onClose(e,t){}onError(e,t){}}class pe{}class ve{}class Ce{}class fe{}class Te{}class Ee{}class ye{}class be{}class Me{constructor(){this.inboundVideoStats=new ve,this.inboundAudioStats=new pe,this.candidatePair=new Te,this.DataChannelStats=new Ce,this.outBoundVideoStats=new Ee,this.sessionStats=new ye,this.streamStats=new be,this.codecs=new Map}processStats(e){this.localCandidates=new Array,this.remoteCandidates=new Array,e.forEach((e=>{switch(e.type){case"candidate-pair":this.handleCandidatePair(e);break;case"certificate":case"media-source":case"outbound-rtp":case"peer-connection":case"remote-inbound-rtp":case"transport":break;case"codec":this.handleCodec(e);break;case"data-channel":this.handleDataChannel(e);break;case"inbound-rtp":this.handleInBoundRTP(e);break;case"local-candidate":this.handleLocalCandidate(e);break;case"remote-candidate":this.handleRemoteCandidate(e);break;case"remote-outbound-rtp":this.handleRemoteOutBound(e);break;case"track":this.handleTrack(e);break;case"stream":this.handleStream(e);break;default:i.Error(i.GetStackTrace(),"unhandled Stat Type"),i.Log(i.GetStackTrace(),e)}}))}handleStream(e){this.streamStats=e}handleCandidatePair(e){this.candidatePair.bytesReceived=e.bytesReceived,this.candidatePair.bytesSent=e.bytesSent,this.candidatePair.localCandidateId=e.localCandidateId,this.candidatePair.remoteCandidateId=e.remoteCandidateId,this.candidatePair.nominated=e.nominated,this.candidatePair.readable=e.readable,this.candidatePair.selected=e.selected,this.candidatePair.writable=e.writable,this.candidatePair.state=e.state,this.candidatePair.currentRoundTripTime=e.currentRoundTripTime}handleDataChannel(e){this.DataChannelStats.bytesReceived=e.bytesReceived,this.DataChannelStats.bytesSent=e.bytesSent,this.DataChannelStats.dataChannelIdentifier=e.dataChannelIdentifier,this.DataChannelStats.id=e.id,this.DataChannelStats.label=e.label,this.DataChannelStats.messagesReceived=e.messagesReceived,this.DataChannelStats.messagesSent=e.messagesSent,this.DataChannelStats.protocol=e.protocol,this.DataChannelStats.state=e.state,this.DataChannelStats.timestamp=e.timestamp}handleLocalCandidate(e){const t=new fe;t.label="local-candidate",t.address=e.address,t.port=e.port,t.protocol=e.protocol,t.candidateType=e.candidateType,t.id=e.id,this.localCandidates.push(t)}handleRemoteCandidate(e){const t=new fe;t.label="local-candidate",t.address=e.address,t.port=e.port,t.protocol=e.protocol,t.id=e.id,t.candidateType=e.candidateType,this.remoteCandidates.push(t)}handleInBoundRTP(e){switch(e.kind){case"video":this.inboundVideoStats=e,null!=this.lastVideoStats&&(this.inboundVideoStats.bitrate=8*(this.inboundVideoStats.bytesReceived-this.lastVideoStats.bytesReceived)/(this.inboundVideoStats.timestamp-this.lastVideoStats.timestamp),this.inboundVideoStats.bitrate=Math.floor(this.inboundVideoStats.bitrate)),this.lastVideoStats=Object.assign({},this.inboundVideoStats);break;case"audio":this.inboundAudioStats=e,null!=this.lastAudioStats&&(this.inboundAudioStats.bitrate=8*(this.inboundAudioStats.bytesReceived-this.lastAudioStats.bytesReceived)/(this.inboundAudioStats.timestamp-this.lastAudioStats.timestamp),this.inboundAudioStats.bitrate=Math.floor(this.inboundAudioStats.bitrate)),this.lastAudioStats=Object.assign({},this.inboundAudioStats);break;default:i.Log(i.GetStackTrace(),"Kind is not handled")}}handleRemoteOutBound(e){"video"===e.kind&&(this.outBoundVideoStats.bytesSent=e.bytesSent,this.outBoundVideoStats.id=e.id,this.outBoundVideoStats.localId=e.localId,this.outBoundVideoStats.packetsSent=e.packetsSent,this.outBoundVideoStats.remoteTimestamp=e.remoteTimestamp,this.outBoundVideoStats.timestamp=e.timestamp)}handleTrack(e){"track"!==e.type||"video_label"!==e.trackIdentifier&&"video"!==e.kind||(this.inboundVideoStats.framesDropped=e.framesDropped,this.inboundVideoStats.framesReceived=e.framesReceived,this.inboundVideoStats.frameHeight=e.frameHeight,this.inboundVideoStats.frameWidth=e.frameWidth)}handleCodec(e){const t=e.id,r=`${e.mimeType.replace("video/","").replace("audio/","")}${e.sdpFmtpLine?` ${e.sdpFmtpLine}`:""}`;this.codecs.set(t,r)}handleSessionStatistics(e,t,r){const n=Date.now()-e;this.sessionStats.runTime=new Date(n).toISOString().substr(11,8).toString();const i=null===t?"Not sent yet":t?"true":"false";this.sessionStats.controlsStreamInput=i,this.sessionStats.videoEncoderAvgQP=r}isNumber(e){return"number"==typeof e&&isFinite(e)}}const we=(Pe={parseRtpParameters:()=>sdp.exports.parseRtpParameters,splitSections:()=>sdp.exports.splitSections},ke={},n$1.d(ke,Pe),ke);var Pe,ke,Re,Le,xe=function(e,t,r,n){return new(r||(r=Promise))((function(i,s){function a(e){try{l(n.next(e))}catch(e){s(e)}}function o(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,o)}l((n=n.apply(e,t||[])).next())}))};class Ae{constructor(e,t,r){this.config=t,this.createPeerConnection(e,r)}createPeerConnection(e,t){this.config.isFlagEnabled(re.ForceTURN)&&(e.iceTransportPolicy="relay",i.Log(i.GetStackTrace(),"Forcing TURN usage by setting ICE Transport Policy in peer connection config.")),this.peerConnection=new RTCPeerConnection(e),this.peerConnection.onsignalingstatechange=e=>this.handleSignalStateChange(e),this.peerConnection.oniceconnectionstatechange=e=>this.handleIceConnectionStateChange(e),this.peerConnection.onicegatheringstatechange=e=>this.handleIceGatheringStateChange(e),this.peerConnection.ontrack=e=>this.handleOnTrack(e),this.peerConnection.onicecandidate=e=>this.handleIceCandidate(e),this.peerConnection.ondatachannel=e=>this.handleDataChannel(e),this.aggregatedStats=new Me,this.preferredCodec=t,this.updateCodecSelection=!0}createOffer(e,t){return xe(this,void 0,void 0,(function*(){i.Log(i.GetStackTrace(),"Create Offer",6);const r="localhost"===location.hostname||"127.0.0.1"===location.hostname,n="https:"===location.protocol;let s=t.isFlagEnabled(re.UseMic);!s||r||n||(s=!1,i.Error(i.GetStackTrace(),"Microphone access in the browser will not work if you are not on HTTPS or localhost. Disabling mic access."),i.Error(i.GetStackTrace(),"For testing you can enable HTTP microphone access Chrome by visiting chrome://flags/ and enabling 'unsafely-treat-insecure-origin-as-secure'")),this.setupTransceiversAsync(s).finally((()=>{var t;null===(t=this.peerConnection)||void 0===t||t.createOffer(e).then((e=>{var t;this.showTextOverlayConnecting(),e.sdp=this.mungeSDP(e.sdp,s),null===(t=this.peerConnection)||void 0===t||t.setLocalDescription(e),this.onSendWebRTCOffer(e)})).catch((()=>{this.showTextOverlaySetupFailure()}))}))}))}receiveOffer(e,t){var r;return xe(this,void 0,void 0,(function*(){i.Log(i.GetStackTrace(),"Receive Offer",6),null===(r=this.peerConnection)||void 0===r||r.setRemoteDescription(e).then((()=>{const e="localhost"===location.hostname||"127.0.0.1"===location.hostname,r="https:"===location.protocol;let n=t.isFlagEnabled(re.UseMic);!n||e||r||(n=!1,i.Error(i.GetStackTrace(),"Microphone access in the browser will not work if you are not on HTTPS or localhost. Disabling mic access."),i.Error(i.GetStackTrace(),"For testing you can enable HTTP microphone access Chrome by visiting chrome://flags/ and enabling 'unsafely-treat-insecure-origin-as-secure'")),this.setupTransceiversAsync(n).finally((()=>{var e;null===(e=this.peerConnection)||void 0===e||e.createAnswer().then((e=>{var t;return e.sdp=this.mungeSDP(e.sdp,n),null===(t=this.peerConnection)||void 0===t?void 0:t.setLocalDescription(e)})).then((()=>{var e;this.onSendWebRTCAnswer(null===(e=this.peerConnection)||void 0===e?void 0:e.currentLocalDescription)})).catch((()=>{i.Error(i.GetStackTrace(),"createAnswer() failed")}))}))})),this.config.setOptionSettingOptions(ce.PreferredCodec,this.parseAvailableCodecs(e).filter((e=>this.config.getSettingOption(ce.PreferredCodec).options.includes(e))))}))}receiveAnswer(e){var t;null===(t=this.peerConnection)||void 0===t||t.setRemoteDescription(e),this.config.setOptionSettingOptions(ce.PreferredCodec,this.parseAvailableCodecs(e).filter((e=>this.config.getSettingOption(ce.PreferredCodec).options.includes(e))))}generateStats(){var e;null===(e=this.peerConnection)||void 0===e||e.getStats(null).then((e=>{this.aggregatedStats.processStats(e),this.onVideoStats(this.aggregatedStats),this.updateCodecSelection&&this.config.setOptionSettingValue(ce.PreferredCodec,this.aggregatedStats.codecs.get(this.aggregatedStats.inboundVideoStats.codecId))}))}close(){this.peerConnection&&(this.peerConnection.close(),this.peerConnection=null)}mungeSDP(e,t){const r=e;r.replace(/(a=fmtp:\d+ .*level-asymmetry-allowed=.*)\r\n/gm,"$1;x-google-start-bitrate=10000;x-google-max-bitrate=100000\r\n");let n="";return n+="maxaveragebitrate=510000;",t&&(n+="sprop-maxcapturerate=48000;"),n+=this.config.isFlagEnabled(re.ForceMonoAudio)?"stereo=0;":"stereo=1;",n+="useinbandfec=1",r.replace("useinbandfec=1",n),r}handleOnIce(e){var t;i.Log(i.GetStackTrace(),"peerconnection handleOnIce",6),this.config.isFlagEnabled(re.ForceTURN)&&e.candidate.indexOf("relay")<0?i.Info(i.GetStackTrace(),`Dropping candidate because it was not TURN relay. | Type= ${e.type} | Protocol= ${e.protocol} | Address=${e.address} | Port=${e.port} |`,6):null===(t=this.peerConnection)||void 0===t||t.addIceCandidate(e)}handleSignalStateChange(e){i.Log(i.GetStackTrace(),"signaling state change: "+e,6)}handleIceConnectionStateChange(e){i.Log(i.GetStackTrace(),"ice connection state change: "+e,6),this.onIceConnectionStateChange(e)}handleIceGatheringStateChange(e){i.Log(i.GetStackTrace(),"ice gathering state change: "+JSON.stringify(e),6)}handleOnTrack(e){this.onTrack(e)}handleIceCandidate(e){this.onPeerIceCandidate(e)}handleDataChannel(e){this.onDataChannel(e)}onTrack(e){}onIceConnectionStateChange(e){}onPeerIceCandidate(e){}onDataChannel(e){}setupTransceiversAsync(e){var t,r,n,i,s,a,o,l,c;return xe(this,void 0,void 0,(function*(){const h=(null===(t=this.peerConnection)||void 0===t?void 0:t.getTransceivers().length)>0;if(null===(r=this.peerConnection)||void 0===r||r.addTransceiver("video",{direction:"recvonly"}),RTCRtpReceiver.getCapabilities&&""!=this.preferredCodec)for(const e of null!==(i=null===(n=this.peerConnection)||void 0===n?void 0:n.getTransceivers())&&void 0!==i?i:[])if(e&&e.receiver&&e.receiver.track&&"video"===e.receiver.track.kind){const t=this.preferredCodec.split(" "),r=[{mimeType:"video/"+t[0],clockRate:9e4,sdpFmtpLine:t[1]?t[1]:""}];this.config.getSettingOption(ce.PreferredCodec).options.filter((e=>e!=this.preferredCodec)).forEach((e=>{const t=e.split(" ");r.push({mimeType:"video/"+t[0],clockRate:9e4,sdpFmtpLine:t[1]?t[1]:""})}));for(const e of r)""===e.sdpFmtpLine&&delete e.sdpFmtpLine;e.setCodecPreferences(r)}if(e){const t={video:!1,audio:!!e&&{autoGainControl:!1,channelCount:1,echoCancellation:!1,latency:0,noiseSuppression:!1,sampleRate:48e3,sampleSize:16,volume:1}},r=yield navigator.mediaDevices.getUserMedia(t);if(r)if(h){for(const e of null!==(o=null===(a=this.peerConnection)||void 0===a?void 0:a.getTransceivers())&&void 0!==o?o:[])if(e&&e.receiver&&e.receiver.track&&"audio"===e.receiver.track.kind)for(const t of r.getTracks())t.kind&&"audio"==t.kind&&(e.sender.replaceTrack(t),e.direction="sendrecv")}else for(const e of r.getTracks())e.kind&&"audio"==e.kind&&(null===(l=this.peerConnection)||void 0===l||l.addTransceiver(e,{direction:"sendrecv"}));else null===(c=this.peerConnection)||void 0===c||c.addTransceiver("audio",{direction:"recvonly"})}else null===(s=this.peerConnection)||void 0===s||s.addTransceiver("audio",{direction:"recvonly"})}))}onVideoStats(e){}onSendWebRTCOffer(e){}onSendWebRTCAnswer(e){}showTextOverlayConnecting(){}showTextOverlaySetupFailure(){}parseAvailableCodecs(e){if(!RTCRtpReceiver.getCapabilities)return["Only available on Chrome"];const t=[],r=(0,we.splitSections)(e.sdp);return r.shift(),r.forEach((e=>{const{codecs:r}=(0,we.parseRtpParameters)(e),n=/(VP\d|H26\d|AV1).*/;r.forEach((e=>{const r=e.name+" "+Object.keys(e.parameters||{}).map((t=>t+"="+e.parameters[t])).join(";");if(null!==n.exec(r)){"VP9"==e.name&&(e.parameters={"profile-id":"0"});const r=e.name+" "+Object.keys(e.parameters||{}).map((t=>t+"="+e.parameters[t])).join(";");t.push(r)}}))})),t}}class Fe{constructor(){this.PixelStreamingSettings=new De,this.EncoderSettings=new Oe,this.WebRTCSettings=new Ue}ueCompatible(){null!=this.WebRTCSettings.MaxFPS&&(this.WebRTCSettings.FPS=this.WebRTCSettings.MaxFPS)}}class De{}class Oe{}class Ue{}class Ie{constructor(){this.ReceiptTimeMs=null,this.TransmissionTimeMs=null,this.PreCaptureTimeMs=null,this.PostCaptureTimeMs=null,this.PreEncodeTimeMs=null,this.PostEncodeTimeMs=null,this.EncodeMs=null,this.CaptureToSendMs=null,this.testStartTimeMs=0,this.browserReceiptTimeMs=0,this.latencyExcludingDecode=0,this.testDuration=0,this.networkLatency=0,this.browserSendLatency=0,this.frameDisplayDeltaTimeMs=0,this.endToEndLatency=0,this.encodeLatency=0}setFrameDisplayDeltaTime(e){0==this.frameDisplayDeltaTimeMs&&(this.frameDisplayDeltaTimeMs=Math.round(e))}processFields(){null!=this.EncodeMs||null==this.PreEncodeTimeMs&&null==this.PostEncodeTimeMs||(i.Log(i.GetStackTrace(),`Setting Encode Ms \n ${this.PostEncodeTimeMs} \n ${this.PreEncodeTimeMs}`,6),this.EncodeMs=this.PostEncodeTimeMs-this.PreEncodeTimeMs),null!=this.CaptureToSendMs||null==this.PreCaptureTimeMs&&null==this.PostCaptureTimeMs||(i.Log(i.GetStackTrace(),`Setting CaptureToSendMs Ms \n ${this.PostCaptureTimeMs} \n ${this.PreCaptureTimeMs}`,6),this.CaptureToSendMs=this.PostCaptureTimeMs-this.PreCaptureTimeMs)}}class Ge{static setExtensionFromBytes(e,t){t.receiving||(t.mimetype="",t.extension="",t.receiving=!0,t.valid=!1,t.size=0,t.data=[],t.timestampStart=(new Date).getTime(),i.Log(i.GetStackTrace(),"Received first chunk of file",6));const r=new TextDecoder("utf-16").decode(e.slice(1));i.Log(i.GetStackTrace(),r,6),t.extension=r}static setMimeTypeFromBytes(e,t){t.receiving||(t.mimetype="",t.extension="",t.receiving=!0,t.valid=!1,t.size=0,t.data=[],t.timestampStart=(new Date).getTime(),i.Log(i.GetStackTrace(),"Received first chunk of file",6));const r=new TextDecoder("utf-16").decode(e.slice(1));i.Log(i.GetStackTrace(),r,6),t.mimetype=r}static setContentsFromBytes(e,t){if(!t.receiving)return;t.size=Math.ceil(new DataView(e.slice(1,5).buffer).getInt32(0,!0)/16379);const r=e.slice(5);if(t.data.push(r),i.Log(i.GetStackTrace(),`Received file chunk: ${t.data.length}/${t.size}`,6),t.data.length===t.size){t.receiving=!1,t.valid=!0,i.Log(i.GetStackTrace(),"Received complete file",6);const e=(new Date).getTime()-t.timestampStart,r=Math.round(16*t.size*1024/e);i.Log(i.GetStackTrace(),`Average transfer bitrate: ${r}kb/s over ${e/1e3} seconds`,6);const n=new Blob(t.data,{type:t.mimetype}),s=document.createElement("a");s.setAttribute("href",URL.createObjectURL(n)),s.setAttribute("download",`transfer.${t.extension}`),document.body.append(s),s.remove()}else t.data.length>t.size&&(t.receiving=!1,i.Error(i.GetStackTrace(),`Received bigger file than advertised: ${t.data.length}/${t.size}`))}}class ze{constructor(){this.mimetype="",this.extension="",this.receiving=!1,this.size=0,this.data=[],this.valid=!1}}class Be{}Be.mainButton=0,Be.auxiliaryButton=1,Be.secondaryButton=2,Be.fourthButton=3,Be.fifthButton=4;class _e{}_e.primaryButton=1,_e.secondaryButton=2,_e.auxiliaryButton=4,_e.fourthButton=8,_e.fifthButton=16;class We{constructor(){this.unregisterCallbacks=[]}addUnregisterCallback(e){this.unregisterCallbacks.push(e)}unregisterAll(){for(const e of this.unregisterCallbacks)e();this.unregisterCallbacks=[]}}class He{constructor(e,t,r){this.touchEventListenerTracker=new We,this.toStreamerMessagesProvider=e,this.videoElementProvider=t,this.coordinateConverter=r;const n=e=>this.onTouchStart(e),i=e=>this.onTouchEnd(e),s=e=>this.onTouchMove(e);document.addEventListener("touchstart",n,{passive:!1}),document.addEventListener("touchend",i,{passive:!1}),document.addEventListener("touchmove",s,{passive:!1}),this.touchEventListenerTracker.addUnregisterCallback((()=>document.removeEventListener("touchstart",n))),this.touchEventListenerTracker.addUnregisterCallback((()=>document.removeEventListener("touchend",i))),this.touchEventListenerTracker.addUnregisterCallback((()=>document.removeEventListener("touchmove",s)))}unregisterTouchEvents(){this.touchEventListenerTracker.unregisterAll()}setVideoElementParentClientRect(e){this.videoElementParentClientRect=e}onTouchStart(e){if(this.videoElementProvider.isVideoReady()){if(null==this.fakeTouchFinger){const t=e.changedTouches[0];this.fakeTouchFinger=new Ve(t.identifier,t.clientX-this.videoElementParentClientRect.left,t.clientY-this.videoElementParentClientRect.top);const r=this.videoElementProvider.getVideoParentElement(),n=new MouseEvent("mouseenter",t);r.dispatchEvent(n);const i=this.coordinateConverter.normalizeAndQuantizeUnsigned(this.fakeTouchFinger.x,this.fakeTouchFinger.y);this.toStreamerMessagesProvider.toStreamerHandlers.get("MouseDown")([Be.mainButton,i.x,i.y])}e.preventDefault()}}onTouchEnd(e){if(!this.videoElementProvider.isVideoReady())return;const t=this.videoElementProvider.getVideoParentElement(),r=this.toStreamerMessagesProvider.toStreamerHandlers;for(let n=0;n<e.changedTouches.length;n++){const i=e.changedTouches[n];if(i.identifier===this.fakeTouchFinger.id){const e=i.clientX-this.videoElementParentClientRect.left,n=i.clientY-this.videoElementParentClientRect.top,s=this.coordinateConverter.normalizeAndQuantizeUnsigned(e,n);r.get("MouseUp")([Be.mainButton,s.x,s.y]);const a=new MouseEvent("mouseleave",i);t.dispatchEvent(a),this.fakeTouchFinger=null;break}}e.preventDefault()}onTouchMove(e){if(!this.videoElementProvider.isVideoReady())return;const t=this.toStreamerMessagesProvider.toStreamerHandlers;for(let r=0;r<e.touches.length;r++){const n=e.touches[r];if(n.identifier===this.fakeTouchFinger.id){const e=n.clientX-this.videoElementParentClientRect.left,r=n.clientY-this.videoElementParentClientRect.top,i=this.coordinateConverter.normalizeAndQuantizeUnsigned(e,r),s=this.coordinateConverter.normalizeAndQuantizeSigned(e-this.fakeTouchFinger.x,r-this.fakeTouchFinger.y);t.get("MouseMove")([i.x,i.y,s.x,s.y]),this.fakeTouchFinger.x=e,this.fakeTouchFinger.y=r;break}}e.preventDefault()}}class Ve{constructor(e,t,r){this.id=e,this.x=t,this.y=r}}class Ne{}Ne.backSpace=8,Ne.shift=16,Ne.control=17,Ne.alt=18,Ne.rightShift=253,Ne.rightControl=254,Ne.rightAlt=255;class Ke{constructor(e,t,r){this.keyboardEventListenerTracker=new We,this.CodeToKeyCode={Escape:27,Digit0:48,Digit1:49,Digit2:50,Digit3:51,Digit4:52,Digit5:53,Digit6:54,Digit7:55,Digit8:56,Digit9:57,Minus:173,Equal:187,Backspace:8,Tab:9,KeyQ:81,KeyW:87,KeyE:69,KeyR:82,KeyT:84,KeyY:89,KeyU:85,KeyI:73,KeyO:79,KeyP:80,BracketLeft:219,BracketRight:221,Enter:13,ControlLeft:17,KeyA:65,KeyS:83,KeyD:68,KeyF:70,KeyG:71,KeyH:72,KeyJ:74,KeyK:75,KeyL:76,Semicolon:186,Quote:222,Backquote:192,ShiftLeft:16,Backslash:220,KeyZ:90,KeyX:88,KeyC:67,KeyV:86,KeyB:66,KeyN:78,KeyM:77,Comma:188,Period:190,Slash:191,ShiftRight:253,AltLeft:18,Space:32,CapsLock:20,F1:112,F2:113,F3:114,F4:115,F5:116,F6:117,F7:118,F8:119,F9:120,F10:121,F11:122,F12:123,Pause:19,ScrollLock:145,NumpadDivide:111,NumpadMultiply:106,NumpadSubtract:109,NumpadAdd:107,NumpadDecimal:110,Numpad9:105,Numpad8:104,Numpad7:103,Numpad6:102,Numpad5:101,Numpad4:100,Numpad3:99,Numpad2:98,Numpad1:97,Numpad0:96,NumLock:144,ControlRight:254,AltRight:255,Home:36,End:35,ArrowUp:38,ArrowLeft:37,ArrowRight:39,ArrowDown:40,PageUp:33,PageDown:34,Insert:45,Delete:46,ContextMenu:93},this.toStreamerMessagesProvider=e,this.config=t,this.activeKeysProvider=r}registerKeyBoardEvents(){const e=e=>this.handleOnKeyDown(e),t=e=>this.handleOnKeyUp(e),r=e=>this.handleOnKeyPress(e);document.addEventListener("keydown",e),document.addEventListener("keyup",t),document.addEventListener("keypress",r),this.keyboardEventListenerTracker.addUnregisterCallback((()=>document.removeEventListener("keydown",e))),this.keyboardEventListenerTracker.addUnregisterCallback((()=>document.removeEventListener("keyup",t))),this.keyboardEventListenerTracker.addUnregisterCallback((()=>document.removeEventListener("keypress",r)))}unregisterKeyBoardEvents(){this.keyboardEventListenerTracker.unregisterAll()}handleOnKeyDown(e){const t=this.getKeycode(e);t&&(i.Log(i.GetStackTrace(),`key down ${t}, repeat = ${e.repeat}`,6),this.toStreamerMessagesProvider.toStreamerHandlers.get("KeyDown")([this.getKeycode(e),e.repeat?1:0]),this.activeKeysProvider.getActiveKeys().push(t),t===Ne.backSpace&&document.dispatchEvent(new KeyboardEvent("keypress",{charCode:Ne.backSpace})),this.config.isFlagEnabled(re.SuppressBrowserKeys)&&this.isKeyCodeBrowserKey(t)&&e.preventDefault())}handleOnKeyUp(e){const t=this.getKeycode(e);t&&(i.Log(i.GetStackTrace(),`key up ${t}`,6),this.toStreamerMessagesProvider.toStreamerHandlers.get("KeyUp")([t,e.repeat?1:0]),this.config.isFlagEnabled(re.SuppressBrowserKeys)&&this.isKeyCodeBrowserKey(t)&&e.preventDefault())}handleOnKeyPress(e){if(!("charCode"in e))return void i.Warning(i.GetStackTrace(),"KeyboardEvent.charCode is deprecated in this browser, cannot send key press.");const t=e.charCode;i.Log(i.GetStackTrace(),`key press ${t}`,6),this.toStreamerMessagesProvider.toStreamerHandlers.get("KeyPress")([t])}getKeycode(e){if(!("keyCode"in e)){const t=e;return t.code in this.CodeToKeyCode?this.CodeToKeyCode[t.code]:(i.Warning(i.GetStackTrace(),`Keyboard code of ${t.code} is not supported in our mapping, ignoring this key.`),null)}return e.keyCode===Ne.shift&&"ShiftRight"===e.code?Ne.rightShift:e.keyCode===Ne.control&&"ControlRight"===e.code?Ne.rightControl:e.keyCode===Ne.alt&&"AltRight"===e.code?Ne.rightAlt:e.keyCode}isKeyCodeBrowserKey(e){return e>=112&&e<=123||9===e}}class Qe{constructor(e,t,r){this.x=0,this.y=0,this.updateMouseMovePositionEvent=e=>{this.updateMouseMovePosition(e)},this.mouseEventListenerTracker=new We,this.videoElementProvider=e,this.mouseController=t,this.activeKeysProvider=r;const n=this.videoElementProvider.getVideoParentElement();this.x=n.getBoundingClientRect().width/2,this.y=n.getBoundingClientRect().height/2,this.coord=this.mouseController.coordinateConverter.normalizeAndQuantizeUnsigned(this.x,this.y)}unregisterMouseEvents(){this.mouseEventListenerTracker.unregisterAll()}lockStateChange(){const e=this.videoElementProvider.getVideoParentElement(),t=this.mouseController.toStreamerMessagesProvider.toStreamerHandlers;if(document.pointerLockElement===e||document.mozPointerLockElement===e)i.Log(i.GetStackTrace(),"Pointer locked",6),document.addEventListener("mousemove",this.updateMouseMovePositionEvent,!1),this.mouseEventListenerTracker.addUnregisterCallback((()=>document.removeEventListener("mousemove",this.updateMouseMovePositionEvent,!1)));else{i.Log(i.GetStackTrace(),"The pointer lock status is now unlocked",6),document.removeEventListener("mousemove",this.updateMouseMovePositionEvent,!1);let e=this.activeKeysProvider.getActiveKeys();const r=[];new Set(e).forEach((e=>{})),r.forEach((e=>{t.get("KeyUp")([e])})),e=[]}}updateMouseMovePosition(e){if(!this.videoElementProvider.isVideoReady())return;const t=this.mouseController.toStreamerMessagesProvider.toStreamerHandlers,r=this.videoElementProvider.getVideoParentElement().clientWidth,n=this.videoElementProvider.getVideoParentElement().clientHeight;this.x+=e.movementX,this.y+=e.movementY,this.x>r&&(this.x-=r),this.y>n&&(this.y-=n),this.x<0&&(this.x=r+this.x),this.y<0&&(this.y=n-this.y),this.coord=this.mouseController.coordinateConverter.normalizeAndQuantizeUnsigned(this.x,this.y);const i=this.mouseController.coordinateConverter.normalizeAndQuantizeSigned(e.movementX,e.movementY);t.get("MouseMove")([this.coord.x,this.coord.y,i.x,i.y])}handleMouseDown(e){this.videoElementProvider.isVideoReady()&&this.mouseController.toStreamerMessagesProvider.toStreamerHandlers.get("MouseDown")([e.button,this.coord.x,this.coord.y])}handleMouseUp(e){this.videoElementProvider.isVideoReady()&&this.mouseController.toStreamerMessagesProvider.toStreamerHandlers.get("MouseUp")([e.button,this.coord.x,this.coord.y])}handleMouseWheel(e){this.videoElementProvider.isVideoReady()&&this.mouseController.toStreamerMessagesProvider.toStreamerHandlers.get("MouseWheel")([e.wheelDelta,this.coord.x,this.coord.y])}handleMouseDouble(e){this.videoElementProvider.isVideoReady()&&this.mouseController.toStreamerMessagesProvider.toStreamerHandlers.get("MouseDouble")([e.button,this.coord.x,this.coord.y])}handlePressMouseButtons(e){this.videoElementProvider.isVideoReady()&&this.mouseController.pressMouseButtons(e.buttons,this.x,this.y)}handleReleaseMouseButtons(e){this.videoElementProvider.isVideoReady()&&this.mouseController.releaseMouseButtons(e.buttons,this.x,this.y)}}class $e{constructor(e){this.mouseController=e}unregisterMouseEvents(){}updateMouseMovePosition(e){if(!this.mouseController.videoElementProvider.isVideoReady())return;i.Log(i.GetStackTrace(),"MouseMove",6);const t=this.mouseController.coordinateConverter.normalizeAndQuantizeUnsigned(e.offsetX,e.offsetY),r=this.mouseController.coordinateConverter.normalizeAndQuantizeSigned(e.movementX,e.movementY);this.mouseController.toStreamerMessagesProvider.toStreamerHandlers.get("MouseMove")([t.x,t.y,r.x,r.y]),e.preventDefault()}handleMouseDown(e){if(!this.mouseController.videoElementProvider.isVideoReady())return;i.Log(i.GetStackTrace(),"onMouse Down",6);const t=this.mouseController.coordinateConverter.normalizeAndQuantizeUnsigned(e.offsetX,e.offsetY);this.mouseController.toStreamerMessagesProvider.toStreamerHandlers.get("MouseDown")([e.button,t.x,t.y]),e.preventDefault()}handleMouseUp(e){if(!this.mouseController.videoElementProvider.isVideoReady())return;const t=this.mouseController.coordinateConverter.normalizeAndQuantizeUnsigned(e.offsetX,e.offsetY);this.mouseController.toStreamerMessagesProvider.toStreamerHandlers.get("MouseUp")([e.button,t.x,t.y]),e.preventDefault()}handleContextMenu(e){if(!this.mouseController.videoElementProvider.isVideoReady())return;const t=this.mouseController.coordinateConverter.normalizeAndQuantizeUnsigned(e.offsetX,e.offsetY);this.mouseController.toStreamerMessagesProvider.toStreamerHandlers.get("MouseUp")([e.button,t.x,t.y]),e.preventDefault()}handleMouseWheel(e){if(!this.mouseController.videoElementProvider.isVideoReady())return;const t=this.mouseController.coordinateConverter.normalizeAndQuantizeUnsigned(e.offsetX,e.offsetY);this.mouseController.toStreamerMessagesProvider.toStreamerHandlers.get("MouseWheel")([e.wheelDelta,t.x,t.y]),e.preventDefault()}handleMouseDouble(e){if(!this.mouseController.videoElementProvider.isVideoReady())return;const t=this.mouseController.coordinateConverter.normalizeAndQuantizeUnsigned(e.offsetX,e.offsetY);this.mouseController.toStreamerMessagesProvider.toStreamerHandlers.get("MouseDouble")([e.button,t.x,t.y])}handlePressMouseButtons(e){this.mouseController.videoElementProvider.isVideoReady()&&this.mouseController.pressMouseButtons(e.buttons,e.offsetX,e.offsetY)}handleReleaseMouseButtons(e){this.mouseController.videoElementProvider.isVideoReady()&&this.mouseController.releaseMouseButtons(e.buttons,e.offsetX,e.offsetY)}}class qe{constructor(e,t,r,n){this.mouseEventListenerTracker=new We,this.toStreamerMessagesProvider=e,this.coordinateConverter=r,this.videoElementProvider=t,this.activeKeysProvider=n,this.registerMouseEnterAndLeaveEvents()}unregisterMouseEvents(){this.mouseEventListenerTracker.unregisterAll()}registerLockedMouseEvents(e){const t=this.videoElementProvider.getVideoParentElement(),r=new Qe(this.videoElementProvider,e,this.activeKeysProvider);if(t.requestPointerLock=t.requestPointerLock||t.mozRequestPointerLock,document.exitPointerLock=document.exitPointerLock||document.mozExitPointerLock,t.requestPointerLock){const e=()=>{t.requestPointerLock()};t.addEventListener("click",e),this.mouseEventListenerTracker.addUnregisterCallback((()=>t.removeEventListener("click",e)))}const n=()=>r.lockStateChange();document.addEventListener("pointerlockchange",n,!1),document.addEventListener("mozpointerlockchange",n,!1),this.mouseEventListenerTracker.addUnregisterCallback((()=>document.removeEventListener("pointerlockchange",n,!1))),this.mouseEventListenerTracker.addUnregisterCallback((()=>document.removeEventListener("mozpointerlockchange",n,!1)));const i=e=>r.handleMouseDown(e),s=e=>r.handleMouseUp(e),a=e=>r.handleMouseWheel(e),o=e=>r.handleMouseDouble(e);t.addEventListener("mousedown",i),t.addEventListener("mouseup",s),t.addEventListener("wheel",a),t.addEventListener("dblclick",o),this.mouseEventListenerTracker.addUnregisterCallback((()=>t.removeEventListener("mousedown",i))),this.mouseEventListenerTracker.addUnregisterCallback((()=>t.removeEventListener("mouseup",s))),this.mouseEventListenerTracker.addUnregisterCallback((()=>t.removeEventListener("wheel",a))),this.mouseEventListenerTracker.addUnregisterCallback((()=>t.removeEventListener("dblclick",o))),this.mouseEventListenerTracker.addUnregisterCallback((()=>r.unregisterMouseEvents())),this.mouseEventListenerTracker.addUnregisterCallback((()=>{!document.exitPointerLock||document.pointerLockElement!==t&&document.mozPointerLockElement!==t||document.exitPointerLock()}))}registerHoveringMouseEvents(e){const t=this.videoElementProvider.getVideoParentElement(),r=new $e(e),n=e=>r.updateMouseMovePosition(e),i=e=>r.handleMouseDown(e),s=e=>r.handleMouseUp(e),a=e=>r.handleContextMenu(e),o=e=>r.handleMouseWheel(e),l=e=>r.handleMouseDouble(e);t.addEventListener("mousemove",n),t.addEventListener("mousedown",i),t.addEventListener("mouseup",s),t.addEventListener("contextmenu",a),t.addEventListener("wheel",o),t.addEventListener("dblclick",l),this.mouseEventListenerTracker.addUnregisterCallback((()=>t.removeEventListener("mousemove",n))),this.mouseEventListenerTracker.addUnregisterCallback((()=>t.removeEventListener("mousedown",i))),this.mouseEventListenerTracker.addUnregisterCallback((()=>t.removeEventListener("mouseup",s))),this.mouseEventListenerTracker.addUnregisterCallback((()=>t.removeEventListener("contextmenu",a))),this.mouseEventListenerTracker.addUnregisterCallback((()=>t.removeEventListener("wheel",o))),this.mouseEventListenerTracker.addUnregisterCallback((()=>t.removeEventListener("dblclick",l))),this.mouseEventListenerTracker.addUnregisterCallback((()=>r.unregisterMouseEvents()))}registerMouseEnterAndLeaveEvents(){const e=this.videoElementProvider.getVideoParentElement(),t=e=>{this.videoElementProvider.isVideoReady()&&(i.Log(i.GetStackTrace(),"Mouse Entered",6),this.sendMouseEnter(),this.pressMouseButtons(e.buttons,e.x,e.y))},r=e=>{this.videoElementProvider.isVideoReady()&&(i.Log(i.GetStackTrace(),"Mouse Left",6),this.sendMouseLeave(),this.releaseMouseButtons(e.buttons,e.x,e.y))};e.addEventListener("mouseenter",t),e.addEventListener("mouseleave",r),this.mouseEventListenerTracker.addUnregisterCallback((()=>e.removeEventListener("mouseenter",t))),this.mouseEventListenerTracker.addUnregisterCallback((()=>e.removeEventListener("mouseleave",r)))}releaseMouseButtons(e,t,r){const n=this.coordinateConverter.normalizeAndQuantizeUnsigned(t,r);e&_e.primaryButton&&this.sendMouseUp(Be.mainButton,n.x,n.y),e&_e.secondaryButton&&this.sendMouseUp(Be.secondaryButton,n.x,n.y),e&_e.auxiliaryButton&&this.sendMouseUp(Be.auxiliaryButton,n.x,n.y),e&_e.fourthButton&&this.sendMouseUp(Be.fourthButton,n.x,n.y),e&_e.fifthButton&&this.sendMouseUp(Be.fifthButton,n.x,n.y)}pressMouseButtons(e,t,r){if(!this.videoElementProvider.isVideoReady())return;const n=this.coordinateConverter.normalizeAndQuantizeUnsigned(t,r);e&_e.primaryButton&&this.sendMouseDown(Be.mainButton,n.x,n.y),e&_e.secondaryButton&&this.sendMouseDown(Be.secondaryButton,n.x,n.y),e&_e.auxiliaryButton&&this.sendMouseDown(Be.auxiliaryButton,n.x,n.y),e&_e.fourthButton&&this.sendMouseDown(Be.fourthButton,n.x,n.y),e&_e.fifthButton&&this.sendMouseDown(Be.fifthButton,n.x,n.y)}sendMouseEnter(){this.videoElementProvider.isVideoReady()&&this.toStreamerMessagesProvider.toStreamerHandlers.get("MouseEnter")()}sendMouseLeave(){this.videoElementProvider.isVideoReady()&&this.toStreamerMessagesProvider.toStreamerHandlers.get("MouseLeave")()}sendMouseDown(e,t,r){this.videoElementProvider.isVideoReady()&&(i.Log(i.GetStackTrace(),`mouse button ${e} down at (${t}, ${r})`,6),this.toStreamerMessagesProvider.toStreamerHandlers.get("MouseDown")([e,t,r]))}sendMouseUp(e,t,r){if(!this.videoElementProvider.isVideoReady())return;i.Log(i.GetStackTrace(),`mouse button ${e} up at (${t}, ${r})`,6);const n=this.coordinateConverter.normalizeAndQuantizeUnsigned(t,r);this.toStreamerMessagesProvider.toStreamerHandlers.get("MouseUp")([e,n.x,n.y])}}class Xe{constructor(e,t,r){this.fingers=[9,8,7,6,5,4,3,2,1,0],this.fingerIds=new Map,this.maxByteValue=255,this.touchEventListenerTracker=new We,this.toStreamerMessagesProvider=e,this.videoElementProvider=t,this.coordinateConverter=r,this.videoElementParent=t.getVideoElement();const n=e=>this.onTouchStart(e),s=e=>this.onTouchEnd(e),a=e=>this.onTouchMove(e);this.videoElementParent.addEventListener("touchstart",n,{passive:!1}),this.videoElementParent.addEventListener("touchend",s,{passive:!1}),this.videoElementParent.addEventListener("touchmove",a,{passive:!1}),this.touchEventListenerTracker.addUnregisterCallback((()=>this.videoElementParent.removeEventListener("touchstart",n))),this.touchEventListenerTracker.addUnregisterCallback((()=>this.videoElementParent.removeEventListener("touchend",s))),this.touchEventListenerTracker.addUnregisterCallback((()=>this.videoElementParent.removeEventListener("touchmove",a))),i.Log(i.GetStackTrace(),"Touch Events Registered",6);const o=e=>{e.preventDefault()};document.addEventListener("touchmove",o,{passive:!1}),this.touchEventListenerTracker.addUnregisterCallback((()=>document.removeEventListener("touchmove",o)))}unregisterTouchEvents(){this.touchEventListenerTracker.unregisterAll()}rememberTouch(e){const t=this.fingers.pop();void 0===t&&i.Log(i.GetStackTrace(),"exhausted touch identifiers",6),this.fingerIds.set(e.identifier,t)}forgetTouch(e){this.fingers.push(this.fingerIds.get(e.identifier)),this.fingers.sort((function(e,t){return t-e})),this.fingerIds.delete(e.identifier)}onTouchStart(e){if(this.videoElementProvider.isVideoReady()){for(let t=0;t<e.changedTouches.length;t++)this.rememberTouch(e.changedTouches[t]);i.Log(i.GetStackTrace(),"touch start",6),this.emitTouchData("TouchStart",e.changedTouches),e.preventDefault()}}onTouchEnd(e){if(this.videoElementProvider.isVideoReady()){i.Log(i.GetStackTrace(),"touch end",6),this.emitTouchData("TouchEnd",e.changedTouches);for(let t=0;t<e.changedTouches.length;t++)this.forgetTouch(e.changedTouches[t]);e.preventDefault()}}onTouchMove(e){this.videoElementProvider.isVideoReady()&&(i.Log(i.GetStackTrace(),"touch move",6),this.emitTouchData("TouchMove",e.touches),e.preventDefault())}emitTouchData(e,t){if(!this.videoElementProvider.isVideoReady())return;const r=this.videoElementProvider.getVideoParentElement(),n=this.toStreamerMessagesProvider.toStreamerHandlers;for(let s=0;s<t.length;s++){const a=1,o=t[s],l=o.clientX-r.offsetLeft,c=o.clientY-r.offsetTop;i.Log(i.GetStackTrace(),`F${this.fingerIds.get(o.identifier)}=(${l}, ${c})`,6);const h=this.coordinateConverter.normalizeAndQuantizeUnsigned(l,c);switch(e){case"TouchStart":n.get("TouchStart")([a,h.x,h.y,this.fingerIds.get(o.identifier),this.maxByteValue*o.force,h.inRange?1:0]);break;case"TouchEnd":n.get("TouchEnd")([a,h.x,h.y,this.fingerIds.get(o.identifier),this.maxByteValue*o.force,h.inRange?1:0]);break;case"TouchMove":n.get("TouchMove")([a,h.x,h.y,this.fingerIds.get(o.identifier),this.maxByteValue*o.force,h.inRange?1:0])}}}}class je{constructor(e){this.gamePadEventListenerTracker=new We,this.toStreamerMessagesProvider=e,this.requestAnimationFrame=(window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||window.requestAnimationFrame).bind(window);const t=window;if("GamepadEvent"in t){const e=e=>this.gamePadConnectHandler(e),t=e=>this.gamePadDisconnectHandler(e);window.addEventListener("gamepadconnected",e),window.addEventListener("gamepaddisconnected",t),this.gamePadEventListenerTracker.addUnregisterCallback((()=>window.removeEventListener("gamepadconnected",e))),this.gamePadEventListenerTracker.addUnregisterCallback((()=>window.removeEventListener("gamepaddisconnected",t)))}else if("WebKitGamepadEvent"in t){const e=e=>this.gamePadConnectHandler(e),t=e=>this.gamePadDisconnectHandler(e);window.addEventListener("webkitgamepadconnected",e),window.addEventListener("webkitgamepaddisconnected",t),this.gamePadEventListenerTracker.addUnregisterCallback((()=>window.removeEventListener("webkitgamepadconnected",e))),this.gamePadEventListenerTracker.addUnregisterCallback((()=>window.removeEventListener("webkitgamepaddisconnected",t)))}if(this.controllers=[],navigator.getGamepads)for(const e of navigator.getGamepads())e&&this.gamePadConnectHandler(new GamepadEvent("gamepadconnected",{gamepad:e}))}unregisterGamePadEvents(){this.gamePadEventListenerTracker.unregisterAll();for(const e of this.controllers)void 0!==e.id&&this.onGamepadDisconnected(e.id);this.controllers=[],this.onGamepadConnected=()=>{},this.onGamepadDisconnected=()=>{}}gamePadConnectHandler(e){i.Log(i.GetStackTrace(),"Gamepad connect handler",6);const t=e.gamepad,r={currentState:t,prevState:t,id:void 0};this.controllers.push(r),this.controllers[t.index].currentState=t,this.controllers[t.index].prevState=t,i.Log(i.GetStackTrace(),"gamepad: "+t.id+" connected",6),window.requestAnimationFrame((()=>this.updateStatus())),this.onGamepadConnected()}gamePadDisconnectHandler(e){i.Log(i.GetStackTrace(),"Gamepad disconnect handler",6),i.Log(i.GetStackTrace(),"gamepad: "+e.gamepad.id+" disconnected",6);const t=this.controllers[e.gamepad.index];delete this.controllers[e.gamepad.index],this.controllers=this.controllers.filter((e=>void 0!==e)),this.onGamepadDisconnected(t.id)}scanGamePads(){const e=navigator.getGamepads?navigator.getGamepads():navigator.webkitGetGamepads?navigator.webkitGetGamepads():[];for(let t=0;t<e.length;t++)e[t]&&e[t].index in this.controllers&&(this.controllers[e[t].index].currentState=e[t])}updateStatus(){this.scanGamePads();const e=this.toStreamerMessagesProvider.toStreamerHandlers;for(const t of this.controllers){const r=void 0===t.id?this.controllers.indexOf(t):t.id,n=t.currentState;for(let n=0;n<t.currentState.buttons.length;n++){const i=t.currentState.buttons[n],s=t.prevState.buttons[n];i.pressed?n==Re.LeftTrigger?e.get("GamepadAnalog")([r,5,i.value]):n==Re.RightTrigger?e.get("GamepadAnalog")([r,6,i.value]):e.get("GamepadButtonPressed")([r,n,s.pressed?1:0]):!i.pressed&&s.pressed&&(n==Re.LeftTrigger?e.get("GamepadAnalog")([r,5,0]):n==Re.RightTrigger?e.get("GamepadAnalog")([r,6,0]):e.get("GamepadButtonReleased")([r,n]))}for(let t=0;t<n.axes.length;t+=2){const i=parseFloat(n.axes[t].toFixed(4)),s=-parseFloat(n.axes[t+1].toFixed(4));e.get("GamepadAnalog")([r,t+1,i]),e.get("GamepadAnalog")([r,t+2,s])}this.controllers[r].prevState=n}this.controllers.length>0&&this.requestAnimationFrame((()=>this.updateStatus()))}onGamepadResponseReceived(e){for(const t of this.controllers)if(void 0===t.id){t.id=e;break}}onGamepadConnected(){}onGamepadDisconnected(e){}}!function(e){e[e.RightClusterBottomButton=0]="RightClusterBottomButton",e[e.RightClusterRightButton=1]="RightClusterRightButton",e[e.RightClusterLeftButton=2]="RightClusterLeftButton",e[e.RightClusterTopButton=3]="RightClusterTopButton",e[e.LeftShoulder=4]="LeftShoulder",e[e.RightShoulder=5]="RightShoulder",e[e.LeftTrigger=6]="LeftTrigger",e[e.RightTrigger=7]="RightTrigger",e[e.SelectOrBack=8]="SelectOrBack",e[e.StartOrForward=9]="StartOrForward",e[e.LeftAnalogPress=10]="LeftAnalogPress",e[e.RightAnalogPress=11]="RightAnalogPress",e[e.LeftClusterTopButton=12]="LeftClusterTopButton",e[e.LeftClusterBottomButton=13]="LeftClusterBottomButton",e[e.LeftClusterLeftButton=14]="LeftClusterLeftButton",e[e.LeftClusterRightButton=15]="LeftClusterRightButton",e[e.CentreButton=16]="CentreButton",e[e.LeftStickHorizontal=0]="LeftStickHorizontal",e[e.LeftStickVertical=1]="LeftStickVertical",e[e.RightStickHorizontal=2]="RightStickHorizontal",e[e.RightStickVertical=3]="RightStickVertical"}(Re||(Re={}));class Ye{constructor(e,t,r){this.activeKeys=new Je,this.toStreamerMessagesProvider=e,this.videoElementProvider=t,this.coordinateConverter=r}registerKeyBoard(e){i.Log(i.GetStackTrace(),"Register Keyboard Events",7);const t=new Ke(this.toStreamerMessagesProvider,e,this.activeKeys);return t.registerKeyBoardEvents(),t}registerMouse(e){i.Log(i.GetStackTrace(),"Register Mouse Events",7);const t=new qe(this.toStreamerMessagesProvider,this.videoElementProvider,this.coordinateConverter,this.activeKeys);switch(e){case ue.LockedMouse:t.registerLockedMouseEvents(t);break;case ue.HoveringMouse:t.registerHoveringMouseEvents(t);break;default:i.Info(i.GetStackTrace(),"unknown Control Scheme Type Defaulting to Locked Mouse Events"),t.registerLockedMouseEvents(t)}return t}registerTouch(e,t){if(i.Log(i.GetStackTrace(),"Registering Touch",6),e){const e=new He(this.toStreamerMessagesProvider,this.videoElementProvider,this.coordinateConverter);return e.setVideoElementParentClientRect(t),e}return new Xe(this.toStreamerMessagesProvider,this.videoElementProvider,this.coordinateConverter)}registerGamePad(){return i.Log(i.GetStackTrace(),"Register Game Pad",7),new je(this.toStreamerMessagesProvider)}}class Je{constructor(){this.activeKeys=[],this.activeKeys=[]}getActiveKeys(){return this.activeKeys}}class Ze{constructor(e,t){this.lastTimeResized=(new Date).getTime(),this.videoElement=document.createElement("video"),this.config=t,this.videoElement.id="streamingVideo",this.videoElement.disablePictureInPicture=!0,this.videoElement.playsInline=!0,this.videoElement.style.width="100%",this.videoElement.style.height="100%",this.videoElement.style.position="absolute",this.videoElement.style.pointerEvents="all",e.appendChild(this.videoElement),this.onResizePlayerCallback=()=>{console.log("Resolution changed, restyling player, did you forget to override this function?")},this.onMatchViewportResolutionCallback=()=>{console.log("Resolution changed and match viewport resolution is turned on, did you forget to override this function?")},this.videoElement.onclick=()=>{this.videoElement.paused&&this.videoElement.play()},this.videoElement.onloadedmetadata=()=>{this.onVideoInitialized()},window.addEventListener("resize",(()=>this.resizePlayerStyle()),!0),window.addEventListener("orientationchange",(()=>this.onOrientationChange()))}play(){return this.videoElement.muted=this.config.isFlagEnabled(re.StartVideoMuted),this.videoElement.autoplay=this.config.isFlagEnabled(re.AutoPlayVideo),this.videoElement.play()}isPaused(){return this.videoElement.paused}isVideoReady(){return void 0!==this.videoElement.readyState&&this.videoElement.readyState>0}hasVideoSource(){return void 0!==this.videoElement.srcObject&&null!==this.videoElement.srcObject}getVideoElement(){return this.videoElement}getVideoParentElement(){return this.videoElement.parentElement}setVideoEnabled(e){this.videoElement.srcObject.getTracks().forEach((t=>t.enabled=e))}onVideoInitialized(){}onOrientationChange(){clearTimeout(this.orientationChangeTimeout),this.orientationChangeTimeout=window.setTimeout((()=>{this.resizePlayerStyle()}),500)}resizePlayerStyle(){const e=this.getVideoParentElement();e&&(this.updateVideoStreamSize(),e.classList.contains("fixed-size")||this.resizePlayerStyleToFillParentElement(),this.onResizePlayerCallback())}resizePlayerStyleToFillParentElement(){this.getVideoParentElement().setAttribute("style","top: 0px; left: 0px; width: 100%; height: 100%; cursor: default;")}updateVideoStreamSize(){if(this.config.isFlagEnabled(re.MatchViewportResolution))if((new Date).getTime()-this.lastTimeResized>1e3){const e=this.getVideoParentElement();if(!e)return;this.onMatchViewportResolutionCallback(e.clientWidth,e.clientHeight),this.lastTimeResized=(new Date).getTime()}else i.Log(i.GetStackTrace(),"Resizing too often - skipping",6),clearTimeout(this.resizeTimeoutHandle),this.resizeTimeoutHandle=window.setTimeout((()=>this.updateVideoStreamSize),1e3)}}class et$1{constructor(){this.map=new Map,this.reverseMap=new Map}getFromKey(e){return this.map.get(e)}getFromValue(e){return this.reverseMap.get(e)}add(e,t){this.map.set(e,t),this.reverseMap.set(t,e)}remove(e,t){this.map.delete(e),this.reverseMap.delete(t)}}class tt$1{constructor(){this.toStreamerHandlers=new Map,this.fromStreamerHandlers=new Map,this.toStreamerMessages=new et$1,this.fromStreamerMessages=new et$1}populateDefaultProtocol(){this.toStreamerMessages.add("IFrameRequest",{id:0,byteLength:0,structure:[]}),this.toStreamerMessages.add("RequestQualityControl",{id:1,byteLength:0,structure:[]}),this.toStreamerMessages.add("FpsRequest",{id:2,byteLength:0,structure:[]}),this.toStreamerMessages.add("AverageBitrateRequest",{id:3,byteLength:0,structure:[]}),this.toStreamerMessages.add("StartStreaming",{id:4,byteLength:0,structure:[]}),this.toStreamerMessages.add("StopStreaming",{id:5,byteLength:0,structure:[]}),this.toStreamerMessages.add("LatencyTest",{id:6,byteLength:0,structure:[]}),this.toStreamerMessages.add("RequestInitialSettings",{id:7,byteLength:0,structure:[]}),this.toStreamerMessages.add("TestEcho",{id:8,byteLength:0,structure:[]}),this.toStreamerMessages.add("UIInteraction",{id:50,byteLength:0,structure:[]}),this.toStreamerMessages.add("Command",{id:51,byteLength:0,structure:[]}),this.toStreamerMessages.add("KeyDown",{id:60,byteLength:2,structure:["uint8","uint8"]}),this.toStreamerMessages.add("KeyUp",{id:61,byteLength:1,structure:["uint8"]}),this.toStreamerMessages.add("KeyPress",{id:62,byteLength:2,structure:["uint16"]}),this.toStreamerMessages.add("MouseEnter",{id:70,byteLength:0,structure:[]}),this.toStreamerMessages.add("MouseLeave",{id:71,byteLength:0,structure:[]}),this.toStreamerMessages.add("MouseDown",{id:72,byteLength:5,structure:["uint8","uint16","uint16"]}),this.toStreamerMessages.add("MouseUp",{id:73,byteLength:5,structure:["uint8","uint16","uint16"]}),this.toStreamerMessages.add("MouseMove",{id:74,byteLength:8,structure:["uint16","uint16","int16","int16"]}),this.toStreamerMessages.add("MouseWheel",{id:75,byteLength:6,structure:["int16","uint16","uint16"]}),this.toStreamerMessages.add("MouseDouble",{id:76,byteLength:5,structure:["uint8","uint16","uint16"]}),this.toStreamerMessages.add("TouchStart",{id:80,byteLength:8,structure:["uint8","uint16","uint16","uint8","uint8","uint8"]}),this.toStreamerMessages.add("TouchEnd",{id:81,byteLength:8,structure:["uint8","uint16","uint16","uint8","uint8","uint8"]}),this.toStreamerMessages.add("TouchMove",{id:82,byteLength:8,structure:["uint8","uint16","uint16","uint8","uint8","uint8"]}),this.toStreamerMessages.add("GamepadConnected",{id:93,byteLength:0,structure:[]}),this.toStreamerMessages.add("GamepadButtonPressed",{id:90,byteLength:3,structure:["uint8","uint8","uint8"]}),this.toStreamerMessages.add("GamepadButtonReleased",{id:91,byteLength:3,structure:["uint8","uint8","uint8"]}),this.toStreamerMessages.add("GamepadAnalog",{id:92,byteLength:10,structure:["uint8","uint8","double"]}),this.toStreamerMessages.add("GamepadDisconnected",{id:94,byteLength:1,structure:["uint8"]}),this.fromStreamerMessages.add("QualityControlOwnership",0),this.fromStreamerMessages.add("Response",1),this.fromStreamerMessages.add("Command",2),this.fromStreamerMessages.add("FreezeFrame",3),this.fromStreamerMessages.add("UnfreezeFrame",4),this.fromStreamerMessages.add("VideoEncoderAvgQP",5),this.fromStreamerMessages.add("LatencyTest",6),this.fromStreamerMessages.add("InitialSettings",7),this.fromStreamerMessages.add("FileExtension",8),this.fromStreamerMessages.add("FileMimeType",9),this.fromStreamerMessages.add("FileContents",10),this.fromStreamerMessages.add("TestEcho",11),this.fromStreamerMessages.add("InputControlOwnership",12),this.fromStreamerMessages.add("GamepadResponse",13),this.fromStreamerMessages.add("Protocol",255)}registerMessageHandler(e,t,r){switch(e){case Le.ToStreamer:this.toStreamerHandlers.set(t,r);break;case Le.FromStreamer:this.fromStreamerHandlers.set(t,r);break;default:i.Log(i.GetStackTrace(),`Unknown message direction ${e}`)}}}!function(e){e[e.ToStreamer=0]="ToStreamer",e[e.FromStreamer=1]="FromStreamer"}(Le||(Le={}));class st$1{constructor(){this.responseEventListeners=new Map}addResponseEventListener(e,t){this.responseEventListeners.set(e,t)}removeResponseEventListener(e){this.responseEventListeners.delete(e)}onResponse(e){i.Log(i.GetStackTrace(),"DataChannelReceiveMessageType.Response",6);const t=new TextDecoder("utf-16").decode(e.slice(1));i.Log(i.GetStackTrace(),t,6),this.responseEventListeners.forEach((e=>{e(t)}))}}class nt$1{constructor(e,t){this.dataChannelSender=e,this.toStreamerMessagesMapProvider=t}sendLatencyTest(e){this.sendDescriptor("LatencyTest",e)}emitCommand(e){this.sendDescriptor("Command",e)}emitUIInteraction(e){this.sendDescriptor("UIInteraction",e)}sendDescriptor(e,t){const r=JSON.stringify(t),n=this.toStreamerMessagesMapProvider.toStreamerMessages.getFromKey(e);void 0===n&&i.Error(i.GetStackTrace(),`Attempted to emit descriptor with message type: ${e}, but the frontend hasn't been configured to send such a message. Check you've added the message type in your cpp`),i.Log(i.GetStackTrace(),"Sending: "+t,6);const s=new DataView(new ArrayBuffer(3+2*r.length));let a=0;s.setUint8(a,n.id),a++,s.setUint16(a,r.length,!0),a+=2;for(let e=0;e<r.length;e++)s.setUint16(a,r.charCodeAt(e),!0),a+=2;this.dataChannelSender.canSend()?this.dataChannelSender.sendData(s.buffer):i.Info(i.GetStackTrace(),`Data channel cannot send yet, skipping sending descriptor message: ${e} - ${r}`)}}class rt$1{constructor(e,t){this.dataChannelSender=e,this.toStreamerMessagesMapProvider=t}sendMessageToStreamer(e,t){void 0===t&&(t=[]);const r=this.toStreamerMessagesMapProvider.toStreamerMessages.getFromKey(e);if(void 0===r)return void i.Error(i.GetStackTrace(),`Attempted to send a message to the streamer with message type: ${e}, but the frontend hasn't been configured to send such a message. Check you've added the message type in your cpp`);const n=new DataView(new ArrayBuffer(r.byteLength+1));n.setUint8(0,r.id);let s=1;t.forEach(((e,t)=>{switch(r.structure[t]){case"uint8":n.setUint8(s,e),s+=1;break;case"uint16":n.setUint16(s,e,!0),s+=2;break;case"int16":n.setInt16(s,e,!0),s+=2;break;case"float":n.setFloat32(s,e,!0),s+=4;break;case"double":n.setFloat64(s,e,!0),s+=8}})),this.dataChannelSender.canSend()?this.dataChannelSender.sendData(n.buffer):i.Info(i.GetStackTrace(),`Data channel cannot send yet, skipping sending message: ${e} - ${new Uint8Array(n.buffer)}`)}}class it$1{constructor(e){this.sendMessageController=e}SendRequestQualityControl(){this.sendMessageController.sendMessageToStreamer("RequestQualityControl")}SendMaxFpsRequest(){this.sendMessageController.sendMessageToStreamer("FpsRequest")}SendAverageBitrateRequest(){this.sendMessageController.sendMessageToStreamer("AverageBitrateRequest")}SendStartStreaming(){this.sendMessageController.sendMessageToStreamer("StartStreaming")}SendStopStreaming(){this.sendMessageController.sendMessageToStreamer("StopStreaming")}SendRequestInitialSettings(){this.sendMessageController.sendMessageToStreamer("RequestInitialSettings")}}class ot$1{constructor(e){this.dataChannelProvider=e}canSend(){return void 0!==this.dataChannelProvider.getDataChannelInstance().dataChannel&&"open"==this.dataChannelProvider.getDataChannelInstance().dataChannel.readyState}sendData(e){const t=this.dataChannelProvider.getDataChannelInstance();"open"==t.dataChannel.readyState?(t.dataChannel.send(e),i.Log(i.GetStackTrace(),`Message Sent: ${new Uint8Array(e)}`,6),this.resetAfkWarningTimerOnDataSend()):i.Error(i.GetStackTrace(),`Message Failed: ${new Uint8Array(e)}`)}resetAfkWarningTimerOnDataSend(){}}class at$2{constructor(e){this.videoElementProvider=e,this.normalizeAndQuantizeUnsignedFunc=()=>{throw new Error("Normalize and quantize unsigned, method not implemented.")},this.normalizeAndQuantizeSignedFunc=()=>{throw new Error("Normalize and unquantize signed, method not implemented.")},this.denormalizeAndUnquantizeUnsignedFunc=()=>{throw new Error("Denormalize and unquantize unsigned, method not implemented.")}}normalizeAndQuantizeUnsigned(e,t){return this.normalizeAndQuantizeUnsignedFunc(e,t)}unquantizeAndDenormalizeUnsigned(e,t){return this.denormalizeAndUnquantizeUnsignedFunc(e,t)}normalizeAndQuantizeSigned(e,t){return this.normalizeAndQuantizeSignedFunc(e,t)}setupNormalizeAndQuantize(){if(this.videoElementParent=this.videoElementProvider.getVideoParentElement(),this.videoElement=this.videoElementProvider.getVideoElement(),this.videoElementParent&&this.videoElement){const e=this.videoElementParent.clientHeight/this.videoElementParent.clientWidth,t=this.videoElement.videoHeight/this.videoElement.videoWidth;e>t?(i.Log(i.GetStackTrace(),"Setup Normalize and Quantize for playerAspectRatio > videoAspectRatio",6),this.ratio=e/t,this.normalizeAndQuantizeUnsignedFunc=(e,t)=>this.normalizeAndQuantizeUnsignedPlayerBigger(e,t),this.normalizeAndQuantizeSignedFunc=(e,t)=>this.normalizeAndQuantizeSignedPlayerBigger(e,t),this.denormalizeAndUnquantizeUnsignedFunc=(e,t)=>this.denormalizeAndUnquantizeUnsignedPlayerBigger(e,t)):(i.Log(i.GetStackTrace(),"Setup Normalize and Quantize for playerAspectRatio <= videoAspectRatio",6),this.ratio=t/e,this.normalizeAndQuantizeUnsignedFunc=(e,t)=>this.normalizeAndQuantizeUnsignedPlayerSmaller(e,t),this.normalizeAndQuantizeSignedFunc=(e,t)=>this.normalizeAndQuantizeSignedPlayerSmaller(e,t),this.denormalizeAndUnquantizeUnsignedFunc=(e,t)=>this.denormalizeAndUnquantizeUnsignedPlayerSmaller(e,t))}}normalizeAndQuantizeUnsignedPlayerBigger(e,t){const r=e/this.videoElementParent.clientWidth,n=this.ratio*(t/this.videoElementParent.clientHeight-.5)+.5;return r<0||r>1||n<0||n>1?new dt(!1,65535,65535):new dt(!0,65536*r,65536*n)}denormalizeAndUnquantizeUnsignedPlayerBigger(e,t){const r=e/65536,n=(t/65536-.5)/this.ratio+.5;return new lt$1(r*this.videoElementParent.clientWidth,n*this.videoElementParent.clientHeight)}normalizeAndQuantizeSignedPlayerBigger(e,t){const r=e/(.5*this.videoElementParent.clientWidth),n=this.ratio*t/(.5*this.videoElementParent.clientHeight);return new ct$1(32767*r,32767*n)}normalizeAndQuantizeUnsignedPlayerSmaller(e,t){const r=this.ratio*(e/this.videoElementParent.clientWidth-.5)+.5,n=t/this.videoElementParent.clientHeight;return r<0||r>1||n<0||n>1?new dt(!1,65535,65535):new dt(!0,65536*r,65536*n)}denormalizeAndUnquantizeUnsignedPlayerSmaller(e,t){const r=(e/65536-.5)/this.ratio+.5,n=t/65536;return new lt$1(r*this.videoElementParent.clientWidth,n*this.videoElementParent.clientHeight)}normalizeAndQuantizeSignedPlayerSmaller(e,t){const r=this.ratio*e/(.5*this.videoElementParent.clientWidth),n=t/(.5*this.videoElementParent.clientHeight);return new ct$1(32767*r,32767*n)}}class dt{constructor(e,t,r){this.inRange=e,this.x=t,this.y=r}}class lt$1{constructor(e,t){this.x=e,this.y=t}}class ct$1{constructor(e,t){this.x=e,this.y=t}}class ht{constructor(e,t){this.shouldShowPlayOverlay=!0,this.config=e,this.pixelStreaming=t,this.responseController=new st$1,this.file=new ze,this.sdpConstraints={offerToReceiveAudio:!0,offerToReceiveVideo:!0},this.afkController=new me(this.config,this.pixelStreaming,this.onAfkTriggered.bind(this)),this.afkController.onAFKTimedOutCallback=()=>{this.setDisconnectMessageOverride("You have been disconnected due to inactivity"),this.closeSignalingServer()},this.freezeFrameController=new y$1(this.pixelStreaming.videoElementParent),this.videoPlayer=new Ze(this.pixelStreaming.videoElementParent,this.config),this.videoPlayer.onVideoInitialized=()=>this.handleVideoInitialized(),this.videoPlayer.onMatchViewportResolutionCallback=(e,t)=>{const r={"Resolution.Width":e,"Resolution.Height":t};this.sendDescriptorController.emitCommand(r)},this.videoPlayer.onResizePlayerCallback=()=>{this.setUpMouseAndFreezeFrame()},this.streamController=new T$1(this.videoPlayer),this.coordinateConverter=new at$2(this.videoPlayer),this.sendrecvDataChannelController=new Se,this.recvDataChannelController=new Se,this.registerDataChannelEventEmitters(this.sendrecvDataChannelController),this.registerDataChannelEventEmitters(this.recvDataChannelController),this.dataChannelSender=new ot$1(this.sendrecvDataChannelController),this.dataChannelSender.resetAfkWarningTimerOnDataSend=()=>this.afkController.resetAfkWarningTimer(),this.streamMessageController=new tt$1,this.webSocketController=new f$1,this.webSocketController.onConfig=e=>this.handleOnConfigMessage(e),this.webSocketController.onStreamerList=e=>this.handleStreamerListMessage(e),this.webSocketController.onWebSocketOncloseOverlayMessage=e=>{this.pixelStreaming._onDisconnect(`Websocket disconnect (${e.code}) ${""!=e.reason?"- "+e.reason:""}`),this.setVideoEncoderAvgQP(0)},this.webSocketController.onOpen.addEventListener("open",(()=>{this.config.isFlagEnabled(re.BrowserSendOffer)||this.webSocketController.requestStreamerList()})),this.webSocketController.onClose.addEventListener("close",(()=>{this.afkController.stopAfkWarningTimer(),this.statsTimerHandle&&void 0!==this.statsTimerHandle&&window.clearInterval(this.statsTimerHandle),this.setTouchInputEnabled(!1),this.setMouseInputEnabled(!1),this.setKeyboardInputEnabled(!1),this.setGamePadInputEnabled(!1)})),this.sendDescriptorController=new nt$1(this.dataChannelSender,this.streamMessageController),this.sendMessageController=new rt$1(this.dataChannelSender,this.streamMessageController),this.toStreamerMessagesController=new it$1(this.sendMessageController),this.registerMessageHandlers(),this.streamMessageController.populateDefaultProtocol(),this.inputClassesFactory=new Ye(this.streamMessageController,this.videoPlayer,this.coordinateConverter),this.isUsingSFU=!1,this.isQualityController=!1,this.preferredCodec="",this.config._addOnOptionSettingChangedListener(ce.StreamerId,(e=>{this.peerConnectionController.peerConnection.close(),this.peerConnectionController.createPeerConnection(this.peerConfig,this.preferredCodec),this.webSocketController.sendSubscribe(e)})),this.setVideoEncoderAvgQP(-1),this.signallingUrlBuilder=()=>{let e=this.config.getTextSettingValue(de.SignallingServerUrl);return this.config.isFlagEnabled(re.BrowserSendOffer)&&(e+="?"+re.BrowserSendOffer+"=true"),e}}requestUnquantizedAndDenormalizeUnsigned(e,t){return this.coordinateConverter.unquantizeAndDenormalizeUnsigned(e,t)}handleOnMessage(e){const t=new Uint8Array(e.data);i.Log(i.GetStackTrace(),"Message incoming:"+t,6);const r=this.streamMessageController.fromStreamerMessages.getFromValue(t[0]);this.streamMessageController.fromStreamerHandlers.get(r)(e.data)}registerMessageHandlers(){this.streamMessageController.registerMessageHandler(Le.FromStreamer,"QualityControlOwnership",(e=>this.onQualityControlOwnership(e))),this.streamMessageController.registerMessageHandler(Le.FromStreamer,"Response",(e=>this.responseController.onResponse(e))),this.streamMessageController.registerMessageHandler(Le.FromStreamer,"Command",(e=>{this.onCommand(e)})),this.streamMessageController.registerMessageHandler(Le.FromStreamer,"FreezeFrame",(e=>this.onFreezeFrameMessage(e))),this.streamMessageController.registerMessageHandler(Le.FromStreamer,"UnfreezeFrame",(()=>this.invalidateFreezeFrameAndEnableVideo())),this.streamMessageController.registerMessageHandler(Le.FromStreamer,"VideoEncoderAvgQP",(e=>this.handleVideoEncoderAvgQP(e))),this.streamMessageController.registerMessageHandler(Le.FromStreamer,"LatencyTest",(e=>this.handleLatencyTestResult(e))),this.streamMessageController.registerMessageHandler(Le.FromStreamer,"InitialSettings",(e=>this.handleInitialSettings(e))),this.streamMessageController.registerMessageHandler(Le.FromStreamer,"FileExtension",(e=>this.onFileExtension(e))),this.streamMessageController.registerMessageHandler(Le.FromStreamer,"FileMimeType",(e=>this.onFileMimeType(e))),this.streamMessageController.registerMessageHandler(Le.FromStreamer,"FileContents",(e=>this.onFileContents(e))),this.streamMessageController.registerMessageHandler(Le.FromStreamer,"TestEcho",(()=>{})),this.streamMessageController.registerMessageHandler(Le.FromStreamer,"InputControlOwnership",(e=>this.onInputControlOwnership(e))),this.streamMessageController.registerMessageHandler(Le.FromStreamer,"GamepadResponse",(e=>this.onGamepadResponse(e))),this.streamMessageController.registerMessageHandler(Le.FromStreamer,"Protocol",(e=>this.onProtocolMessage(e))),this.streamMessageController.registerMessageHandler(Le.ToStreamer,"IFrameRequest",(()=>this.sendMessageController.sendMessageToStreamer("IFrameRequest"))),this.streamMessageController.registerMessageHandler(Le.ToStreamer,"RequestQualityControl",(()=>this.sendMessageController.sendMessageToStreamer("RequestQualityControl"))),this.streamMessageController.registerMessageHandler(Le.ToStreamer,"FpsRequest",(()=>this.sendMessageController.sendMessageToStreamer("FpsRequest"))),this.streamMessageController.registerMessageHandler(Le.ToStreamer,"AverageBitrateRequest",(()=>this.sendMessageController.sendMessageToStreamer("AverageBitrateRequest"))),this.streamMessageController.registerMessageHandler(Le.ToStreamer,"StartStreaming",(()=>this.sendMessageController.sendMessageToStreamer("StartStreaming"))),this.streamMessageController.registerMessageHandler(Le.ToStreamer,"StopStreaming",(()=>this.sendMessageController.sendMessageToStreamer("StopStreaming"))),this.streamMessageController.registerMessageHandler(Le.ToStreamer,"LatencyTest",(()=>this.sendMessageController.sendMessageToStreamer("LatencyTest"))),this.streamMessageController.registerMessageHandler(Le.ToStreamer,"RequestInitialSettings",(()=>this.sendMessageController.sendMessageToStreamer("RequestInitialSettings"))),this.streamMessageController.registerMessageHandler(Le.ToStreamer,"TestEcho",(()=>{})),this.streamMessageController.registerMessageHandler(Le.ToStreamer,"UIInteraction",(e=>this.sendDescriptorController.emitUIInteraction(e))),this.streamMessageController.registerMessageHandler(Le.ToStreamer,"Command",(e=>this.sendDescriptorController.emitCommand(e))),this.streamMessageController.registerMessageHandler(Le.ToStreamer,"KeyDown",(e=>this.sendMessageController.sendMessageToStreamer("KeyDown",e))),this.streamMessageController.registerMessageHandler(Le.ToStreamer,"KeyUp",(e=>this.sendMessageController.sendMessageToStreamer("KeyUp",e))),this.streamMessageController.registerMessageHandler(Le.ToStreamer,"KeyPress",(e=>this.sendMessageController.sendMessageToStreamer("KeyPress",e))),this.streamMessageController.registerMessageHandler(Le.ToStreamer,"MouseEnter",(e=>this.sendMessageController.sendMessageToStreamer("MouseEnter",e))),this.streamMessageController.registerMessageHandler(Le.ToStreamer,"MouseLeave",(e=>this.sendMessageController.sendMessageToStreamer("MouseLeave",e))),this.streamMessageController.registerMessageHandler(Le.ToStreamer,"MouseDown",(e=>this.sendMessageController.sendMessageToStreamer("MouseDown",e))),this.streamMessageController.registerMessageHandler(Le.ToStreamer,"MouseUp",(e=>this.sendMessageController.sendMessageToStreamer("MouseUp",e))),this.streamMessageController.registerMessageHandler(Le.ToStreamer,"MouseMove",(e=>this.sendMessageController.sendMessageToStreamer("MouseMove",e))),this.streamMessageController.registerMessageHandler(Le.ToStreamer,"MouseWheel",(e=>this.sendMessageController.sendMessageToStreamer("MouseWheel",e))),this.streamMessageController.registerMessageHandler(Le.ToStreamer,"MouseDouble",(e=>this.sendMessageController.sendMessageToStreamer("MouseDouble",e))),this.streamMessageController.registerMessageHandler(Le.ToStreamer,"TouchStart",(e=>this.sendMessageController.sendMessageToStreamer("TouchStart",e))),this.streamMessageController.registerMessageHandler(Le.ToStreamer,"TouchEnd",(e=>this.sendMessageController.sendMessageToStreamer("TouchEnd",e))),this.streamMessageController.registerMessageHandler(Le.ToStreamer,"TouchMove",(e=>this.sendMessageController.sendMessageToStreamer("TouchMove",e))),this.streamMessageController.registerMessageHandler(Le.ToStreamer,"GamepadConnected",(()=>this.sendMessageController.sendMessageToStreamer("GamepadConnected"))),this.streamMessageController.registerMessageHandler(Le.ToStreamer,"GamepadButtonPressed",(e=>this.sendMessageController.sendMessageToStreamer("GamepadButtonPressed",e))),this.streamMessageController.registerMessageHandler(Le.ToStreamer,"GamepadButtonReleased",(e=>this.sendMessageController.sendMessageToStreamer("GamepadButtonReleased",e))),this.streamMessageController.registerMessageHandler(Le.ToStreamer,"GamepadAnalog",(e=>this.sendMessageController.sendMessageToStreamer("GamepadAnalog",e))),this.streamMessageController.registerMessageHandler(Le.ToStreamer,"GamepadDisconnected",(e=>this.sendMessageController.sendMessageToStreamer("GamepadDisconnected",e))),this.streamMessageController.registerMessageHandler(Le.ToStreamer,"XRHMDTransform",(e=>this.sendMessageController.sendMessageToStreamer("XRHMDTransform",e))),this.streamMessageController.registerMessageHandler(Le.ToStreamer,"XRControllerTransform",(e=>this.sendMessageController.sendMessageToStreamer("XRControllerTransform",e))),this.streamMessageController.registerMessageHandler(Le.ToStreamer,"XRSystem",(e=>this.sendMessageController.sendMessageToStreamer("XRSystem",e))),this.streamMessageController.registerMessageHandler(Le.ToStreamer,"XRButtonTouched",(e=>this.sendMessageController.sendMessageToStreamer("XRButtonTouched",e))),this.streamMessageController.registerMessageHandler(Le.ToStreamer,"XRButtonPressed",(e=>this.sendMessageController.sendMessageToStreamer("XRButtonPressed",e))),this.streamMessageController.registerMessageHandler(Le.ToStreamer,"XRButtonReleased",(e=>this.sendMessageController.sendMessageToStreamer("XRButtonReleased",e))),this.streamMessageController.registerMessageHandler(Le.ToStreamer,"XRAnalog",(e=>this.sendMessageController.sendMessageToStreamer("XRAnalog",e)))}onCommand(e){i.Log(i.GetStackTrace(),"DataChannelReceiveMessageType.Command",6);const t=new TextDecoder("utf-16").decode(e.slice(1));i.Log(i.GetStackTrace(),"Data Channel Command: "+t,6);const r=JSON.parse(t);"onScreenKeyboard"===r.command&&this.pixelStreaming._activateOnScreenKeyboard(r)}onProtocolMessage(e){try{const t=new TextDecoder("utf-16").decode(e.slice(1)),r=JSON.parse(t);Object.prototype.hasOwnProperty.call(r,"Direction")||i.Error(i.GetStackTrace(),"Malformed protocol received. Ensure the protocol message contains a direction");const n=r.Direction;delete r.Direction,i.Log(i.GetStackTrace(),`Received new ${n==Le.FromStreamer?"FromStreamer":"ToStreamer"} protocol. Updating existing protocol...`),Object.keys(r).forEach((e=>{const t=r[e];switch(n){case Le.ToStreamer:if(!Object.prototype.hasOwnProperty.call(t,"id")||!Object.prototype.hasOwnProperty.call(t,"byteLength"))return void i.Error(i.GetStackTrace(),`ToStreamer->${e} protocol definition was malformed as it didn't contain at least an id and a byteLength\n\n Definition was: ${JSON.stringify(t,null,2)}`);if(t.byteLength>0&&!Object.prototype.hasOwnProperty.call(t,"structure"))return void i.Error(i.GetStackTrace(),`ToStreamer->${e} protocol definition was malformed as it specified a byteLength but no accompanying structure`);this.streamMessageController.toStreamerHandlers.get(e)?this.streamMessageController.toStreamerMessages.add(e,t):i.Error(i.GetStackTrace(),`There was no registered handler for "${e}" - try adding one using registerMessageHandler(MessageDirection.ToStreamer, "${e}", myHandler)`);break;case Le.FromStreamer:if(!Object.prototype.hasOwnProperty.call(t,"id"))return void i.Error(i.GetStackTrace(),`FromStreamer->${e} protocol definition was malformed as it didn't contain at least an id\n\n Definition was: ${JSON.stringify(t,null,2)}`);this.streamMessageController.fromStreamerHandlers.get(e)?this.streamMessageController.fromStreamerMessages.add(e,t.id):i.Error(i.GetStackTrace(),`There was no registered handler for "${t}" - try adding one using registerMessageHandler(MessageDirection.FromStreamer, "${e}", myHandler)`);break;default:i.Error(i.GetStackTrace(),`Unknown direction: ${n}`)}})),this.toStreamerMessagesController.SendRequestInitialSettings(),this.toStreamerMessagesController.SendRequestQualityControl()}catch(e){i.Log(i.GetStackTrace(),e)}}onInputControlOwnership(e){const t=new Uint8Array(e);i.Log(i.GetStackTrace(),"DataChannelReceiveMessageType.InputControlOwnership",6);const r=new Boolean(t[1]).valueOf();i.Log(i.GetStackTrace(),`Received input controller message - will your input control the stream: ${r}`),this.pixelStreaming._onInputControlOwnership(r)}onGamepadResponse(e){const t=new TextDecoder("utf-16").decode(e.slice(1)),r=JSON.parse(t);this.gamePadController.onGamepadResponseReceived(r.controllerId)}onAfkTriggered(){this.afkController.onAfkClick(),this.videoPlayer.isPaused()&&this.videoPlayer.hasVideoSource()&&this.playStream()}setAfkEnabled(e){e?this.onAfkTriggered():this.afkController.stopAfkWarningTimer()}restartStreamAutomatically(){if(this.webSocketController)if(this.webSocketController.webSocket&&this.webSocketController.webSocket.readyState!==WebSocket.CLOSED){this.pixelStreaming._showActionOrErrorOnDisconnect=!1,this.setDisconnectMessageOverride("Restarting stream..."),this.closeSignalingServer();const e=setTimeout((()=>{this.pixelStreaming._onWebRtcAutoConnect(),this.connectToSignallingServer(),clearTimeout(e)}),3e3)}else i.Log(i.GetStackTrace(),"A websocket connection has not been made yet so we will start the stream"),this.pixelStreaming._onWebRtcAutoConnect(),this.connectToSignallingServer();else i.Log(i.GetStackTrace(),"The Web Socket Controller does not exist so this will not work right now.")}loadFreezeFrameOrShowPlayOverlay(){this.pixelStreaming.dispatchEvent(new $$9({shouldShowPlayOverlay:this.shouldShowPlayOverlay,isValid:this.freezeFrameController.valid,jpegData:this.freezeFrameController.jpeg})),!0===this.shouldShowPlayOverlay?(i.Log(i.GetStackTrace(),"showing play overlay"),this.resizePlayerStyle()):(i.Log(i.GetStackTrace(),"showing freeze frame"),this.freezeFrameController.showFreezeFrame()),setTimeout((()=>{this.videoPlayer.setVideoEnabled(!1)}),this.freezeFrameController.freezeFrameDelay)}onFreezeFrameMessage(e){i.Log(i.GetStackTrace(),"DataChannelReceiveMessageType.FreezeFrame",6);const t=new Uint8Array(e);this.freezeFrameController.processFreezeFrameMessage(t,(()=>this.loadFreezeFrameOrShowPlayOverlay()))}invalidateFreezeFrameAndEnableVideo(){i.Log(i.GetStackTrace(),"DataChannelReceiveMessageType.FreezeFrame",6),setTimeout((()=>{this.pixelStreaming.dispatchEvent(new q$1),this.freezeFrameController.hideFreezeFrame()}),this.freezeFrameController.freezeFrameDelay),this.videoPlayer.getVideoElement()&&this.videoPlayer.setVideoEnabled(!0)}onFileExtension(e){const t=new Uint8Array(e);Ge.setExtensionFromBytes(t,this.file)}onFileMimeType(e){const t=new Uint8Array(e);Ge.setMimeTypeFromBytes(t,this.file)}onFileContents(e){const t=new Uint8Array(e);Ge.setContentsFromBytes(t,this.file)}playStream(){if(!this.videoPlayer.getVideoElement()){const e="Could not play video stream because the video player was not initialized correctly.";return this.pixelStreaming.dispatchEvent(new N$1({message:e})),i.Error(i.GetStackTrace(),e),this.setDisconnectMessageOverride("Stream not initialized correctly"),void this.closeSignalingServer()}this.videoPlayer.hasVideoSource()?(this.setTouchInputEnabled(this.config.isFlagEnabled(re.TouchInput)),this.pixelStreaming.dispatchEvent(new K$1),this.streamController.audioElement.srcObject?(this.streamController.audioElement.muted=this.config.isFlagEnabled(re.StartVideoMuted),this.streamController.audioElement.play().then((()=>{this.playVideo()})).catch((e=>{i.Log(i.GetStackTrace(),e),i.Log(i.GetStackTrace(),"Browser does not support autoplaying video without interaction - to resolve this we are going to show the play button overlay."),this.pixelStreaming.dispatchEvent(new Q$1({reason:e}))}))):this.playVideo(),this.shouldShowPlayOverlay=!1,this.freezeFrameController.showFreezeFrame()):i.Warning(i.GetStackTrace(),"Cannot play stream, the video element has no srcObject to play.")}playVideo(){this.videoPlayer.play().catch((e=>{this.streamController.audioElement.srcObject&&this.streamController.audioElement.pause(),i.Log(i.GetStackTrace(),e),i.Log(i.GetStackTrace(),"Browser does not support autoplaying video without interaction - to resolve this we are going to show the play button overlay."),this.pixelStreaming.dispatchEvent(new Q$1({reason:e}))}))}autoPlayVideoOrSetUpPlayOverlay(){this.config.isFlagEnabled(re.AutoPlayVideo)&&this.playStream(),this.resizePlayerStyle()}connectToSignallingServer(){const e=this.signallingUrlBuilder();this.webSocketController.connect(e)}startSession(e){if(this.peerConfig=e,this.config.isFlagEnabled(re.ForceTURN)&&!this.checkTurnServerAvailability(e))return i.Info(i.GetStackTrace(),"No turn server was found in the Peer Connection Options. TURN cannot be forced, closing connection. Please use STUN instead"),this.setDisconnectMessageOverride("TURN cannot be forced, closing connection. Please use STUN instead."),void this.closeSignalingServer();this.peerConnectionController=new Ae(this.peerConfig,this.config,this.preferredCodec),this.peerConnectionController.onVideoStats=e=>this.handleVideoStats(e),this.peerConnectionController.onSendWebRTCOffer=e=>this.handleSendWebRTCOffer(e),this.peerConnectionController.onSendWebRTCAnswer=e=>this.handleSendWebRTCAnswer(e),this.peerConnectionController.onPeerIceCandidate=e=>this.handleSendIceCandidate(e),this.peerConnectionController.onDataChannel=e=>this.handleDataChannel(e),this.peerConnectionController.showTextOverlayConnecting=()=>this.pixelStreaming._onWebRtcConnecting(),this.peerConnectionController.showTextOverlaySetupFailure=()=>this.pixelStreaming._onWebRtcFailed();let t=!1;this.peerConnectionController.onIceConnectionStateChange=()=>{!t&&["connected","completed"].includes(this.peerConnectionController.peerConnection.iceConnectionState)&&(this.pixelStreaming._onWebRtcConnected(),t=!0)},this.peerConnectionController.onTrack=e=>this.streamController.handleOnTrack(e),this.config.isFlagEnabled(re.BrowserSendOffer)&&(this.sendrecvDataChannelController.createDataChannel(this.peerConnectionController.peerConnection,"cirrus",this.datachannelOptions),this.sendrecvDataChannelController.handleOnMessage=e=>this.handleOnMessage(e),this.peerConnectionController.createOffer(this.sdpConstraints,this.config))}checkTurnServerAvailability(e){if(!e.iceServers)return i.Info(i.GetStackTrace(),"A turn sever was not found"),!1;for(const t of e.iceServers)for(const e of t.urls)if(e.includes("turn"))return i.Log(i.GetStackTrace(),`A turn sever was found at ${e}`),!0;return i.Info(i.GetStackTrace(),"A turn sever was not found"),!1}handleOnConfigMessage(e){this.resizePlayerStyle(),this.startSession(e.peerConnectionOptions),this.webSocketController.onWebRtcAnswer=e=>this.handleWebRtcAnswer(e),this.webSocketController.onWebRtcOffer=e=>this.handleWebRtcOffer(e),this.webSocketController.onWebRtcPeerDataChannels=e=>this.handleWebRtcSFUPeerDatachannels(e),this.webSocketController.onIceCandidate=e=>this.handleIceCandidate(e)}handleStreamerListMessage(e){i.Log(i.GetStackTrace(),`Got streamer list ${e.ids}`,6);const t=[...e.ids];t.unshift(""),this.config.setOptionSettingOptions(ce.StreamerId,t);const r=new URLSearchParams(window.location.search);let n=null;1==e.ids.length?n=e.ids[0]:this.config.isFlagEnabled(re.PreferSFU)&&e.ids.includes("SFU")?n="SFU":r.has(ce.StreamerId)&&e.ids.includes(r.get(ce.StreamerId))&&(n=r.get(ce.StreamerId)),null!==n&&this.config.setOptionSettingValue(ce.StreamerId,n),this.pixelStreaming.dispatchEvent(new j$1({messageStreamerList:e,autoSelectedStreamerId:n}))}handleWebRtcAnswer(e){i.Log(i.GetStackTrace(),`Got answer sdp ${e.sdp}`,6);const t={sdp:e.sdp,type:"answer"};this.peerConnectionController.receiveAnswer(t),this.handlePostWebrtcNegotiation()}handleWebRtcOffer(e){i.Log(i.GetStackTrace(),`Got offer sdp ${e.sdp}`,6),this.isUsingSFU=!!e.sfu&&e.sfu,this.isUsingSFU&&(this.peerConnectionController.preferredCodec="");const t={sdp:e.sdp,type:"offer"};this.peerConnectionController.receiveOffer(t,this.config),this.handlePostWebrtcNegotiation()}handleWebRtcSFUPeerDatachannels(e){const t={ordered:!0,negotiated:!0,id:e.sendStreamId},r=e.sendStreamId!=e.recvStreamId;if(this.sendrecvDataChannelController.createDataChannel(this.peerConnectionController.peerConnection,r?"send-datachannel":"datachannel",t),r){const t={ordered:!0,negotiated:!0,id:e.recvStreamId};this.recvDataChannelController.createDataChannel(this.peerConnectionController.peerConnection,"recv-datachannel",t),this.recvDataChannelController.handleOnOpen=()=>this.webSocketController.sendSFURecvDataChannelReady(),this.recvDataChannelController.handleOnMessage=e=>this.handleOnMessage(e)}else this.sendrecvDataChannelController.handleOnMessage=e=>this.handleOnMessage(e)}handlePostWebrtcNegotiation(){this.afkController.startAfkWarningTimer(),this.pixelStreaming._onWebRtcSdp(),this.statsTimerHandle&&void 0!==this.statsTimerHandle&&window.clearInterval(this.statsTimerHandle),this.statsTimerHandle=window.setInterval((()=>this.getStats()),1e3),this.setMouseInputEnabled(this.config.isFlagEnabled(re.MouseInput)),this.setKeyboardInputEnabled(this.config.isFlagEnabled(re.KeyboardInput)),this.setGamePadInputEnabled(this.config.isFlagEnabled(re.GamepadInput))}handleIceCandidate(e){i.Log(i.GetStackTrace(),"Web RTC Controller: onWebRtcIce",6);const t=new RTCIceCandidate(e);this.peerConnectionController.handleOnIce(t)}handleSendIceCandidate(e){i.Log(i.GetStackTrace(),"OnIceCandidate",6),e.candidate&&e.candidate.candidate&&this.webSocketController.sendIceCandidate(e.candidate)}handleDataChannel(e){i.Log(i.GetStackTrace(),"Data channel created for us by browser as we are a receiving peer.",6),this.sendrecvDataChannelController.dataChannel=e.channel,this.sendrecvDataChannelController.setupDataChannel(),this.sendrecvDataChannelController.handleOnMessage=e=>this.handleOnMessage(e)}handleSendWebRTCOffer(e){i.Log(i.GetStackTrace(),"Sending the offer to the Server",6),this.webSocketController.sendWebRtcOffer(e)}handleSendWebRTCAnswer(e){i.Log(i.GetStackTrace(),"Sending the answer to the Server",6),this.webSocketController.sendWebRtcAnswer(e),this.isUsingSFU&&this.webSocketController.sendWebRtcDatachannelRequest()}setUpMouseAndFreezeFrame(){this.videoElementParentClientRect=this.videoPlayer.getVideoParentElement().getBoundingClientRect(),this.coordinateConverter.setupNormalizeAndQuantize(),this.freezeFrameController.freezeFrame.resize()}closeSignalingServer(){var e;null===(e=this.webSocketController)||void 0===e||e.close()}closePeerConnection(){var e;null===(e=this.peerConnectionController)||void 0===e||e.close()}close(){this.closeSignalingServer(),this.closePeerConnection()}getStats(){this.peerConnectionController.generateStats()}sendLatencyTest(){this.latencyStartTime=Date.now(),this.sendDescriptorController.sendLatencyTest({StartTime:this.latencyStartTime})}sendEncoderMinQP(e){i.Log(i.GetStackTrace(),`MinQP=${e}\n`,6),null!=e&&this.sendDescriptorController.emitCommand({"Encoder.MinQP":e})}sendEncoderMaxQP(e){i.Log(i.GetStackTrace(),`MaxQP=${e}\n`,6),null!=e&&this.sendDescriptorController.emitCommand({"Encoder.MaxQP":e})}sendWebRTCMinBitrate(e){i.Log(i.GetStackTrace(),`WebRTC Min Bitrate=${e}`,6),null!=e&&this.sendDescriptorController.emitCommand({"WebRTC.MinBitrate":e})}sendWebRTCMaxBitrate(e){i.Log(i.GetStackTrace(),`WebRTC Max Bitrate=${e}`,6),null!=e&&this.sendDescriptorController.emitCommand({"WebRTC.MaxBitrate":e})}sendWebRTCFps(e){i.Log(i.GetStackTrace(),`WebRTC FPS=${e}`,6),null!=e&&(this.sendDescriptorController.emitCommand({"WebRTC.Fps":e}),this.sendDescriptorController.emitCommand({"WebRTC.MaxFps":e}))}sendShowFps(){i.Log(i.GetStackTrace(),"---- Sending show stat to UE ----",6),this.sendDescriptorController.emitCommand({"stat.fps":""})}sendIframeRequest(){i.Log(i.GetStackTrace(),"---- Sending Request for an IFrame ----",6),this.streamMessageController.toStreamerHandlers.get("IFrameRequest")()}emitUIInteraction(e){i.Log(i.GetStackTrace(),"---- Sending custom UIInteraction message ----",6),this.sendDescriptorController.emitUIInteraction(e)}emitCommand(e){i.Log(i.GetStackTrace(),"---- Sending custom Command message ----",6),this.sendDescriptorController.emitCommand(e)}emitConsoleCommand(e){i.Log(i.GetStackTrace(),"---- Sending custom Command:ConsoleCommand message ----",6),this.sendDescriptorController.emitCommand({ConsoleCommand:e})}sendRequestQualityControlOwnership(){i.Log(i.GetStackTrace(),"---- Sending Request to Control Quality ----",6),this.toStreamerMessagesController.SendRequestQualityControl()}handleLatencyTestResult(e){i.Log(i.GetStackTrace(),"DataChannelReceiveMessageType.latencyTest",6);const t=new TextDecoder("utf-16").decode(e.slice(1)),r=new Ie;Object.assign(r,JSON.parse(t)),r.processFields(),r.testStartTimeMs=this.latencyStartTime,r.browserReceiptTimeMs=Date.now(),r.latencyExcludingDecode=~~(r.browserReceiptTimeMs-r.testStartTimeMs),r.testDuration=~~(r.TransmissionTimeMs-r.ReceiptTimeMs),r.networkLatency=~~(r.latencyExcludingDecode-r.testDuration),r.frameDisplayDeltaTimeMs&&r.browserReceiptTimeMs&&(r.endToEndLatency=(r.frameDisplayDeltaTimeMs,r.networkLatency,~~+r.CaptureToSendMs)),this.pixelStreaming._onLatencyTestResult(r)}handleInitialSettings(e){i.Log(i.GetStackTrace(),"DataChannelReceiveMessageType.InitialSettings",6);const t=new TextDecoder("utf-16").decode(e.slice(1)),r=JSON.parse(t),n=new Fe;r.Encoder&&(n.EncoderSettings=r.Encoder),r.WebRTC&&(n.WebRTCSettings=r.WebRTC),r.PixelStreaming&&(n.PixelStreamingSettings=r.PixelStreaming),r.ConfigOptions&&this.config.setFlagEnabled(re.HoveringMouseMode,!!r.ConfigOptions.DefaultToHover),n.ueCompatible(),i.Log(i.GetStackTrace(),t,6),this.pixelStreaming._onInitialSettings(n)}handleVideoEncoderAvgQP(e){i.Log(i.GetStackTrace(),"DataChannelReceiveMessageType.VideoEncoderAvgQP",6);const t=Number(new TextDecoder("utf-16").decode(e.slice(1)));this.setVideoEncoderAvgQP(t)}handleVideoInitialized(){this.pixelStreaming._onVideoInitialized(),this.autoPlayVideoOrSetUpPlayOverlay(),this.resizePlayerStyle(),this.videoPlayer.updateVideoStreamSize()}onQualityControlOwnership(e){const t=new Uint8Array(e);i.Log(i.GetStackTrace(),"DataChannelReceiveMessageType.QualityControlOwnership",6),this.isQualityController=new Boolean(t[1]).valueOf(),i.Log(i.GetStackTrace(),`Received quality controller message, will control quality: ${this.isQualityController}`),this.pixelStreaming._onQualityControlOwnership(this.isQualityController)}handleVideoStats(e){this.pixelStreaming._onVideoStats(e)}resizePlayerStyle(){this.videoPlayer.resizePlayerStyle()}getDisconnectMessageOverride(){return this.disconnectMessageOverride}setDisconnectMessageOverride(e){this.disconnectMessageOverride=e}setPreferredCodec(e){this.preferredCodec=e,this.peerConnectionController&&(this.peerConnectionController.preferredCodec=e,this.peerConnectionController.updateCodecSelection=!1)}setVideoEncoderAvgQP(e){this.videoAvgQp=e,this.pixelStreaming._onVideoEncoderAvgQP(this.videoAvgQp)}setKeyboardInputEnabled(e){var t;null===(t=this.keyboardController)||void 0===t||t.unregisterKeyBoardEvents(),e&&(this.keyboardController=this.inputClassesFactory.registerKeyBoard(this.config))}setMouseInputEnabled(e){var t;if(null===(t=this.mouseController)||void 0===t||t.unregisterMouseEvents(),e){const e=this.config.isFlagEnabled(re.HoveringMouseMode)?ue.HoveringMouse:ue.LockedMouse;this.mouseController=this.inputClassesFactory.registerMouse(e)}}setTouchInputEnabled(e){var t;null===(t=this.touchController)||void 0===t||t.unregisterTouchEvents(),e&&(this.touchController=this.inputClassesFactory.registerTouch(this.config.isFlagEnabled(re.FakeMouseWithTouches),this.videoElementParentClientRect))}setGamePadInputEnabled(e){var t;null===(t=this.gamePadController)||void 0===t||t.unregisterGamePadEvents(),e&&(this.gamePadController=this.inputClassesFactory.registerGamePad(),this.gamePadController.onGamepadConnected=()=>{this.streamMessageController.toStreamerHandlers.get("GamepadConnected")()},this.gamePadController.onGamepadDisconnected=e=>{this.streamMessageController.toStreamerHandlers.get("GamepadDisconnected")([e])})}registerDataChannelEventEmitters(e){e.onOpen=(e,t)=>this.pixelStreaming.dispatchEvent(new B$1({label:e,event:t})),e.onClose=(e,t)=>this.pixelStreaming.dispatchEvent(new _$1({label:e,event:t})),e.onError=(e,t)=>this.pixelStreaming.dispatchEvent(new W$1({label:e,event:t}))}}class gt{static vertexShader(){return"\n\t\tattribute vec2 a_position;\n\t\tattribute vec2 a_texCoord;\n\n\t\t// input\n\t\tuniform vec2 u_resolution;\n\t\tuniform vec4 u_offset;\n\n\t\t//\n\t\tvarying vec2 v_texCoord;\n\n\t\tvoid main() {\n\t\t // convert the rectangle from pixels to 0.0 to 1.0\n\t\t vec2 zeroToOne = a_position / u_resolution;\n\n\t\t // convert from 0->1 to 0->2\n\t\t vec2 zeroToTwo = zeroToOne * 2.0;\n\n\t\t // convert from 0->2 to -1->+1 (clipspace)\n\t\t vec2 clipSpace = zeroToTwo - 1.0;\n\n\t\t gl_Position = vec4(clipSpace * vec2(1, -1), 0, 1);\n\t\t // pass the texCoord to the fragment shader\n\t\t // The GPU will interpolate this value between points.\n\t\t v_texCoord = (a_texCoord * u_offset.xy) + u_offset.zw;\n\t\t}\n\t\t"}static fragmentShader(){return"\n\t\tprecision mediump float;\n\n\t\t// our texture\n\t\tuniform sampler2D u_image;\n\n\t\t// the texCoords passed in from the vertex shader.\n\t\tvarying vec2 v_texCoord;\n\n\t\tvoid main() {\n\t\t gl_FragColor = texture2D(u_image, v_texCoord);\n\t\t}\n\t\t"}}class ut{static deepCopyGamepad(e){return JSON.parse(JSON.stringify({buttons:e.buttons.map((e=>JSON.parse(JSON.stringify({pressed:e.pressed,touched:e.touched})))),axes:e.axes}))}}class mt{constructor(e){this.toStreamerMessagesProvider=e,this.controllers=[]}updateStatus(e,t,r){if(e.gamepad){const n=t.getPose(e.gripSpace,r);if(!n)return;let i=0;e.profiles.includes("htc-vive")?i=1:e.profiles.includes("oculus-touch")&&(i=2),this.toStreamerMessagesProvider.toStreamerHandlers.get("XRSystem")([i]);let s=2;switch(e.handedness){case"left":s=0;break;case"right":s=1}const a=n.transform.matrix,o=[];for(let e=0;e<16;e++)o[e]=new Float32Array([a[e]])[0];this.toStreamerMessagesProvider.toStreamerHandlers.get("XRControllerTransform")([o[0],o[4],o[8],o[12],o[1],o[5],o[9],o[13],o[2],o[6],o[10],o[14],o[3],o[7],o[11],o[15],s]),void 0===this.controllers[s]&&(this.controllers[s]={prevState:void 0,currentState:void 0,id:void 0},this.controllers[s].prevState=ut.deepCopyGamepad(e.gamepad)),this.controllers[s].currentState=ut.deepCopyGamepad(e.gamepad);const l=this.controllers[s],c=l.currentState,h=l.prevState;for(let e=0;e<c.buttons.length;e++){const t=c.buttons[e],r=h.buttons[e];t.pressed?this.toStreamerMessagesProvider.toStreamerHandlers.get("XRButtonPressed")([s,e,r.pressed?1:0]):!t.pressed&&r.pressed&&this.toStreamerMessagesProvider.toStreamerHandlers.get("XRButtonReleased")([s,e,0]),t.touched&&!t.pressed?this.toStreamerMessagesProvider.toStreamerHandlers.get("XRButtonPressed")([s,3,r.touched?1:0]):!t.touched&&r.touched&&this.toStreamerMessagesProvider.toStreamerHandlers.get("XRButtonReleased")([s,3,0])}for(let e=0;e<c.axes.length;e++)this.toStreamerMessagesProvider.toStreamerHandlers.get("XRAnalog")([s,e,c.axes[e]]);this.controllers[s].prevState=c}}}class St{constructor(e){this.xrSession=null,this.webRtcController=e,this.xrControllers=[],this.xrGamepadController=new mt(this.webRtcController.streamMessageController),this.onSessionEnded=new EventTarget,this.onSessionStarted=new EventTarget,this.onFrame=new EventTarget}xrClicked(){this.xrSession?this.xrSession.end():navigator.xr.requestSession("immersive-vr").then((e=>{this.onXrSessionStarted(e)}))}onXrSessionEnded(){i.Log(i.GetStackTrace(),"XR Session ended"),this.xrSession=null,this.onSessionEnded.dispatchEvent(new Event("xrSessionEnded"))}onXrSessionStarted(e){i.Log(i.GetStackTrace(),"XR Session started"),this.xrSession=e,this.xrSession.addEventListener("end",(()=>{this.onXrSessionEnded()}));const t=document.createElement("canvas");this.gl=t.getContext("webgl2",{xrCompatible:!0}),this.xrSession.updateRenderState({baseLayer:new XRWebGLLayer(this.xrSession,this.gl)});const r=this.gl.createShader(this.gl.VERTEX_SHADER);this.gl.shaderSource(r,gt.vertexShader()),this.gl.compileShader(r);const n=this.gl.createShader(this.gl.FRAGMENT_SHADER);this.gl.shaderSource(n,gt.fragmentShader()),this.gl.compileShader(n);const s=this.gl.createProgram();this.gl.attachShader(s,r),this.gl.attachShader(s,n),this.gl.linkProgram(s),this.gl.useProgram(s),this.positionLocation=this.gl.getAttribLocation(s,"a_position"),this.texcoordLocation=this.gl.getAttribLocation(s,"a_texCoord"),this.positionBuffer=this.gl.createBuffer(),this.gl.bindBuffer(this.gl.ARRAY_BUFFER,this.positionBuffer),this.gl.enableVertexAttribArray(this.positionLocation);const a=this.gl.createTexture();this.gl.bindTexture(this.gl.TEXTURE_2D,a),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.NEAREST),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MAG_FILTER,this.gl.NEAREST),this.texcoordBuffer=this.gl.createBuffer(),this.resolutionLocation=this.gl.getUniformLocation(s,"u_resolution"),this.offsetLocation=this.gl.getUniformLocation(s,"u_offset"),e.requestReferenceSpace("local").then((e=>{this.xrRefSpace=e,this.xrSession.requestAnimationFrame(((e,t)=>this.onXrFrame(e,t)))})),this.onSessionStarted.dispatchEvent(new Event("xrSessionStarted"))}onXrFrame(e,t){const r=t.getViewerPose(this.xrRefSpace);if(r){const e=r.transform.matrix,t=[];for(let r=0;r<16;r++)t[r]=new Float32Array([e[r]])[0];this.webRtcController.streamMessageController.toStreamerHandlers.get("XRHMDTransform")([t[0],t[4],t[8],t[12],t[1],t[5],t[9],t[13],t[2],t[6],t[10],t[14],t[3],t[7],t[11],t[15]]);const n=this.xrSession.renderState.baseLayer;this.gl.bindFramebuffer(this.gl.FRAMEBUFFER,n.framebuffer),this.gl.texImage2D(this.gl.TEXTURE_2D,0,this.gl.RGBA,this.gl.RGBA,this.gl.UNSIGNED_BYTE,this.webRtcController.videoPlayer.getVideoElement()),this.render(this.webRtcController.videoPlayer.getVideoElement())}this.webRtcController.config.isFlagEnabled(re.XRControllerInput)&&this.xrSession.inputSources.forEach(((e,r,n)=>{this.xrGamepadController.updateStatus(e,t,this.xrRefSpace)}),this),this.xrSession.requestAnimationFrame(((e,t)=>this.onXrFrame(e,t))),this.onFrame.dispatchEvent(new se({time:e,frame:t}))}render(e){if(!this.gl)return;const t=this.xrSession.renderState.baseLayer;let r,n,i,s,a;this.gl.viewport(0,0,t.framebufferWidth,t.framebufferHeight),this.gl.uniform4f(this.offsetLocation,1,1,0,0),this.gl.bufferData(this.gl.ARRAY_BUFFER,new Float32Array([0,0,e.videoWidth,0,0,e.videoHeight,0,e.videoHeight,e.videoWidth,0,e.videoWidth,e.videoHeight]),this.gl.STATIC_DRAW),this.gl.bindBuffer(this.gl.ARRAY_BUFFER,this.texcoordBuffer),this.gl.bufferData(this.gl.ARRAY_BUFFER,new Float32Array([0,0,1,0,0,1,0,1,1,0,1,1]),this.gl.STATIC_DRAW),this.gl.bindBuffer(this.gl.ARRAY_BUFFER,this.positionBuffer),r=2,n=this.gl.FLOAT,i=!1,s=0,a=0,this.gl.vertexAttribPointer(this.positionLocation,r,n,i,s,a),this.gl.enableVertexAttribArray(this.texcoordLocation),this.gl.bindBuffer(this.gl.ARRAY_BUFFER,this.texcoordBuffer),r=2,n=this.gl.FLOAT,i=!1,s=0,a=0,this.gl.vertexAttribPointer(this.texcoordLocation,r,n,i,s,a),this.gl.uniform2f(this.resolutionLocation,e.videoWidth,e.videoHeight);const o=this.gl.TRIANGLES;a=0,this.gl.drawArrays(o,a,6)}static isSessionSupported(e){return navigator.xr?navigator.xr.isSessionSupported(e):new Promise((()=>!1))}}class pt{constructor(e){this.editTextButton=null,this.hiddenInput=null,"ontouchstart"in document.documentElement&&this.createOnScreenKeyboardHelpers(e)}unquantizeAndDenormalizeUnsigned(e,t){return null}createOnScreenKeyboardHelpers(e){this.hiddenInput||(this.hiddenInput=document.createElement("input"),this.hiddenInput.id="hiddenInput",this.hiddenInput.maxLength=0,e.appendChild(this.hiddenInput)),this.editTextButton||(this.editTextButton=document.createElement("button"),this.editTextButton.id="editTextButton",this.editTextButton.innerHTML="edit text",e.appendChild(this.editTextButton),this.editTextButton.classList.add("hiddenState"),this.editTextButton.addEventListener("touchend",(e=>{this.hiddenInput.focus(),e.preventDefault()})))}showOnScreenKeyboard(e){if(e.showOnScreenKeyboard){this.editTextButton.classList.remove("hiddenState");const t=this.unquantizeAndDenormalizeUnsigned(e.x,e.y);this.editTextButton.style.top=t.y.toString()+"px",this.editTextButton.style.left=(t.x-40).toString()+"px"}else this.editTextButton.classList.add("hiddenState"),this.hiddenInput.blur()}}class vt{constructor(e,t){this._showActionOrErrorOnDisconnect=!0,this.allowConsoleCommands=!1,this.config=e,(null==t?void 0:t.videoElementParent)&&(this._videoElementParent=t.videoElementParent),this._eventEmitter=new ne,this.configureSettings(),this.setWebRtcPlayerController(new ht(this.config,this)),this.onScreenKeyboardHelper=new pt(this.videoElementParent),this.onScreenKeyboardHelper.unquantizeAndDenormalizeUnsigned=(e,t)=>this._webRtcController.requestUnquantizedAndDenormalizeUnsigned(e,t),this._activateOnScreenKeyboard=e=>this.onScreenKeyboardHelper.showOnScreenKeyboard(e),this._webXrController=new St(this._webRtcController)}get videoElementParent(){return this._videoElementParent||(this._videoElementParent=document.createElement("div"),this._videoElementParent.id="videoElementParent"),this._videoElementParent}configureSettings(){this.config._addOnSettingChangedListener(re.IsQualityController,(e=>{!0!==e||this._webRtcController.isQualityController||this._webRtcController.sendRequestQualityControlOwnership()})),this.config._addOnSettingChangedListener(re.AFKDetection,(e=>{this._webRtcController.setAfkEnabled(e)})),this.config._addOnSettingChangedListener(re.MatchViewportResolution,(()=>{this._webRtcController.videoPlayer.updateVideoStreamSize()})),this.config._addOnSettingChangedListener(re.HoveringMouseMode,(e=>{this.config.setFlagLabel(re.HoveringMouseMode,`Control Scheme: ${e?"Hovering":"Locked"} Mouse`),this._webRtcController.setMouseInputEnabled(this.config.isFlagEnabled(re.MouseInput))})),this.config._addOnSettingChangedListener(re.KeyboardInput,(e=>{this._webRtcController.setKeyboardInputEnabled(e)})),this.config._addOnSettingChangedListener(re.MouseInput,(e=>{this._webRtcController.setMouseInputEnabled(e)})),this.config._addOnSettingChangedListener(re.TouchInput,(e=>{this._webRtcController.setTouchInputEnabled(e)})),this.config._addOnSettingChangedListener(re.GamepadInput,(e=>{this._webRtcController.setGamePadInputEnabled(e)})),this.config._addOnNumericSettingChangedListener(oe.MinQP,(e=>{i.Log(i.GetStackTrace(),"-------- Sending MinQP --------",7),this._webRtcController.sendEncoderMinQP(e),i.Log(i.GetStackTrace(),"-------------------------------------------",7)})),this.config._addOnNumericSettingChangedListener(oe.MaxQP,(e=>{i.Log(i.GetStackTrace(),"-------- Sending encoder settings --------",7),this._webRtcController.sendEncoderMaxQP(e),i.Log(i.GetStackTrace(),"-------------------------------------------",7)})),this.config._addOnNumericSettingChangedListener(oe.WebRTCMinBitrate,(e=>{i.Log(i.GetStackTrace(),"-------- Sending web rtc settings --------",7),this._webRtcController.sendWebRTCMinBitrate(1e3*e),i.Log(i.GetStackTrace(),"-------------------------------------------",7)})),this.config._addOnNumericSettingChangedListener(oe.WebRTCMaxBitrate,(e=>{i.Log(i.GetStackTrace(),"-------- Sending web rtc settings --------",7),this._webRtcController.sendWebRTCMaxBitrate(1e3*e),i.Log(i.GetStackTrace(),"-------------------------------------------",7)})),this.config._addOnNumericSettingChangedListener(oe.WebRTCFPS,(e=>{i.Log(i.GetStackTrace(),"-------- Sending web rtc settings --------",7),this._webRtcController.sendWebRTCFps(e),i.Log(i.GetStackTrace(),"-------------------------------------------",7)})),this.config._addOnOptionSettingChangedListener(ce.PreferredCodec,(e=>{this._webRtcController&&this._webRtcController.setPreferredCodec(e)})),this.config._registerOnChangeEvents(this._eventEmitter)}_activateOnScreenKeyboard(e){throw new Error("Method not implemented.")}_onInputControlOwnership(e){this._inputController=e}setWebRtcPlayerController(e){this._webRtcController=e,this._webRtcController.setPreferredCodec(this.config.getSettingOption(ce.PreferredCodec).selected),this._webRtcController.resizePlayerStyle(),this.checkForAutoConnect()}connect(){this._webRtcController.connectToSignallingServer()}reconnect(){this._webRtcController.restartStreamAutomatically()}disconnect(){this._webRtcController.close()}play(){this._onStreamLoading(),this._webRtcController.playStream()}checkForAutoConnect(){this.config.isFlagEnabled(re.AutoConnect)&&(this._onWebRtcAutoConnect(),this._webRtcController.connectToSignallingServer())}_onWebRtcAutoConnect(){this._eventEmitter.dispatchEvent(new O$1),this._showActionOrErrorOnDisconnect=!0}_onWebRtcSdp(){this._eventEmitter.dispatchEvent(new D$1)}_onStreamLoading(){this._eventEmitter.dispatchEvent(new V$1)}_onDisconnect(e){""!=this._webRtcController.getDisconnectMessageOverride()&&void 0!==this._webRtcController.getDisconnectMessageOverride()&&null!=this._webRtcController.getDisconnectMessageOverride()&&(e=this._webRtcController.getDisconnectMessageOverride(),this._webRtcController.setDisconnectMessageOverride("")),this._eventEmitter.dispatchEvent(new z$2({eventString:e,showActionOrErrorOnDisconnect:this._showActionOrErrorOnDisconnect})),0==this._showActionOrErrorOnDisconnect&&(this._showActionOrErrorOnDisconnect=!0)}_onWebRtcConnecting(){this._eventEmitter.dispatchEvent(new U$1)}_onWebRtcConnected(){this._eventEmitter.dispatchEvent(new I$1)}_onWebRtcFailed(){this._eventEmitter.dispatchEvent(new G$1)}_onVideoInitialized(){this._eventEmitter.dispatchEvent(new H$1),this._videoStartTime=Date.now()}_onLatencyTestResult(e){this._eventEmitter.dispatchEvent(new Y$1({latencyTimings:e}))}_onVideoStats(e){this._videoStartTime&&void 0!==this._videoStartTime||(this._videoStartTime=Date.now()),e.handleSessionStatistics(this._videoStartTime,this._inputController,this._webRtcController.videoAvgQp),this._eventEmitter.dispatchEvent(new X$1({aggregatedStats:e}))}_onVideoEncoderAvgQP(e){this._eventEmitter.dispatchEvent(new F$1({avgQP:e}))}_onInitialSettings(e){var t;this._eventEmitter.dispatchEvent(new J$1({settings:e})),e.PixelStreamingSettings&&(this.allowConsoleCommands=null!==(t=e.PixelStreamingSettings.AllowPixelStreamingCommands)&&void 0!==t&&t,!1===this.allowConsoleCommands&&i.Info(i.GetStackTrace(),"-AllowPixelStreamingCommands=false, sending arbitrary console commands from browser to UE is disabled."));const r=this.config.useUrlParams,n=new URLSearchParams(window.location.search);e.EncoderSettings&&(this.config.setNumericSetting(oe.MinQP,r&&n.has(oe.MinQP)?Number.parseInt(n.get(oe.MinQP)):e.EncoderSettings.MinQP),this.config.setNumericSetting(oe.MaxQP,r&&n.has(oe.MaxQP)?Number.parseInt(n.get(oe.MaxQP)):e.EncoderSettings.MaxQP)),e.WebRTCSettings&&(this.config.setNumericSetting(oe.WebRTCMinBitrate,r&&n.has(oe.WebRTCMinBitrate)?Number.parseInt(n.get(oe.WebRTCMinBitrate))/1e3:e.WebRTCSettings.MinBitrate/1e3),this.config.setNumericSetting(oe.WebRTCMaxBitrate,r&&n.has(oe.WebRTCMaxBitrate)?Number.parseInt(n.get(oe.WebRTCMaxBitrate))/1e3:e.WebRTCSettings.MaxBitrate/1e3),this.config.setNumericSetting(oe.WebRTCFPS,r&&n.has(oe.WebRTCFPS)?Number.parseInt(n.get(oe.WebRTCFPS)):e.WebRTCSettings.FPS))}_onQualityControlOwnership(e){this.config.setFlagEnabled(re.IsQualityController,e)}requestLatencyTest(){return!!this._webRtcController.videoPlayer.isVideoReady()&&(this._webRtcController.sendLatencyTest(),!0)}requestShowFps(){return!!this._webRtcController.videoPlayer.isVideoReady()&&(this._webRtcController.sendShowFps(),!0)}requestIframe(){return!!this._webRtcController.videoPlayer.isVideoReady()&&(this._webRtcController.sendIframeRequest(),!0)}emitUIInteraction(e){return!!this._webRtcController.videoPlayer.isVideoReady()&&(this._webRtcController.emitUIInteraction(e),!0)}emitCommand(e){return!(!this._webRtcController.videoPlayer.isVideoReady()||!this.allowConsoleCommands&&"ConsoleCommand"in e||(this._webRtcController.emitCommand(e),0))}emitConsoleCommand(e){return!(!this.allowConsoleCommands||!this._webRtcController.videoPlayer.isVideoReady()||(this._webRtcController.emitConsoleCommand(e),0))}addResponseEventListener(e,t){this._webRtcController.responseController.addResponseEventListener(e,t)}removeResponseEventListener(e){this._webRtcController.responseController.removeResponseEventListener(e)}dispatchEvent(e){return this._eventEmitter.dispatchEvent(e)}addEventListener(e,t){this._eventEmitter.addEventListener(e,t)}removeEventListener(e,t){this._eventEmitter.removeEventListener(e,t)}toggleXR(){this.webXrController.xrClicked()}setSignallingUrlBuilder(e){this._webRtcController.signallingUrlBuilder=e}get webSocketController(){return this._webRtcController.webSocketController}get webXrController(){return this._webXrController}}var Ct=r$1.Dz,ft=r$1.g$,Tt=r$1.Lt,Et=r$1.Q9,yt=r$1.qf,bt=r$1.hV,Mt=r$1.z$,wt=r$1.J0,Pt=r$1.De,kt=r$1.$C,Rt=r$1.al,Lt=r$1._W,xt=r$1.tz,At=r$1.Nu,Ft=r$1.zg,Dt=r$1.vp,Ot=r$1.vU,Ut=r$1.wF,It=r$1.rv,Gt=r$1.Nh,zt=r$1.ss,Bt=r$1.qW,_t=r$1.QL,Wt=r$1.cf,Ht=r$1.eM,Vt=r$1.Yd,Nt=r$1.iM,Kt=r$1.qy,Qt=r$1.ce,$t=r$1.sK,qt=r$1.Ok,Xt=r$1.q5,jt=r$1.g,Yt=r$1.xl,Jt=r$1.I,Zt=r$1.bx,es=r$1.Ib,ts=r$1.Az,ss=r$1.Iw,ns$1=r$1.qY,rs=r$1.db,is=r$1.mR,os=r$1.Tn,as=r$1.rV,ds=r$1.gh,ls=r$1.i5,cs=r$1.x_,hs=r$1.Am,gs=r$1.eR,us=r$1.r8,ms=r$1.u3,Ss=r$1.vd,ps=r$1.iV,vs=r$1.jZ,Cs=r$1.SW,fs=r$1.ZH,Ts=r$1.Ni,Es=r$1.lh,ys=r$1.bq,bs=r$1.$f,Ms=r$1.eu,ws=r$1.Ax,Ps=r$1.Mc;function _extends(){return _extends=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},_extends.apply(this,arguments)}var _typeof$1="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},isBrowser="object"===("undefined"==typeof window?"undefined":_typeof$1(window))&&"object"===("undefined"==typeof document?"undefined":_typeof$1(document))&&9===document.nodeType;function _typeof(e){return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},_typeof(e)}function _toPrimitive(e,t){if("object"!==_typeof(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!==_typeof(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}function _toPropertyKey(e){var t=_toPrimitive(e,"string");return"symbol"===_typeof(t)?t:String(t)}function _defineProperties(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,_toPropertyKey(n.key),n)}}function _createClass(e,t,r){return t&&_defineProperties(e.prototype,t),r&&_defineProperties(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function _setPrototypeOf(e,t){return _setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},_setPrototypeOf(e,t)}function _inheritsLoose(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,_setPrototypeOf(e,t)}function _assertThisInitialized(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function _objectWithoutPropertiesLoose(e,t){if(null==e)return{};var r,n,i={},s=Object.keys(e);for(n=0;n<s.length;n++)r=s[n],t.indexOf(r)>=0||(i[r]=e[r]);return i}var plainObjectConstrurctor={}.constructor;function cloneStyle(e){if(null==e||"object"!=typeof e)return e;if(Array.isArray(e))return e.map(cloneStyle);if(e.constructor!==plainObjectConstrurctor)return e;var t={};for(var r in e)t[r]=cloneStyle(e[r]);return t}function createRule(e,t,r){void 0===e&&(e="unnamed");var n=r.jss,i=cloneStyle(t),s=n.plugins.onCreateRule(e,i,r);return s||(e[0],null)}var join$4=function(e,t){for(var r="",n=0;n<e.length&&"!important"!==e[n];n++)r&&(r+=t),r+=e[n];return r},toCssValue=function(e){if(!Array.isArray(e))return e;var t="";if(Array.isArray(e[0]))for(var r=0;r<e.length&&"!important"!==e[r];r++)t&&(t+=", "),t+=join$4(e[r]," ");else t=join$4(e,", ");return"!important"===e[e.length-1]&&(t+=" !important"),t};function getWhitespaceSymbols(e){return e&&!1===e.format?{linebreak:"",space:""}:{linebreak:"\n",space:" "}}function indentStr(e,t){for(var r="",n=0;n<t;n++)r+=" ";return r+e}function toCss(e,t,r){void 0===r&&(r={});var n="";if(!t)return n;var i=r.indent,s=void 0===i?0:i,a=t.fallbacks;!1===r.format&&(s=-1/0);var o=getWhitespaceSymbols(r),l=o.linebreak,c=o.space;if(e&&s++,a)if(Array.isArray(a))for(var h=0;h<a.length;h++){var d=a[h];for(var u in d){var p=d[u];null!=p&&(n&&(n+=l),n+=indentStr(u+":"+c+toCssValue(p)+";",s))}}else for(var f in a){var m=a[f];null!=m&&(n&&(n+=l),n+=indentStr(f+":"+c+toCssValue(m)+";",s))}for(var g in t){var y=t[g];null!=y&&"fallbacks"!==g&&(n&&(n+=l),n+=indentStr(g+":"+c+toCssValue(y)+";",s))}return(n||r.allowEmpty)&&e?(n&&(n=""+l+n+l),indentStr(""+e+c+"{"+n,--s)+indentStr("}",s)):n}var escapeRegex=/([[\].#*$><+~=|^:(),"'`\s])/g,nativeEscape="undefined"!=typeof CSS&&CSS.escape,escape=function(e){return nativeEscape?nativeEscape(e):e.replace(escapeRegex,"\\$1")},BaseStyleRule=function(){function e(e,t,r){this.type="style",this.isProcessed=!1;var n=r.sheet,i=r.Renderer;this.key=e,this.options=r,this.style=t,n?this.renderer=n.renderer:i&&(this.renderer=new i)}return e.prototype.prop=function(e,t,r){if(void 0===t)return this.style[e];var n=!!r&&r.force;if(!n&&this.style[e]===t)return this;var i=t;r&&!1===r.process||(i=this.options.jss.plugins.onChangeValue(t,e,this));var s=null==i||!1===i,a=e in this.style;if(s&&!a&&!n)return this;var o=s&&a;if(o?delete this.style[e]:this.style[e]=i,this.renderable&&this.renderer)return o?this.renderer.removeProperty(this.renderable,e):this.renderer.setProperty(this.renderable,e,i),this;var l=this.options.sheet;return l&&l.attached,this},e}(),StyleRule=function(e){function t(t,r,n){var i;i=e.call(this,t,r,n)||this;var s=n.selector,a=n.scoped,o=n.sheet,l=n.generateId;return s?i.selectorText=s:!1!==a&&(i.id=l(_assertThisInitialized(_assertThisInitialized(i)),o),i.selectorText="."+escape(i.id)),i}_inheritsLoose(t,e);var r=t.prototype;return r.applyTo=function(e){var t=this.renderer;if(t){var r=this.toJSON();for(var n in r)t.setProperty(e,n,r[n])}return this},r.toJSON=function(){var e={};for(var t in this.style){var r=this.style[t];"object"!=typeof r?e[t]=r:Array.isArray(r)&&(e[t]=toCssValue(r))}return e},r.toString=function(e){var t=this.options.sheet,r=!!t&&t.options.link?_extends({},e,{allowEmpty:!0}):e;return toCss(this.selectorText,this.style,r)},_createClass(t,[{key:"selector",set:function(e){if(e!==this.selectorText){this.selectorText=e;var t=this.renderer,r=this.renderable;if(r&&t)t.setSelector(r,e)||t.replaceRule(r,this)}},get:function(){return this.selectorText}}]),t}(BaseStyleRule),pluginStyleRule={onCreateRule:function(e,t,r){return"@"===e[0]||r.parent&&"keyframes"===r.parent.type?null:new StyleRule(e,t,r)}},defaultToStringOptions={indent:1,children:!0},atRegExp=/@([\w-]+)/,ConditionalRule=function(){function e(e,t,r){this.type="conditional",this.isProcessed=!1,this.key=e;var n=e.match(atRegExp);for(var i in this.at=n?n[1]:"unknown",this.query=r.name||"@"+this.at,this.options=r,this.rules=new RuleList(_extends({},r,{parent:this})),t)this.rules.add(i,t[i]);this.rules.process()}var t=e.prototype;return t.getRule=function(e){return this.rules.get(e)},t.indexOf=function(e){return this.rules.indexOf(e)},t.addRule=function(e,t,r){var n=this.rules.add(e,t,r);return n?(this.options.jss.plugins.onProcessRule(n),n):null},t.replaceRule=function(e,t,r){var n=this.rules.replace(e,t,r);return n&&this.options.jss.plugins.onProcessRule(n),n},t.toString=function(e){void 0===e&&(e=defaultToStringOptions);var t=getWhitespaceSymbols(e).linebreak;if(null==e.indent&&(e.indent=defaultToStringOptions.indent),null==e.children&&(e.children=defaultToStringOptions.children),!1===e.children)return this.query+" {}";var r=this.rules.toString(e);return r?this.query+" {"+t+r+t+"}":""},e}(),keyRegExp=/@container|@media|@supports\s+/,pluginConditionalRule={onCreateRule:function(e,t,r){return keyRegExp.test(e)?new ConditionalRule(e,t,r):null}},defaultToStringOptions$1={indent:1,children:!0},nameRegExp=/@keyframes\s+([\w-]+)/,KeyframesRule=function(){function e(e,t,r){this.type="keyframes",this.at="@keyframes",this.isProcessed=!1;var n=e.match(nameRegExp);n&&n[1]?this.name=n[1]:this.name="noname",this.key=this.type+"-"+this.name,this.options=r;var i=r.scoped,s=r.sheet,a=r.generateId;for(var o in this.id=!1===i?this.name:escape(a(this,s)),this.rules=new RuleList(_extends({},r,{parent:this})),t)this.rules.add(o,t[o],_extends({},r,{parent:this}));this.rules.process()}return e.prototype.toString=function(e){void 0===e&&(e=defaultToStringOptions$1);var t=getWhitespaceSymbols(e).linebreak;if(null==e.indent&&(e.indent=defaultToStringOptions$1.indent),null==e.children&&(e.children=defaultToStringOptions$1.children),!1===e.children)return this.at+" "+this.id+" {}";var r=this.rules.toString(e);return r&&(r=""+t+r+t),this.at+" "+this.id+" {"+r+"}"},e}(),keyRegExp$1=/@keyframes\s+/,refRegExp=/\$([\w-]+)/g,findReferencedKeyframe=function(e,t){return"string"==typeof e?e.replace(refRegExp,(function(e,r){return r in t?t[r]:e})):e},replaceRef=function(e,t,r){var n=e[t],i=findReferencedKeyframe(n,r);i!==n&&(e[t]=i)},pluginKeyframesRule={onCreateRule:function(e,t,r){return"string"==typeof e&&keyRegExp$1.test(e)?new KeyframesRule(e,t,r):null},onProcessStyle:function(e,t,r){return"style"===t.type&&r?("animation-name"in e&&replaceRef(e,"animation-name",r.keyframes),"animation"in e&&replaceRef(e,"animation",r.keyframes),e):e},onChangeValue:function(e,t,r){var n=r.options.sheet;if(!n)return e;switch(t){case"animation":case"animation-name":return findReferencedKeyframe(e,n.keyframes);default:return e}}},KeyframeRule=function(e){function t(){return e.apply(this,arguments)||this}return _inheritsLoose(t,e),t.prototype.toString=function(e){var t=this.options.sheet,r=!!t&&t.options.link?_extends({},e,{allowEmpty:!0}):e;return toCss(this.key,this.style,r)},t}(BaseStyleRule),pluginKeyframeRule={onCreateRule:function(e,t,r){return r.parent&&"keyframes"===r.parent.type?new KeyframeRule(e,t,r):null}},FontFaceRule=function(){function e(e,t,r){this.type="font-face",this.at="@font-face",this.isProcessed=!1,this.key=e,this.style=t,this.options=r}return e.prototype.toString=function(e){var t=getWhitespaceSymbols(e).linebreak;if(Array.isArray(this.style)){for(var r="",n=0;n<this.style.length;n++)r+=toCss(this.at,this.style[n]),this.style[n+1]&&(r+=t);return r}return toCss(this.at,this.style,e)},e}(),keyRegExp$2=/@font-face/,pluginFontFaceRule={onCreateRule:function(e,t,r){return keyRegExp$2.test(e)?new FontFaceRule(e,t,r):null}},ViewportRule=function(){function e(e,t,r){this.type="viewport",this.at="@viewport",this.isProcessed=!1,this.key=e,this.style=t,this.options=r}return e.prototype.toString=function(e){return toCss(this.key,this.style,e)},e}(),pluginViewportRule={onCreateRule:function(e,t,r){return"@viewport"===e||"@-ms-viewport"===e?new ViewportRule(e,t,r):null}},SimpleRule=function(){function e(e,t,r){this.type="simple",this.isProcessed=!1,this.key=e,this.value=t,this.options=r}return e.prototype.toString=function(e){if(Array.isArray(this.value)){for(var t="",r=0;r<this.value.length;r++)t+=this.key+" "+this.value[r]+";",this.value[r+1]&&(t+="\n");return t}return this.key+" "+this.value+";"},e}(),keysMap={"@charset":!0,"@import":!0,"@namespace":!0},pluginSimpleRule={onCreateRule:function(e,t,r){return e in keysMap?new SimpleRule(e,t,r):null}},plugins=[pluginStyleRule,pluginConditionalRule,pluginKeyframesRule,pluginKeyframeRule,pluginFontFaceRule,pluginViewportRule,pluginSimpleRule],defaultUpdateOptions={process:!0},forceUpdateOptions={force:!0,process:!0},RuleList=function(){function e(e){this.map={},this.raw={},this.index=[],this.counter=0,this.options=e,this.classes=e.classes,this.keyframes=e.keyframes}var t=e.prototype;return t.add=function(e,t,r){var n=this.options,i=n.parent,s=n.sheet,a=n.jss,o=n.Renderer,l=n.generateId,c=n.scoped,h=_extends({classes:this.classes,parent:i,sheet:s,jss:a,Renderer:o,generateId:l,scoped:c,name:e,keyframes:this.keyframes,selector:void 0},r),d=e;e in this.raw&&(d=e+"-d"+this.counter++),this.raw[d]=t,d in this.classes&&(h.selector="."+escape(this.classes[d]));var u=createRule(d,t,h);if(!u)return null;this.register(u);var p=void 0===h.index?this.index.length:h.index;return this.index.splice(p,0,u),u},t.replace=function(e,t,r){var n=this.get(e),i=this.index.indexOf(n);n&&this.remove(n);var s=r;return-1!==i&&(s=_extends({},r,{index:i})),this.add(e,t,s)},t.get=function(e){return this.map[e]},t.remove=function(e){this.unregister(e),delete this.raw[e.key],this.index.splice(this.index.indexOf(e),1)},t.indexOf=function(e){return this.index.indexOf(e)},t.process=function(){var e=this.options.jss.plugins;this.index.slice(0).forEach(e.onProcessRule,e)},t.register=function(e){this.map[e.key]=e,e instanceof StyleRule?(this.map[e.selector]=e,e.id&&(this.classes[e.key]=e.id)):e instanceof KeyframesRule&&this.keyframes&&(this.keyframes[e.name]=e.id)},t.unregister=function(e){delete this.map[e.key],e instanceof StyleRule?(delete this.map[e.selector],delete this.classes[e.key]):e instanceof KeyframesRule&&delete this.keyframes[e.name]},t.update=function(){var e,t,r;if("string"==typeof(arguments.length<=0?void 0:arguments[0])?(e=arguments.length<=0?void 0:arguments[0],t=arguments.length<=1?void 0:arguments[1],r=arguments.length<=2?void 0:arguments[2]):(t=arguments.length<=0?void 0:arguments[0],r=arguments.length<=1?void 0:arguments[1],e=null),e)this.updateOne(this.get(e),t,r);else for(var n=0;n<this.index.length;n++)this.updateOne(this.index[n],t,r)},t.updateOne=function(t,r,n){void 0===n&&(n=defaultUpdateOptions);var i=this.options,s=i.jss.plugins,a=i.sheet;if(t.rules instanceof e)t.rules.update(r,n);else{var o=t.style;if(s.onUpdate(r,t,a,n),n.process&&o&&o!==t.style){for(var l in s.onProcessStyle(t.style,t,a),t.style){var c=t.style[l];c!==o[l]&&t.prop(l,c,forceUpdateOptions)}for(var h in o){var d=t.style[h],u=o[h];null==d&&d!==u&&t.prop(h,null,forceUpdateOptions)}}}},t.toString=function(e){for(var t="",r=this.options.sheet,n=!!r&&r.options.link,i=getWhitespaceSymbols(e).linebreak,s=0;s<this.index.length;s++){var a=this.index[s].toString(e);(a||n)&&(t&&(t+=i),t+=a)}return t},e}(),StyleSheet=function(){function e(e,t){for(var r in this.attached=!1,this.deployed=!1,this.classes={},this.keyframes={},this.options=_extends({},t,{sheet:this,parent:this,classes:this.classes,keyframes:this.keyframes}),t.Renderer&&(this.renderer=new t.Renderer(this)),this.rules=new RuleList(this.options),e)this.rules.add(r,e[r]);this.rules.process()}var t=e.prototype;return t.attach=function(){return this.attached||(this.renderer&&this.renderer.attach(),this.attached=!0,this.deployed||this.deploy()),this},t.detach=function(){return this.attached?(this.renderer&&this.renderer.detach(),this.attached=!1,this):this},t.addRule=function(e,t,r){var n=this.queue;this.attached&&!n&&(this.queue=[]);var i=this.rules.add(e,t,r);return i?(this.options.jss.plugins.onProcessRule(i),this.attached?this.deployed?(n?n.push(i):(this.insertRule(i),this.queue&&(this.queue.forEach(this.insertRule,this),this.queue=void 0)),i):i:(this.deployed=!1,i)):null},t.replaceRule=function(e,t,r){var n=this.rules.get(e);if(!n)return this.addRule(e,t,r);var i=this.rules.replace(e,t,r);return i&&this.options.jss.plugins.onProcessRule(i),this.attached?this.deployed?(this.renderer&&(i?n.renderable&&this.renderer.replaceRule(n.renderable,i):this.renderer.deleteRule(n)),i):i:(this.deployed=!1,i)},t.insertRule=function(e){this.renderer&&this.renderer.insertRule(e)},t.addRules=function(e,t){var r=[];for(var n in e){var i=this.addRule(n,e[n],t);i&&r.push(i)}return r},t.getRule=function(e){return this.rules.get(e)},t.deleteRule=function(e){var t="object"==typeof e?e:this.rules.get(e);return!(!t||this.attached&&!t.renderable)&&(this.rules.remove(t),!(this.attached&&t.renderable&&this.renderer)||this.renderer.deleteRule(t.renderable))},t.indexOf=function(e){return this.rules.indexOf(e)},t.deploy=function(){return this.renderer&&this.renderer.deploy(),this.deployed=!0,this},t.update=function(){var e;return(e=this.rules).update.apply(e,arguments),this},t.updateOne=function(e,t,r){return this.rules.updateOne(e,t,r),this},t.toString=function(e){return this.rules.toString(e)},e}(),PluginsRegistry=function(){function e(){this.plugins={internal:[],external:[]},this.registry={}}var t=e.prototype;return t.onCreateRule=function(e,t,r){for(var n=0;n<this.registry.onCreateRule.length;n++){var i=this.registry.onCreateRule[n](e,t,r);if(i)return i}return null},t.onProcessRule=function(e){if(!e.isProcessed){for(var t=e.options.sheet,r=0;r<this.registry.onProcessRule.length;r++)this.registry.onProcessRule[r](e,t);e.style&&this.onProcessStyle(e.style,e,t),e.isProcessed=!0}},t.onProcessStyle=function(e,t,r){for(var n=0;n<this.registry.onProcessStyle.length;n++)t.style=this.registry.onProcessStyle[n](t.style,t,r)},t.onProcessSheet=function(e){for(var t=0;t<this.registry.onProcessSheet.length;t++)this.registry.onProcessSheet[t](e)},t.onUpdate=function(e,t,r,n){for(var i=0;i<this.registry.onUpdate.length;i++)this.registry.onUpdate[i](e,t,r,n)},t.onChangeValue=function(e,t,r){for(var n=e,i=0;i<this.registry.onChangeValue.length;i++)n=this.registry.onChangeValue[i](n,t,r);return n},t.use=function(e,t){void 0===t&&(t={queue:"external"});var r=this.plugins[t.queue];-1===r.indexOf(e)&&(r.push(e),this.registry=[].concat(this.plugins.external,this.plugins.internal).reduce((function(e,t){for(var r in t)r in e&&e[r].push(t[r]);return e}),{onCreateRule:[],onProcessRule:[],onProcessStyle:[],onProcessSheet:[],onChangeValue:[],onUpdate:[]}))},e}(),SheetsRegistry=function(){function e(){this.registry=[]}var t=e.prototype;return t.add=function(e){var t=this.registry,r=e.options.index;if(-1===t.indexOf(e))if(0===t.length||r>=this.index)t.push(e);else for(var n=0;n<t.length;n++)if(t[n].options.index>r)return void t.splice(n,0,e)},t.reset=function(){this.registry=[]},t.remove=function(e){var t=this.registry.indexOf(e);this.registry.splice(t,1)},t.toString=function(e){for(var t=void 0===e?{}:e,r=t.attached,n=_objectWithoutPropertiesLoose(t,["attached"]),i=getWhitespaceSymbols(n).linebreak,s="",a=0;a<this.registry.length;a++){var o=this.registry[a];null!=r&&o.attached!==r||(s&&(s+=i),s+=o.toString(n))}return s},_createClass(e,[{key:"index",get:function(){return 0===this.registry.length?0:this.registry[this.registry.length-1].options.index}}]),e}(),sheets=new SheetsRegistry,globalThis$1="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window&&window.Math===Math?window:"undefined"!=typeof self&&self.Math===Math?self:Function("return this")(),ns="2f1acc6c3a606b082e5eef5e54414ffb";null==globalThis$1[ns]&&(globalThis$1[ns]=0);var moduleId=globalThis$1[ns]++,createGenerateId=function(e){void 0===e&&(e={});var t=0;return function(r,n){t+=1;var i="",s="";return n&&(n.options.classNamePrefix&&(s=n.options.classNamePrefix),null!=n.options.jss.id&&(i=String(n.options.jss.id))),e.minify?""+(s||"c")+moduleId+i+t:s+r.key+"-"+moduleId+(i?"-"+i:"")+"-"+t}},memoize=function(e){var t;return function(){return t||(t=e()),t}},getPropertyValue=function(e,t){try{return e.attributeStyleMap?e.attributeStyleMap.get(t):e.style.getPropertyValue(t)}catch(e){return""}},setProperty=function(e,t,r){try{var n=r;if(Array.isArray(r)&&(n=toCssValue(r)),e.attributeStyleMap)e.attributeStyleMap.set(t,n);else{var i=n?n.indexOf("!important"):-1,s=i>-1?n.substr(0,i-1):n;e.style.setProperty(t,s,i>-1?"important":"")}}catch(e){return!1}return!0},removeProperty=function(e,t){try{e.attributeStyleMap?e.attributeStyleMap.delete(t):e.style.removeProperty(t)}catch(e){}},setSelector=function(e,t){return e.selectorText=t,e.selectorText===t},getHead=memoize((function(){return document.querySelector("head")}));function findHigherSheet(e,t){for(var r=0;r<e.length;r++){var n=e[r];if(n.attached&&n.options.index>t.index&&n.options.insertionPoint===t.insertionPoint)return n}return null}function findHighestSheet(e,t){for(var r=e.length-1;r>=0;r--){var n=e[r];if(n.attached&&n.options.insertionPoint===t.insertionPoint)return n}return null}function findCommentNode(e){for(var t=getHead(),r=0;r<t.childNodes.length;r++){var n=t.childNodes[r];if(8===n.nodeType&&n.nodeValue.trim()===e)return n}return null}function findPrevNode(e){var t=sheets.registry;if(t.length>0){var r=findHigherSheet(t,e);if(r&&r.renderer)return{parent:r.renderer.element.parentNode,node:r.renderer.element};if((r=findHighestSheet(t,e))&&r.renderer)return{parent:r.renderer.element.parentNode,node:r.renderer.element.nextSibling}}var n=e.insertionPoint;if(n&&"string"==typeof n){var i=findCommentNode(n);if(i)return{parent:i.parentNode,node:i.nextSibling}}return!1}function insertStyle(e,t){var r=t.insertionPoint,n=findPrevNode(t);if(!1!==n&&n.parent)n.parent.insertBefore(e,n.node);else if(r&&"number"==typeof r.nodeType){var i=r,s=i.parentNode;s&&s.insertBefore(e,i.nextSibling)}else getHead().appendChild(e)}var getNonce=memoize((function(){var e=document.querySelector('meta[property="csp-nonce"]');return e?e.getAttribute("content"):null})),_insertRule=function(e,t,r){try{"insertRule"in e?e.insertRule(t,r):"appendRule"in e&&e.appendRule(t)}catch(e){return!1}return e.cssRules[r]},getValidRuleInsertionIndex=function(e,t){var r=e.cssRules.length;return void 0===t||t>r?r:t},createStyle=function(){var e=document.createElement("style");return e.textContent="\n",e},DomRenderer=function(){function e(e){this.getPropertyValue=getPropertyValue,this.setProperty=setProperty,this.removeProperty=removeProperty,this.setSelector=setSelector,this.hasInsertedRules=!1,this.cssRules=[],e&&sheets.add(e),this.sheet=e;var t=this.sheet?this.sheet.options:{},r=t.media,n=t.meta,i=t.element;this.element=i||createStyle(),this.element.setAttribute("data-jss",""),r&&this.element.setAttribute("media",r),n&&this.element.setAttribute("data-meta",n);var s=getNonce();s&&this.element.setAttribute("nonce",s)}var t=e.prototype;return t.attach=function(){if(!this.element.parentNode&&this.sheet){insertStyle(this.element,this.sheet.options);var e=Boolean(this.sheet&&this.sheet.deployed);this.hasInsertedRules&&e&&(this.hasInsertedRules=!1,this.deploy())}},t.detach=function(){if(this.sheet){var e=this.element.parentNode;e&&e.removeChild(this.element),this.sheet.options.link&&(this.cssRules=[],this.element.textContent="\n")}},t.deploy=function(){var e=this.sheet;e&&(e.options.link?this.insertRules(e.rules):this.element.textContent="\n"+e.toString()+"\n")},t.insertRules=function(e,t){for(var r=0;r<e.index.length;r++)this.insertRule(e.index[r],r,t)},t.insertRule=function(e,t,r){if(void 0===r&&(r=this.element.sheet),e.rules){var n=e,i=r;if("conditional"===e.type||"keyframes"===e.type){var s=getValidRuleInsertionIndex(r,t);if(!1===(i=_insertRule(r,n.toString({children:!1}),s)))return!1;this.refCssRule(e,s,i)}return this.insertRules(n.rules,i),i}var a=e.toString();if(!a)return!1;var o=getValidRuleInsertionIndex(r,t),l=_insertRule(r,a,o);return!1!==l&&(this.hasInsertedRules=!0,this.refCssRule(e,o,l),l)},t.refCssRule=function(e,t,r){e.renderable=r,e.options.parent instanceof StyleSheet&&this.cssRules.splice(t,0,r)},t.deleteRule=function(e){var t=this.element.sheet,r=this.indexOf(e);return-1!==r&&(t.deleteRule(r),this.cssRules.splice(r,1),!0)},t.indexOf=function(e){return this.cssRules.indexOf(e)},t.replaceRule=function(e,t){var r=this.indexOf(e);return-1!==r&&(this.element.sheet.deleteRule(r),this.cssRules.splice(r,1),this.insertRule(t,r))},t.getRules=function(){return this.element.sheet.cssRules},e}(),instanceCounter=0,Jss=function(){function e(e){this.id=instanceCounter++,this.version="10.10.0",this.plugins=new PluginsRegistry,this.options={id:{minify:!1},createGenerateId:createGenerateId,Renderer:isBrowser?DomRenderer:null,plugins:[]},this.generateId=createGenerateId({minify:!1});for(var t=0;t<plugins.length;t++)this.plugins.use(plugins[t],{queue:"internal"});this.setup(e)}var t=e.prototype;return t.setup=function(e){return void 0===e&&(e={}),e.createGenerateId&&(this.options.createGenerateId=e.createGenerateId),e.id&&(this.options.id=_extends({},this.options.id,e.id)),(e.createGenerateId||e.id)&&(this.generateId=this.options.createGenerateId(this.options.id)),null!=e.insertionPoint&&(this.options.insertionPoint=e.insertionPoint),"Renderer"in e&&(this.options.Renderer=e.Renderer),e.plugins&&this.use.apply(this,e.plugins),this},t.createStyleSheet=function(e,t){void 0===t&&(t={});var r=t.index;"number"!=typeof r&&(r=0===sheets.index?0:sheets.index+1);var n=new StyleSheet(e,_extends({},t,{jss:this,generateId:t.generateId||this.generateId,insertionPoint:this.options.insertionPoint,Renderer:this.options.Renderer,index:r}));return this.plugins.onProcessSheet(n),n},t.removeStyleSheet=function(e){return e.detach(),sheets.remove(e),this},t.createRule=function(e,t,r){if(void 0===t&&(t={}),void 0===r&&(r={}),"object"==typeof e)return this.createRule(void 0,e,t);var n=_extends({},r,{name:e,jss:this,Renderer:this.options.Renderer});n.generateId||(n.generateId=this.generateId),n.classes||(n.classes={}),n.keyframes||(n.keyframes={});var i=createRule(e,t,n);return i&&this.plugins.onProcessRule(i),i},t.use=function(){for(var e=this,t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return r.forEach((function(t){e.plugins.use(t)})),this},e}(),createJss=function(e){return new Jss(e)},index=createJss(),index$1=index,at$1="@global",atPrefix="@global ",GlobalContainerRule=function(){function e(e,t,r){for(var n in this.type="global",this.at=at$1,this.isProcessed=!1,this.key=e,this.options=r,this.rules=new RuleList(_extends({},r,{parent:this})),t)this.rules.add(n,t[n]);this.rules.process()}var t=e.prototype;return t.getRule=function(e){return this.rules.get(e)},t.addRule=function(e,t,r){var n=this.rules.add(e,t,r);return n&&this.options.jss.plugins.onProcessRule(n),n},t.replaceRule=function(e,t,r){var n=this.rules.replace(e,t,r);return n&&this.options.jss.plugins.onProcessRule(n),n},t.indexOf=function(e){return this.rules.indexOf(e)},t.toString=function(e){return this.rules.toString(e)},e}(),GlobalPrefixedRule=function(){function e(e,t,r){this.type="global",this.at=at$1,this.isProcessed=!1,this.key=e,this.options=r;var n=e.substr(atPrefix.length);this.rule=r.jss.createRule(n,t,_extends({},r,{parent:this}))}return e.prototype.toString=function(e){return this.rule?this.rule.toString(e):""},e}(),separatorRegExp=/\s*,\s*/g;function addScope(e,t){for(var r=e.split(separatorRegExp),n="",i=0;i<r.length;i++)n+=t+" "+r[i].trim(),r[i+1]&&(n+=", ");return n}function handleNestedGlobalContainerRule(e,t){var r=e.options,n=e.style,i=n?n[at$1]:null;if(i){for(var s in i)t.addRule(s,i[s],_extends({},r,{selector:addScope(s,e.selector)}));delete n[at$1]}}function handlePrefixedGlobalRule(e,t){var r=e.options,n=e.style;for(var i in n)if("@"===i[0]&&i.substr(0,at$1.length)===at$1){var s=addScope(i.substr(at$1.length),e.selector);t.addRule(s,n[i],_extends({},r,{selector:s})),delete n[i]}}function jssGlobal(){return{onCreateRule:function(e,t,r){if(!e)return null;if(e===at$1)return new GlobalContainerRule(e,t,r);if("@"===e[0]&&e.substr(0,atPrefix.length)===atPrefix)return new GlobalPrefixedRule(e,t,r);var n=r.parent;return n&&("global"===n.type||n.options.parent&&"global"===n.options.parent.type)&&(r.scoped=!1),r.selector||!1!==r.scoped||(r.selector=e),null},onProcessRule:function(e,t){"style"===e.type&&t&&(handleNestedGlobalContainerRule(e,t),handlePrefixedGlobalRule(e,t))}}}var uppercasePattern=/[A-Z]/g,msPattern=/^ms-/,cache={};function toHyphenLower(e){return"-"+e.toLowerCase()}function hyphenateStyleName(e){if(cache.hasOwnProperty(e))return cache[e];var t=e.replace(uppercasePattern,toHyphenLower);return cache[e]=msPattern.test(t)?"-"+t:t}function convertCase(e){var t={};for(var r in e){t[0===r.indexOf("--")?r:hyphenateStyleName(r)]=e[r]}return e.fallbacks&&(Array.isArray(e.fallbacks)?t.fallbacks=e.fallbacks.map(convertCase):t.fallbacks=convertCase(e.fallbacks)),t}function camelCase(){return{onProcessStyle:function(e){if(Array.isArray(e)){for(var t=0;t<e.length;t++)e[t]=convertCase(e[t]);return e}return convertCase(e)},onChangeValue:function(e,t,r){if(0===t.indexOf("--"))return e;var n=hyphenateStyleName(t);return t===n?e:(r.prop(n,e),null)}}}var n={d:(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t)},o={};n.d(o,{ym:()=>b,EW:()=>h$1,Mx:()=>Q,L3:()=>H,rl:()=>m,NR:()=>u,f1:()=>v$1,IY:()=>E,RZ:()=>d,XY:()=>j,Fk:()=>g,Zh:()=>N,ek:()=>R,MG:()=>z$1,gE:()=>U,tW:()=>B,wr:()=>p});const l=(a={Flags:()=>Ot,Logger:()=>Vt,NumericParameters:()=>$t,OptionParameters:()=>qt,SettingFlag:()=>ts,TextParameters:()=>cs,WebXRController:()=>bs},r={},n.d(r,a),r);var a,r,c;class d{constructor(e,t,r){this.rootDiv=e,this.rootElement=t,this.textElement=r,this.rootElement.appendChild(this.textElement),this.hide(),this.rootDiv.appendChild(this.rootElement)}show(){this.rootElement.classList.remove("hiddenState")}hide(){this.rootElement.classList.add("hiddenState")}}class h$1 extends d{constructor(e,t,r){super(e,t,r),this.onActionCallback=()=>{l.Logger.Info(l.Logger.GetStackTrace(),"Did you forget to set the onAction callback in your overlay?")}}update(e){null==e&&null==e||(this.textElement.innerHTML=e)}onAction(e){this.onActionCallback=e}activate(){this.onActionCallback()}}class m extends h$1{static createRootElement(){const e=document.createElement("div");return e.id="connectOverlay",e.className="clickableState",e}static createContentElement(){const e=document.createElement("div");return e.id="connectButton",e.innerHTML="Click to start",e}constructor(e){super(e,m.createRootElement(),m.createContentElement()),this.rootElement.addEventListener("click",(()=>{this.activate()}))}}class u extends h$1{static createRootElement(){const e=document.createElement("div");return e.id="disconnectOverlay",e.className="clickableState",e}static createContentElement(){const e=document.createElement("div");return e.id="disconnectButton",e.innerHTML="Click To Restart",e}constructor(e){super(e,u.createRootElement(),u.createContentElement()),this.rootElement.addEventListener("click",(()=>{this.activate()}))}}class g extends h$1{static createRootElement(){const e=document.createElement("div");return e.id="playOverlay",e.className="clickableState",e}static createContentElement(){const e=document.createElement("img");return e.id="playButton",e.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAPEAAAD5CAYAAAD2mNNkAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAAZdEVYdFNvZnR3YXJlAHBhaW50Lm5ldCA0LjAuMjHxIGmVAAASgklEQVR4Xu2dC7BdVX2HqUCCIRASCPjAFIQREBRBBSRYbFOt8lIrFUWRFqXWsT5wbItUqFWs0KqIMPKoYEWpRS06KDjS1BeVFkVQbCw+wCfiAwGhCKWP9PuZtU24uTe59zz22Y/vm/nGkXtz7jlrr9+sdfZea/03Wb169QtxGW62iYi0D8L7NbwYj8EdcdPyIxFpA4T2P/F/8Ua8CI/GhPnXyq+ISJMhrAlxxX9hRuYL8Sh8SPk1EWkqBHXdEFfcg6vw3fhs3Kb8uog0DQI6XYgr8rOvYsJ8OM4v/0xEmkIJ6ob4P8zIfANegCvQMIs0BQK5sRBXJMy/wIzM5+ByXFBeRkQmBUGcbYjX5S5MmM/AA3CL8nIiUjcEcJAQV9yBX8a/wSeiz5hF6obgDRPikGfMCfOX8DTcu7y0iNQBoRs2xBX/g3diwvwm3Kn8CREZJ4RtVCGuqMKcu9kn4xJ09ZfIuCBgow5xyJ3sTLNzAywrwF6J26NhFhk1BGscIV6XhPluvA6Pxx3KnxaRUUCoxh3iioQ5z5n/BY/FJeUtiMgwEKa6QlyRMN+Hn8Hn4ZblrYjIIBCiukMc8p25Ws6ZMD+zvB0RmSsEaBIhnkrew5V4EHrCiMhcKAFqCv+Nl+J+uBC9my2yMQhKk0Jcke/M78Gsy06YH1TerohMhYA0McQVP8Nz8UDcCl2bLTIVgtHkEFd8D8/E/XFrdGQWqSAQbQhxyKOpm/B03Ac9MkgkEIa2hLgiN78S5lPx0bgIvQEm/YUAtC3EFQnzzfgnuDc6zZZ+Qsdva4jX5Sv4atwXHZmlX9DhuxDikC2Qn8dXYUbmReUjinQbOntXQlyRTRafwldgwrxV+agi3YRO3rUQV/wcV+LL8DHoyZzSTejcXQ1xRc7/uhyzl3kv3Lx8dJFuQKfueohDnjFnZP4o/j7m0ZQH4Es3oDP3IcQV2f6YMF+COZjgUeiZ2dJu6MR9CvG63ILvx4zMCfO80iQi7YLO29cQV3wb34spsr4rumBE2gWdtu8hDln99S1MXeYX4M6leUSaDx3WEK8lRdYT5lR/zPlfnswpzYeOaojXJ4cSfB3Pw+fgtug0W5oJndMQT0/uZGeaXZVyfTZuV5pNpDnQMQ3xxsk0O9Ufz8ZDcdvSfCKThw5piGdP2ioF496JT0c3WcjkKR1T5kYWjCTM78DfQheMyOSgAxriwch35lR/vAbPwOXozS+pHzqeIR6Oal12wvx2fBy6yULqgw5niEdDwpyR+VpMkfXsmHIpp4wfOpohHj234RfwFNwDnWbL+KCDGeLxkJH5p3g1vg53K00uMlroXIZ4vGTBSMJ8FeZkzmWl6UVGA53KENfD/ZiyNCmynvO/FpdLIDIcdCZDXC8ZmfOd+d/wJejZXzIcdCJDXD95xpwjdnP+V74zH4Wu/pLBoPMY4smSMN+FKbJ+BBpmmRt0GkPcDBLmu/FjeAi6lFNmB53FEDeHTLPzaCoj80dwBfqMWTYMncQQN5esAPsw7lcul8j60EEMcfPJDbD3YU7l3KxcOpE10CkMcTvIVDvfmc/E3XELtPqjGOKWkhVgp+GemDD7vbnP0AEMcXtJkfU34GNxAToy9xEuvCFuP6vwJMyOqYXl0kpf4KIb4m5QncyZTRapZGGY+wIX2xB3i3vxOswmi13QaXbX4QIb4m6SY3a/iMdh7mYb5q7ChTXE3aXaaLESq7rMW5ZLL12Bi2qI+8E9eDkmzLuhYe4KXExD3B8yMt+Ol+KL0CLrXYCLaIj7R8J8K16CR6PLOdsMF88Q95fsmPoRXozPxdzNdvVX2+CiGWLJza+EOXWZj8Sd0APw2wIXyxBLqPYy34LnY8K8DA1z0+EiGWKZSgJ9I74LU2R9R3Sa3VS4OIZYZqJaynkWpsj6w0u3kSbBhTHEsjHuwxswpVwPw6Wl+0gT4IIYYpkNmWKnr1yPqf54KG5VupFMknJhRGZLwpzVX6n++DZ8GrpjapJwAQyxDELCnB1TqWTx1/gUdGSeBDS8IZZBSZBjzv76PP4VHoSGuU5ocEMsoyBhTsG4VH98Ix6A80s3k3FCQxtiGSVZMPIT/CwmzPuhz5jHCQ1siGUcZClnwvxpPAX3LF1ORg2Na4hlXGSKnQUjCfNn8PX4CNy0dD8ZBTSoIZZxkzBXI/Pn8ATMumzDPApoSEMsdZEw5zvzDzHT7JdjwuzZX8NAAxpimQSZZifMn8Tj8aGlS8pcofEMsUyKjMw5lTOnjHwcc2TQktI1ZbbQaIZYJk3CnE0WGZmvwOeh+5hnC41liKUpVCNzwvwJPBy9+bUxaCRDLE0jYb4fU/0x0+yD8cGly8pUaBxDLE0kQa7CfCfmML8D0SN2p0KjGGJpOglztWgkh/k9CT1it4LGMMTSFhLmLBrJ3exzcJ/SjfsNDWGIpY0k0D/AM/GRpTv3ExrAEEubqVaAnY5LsX93s/nQhli6QLUF8nWYI3bnYT+Wc/JBDbF0heqO9jfwlfhInI/dDjMf0BBLF0mYr8NsskiNqS2wm2Hmgxli6TJ5zpwjg/4Qd8buLRrhQxli6QM5ZjdHBh2H+c7cnUUjfBhDLH0hU+y7cCU+H7OXeV6JQnvhQxhi6RsJc0bmy/BZ+MsbYCUS7YM3b4ilryTM2QL5QUzBuHxnbt80mzdtiEVWr74NL8KUck2R9faMzLxZQyyyhozMWcp5If4uJszNP5yAN2mIRR5IVn/djOfhEdjsw/x4c4ZYZHryjPkmPBsPwYeV2DQL3pghFpmZTLFzZFDCnLrMz8DtsTkbLXgzhlhk4yTM2cu8CrNjKiNzwjz5OlO8CUMsMjcS5qzLfgumyPr2JU6TgTdgiEUGoyqynrrMv42TOTObP2yIRQYn0+ws5bwaU8r1N3HrEq964A8aYpHhSZjvwBSMS5gPwnrWZfOHDLHI6Mgz5hyxm4Jxf4kH4HjDzB8wxCKjJ2HONPuf8c9xHxzPXmZe2BCLjIdMsWMqWfwTnoiPwdGOzLygIRYZPwlzVWPqtbgXjmbBCC9kiEXqI8+Ys8nicnwN7laiODi8iCEWqZeMylmXnTCnYFxO5tyxRHLu8I8NschkSJizLvv7mJH5pbgY57Zjin9giEUmSzUyfw9TZP1Y3LZEdOPwy4ZYpBkkzKn++B38KB6F25Wozgy/ZIhFmkXCnLO/vosfwpwysqhEdn34oSEWaSYJ8y8w0+wP4GG4/oIR/qMhFmk2VZgzzU6Ys2Nq7T5m/o8hFmkHCXO2PybMF+O++CBDLNIuEuSsy8535lvxZEMs0j6qWszZJbXUEIu0i1vwrZhqFZv5nVikPWTqfA5mF9QDD+fjPxhikeaR777xdrwAn1Aiuz780BCLNIvsdMqBAqkNtRw3XBeKXzDEIpMno27Cezdeik/GBSWmG4ZfNMQikyPhzXrpVGXM6R8rcG7lVfkHhlikfhLe7FzKo6KV+Hu45m7zXOEfGmKReske4oT3k3gMblniOBi8gCEWqYeMvD/GK/F43KHEcDh4IUMsMl5yw+pHmLOoX4aDH8UzHbygIRYZD/nem5H3KjwBd8LRV1HkRQ2xyGjJ3eacNZ1iayfhr+P46hnz4oZYZDRk2pzwph7TX+CuOP76xfwRQywyHNlVVIX3VHx8iVc98AcNscjgZJFGypq+GffHwZ71DgN/1BCLzJ2f47/iWzBlTId71jsM/HFDLDI7crf5HrwG34YHY70FxaeDN2GIRTZMwpvjcK7Fd+BTcfLhreDNGGKRmcnIez2+Ew/FhTi3MivjhjdkiEXWJ0fEfhXPwmfi4hKZ5sGbM8Qia8n65lX4LkzlhYeVqDQX3qQhFlnzrPc/8FzMtsBl2Kxp80zwRg2x9J0cxn4epoBZlkjW/6x3GHjDhlj6SJZI5gTJ9+DzMeHdvMSiXfDGDbH0iWpbYMqgJLy7YLtG3qnwAQyx9IVsC7wEX4C74/h2FtUJH8QQS9fJUTg5QfI43APnle7fDfhAhli6So5//Ri+GBPeya1vHid8MEMsXSMH0X0CX4J74cLS3bsJH9AQS1fITavs6f1VeLEdz3qHgQ9piKXtZHNC1jfnELpfTpux++Gt4MMaYmkrmTZ/GV+LCW+3p80zwQc3xNI2skTyBswhdHtic7YFTgIawBBLm7gRT8HH4dbYn2nzTNAIhljaQCrkvwkT3tywGv8pkm2BxjDE0lRyokbOsjoDUyE/N6wM71RoFEMsTSPhvRPfjY/GBei0eSZoHEMsTeJ2/ADug+3cVVQ3NJQhliaQkfcf8SnoqDsXaDBDLJMij4ruxcvwaejIOwg0nCGWusnyyIT3CjwM+7lIY1TQgIZY6iA3qzLyZmdRSn0eic09QbJN0JCGWMZJwpuR9w78Er4Qu7klcFLQoIZYxkXq9OZuc2oWZXNCv5dHjgsa1hDLqKnCm2qB2Zzw0NLdZBzQwIZYRkWmzT/DhPdE3KV0MxknNLQhlmHJ996ENwXHsjkhq6xcHlkXNLYhlkFJeHPDKhvyszkh4W338a9thEY3xDJX8qgoGxMS3tTpfSzOL11K6obGN8QyWxLeLI/MtDmlPvdHp82ThotgiGU2ZOStwrsCXSLZFLgYhlg2xF2Yc6zOxqejCzWaBhfFEMt0pMj2VzB1eg/BJaXLSNPg4hhiqcjd5izUSIX8lPp8Fi4tXUWaChfJEEtIhfwU2b4QU2R7O3RfbxvgQhnifpOD17+JCW9KfS5F7zi3CS6YIe4nOXj9W/h3eAw+vHQJaRtcPEPcL/Ks92a8CI/FXdFpc5vhAhri/vB9/Hv8A3wUukSyC3AhDXH3+Sn+Ax6PqZDvEskuwQU1xN2kOgonJ0im1Gc2J2xRLrt0CS6sIe4W1c6ij2NG3lROmFcut3QRLrAh7g4J75X4R7g3Gt4+wIU2xO0n0+ZP4aswBcdc39wnuOCGuL3kWe/n8DW4Ly4ql1X6BBfeELeTL+AJ+ATcBn3W21e4+Ia4PeSO89fwT/GJuAhdItl36ASGuPlkZ9G38fWYo3Ay8hpeWQOdwRA3lxwBexO+GVPq07Insj50DEPcTLK++e2Yc6wWo995ZXroHIa4WdyKOQpnOWbavGm5VCLTQycxxM0gp0iej0/G3LAyvDI76CyGeHJUx+G8Hw9Ewytzh05jiCdDDqK7HA/Aheh3XhkMOo8hrpe096fxd9D9vDI8pVPJ+LkXP4vPQafMMjroUIZ4fOQ7b9Y3X4U5x8oi2zJ66FiGePRkeWROkfwiHoee3Szjgw5miEdDRt14D+bw9ZfjDqWZRcYHHc0QD091FE6OgP0z9OB1qQ86myEenKxtTngz8r4BHXmlfuh4hnjuJLwp9Zlqgafh7qU5ReqHDmiIZ0+mzVkeeQO+FR9fmlFkctARDfHsSJ3ef8dqZ5GH0EkzoDMa4pnJ3ea0T07TOAezvnlBaTqRZlA6qTyQhDdrm1fhBXgwGl5pJnROQ7yW6jlvwvtefAZuXppKpJmUTitrp80p9Zn1zQ8uTSTSbOisfQ9xps2pkJ/wPhe3K00j0g7otH0N8f34dXwfHo0W2ZZ2QuftY4izPDKnabwIH4Ee/yrthQ7clxBnldUP8BJ8MSa87uuV9kNH7nqIc4ZVwvshfCkuQ8Mr3YEO3dUQZ4nkD/HDmFKfe5SPLNIt6NxdDHHC+xF8BabsiSOvdBc6eJdCfBtehglvimz7rFe6Dx29CyHOQo0r8NWYOr0W2Zb+QIdva4izRDLPeldi6vSm1OfC8rFE+gMdv40hznu+GlMhfz/cEj0OR/oJnb9NIc57vQZPxCehI69ICUbTydnN1+LJmPAuKW9fRAhEk0OcZ73XYw6hOwg9v1lkKgSjqSHO5oRT8TdwKbq+WWQ6CEeTQpw7zlmocTqmTm/Ob7bomMiGICRNCHGmzT/BszClPjPyuspKZDYQlkmH+Mf4t7gct0enzSJzgdBMKsQJ70X4VHTkFRkUwlN3iFM54YN4KG6LHkQnMgyEqK4Q51nvpZjwZuQ1vCKjgDDVEeIr8XBMeL3bLDJKCNW4QpyR9zo8ArdBb1iJjAPCNeoQJ7ypFngszkc3JoiME0I2qhDnWW8Kjv0xujFBpC4I3DAhzgqrHESXUp/Z0/uQ8rIiUhcEb5AQJ7z34TfwJNy5vJyI1A0BnG2IE9yYsiffwTfizuh3XpFJQghnE+J83014v4upkL8r+qhIpAkQxg2FOOHNzzNtPhf3REdekSZRQjqVTJtzguSNeD4eWH5dRJoGAZ0a4rvxm3ghrkCnzSJNhpBWIc7/plpgwpudRZ7dLNIGCOvtJbwX42G4uPxIRNoAoU2d3iNxUflPItIaNtnk/wEGBoMdpECGHAAAAABJRU5ErkJggg==",e.alt="Start Streaming",e}constructor(e){super(e,g.createRootElement(),g.createContentElement()),this.rootElement.addEventListener("click",(()=>{this.activate()}))}}class p extends d{constructor(e,t,r){super(e,t,r)}update(e){null==e&&null==e||(this.textElement.innerHTML=e)}}class E extends p{static createRootElement(){const e=document.createElement("div");return e.id="infoOverlay",e.className="textDisplayState",e}static createContentElement(){const e=document.createElement("div");return e.id="messageOverlayInner",e}constructor(e){super(e,E.createRootElement(),E.createContentElement())}}class v$1 extends p{static createRootElement(){const e=document.createElement("div");return e.id="errorOverlay",e.className="textDisplayState",e}static createContentElement(){const e=document.createElement("div");return e.id="errorOverlayInner",e}constructor(e){super(e,v$1.createRootElement(),v$1.createContentElement())}}class b extends h$1{static createRootElement(){const e=document.createElement("div");return e.id="afkOverlay",e.className="clickableState",e}static createContentElement(){const e=document.createElement("div");return e.id="afkOverlayInner",e.innerHTML='<center>No activity detected<br>Disconnecting in <span id="afkCountDownNumber"></span> seconds<br>Click to continue<br></center>',e}constructor(e){super(e,b.createRootElement(),b.createContentElement()),this.rootElement.addEventListener("click",(()=>{this.activate()}))}updateCountdown(e){this.textElement.innerHTML=`<center>No activity detected<br>Disconnecting in <span id="afkCountDownNumber">${e}</span> seconds<br>Click to continue<br></center>`}}class f{get rootElement(){return this._rootElement}set rootElement(e){e.onclick=()=>this.toggleFullscreen(),this._rootElement=e}constructor(){this.isFullscreen=!1,document.addEventListener("webkitfullscreenchange",(()=>this.onFullscreenChange()),!1),document.addEventListener("mozfullscreenchange",(()=>this.onFullscreenChange()),!1),document.addEventListener("fullscreenchange",(()=>this.onFullscreenChange()),!1),document.addEventListener("MSFullscreenChange",(()=>this.onFullscreenChange()),!1)}toggleFullscreen(){if(document.fullscreenElement||document.webkitFullscreenElement||document.mozFullScreenElement||document.msFullscreenElement)document.exitFullscreen?document.exitFullscreen():document.mozCancelFullScreen?document.mozCancelFullScreen():document.webkitExitFullscreen?document.webkitExitFullscreen():document.msExitFullscreen&&document.msExitFullscreen();else{const e=this.fullscreenElement;if(!e)return;e.requestFullscreen?e.requestFullscreen():e.mozRequestFullscreen?e.mozRequestFullscreen():e.webkitRequestFullscreen?e.webkitRequestFullscreen():e.msRequestFullscreen?e.msRequestFullscreen():e.webkitEnterFullscreen&&e.webkitEnterFullscreen()}this.onFullscreenChange()}onFullscreenChange(){this.isFullscreen=document.webkitIsFullScreen||document.mozFullScreen||document.msFullscreenElement&&null!==document.msFullscreenElement||document.fullscreenElement&&null!==document.fullscreenElement}}class y extends f{constructor(e){super(),this.rootElement=e}}class x extends f{constructor(){super();const e=document.createElement("button");e.type="button",e.classList.add("UiTool"),e.id="fullscreen-btn",e.appendChild(this.maximizeIcon),e.appendChild(this.minimizeIcon),e.appendChild(this.tooltipText),this.rootElement=e}get tooltipText(){return this._tooltipText||(this._tooltipText=document.createElement("span"),this._tooltipText.classList.add("tooltiptext"),this._tooltipText.innerHTML="Fullscreen"),this._tooltipText}get maximizeIcon(){if(!this._maximizeIcon){this._maximizeIcon=document.createElementNS("http://www.w3.org/2000/svg","svg"),this._maximizeIcon.setAttributeNS(null,"id","maximizeIcon"),this._maximizeIcon.setAttributeNS(null,"x","0px"),this._maximizeIcon.setAttributeNS(null,"y","0px"),this._maximizeIcon.setAttributeNS(null,"viewBox","0 0 384.97 384.97");const e=document.createElementNS("http://www.w3.org/2000/svg","g");e.classList.add("svgIcon"),this._maximizeIcon.appendChild(e);const t=document.createElementNS("http://www.w3.org/2000/svg","path");t.setAttributeNS(null,"d","M384.97,12.03c0-6.713-5.317-12.03-12.03-12.03H264.847c-6.833,0-11.922,5.39-11.934,12.223c0,6.821,5.101,11.838,11.934,11.838h96.062l-0.193,96.519c0,6.833,5.197,12.03,12.03,12.03c6.833-0.012,12.03-5.197,12.03-12.03l0.193-108.369c0-0.036-0.012-0.06-0.012-0.084C384.958,12.09,384.97,12.066,384.97,12.03z");const r=document.createElementNS("http://www.w3.org/2000/svg","path");r.setAttributeNS(null,"d","M120.496,0H12.403c-0.036,0-0.06,0.012-0.096,0.012C12.283,0.012,12.247,0,12.223,0C5.51,0,0.192,5.317,0.192,12.03L0,120.399c0,6.833,5.39,11.934,12.223,11.934c6.821,0,11.838-5.101,11.838-11.934l0.192-96.339h96.242c6.833,0,12.03-5.197,12.03-12.03C132.514,5.197,127.317,0,120.496,0z");const n=document.createElementNS("http://www.w3.org/2000/svg","path");n.setAttributeNS(null,"d","M120.123,360.909H24.061v-96.242c0-6.833-5.197-12.03-12.03-12.03S0,257.833,0,264.667v108.092c0,0.036,0.012,0.06,0.012,0.084c0,0.036-0.012,0.06-0.012,0.096c0,6.713,5.317,12.03,12.03,12.03h108.092c6.833,0,11.922-5.39,11.934-12.223C132.057,365.926,126.956,360.909,120.123,360.909z");const i=document.createElementNS("http://www.w3.org/2000/svg","path");i.setAttributeNS(null,"d","M372.747,252.913c-6.833,0-11.85,5.101-11.838,11.934v96.062h-96.242c-6.833,0-12.03,5.197-12.03,12.03s5.197,12.03,12.03,12.03h108.092c0.036,0,0.06-0.012,0.084-0.012c0.036-0.012,0.06,0.012,0.096,0.012c6.713,0,12.03-5.317,12.03-12.03V264.847C384.97,258.014,379.58,252.913,372.747,252.913z"),e.appendChild(t),e.appendChild(r),e.appendChild(n),e.appendChild(i)}return this._maximizeIcon}get minimizeIcon(){if(!this._minimizeIcon){this._minimizeIcon=document.createElementNS("http://www.w3.org/2000/svg","svg"),this._minimizeIcon.setAttributeNS(null,"id","minimizeIcon"),this._minimizeIcon.setAttributeNS(null,"x","0px"),this._minimizeIcon.setAttributeNS(null,"y","0px"),this._minimizeIcon.setAttributeNS(null,"viewBox","0 0 385.331 385.331");const e=document.createElementNS("http://www.w3.org/2000/svg","g");e.classList.add("svgIcon"),this._minimizeIcon.appendChild(e);const t=document.createElementNS("http://www.w3.org/2000/svg","path");t.setAttributeNS(null,"d","M264.943,156.665h108.273c6.833,0,11.934-5.39,11.934-12.211c0-6.833-5.101-11.85-11.934-11.838h-96.242V36.181c0-6.833-5.197-12.03-12.03-12.03s-12.03,5.197-12.03,12.03v108.273c0,0.036,0.012,0.06,0.012,0.084c0,0.036-0.012,0.06-0.012,0.096C252.913,151.347,258.23,156.677,264.943,156.665z");const r=document.createElementNS("http://www.w3.org/2000/svg","path");r.setAttributeNS(null,"d","M120.291,24.247c-6.821,0-11.838,5.113-11.838,11.934v96.242H12.03c-6.833,0-12.03,5.197-12.03,12.03c0,6.833,5.197,12.03,12.03,12.03h108.273c0.036,0,0.06-0.012,0.084-0.012c0.036,0,0.06,0.012,0.096,0.012c6.713,0,12.03-5.317,12.03-12.03V36.181C132.514,29.36,127.124,24.259,120.291,24.247z");const n=document.createElementNS("http://www.w3.org/2000/svg","path");n.setAttributeNS(null,"d","M120.387,228.666H12.115c-6.833,0.012-11.934,5.39-11.934,12.223c0,6.833,5.101,11.85,11.934,11.838h96.242v96.423c0,6.833,5.197,12.03,12.03,12.03c6.833,0,12.03-5.197,12.03-12.03V240.877c0-0.036-0.012-0.06-0.012-0.084c0-0.036,0.012-0.06,0.012-0.096C132.418,233.983,127.1,228.666,120.387,228.666z");const i=document.createElementNS("http://www.w3.org/2000/svg","path");i.setAttributeNS(null,"d","M373.3,228.666H265.028c-0.036,0-0.06,0.012-0.084,0.012c-0.036,0-0.06-0.012-0.096-0.012c-6.713,0-12.03,5.317-12.03,12.03v108.273c0,6.833,5.39,11.922,12.223,11.934c6.821,0.012,11.838-5.101,11.838-11.922v-96.242H373.3c6.833,0,12.03-5.197,12.03-12.03S380.134,228.678,373.3,228.666z"),e.appendChild(t),e.appendChild(r),e.appendChild(n),e.appendChild(i)}return this._minimizeIcon}onFullscreenChange(){super.onFullscreenChange();const e=this.minimizeIcon,t=this.maximizeIcon;this.isFullscreen?(e.style.display="inline",e.style.transform="translate(0, 0)",t.style.display="none"):(e.style.display="none",t.style.display="inline",t.style.transform="translate(0, 0)")}}class C{get rootElement(){return this._rootElement||(this._rootElement=document.createElement("button"),this._rootElement.type="button",this._rootElement.classList.add("UiTool"),this._rootElement.id="settingsBtn",this._rootElement.appendChild(this.settingsIcon),this._rootElement.appendChild(this.tooltipText)),this._rootElement}get tooltipText(){return this._tooltipText||(this._tooltipText=document.createElement("span"),this._tooltipText.classList.add("tooltiptext"),this._tooltipText.innerHTML="Settings"),this._tooltipText}get settingsIcon(){if(!this._settingsIcon){this._settingsIcon=document.createElementNS("http://www.w3.org/2000/svg","svg"),this._settingsIcon.setAttributeNS(null,"id","settingsIcon"),this._settingsIcon.setAttributeNS(null,"x","0px"),this._settingsIcon.setAttributeNS(null,"y","0px"),this._settingsIcon.setAttributeNS(null,"viewBox","0 0 478.703 478.703");const e=document.createElementNS("http://www.w3.org/2000/svg","g");e.classList.add("svgIcon"),this._settingsIcon.appendChild(e);const t=document.createElementNS("http://www.w3.org/2000/svg","path");t.setAttributeNS(null,"d","M454.2,189.101l-33.6-5.7c-3.5-11.3-8-22.2-13.5-32.6l19.8-27.7c8.4-11.8,7.1-27.9-3.2-38.1l-29.8-29.8\t\t\tc-5.6-5.6-13-8.7-20.9-8.7c-6.2,0-12.1,1.9-17.1,5.5l-27.8,19.8c-10.8-5.7-22.1-10.4-33.8-13.9l-5.6-33.2\t\t\tc-2.4-14.3-14.7-24.7-29.2-24.7h-42.1c-14.5,0-26.8,10.4-29.2,24.7l-5.8,34c-11.2,3.5-22.1,8.1-32.5,13.7l-27.5-19.8\t\t\tc-5-3.6-11-5.5-17.2-5.5c-7.9,0-15.4,3.1-20.9,8.7l-29.9,29.8c-10.2,10.2-11.6,26.3-3.2,38.1l20,28.1\t\t\tc-5.5,10.5-9.9,21.4-13.3,32.7l-33.2,5.6c-14.3,2.4-24.7,14.7-24.7,29.2v42.1c0,14.5,10.4,26.8,24.7,29.2l34,5.8\t\t\tc3.5,11.2,8.1,22.1,13.7,32.5l-19.7,27.4c-8.4,11.8-7.1,27.9,3.2,38.1l29.8,29.8c5.6,5.6,13,8.7,20.9,8.7c6.2,0,12.1-1.9,17.1-5.5\t\t\tl28.1-20c10.1,5.3,20.7,9.6,31.6,13l5.6,33.6c2.4,14.3,14.7,24.7,29.2,24.7h42.2c14.5,0,26.8-10.4,29.2-24.7l5.7-33.6\t\t\tc11.3-3.5,22.2-8,32.6-13.5l27.7,19.8c5,3.6,11,5.5,17.2,5.5l0,0c7.9,0,15.3-3.1,20.9-8.7l29.8-29.8c10.2-10.2,11.6-26.3,3.2-38.1\t\t\tl-19.8-27.8c5.5-10.5,10.1-21.4,13.5-32.6l33.6-5.6c14.3-2.4,24.7-14.7,24.7-29.2v-42.1\t\t\tC478.9,203.801,468.5,191.501,454.2,189.101z M451.9,260.401c0,1.3-0.9,2.4-2.2,2.6l-42,7c-5.3,0.9-9.5,4.8-10.8,9.9\t\t\tc-3.8,14.7-9.6,28.8-17.4,41.9c-2.7,4.6-2.5,10.3,0.6,14.7l24.7,34.8c0.7,1,0.6,2.5-0.3,3.4l-29.8,29.8c-0.7,0.7-1.4,0.8-1.9,0.8\t\t\tc-0.6,0-1.1-0.2-1.5-0.5l-34.7-24.7c-4.3-3.1-10.1-3.3-14.7-0.6c-13.1,7.8-27.2,13.6-41.9,17.4c-5.2,1.3-9.1,5.6-9.9,10.8l-7.1,42\t\t\tc-0.2,1.3-1.3,2.2-2.6,2.2h-42.1c-1.3,0-2.4-0.9-2.6-2.2l-7-42c-0.9-5.3-4.8-9.5-9.9-10.8c-14.3-3.7-28.1-9.4-41-16.8\t\t\tc-2.1-1.2-4.5-1.8-6.8-1.8c-2.7,0-5.5,0.8-7.8,2.5l-35,24.9c-0.5,0.3-1,0.5-1.5,0.5c-0.4,0-1.2-0.1-1.9-0.8l-29.8-29.8\t\t\tc-0.9-0.9-1-2.3-0.3-3.4l24.6-34.5c3.1-4.4,3.3-10.2,0.6-14.8c-7.8-13-13.8-27.1-17.6-41.8c-1.4-5.1-5.6-9-10.8-9.9l-42.3-7.2\t\t\tc-1.3-0.2-2.2-1.3-2.2-2.6v-42.1c0-1.3,0.9-2.4,2.2-2.6l41.7-7c5.3-0.9,9.6-4.8,10.9-10c3.7-14.7,9.4-28.9,17.1-42\t\t\tc2.7-4.6,2.4-10.3-0.7-14.6l-24.9-35c-0.7-1-0.6-2.5,0.3-3.4l29.8-29.8c0.7-0.7,1.4-0.8,1.9-0.8c0.6,0,1.1,0.2,1.5,0.5l34.5,24.6\t\t\tc4.4,3.1,10.2,3.3,14.8,0.6c13-7.8,27.1-13.8,41.8-17.6c5.1-1.4,9-5.6,9.9-10.8l7.2-42.3c0.2-1.3,1.3-2.2,2.6-2.2h42.1\t\t\tc1.3,0,2.4,0.9,2.6,2.2l7,41.7c0.9,5.3,4.8,9.6,10,10.9c15.1,3.8,29.5,9.7,42.9,17.6c4.6,2.7,10.3,2.5,14.7-0.6l34.5-24.8\t\t\tc0.5-0.3,1-0.5,1.5-0.5c0.4,0,1.2,0.1,1.9,0.8l29.8,29.8c0.9,0.9,1,2.3,0.3,3.4l-24.7,34.7c-3.1,4.3-3.3,10.1-0.6,14.7\t\t\tc7.8,13.1,13.6,27.2,17.4,41.9c1.3,5.2,5.6,9.1,10.8,9.9l42,7.1c1.3,0.2,2.2,1.3,2.2,2.6v42.1H451.9z");const r=document.createElementNS("http://www.w3.org/2000/svg","path");r.setAttributeNS(null,"d","M239.4,136.001c-57,0-103.3,46.3-103.3,103.3s46.3,103.3,103.3,103.3s103.3-46.3,103.3-103.3S296.4,136.001,239.4,136.001z M239.4,315.601c-42.1,0-76.3-34.2-76.3-76.3s34.2-76.3,76.3-76.3s76.3,34.2,76.3,76.3S281.5,315.601,239.4,315.601z"),e.appendChild(t),e.appendChild(r)}return this._settingsIcon}}class S{get rootElement(){return this._rootElement||(this._rootElement=document.createElement("button"),this._rootElement.type="button",this._rootElement.classList.add("UiTool"),this._rootElement.id="statsBtn",this._rootElement.appendChild(this.statsIcon),this._rootElement.appendChild(this.tooltipText)),this._rootElement}get tooltipText(){return this._tooltipText||(this._tooltipText=document.createElement("span"),this._tooltipText.classList.add("tooltiptext"),this._tooltipText.innerHTML="Information"),this._tooltipText}get statsIcon(){if(!this._statsIcon){this._statsIcon=document.createElementNS("http://www.w3.org/2000/svg","svg"),this._statsIcon.setAttributeNS(null,"id","statsIcon"),this._statsIcon.setAttributeNS(null,"x","0px"),this._statsIcon.setAttributeNS(null,"y","0px"),this._statsIcon.setAttributeNS(null,"viewBox","0 0 330 330");const e=document.createElementNS("http://www.w3.org/2000/svg","g");e.classList.add("svgIcon"),this._statsIcon.appendChild(e);const t=document.createElementNS("http://www.w3.org/2000/svg","path");t.setAttributeNS(null,"d","M165,0.008C74.019,0.008,0,74.024,0,164.999c0,90.977,74.019,164.992,165,164.992s165-74.015,165-164.992C330,74.024,255.981,0.008,165,0.008z M165,299.992c-74.439,0-135-60.557-135-134.992S90.561,30.008,165,30.008s135,60.557,135,134.991C300,239.436,239.439,299.992,165,299.992z");const r=document.createElementNS("http://www.w3.org/2000/svg","path");r.setAttributeNS(null,"d","M165,130.008c-8.284,0-15,6.716-15,15v99.983c0,8.284,6.716,15,15,15s15-6.716,15-15v-99.983C180,136.725,173.284,130.008,165,130.008z");const n=document.createElementNS("http://www.w3.org/2000/svg","path");n.setAttributeNS(null,"d","M165,70.011c-3.95,0-7.811,1.6-10.61,4.39c-2.79,2.79-4.39,6.66-4.39,10.61s1.6,7.81,4.39,10.61c2.79,2.79,6.66,4.39,10.61,4.39s7.81-1.6,10.609-4.39c2.79-2.8,4.391-6.66,4.391-10.61s-1.601-7.82-4.391-10.61C172.81,71.61,168.95,70.011,165,70.011z"),e.appendChild(t),e.appendChild(r),e.appendChild(n)}return this._statsIcon}}class w$1{get rootElement(){return this._rootElement||(this._rootElement=document.createElement("button"),this._rootElement.type="button",this._rootElement.classList.add("UiTool"),this._rootElement.id="xrBtn",this._rootElement.appendChild(this.xrIcon),this._rootElement.appendChild(this.tooltipText)),this._rootElement}get tooltipText(){return this._tooltipText||(this._tooltipText=document.createElement("span"),this._tooltipText.classList.add("tooltiptext"),this._tooltipText.innerHTML="XR"),this._tooltipText}get xrIcon(){if(!this._xrIcon){this._xrIcon=document.createElementNS("http://www.w3.org/2000/svg","svg"),this._xrIcon.setAttributeNS(null,"id","xrIcon"),this._xrIcon.setAttributeNS(null,"x","0px"),this._xrIcon.setAttributeNS(null,"y","0px"),this._xrIcon.setAttributeNS(null,"viewBox","0 0 100 100");const e=document.createElementNS("http://www.w3.org/2000/svg","g");e.classList.add("svgIcon"),this._xrIcon.appendChild(e);const t=document.createElementNS("http://www.w3.org/2000/svg","path");t.setAttributeNS(null,"d","M29 41c-5 0-9 4-9 9s4 9 9 9 9-4 9-9-4-9-9-9zm0 14c-2.8 0-5-2.2-5-5s2.2-5 5-5 5 2.2 5 5-2.2 5-5 5zm42-14c-5 0-9 4-9 9s4 9 9 9 9-4 9-9-4-9-9-9zm0 14c-2.8 0-5-2.2-5-5s2.2-5 5-5 5 2.2 5 5-2.2 5-5 5zm12-31H17c-6.6 0-12 5.4-12 12v28c0 6.6 5.4 12 12 12h14.5c3.5 0 6.8-1.5 9-4.1l3.5-4c1.5-1.7 3.7-2.7 6-2.7s4.5 1 6 2.7l3.5 4c2.3 2.6 5.6 4.1 9 4.1H83c6.6 0 12-5.4 12-12V36c0-6.6-5.4-12-12-12zm8 40c0 4.4-3.6 8-8 8H68.5c-2.3 0-4.5-1-6-2.7l-3.5-4c-2.3-2.6-5.6-4.1-9-4.1-3.5 0-6.8 1.5-9 4.1l-3.5 4C36 71 33.8 72 31.5 72H17c-4.4 0-8-3.6-8-8V36c0-4.4 3.6-8 8-8h66c4.4 0 8 3.6 8 8v28z"),e.appendChild(t)}return this._xrIcon}}function T(e){return!e||!!e&&e.isEnabled}function _(e){return null==e||e.creationMode===c.CreateDefaultElement}!function(e){e[e.CreateDefaultElement=0]="CreateDefaultElement",e[e.UseCustomElement=1]="UseCustomElement",e[e.Disable=2]="Disable"}(c||(c={}));class L{constructor(e){e&&!_(e.statsButtonType)||(this.statsIcon=new S),e&&!_(e.fullscreenButtonType)||(this.settingsIcon=new C),e&&!_(e.settingsButtonType)||(this.fullscreenIcon=new x),e&&!_(e.xrIconType)||(this.xrIcon=new w$1)}get rootElement(){return this._rootElement||(this._rootElement=document.createElement("div"),this._rootElement.id="controls",this.fullscreenIcon&&this._rootElement.appendChild(this.fullscreenIcon.rootElement),this.settingsIcon&&this._rootElement.appendChild(this.settingsIcon.rootElement),this.statsIcon&&this._rootElement.appendChild(this.statsIcon.rootElement),this.xrIcon&&l.WebXRController.isSessionSupported("immersive-vr").then((e=>{e&&this._rootElement.appendChild(this.xrIcon.rootElement)}))),this._rootElement}}class I{constructor(e,t){this._label=e,this._buttonText=t}addOnClickListener(e){this.button.addEventListener("click",e)}get button(){return this._button||(this._button=document.createElement("input"),this._button.type="button",this._button.value=this._buttonText,this._button.classList.add("overlay-button"),this._button.classList.add("btn-flat")),this._button}get rootElement(){if(!this._rootElement){this._rootElement=document.createElement("div"),this._rootElement.classList.add("setting");const e=document.createElement("div");e.innerText=this._label,this._rootElement.appendChild(e);const t=document.createElement("label");t.classList.add("btn-overlay"),this._rootElement.appendChild(t),t.appendChild(this.button)}return this._rootElement}}class k{constructor(){this._rootElement=null}get rootElement(){if(!this._rootElement){this._rootElement=document.createElement("div"),this._rootElement.id="settings-panel",this._rootElement.classList.add("panel-wrap");const e=document.createElement("div");e.classList.add("panel"),this._rootElement.appendChild(e);const t=document.createElement("div");t.id="settingsHeading",t.textContent="Settings",e.appendChild(t),e.appendChild(this.settingsCloseButton),e.appendChild(this.settingsContentElement)}return this._rootElement}get settingsContentElement(){return this._settingsContentElement||(this._settingsContentElement=document.createElement("div"),this._settingsContentElement.id="settingsContent"),this._settingsContentElement}get settingsCloseButton(){return this._settingsCloseButton||(this._settingsCloseButton=document.createElement("div"),this._settingsCloseButton.id="settingsClose"),this._settingsCloseButton}show(){this.rootElement.classList.contains("panel-wrap-visible")||this.rootElement.classList.add("panel-wrap-visible")}toggleVisibility(){this.rootElement.classList.toggle("panel-wrap-visible")}hide(){this.rootElement.classList.contains("panel-wrap-visible")&&this.rootElement.classList.remove("panel-wrap-visible")}}class F{get rootElement(){if(!this._rootElement){this._rootElement=document.createElement("section"),this._rootElement.classList.add("settingsContainer");const e=document.createElement("div");e.id="latencyTestHeader",e.classList.add("settings-text"),e.classList.add("settingsHeader"),this._rootElement.appendChild(e);const t=document.createElement("div");t.innerHTML="Latency Test",e.appendChild(t),e.appendChild(this.latencyTestButton);const r=document.createElement("div");r.id="latencyTestContainer",r.classList.add("d-none"),this._rootElement.appendChild(r),r.appendChild(this.latencyTestResultsElement)}return this._rootElement}get latencyTestResultsElement(){return this._latencyTestResultsElement||(this._latencyTestResultsElement=document.createElement("div"),this._latencyTestResultsElement.id="latencyStatsResults",this._latencyTestResultsElement.classList.add("StatsResult")),this._latencyTestResultsElement}get latencyTestButton(){return this._latencyTestButton||(this._latencyTestButton=document.createElement("input"),this._latencyTestButton.type="button",this._latencyTestButton.value="Run Test",this._latencyTestButton.id="btn-start-latency-test",this._latencyTestButton.classList.add("streamTools-button"),this._latencyTestButton.classList.add("btn-flat")),this._latencyTestButton}handleTestResult(e){l.Logger.Log(l.Logger.GetStackTrace(),e.toString(),6);let t="";t+="<div>Net latency RTT (ms): "+e.networkLatency+"</div>",t+="<div>UE Encode (ms): "+e.EncodeMs+"</div>",t+="<div>UE Capture (ms): "+e.CaptureToSendMs+"</div>",t+="<div>Browser send latency (ms): "+e.browserSendLatency+"</div>",t+=e.frameDisplayDeltaTimeMs&&e.browserReceiptTimeMs?"<div>Browser receive latency (ms): "+e.frameDisplayDeltaTimeMs+"</div>":"",t+="<div>Total latency (excluding browser) (ms): "+e.latencyExcludingDecode+"</div>",t+=e.endToEndLatency?"<div>Total latency (ms): "+e.endToEndLatency+"</div>":"",this.latencyTestResultsElement.innerHTML=t}}class P{static formatBytes(e,t){if(0===e)return"0";const r=t<0?0:t,n=Math.floor(Math.log(e)/Math.log(1024));return parseFloat((e/Math.pow(1024,n)).toFixed(r))+" "+["Bytes","KiB","MiB","GiB","TiB","PiB","EiB","ZiB","YiB"][n]}}class A{}class O{constructor(){this.statsMap=new Map,this.latencyTest=new F}get rootElement(){if(!this._rootElement){this._rootElement=document.createElement("div"),this._rootElement.id="stats-panel",this._rootElement.classList.add("panel-wrap");const e=document.createElement("div");e.classList.add("panel"),this._rootElement.appendChild(e);const t=document.createElement("div");t.id="statsHeading",t.textContent="Information",e.appendChild(t),e.appendChild(this.statsCloseButton),e.appendChild(this.statsContentElement)}return this._rootElement}get statsContentElement(){if(!this._statsContentElement){this._statsContentElement=document.createElement("div"),this._statsContentElement.id="statsContent";const e=document.createElement("div");e.id="streamToolsStats",e.classList.add("container");const t=document.createElement("div");t.id="ControlStats",t.classList.add("row");const r=document.createElement("section");r.id="statistics",r.classList.add("settingsContainer");const n=document.createElement("div");n.id="statisticsHeader",n.classList.add("settings-text"),n.classList.add("settingsHeader");const i=document.createElement("div");i.innerHTML="Session Stats",this._statsContentElement.appendChild(e),e.appendChild(t),t.appendChild(r),r.appendChild(n),n.appendChild(i),r.appendChild(this.statisticsContainer),t.appendChild(this.latencyTest.rootElement)}return this._statsContentElement}get statisticsContainer(){return this._statisticsContainer||(this._statisticsContainer=document.createElement("div"),this._statisticsContainer.id="statisticsContainer",this._statisticsContainer.classList.add("d-none"),this._statisticsContainer.appendChild(this.statsResult)),this._statisticsContainer}get statsResult(){return this._statsResult||(this._statsResult=document.createElement("div"),this._statsResult.id="statisticsResult",this._statsResult.classList.add("StatsResult")),this._statsResult}get statsCloseButton(){return this._statsCloseButton||(this._statsCloseButton=document.createElement("div"),this._statsCloseButton.id="statsClose"),this._statsCloseButton}show(){this.rootElement.classList.contains("panel-wrap-visible")||this.rootElement.classList.add("panel-wrap-visible")}toggleVisibility(){this.rootElement.classList.toggle("panel-wrap-visible")}hide(){this.rootElement.classList.contains("panel-wrap-visible")&&this.rootElement.classList.remove("panel-wrap-visible")}handleStats(e){var t,r,n,i,s;const a=new Intl.NumberFormat(window.navigator.language,{maximumFractionDigits:0}),o=P.formatBytes(e.inboundVideoStats.bytesReceived,2);this.addOrUpdateStat("InboundDataStat","Received",o);const c=Object.prototype.hasOwnProperty.call(e.inboundVideoStats,"packetsLost")?a.format(e.inboundVideoStats.packetsLost):"Chrome only";this.addOrUpdateStat("PacketsLostStat","Packets Lost",c),e.inboundVideoStats.bitrate&&this.addOrUpdateStat("VideoBitrateStat","Video Bitrate (kbps)",e.inboundVideoStats.bitrate.toString()),e.inboundAudioStats.bitrate&&this.addOrUpdateStat("AudioBitrateStat","Audio Bitrate (kbps)",e.inboundAudioStats.bitrate.toString());const h=Object.prototype.hasOwnProperty.call(e.inboundVideoStats,"frameWidth")&&e.inboundVideoStats.frameWidth&&Object.prototype.hasOwnProperty.call(e.inboundVideoStats,"frameHeight")&&e.inboundVideoStats.frameHeight?e.inboundVideoStats.frameWidth+"x"+e.inboundVideoStats.frameHeight:"Chrome only";this.addOrUpdateStat("VideoResStat","Video resolution",h);const d=Object.prototype.hasOwnProperty.call(e.inboundVideoStats,"framesDecoded")?a.format(e.inboundVideoStats.framesDecoded):"Chrome only";this.addOrUpdateStat("FramesDecodedStat","Frames Decoded",d),e.inboundVideoStats.framesPerSecond&&this.addOrUpdateStat("FramerateStat","Framerate",e.inboundVideoStats.framesPerSecond.toString()),this.addOrUpdateStat("FramesDroppedStat","Frames dropped",null===(t=e.inboundVideoStats.framesDropped)||void 0===t?void 0:t.toString()),e.inboundVideoStats.codecId&&this.addOrUpdateStat("VideoCodecStat","Video codec",null!==(n=null===(r=e.codecs.get(e.inboundVideoStats.codecId))||void 0===r?void 0:r.split(" ")[0])&&void 0!==n?n:""),e.inboundAudioStats.codecId&&this.addOrUpdateStat("AudioCodecStat","Audio codec",null!==(s=null===(i=e.codecs.get(e.inboundAudioStats.codecId))||void 0===i?void 0:i.split(" ")[0])&&void 0!==s?s:"");const u=Object.prototype.hasOwnProperty.call(e.candidatePair,"currentRoundTripTime")&&e.isNumber(e.candidatePair.currentRoundTripTime)?a.format(1e3*e.candidatePair.currentRoundTripTime):"Can't calculate";this.addOrUpdateStat("RTTStat","Net RTT (ms)",u),this.addOrUpdateStat("DurationStat","Duration",e.sessionStats.runTime),this.addOrUpdateStat("ControlsInputStat","Controls stream input",e.sessionStats.controlsStreamInput),this.addOrUpdateStat("QPStat","Video quantization parameter",e.sessionStats.videoEncoderAvgQP.toString()),l.Logger.Log(l.Logger.GetStackTrace(),`--------- Stats ---------\n ${e}\n------------------------`,6)}addOrUpdateStat(e,t,r){const n=`${t}: ${r}`;if(this.statsMap.has(e)){const t=this.statsMap.get(e);void 0!==t&&(t.element.innerHTML=n)}else{const i=new A;i.id=e,i.stat=r,i.title=t,i.element=document.createElement("div"),i.element.innerHTML=n,this.statsResult.appendChild(i.element),this.statsMap.set(e,i)}}}class M{constructor(){this.videoEncoderAvgQP=-1,this.statsText="",this.color="",this.orangeQP=26,this.redQP=35}get rootElement(){return this._rootElement||(this._rootElement=document.createElement("div"),this._rootElement.id="connection",this._rootElement.classList.add("UiTool"),this._rootElement.appendChild(this.qualityStatus),this._rootElement.appendChild(this.qualityText),this.updateQpTooltip(-1)),this._rootElement}get qualityText(){return this._qualityText||(this._qualityText=document.createElement("span"),this._qualityText.id="qualityText",this._qualityText.classList.add("tooltiptext")),this._qualityText}get qualityStatus(){return this._qualityStatus||(this._qualityStatus=document.createElementNS("http://www.w3.org/2000/svg","svg"),this._qualityStatus.setAttributeNS(null,"id","connectionStrength"),this._qualityStatus.setAttributeNS(null,"x","0px"),this._qualityStatus.setAttributeNS(null,"y","0px"),this._qualityStatus.setAttributeNS(null,"viewBox","0 0 494.45 494.45"),this.qualityStatus.appendChild(this.dot),this.qualityStatus.appendChild(this.middle),this.qualityStatus.appendChild(this.outer),this.qualityStatus.appendChild(this.inner)),this._qualityStatus}get dot(){return this._dot||(this._dot=document.createElementNS("http://www.w3.org/2000/svg","circle"),this._dot.setAttributeNS(null,"id","dot"),this._dot.setAttributeNS(null,"cx","247.125"),this._dot.setAttributeNS(null,"cy","398.925"),this._dot.setAttributeNS(null,"r","35.3")),this._dot}get outer(){return this._outer||(this._outer=document.createElementNS("http://www.w3.org/2000/svg","path"),this._outer.setAttributeNS(null,"id","outer"),this._outer.setAttributeNS(null,"d","M467.925,204.625c-6.8,0-13.5-2.6-18.7-7.8c-111.5-111.4-292.7-111.4-404.1,0c-10.3,10.3-27.1,10.3-37.4,0s-10.3-27.1,0-37.4c64-64,149-99.2,239.5-99.2s175.5,35.2,239.5,99.2c10.3,10.3,10.3,27.1,0,37.4C481.425,202.025,474.625,204.625,467.925,204.625z")),this._outer}get middle(){return this._middle||(this._middle=document.createElementNS("http://www.w3.org/2000/svg","path"),this._middle.setAttributeNS(null,"id","middle"),this._middle.setAttributeNS(null,"d","M395.225,277.325c-6.8,0-13.5-2.6-18.7-7.8c-71.4-71.3-187.4-71.3-258.8,0c-10.3,10.3-27.1,10.3-37.4,0s-10.3-27.1,0-37.4c92-92,241.6-92,333.6,0c10.3,10.3,10.3,27.1,0,37.4C408.725,274.725,401.925,277.325,395.225,277.325z")),this._middle}get inner(){return this._inner||(this._inner=document.createElementNS("http://www.w3.org/2000/svg","path"),this._inner.setAttributeNS(null,"id","inner"),this._inner.setAttributeNS(null,"d","M323.625,348.825c-6.8,0-13.5-2.6-18.7-7.8c-15.4-15.4-36-23.9-57.8-23.9s-42.4,8.5-57.8,23.9c-10.3,10.3-27.1,10.3-37.4,0c-10.3-10.3-10.3-27.1,0-37.4c25.4-25.4,59.2-39.4,95.2-39.4s69.8,14,95.2,39.5c10.3,10.3,10.3,27.1,0,37.4C337.225,346.225,330.425,348.825,323.625,348.825z")),this._inner}blinkVideoQualityStatus(e){let t=e,r=1;const n=setInterval((()=>{r-=.1,this.qualityText.style.opacity=String(Math.abs(2*(r-.5))),r<=.1&&(0==--t?clearInterval(n):r=1)}),100/e)}updateQpTooltip(e){this.videoEncoderAvgQP=e,e>this.redQP?(this.color="red",this.blinkVideoQualityStatus(2),this.statsText=`<div style="color: ${this.color}">Poor encoding quality</div>`,this.outer.setAttributeNS(null,"fill","#3c3b40"),this.middle.setAttributeNS(null,"fill","#3c3b40"),this.inner.setAttributeNS(null,"fill",this.color),this.dot.setAttributeNS(null,"fill",this.color)):e>this.orangeQP?(this.color="orange",this.blinkVideoQualityStatus(1),this.statsText=`<div style="color: ${this.color}">Blocky encoding quality</div>`,this.outer.setAttributeNS(null,"fill","#3c3b40"),this.middle.setAttributeNS(null,"fill",this.color),this.inner.setAttributeNS(null,"fill",this.color),this.dot.setAttributeNS(null,"fill",this.color)):e<=0?(this.color="#b0b0b0",this.outer.setAttributeNS(null,"fill","#3c3b40"),this.middle.setAttributeNS(null,"fill","#3c3b40"),this.inner.setAttributeNS(null,"fill","#3c3b40"),this.dot.setAttributeNS(null,"fill","#3c3b40"),this.statsText=`<div style="color: ${this.color}">Not connected</div>`):(this.color="lime",this.qualityStatus.style.opacity="1",this.statsText=`<div style="color: ${this.color}">Clear encoding quality</div>`,this.outer.setAttributeNS(null,"fill",this.color),this.middle.setAttributeNS(null,"fill",this.color),this.inner.setAttributeNS(null,"fill",this.color),this.dot.setAttributeNS(null,"fill",this.color)),this.qualityText.innerHTML=this.statsText}}class N{constructor(e){this._setting=e}get setting(){return this._setting}get rootElement(){return this._rootElement||(this._rootElement=document.createElement("div")),this._rootElement}}class R extends N{constructor(e){super(e),this.label=e.label,this.flag=e.flag}get setting(){return this._setting}get settingsTextElem(){return this._settingsTextElem||(this._settingsTextElem=document.createElement("div"),this._settingsTextElem.innerText=this.setting._label,this._settingsTextElem.title=this.setting.description),this._settingsTextElem}get checkbox(){return this._checkbox||(this._checkbox=document.createElement("input"),this._checkbox.type="checkbox"),this._checkbox}get rootElement(){if(!this._rootElement){this._rootElement=document.createElement("div"),this._rootElement.id=this.setting.id,this._rootElement.classList.add("setting"),this._rootElement.appendChild(this.settingsTextElem);const e=document.createElement("label");e.classList.add("tgl-switch"),this._rootElement.appendChild(e),this.checkbox.title=this.setting.description,this.checkbox.classList.add("tgl"),this.checkbox.classList.add("tgl-flat");const t=document.createElement("div");t.classList.add("tgl-slider"),e.appendChild(this.checkbox),e.appendChild(t),this.checkbox.addEventListener("change",(()=>{this.setting.flag!==this.checkbox.checked&&(this.setting.flag=this.checkbox.checked,this.setting.updateURLParams())}))}return this._rootElement}set flag(e){this.checkbox.checked=e}get flag(){return this.checkbox.checked}set label(e){this.settingsTextElem.innerText=e}get label(){return this.settingsTextElem.innerText}}class z$1 extends N{constructor(e){super(e),this.label=this.setting.label,this.number=this.setting.number}get setting(){return this._setting}get settingsTextElem(){return this._settingsTextElem||(this._settingsTextElem=document.createElement("label"),this._settingsTextElem.innerText=this.setting.label,this._settingsTextElem.title=this.setting.description),this._settingsTextElem}get spinner(){return this._spinner||(this._spinner=document.createElement("input"),this._spinner.type="number",this._spinner.min=this.setting.min.toString(),this._spinner.max=this.setting.max.toString(),this._spinner.value=this.setting.number.toString(),this._spinner.title=this.setting.description,this._spinner.classList.add("form-control")),this._spinner}get rootElement(){return this._rootElement||(this._rootElement=document.createElement("div"),this._rootElement.classList.add("setting"),this._rootElement.classList.add("form-group"),this._rootElement.appendChild(this.settingsTextElem),this._rootElement.appendChild(this.spinner),this.spinner.onchange=e=>{const t=e.target,r=Number.parseInt(t.value);Number.isNaN(r)?(l.Logger.Warning(l.Logger.GetStackTrace(),`Could not parse value change into a valid number - value was ${t.value}, resetting value to ${this.setting.min}`),this.setting.number!==this.setting.min&&(this.setting.number=this.setting.min)):this.setting.number!==r&&(this.setting.number=r,this.setting.updateURLParams())}),this._rootElement}set number(e){this.spinner.value=this.setting.clamp(e).toString()}get number(){return+this.spinner.value}set label(e){this.settingsTextElem.innerText=e}get label(){return this.settingsTextElem.innerText}}class B extends N{constructor(e){super(e),this.label=this.setting.label,this.text=this.setting.text}get setting(){return this._setting}get settingsTextElem(){return this._settingsTextElem||(this._settingsTextElem=document.createElement("div"),this._settingsTextElem.innerText=this.setting.label,this._settingsTextElem.title=this.setting.description),this._settingsTextElem}get textbox(){return this._textbox||(this._textbox=document.createElement("input"),this._textbox.classList.add("form-control"),this._textbox.type="textbox"),this._textbox}get rootElement(){if(!this._rootElement){this._rootElement=document.createElement("div"),this._rootElement.id=this.setting.id,this._rootElement.classList.add("setting"),this._rootElement.appendChild(this.settingsTextElem);const e=document.createElement("label");this._rootElement.appendChild(e),this.textbox.title=this.setting.description,e.appendChild(this.textbox),this.textbox.addEventListener("input",(()=>{this.setting.text!==this.textbox.value&&(this.setting.text=this.textbox.value,this.setting.updateURLParams())}))}return this._rootElement}set text(e){this.textbox.value=e}get text(){return this.textbox.value}set label(e){this.settingsTextElem.innerText=e}get label(){return this.settingsTextElem.innerText}}class U extends N{constructor(e){super(e),this.label=this.setting.label,this.options=this.setting.options,this.selected=this.setting.selected}get setting(){return this._setting}get selector(){return this._selector||(this._selector=document.createElement("select"),this._selector.classList.add("form-control"),this._selector.classList.add("settings-option")),this._selector}get settingsTextElem(){return this._settingsTextElem||(this._settingsTextElem=document.createElement("div"),this._settingsTextElem.innerText=this.setting.label,this._settingsTextElem.title=this.setting.description),this._settingsTextElem}set label(e){this.settingsTextElem.innerText=e}get label(){return this.settingsTextElem.innerText}get rootElement(){if(!this._rootElement){this._rootElement=document.createElement("div"),this._rootElement.id=this.setting.id,this._rootElement.classList.add("setting"),this._rootElement.classList.add("form-group"),this._rootElement.appendChild(this.settingsTextElem);const e=document.createElement("label");this._rootElement.appendChild(e),this.selector.title=this.setting.description,e.appendChild(this.selector),this.selector.onchange=()=>{this.setting.selected!==this.selector.value&&(this.setting.selected=this.selector.value,this.setting.updateURLParams())}}return this._rootElement}set options(e){for(let e=this.selector.options.length-1;e>=0;e--)this.selector.remove(e);e.forEach((e=>{const t=document.createElement("option");t.value=e,t.innerHTML=e,this.selector.appendChild(t)}))}get options(){return[...this.selector.options].map((e=>e.value))}set selected(e){const t=this.options.filter((t=>-1!==t.indexOf(e)));t.length&&(this.selector.value=t[0])}get selected(){return this.selector.value}disable(){this.selector.disabled=!0}enable(){this.selector.disabled=!1}}const D="LightMode";class H{constructor(e){this.customFlags=new Map,this.flagsUi=new Map,this.numericParametersUi=new Map,this.textParametersUi=new Map,this.optionParametersUi=new Map,this.createCustomUISettings(e.useUrlParams),this.registerSettingsUIComponents(e)}createCustomUISettings(e){this.customFlags.set(D,new l.SettingFlag(D,"Color Scheme: Dark Mode","Page styling will be either light or dark",!1,e,((e,t)=>{t.label=`Color Scheme: ${e?"Light":"Dark"} Mode`})))}registerSettingsUIComponents(e){for(const t of e.getFlags())this.flagsUi.set(t.id,new R(t));for(const e of Array.from(this.customFlags.values()))this.flagsUi.set(e.id,new R(e));for(const t of e.getTextSettings())this.textParametersUi.set(t.id,new B(t));for(const t of e.getNumericSettings())this.numericParametersUi.set(t.id,new z$1(t));for(const t of e.getOptionSettings())this.optionParametersUi.set(t.id,new U(t))}buildSectionWithHeading(e,t){const r=document.createElement("section");r.classList.add("settingsContainer");const n=document.createElement("div");return n.classList.add("settingsHeader"),n.classList.add("settings-text"),n.textContent=t,r.appendChild(n),e.appendChild(r),r}populateSettingsElement(e){const t=this.buildSectionWithHeading(e,"Pixel Streaming");this.addSettingText(t,this.textParametersUi.get(l.TextParameters.SignallingServerUrl)),this.addSettingOption(t,this.optionParametersUi.get(l.OptionParameters.StreamerId)),this.addSettingFlag(t,this.flagsUi.get(l.Flags.AutoConnect)),this.addSettingFlag(t,this.flagsUi.get(l.Flags.AutoPlayVideo)),this.addSettingFlag(t,this.flagsUi.get(l.Flags.BrowserSendOffer)),this.addSettingFlag(t,this.flagsUi.get(l.Flags.UseMic)),this.addSettingFlag(t,this.flagsUi.get(l.Flags.StartVideoMuted)),this.addSettingFlag(t,this.flagsUi.get(l.Flags.PreferSFU)),this.addSettingFlag(t,this.flagsUi.get(l.Flags.IsQualityController)),this.addSettingFlag(t,this.flagsUi.get(l.Flags.ForceMonoAudio)),this.addSettingFlag(t,this.flagsUi.get(l.Flags.ForceTURN)),this.addSettingFlag(t,this.flagsUi.get(l.Flags.SuppressBrowserKeys)),this.addSettingFlag(t,this.flagsUi.get(l.Flags.AFKDetection)),this.addSettingNumeric(t,this.numericParametersUi.get(l.NumericParameters.AFKTimeoutSecs));const r=this.buildSectionWithHeading(e,"UI");this.addSettingFlag(r,this.flagsUi.get(l.Flags.MatchViewportResolution)),this.addSettingFlag(r,this.flagsUi.get(l.Flags.HoveringMouseMode)),this.addSettingFlag(r,this.flagsUi.get(D));const n=this.buildSectionWithHeading(e,"Input");this.addSettingFlag(n,this.flagsUi.get(l.Flags.KeyboardInput)),this.addSettingFlag(n,this.flagsUi.get(l.Flags.MouseInput)),this.addSettingFlag(n,this.flagsUi.get(l.Flags.TouchInput)),this.addSettingFlag(n,this.flagsUi.get(l.Flags.GamepadInput)),this.addSettingFlag(n,this.flagsUi.get(l.Flags.XRControllerInput));const i=this.buildSectionWithHeading(e,"Encoder");this.addSettingNumeric(i,this.numericParametersUi.get(l.NumericParameters.MinQP)),this.addSettingNumeric(i,this.numericParametersUi.get(l.NumericParameters.MaxQP));const s=this.optionParametersUi.get(l.OptionParameters.PreferredCodec);this.addSettingOption(i,this.optionParametersUi.get(l.OptionParameters.PreferredCodec)),s&&[...s.selector.options].map((e=>e.value)).includes("Only available on Chrome")&&s.disable();const a=this.buildSectionWithHeading(e,"WebRTC");this.addSettingNumeric(a,this.numericParametersUi.get(l.NumericParameters.WebRTCFPS)),this.addSettingNumeric(a,this.numericParametersUi.get(l.NumericParameters.WebRTCMinBitrate)),this.addSettingNumeric(a,this.numericParametersUi.get(l.NumericParameters.WebRTCMaxBitrate))}addSettingText(e,t){t&&(e.appendChild(t.rootElement),this.textParametersUi.set(t.setting.id,t))}addSettingFlag(e,t){t&&(e.appendChild(t.rootElement),this.flagsUi.set(t.setting.id,t))}addSettingNumeric(e,t){t&&(e.appendChild(t.rootElement),this.numericParametersUi.set(t.setting.id,t))}addSettingOption(e,t){t&&(e.appendChild(t.rootElement),this.optionParametersUi.set(t.setting.id,t))}onSettingsChanged({data:{id:e,target:t,type:r}}){if("flag"===r){const r=e,n=t,i=this.flagsUi.get(r);i&&(i.flag!==n.flag&&(i.flag=n.flag),i.label!==n.label&&(i.label=n.label))}else if("number"===r){const r=e,n=t,i=this.numericParametersUi.get(r);i&&(i.number!==n.number&&(i.number=n.number),i.label!==n.label&&(i.label=n.label))}else if("text"===r){const r=e,n=t,i=this.textParametersUi.get(r);i&&(i.text!==n.text&&(i.text=n.text),i.label!==n.label&&(i.label=n.label))}else if("option"===r){const r=e,n=t,i=this.optionParametersUi.get(r);if(i){const e=i.options,t=n.options;e.length===t.length&&e.every((e=>t.includes(e)))||(i.options=n.options),i.selected!==n.selected&&(i.selected=n.selected),i.label!==n.label&&(i.label=n.label)}}}addCustomFlagOnSettingChangedListener(e,t){this.customFlags.has(e)&&(this.customFlags.get(e).onChange=t)}setCustomFlagLabel(e,t){this.customFlags.has(e)?(this.customFlags.get(e).label=t,this.flagsUi.get(e).label=t):l.Logger.Warning(l.Logger.GetStackTrace(),`Cannot set label for flag called ${e} - it does not exist in the Config.flags map.`)}isCustomFlagEnabled(e){return this.customFlags.get(e).flag}}class Q{constructor(e){this._options=e,this.stream=e.stream,this.onColorModeChanged=e.onColorModeChanged,this.configUI=new H(this.stream.config),this.createOverlays(),T(e.statsPanelConfig)&&(this.statsPanel=new O,this.uiFeaturesElement.appendChild(this.statsPanel.rootElement)),T(e.settingsPanelConfig)&&(this.settingsPanel=new k,this.uiFeaturesElement.appendChild(this.settingsPanel.rootElement),this.configureSettings()),e.videoQpIndicatorConfig&&e.videoQpIndicatorConfig.disableIndicator||(this.videoQpIndicator=new M,this.uiFeaturesElement.appendChild(this.videoQpIndicator.rootElement)),this.createButtons(),this.registerCallbacks(),this.showConnectOrAutoConnectOverlays(),this.setColorMode(this.configUI.isCustomFlagEnabled(D))}createOverlays(){this.disconnectOverlay=new u(this.stream.videoElementParent),this.connectOverlay=new m(this.stream.videoElementParent),this.playOverlay=new g(this.stream.videoElementParent),this.infoOverlay=new E(this.stream.videoElementParent),this.errorOverlay=new v$1(this.stream.videoElementParent),this.afkOverlay=new b(this.stream.videoElementParent),this.disconnectOverlay.onAction((()=>this.stream.reconnect())),this.connectOverlay.onAction((()=>this.stream.connect())),this.playOverlay.onAction((()=>this.stream.play()))}createButtons(){const e={statsButtonType:this._options.statsPanelConfig?this._options.statsPanelConfig.visibilityButtonConfig:void 0,settingsButtonType:this._options.settingsPanelConfig?this._options.settingsPanelConfig.visibilityButtonConfig:void 0,fullscreenButtonType:this._options.fullScreenControlsConfig,xrIconType:this._options.xrControlsConfig},t=new L(e);this.uiFeaturesElement.appendChild(t.rootElement);const r=this._options.fullScreenControlsConfig&&this._options.fullScreenControlsConfig.creationMode===c.UseCustomElement?new y(this._options.fullScreenControlsConfig.customElement):t.fullscreenIcon;r&&(r.fullscreenElement=this.rootElement);const n=t.settingsIcon?t.settingsIcon.rootElement:this._options.settingsPanelConfig.visibilityButtonConfig.customElement;n&&(n.onclick=()=>this.settingsClicked()),this.settingsPanel&&(this.settingsPanel.settingsCloseButton.onclick=()=>this.settingsClicked());const i=t.xrIcon?t.xrIcon.rootElement:this._options.xrControlsConfig.creationMode===c.UseCustomElement?this._options.xrControlsConfig.customElement:void 0;i&&(i.onclick=()=>this.stream.toggleXR());const s=t.statsIcon?t.statsIcon.rootElement:this._options.statsPanelConfig.visibilityButtonConfig.customElement;if(s&&(s.onclick=()=>this.statsClicked()),this.statsPanel&&(this.statsPanel.statsCloseButton.onclick=()=>this.statsClicked()),this.settingsPanel){const e=new I("Show FPS","Toggle");e.addOnClickListener((()=>{this.stream.requestShowFps()}));const t=new I("Restart Stream","Restart");t.addOnClickListener((()=>{this.stream.reconnect()}));const r=new I("Request keyframe","Request");r.addOnClickListener((()=>{this.stream.requestIframe()}));const n=this.configUI.buildSectionWithHeading(this.settingsPanel.settingsContentElement,"Commands");n.appendChild(e.rootElement),n.appendChild(r.rootElement),n.appendChild(t.rootElement)}}configureSettings(){this.configUI.populateSettingsElement(this.settingsPanel.settingsContentElement),this.configUI.addCustomFlagOnSettingChangedListener(D,(e=>{this.configUI.setCustomFlagLabel(D,`Color Scheme: ${e?"Light":"Dark"} Mode`),this.setColorMode(e)}))}registerCallbacks(){this.stream.addEventListener("afkWarningActivate",(({data:{countDown:e,dismissAfk:t}})=>this.showAfkOverlay(e,t))),this.stream.addEventListener("afkWarningUpdate",(({data:{countDown:e}})=>this.afkOverlay.updateCountdown(e))),this.stream.addEventListener("afkWarningDeactivate",(()=>this.afkOverlay.hide())),this.stream.addEventListener("afkTimedOut",(()=>this.afkOverlay.hide())),this.stream.addEventListener("videoEncoderAvgQP",(({data:{avgQP:e}})=>this.onVideoEncoderAvgQP(e))),this.stream.addEventListener("webRtcSdp",(()=>this.onWebRtcSdp())),this.stream.addEventListener("webRtcAutoConnect",(()=>this.onWebRtcAutoConnect())),this.stream.addEventListener("webRtcConnecting",(()=>this.onWebRtcConnecting())),this.stream.addEventListener("webRtcConnected",(()=>this.onWebRtcConnected())),this.stream.addEventListener("webRtcFailed",(()=>this.onWebRtcFailed())),this.stream.addEventListener("webRtcDisconnected",(({data:{eventString:e,showActionOrErrorOnDisconnect:t}})=>this.onDisconnect(e,t))),this.stream.addEventListener("videoInitialized",(()=>this.onVideoInitialized())),this.stream.addEventListener("streamLoading",(()=>this.onStreamLoading())),this.stream.addEventListener("playStreamError",(({data:{message:e}})=>this.onPlayStreamError(e))),this.stream.addEventListener("playStream",(()=>this.onPlayStream())),this.stream.addEventListener("playStreamRejected",(({data:{reason:e}})=>this.onPlayStreamRejected(e))),this.stream.addEventListener("loadFreezeFrame",(({data:{shouldShowPlayOverlay:e}})=>this.onLoadFreezeFrame(e))),this.stream.addEventListener("statsReceived",(({data:{aggregatedStats:e}})=>this.onStatsReceived(e))),this.stream.addEventListener("latencyTestResult",(({data:{latencyTimings:e}})=>this.onLatencyTestResults(e))),this.stream.addEventListener("streamerListMessage",(({data:{messageStreamerList:e,autoSelectedStreamerId:t}})=>this.handleStreamerListMessage(e,t))),this.stream.addEventListener("settingsChanged",(e=>this.configUI.onSettingsChanged(e)))}get rootElement(){return this._rootElement||(this._rootElement=document.createElement("div"),this._rootElement.id="playerUI",this._rootElement.classList.add("noselect"),this._rootElement.appendChild(this.stream.videoElementParent),this._rootElement.appendChild(this.uiFeaturesElement)),this._rootElement}get uiFeaturesElement(){return this._uiFeatureElement||(this._uiFeatureElement=document.createElement("div"),this._uiFeatureElement.id="uiFeatures"),this._uiFeatureElement}showDisconnectOverlay(e){this.hideCurrentOverlay(),this.updateDisconnectOverlay(e),this.disconnectOverlay.show(),this.currentOverlay=this.disconnectOverlay}updateDisconnectOverlay(e){this.disconnectOverlay.update(e)}onDisconnectionAction(){this.disconnectOverlay.activate()}hideCurrentOverlay(){null!=this.currentOverlay&&(this.currentOverlay.hide(),this.currentOverlay=null)}showConnectOverlay(){this.hideCurrentOverlay(),this.connectOverlay.show(),this.currentOverlay=this.connectOverlay}showPlayOverlay(){this.hideCurrentOverlay(),this.playOverlay.show(),this.currentOverlay=this.playOverlay}showTextOverlay(e){this.hideCurrentOverlay(),this.infoOverlay.update(e),this.infoOverlay.show(),this.currentOverlay=this.infoOverlay}showErrorOverlay(e){this.hideCurrentOverlay(),this.errorOverlay.update(e),this.errorOverlay.show(),this.currentOverlay=this.errorOverlay}settingsClicked(){this.statsPanel.hide(),this.settingsPanel.toggleVisibility()}statsClicked(){this.settingsPanel.hide(),this.statsPanel.toggleVisibility()}onConnectAction(){this.connectOverlay.activate()}onPlayAction(){this.playOverlay.activate()}showAfkOverlay(e,t){this.hideCurrentOverlay(),this.afkOverlay.updateCountdown(e),this.afkOverlay.onAction((()=>t())),this.afkOverlay.show(),this.currentOverlay=this.afkOverlay}showConnectOrAutoConnectOverlays(){this.stream.config.isFlagEnabled(l.Flags.AutoConnect)||this.showConnectOverlay()}onWebRtcAutoConnect(){this.showTextOverlay("Auto Connecting Now")}onWebRtcSdp(){this.showTextOverlay("WebRTC Connection Negotiated")}onStreamLoading(){const e=document.createElement("span");e.className="visually-hidden",e.innerHTML="Loading...";const t=document.createElement("div");t.id="loading-spinner",t.className="spinner-border ms-2",t.setAttribute("role","status"),t.appendChild(e),this.showTextOverlay("Loading Stream "+t.outerHTML)}onDisconnect(e,t){0==t?this.showErrorOverlay(`Disconnected: ${e}`):this.showDisconnectOverlay(`Disconnected: ${e} <div class="clickableState">Click To Restart</div>`),this.statsPanel.latencyTest.latencyTestButton.onclick=()=>{}}onWebRtcConnecting(){this.showTextOverlay("Starting connection to server, please wait")}onWebRtcConnected(){this.showTextOverlay("WebRTC connected, waiting for video")}onWebRtcFailed(){this.showErrorOverlay("Unable to setup video")}onLoadFreezeFrame(e){!0===e&&(l.Logger.Log(l.Logger.GetStackTrace(),"showing play overlay"),this.showPlayOverlay())}onPlayStream(){this.hideCurrentOverlay()}onPlayStreamError(e){this.showErrorOverlay(e)}onPlayStreamRejected(e){this.showPlayOverlay()}onVideoInitialized(){this.stream.config.isFlagEnabled(l.Flags.AutoPlayVideo)||this.showPlayOverlay(),this.statsPanel.latencyTest.latencyTestButton.onclick=()=>{this.stream.requestLatencyTest()}}onVideoEncoderAvgQP(e){this.videoQpIndicator&&this.videoQpIndicator.updateQpTooltip(e)}onInitialSettings(e){e.PixelStreamingSettings&&e.PixelStreamingSettings.DisableLatencyTest&&(this.statsPanel.latencyTest.latencyTestButton.disabled=!0,this.statsPanel.latencyTest.latencyTestButton.title="Disabled by -PixelStreamingDisableLatencyTester=true",l.Logger.Info(l.Logger.GetStackTrace(),"-PixelStreamingDisableLatencyTester=true, requesting latency report from the the browser to UE is disabled."))}onStatsReceived(e){this.statsPanel.handleStats(e)}onLatencyTestResults(e){this.statsPanel.latencyTest.handleTestResult(e)}handleStreamerListMessage(e,t){null===t&&(0===e.ids.length?this.showDisconnectOverlay('No streamers connected. <div class="clickableState">Click To Restart</div>'):this.showTextOverlay("Multiple streamers detected. Use the dropdown in the settings menu to select the streamer"))}setColorMode(e){this.onColorModeChanged&&this.onColorModeChanged(e)}}const W=(e=>{var t={};return n.d(t,e),t})({default:()=>index$1}),Z=(e=>{var t={};return n.d(t,e),t})({default:()=>jssGlobal}),X=(e=>{var t={};return n.d(t,e),t})({default:()=>camelCase});class j{constructor(e){this.defaultLightModePalette={"--color0":"#e2e0dd80","--color1":"#FFFFFF","--color2":"#000000","--color3":"#0585fe","--color4":"#35b350","--color5":"#ffab00","--color6":"#e1e2dd","--color7":"#c3c4bf"},this.defaultDarkModePalette={"--color0":"#1D1F2280","--color1":"#000000","--color2":"#FFFFFF","--color3":"#0585fe","--color4":"#35b350","--color5":"#ffab00","--color6":"#1e1d22","--color7":"#3c3b40"},this.defaultStyles={":root":{"--color0":"#1D1F2280","--color1":"#000000","--color2":"#FFFFFF","--color3":"#0585fe","--color4":"#35b350","--color5":"#ffab00","--color6":"#1e1d22","--color7":"#3c3b40","--color8":"#41008c","--color9":"#3e0070","--color10":"#2e0052","--color11":"rgba(65,0,139,1)"},".noselect":{userSelect:"none"},"#playerUI":{width:"100%",height:"100%",position:"relative"},"#videoElementParent":{width:"100%",height:"100%",position:"absolute",backgroundColor:"var(--color1)"},"#uiFeatures":{width:"100%",height:"100%",zIndex:"30",position:"relative",color:"var(--color2)",pointerEvents:"none",overflow:"hidden"},".UiTool .tooltiptext":{visibility:"hidden",width:"auto",color:"var(--color2)",textAlign:"center",borderRadius:"15px",padding:"0px 10px",fontFamily:"'Montserrat', sans-serif",fontSize:"0.75rem",letterSpacing:"0.75px",position:"absolute",top:"0",transform:"translateY(25%)",left:"125%",zIndex:"20"},".UiTool:hover .tooltiptext":{visibility:"visible",backgroundColor:"var(--color7)"},"#connection .tooltiptext":{top:"125%",transform:"translateX(-25%)",left:"0",zIndex:"20",padding:"5px 10px"},"#connection":{position:"absolute",bottom:"8%",left:"5%",fontFamily:"'Michroma', sans-serif",height:"3rem",width:"3rem",pointerEvents:"all"},"#settings-panel .tooltiptext":{display:"block",top:"125%",transform:"translateX(-50%)",left:"0",zIndex:"20",padding:"5px 10px",border:"3px solid var(--color3)",width:"max-content",fallbacks:[{width:"max-content"},{border:"3px solid var(--color3)"},{padding:"5px 10px"},{zIndex:"20"},{left:"0"},{transform:"translateX(-50%)"},{top:"125%"},{display:"block"}]},"#controls":{position:"absolute",top:"3%",left:"2%",fontFamily:"'Michroma', sans-serif",pointerEvents:"all",display:"block"},"#controls>*":{marginBottom:"0.5rem",borderRadius:"50%",display:"block",height:"2rem",lineHeight:"1.75rem",padding:"0.5rem"},"#controls #additionalinfo":{textAlign:"center",fontFamily:"'Montserrat', sans-serif"},"#fullscreen-btn":{padding:"0.6rem !important"},"#minimizeIcon":{display:"none"},"#settingsBtn, #statsBtn":{cursor:"pointer"},"#uiFeatures button":{backgroundColor:"var(--color7)",border:"1px solid var(--color7)",color:"var(--color2)",position:"relative",width:"3rem",height:"3rem",padding:"0.5rem",textAlign:"center"},"#uiFeatures button:hover":{backgroundColor:"var(--color3)",border:"3px solid var(--color3)",transition:"0.25s ease",paddingLeft:"0.55rem",paddingTop:"0.55rem"},"#uiFeatures button:active":{border:"3px solid var(--color3)",backgroundColor:"var(--color7)",paddingLeft:"0.55rem",paddingTop:"0.55rem"},".btn-flat":{backgroundColor:"transparent",color:"var(--color2)",fontFamily:"'Montserrat'",fontWeight:"bold",border:"3px solid var(--color3)",borderRadius:"1rem",fontSize:"0.75rem",paddingLeft:"0.5rem",paddingRight:"0.5rem",cursor:"pointer",textAlign:"center"},".btn-flat:hover":{backgroundColor:"var(--color3)",transition:"ease 0.3s"},".btn-flat:disabled":{background:"var(--color7)",borderColor:"var(--color3)",color:"var(--color3)",cursor:"default"},".btn-flat:active":{backgroundColor:"transparent"},".btn-flat:focus":{outline:"none"},"#uiFeatures img":{width:"100%",height:"100%"},".panel-wrap":{position:"absolute",top:"0",bottom:"0",right:"0",height:"100%",minWidth:"20vw",maxWidth:"100vw",transform:"translateX(100%)",transition:".3s ease-out",pointerEvents:"all",backdropFilter:"blur(10px)",webkitBackdropFilter:"blur(10px)",overflowY:"auto",overflowX:"hidden",backgroundColor:"var(--color0)"},".panel-wrap-visible":{transform:"translateX(0%)"},".panel":{overflowY:"auto",padding:"1em"},"#settingsHeading, #statsHeading":{display:"inline-block",fontSize:"2em",marginBlockStart:"0.67em",marginBlockEnd:"0.67em",marginInlineStart:"0px",marginInlineEnd:"0px",position:"relative",padding:"0 0 0 2rem"},"#settingsClose, #statsClose":{margin:"0.5rem",paddingTop:"0.5rem",paddingBottom:"0.5rem",paddingRight:"0.5rem",fontSize:"2em",float:"right"},"#settingsClose:after, #statsClose:after":{paddingLeft:"0.5rem",display:"inline-block",content:'"\\00d7"'},"#settingsClose:hover, #statsClose:hover":{color:"var(--color3)",transition:"ease 0.3s"},"#settingsContent, #statsContent":{marginLeft:"2rem",marginRight:"2rem"},".setting":{display:"flex",flexDirection:"row",justifyContent:"space-between",padding:"0.15rem 10px 0.15rem 10px"},".settings-text":{color:"var(--color2)",verticalAlign:"middle",fontWeight:"normal"},".settings-option":{width:"100%",textOverflow:"ellipsis",whiteSpace:"nowrap"},"#connectOverlay, #playOverlay, #infoOverlay, #errorOverlay, #afkOverlay, #disconnectOverlay":{zIndex:"30",position:"absolute",color:"var(--color2)",fontSize:"1.8em",width:"100%",height:"100%",backgroundColor:"var(--color1)",alignItems:"center",justifyContent:"center",textTransform:"uppercase"},".clickableState":{alignItems:"center",justifyContent:"center",display:"flex",cursor:"pointer"},".textDisplayState":{display:"flex"},".hiddenState":{display:"none"},"#playButton, #connectButton":{display:"inline-block",height:"auto",zIndex:"30"},"img#playButton":{maxWidth:"241px",width:"10%"},"#uiInteraction":{position:"fixed"},"#UIInteractionButtonBoundary":{padding:"2px"},"#UIInteractionButton":{cursor:"pointer"},"#hiddenInput":{position:"absolute",left:"-10%",width:"0px",opacity:"0"},"#editTextButton":{position:"absolute",height:"40px",width:"40px"},".btn-overlay":{verticalAlign:"middle",display:"inline-block"},".tgl-switch":{verticalAlign:"middle",display:"inline-block"},".tgl-switch .tgl":{display:"none"},".tgl, .tgl:after, .tgl:before, .tgl *, .tgl *:after, .tgl *:before, .tgl+.tgl-slider":{webkitBoxSizing:"border-box",boxSizing:"border-box"},".tgl::-moz-selection, .tgl:after::-moz-selection, .tgl:before::-moz-selection, .tgl *::-moz-selection, .tgl *:after::-moz-selection, .tgl *:before::-moz-selection, .tgl+.tgl-slider::-moz-selection":{background:"none"},".tgl::selection, .tgl:after::selection, .tgl:before::selection, .tgl *::selection, .tgl *:after::selection, .tgl *:before::selection, .tgl+.tgl-slider::selection":{background:"none"},".tgl-slider":{},".tgl+.tgl-slider":{outline:"0",display:"block",width:"40px",height:"18px",position:"relative",cursor:"pointer",userSelect:"none"},".tgl+.tgl-slider:after, .tgl+.tgl-slider:before":{position:"relative",display:"block",content:'""',width:"50%",height:"100%"},".tgl+.tgl-slider:after":{left:"0"},".tgl+.tgl-slider:before":{display:"none"},".tgl-flat+.tgl-slider":{padding:"2px",webkitTransition:"all .2s ease",transition:"all .2s ease",background:"var(--color6)",border:"3px solid var(--color7)",borderRadius:"2em"},".tgl-flat+.tgl-slider:after":{webkitTransition:"all .2s ease",transition:"all .2s ease",background:"var(--color7)",content:'""',borderRadius:"1em"},".tgl-flat:checked+.tgl-slider":{border:"3px solid var(--color3)"},".tgl-flat:checked+.tgl-slider:after":{left:"50%",background:"var(--color3)"},".btn-apply":{display:"block !important",marginLeft:"auto",marginRight:"auto",width:"40%"},".form-control":{backgroundColor:"var(--color7)",border:"2px solid var(--color7)",borderRadius:"4px",color:"var(--color2)",textAlign:"right",fontFamily:"inherit"},".form-control:hover":{borderColor:"var(--color7)"},".form-group":{paddingTop:"4px",display:"grid",gridTemplateColumns:"80% 20%",rowGap:"4px",paddingRight:"10px",paddingLeft:"10px"},".form-group label":{verticalAlign:"middle",fontWeight:"normal"},".settingsContainer":{display:"flex",flexDirection:"column",borderBottom:"1px solid var(--color7)",paddingTop:"10px",paddingBottom:"10px"},".settingsContainer> :first-child":{marginTop:"4px",marginBottom:"4px",fontWeight:"bold",justifyContent:"space-between",display:"flex",flexDirection:"row",alignItems:"baseline"},".collapse":{paddingLeft:"5%"},"#streamTools":{borderBottomRightRadius:"5px",borderBottomLeftRadius:"5px",userSelect:"none",position:"absolute",top:"0",right:"2%",zIndex:"100",border:"4px solid var(--colour8)",borderTopWidth:"0px"},".settingsHeader":{fontStyle:"italic"},"#streamToolsHeader":{display:"flex",flexDirection:"row",justifyContent:"space-between",borderBottom:"1px solid var(--colour8)",backgroundColor:"var(--color7)"},".streamTools":{backgroundColor:"var(--color2)",fontFamily:"var(--buttonFont)",fontWeight:"lighter",color:"var(--color7)"},".streamTools-shown>#streamToolsSettings, .streamTools-shown>#streamToolsStats":{display:"block"},"#streamToolsToggle":{width:"100%"},"#qualityStatus":{fontSize:"37px",paddingRight:"4px"},".svgIcon":{fill:"var(--color2)"}};const{customStyles:t,lightModePalette:r,darkModePalette:n}=null!=e?e:{},i={plugins:[(0,Z.default)(),(0,X.default)()]};W.default.setup(i),this.customStyles=t,this.lightModePalette=null!=r?r:this.defaultLightModePalette,this.darkModePalette=null!=n?n:this.defaultDarkModePalette}applyStyleSheet(){W.default.createStyleSheet({"@global":Object.assign(Object.assign({},this.defaultStyles),this.customStyles)}).attach()}applyPalette(e){const t=document.querySelector(":root");t.style.setProperty("--color0",e["--color0"]),t.style.setProperty("--color1",e["--color1"]),t.style.setProperty("--color2",e["--color2"]),t.style.setProperty("--color3",e["--color3"]),t.style.setProperty("--color4",e["--color4"]),t.style.setProperty("--color5",e["--color5"]),t.style.setProperty("--color6",e["--color6"]),t.style.setProperty("--color7",e["--color7"])}setColorMode(e){e?this.applyPalette(this.lightModePalette):this.applyPalette(this.darkModePalette)}}var q=o.ym,V=o.EW,G=o.Mx,J=o.L3,Y=o.rl,K=o.NR,$$8=o.f1,tt=o.IY,et=o.RZ,st=o.XY,it=o.Fk,nt=o.Zh,ot=o.ek,lt=o.MG,at=o.gE,rt=o.tW,ct=o.wr,check=function(e){return e&&e.Math==Math&&e},global$g=check("object"==typeof globalThis&&globalThis)||check("object"==typeof window&&window)||check("object"==typeof self&&self)||check("object"==typeof commonjsGlobal&&commonjsGlobal)||function(){return this}()||Function("return this")(),objectGetOwnPropertyDescriptor={},fails$k=function(e){try{return!!e()}catch(e){return!0}},fails$j=fails$k,descriptors=!fails$j((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]})),fails$i=fails$k,functionBindNative=!fails$i((function(){var e=function(){}.bind();return"function"!=typeof e||e.hasOwnProperty("prototype")})),NATIVE_BIND$3=functionBindNative,call$g=Function.prototype.call,functionCall=NATIVE_BIND$3?call$g.bind(call$g):function(){return call$g.apply(call$g,arguments)},objectPropertyIsEnumerable={},$propertyIsEnumerable={}.propertyIsEnumerable,getOwnPropertyDescriptor$3=Object.getOwnPropertyDescriptor,NASHORN_BUG=getOwnPropertyDescriptor$3&&!$propertyIsEnumerable.call({1:2},1);objectPropertyIsEnumerable.f=NASHORN_BUG?function(e){var t=getOwnPropertyDescriptor$3(this,e);return!!t&&t.enumerable}:$propertyIsEnumerable;var createPropertyDescriptor$5=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}},NATIVE_BIND$2=functionBindNative,FunctionPrototype$2=Function.prototype,call$f=FunctionPrototype$2.call,uncurryThisWithBind=NATIVE_BIND$2&&FunctionPrototype$2.bind.bind(call$f,call$f),functionUncurryThis=NATIVE_BIND$2?uncurryThisWithBind:function(e){return function(){return call$f.apply(e,arguments)}},uncurryThis$n=functionUncurryThis,toString$9=uncurryThis$n({}.toString),stringSlice$8=uncurryThis$n("".slice),classofRaw$2=function(e){return stringSlice$8(toString$9(e),8,-1)},uncurryThis$m=functionUncurryThis,fails$h=fails$k,classof$7=classofRaw$2,$Object$4=Object,split$3=uncurryThis$m("".split),indexedObject=fails$h((function(){return!$Object$4("z").propertyIsEnumerable(0)}))?function(e){return"String"==classof$7(e)?split$3(e,""):$Object$4(e)}:$Object$4,isNullOrUndefined$5=function(e){return null==e},isNullOrUndefined$4=isNullOrUndefined$5,$TypeError$b=TypeError,requireObjectCoercible$7=function(e){if(isNullOrUndefined$4(e))throw $TypeError$b("Can't call method on "+e);return e},IndexedObject$1=indexedObject,requireObjectCoercible$6=requireObjectCoercible$7,toIndexedObject$5=function(e){return IndexedObject$1(requireObjectCoercible$6(e))},documentAll$2="object"==typeof document&&document.all,IS_HTMLDDA=void 0===documentAll$2&&void 0!==documentAll$2,documentAll_1={all:documentAll$2,IS_HTMLDDA:IS_HTMLDDA},$documentAll$1=documentAll_1,documentAll$1=$documentAll$1.all,isCallable$j=$documentAll$1.IS_HTMLDDA?function(e){return"function"==typeof e||e===documentAll$1}:function(e){return"function"==typeof e},isCallable$i=isCallable$j,$documentAll=documentAll_1,documentAll=$documentAll.all,isObject$8=$documentAll.IS_HTMLDDA?function(e){return"object"==typeof e?null!==e:isCallable$i(e)||e===documentAll}:function(e){return"object"==typeof e?null!==e:isCallable$i(e)},global$f=global$g,isCallable$h=isCallable$j,aFunction=function(e){return isCallable$h(e)?e:void 0},getBuiltIn$4=function(e,t){return arguments.length<2?aFunction(global$f[e]):global$f[e]&&global$f[e][t]},uncurryThis$l=functionUncurryThis,objectIsPrototypeOf=uncurryThis$l({}.isPrototypeOf),engineUserAgent="undefined"!=typeof navigator&&String(navigator.userAgent)||"",global$e=global$g,userAgent=engineUserAgent,process=global$e.process,Deno=global$e.Deno,versions=process&&process.versions||Deno&&Deno.version,v8=versions&&versions.v8,match,version;v8&&(match=v8.split("."),version=match[0]>0&&match[0]<4?1:+(match[0]+match[1])),!version&&userAgent&&(match=userAgent.match(/Edge\/(\d+)/),(!match||match[1]>=74)&&(match=userAgent.match(/Chrome\/(\d+)/),match&&(version=+match[1])));var engineV8Version=version,V8_VERSION=engineV8Version,fails$g=fails$k,symbolConstructorDetection=!!Object.getOwnPropertySymbols&&!fails$g((function(){var e=Symbol();return!String(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&V8_VERSION&&V8_VERSION<41})),NATIVE_SYMBOL$1=symbolConstructorDetection,useSymbolAsUid=NATIVE_SYMBOL$1&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,getBuiltIn$3=getBuiltIn$4,isCallable$g=isCallable$j,isPrototypeOf$2=objectIsPrototypeOf,USE_SYMBOL_AS_UID$1=useSymbolAsUid,$Object$3=Object,isSymbol$2=USE_SYMBOL_AS_UID$1?function(e){return"symbol"==typeof e}:function(e){var t=getBuiltIn$3("Symbol");return isCallable$g(t)&&isPrototypeOf$2(t.prototype,$Object$3(e))},$String$4=String,tryToString$2=function(e){try{return $String$4(e)}catch(e){return"Object"}},isCallable$f=isCallable$j,tryToString$1=tryToString$2,$TypeError$a=TypeError,aCallable$4=function(e){if(isCallable$f(e))return e;throw $TypeError$a(tryToString$1(e)+" is not a function")},aCallable$3=aCallable$4,isNullOrUndefined$3=isNullOrUndefined$5,getMethod$5=function(e,t){var r=e[t];return isNullOrUndefined$3(r)?void 0:aCallable$3(r)},call$e=functionCall,isCallable$e=isCallable$j,isObject$7=isObject$8,$TypeError$9=TypeError,ordinaryToPrimitive$1=function(e,t){var r,n;if("string"===t&&isCallable$e(r=e.toString)&&!isObject$7(n=call$e(r,e)))return n;if(isCallable$e(r=e.valueOf)&&!isObject$7(n=call$e(r,e)))return n;if("string"!==t&&isCallable$e(r=e.toString)&&!isObject$7(n=call$e(r,e)))return n;throw $TypeError$9("Can't convert object to primitive value")},shared$4={exports:{}},isPure=!1,global$d=global$g,defineProperty$6=Object.defineProperty,defineGlobalProperty$3=function(e,t){try{defineProperty$6(global$d,e,{value:t,configurable:!0,writable:!0})}catch(r){global$d[e]=t}return t},global$c=global$g,defineGlobalProperty$2=defineGlobalProperty$3,SHARED="__core-js_shared__",store$3=global$c[SHARED]||defineGlobalProperty$2(SHARED,{}),sharedStore=store$3,store$2=sharedStore;(shared$4.exports=function(e,t){return store$2[e]||(store$2[e]=void 0!==t?t:{})})("versions",[]).push({version:"3.29.1",mode:"global",copyright:"© 2014-2023 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.29.1/LICENSE",source:"https://github.com/zloirock/core-js"});var requireObjectCoercible$5=requireObjectCoercible$7,$Object$2=Object,toObject$5=function(e){return $Object$2(requireObjectCoercible$5(e))},uncurryThis$k=functionUncurryThis,toObject$4=toObject$5,hasOwnProperty=uncurryThis$k({}.hasOwnProperty),hasOwnProperty_1=Object.hasOwn||function(e,t){return hasOwnProperty(toObject$4(e),t)},uncurryThis$j=functionUncurryThis,id=0,postfix=Math.random(),toString$8=uncurryThis$j(1..toString),uid$2=function(e){return"Symbol("+(void 0===e?"":e)+")_"+toString$8(++id+postfix,36)},global$b=global$g,shared$3=shared$4.exports,hasOwn$b=hasOwnProperty_1,uid$1=uid$2,NATIVE_SYMBOL=symbolConstructorDetection,USE_SYMBOL_AS_UID=useSymbolAsUid,Symbol$1=global$b.Symbol,WellKnownSymbolsStore=shared$3("wks"),createWellKnownSymbol=USE_SYMBOL_AS_UID?Symbol$1.for||Symbol$1:Symbol$1&&Symbol$1.withoutSetter||uid$1,wellKnownSymbol$g=function(e){return hasOwn$b(WellKnownSymbolsStore,e)||(WellKnownSymbolsStore[e]=NATIVE_SYMBOL&&hasOwn$b(Symbol$1,e)?Symbol$1[e]:createWellKnownSymbol("Symbol."+e)),WellKnownSymbolsStore[e]},call$d=functionCall,isObject$6=isObject$8,isSymbol$1=isSymbol$2,getMethod$4=getMethod$5,ordinaryToPrimitive=ordinaryToPrimitive$1,wellKnownSymbol$f=wellKnownSymbol$g,$TypeError$8=TypeError,TO_PRIMITIVE=wellKnownSymbol$f("toPrimitive"),toPrimitive$1=function(e,t){if(!isObject$6(e)||isSymbol$1(e))return e;var r,n=getMethod$4(e,TO_PRIMITIVE);if(n){if(void 0===t&&(t="default"),r=call$d(n,e,t),!isObject$6(r)||isSymbol$1(r))return r;throw $TypeError$8("Can't convert object to primitive value")}return void 0===t&&(t="number"),ordinaryToPrimitive(e,t)},toPrimitive=toPrimitive$1,isSymbol=isSymbol$2,toPropertyKey$3=function(e){var t=toPrimitive(e,"string");return isSymbol(t)?t:t+""},global$a=global$g,isObject$5=isObject$8,document$1=global$a.document,EXISTS$1=isObject$5(document$1)&&isObject$5(document$1.createElement),documentCreateElement$2=function(e){return EXISTS$1?document$1.createElement(e):{}},DESCRIPTORS$c=descriptors,fails$f=fails$k,createElement=documentCreateElement$2,ie8DomDefine=!DESCRIPTORS$c&&!fails$f((function(){return 7!=Object.defineProperty(createElement("div"),"a",{get:function(){return 7}}).a})),DESCRIPTORS$b=descriptors,call$c=functionCall,propertyIsEnumerableModule$1=objectPropertyIsEnumerable,createPropertyDescriptor$4=createPropertyDescriptor$5,toIndexedObject$4=toIndexedObject$5,toPropertyKey$2=toPropertyKey$3,hasOwn$a=hasOwnProperty_1,IE8_DOM_DEFINE$1=ie8DomDefine,$getOwnPropertyDescriptor$1=Object.getOwnPropertyDescriptor;objectGetOwnPropertyDescriptor.f=DESCRIPTORS$b?$getOwnPropertyDescriptor$1:function(e,t){if(e=toIndexedObject$4(e),t=toPropertyKey$2(t),IE8_DOM_DEFINE$1)try{return $getOwnPropertyDescriptor$1(e,t)}catch(e){}if(hasOwn$a(e,t))return createPropertyDescriptor$4(!call$c(propertyIsEnumerableModule$1.f,e,t),e[t])};var objectDefineProperty={},DESCRIPTORS$a=descriptors,fails$e=fails$k,v8PrototypeDefineBug=DESCRIPTORS$a&&fails$e((function(){return 42!=Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype})),isObject$4=isObject$8,$String$3=String,$TypeError$7=TypeError,anObject$e=function(e){if(isObject$4(e))return e;throw $TypeError$7($String$3(e)+" is not an object")},DESCRIPTORS$9=descriptors,IE8_DOM_DEFINE=ie8DomDefine,V8_PROTOTYPE_DEFINE_BUG$1=v8PrototypeDefineBug,anObject$d=anObject$e,toPropertyKey$1=toPropertyKey$3,$TypeError$6=TypeError,$defineProperty=Object.defineProperty,$getOwnPropertyDescriptor=Object.getOwnPropertyDescriptor,ENUMERABLE="enumerable",CONFIGURABLE$1="configurable",WRITABLE="writable";objectDefineProperty.f=DESCRIPTORS$9?V8_PROTOTYPE_DEFINE_BUG$1?function(e,t,r){if(anObject$d(e),t=toPropertyKey$1(t),anObject$d(r),"function"==typeof e&&"prototype"===t&&"value"in r&&WRITABLE in r&&!r[WRITABLE]){var n=$getOwnPropertyDescriptor(e,t);n&&n[WRITABLE]&&(e[t]=r.value,r={configurable:CONFIGURABLE$1 in r?r[CONFIGURABLE$1]:n[CONFIGURABLE$1],enumerable:ENUMERABLE in r?r[ENUMERABLE]:n[ENUMERABLE],writable:!1})}return $defineProperty(e,t,r)}:$defineProperty:function(e,t,r){if(anObject$d(e),t=toPropertyKey$1(t),anObject$d(r),IE8_DOM_DEFINE)try{return $defineProperty(e,t,r)}catch(e){}if("get"in r||"set"in r)throw $TypeError$6("Accessors not supported");return"value"in r&&(e[t]=r.value),e};var DESCRIPTORS$8=descriptors,definePropertyModule$4=objectDefineProperty,createPropertyDescriptor$3=createPropertyDescriptor$5,createNonEnumerableProperty$5=DESCRIPTORS$8?function(e,t,r){return definePropertyModule$4.f(e,t,createPropertyDescriptor$3(1,r))}:function(e,t,r){return e[t]=r,e},makeBuiltIn$3={exports:{}},DESCRIPTORS$7=descriptors,hasOwn$9=hasOwnProperty_1,FunctionPrototype$1=Function.prototype,getDescriptor=DESCRIPTORS$7&&Object.getOwnPropertyDescriptor,EXISTS=hasOwn$9(FunctionPrototype$1,"name"),PROPER=EXISTS&&"something"===function(){}.name,CONFIGURABLE=EXISTS&&(!DESCRIPTORS$7||DESCRIPTORS$7&&getDescriptor(FunctionPrototype$1,"name").configurable),functionName={EXISTS:EXISTS,PROPER:PROPER,CONFIGURABLE:CONFIGURABLE},uncurryThis$i=functionUncurryThis,isCallable$d=isCallable$j,store$1=sharedStore,functionToString=uncurryThis$i(Function.toString);isCallable$d(store$1.inspectSource)||(store$1.inspectSource=function(e){return functionToString(e)});var inspectSource$2=store$1.inspectSource,global$9=global$g,isCallable$c=isCallable$j,WeakMap$1=global$9.WeakMap,weakMapBasicDetection=isCallable$c(WeakMap$1)&&/native code/.test(String(WeakMap$1)),shared$2=shared$4.exports,uid=uid$2,keys=shared$2("keys"),sharedKey$3=function(e){return keys[e]||(keys[e]=uid(e))},hiddenKeys$4={},NATIVE_WEAK_MAP=weakMapBasicDetection,global$8=global$g,isObject$3=isObject$8,createNonEnumerableProperty$4=createNonEnumerableProperty$5,hasOwn$8=hasOwnProperty_1,shared$1=sharedStore,sharedKey$2=sharedKey$3,hiddenKeys$3=hiddenKeys$4,OBJECT_ALREADY_INITIALIZED="Object already initialized",TypeError$3=global$8.TypeError,WeakMap=global$8.WeakMap,set,get,has,enforce=function(e){return has(e)?get(e):set(e,{})},getterFor=function(e){return function(t){var r;if(!isObject$3(t)||(r=get(t)).type!==e)throw TypeError$3("Incompatible receiver, "+e+" required");return r}};if(NATIVE_WEAK_MAP||shared$1.state){var store=shared$1.state||(shared$1.state=new WeakMap);store.get=store.get,store.has=store.has,store.set=store.set,set=function(e,t){if(store.has(e))throw TypeError$3(OBJECT_ALREADY_INITIALIZED);return t.facade=e,store.set(e,t),t},get=function(e){return store.get(e)||{}},has=function(e){return store.has(e)}}else{var STATE=sharedKey$2("state");hiddenKeys$3[STATE]=!0,set=function(e,t){if(hasOwn$8(e,STATE))throw TypeError$3(OBJECT_ALREADY_INITIALIZED);return t.facade=e,createNonEnumerableProperty$4(e,STATE,t),t},get=function(e){return hasOwn$8(e,STATE)?e[STATE]:{}},has=function(e){return hasOwn$8(e,STATE)}}var internalState={set:set,get:get,has:has,enforce:enforce,getterFor:getterFor},uncurryThis$h=functionUncurryThis,fails$d=fails$k,isCallable$b=isCallable$j,hasOwn$7=hasOwnProperty_1,DESCRIPTORS$6=descriptors,CONFIGURABLE_FUNCTION_NAME$1=functionName.CONFIGURABLE,inspectSource$1=inspectSource$2,InternalStateModule$4=internalState,enforceInternalState=InternalStateModule$4.enforce,getInternalState$3=InternalStateModule$4.get,$String$2=String,defineProperty$5=Object.defineProperty,stringSlice$7=uncurryThis$h("".slice),replace$5=uncurryThis$h("".replace),join$3=uncurryThis$h([].join),CONFIGURABLE_LENGTH=DESCRIPTORS$6&&!fails$d((function(){return 8!==defineProperty$5((function(){}),"length",{value:8}).length})),TEMPLATE=String(String).split("String"),makeBuiltIn$2=makeBuiltIn$3.exports=function(e,t,r){"Symbol("===stringSlice$7($String$2(t),0,7)&&(t="["+replace$5($String$2(t),/^Symbol\(([^)]*)\)/,"$1")+"]"),r&&r.getter&&(t="get "+t),r&&r.setter&&(t="set "+t),(!hasOwn$7(e,"name")||CONFIGURABLE_FUNCTION_NAME$1&&e.name!==t)&&(DESCRIPTORS$6?defineProperty$5(e,"name",{value:t,configurable:!0}):e.name=t),CONFIGURABLE_LENGTH&&r&&hasOwn$7(r,"arity")&&e.length!==r.arity&&defineProperty$5(e,"length",{value:r.arity});try{r&&hasOwn$7(r,"constructor")&&r.constructor?DESCRIPTORS$6&&defineProperty$5(e,"prototype",{writable:!1}):e.prototype&&(e.prototype=void 0)}catch(e){}var n=enforceInternalState(e);return hasOwn$7(n,"source")||(n.source=join$3(TEMPLATE,"string"==typeof t?t:"")),e};Function.prototype.toString=makeBuiltIn$2((function(){return isCallable$b(this)&&getInternalState$3(this).source||inspectSource$1(this)}),"toString");var isCallable$a=isCallable$j,definePropertyModule$3=objectDefineProperty,makeBuiltIn$1=makeBuiltIn$3.exports,defineGlobalProperty$1=defineGlobalProperty$3,defineBuiltIn$8=function(e,t,r,n){n||(n={});var i=n.enumerable,s=void 0!==n.name?n.name:t;if(isCallable$a(r)&&makeBuiltIn$1(r,s,n),n.global)i?e[t]=r:defineGlobalProperty$1(t,r);else{try{n.unsafe?e[t]&&(i=!0):delete e[t]}catch(e){}i?e[t]=r:definePropertyModule$3.f(e,t,{value:r,enumerable:!1,configurable:!n.nonConfigurable,writable:!n.nonWritable})}return e},objectGetOwnPropertyNames={},ceil=Math.ceil,floor$4=Math.floor,mathTrunc=Math.trunc||function(e){var t=+e;return(t>0?floor$4:ceil)(t)},trunc=mathTrunc,toIntegerOrInfinity$4=function(e){var t=+e;return t!=t||0===t?0:trunc(t)},toIntegerOrInfinity$3=toIntegerOrInfinity$4,max$2=Math.max,min$3=Math.min,toAbsoluteIndex$2=function(e,t){var r=toIntegerOrInfinity$3(e);return r<0?max$2(r+t,0):min$3(r,t)},toIntegerOrInfinity$2=toIntegerOrInfinity$4,min$2=Math.min,toLength$3=function(e){return e>0?min$2(toIntegerOrInfinity$2(e),9007199254740991):0},toLength$2=toLength$3,lengthOfArrayLike$3=function(e){return toLength$2(e.length)},toIndexedObject$3=toIndexedObject$5,toAbsoluteIndex$1=toAbsoluteIndex$2,lengthOfArrayLike$2=lengthOfArrayLike$3,createMethod$1=function(e){return function(t,r,n){var i,s=toIndexedObject$3(t),a=lengthOfArrayLike$2(s),o=toAbsoluteIndex$1(n,a);if(e&&r!=r){for(;a>o;)if((i=s[o++])!=i)return!0}else for(;a>o;o++)if((e||o in s)&&s[o]===r)return e||o||0;return!e&&-1}},arrayIncludes={includes:createMethod$1(!0),indexOf:createMethod$1(!1)},uncurryThis$g=functionUncurryThis,hasOwn$6=hasOwnProperty_1,toIndexedObject$2=toIndexedObject$5,indexOf$1=arrayIncludes.indexOf,hiddenKeys$2=hiddenKeys$4,push$4=uncurryThis$g([].push),objectKeysInternal=function(e,t){var r,n=toIndexedObject$2(e),i=0,s=[];for(r in n)!hasOwn$6(hiddenKeys$2,r)&&hasOwn$6(n,r)&&push$4(s,r);for(;t.length>i;)hasOwn$6(n,r=t[i++])&&(~indexOf$1(s,r)||push$4(s,r));return s},enumBugKeys$3=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],internalObjectKeys$1=objectKeysInternal,enumBugKeys$2=enumBugKeys$3,hiddenKeys$1=enumBugKeys$2.concat("length","prototype");objectGetOwnPropertyNames.f=Object.getOwnPropertyNames||function(e){return internalObjectKeys$1(e,hiddenKeys$1)};var objectGetOwnPropertySymbols={};objectGetOwnPropertySymbols.f=Object.getOwnPropertySymbols;var getBuiltIn$2=getBuiltIn$4,uncurryThis$f=functionUncurryThis,getOwnPropertyNamesModule=objectGetOwnPropertyNames,getOwnPropertySymbolsModule$1=objectGetOwnPropertySymbols,anObject$c=anObject$e,concat$2=uncurryThis$f([].concat),ownKeys$1=getBuiltIn$2("Reflect","ownKeys")||function(e){var t=getOwnPropertyNamesModule.f(anObject$c(e)),r=getOwnPropertySymbolsModule$1.f;return r?concat$2(t,r(e)):t},hasOwn$5=hasOwnProperty_1,ownKeys=ownKeys$1,getOwnPropertyDescriptorModule=objectGetOwnPropertyDescriptor,definePropertyModule$2=objectDefineProperty,copyConstructorProperties$1=function(e,t,r){for(var n=ownKeys(t),i=definePropertyModule$2.f,s=getOwnPropertyDescriptorModule.f,a=0;a<n.length;a++){var o=n[a];hasOwn$5(e,o)||r&&hasOwn$5(r,o)||i(e,o,s(t,o))}},fails$c=fails$k,isCallable$9=isCallable$j,replacement=/#|\.prototype\./,isForced$1=function(e,t){var r=data[normalize(e)];return r==POLYFILL||r!=NATIVE&&(isCallable$9(t)?fails$c(t):!!t)},normalize=isForced$1.normalize=function(e){return String(e).replace(replacement,".").toLowerCase()},data=isForced$1.data={},NATIVE=isForced$1.NATIVE="N",POLYFILL=isForced$1.POLYFILL="P",isForced_1=isForced$1,global$7=global$g,getOwnPropertyDescriptor$2=objectGetOwnPropertyDescriptor.f,createNonEnumerableProperty$3=createNonEnumerableProperty$5,defineBuiltIn$7=defineBuiltIn$8,defineGlobalProperty=defineGlobalProperty$3,copyConstructorProperties=copyConstructorProperties$1,isForced=isForced_1,_export=function(e,t){var r,n,i,s,a,o=e.target,l=e.global,c=e.stat;if(r=l?global$7:c?global$7[o]||defineGlobalProperty(o,{}):(global$7[o]||{}).prototype)for(n in t){if(s=t[n],i=e.dontCallGetSet?(a=getOwnPropertyDescriptor$2(r,n))&&a.value:r[n],!isForced(l?n:o+(c?".":"#")+n,e.forced)&&void 0!==i){if(typeof s==typeof i)continue;copyConstructorProperties(s,i)}(e.sham||i&&i.sham)&&createNonEnumerableProperty$3(s,"sham",!0),defineBuiltIn$7(r,n,s,e)}},wellKnownSymbol$e=wellKnownSymbol$g,TO_STRING_TAG$3=wellKnownSymbol$e("toStringTag"),test={};test[TO_STRING_TAG$3]="z";var toStringTagSupport="[object z]"===String(test),TO_STRING_TAG_SUPPORT=toStringTagSupport,isCallable$8=isCallable$j,classofRaw$1=classofRaw$2,wellKnownSymbol$d=wellKnownSymbol$g,TO_STRING_TAG$2=wellKnownSymbol$d("toStringTag"),$Object$1=Object,CORRECT_ARGUMENTS="Arguments"==classofRaw$1(function(){return arguments}()),tryGet=function(e,t){try{return e[t]}catch(e){}},classof$6=TO_STRING_TAG_SUPPORT?classofRaw$1:function(e){var t,r,n;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(r=tryGet(t=$Object$1(e),TO_STRING_TAG$2))?r:CORRECT_ARGUMENTS?classofRaw$1(t):"Object"==(n=classofRaw$1(t))&&isCallable$8(t.callee)?"Arguments":n},classof$5=classof$6,$String$1=String,toString$7=function(e){if("Symbol"===classof$5(e))throw TypeError("Cannot convert a Symbol value to a string");return $String$1(e)},anObject$b=anObject$e,regexpFlags$1=function(){var e=anObject$b(this),t="";return e.hasIndices&&(t+="d"),e.global&&(t+="g"),e.ignoreCase&&(t+="i"),e.multiline&&(t+="m"),e.dotAll&&(t+="s"),e.unicode&&(t+="u"),e.unicodeSets&&(t+="v"),e.sticky&&(t+="y"),t},fails$b=fails$k,global$6=global$g,$RegExp$2=global$6.RegExp,UNSUPPORTED_Y$1=fails$b((function(){var e=$RegExp$2("a","y");return e.lastIndex=2,null!=e.exec("abcd")})),MISSED_STICKY=UNSUPPORTED_Y$1||fails$b((function(){return!$RegExp$2("a","y").sticky})),BROKEN_CARET=UNSUPPORTED_Y$1||fails$b((function(){var e=$RegExp$2("^r","gy");return e.lastIndex=2,null!=e.exec("str")})),regexpStickyHelpers={BROKEN_CARET:BROKEN_CARET,MISSED_STICKY:MISSED_STICKY,UNSUPPORTED_Y:UNSUPPORTED_Y$1},objectDefineProperties={},internalObjectKeys=objectKeysInternal,enumBugKeys$1=enumBugKeys$3,objectKeys$2=Object.keys||function(e){return internalObjectKeys(e,enumBugKeys$1)},DESCRIPTORS$5=descriptors,V8_PROTOTYPE_DEFINE_BUG=v8PrototypeDefineBug,definePropertyModule$1=objectDefineProperty,anObject$a=anObject$e,toIndexedObject$1=toIndexedObject$5,objectKeys$1=objectKeys$2;objectDefineProperties.f=DESCRIPTORS$5&&!V8_PROTOTYPE_DEFINE_BUG?Object.defineProperties:function(e,t){anObject$a(e);for(var r,n=toIndexedObject$1(t),i=objectKeys$1(t),s=i.length,a=0;s>a;)definePropertyModule$1.f(e,r=i[a++],n[r]);return e};var getBuiltIn$1=getBuiltIn$4,html$1=getBuiltIn$1("document","documentElement"),anObject$9=anObject$e,definePropertiesModule=objectDefineProperties,enumBugKeys=enumBugKeys$3,hiddenKeys=hiddenKeys$4,html=html$1,documentCreateElement$1=documentCreateElement$2,sharedKey$1=sharedKey$3,GT=">",LT="<",PROTOTYPE="prototype",SCRIPT="script",IE_PROTO$1=sharedKey$1("IE_PROTO"),EmptyConstructor=function(){},scriptTag=function(e){return LT+SCRIPT+GT+e+LT+"/"+SCRIPT+GT},NullProtoObjectViaActiveX=function(e){e.write(scriptTag("")),e.close();var t=e.parentWindow.Object;return e=null,t},NullProtoObjectViaIFrame=function(){var e,t=documentCreateElement$1("iframe"),r="java"+SCRIPT+":";return t.style.display="none",html.appendChild(t),t.src=String(r),(e=t.contentWindow.document).open(),e.write(scriptTag("document.F=Object")),e.close(),e.F},activeXDocument,NullProtoObject=function(){try{activeXDocument=new ActiveXObject("htmlfile")}catch(e){}NullProtoObject="undefined"!=typeof document?document.domain&&activeXDocument?NullProtoObjectViaActiveX(activeXDocument):NullProtoObjectViaIFrame():NullProtoObjectViaActiveX(activeXDocument);for(var e=enumBugKeys.length;e--;)delete NullProtoObject[PROTOTYPE][enumBugKeys[e]];return NullProtoObject()};hiddenKeys[IE_PROTO$1]=!0;var objectCreate=Object.create||function(e,t){var r;return null!==e?(EmptyConstructor[PROTOTYPE]=anObject$9(e),r=new EmptyConstructor,EmptyConstructor[PROTOTYPE]=null,r[IE_PROTO$1]=e):r=NullProtoObject(),void 0===t?r:definePropertiesModule.f(r,t)},fails$a=fails$k,global$5=global$g,$RegExp$1=global$5.RegExp,regexpUnsupportedDotAll=fails$a((function(){var e=$RegExp$1(".","s");return!(e.dotAll&&e.exec("\n")&&"s"===e.flags)})),fails$9=fails$k,global$4=global$g,$RegExp=global$4.RegExp,regexpUnsupportedNcg=fails$9((function(){var e=$RegExp("(?<a>b)","g");return"b"!==e.exec("b").groups.a||"bc"!=="b".replace(e,"$<a>c")})),call$b=functionCall,uncurryThis$e=functionUncurryThis,toString$6=toString$7,regexpFlags=regexpFlags$1,stickyHelpers=regexpStickyHelpers,shared=shared$4.exports,create$3=objectCreate,getInternalState$2=internalState.get,UNSUPPORTED_DOT_ALL=regexpUnsupportedDotAll,UNSUPPORTED_NCG=regexpUnsupportedNcg,nativeReplace=shared("native-string-replace",String.prototype.replace),nativeExec=RegExp.prototype.exec,patchedExec=nativeExec,charAt$6=uncurryThis$e("".charAt),indexOf=uncurryThis$e("".indexOf),replace$4=uncurryThis$e("".replace),stringSlice$6=uncurryThis$e("".slice),UPDATES_LAST_INDEX_WRONG=(re1=/a/,re2=/b*/g,call$b(nativeExec,re1,"a"),call$b(nativeExec,re2,"a"),0!==re1.lastIndex||0!==re2.lastIndex),re1,re2,UNSUPPORTED_Y=stickyHelpers.BROKEN_CARET,NPCG_INCLUDED=void 0!==/()??/.exec("")[1],PATCH=UPDATES_LAST_INDEX_WRONG||NPCG_INCLUDED||UNSUPPORTED_Y||UNSUPPORTED_DOT_ALL||UNSUPPORTED_NCG;PATCH&&(patchedExec=function(e){var t,r,n,i,s,a,o,l=this,c=getInternalState$2(l),h=toString$6(e),d=c.raw;if(d)return d.lastIndex=l.lastIndex,t=call$b(patchedExec,d,h),l.lastIndex=d.lastIndex,t;var u=c.groups,p=UNSUPPORTED_Y&&l.sticky,f=call$b(regexpFlags,l),m=l.source,g=0,y=h;if(p&&(f=replace$4(f,"y",""),-1===indexOf(f,"g")&&(f+="g"),y=stringSlice$6(h,l.lastIndex),l.lastIndex>0&&(!l.multiline||l.multiline&&"\n"!==charAt$6(h,l.lastIndex-1))&&(m="(?: "+m+")",y=" "+y,g++),r=new RegExp("^(?:"+m+")",f)),NPCG_INCLUDED&&(r=new RegExp("^"+m+"$(?!\\s)",f)),UPDATES_LAST_INDEX_WRONG&&(n=l.lastIndex),i=call$b(nativeExec,p?r:l,y),p?i?(i.input=stringSlice$6(i.input,g),i[0]=stringSlice$6(i[0],g),i.index=l.lastIndex,l.lastIndex+=i[0].length):l.lastIndex=0:UPDATES_LAST_INDEX_WRONG&&i&&(l.lastIndex=l.global?i.index+i[0].length:n),NPCG_INCLUDED&&i&&i.length>1&&call$b(nativeReplace,i[0],r,(function(){for(s=1;s<arguments.length-2;s++)void 0===arguments[s]&&(i[s]=void 0)})),i&&u)for(i.groups=a=create$3(null),s=0;s<u.length;s++)a[(o=u[s])[0]]=i[o[1]];return i});var regexpExec$2=patchedExec,$$7=_export,exec$3=regexpExec$2;$$7({target:"RegExp",proto:!0,forced:/./.exec!==exec$3},{exec:exec$3});var NATIVE_BIND$1=functionBindNative,FunctionPrototype=Function.prototype,apply$1=FunctionPrototype.apply,call$a=FunctionPrototype.call,functionApply="object"==typeof Reflect&&Reflect.apply||(NATIVE_BIND$1?call$a.bind(apply$1):function(){return call$a.apply(apply$1,arguments)}),classofRaw=classofRaw$2,uncurryThis$d=functionUncurryThis,functionUncurryThisClause=function(e){if("Function"===classofRaw(e))return uncurryThis$d(e)},uncurryThis$c=functionUncurryThisClause,defineBuiltIn$6=defineBuiltIn$8,regexpExec$1=regexpExec$2,fails$8=fails$k,wellKnownSymbol$c=wellKnownSymbol$g,createNonEnumerableProperty$2=createNonEnumerableProperty$5,SPECIES=wellKnownSymbol$c("species"),RegExpPrototype$2=RegExp.prototype,fixRegexpWellKnownSymbolLogic=function(e,t,r,n){var i=wellKnownSymbol$c(e),s=!fails$8((function(){var t={};return t[i]=function(){return 7},7!=""[e](t)})),a=s&&!fails$8((function(){var t=!1,r=/a/;return"split"===e&&((r={}).constructor={},r.constructor[SPECIES]=function(){return r},r.flags="",r[i]=/./[i]),r.exec=function(){return t=!0,null},r[i](""),!t}));if(!s||!a||r){var o=uncurryThis$c(/./[i]),l=t(i,""[e],(function(e,t,r,n,i){var a=uncurryThis$c(e),l=t.exec;return l===regexpExec$1||l===RegExpPrototype$2.exec?s&&!i?{done:!0,value:o(t,r,n)}:{done:!0,value:a(r,t,n)}:{done:!1}}));defineBuiltIn$6(String.prototype,e,l[0]),defineBuiltIn$6(RegExpPrototype$2,i,l[1])}n&&createNonEnumerableProperty$2(RegExpPrototype$2[i],"sham",!0)},uncurryThis$b=functionUncurryThis,toIntegerOrInfinity$1=toIntegerOrInfinity$4,toString$5=toString$7,requireObjectCoercible$4=requireObjectCoercible$7,charAt$5=uncurryThis$b("".charAt),charCodeAt$1=uncurryThis$b("".charCodeAt),stringSlice$5=uncurryThis$b("".slice),createMethod=function(e){return function(t,r){var n,i,s=toString$5(requireObjectCoercible$4(t)),a=toIntegerOrInfinity$1(r),o=s.length;return a<0||a>=o?e?"":void 0:(n=charCodeAt$1(s,a))<55296||n>56319||a+1===o||(i=charCodeAt$1(s,a+1))<56320||i>57343?e?charAt$5(s,a):n:e?stringSlice$5(s,a,a+2):i-56320+(n-55296<<10)+65536}},stringMultibyte={codeAt:createMethod(!1),charAt:createMethod(!0)},charAt$4=stringMultibyte.charAt,advanceStringIndex$1=function(e,t,r){return t+(r?charAt$4(e,t).length:1)},uncurryThis$a=functionUncurryThis,toObject$3=toObject$5,floor$3=Math.floor,charAt$3=uncurryThis$a("".charAt),replace$3=uncurryThis$a("".replace),stringSlice$4=uncurryThis$a("".slice),SUBSTITUTION_SYMBOLS=/\$([$&'`]|\d{1,2}|<[^>]*>)/g,SUBSTITUTION_SYMBOLS_NO_NAMED=/\$([$&'`]|\d{1,2})/g,getSubstitution$1=function(e,t,r,n,i,s){var a=r+e.length,o=n.length,l=SUBSTITUTION_SYMBOLS_NO_NAMED;return void 0!==i&&(i=toObject$3(i),l=SUBSTITUTION_SYMBOLS),replace$3(s,l,(function(s,l){var c;switch(charAt$3(l,0)){case"$":return"$";case"&":return e;case"`":return stringSlice$4(t,0,r);case"'":return stringSlice$4(t,a);case"<":c=i[stringSlice$4(l,1,-1)];break;default:var h=+l;if(0===h)return s;if(h>o){var d=floor$3(h/10);return 0===d?s:d<=o?void 0===n[d-1]?charAt$3(l,1):n[d-1]+charAt$3(l,1):s}c=n[h-1]}return void 0===c?"":c}))},call$9=functionCall,anObject$8=anObject$e,isCallable$7=isCallable$j,classof$4=classofRaw$2,regexpExec=regexpExec$2,$TypeError$5=TypeError,regexpExecAbstract=function(e,t){var r=e.exec;if(isCallable$7(r)){var n=call$9(r,e,t);return null!==n&&anObject$8(n),n}if("RegExp"===classof$4(e))return call$9(regexpExec,e,t);throw $TypeError$5("RegExp#exec called on incompatible receiver")},apply=functionApply,call$8=functionCall,uncurryThis$9=functionUncurryThis,fixRegExpWellKnownSymbolLogic$1=fixRegexpWellKnownSymbolLogic,fails$7=fails$k,anObject$7=anObject$e,isCallable$6=isCallable$j,isNullOrUndefined$2=isNullOrUndefined$5,toIntegerOrInfinity=toIntegerOrInfinity$4,toLength$1=toLength$3,toString$4=toString$7,requireObjectCoercible$3=requireObjectCoercible$7,advanceStringIndex=advanceStringIndex$1,getMethod$3=getMethod$5,getSubstitution=getSubstitution$1,regExpExec$1=regexpExecAbstract,wellKnownSymbol$b=wellKnownSymbol$g,REPLACE=wellKnownSymbol$b("replace"),max$1=Math.max,min$1=Math.min,concat$1=uncurryThis$9([].concat),push$3=uncurryThis$9([].push),stringIndexOf$1=uncurryThis$9("".indexOf),stringSlice$3=uncurryThis$9("".slice),maybeToString=function(e){return void 0===e?e:String(e)},REPLACE_KEEPS_$0="$0"==="a".replace(/./,"$0"),REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE=!!/./[REPLACE]&&""===/./[REPLACE]("a","$0"),REPLACE_SUPPORTS_NAMED_GROUPS=!fails$7((function(){var e=/./;return e.exec=function(){var e=[];return e.groups={a:"7"},e},"7"!=="".replace(e,"$<a>")}));fixRegExpWellKnownSymbolLogic$1("replace",(function(e,t,r){var n=REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE?"$":"$0";return[function(e,r){var n=requireObjectCoercible$3(this),i=isNullOrUndefined$2(e)?void 0:getMethod$3(e,REPLACE);return i?call$8(i,e,n,r):call$8(t,toString$4(n),e,r)},function(e,i){var s=anObject$7(this),a=toString$4(e);if("string"==typeof i&&-1===stringIndexOf$1(i,n)&&-1===stringIndexOf$1(i,"$<")){var o=r(t,s,a,i);if(o.done)return o.value}var l=isCallable$6(i);l||(i=toString$4(i));var c=s.global;if(c){var h=s.unicode;s.lastIndex=0}for(var d=[];;){var u=regExpExec$1(s,a);if(null===u)break;if(push$3(d,u),!c)break;""===toString$4(u[0])&&(s.lastIndex=advanceStringIndex(a,toLength$1(s.lastIndex),h))}for(var p="",f=0,m=0;m<d.length;m++){for(var g=toString$4((u=d[m])[0]),y=max$1(min$1(toIntegerOrInfinity(u.index),a.length),0),v=[],b=1;b<u.length;b++)push$3(v,maybeToString(u[b]));var S=u.groups;if(l){var E=concat$1([g],v,y,a);void 0!==S&&push$3(E,S);var C=toString$4(apply(i,void 0,E))}else C=getSubstitution(g,a,y,v,S,i);y>=f&&(p+=stringSlice$3(a,f,y)+C,f=y+g.length)}return p+stringSlice$3(a,f)}]}),!REPLACE_SUPPORTS_NAMED_GROUPS||!REPLACE_KEEPS_$0||REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE);var wellKnownSymbol$a=wellKnownSymbol$g,create$2=objectCreate,defineProperty$4=objectDefineProperty.f,UNSCOPABLES=wellKnownSymbol$a("unscopables"),ArrayPrototype$1=Array.prototype;null==ArrayPrototype$1[UNSCOPABLES]&&defineProperty$4(ArrayPrototype$1,UNSCOPABLES,{configurable:!0,value:create$2(null)});var addToUnscopables$2=function(e){ArrayPrototype$1[UNSCOPABLES][e]=!0},$$6=_export,$includes=arrayIncludes.includes,fails$6=fails$k,addToUnscopables$1=addToUnscopables$2,BROKEN_ON_SPARSE=fails$6((function(){return!Array(1).includes()}));$$6({target:"Array",proto:!0,forced:BROKEN_ON_SPARSE},{includes:function(e){return $includes(this,e,arguments.length>1?arguments[1]:void 0)}}),addToUnscopables$1("includes");var isObject$2=isObject$8,classof$3=classofRaw$2,wellKnownSymbol$9=wellKnownSymbol$g,MATCH$1=wellKnownSymbol$9("match"),isRegexp=function(e){var t;return isObject$2(e)&&(void 0!==(t=e[MATCH$1])?!!t:"RegExp"==classof$3(e))},isRegExp=isRegexp,$TypeError$4=TypeError,notARegexp=function(e){if(isRegExp(e))throw $TypeError$4("The method doesn't accept regular expressions");return e},wellKnownSymbol$8=wellKnownSymbol$g,MATCH=wellKnownSymbol$8("match"),correctIsRegexpLogic=function(e){var t=/./;try{"/./"[e](t)}catch(r){try{return t[MATCH]=!1,"/./"[e](t)}catch(e){}}return!1},$$5=_export,uncurryThis$8=functionUncurryThis,notARegExp$1=notARegexp,requireObjectCoercible$2=requireObjectCoercible$7,toString$3=toString$7,correctIsRegExpLogic$1=correctIsRegexpLogic,stringIndexOf=uncurryThis$8("".indexOf);function __setFunctionName(e,t,r){return"symbol"==typeof t&&(t=t.description?"[".concat(t.description,"]"):""),Object.defineProperty(e,"name",{configurable:!0,value:r?"".concat(r," ",t):t})}$$5({target:"String",proto:!0,forced:!correctIsRegExpLogic$1("includes")},{includes:function(e){return!!~stringIndexOf(toString$3(requireObjectCoercible$2(this)),toString$3(notARegExp$1(e)),arguments.length>1?arguments[1]:void 0)}});const ArcwareStyles={customStyles:{":root":{"--color0":"#18181A !important","--color1":"#000000","--color2":"#FFFFFF","--color3":"#DAF693 !important","--color4":"#35b350","--color5":"#ffab00","--color6":"#858588 !important","--color7":"#B5B5B7 !important","--color8":"#41008c","--color9":"#3e0070","--color10":"#2e0052","--color11":"rgba(65,0,139,1) !important","--color12":"#222224 !important","--color13":"#f0f0f2 !important","--colorBoxShadow":"rgba(0, 0, 0, 0.20) !important"},"*":{fontFamily:"system-ui"},"::-webkit-scrollbar":{width:"10px"},"::-webkit-scrollbar-track":{background:"var(--color13)",opacity:"0.5",borderRadius:"30px",borderTop:"20px solid var(--color0)",borderRight:"5px solid var(--color0)",borderBottom:"20px solid var(--color0)",borderLeft:"5px solid var(--color0)"},"::-webkit-scrollbar-track-piece":{background:"transparent"},"::-webkit-scrollbar-thumb":{background:"var(--color13)",width:"8px",borderRight:"2px solid var(--color0)",borderLeft:"2px solid var(--color0)",transition:"all ease-in-out 0.3s",borderRadius:"7px"},"::-webkit-scrollbar-thumb:hover":{transition:"all ease-in-out 0.3s",background:"var(--color3)"},"#playerUI, #videoElementParent":{position:"absolute",width:"100%",height:"100%",top:0,right:0,bottom:0,left:0,margin:"auto"},"#uiFeatures #controls":{top:"auto",left:"auto",bottom:"10px",right:"20px",display:"flex",flexDirection:"column-reverse"},"#uiFeatures #connection":{bottom:"5px",left:"10px",width:"2.5rem",heihgt:"2.5rem"},"#uiFeatures button":{backgroundColor:"var(--color12)",border:"none",position:"relative",width:"45px",height:"45px",padding:"0.5rem",textAlign:"center",cursor:"pointer",display:"flex",flexDirection:"row",justifyContent:"center",alignItems:"center",boxShadow:"0px 0px 24px 0px var(--colorBoxShadow)",borderRadius:"3px",outline:"none"},"#uiFeatures button:hover, #uiFeatures button:active":{padding:"0 !important",border:"none"},"#uiFeatures button #audioIconMuted, #uiFeatures button #audioIconUnmuted, #uiFeatures button #micIconMuted, #uiFeatures button #micIconUnmuted":{width:"31px",height:"28px"},"#uiFeatures button #maximizeIcon, #uiFeatures button #minimizeIcon":{width:"25px",height:"25px"},"#uiFeatures button .tooltiptext":{right:"125%",left:"auto",boxShadow:"0px 0px 24px 0px var(--colorBoxShadow)",borderRadius:"3px",backgroundColor:"var(--color12)",width:"95px"},"#controls>*":{marginBottom:"0.5rem",display:"block",lineHeight:"1.75rem",padding:"0.5rem",backgroundColor:"var(--color12)"},".svgIcon":{fill:"var(--color13)"},"#uiFeatures button:hover .svgIcon, #uiFeatures button:active .svgIcon":{fill:"var(--color12)"},".tgl-switch .tgl-slider, .tgl-flat:checked+.tgl-slider":{border:"3px solid transparent"},".tgl-switch .tgl-slider":{background:"none"},".tgl-switch .tgl-slider::before":{content:"''",display:"block",background:"var(--color6)",position:"absolute",height:"50%",width:"90%",borderRadius:"5px",margin:"auto",top:"0",bottom:"0",left:"0",right:"0"},".tgl-switch .tgl-slider::after":{height:"13px",width:"13px",borderRadius:"50%",top:"-2px",left:"-1%"},".tgl-flat:checked+.tgl-slider:after":{left:"62%",background:"var(--color3)"},".form-control":{backgroundColor:"transparent",border:"1px solid var(--color13)",borderRadius:"2px",color:"var(--color13)",textAlign:"left",fontFamily:"inherit",padding:"5px 15px "},".btn-flat":{background:"var(--color3)",color:"var(--color12)",border:"none",padding:"7px 50px",cursor:"pointer",borderRadius:"4px",textTransform:"uppercase",minWidth:"175px"},".btn-flat:disabled":{background:"var(--color7)",borderColor:"var(--color3)",color:"var(--color3)",cursor:"default"},".btn-flat:focus":{outline:"none"},".arcware-logo-loader":{position:"relative",display:"block",width:"12.5%",height:"12.5%"},"#playOverlay img#playButton":{width:"5%"},"#disconnectOverlay, #errorOverlay":{textTransform:"initial",textAlign:"center",fontSize:"20px",lineHeight:2.5},"#disconnectOverlay .clickableState":{textTransform:"initial",textAlign:"center",color:"#DAF693",padding:"5px",fontSize:"18px",border:"1px solid #DAF693",margin:"25px auto 0",width:"180px"},"#afkOverlay":{background:"none",transition:"all ease-in-out 0.5s",opacity:1,pointerEvents:"initial"},"#afkOverlayInner":{textTransform:"initial",background:"#18181A",padding:"20px 10px 30px",fontSize:"18px",width:"360px",textAlign:"center",lineHeight:2.5},"#afkOverlayInner center::first-line":{textTransform:"uppercase",color:"#FF8461",fontWeight:"bold",fontSize:"24px"},"#afkOverlayInner #afkCountDownNumber":{color:"#DAF693",fontSize:"26px",lineHeight:"22px"},"#afkOverlayInner center .retry-button":{textTransform:"initial",textAlign:"center",color:"#DAF693",padding:"5px",fontSize:"18px",border:"1px solid #DAF693",margin:"25px auto 0",width:"180px"},"#infoOverlay.hiddenState":{display:"none"},"#disconnectOverlay, #playOverlay, #errorOverlay, #microphoneOverlay":{background:"#18181A",display:"flex",transition:"all ease-in-out 0.5s",opacity:1,pointerEvents:"initial"},"#microphoneOverlay":{textTransform:"initial",padding:"20px 30px",fontSize:"14px",height:"230px",width:"360px",textAlign:"center",lineHeight:1.25,position:"absolute",margin:"auto",top:"0",bottom:"0",left:"0",right:"0",justifyContent:"center",alignItems:"center",flexDirection:"column",zIndex:99999},"#microphoneOverlay .title":{fontSize:"24px",position:"relative",marginBottom:"20px",color:"#F0F0F2"},"#microphoneOverlay .title:after":{content:"''",display:"inline-block",animation:"dotty steps(1,end) 1s infinite",position:"absolute"},"#microphoneOverlay p":{margin:0,color:"#858588"},"#microphoneOverlay svg":{height:"65px",marginBottom:"15px",marginTop:"-5px"},"#microphoneOverlay .svgIcon":{fill:"#DAF693"},"#disconnectOverlay.hiddenState, #playOverlay.hiddenState, #errorOverlay.hiddenState, #afkOverlay.hiddenState, #microphoneOverlay.hiddenState":{opacity:0,pointerEvents:"none"},"#disconnectOverlay.mic-overlay-is-visible, #errorOverlay.mic-overlay-is-visible, #infoOverlay.mic-overlay-is-visible":{opacity:0,pointerEvents:"none"},"#infoOverlay.hiddenState, #connectOverlay.hiddenState":{display:"none"},"#infoOverlay":{display:"none"},".love-letters-box-root":{display:"flex",position:"absolute",width:"100%",height:"100%",color:"#ffffff",justifyContent:"center",alignItems:"center",flexDirection:"column",background:"#18181A",zIndex:1},".love-letters-box-root.fade-out":{opacity:0,transition:"opacity 0.5s"},"#letters-block":{position:"absolute",top:0,left:0,right:0,bottom:0,margin:"auto",color:"#ffffff",zIndex:4,display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",fontSize:"16px",textTransform:"initial",textAlign:"center"},"#letters-block p":{textAlign:"center",lineHeight:1.4,margin:"0 auto",fontSize:"16px"},".letter-animation:nth-last-of-type(1)::after":{display:"inline-block",animation:"dotty steps(1,end) 1s infinite",content:"''",position:"absolute"},".letter-animation":{transition:"all 0.5s ease-in-out",transformOrigin:"center"},".letter-animation-enter":{animation:"fadeInUp 0.75s ease-out"},".letter-animation-exit":{opacity:0,scale:.9,transition:"all ease-in-out 1s"},"@keyframes dotty":{"0%":{content:"''"},"25%":{content:"'.'"},"50%":{content:"'..'"},"75%":{content:"'...'"},"100%":{content:"''"}},"@keyframes fadeInUp":{from:{opacity:0,transform:" translateY(5px)",scale:.9},to:{opacity:1,transform:"translateY(0)",scale:1}},".hidden":{display:"none",opacity:0},".visible":{display:"block",opacity:1,transition:"opacity 1s ease-out"}}};class AudioIcon{constructor(){this.audioIconUnmuted=this.createAudioIconUnmuted(),this.audioIconMuted=this.createAudioIconMuted()}createAudioIconUnmuted(){const e=document.createElementNS("http://www.w3.org/2000/svg","svg");e.setAttributeNS(null,"id","audioIconUnmuted"),e.setAttributeNS(null,"x","31px"),e.setAttributeNS(null,"y","28px"),e.setAttributeNS(null,"viewBox","0 0 31 28");const t=document.createElementNS("http://www.w3.org/2000/svg","g");t.classList.add("svgIcon"),e.appendChild(t);const r=document.createElementNS("http://www.w3.org/2000/svg","path");r.setAttributeNS(null,"d","M21.0008,0.0720318C20.556,-0.117811,20.0379,0.0805569,19.8435,0.514827C19.6492,0.949098,19.8522,1.45512,20.297,1.6449C25.1233,3.70434,28.242,8.35761,28.2422,13.4998C28.2422,18.6423,25.1234,23.2957,20.2966,25.3551C19.8518,25.5448,19.6488,26.0508,19.8431,26.4852C19.9874,26.8077,20.3102,27,20.649,27C20.7664,27,20.8859,26.9769,21.0004,26.928C26.4674,24.5954,30,19.3246,30,13.4997C29.9998,7.67531,26.4674,2.40462,21.0008,0.0720318Z");const n=document.createElementNS("http://www.w3.org/2000/svg","path");n.setAttributeNS(null,"d","M21.2351,6.69434C20.8735,6.37822,20.3179,6.4082,19.9941,6.76134C19.6703,7.11454,19.701,7.65706,20.0627,7.97324C21.6712,9.37932,22.5937,11.3937,22.5937,13.5C22.5937,15.6062,21.6711,17.6206,20.0627,19.0267C19.701,19.3428,19.6703,19.8854,19.9941,20.2386C20.1677,20.4279,20.4079,20.5244,20.6492,20.5244C20.8579,20.5244,21.0674,20.4522,21.2351,20.3056C23.2157,18.5744,24.3515,16.0937,24.3515,13.4999C24.3515,10.9061,23.2156,8.42553,21.2351,6.69434Z");const i=document.createElementNS("http://www.w3.org/2000/svg","path");return i.setAttributeNS(null,"d","M15.3973,2.16277C15.1018,2.01658,14.7473,2.04502,14.4803,2.23623L7.65176,7.12598H0.878906C0.393516,7.12598,0,7.51024,0,7.98422V19.0155C0,19.4895,0.393516,19.8738,0.878906,19.8738H7.6517L14.4802,24.7637C14.6339,24.8737,14.8164,24.9298,15.0001,24.9298C15.1356,24.9298,15.2718,24.8992,15.3973,24.8371C15.6927,24.6909,15.8789,24.395,15.8789,24.0716V2.9282C15.8789,2.60482,15.6927,2.30884,15.3973,2.16277ZM14.121,22.3778L8.45918,18.3234C8.30842,18.2154,8.12637,18.1572,7.93939,18.1572H1.75781V8.84246H7.93939C8.12631,8.84246,8.30842,8.78422,8.45912,8.67636L14.121,4.62197V22.3778Z"),t.appendChild(r),t.appendChild(n),t.appendChild(i),e}createAudioIconMuted(){const e=document.createElementNS("http://www.w3.org/2000/svg","svg");e.setAttributeNS(null,"id","audioIconMuted"),e.setAttributeNS(null,"x","31px"),e.setAttributeNS(null,"y","28px"),e.setAttributeNS(null,"viewBox","0 -1 31 28");const t=document.createElementNS("http://www.w3.org/2000/svg","g");t.classList.add("svgIcon"),e.appendChild(t);const r=document.createElementNS("http://www.w3.org/2000/svg","path");r.setAttributeNS(null,"d","M16.3501,0.829286C16.046,0.678799,15.6811,0.708072,15.4062,0.904912L8.37681,5.93848H1.40476C0.90509,5.93848,0.5,6.33404,0.5,6.82196V18.1777C0.5,18.6657,0.90509,19.0612,1.40476,19.0612H8.37675L15.4061,24.0949C15.5643,24.2082,15.7522,24.2659,15.9412,24.2659C16.0808,24.2659,16.221,24.2344,16.3501,24.1705C16.6542,24.02,16.8459,23.7154,16.8459,23.3825V1.61724C16.8459,1.28434,16.6542,0.979655,16.3501,0.829286ZM15.0364,21.6389L9.20798,17.4652C9.05278,17.3541,8.86538,17.2942,8.6729,17.2942H2.30951V7.70544H8.6729C8.86532,7.70544,9.05278,7.64548,9.20792,7.53446L15.0364,3.36082V21.6389Z");const n=document.createElementNS("http://www.w3.org/2000/svg","path");return n.setAttributeNS(null,"d","M25.2799,11.7634L21.8442,8.32748C21.6206,8.10399,21.6206,7.74264,21.8442,7.51915C22.0676,7.29566,22.429,7.29566,22.6525,7.51915L26.0883,10.955L29.524,7.51915C29.7476,7.29566,30.1088,7.29566,30.3323,7.51915C30.5559,7.74264,30.5559,8.10399,30.3323,8.32748L26.8966,11.7634L30.3323,15.1992C30.5559,15.4227,30.5559,15.7841,30.3323,16.0076C30.2209,16.1191,30.0745,16.1751,29.9281,16.1751C29.7818,16.1751,29.6355,16.1191,29.524,16.0076L26.0883,12.5717L22.6525,16.0076C22.541,16.1191,22.3947,16.1751,22.2483,16.1751C22.102,16.1751,21.9556,16.1191,21.8442,16.0076C21.6206,15.7841,21.6206,15.4227,21.8442,15.1992L25.2799,11.7634Z"),t.appendChild(r),t.appendChild(n),e}}class AudioButton{constructor(e){this.stream=e,this.setAudioMutedByDefault(),this.button=this.createButton(),this.audioIcon=new AudioIcon,this.tooltipText=this.createTooltipText(),this.button.appendChild(this.tooltipText),this.button.appendChild(this.audioIcon.audioIconMuted),this.button.appendChild(this.audioIcon.audioIconUnmuted),this.audioIcon.audioIconUnmuted.style.display="none",this.button.addEventListener("click",this.toggleAudio.bind(this)),this.onVolumeChange=this.onVolumeChange.bind(this);this.stream.webRtcController.videoPlayer.videoElement.addEventListener("volumechange",this.onVolumeChange.bind(this))}setAudioMutedByDefault(){const e=this.stream.videoElementParent;if(e){const t=e.querySelector("video");t&&this.stream.toggleAudio(t,!0)}}createButton(){const e=document.createElement("button");return e.setAttribute("id","audioBtn"),e.setAttribute("type","button"),e.classList.add("UiTool"),e}createTooltipText(){const e=document.createElement("span");return e.classList.add("tooltiptext"),e.innerHTML="Mute/Unmute",e}toggleAudio(){const e=this.stream.videoElementParent;if(e){const t=e.querySelector("video");if(t){const e=!t.muted;this.stream.toggleAudio(t,e),this.updateAudioIcon(e)}}}updateAudioIcon(e){e?(this.audioIcon.audioIconUnmuted.style.display="none",this.audioIcon.audioIconMuted.style.display="block"):(this.audioIcon.audioIconMuted.style.display="none",this.audioIcon.audioIconUnmuted.style.display="block")}get element(){return this.button}onVolumeChange(e){const t=e.target;this.updateAudioIcon(t.muted)}}class MicIcon{constructor(){this.micIconUnmuted=this.createMicIconUnmuted(),this.micIconMuted=this.createMicIconMuted()}createMicIconUnmuted(){const e=document.createElementNS("http://www.w3.org/2000/svg","svg");e.setAttributeNS(null,"id","micIconUnmuted"),e.setAttributeNS(null,"x","24px"),e.setAttributeNS(null,"y","24px"),e.setAttributeNS(null,"viewBox","0 -1 24 24");const t=document.createElementNS("http://www.w3.org/2000/svg","g");t.classList.add("svgIcon"),e.appendChild(t);const r=document.createElementNS("http://www.w3.org/2000/svg","path");return r.setAttributeNS(null,"d","M12 14c1.66,0,2.99-1.34,2.99-3L15,5c0-1.66-1.34-3-3-3S9,3.34,9,5v6c0,1.66,1.34,3,3,3zm5.3-3c0,3-2.54,5.1-5.3,5.1S6.7,14,6.7,11H5c0,3.41,2.72,6.23,6,6.72V21h2v-3.28c3.28-.48,6-3.3,6-6.72h-1.7z"),t.appendChild(r),e}createMicIconMuted(){const e=document.createElementNS("http://www.w3.org/2000/svg","svg");e.setAttributeNS(null,"id","micIconMuted"),e.setAttributeNS(null,"x","24px"),e.setAttributeNS(null,"y","24px"),e.setAttributeNS(null,"viewBox","0 -1 24 24");const t=document.createElementNS("http://www.w3.org/2000/svg","g");t.classList.add("svgIcon"),e.appendChild(t);const r=document.createElementNS("http://www.w3.org/2000/svg","path");return r.setAttributeNS(null,"d","M19,11h-1.7c0,.74-.16,1.43-.43,2.05l1.23,1.23c.56-.98.9-2.09.9-3.28zm-4.02.17c0-.06.02-.11.02-.17V5c0-1.66-1.34-3-3-3S9,3.34,9,5v.18l5.98,5.99zM4.27,3,3,4.27l6.01,6.01V11c0,1.66,1.33,3,2.99,3,.22,0,.44-.03.65-.08l1.66,1.66c-.71.33-1.5.52-2.31.52-2.76,0-5.3-2.1-5.3-5.1H5c0,3.41,2.72,6.23,6,6.72V21h2v-3.28c.91-.13,1.77-.45,2.54-.9L19.73,21,21,19.73,4.27,3z"),t.appendChild(r),e}}class MicButton{constructor(e){this.stream=e,this.setMicMutedByDefault(),this.button=this.createButton(),this.micIcon=new MicIcon,this.tooltipText=this.createTooltipText(),this.button.appendChild(this.tooltipText),this.button.appendChild(this.micIcon.micIconMuted),this.button.appendChild(this.micIcon.micIconUnmuted),this.micIcon.micIconUnmuted.style.display="none",this.button.addEventListener("click",this.toggleMic.bind(this))}setMicMutedByDefault(){const e=this.stream.videoElementParent;if(e){e.querySelector("video")&&this.stream.toggleMic(!1,!0)}}createButton(){const e=document.createElement("button");return e.setAttribute("id","micBtn"),e.setAttribute("type","button"),e.classList.add("UiTool"),e}createTooltipText(){const e=document.createElement("span");return e.classList.add("tooltiptext"),e.innerHTML="Mic on/off",e}toggleMic(){var e,t;const r=null===(t=null===(e=null==this?void 0:this.stream)||void 0===e?void 0:e.config)||void 0===t?void 0:t.isFlagEnabled(Ot.UseMic);this.stream.toggleMic(!r,!1),this.updateMicIcon(!r)}updateMicIcon(e){e?(this.micIcon.micIconMuted.style.display="none",this.micIcon.micIconUnmuted.style.display="block"):(this.micIcon.micIconUnmuted.style.display="none",this.micIcon.micIconMuted.style.display="block")}get element(){return this.button}}class StopIcon{constructor(){this.stopIcon=this.createStopIcon()}createStopIcon(){const e=document.createElementNS("http://www.w3.org/2000/svg","svg");e.setAttributeNS(null,"id","stopIcon"),e.setAttributeNS(null,"x","24px"),e.setAttributeNS(null,"y","24px"),e.setAttributeNS(null,"viewBox","0 0 24 24");const t=document.createElementNS("http://www.w3.org/2000/svg","g");t.classList.add("svgIcon"),e.appendChild(t);const r=document.createElementNS("http://www.w3.org/2000/svg","path");return r.setAttributeNS(null,"d","M6 6h12v12H6z"),t.appendChild(r),e}}class StopButton{constructor(e){this.stream=e,this.button=this.createButton(),this.stopIcon=new StopIcon,this.tooltipText=this.createTooltipText(),this.button.appendChild(this.tooltipText),this.button.appendChild(this.stopIcon.stopIcon),this.button.addEventListener("click",this.stop.bind(this))}createButton(){const e=document.createElement("button");return e.setAttribute("id","stopBtn"),e.setAttribute("type","button"),e.classList.add("UiTool"),e}createTooltipText(){const e=document.createElement("span");return e.classList.add("tooltiptext"),e.innerHTML="Stop",e}stop(){var e;null===(e=null==this?void 0:this.stream)||void 0===e||e.disconnect()}get element(){return this.button}}var _a;const TextKeyRegex=/^(\['([a-zA-Z 0-9-_]+)'\] )/;function findElementByTextContent(e,t){const r=TextKeyRegex.exec(t);if(!r)return null;const n=t.replace(r[1],""),i=r[2],s=(e||document).querySelectorAll(n);let a=null;return s.forEach((e=>{var t;!a&&(null===(t=null==e?void 0:e.textContent)||void 0===t?void 0:t.includes(i))&&(a=e)})),a}const removals={"#StreamerId":!0,"#ss":!0,"#TimeoutIfIdle":!0,"#OfferToReceive":!0,"#preferSFU":!0,"#ForceTURN":!0,"#LightMode":!0,"['AFK timeout'] div.setting.form-group:not([id])":!0,"['Encoder'] section.settingsContainer:not([id])":!0,"['WebRTC'] section.settingsContainer:not([id])":!0};function remove(e,t){!0===removals[e]&&t&&(t.style.display="none")}class ArcwareApplication extends G{get rootElement(){return super.rootElement}constructor(e){var t,r,n,i,s,a,o,l,c,h,d,u;super(e),this.responseCallback=null,this.ArcwareSection=this.configUI.buildSectionWithHeading(this.settingsPanel.settingsContentElement,"Arcware CloudRT"),this.stream=null==e?void 0:e.stream,this.emitUIInteraction=this.emitUIInteraction.bind(this),this.adjustSettingsPanel(),this.createAudioToggleButton(),this.createMicToggleButton(),this.createStopButton(),this.applyArcwareStyles(),this.videoElementParent=null===(t=null==this?void 0:this.stream)||void 0===t?void 0:t.videoElementParent,this.parentElement=null===(r=null==this?void 0:this.videoElementParent)||void 0===r?void 0:r.parentElement,this.webRtcController=null===(n=null==this?void 0:this.stream)||void 0===n?void 0:n._webRtcController,null===(s=null===(i=null==this?void 0:this.stream)||void 0===i?void 0:i.loveLetterHandler)||void 0===s||s.add((e=>{var t,r,n;if((null==this?void 0:this.playOverlay)&&e&&(null==this?void 0:this.parentElement)){const i=null===(t=null==this?void 0:this.parentElement)||void 0===t?void 0:t.querySelector("#infoOverlay");if(i){null===(r=null==i?void 0:i.classList)||void 0===r||r.remove("hiddenState");const t=null==i?void 0:i.querySelector("#messageOverlayInner");t&&(t.innerHTML=null===(n=null==e?void 0:e.reason)||void 0===n?void 0:n.replace("LL: ",""))}}})),null===(a=null==this?void 0:this.stream)||void 0===a||a.addResponseEventListener("ue-response",(e=>null==this?void 0:this.applicationResponse(e))),null===(l=null===(o=null==this?void 0:this.stream)||void 0===o?void 0:o.sessionIdHandler)||void 0===l||l.add((e=>{var t;null===(t=null==this?void 0:this.statsPanel)||void 0===t||t.addOrUpdateStat("sessionId","SessionId",e)})),null===(h=null===(c=null==this?void 0:this.stream)||void 0===c?void 0:c.videoInitializedHandler)||void 0===h||h.add((()=>{var e,t,r;null===(e=null==this?void 0:this.currentOverlay)||void 0===e||e.hide(),(null===(t=null==this?void 0:this.stream)||void 0===t?void 0:t.streamInfo)&&(null==this||this.autoPlayHandler(null===(r=null==this?void 0:this.stream)||void 0===r?void 0:r.streamInfo))}));null===(u=null===(d=null==this?void 0:this.stream)||void 0===d?void 0:d.videoInitializedHandler)||void 0===u||u.add((()=>{null==this||this.uiDefaultButtonVisibilty("fullscreenButton","#fullscreen-btn"),null==this||this.uiDefaultButtonVisibilty("settingsButton","#settingsBtn"),null==this||this.uiDefaultButtonVisibilty("infoButton","#statsBtn"),null==this||this.uiDefaultButtonVisibilty("audioButton","#audioBtn"),null==this||this.uiDefaultButtonVisibilty("stopButton","#stopBtn"),null==this||this.uiDefaultButtonVisibilty("connectionStrengthIcon","#connection"),null==this||this.uiDefaultButtonVisibilty("micButton","#micBtn"),this.uiElementsVisibility(!0)}).bind(this)),this.uiElementsVisibility(!1)}uiElementsVisibility(e){var t,r;const n=null===(t=null==this?void 0:this.parentElement)||void 0===t?void 0:t.querySelector("#controls");n&&(e?(n.classList.remove("hidden"),n.classList.add("visible")):(n.classList.remove("visible"),n.classList.add("hidden")));const i=null===(r=null==this?void 0:this.parentElement)||void 0===r?void 0:r.querySelector("#connection");i&&(e?(i.classList.remove("hidden"),i.classList.add("visible")):(i.classList.remove("visible"),i.classList.add("hidden")))}adjustSettingsPanel(){var e,t,r,n,i,s,a,o,l,c,h,d;const u=null===(e=null==this?void 0:this.ArcwareSection)||void 0===e?void 0:e.parentElement;u&&(null==u||u.removeChild(null==this?void 0:this.ArcwareSection),null==u||u.insertBefore(null==this?void 0:this.ArcwareSection,null==u?void 0:u.firstChild));const p=this.settingsPanel.settingsContentElement;if(p){p.style.minWidth="400px";for(const e in removals)if(TextKeyRegex.test(e)){remove(e,findElementByTextContent(p,e))}else{remove(e,p.querySelector(e))}const e=findElementByTextContent(p,"['Restart Stream'] section > div.setting");if(e){const t=e.querySelector("div");t&&(t.textContent="Reconnect to Stream");const r=e.querySelector("label > input");r&&(r.value="reconnect")}}{const e=document.createElement("div");e.classList.add("setting"),e.textContent="Keep in mind, these settings will be applied in your current session only.",e.style.paddingBottom="15px",null===(t=null==this?void 0:this.ArcwareSection)||void 0===t||t.appendChild(e)}null===(r=null==this?void 0:this.ArcwareSection)||void 0===r||r.appendChild(new ot(new ts(null===(n=null==ArcwareApplication?void 0:ArcwareApplication.Flags)||void 0===n?void 0:n.noSession,"Disable SessionId","Disable sessionId based reconnection.",null===(s=null===(i=null==this?void 0:this.stream)||void 0===i?void 0:i.session)||void 0===s?void 0:s.noSession,!0)).rootElement),null===(a=null==this?void 0:this.ArcwareSection)||void 0===a||a.appendChild(new rt(new rs("signalling-url","Signalling URL","Signalling URL",`${null===(l=null===(o=null==this?void 0:this.stream)||void 0===o?void 0:o.config)||void 0===l?void 0:l.getTextSettingValue("ss")}?${null===(d=null===(h=null===(c=null==this?void 0:this.stream)||void 0===c?void 0:c.config)||void 0===h?void 0:h.urlFlags)||void 0===d?void 0:d.slice(1)}`,!1)).rootElement)}createAudioToggleButton(){var e;const t=new AudioButton(null==this?void 0:this.stream),r=(null===(e=null==this?void 0:this.stream)||void 0===e?void 0:e.videoElementParent).parentElement;if(r){const e=null==r?void 0:r.querySelector("#uiFeatures");if(e){const r=null==e?void 0:e.querySelector("#controls");r&&(null==r||r.appendChild(null==t?void 0:t.element))}}}createMicToggleButton(){var e;const t=new MicButton(null==this?void 0:this.stream),r=(null===(e=null==this?void 0:this.stream)||void 0===e?void 0:e.videoElementParent).parentElement;if(r){const e=null==r?void 0:r.querySelector("#uiFeatures");if(e){const r=null==e?void 0:e.querySelector("#controls");r&&(null==r||r.appendChild(null==t?void 0:t.element))}}}createStopButton(){var e,t,r,n;if(!0===(null===(r=null===(t=null===(e=this.stream)||void 0===e?void 0:e.config)||void 0===t?void 0:t.settings)||void 0===r?void 0:r.stopButton)){const e=new StopButton(null==this?void 0:this.stream),t=(null===(n=null==this?void 0:this.stream)||void 0===n?void 0:n.videoElementParent).parentElement;if(t){const r=null==t?void 0:t.querySelector("#uiFeatures");if(r){const t=null==r?void 0:r.querySelector("#controls");t&&(null==t||t.appendChild(null==e?void 0:e.element))}}}}uiDefaultButtonVisibilty(e,t){var r,n,i;if(null==this?void 0:this.parentElement){const s=null===(r=null==this?void 0:this.parentElement)||void 0===r?void 0:r.querySelector(t);!1===(null===(i=null===(n=null==this?void 0:this.stream)||void 0===n?void 0:n.config)||void 0===i?void 0:i.settings[e])&&s&&(null==s||s.remove());const a=/iPad|iPhone|iPod/.test(null===navigator||void 0===navigator?void 0:navigator.userAgent);"fullscreenButton"===e&&a&&s&&(null==s||s.remove())}}autoPlayHandler(e){var t;const{videoPlayer:r}=null==this?void 0:this.webRtcController,n=null===(t=null==e?void 0:e.streamInfo)||void 0===t?void 0:t.autoPlay,i=null==r?void 0:r.isPaused();if(n&&i&&r){const e=null==r?void 0:r.getVideoElement();if(e){const t=null==e?void 0:e.parentElement;if(t){const e=null==t?void 0:t.querySelector("#playOverlay");e&&(null==e||e.remove())}null==e||e.play()}}}getApplicationResponse(e){var t;null===(t=null==this?void 0:this.stream)||void 0===t||t.addResponseEventListener("ue-response",(t=>{e(t)}))}applicationResponse(e){(null==this?void 0:this.responseCallback)&&(null==this||this.responseCallback(e))}applyArcwareStyles(){const e=new st(ArcwareStyles);null==e||e.applyStyleSheet()}emitUIInteraction(e){var t;e&&(null===(t=null==this?void 0:this.webRtcController)||void 0===t||t.emitUIInteraction(e))}}ArcwareApplication.Flags=(_a=class{},__setFunctionName(_a,"Flags"),_a.noSession="noSession",_a);var $$4=_export,uncurryThis$7=functionUncurryThisClause,getOwnPropertyDescriptor$1=objectGetOwnPropertyDescriptor.f,toLength=toLength$3,toString$2=toString$7,notARegExp=notARegexp,requireObjectCoercible$1=requireObjectCoercible$7,correctIsRegExpLogic=correctIsRegexpLogic,nativeStartsWith=uncurryThis$7("".startsWith),stringSlice$2=uncurryThis$7("".slice),min=Math.min,CORRECT_IS_REGEXP_LOGIC=correctIsRegExpLogic("startsWith"),MDN_POLYFILL_BUG=!(CORRECT_IS_REGEXP_LOGIC||(descriptor=getOwnPropertyDescriptor$1(String.prototype,"startsWith"),!descriptor||descriptor.writable)),descriptor;$$4({target:"String",proto:!0,forced:!MDN_POLYFILL_BUG&&!CORRECT_IS_REGEXP_LOGIC},{startsWith:function(e){var t=toString$2(requireObjectCoercible$1(this));notARegExp(e);var r=toLength(min(arguments.length>1?arguments[1]:void 0,t.length)),n=toString$2(e);return nativeStartsWith?nativeStartsWith(t,n,r):stringSlice$2(t,r,r+n.length)===n}});var iterators={},fails$5=fails$k,correctPrototypeGetter=!fails$5((function(){function e(){}return e.prototype.constructor=null,Object.getPrototypeOf(new e)!==e.prototype})),hasOwn$4=hasOwnProperty_1,isCallable$5=isCallable$j,toObject$2=toObject$5,sharedKey=sharedKey$3,CORRECT_PROTOTYPE_GETTER=correctPrototypeGetter,IE_PROTO=sharedKey("IE_PROTO"),$Object=Object,ObjectPrototype=$Object.prototype,objectGetPrototypeOf=CORRECT_PROTOTYPE_GETTER?$Object.getPrototypeOf:function(e){var t=toObject$2(e);if(hasOwn$4(t,IE_PROTO))return t[IE_PROTO];var r=t.constructor;return isCallable$5(r)&&t instanceof r?r.prototype:t instanceof $Object?ObjectPrototype:null},fails$4=fails$k,isCallable$4=isCallable$j,isObject$1=isObject$8,getPrototypeOf$1=objectGetPrototypeOf,defineBuiltIn$5=defineBuiltIn$8,wellKnownSymbol$7=wellKnownSymbol$g,ITERATOR$6=wellKnownSymbol$7("iterator"),BUGGY_SAFARI_ITERATORS$1=!1,IteratorPrototype$2,PrototypeOfArrayIteratorPrototype,arrayIterator;[].keys&&(arrayIterator=[].keys(),"next"in arrayIterator?(PrototypeOfArrayIteratorPrototype=getPrototypeOf$1(getPrototypeOf$1(arrayIterator)),PrototypeOfArrayIteratorPrototype!==Object.prototype&&(IteratorPrototype$2=PrototypeOfArrayIteratorPrototype)):BUGGY_SAFARI_ITERATORS$1=!0);var NEW_ITERATOR_PROTOTYPE=!isObject$1(IteratorPrototype$2)||fails$4((function(){var e={};return IteratorPrototype$2[ITERATOR$6].call(e)!==e}));NEW_ITERATOR_PROTOTYPE&&(IteratorPrototype$2={}),isCallable$4(IteratorPrototype$2[ITERATOR$6])||defineBuiltIn$5(IteratorPrototype$2,ITERATOR$6,(function(){return this}));var iteratorsCore={IteratorPrototype:IteratorPrototype$2,BUGGY_SAFARI_ITERATORS:BUGGY_SAFARI_ITERATORS$1},defineProperty$3=objectDefineProperty.f,hasOwn$3=hasOwnProperty_1,wellKnownSymbol$6=wellKnownSymbol$g,TO_STRING_TAG$1=wellKnownSymbol$6("toStringTag"),setToStringTag$4=function(e,t,r){e&&!r&&(e=e.prototype),e&&!hasOwn$3(e,TO_STRING_TAG$1)&&defineProperty$3(e,TO_STRING_TAG$1,{configurable:!0,value:t})},IteratorPrototype$1=iteratorsCore.IteratorPrototype,create$1=objectCreate,createPropertyDescriptor$2=createPropertyDescriptor$5,setToStringTag$3=setToStringTag$4,Iterators$4=iterators,returnThis$1=function(){return this},iteratorCreateConstructor=function(e,t,r,n){var i=t+" Iterator";return e.prototype=create$1(IteratorPrototype$1,{next:createPropertyDescriptor$2(+!n,r)}),setToStringTag$3(e,i,!1),Iterators$4[i]=returnThis$1,e},uncurryThis$6=functionUncurryThis,aCallable$2=aCallable$4,functionUncurryThisAccessor=function(e,t,r){try{return uncurryThis$6(aCallable$2(Object.getOwnPropertyDescriptor(e,t)[r]))}catch(e){}},isCallable$3=isCallable$j,$String=String,$TypeError$3=TypeError,aPossiblePrototype$1=function(e){if("object"==typeof e||isCallable$3(e))return e;throw $TypeError$3("Can't set "+$String(e)+" as a prototype")},uncurryThisAccessor=functionUncurryThisAccessor,anObject$6=anObject$e,aPossiblePrototype=aPossiblePrototype$1,objectSetPrototypeOf=Object.setPrototypeOf||("__proto__"in{}?function(){var e,t=!1,r={};try{(e=uncurryThisAccessor(Object.prototype,"__proto__","set"))(r,[]),t=r instanceof Array}catch(e){}return function(r,n){return anObject$6(r),aPossiblePrototype(n),t?e(r,n):r.__proto__=n,r}}():void 0),$$3=_export,call$7=functionCall,FunctionName=functionName,isCallable$2=isCallable$j,createIteratorConstructor$1=iteratorCreateConstructor,getPrototypeOf=objectGetPrototypeOf,setPrototypeOf=objectSetPrototypeOf,setToStringTag$2=setToStringTag$4,createNonEnumerableProperty$1=createNonEnumerableProperty$5,defineBuiltIn$4=defineBuiltIn$8,wellKnownSymbol$5=wellKnownSymbol$g,Iterators$3=iterators,IteratorsCore=iteratorsCore,PROPER_FUNCTION_NAME$1=FunctionName.PROPER,CONFIGURABLE_FUNCTION_NAME=FunctionName.CONFIGURABLE,IteratorPrototype=IteratorsCore.IteratorPrototype,BUGGY_SAFARI_ITERATORS=IteratorsCore.BUGGY_SAFARI_ITERATORS,ITERATOR$5=wellKnownSymbol$5("iterator"),KEYS="keys",VALUES="values",ENTRIES="entries",returnThis=function(){return this},iteratorDefine=function(e,t,r,n,i,s,a){createIteratorConstructor$1(r,t,n);var o,l,c,h=function(e){if(e===i&&m)return m;if(!BUGGY_SAFARI_ITERATORS&&e in p)return p[e];switch(e){case KEYS:case VALUES:case ENTRIES:return function(){return new r(this,e)}}return function(){return new r(this)}},d=t+" Iterator",u=!1,p=e.prototype,f=p[ITERATOR$5]||p["@@iterator"]||i&&p[i],m=!BUGGY_SAFARI_ITERATORS&&f||h(i),g="Array"==t&&p.entries||f;if(g&&(o=getPrototypeOf(g.call(new e)))!==Object.prototype&&o.next&&(getPrototypeOf(o)!==IteratorPrototype&&(setPrototypeOf?setPrototypeOf(o,IteratorPrototype):isCallable$2(o[ITERATOR$5])||defineBuiltIn$4(o,ITERATOR$5,returnThis)),setToStringTag$2(o,d,!0)),PROPER_FUNCTION_NAME$1&&i==VALUES&&f&&f.name!==VALUES&&(CONFIGURABLE_FUNCTION_NAME?createNonEnumerableProperty$1(p,"name",VALUES):(u=!0,m=function(){return call$7(f,this)})),i)if(l={values:h(VALUES),keys:s?m:h(KEYS),entries:h(ENTRIES)},a)for(c in l)(BUGGY_SAFARI_ITERATORS||u||!(c in p))&&defineBuiltIn$4(p,c,l[c]);else $$3({target:t,proto:!0,forced:BUGGY_SAFARI_ITERATORS||u},l);return p[ITERATOR$5]!==m&&defineBuiltIn$4(p,ITERATOR$5,m,{name:i}),Iterators$3[t]=m,l},createIterResultObject$2=function(e,t){return{value:e,done:t}},toIndexedObject=toIndexedObject$5,addToUnscopables=addToUnscopables$2,Iterators$2=iterators,InternalStateModule$3=internalState,defineProperty$2=objectDefineProperty.f,defineIterator$1=iteratorDefine,createIterResultObject$1=createIterResultObject$2,DESCRIPTORS$4=descriptors,ARRAY_ITERATOR="Array Iterator",setInternalState$3=InternalStateModule$3.set,getInternalState$1=InternalStateModule$3.getterFor(ARRAY_ITERATOR),es_array_iterator=defineIterator$1(Array,"Array",(function(e,t){setInternalState$3(this,{type:ARRAY_ITERATOR,target:toIndexedObject(e),index:0,kind:t})}),(function(){var e=getInternalState$1(this),t=e.target,r=e.kind,n=e.index++;return!t||n>=t.length?(e.target=void 0,createIterResultObject$1(void 0,!0)):createIterResultObject$1("keys"==r?n:"values"==r?t[n]:[n,t[n]],!1)}),"values"),values=Iterators$2.Arguments=Iterators$2.Array;if(addToUnscopables("keys"),addToUnscopables("values"),addToUnscopables("entries"),DESCRIPTORS$4&&"values"!==values.name)try{defineProperty$2(values,"name",{value:"values"})}catch(e){}var domIterables={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},documentCreateElement=documentCreateElement$2,classList=documentCreateElement("span").classList,DOMTokenListPrototype$1=classList&&classList.constructor&&classList.constructor.prototype,domTokenListPrototype=DOMTokenListPrototype$1===Object.prototype?void 0:DOMTokenListPrototype$1,global$3=global$g,DOMIterables=domIterables,DOMTokenListPrototype=domTokenListPrototype,ArrayIteratorMethods=es_array_iterator,createNonEnumerableProperty=createNonEnumerableProperty$5,wellKnownSymbol$4=wellKnownSymbol$g,ITERATOR$4=wellKnownSymbol$4("iterator"),TO_STRING_TAG=wellKnownSymbol$4("toStringTag"),ArrayValues=ArrayIteratorMethods.values,handlePrototype=function(e,t){if(e){if(e[ITERATOR$4]!==ArrayValues)try{createNonEnumerableProperty(e,ITERATOR$4,ArrayValues)}catch(t){e[ITERATOR$4]=ArrayValues}if(e[TO_STRING_TAG]||createNonEnumerableProperty(e,TO_STRING_TAG,t),DOMIterables[t])for(var r in ArrayIteratorMethods)if(e[r]!==ArrayIteratorMethods[r])try{createNonEnumerableProperty(e,r,ArrayIteratorMethods[r])}catch(t){e[r]=ArrayIteratorMethods[r]}}};for(var COLLECTION_NAME in DOMIterables)handlePrototype(global$3[COLLECTION_NAME]&&global$3[COLLECTION_NAME].prototype,COLLECTION_NAME);handlePrototype(DOMTokenListPrototype,"DOMTokenList");var charAt$2=stringMultibyte.charAt,toString$1=toString$7,InternalStateModule$2=internalState,defineIterator=iteratorDefine,createIterResultObject=createIterResultObject$2,STRING_ITERATOR="String Iterator",setInternalState$2=InternalStateModule$2.set,getInternalState=InternalStateModule$2.getterFor(STRING_ITERATOR);defineIterator(String,"String",(function(e){setInternalState$2(this,{type:STRING_ITERATOR,string:toString$1(e),index:0})}),(function(){var e,t=getInternalState(this),r=t.string,n=t.index;return n>=r.length?createIterResultObject(void 0,!0):(e=charAt$2(r,n),t.index+=e.length,createIterResultObject(e,!1))}));var fails$3=fails$k,wellKnownSymbol$3=wellKnownSymbol$g,DESCRIPTORS$3=descriptors,IS_PURE=isPure,ITERATOR$3=wellKnownSymbol$3("iterator"),urlConstructorDetection=!fails$3((function(){var e=new URL("b?a=1&b=2&c=3","http://a"),t=e.searchParams,r="";return e.pathname="c%20d",t.forEach((function(e,n){t.delete("b"),r+=n+e})),IS_PURE&&!e.toJSON||!t.size&&(IS_PURE||!DESCRIPTORS$3)||!t.sort||"http://a/c%20d?a=1&c=3"!==e.href||"3"!==t.get("c")||"a=1"!==String(new URLSearchParams("?a=1"))||!t[ITERATOR$3]||"a"!==new URL("https://a@b").username||"b"!==new URLSearchParams(new URLSearchParams("a=b")).get("a")||"xn--e1aybc"!==new URL("http://тест").host||"#%D0%B1"!==new URL("http://a#б").hash||"a1c3"!==r||"x"!==new URL("http://x",void 0).host})),uncurryThis$5=functionUncurryThisClause,aCallable$1=aCallable$4,NATIVE_BIND=functionBindNative,bind$3=uncurryThis$5(uncurryThis$5.bind),functionBindContext=function(e,t){return aCallable$1(e),void 0===t?e:NATIVE_BIND?bind$3(e,t):function(){return e.apply(t,arguments)}},makeBuiltIn=makeBuiltIn$3.exports,defineProperty$1=objectDefineProperty,defineBuiltInAccessor$2=function(e,t,r){return r.get&&makeBuiltIn(r.get,t,{getter:!0}),r.set&&makeBuiltIn(r.set,t,{setter:!0}),defineProperty$1.f(e,t,r)},isPrototypeOf$1=objectIsPrototypeOf,$TypeError$2=TypeError,anInstance$2=function(e,t){if(isPrototypeOf$1(t,e))return e;throw $TypeError$2("Incorrect invocation")},DESCRIPTORS$2=descriptors,uncurryThis$4=functionUncurryThis,call$6=functionCall,fails$2=fails$k,objectKeys=objectKeys$2,getOwnPropertySymbolsModule=objectGetOwnPropertySymbols,propertyIsEnumerableModule=objectPropertyIsEnumerable,toObject$1=toObject$5,IndexedObject=indexedObject,$assign=Object.assign,defineProperty=Object.defineProperty,concat=uncurryThis$4([].concat),objectAssign=!$assign||fails$2((function(){if(DESCRIPTORS$2&&1!==$assign({b:1},$assign(defineProperty({},"a",{enumerable:!0,get:function(){defineProperty(this,"b",{value:3,enumerable:!1})}}),{b:2})).b)return!0;var e={},t={},r=Symbol(),n="abcdefghijklmnopqrst";return e[r]=7,n.split("").forEach((function(e){t[e]=e})),7!=$assign({},e)[r]||objectKeys($assign({},t)).join("")!=n}))?function(e,t){for(var r=toObject$1(e),n=arguments.length,i=1,s=getOwnPropertySymbolsModule.f,a=propertyIsEnumerableModule.f;n>i;)for(var o,l=IndexedObject(arguments[i++]),c=s?concat(objectKeys(l),s(l)):objectKeys(l),h=c.length,d=0;h>d;)o=c[d++],DESCRIPTORS$2&&!call$6(a,l,o)||(r[o]=l[o]);return r}:$assign,call$5=functionCall,anObject$5=anObject$e,getMethod$2=getMethod$5,iteratorClose$1=function(e,t,r){var n,i;anObject$5(e);try{if(!(n=getMethod$2(e,"return"))){if("throw"===t)throw r;return r}n=call$5(n,e)}catch(e){i=!0,n=e}if("throw"===t)throw r;if(i)throw n;return anObject$5(n),r},anObject$4=anObject$e,iteratorClose=iteratorClose$1,callWithSafeIterationClosing$1=function(e,t,r,n){try{return n?t(anObject$4(r)[0],r[1]):t(r)}catch(t){iteratorClose(e,"throw",t)}},wellKnownSymbol$2=wellKnownSymbol$g,Iterators$1=iterators,ITERATOR$2=wellKnownSymbol$2("iterator"),ArrayPrototype=Array.prototype,isArrayIteratorMethod$1=function(e){return void 0!==e&&(Iterators$1.Array===e||ArrayPrototype[ITERATOR$2]===e)},uncurryThis$3=functionUncurryThis,fails$1=fails$k,isCallable$1=isCallable$j,classof$2=classof$6,getBuiltIn=getBuiltIn$4,inspectSource=inspectSource$2,noop=function(){},empty=[],construct=getBuiltIn("Reflect","construct"),constructorRegExp=/^\s*(?:class|function)\b/,exec$2=uncurryThis$3(constructorRegExp.exec),INCORRECT_TO_STRING=!constructorRegExp.exec(noop),isConstructorModern=function(e){if(!isCallable$1(e))return!1;try{return construct(noop,empty,e),!0}catch(e){return!1}},isConstructorLegacy=function(e){if(!isCallable$1(e))return!1;switch(classof$2(e)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return INCORRECT_TO_STRING||!!exec$2(constructorRegExp,inspectSource(e))}catch(e){return!0}};isConstructorLegacy.sham=!0;var isConstructor$1=!construct||fails$1((function(){var e;return isConstructorModern(isConstructorModern.call)||!isConstructorModern(Object)||!isConstructorModern((function(){e=!0}))||e}))?isConstructorLegacy:isConstructorModern,toPropertyKey=toPropertyKey$3,definePropertyModule=objectDefineProperty,createPropertyDescriptor$1=createPropertyDescriptor$5,createProperty$2=function(e,t,r){var n=toPropertyKey(t);n in e?definePropertyModule.f(e,n,createPropertyDescriptor$1(0,r)):e[n]=r},classof$1=classof$6,getMethod$1=getMethod$5,isNullOrUndefined$1=isNullOrUndefined$5,Iterators=iterators,wellKnownSymbol$1=wellKnownSymbol$g,ITERATOR$1=wellKnownSymbol$1("iterator"),getIteratorMethod$3=function(e){if(!isNullOrUndefined$1(e))return getMethod$1(e,ITERATOR$1)||getMethod$1(e,"@@iterator")||Iterators[classof$1(e)]},call$4=functionCall,aCallable=aCallable$4,anObject$3=anObject$e,tryToString=tryToString$2,getIteratorMethod$2=getIteratorMethod$3,$TypeError$1=TypeError,getIterator$2=function(e,t){var r=arguments.length<2?getIteratorMethod$2(e):t;if(aCallable(r))return anObject$3(call$4(r,e));throw $TypeError$1(tryToString(e)+" is not iterable")},bind$2=functionBindContext,call$3=functionCall,toObject=toObject$5,callWithSafeIterationClosing=callWithSafeIterationClosing$1,isArrayIteratorMethod=isArrayIteratorMethod$1,isConstructor=isConstructor$1,lengthOfArrayLike$1=lengthOfArrayLike$3,createProperty$1=createProperty$2,getIterator$1=getIterator$2,getIteratorMethod$1=getIteratorMethod$3,$Array$1=Array,arrayFrom$1=function(e){var t=toObject(e),r=isConstructor(this),n=arguments.length,i=n>1?arguments[1]:void 0,s=void 0!==i;s&&(i=bind$2(i,n>2?arguments[2]:void 0));var a,o,l,c,h,d,u=getIteratorMethod$1(t),p=0;if(!u||this===$Array$1&&isArrayIteratorMethod(u))for(a=lengthOfArrayLike$1(t),o=r?new this(a):$Array$1(a);a>p;p++)d=s?i(t[p],p):t[p],createProperty$1(o,p,d);else for(h=(c=getIterator$1(t,u)).next,o=r?new this:[];!(l=call$3(h,c)).done;p++)d=s?callWithSafeIterationClosing(c,i,[l.value,p],!0):l.value,createProperty$1(o,p,d);return o.length=p,o},toAbsoluteIndex=toAbsoluteIndex$2,lengthOfArrayLike=lengthOfArrayLike$3,createProperty=createProperty$2,$Array=Array,max=Math.max,arraySliceSimple=function(e,t,r){for(var n=lengthOfArrayLike(e),i=toAbsoluteIndex(t,n),s=toAbsoluteIndex(void 0===r?n:r,n),a=$Array(max(s-i,0)),o=0;i<s;i++,o++)createProperty(a,o,e[i]);return a.length=o,a},uncurryThis$2=functionUncurryThis,maxInt=2147483647,base=36,tMin=1,tMax=26,skew=38,damp=700,initialBias=72,initialN=128,delimiter="-",regexNonASCII=/[^\0-\u007E]/,regexSeparators=/[.\u3002\uFF0E\uFF61]/g,OVERFLOW_ERROR="Overflow: input needs wider integers to process",baseMinusTMin=base-tMin,$RangeError=RangeError,exec$1=uncurryThis$2(regexSeparators.exec),floor$2=Math.floor,fromCharCode=String.fromCharCode,charCodeAt=uncurryThis$2("".charCodeAt),join$2=uncurryThis$2([].join),push$2=uncurryThis$2([].push),replace$2=uncurryThis$2("".replace),split$2=uncurryThis$2("".split),toLowerCase$1=uncurryThis$2("".toLowerCase),ucs2decode=function(e){for(var t=[],r=0,n=e.length;r<n;){var i=charCodeAt(e,r++);if(i>=55296&&i<=56319&&r<n){var s=charCodeAt(e,r++);56320==(64512&s)?push$2(t,((1023&i)<<10)+(1023&s)+65536):(push$2(t,i),r--)}else push$2(t,i)}return t},digitToBasic=function(e){return e+22+75*(e<26)},adapt=function(e,t,r){var n=0;for(e=r?floor$2(e/damp):e>>1,e+=floor$2(e/t);e>baseMinusTMin*tMax>>1;)e=floor$2(e/baseMinusTMin),n+=base;return floor$2(n+(baseMinusTMin+1)*e/(e+skew))},encode=function(e){var t,r,n=[],i=(e=ucs2decode(e)).length,s=initialN,a=0,o=initialBias;for(t=0;t<e.length;t++)(r=e[t])<128&&push$2(n,fromCharCode(r));var l=n.length,c=l;for(l&&push$2(n,delimiter);c<i;){var h=maxInt;for(t=0;t<e.length;t++)(r=e[t])>=s&&r<h&&(h=r);var d=c+1;if(h-s>floor$2((maxInt-a)/d))throw $RangeError(OVERFLOW_ERROR);for(a+=(h-s)*d,s=h,t=0;t<e.length;t++){if((r=e[t])<s&&++a>maxInt)throw $RangeError(OVERFLOW_ERROR);if(r==s){for(var u=a,p=base;;){var f=p<=o?tMin:p>=o+tMax?tMax:p-o;if(u<f)break;var m=u-f,g=base-f;push$2(n,fromCharCode(digitToBasic(f+m%g))),u=floor$2(m/g),p+=base}push$2(n,fromCharCode(digitToBasic(u))),o=adapt(a,d,c==l),a=0,c++}}a++,s++}return join$2(n,"")},stringPunycodeToAscii=function(e){var t,r,n=[],i=split$2(replace$2(toLowerCase$1(e),regexSeparators,"."),".");for(t=0;t<i.length;t++)r=i[t],push$2(n,exec$1(regexNonASCII,r)?"xn--"+encode(r):r);return join$2(n,".")},$TypeError=TypeError,validateArgumentsLength$2=function(e,t){if(e<t)throw $TypeError("Not enough arguments");return e},defineBuiltIn$3=defineBuiltIn$8,defineBuiltIns$1=function(e,t,r){for(var n in t)defineBuiltIn$3(e,n,t[n],r);return e},arraySlice$1=arraySliceSimple,floor$1=Math.floor,mergeSort=function(e,t){var r=e.length,n=floor$1(r/2);return r<8?insertionSort(e,t):merge(e,mergeSort(arraySlice$1(e,0,n),t),mergeSort(arraySlice$1(e,n),t),t)},insertionSort=function(e,t){for(var r,n,i=e.length,s=1;s<i;){for(n=s,r=e[s];n&&t(e[n-1],r)>0;)e[n]=e[--n];n!==s++&&(e[n]=r)}return e},merge=function(e,t,r,n){for(var i=t.length,s=r.length,a=0,o=0;a<i||o<s;)e[a+o]=a<i&&o<s?n(t[a],r[o])<=0?t[a++]:r[o++]:a<i?t[a++]:r[o++];return e},arraySort$1=mergeSort,$$2=_export,global$2=global$g,call$2=functionCall,uncurryThis$1=functionUncurryThis,DESCRIPTORS$1=descriptors,USE_NATIVE_URL$1=urlConstructorDetection,defineBuiltIn$2=defineBuiltIn$8,defineBuiltInAccessor$1=defineBuiltInAccessor$2,defineBuiltIns=defineBuiltIns$1,setToStringTag$1=setToStringTag$4,createIteratorConstructor=iteratorCreateConstructor,InternalStateModule$1=internalState,anInstance$1=anInstance$2,isCallable=isCallable$j,hasOwn$2=hasOwnProperty_1,bind$1=functionBindContext,classof=classof$6,anObject$2=anObject$e,isObject=isObject$8,$toString$2=toString$7,create=objectCreate,createPropertyDescriptor=createPropertyDescriptor$5,getIterator=getIterator$2,getIteratorMethod=getIteratorMethod$3,validateArgumentsLength$1=validateArgumentsLength$2,wellKnownSymbol=wellKnownSymbol$g,arraySort=arraySort$1,ITERATOR=wellKnownSymbol("iterator"),URL_SEARCH_PARAMS="URLSearchParams",URL_SEARCH_PARAMS_ITERATOR=URL_SEARCH_PARAMS+"Iterator",setInternalState$1=InternalStateModule$1.set,getInternalParamsState=InternalStateModule$1.getterFor(URL_SEARCH_PARAMS),getInternalIteratorState=InternalStateModule$1.getterFor(URL_SEARCH_PARAMS_ITERATOR),getOwnPropertyDescriptor=Object.getOwnPropertyDescriptor,safeGetBuiltIn=function(e){if(!DESCRIPTORS$1)return global$2[e];var t=getOwnPropertyDescriptor(global$2,e);return t&&t.value},nativeFetch=safeGetBuiltIn("fetch"),NativeRequest=safeGetBuiltIn("Request"),Headers=safeGetBuiltIn("Headers"),RequestPrototype=NativeRequest&&NativeRequest.prototype,HeadersPrototype=Headers&&Headers.prototype,RegExp$1=global$2.RegExp,TypeError$2=global$2.TypeError,decodeURIComponent$1=global$2.decodeURIComponent,encodeURIComponent$1=global$2.encodeURIComponent,charAt$1=uncurryThis$1("".charAt),join$1=uncurryThis$1([].join),push$1=uncurryThis$1([].push),replace$1=uncurryThis$1("".replace),shift$1=uncurryThis$1([].shift),splice=uncurryThis$1([].splice),split$1=uncurryThis$1("".split),stringSlice$1=uncurryThis$1("".slice),plus=/\+/g,sequences=Array(4),percentSequence=function(e){return sequences[e-1]||(sequences[e-1]=RegExp$1("((?:%[\\da-f]{2}){"+e+"})","gi"))},percentDecode=function(e){try{return decodeURIComponent$1(e)}catch(t){return e}},deserialize=function(e){var t=replace$1(e,plus," "),r=4;try{return decodeURIComponent$1(t)}catch(e){for(;r;)t=replace$1(t,percentSequence(r--),percentDecode);return t}},find=/[!'()~]|%20/g,replacements={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"},replacer=function(e){return replacements[e]},serialize=function(e){return replace$1(encodeURIComponent$1(e),find,replacer)},URLSearchParamsIterator=createIteratorConstructor((function(e,t){setInternalState$1(this,{type:URL_SEARCH_PARAMS_ITERATOR,iterator:getIterator(getInternalParamsState(e).entries),kind:t})}),"Iterator",(function(){var e=getInternalIteratorState(this),t=e.kind,r=e.iterator.next(),n=r.value;return r.done||(r.value="keys"===t?n.key:"values"===t?n.value:[n.key,n.value]),r}),!0),URLSearchParamsState=function(e){this.entries=[],this.url=null,void 0!==e&&(isObject(e)?this.parseObject(e):this.parseQuery("string"==typeof e?"?"===charAt$1(e,0)?stringSlice$1(e,1):e:$toString$2(e)))};URLSearchParamsState.prototype={type:URL_SEARCH_PARAMS,bindURL:function(e){this.url=e,this.update()},parseObject:function(e){var t,r,n,i,s,a,o,l=getIteratorMethod(e);if(l)for(r=(t=getIterator(e,l)).next;!(n=call$2(r,t)).done;){if(s=(i=getIterator(anObject$2(n.value))).next,(a=call$2(s,i)).done||(o=call$2(s,i)).done||!call$2(s,i).done)throw TypeError$2("Expected sequence with length 2");push$1(this.entries,{key:$toString$2(a.value),value:$toString$2(o.value)})}else for(var c in e)hasOwn$2(e,c)&&push$1(this.entries,{key:c,value:$toString$2(e[c])})},parseQuery:function(e){if(e)for(var t,r,n=split$1(e,"&"),i=0;i<n.length;)(t=n[i++]).length&&(r=split$1(t,"="),push$1(this.entries,{key:deserialize(shift$1(r)),value:deserialize(join$1(r,"="))}))},serialize:function(){for(var e,t=this.entries,r=[],n=0;n<t.length;)e=t[n++],push$1(r,serialize(e.key)+"="+serialize(e.value));return join$1(r,"&")},update:function(){this.entries.length=0,this.parseQuery(this.url.query)},updateURL:function(){this.url&&this.url.update()}};var URLSearchParamsConstructor=function(){anInstance$1(this,URLSearchParamsPrototype);var e=setInternalState$1(this,new URLSearchParamsState(arguments.length>0?arguments[0]:void 0));DESCRIPTORS$1||(this.length=e.entries.length)},URLSearchParamsPrototype=URLSearchParamsConstructor.prototype;if(defineBuiltIns(URLSearchParamsPrototype,{append:function(e,t){validateArgumentsLength$1(arguments.length,2);var r=getInternalParamsState(this);push$1(r.entries,{key:$toString$2(e),value:$toString$2(t)}),DESCRIPTORS$1||this.length++,r.updateURL()},delete:function(e){validateArgumentsLength$1(arguments.length,1);for(var t=getInternalParamsState(this),r=t.entries,n=$toString$2(e),i=0;i<r.length;)r[i].key===n?splice(r,i,1):i++;DESCRIPTORS$1||(this.length=r.length),t.updateURL()},get:function(e){validateArgumentsLength$1(arguments.length,1);for(var t=getInternalParamsState(this).entries,r=$toString$2(e),n=0;n<t.length;n++)if(t[n].key===r)return t[n].value;return null},getAll:function(e){validateArgumentsLength$1(arguments.length,1);for(var t=getInternalParamsState(this).entries,r=$toString$2(e),n=[],i=0;i<t.length;i++)t[i].key===r&&push$1(n,t[i].value);return n},has:function(e){validateArgumentsLength$1(arguments.length,1);for(var t=getInternalParamsState(this).entries,r=$toString$2(e),n=0;n<t.length;)if(t[n++].key===r)return!0;return!1},set:function(e,t){validateArgumentsLength$1(arguments.length,1);for(var r,n=getInternalParamsState(this),i=n.entries,s=!1,a=$toString$2(e),o=$toString$2(t),l=0;l<i.length;l++)(r=i[l]).key===a&&(s?splice(i,l--,1):(s=!0,r.value=o));s||push$1(i,{key:a,value:o}),DESCRIPTORS$1||(this.length=i.length),n.updateURL()},sort:function(){var e=getInternalParamsState(this);arraySort(e.entries,(function(e,t){return e.key>t.key?1:-1})),e.updateURL()},forEach:function(e){for(var t,r=getInternalParamsState(this).entries,n=bind$1(e,arguments.length>1?arguments[1]:void 0),i=0;i<r.length;)n((t=r[i++]).value,t.key,this)},keys:function(){return new URLSearchParamsIterator(this,"keys")},values:function(){return new URLSearchParamsIterator(this,"values")},entries:function(){return new URLSearchParamsIterator(this,"entries")}},{enumerable:!0}),defineBuiltIn$2(URLSearchParamsPrototype,ITERATOR,URLSearchParamsPrototype.entries,{name:"entries"}),defineBuiltIn$2(URLSearchParamsPrototype,"toString",(function(){return getInternalParamsState(this).serialize()}),{enumerable:!0}),DESCRIPTORS$1&&defineBuiltInAccessor$1(URLSearchParamsPrototype,"size",{get:function(){return getInternalParamsState(this).entries.length},configurable:!0,enumerable:!0}),setToStringTag$1(URLSearchParamsConstructor,URL_SEARCH_PARAMS),$$2({global:!0,constructor:!0,forced:!USE_NATIVE_URL$1},{URLSearchParams:URLSearchParamsConstructor}),!USE_NATIVE_URL$1&&isCallable(Headers)){var headersHas=uncurryThis$1(HeadersPrototype.has),headersSet=uncurryThis$1(HeadersPrototype.set),wrapRequestOptions=function(e){if(isObject(e)){var t,r=e.body;if(classof(r)===URL_SEARCH_PARAMS)return t=e.headers?new Headers(e.headers):new Headers,headersHas(t,"content-type")||headersSet(t,"content-type","application/x-www-form-urlencoded;charset=UTF-8"),create(e,{body:createPropertyDescriptor(0,$toString$2(r)),headers:createPropertyDescriptor(0,t)})}return e};if(isCallable(nativeFetch)&&$$2({global:!0,enumerable:!0,dontCallGetSet:!0,forced:!0},{fetch:function(e){return nativeFetch(e,arguments.length>1?wrapRequestOptions(arguments[1]):{})}}),isCallable(NativeRequest)){var RequestConstructor=function(e){return anInstance$1(this,RequestPrototype),new NativeRequest(e,arguments.length>1?wrapRequestOptions(arguments[1]):{})};RequestPrototype.constructor=RequestConstructor,RequestConstructor.prototype=RequestPrototype,$$2({global:!0,constructor:!0,dontCallGetSet:!0,forced:!0},{Request:RequestConstructor})}}var web_urlSearchParams_constructor={URLSearchParams:URLSearchParamsConstructor,getState:getInternalParamsState},$$1=_export,DESCRIPTORS=descriptors,USE_NATIVE_URL=urlConstructorDetection,global$1=global$g,bind=functionBindContext,uncurryThis=functionUncurryThis,defineBuiltIn$1=defineBuiltIn$8,defineBuiltInAccessor=defineBuiltInAccessor$2,anInstance=anInstance$2,hasOwn$1=hasOwnProperty_1,assign$1=objectAssign,arrayFrom=arrayFrom$1,arraySlice=arraySliceSimple,codeAt=stringMultibyte.codeAt,toASCII=stringPunycodeToAscii,$toString$1=toString$7,setToStringTag=setToStringTag$4,validateArgumentsLength=validateArgumentsLength$2,URLSearchParamsModule=web_urlSearchParams_constructor,InternalStateModule=internalState,setInternalState=InternalStateModule.set,getInternalURLState=InternalStateModule.getterFor("URL"),URLSearchParams$1=URLSearchParamsModule.URLSearchParams,getInternalSearchParamsState=URLSearchParamsModule.getState,NativeURL=global$1.URL,TypeError$1=global$1.TypeError,parseInt$1=global$1.parseInt,floor=Math.floor,pow=Math.pow,charAt=uncurryThis("".charAt),exec=uncurryThis(/./.exec),join=uncurryThis([].join),numberToString=uncurryThis(1..toString),pop=uncurryThis([].pop),push=uncurryThis([].push),replace=uncurryThis("".replace),shift=uncurryThis([].shift),split=uncurryThis("".split),stringSlice=uncurryThis("".slice),toLowerCase=uncurryThis("".toLowerCase),unshift=uncurryThis([].unshift),INVALID_AUTHORITY="Invalid authority",INVALID_SCHEME="Invalid scheme",INVALID_HOST="Invalid host",INVALID_PORT="Invalid port",ALPHA=/[a-z]/i,ALPHANUMERIC=/[\d+-.a-z]/i,DIGIT=/\d/,HEX_START=/^0x/i,OCT=/^[0-7]+$/,DEC=/^\d+$/,HEX=/^[\da-f]+$/i,FORBIDDEN_HOST_CODE_POINT=/[\0\t\n\r #%/:<>?@[\\\]^|]/,FORBIDDEN_HOST_CODE_POINT_EXCLUDING_PERCENT=/[\0\t\n\r #/:<>?@[\\\]^|]/,LEADING_C0_CONTROL_OR_SPACE=/^[\u0000-\u0020]+/,TRAILING_C0_CONTROL_OR_SPACE=/(^|[^\u0000-\u0020])[\u0000-\u0020]+$/,TAB_AND_NEW_LINE=/[\t\n\r]/g,EOF,parseIPv4=function(e){var t,r,n,i,s,a,o,l=split(e,".");if(l.length&&""==l[l.length-1]&&l.length--,(t=l.length)>4)return e;for(r=[],n=0;n<t;n++){if(""==(i=l[n]))return e;if(s=10,i.length>1&&"0"==charAt(i,0)&&(s=exec(HEX_START,i)?16:8,i=stringSlice(i,8==s?1:2)),""===i)a=0;else{if(!exec(10==s?DEC:8==s?OCT:HEX,i))return e;a=parseInt$1(i,s)}push(r,a)}for(n=0;n<t;n++)if(a=r[n],n==t-1){if(a>=pow(256,5-t))return null}else if(a>255)return null;for(o=pop(r),n=0;n<r.length;n++)o+=r[n]*pow(256,3-n);return o},parseIPv6=function(e){var t,r,n,i,s,a,o,l=[0,0,0,0,0,0,0,0],c=0,h=null,d=0,u=function(){return charAt(e,d)};if(":"==u()){if(":"!=charAt(e,1))return;d+=2,h=++c}for(;u();){if(8==c)return;if(":"!=u()){for(t=r=0;r<4&&exec(HEX,u());)t=16*t+parseInt$1(u(),16),d++,r++;if("."==u()){if(0==r)return;if(d-=r,c>6)return;for(n=0;u();){if(i=null,n>0){if(!("."==u()&&n<4))return;d++}if(!exec(DIGIT,u()))return;for(;exec(DIGIT,u());){if(s=parseInt$1(u(),10),null===i)i=s;else{if(0==i)return;i=10*i+s}if(i>255)return;d++}l[c]=256*l[c]+i,2!=++n&&4!=n||c++}if(4!=n)return;break}if(":"==u()){if(d++,!u())return}else if(u())return;l[c++]=t}else{if(null!==h)return;d++,h=++c}}if(null!==h)for(a=c-h,c=7;0!=c&&a>0;)o=l[c],l[c--]=l[h+a-1],l[h+--a]=o;else if(8!=c)return;return l},findLongestZeroSequence=function(e){for(var t=null,r=1,n=null,i=0,s=0;s<8;s++)0!==e[s]?(i>r&&(t=n,r=i),n=null,i=0):(null===n&&(n=s),++i);return i>r&&(t=n,r=i),t},serializeHost=function(e){var t,r,n,i;if("number"==typeof e){for(t=[],r=0;r<4;r++)unshift(t,e%256),e=floor(e/256);return join(t,".")}if("object"==typeof e){for(t="",n=findLongestZeroSequence(e),r=0;r<8;r++)i&&0===e[r]||(i&&(i=!1),n===r?(t+=r?":":"::",i=!0):(t+=numberToString(e[r],16),r<7&&(t+=":")));return"["+t+"]"}return e},C0ControlPercentEncodeSet={},fragmentPercentEncodeSet=assign$1({},C0ControlPercentEncodeSet,{" ":1,'"':1,"<":1,">":1,"`":1}),pathPercentEncodeSet=assign$1({},fragmentPercentEncodeSet,{"#":1,"?":1,"{":1,"}":1}),userinfoPercentEncodeSet=assign$1({},pathPercentEncodeSet,{"/":1,":":1,";":1,"=":1,"@":1,"[":1,"\\":1,"]":1,"^":1,"|":1}),percentEncode=function(e,t){var r=codeAt(e,0);return r>32&&r<127&&!hasOwn$1(t,e)?e:encodeURIComponent(e)},specialSchemes={ftp:21,file:null,http:80,https:443,ws:80,wss:443},isWindowsDriveLetter=function(e,t){var r;return 2==e.length&&exec(ALPHA,charAt(e,0))&&(":"==(r=charAt(e,1))||!t&&"|"==r)},startsWithWindowsDriveLetter=function(e){var t;return e.length>1&&isWindowsDriveLetter(stringSlice(e,0,2))&&(2==e.length||"/"===(t=charAt(e,2))||"\\"===t||"?"===t||"#"===t)},isSingleDot=function(e){return"."===e||"%2e"===toLowerCase(e)},isDoubleDot=function(e){return".."===(e=toLowerCase(e))||"%2e."===e||".%2e"===e||"%2e%2e"===e},SCHEME_START={},SCHEME={},NO_SCHEME={},SPECIAL_RELATIVE_OR_AUTHORITY={},PATH_OR_AUTHORITY={},RELATIVE={},RELATIVE_SLASH={},SPECIAL_AUTHORITY_SLASHES={},SPECIAL_AUTHORITY_IGNORE_SLASHES={},AUTHORITY={},HOST={},HOSTNAME={},PORT={},FILE={},FILE_SLASH={},FILE_HOST={},PATH_START={},PATH={},CANNOT_BE_A_BASE_URL_PATH={},QUERY={},FRAGMENT={},URLState=function(e,t,r){var n,i,s,a=$toString$1(e);if(t){if(i=this.parse(a))throw TypeError$1(i);this.searchParams=null}else{if(void 0!==r&&(n=new URLState(r,!0)),i=this.parse(a,null,n))throw TypeError$1(i);(s=getInternalSearchParamsState(new URLSearchParams$1)).bindURL(this),this.searchParams=s}};URLState.prototype={type:"URL",parse:function(e,t,r){var n,i,s,a,o=this,l=t||SCHEME_START,c=0,h="",d=!1,u=!1,p=!1;for(e=$toString$1(e),t||(o.scheme="",o.username="",o.password="",o.host=null,o.port=null,o.path=[],o.query=null,o.fragment=null,o.cannotBeABaseURL=!1,e=replace(e,LEADING_C0_CONTROL_OR_SPACE,""),e=replace(e,TRAILING_C0_CONTROL_OR_SPACE,"$1")),e=replace(e,TAB_AND_NEW_LINE,""),n=arrayFrom(e);c<=n.length;){switch(i=n[c],l){case SCHEME_START:if(!i||!exec(ALPHA,i)){if(t)return INVALID_SCHEME;l=NO_SCHEME;continue}h+=toLowerCase(i),l=SCHEME;break;case SCHEME:if(i&&(exec(ALPHANUMERIC,i)||"+"==i||"-"==i||"."==i))h+=toLowerCase(i);else{if(":"!=i){if(t)return INVALID_SCHEME;h="",l=NO_SCHEME,c=0;continue}if(t&&(o.isSpecial()!=hasOwn$1(specialSchemes,h)||"file"==h&&(o.includesCredentials()||null!==o.port)||"file"==o.scheme&&!o.host))return;if(o.scheme=h,t)return void(o.isSpecial()&&specialSchemes[o.scheme]==o.port&&(o.port=null));h="","file"==o.scheme?l=FILE:o.isSpecial()&&r&&r.scheme==o.scheme?l=SPECIAL_RELATIVE_OR_AUTHORITY:o.isSpecial()?l=SPECIAL_AUTHORITY_SLASHES:"/"==n[c+1]?(l=PATH_OR_AUTHORITY,c++):(o.cannotBeABaseURL=!0,push(o.path,""),l=CANNOT_BE_A_BASE_URL_PATH)}break;case NO_SCHEME:if(!r||r.cannotBeABaseURL&&"#"!=i)return INVALID_SCHEME;if(r.cannotBeABaseURL&&"#"==i){o.scheme=r.scheme,o.path=arraySlice(r.path),o.query=r.query,o.fragment="",o.cannotBeABaseURL=!0,l=FRAGMENT;break}l="file"==r.scheme?FILE:RELATIVE;continue;case SPECIAL_RELATIVE_OR_AUTHORITY:if("/"!=i||"/"!=n[c+1]){l=RELATIVE;continue}l=SPECIAL_AUTHORITY_IGNORE_SLASHES,c++;break;case PATH_OR_AUTHORITY:if("/"==i){l=AUTHORITY;break}l=PATH;continue;case RELATIVE:if(o.scheme=r.scheme,i==EOF)o.username=r.username,o.password=r.password,o.host=r.host,o.port=r.port,o.path=arraySlice(r.path),o.query=r.query;else if("/"==i||"\\"==i&&o.isSpecial())l=RELATIVE_SLASH;else if("?"==i)o.username=r.username,o.password=r.password,o.host=r.host,o.port=r.port,o.path=arraySlice(r.path),o.query="",l=QUERY;else{if("#"!=i){o.username=r.username,o.password=r.password,o.host=r.host,o.port=r.port,o.path=arraySlice(r.path),o.path.length--,l=PATH;continue}o.username=r.username,o.password=r.password,o.host=r.host,o.port=r.port,o.path=arraySlice(r.path),o.query=r.query,o.fragment="",l=FRAGMENT}break;case RELATIVE_SLASH:if(!o.isSpecial()||"/"!=i&&"\\"!=i){if("/"!=i){o.username=r.username,o.password=r.password,o.host=r.host,o.port=r.port,l=PATH;continue}l=AUTHORITY}else l=SPECIAL_AUTHORITY_IGNORE_SLASHES;break;case SPECIAL_AUTHORITY_SLASHES:if(l=SPECIAL_AUTHORITY_IGNORE_SLASHES,"/"!=i||"/"!=charAt(h,c+1))continue;c++;break;case SPECIAL_AUTHORITY_IGNORE_SLASHES:if("/"!=i&&"\\"!=i){l=AUTHORITY;continue}break;case AUTHORITY:if("@"==i){d&&(h="%40"+h),d=!0,s=arrayFrom(h);for(var f=0;f<s.length;f++){var m=s[f];if(":"!=m||p){var g=percentEncode(m,userinfoPercentEncodeSet);p?o.password+=g:o.username+=g}else p=!0}h=""}else if(i==EOF||"/"==i||"?"==i||"#"==i||"\\"==i&&o.isSpecial()){if(d&&""==h)return INVALID_AUTHORITY;c-=arrayFrom(h).length+1,h="",l=HOST}else h+=i;break;case HOST:case HOSTNAME:if(t&&"file"==o.scheme){l=FILE_HOST;continue}if(":"!=i||u){if(i==EOF||"/"==i||"?"==i||"#"==i||"\\"==i&&o.isSpecial()){if(o.isSpecial()&&""==h)return INVALID_HOST;if(t&&""==h&&(o.includesCredentials()||null!==o.port))return;if(a=o.parseHost(h))return a;if(h="",l=PATH_START,t)return;continue}"["==i?u=!0:"]"==i&&(u=!1),h+=i}else{if(""==h)return INVALID_HOST;if(a=o.parseHost(h))return a;if(h="",l=PORT,t==HOSTNAME)return}break;case PORT:if(!exec(DIGIT,i)){if(i==EOF||"/"==i||"?"==i||"#"==i||"\\"==i&&o.isSpecial()||t){if(""!=h){var y=parseInt$1(h,10);if(y>65535)return INVALID_PORT;o.port=o.isSpecial()&&y===specialSchemes[o.scheme]?null:y,h=""}if(t)return;l=PATH_START;continue}return INVALID_PORT}h+=i;break;case FILE:if(o.scheme="file","/"==i||"\\"==i)l=FILE_SLASH;else{if(!r||"file"!=r.scheme){l=PATH;continue}if(i==EOF)o.host=r.host,o.path=arraySlice(r.path),o.query=r.query;else if("?"==i)o.host=r.host,o.path=arraySlice(r.path),o.query="",l=QUERY;else{if("#"!=i){startsWithWindowsDriveLetter(join(arraySlice(n,c),""))||(o.host=r.host,o.path=arraySlice(r.path),o.shortenPath()),l=PATH;continue}o.host=r.host,o.path=arraySlice(r.path),o.query=r.query,o.fragment="",l=FRAGMENT}}break;case FILE_SLASH:if("/"==i||"\\"==i){l=FILE_HOST;break}r&&"file"==r.scheme&&!startsWithWindowsDriveLetter(join(arraySlice(n,c),""))&&(isWindowsDriveLetter(r.path[0],!0)?push(o.path,r.path[0]):o.host=r.host),l=PATH;continue;case FILE_HOST:if(i==EOF||"/"==i||"\\"==i||"?"==i||"#"==i){if(!t&&isWindowsDriveLetter(h))l=PATH;else if(""==h){if(o.host="",t)return;l=PATH_START}else{if(a=o.parseHost(h))return a;if("localhost"==o.host&&(o.host=""),t)return;h="",l=PATH_START}continue}h+=i;break;case PATH_START:if(o.isSpecial()){if(l=PATH,"/"!=i&&"\\"!=i)continue}else if(t||"?"!=i)if(t||"#"!=i){if(i!=EOF&&(l=PATH,"/"!=i))continue}else o.fragment="",l=FRAGMENT;else o.query="",l=QUERY;break;case PATH:if(i==EOF||"/"==i||"\\"==i&&o.isSpecial()||!t&&("?"==i||"#"==i)){if(isDoubleDot(h)?(o.shortenPath(),"/"==i||"\\"==i&&o.isSpecial()||push(o.path,"")):isSingleDot(h)?"/"==i||"\\"==i&&o.isSpecial()||push(o.path,""):("file"==o.scheme&&!o.path.length&&isWindowsDriveLetter(h)&&(o.host&&(o.host=""),h=charAt(h,0)+":"),push(o.path,h)),h="","file"==o.scheme&&(i==EOF||"?"==i||"#"==i))for(;o.path.length>1&&""===o.path[0];)shift(o.path);"?"==i?(o.query="",l=QUERY):"#"==i&&(o.fragment="",l=FRAGMENT)}else h+=percentEncode(i,pathPercentEncodeSet);break;case CANNOT_BE_A_BASE_URL_PATH:"?"==i?(o.query="",l=QUERY):"#"==i?(o.fragment="",l=FRAGMENT):i!=EOF&&(o.path[0]+=percentEncode(i,C0ControlPercentEncodeSet));break;case QUERY:t||"#"!=i?i!=EOF&&("'"==i&&o.isSpecial()?o.query+="%27":o.query+="#"==i?"%23":percentEncode(i,C0ControlPercentEncodeSet)):(o.fragment="",l=FRAGMENT);break;case FRAGMENT:i!=EOF&&(o.fragment+=percentEncode(i,fragmentPercentEncodeSet))}c++}},parseHost:function(e){var t,r,n;if("["==charAt(e,0)){if("]"!=charAt(e,e.length-1))return INVALID_HOST;if(!(t=parseIPv6(stringSlice(e,1,-1))))return INVALID_HOST;this.host=t}else if(this.isSpecial()){if(e=toASCII(e),exec(FORBIDDEN_HOST_CODE_POINT,e))return INVALID_HOST;if(null===(t=parseIPv4(e)))return INVALID_HOST;this.host=t}else{if(exec(FORBIDDEN_HOST_CODE_POINT_EXCLUDING_PERCENT,e))return INVALID_HOST;for(t="",r=arrayFrom(e),n=0;n<r.length;n++)t+=percentEncode(r[n],C0ControlPercentEncodeSet);this.host=t}},cannotHaveUsernamePasswordPort:function(){return!this.host||this.cannotBeABaseURL||"file"==this.scheme},includesCredentials:function(){return""!=this.username||""!=this.password},isSpecial:function(){return hasOwn$1(specialSchemes,this.scheme)},shortenPath:function(){var e=this.path,t=e.length;!t||"file"==this.scheme&&1==t&&isWindowsDriveLetter(e[0],!0)||e.length--},serialize:function(){var e=this,t=e.scheme,r=e.username,n=e.password,i=e.host,s=e.port,a=e.path,o=e.query,l=e.fragment,c=t+":";return null!==i?(c+="//",e.includesCredentials()&&(c+=r+(n?":"+n:"")+"@"),c+=serializeHost(i),null!==s&&(c+=":"+s)):"file"==t&&(c+="//"),c+=e.cannotBeABaseURL?a[0]:a.length?"/"+join(a,"/"):"",null!==o&&(c+="?"+o),null!==l&&(c+="#"+l),c},setHref:function(e){var t=this.parse(e);if(t)throw TypeError$1(t);this.searchParams.update()},getOrigin:function(){var e=this.scheme,t=this.port;if("blob"==e)try{return new URLConstructor(e.path[0]).origin}catch(e){return"null"}return"file"!=e&&this.isSpecial()?e+"://"+serializeHost(this.host)+(null!==t?":"+t:""):"null"},getProtocol:function(){return this.scheme+":"},setProtocol:function(e){this.parse($toString$1(e)+":",SCHEME_START)},getUsername:function(){return this.username},setUsername:function(e){var t=arrayFrom($toString$1(e));if(!this.cannotHaveUsernamePasswordPort()){this.username="";for(var r=0;r<t.length;r++)this.username+=percentEncode(t[r],userinfoPercentEncodeSet)}},getPassword:function(){return this.password},setPassword:function(e){var t=arrayFrom($toString$1(e));if(!this.cannotHaveUsernamePasswordPort()){this.password="";for(var r=0;r<t.length;r++)this.password+=percentEncode(t[r],userinfoPercentEncodeSet)}},getHost:function(){var e=this.host,t=this.port;return null===e?"":null===t?serializeHost(e):serializeHost(e)+":"+t},setHost:function(e){this.cannotBeABaseURL||this.parse(e,HOST)},getHostname:function(){var e=this.host;return null===e?"":serializeHost(e)},setHostname:function(e){this.cannotBeABaseURL||this.parse(e,HOSTNAME)},getPort:function(){var e=this.port;return null===e?"":$toString$1(e)},setPort:function(e){this.cannotHaveUsernamePasswordPort()||(""==(e=$toString$1(e))?this.port=null:this.parse(e,PORT))},getPathname:function(){var e=this.path;return this.cannotBeABaseURL?e[0]:e.length?"/"+join(e,"/"):""},setPathname:function(e){this.cannotBeABaseURL||(this.path=[],this.parse(e,PATH_START))},getSearch:function(){var e=this.query;return e?"?"+e:""},setSearch:function(e){""==(e=$toString$1(e))?this.query=null:("?"==charAt(e,0)&&(e=stringSlice(e,1)),this.query="",this.parse(e,QUERY)),this.searchParams.update()},getSearchParams:function(){return this.searchParams.facade},getHash:function(){var e=this.fragment;return e?"#"+e:""},setHash:function(e){""!=(e=$toString$1(e))?("#"==charAt(e,0)&&(e=stringSlice(e,1)),this.fragment="",this.parse(e,FRAGMENT)):this.fragment=null},update:function(){this.query=this.searchParams.serialize()||null}};var URLConstructor=function(e){var t=anInstance(this,URLPrototype),r=validateArgumentsLength(arguments.length,1)>1?arguments[1]:void 0,n=setInternalState(t,new URLState(e,!1,r));DESCRIPTORS||(t.href=n.serialize(),t.origin=n.getOrigin(),t.protocol=n.getProtocol(),t.username=n.getUsername(),t.password=n.getPassword(),t.host=n.getHost(),t.hostname=n.getHostname(),t.port=n.getPort(),t.pathname=n.getPathname(),t.search=n.getSearch(),t.searchParams=n.getSearchParams(),t.hash=n.getHash())},URLPrototype=URLConstructor.prototype,accessorDescriptor=function(e,t){return{get:function(){return getInternalURLState(this)[e]()},set:t&&function(e){return getInternalURLState(this)[t](e)},configurable:!0,enumerable:!0}};if(DESCRIPTORS&&(defineBuiltInAccessor(URLPrototype,"href",accessorDescriptor("serialize","setHref")),defineBuiltInAccessor(URLPrototype,"origin",accessorDescriptor("getOrigin")),defineBuiltInAccessor(URLPrototype,"protocol",accessorDescriptor("getProtocol","setProtocol")),defineBuiltInAccessor(URLPrototype,"username",accessorDescriptor("getUsername","setUsername")),defineBuiltInAccessor(URLPrototype,"password",accessorDescriptor("getPassword","setPassword")),defineBuiltInAccessor(URLPrototype,"host",accessorDescriptor("getHost","setHost")),defineBuiltInAccessor(URLPrototype,"hostname",accessorDescriptor("getHostname","setHostname")),defineBuiltInAccessor(URLPrototype,"port",accessorDescriptor("getPort","setPort")),defineBuiltInAccessor(URLPrototype,"pathname",accessorDescriptor("getPathname","setPathname")),defineBuiltInAccessor(URLPrototype,"search",accessorDescriptor("getSearch","setSearch")),defineBuiltInAccessor(URLPrototype,"searchParams",accessorDescriptor("getSearchParams")),defineBuiltInAccessor(URLPrototype,"hash",accessorDescriptor("getHash","setHash"))),defineBuiltIn$1(URLPrototype,"toJSON",(function(){return getInternalURLState(this).serialize()}),{enumerable:!0}),defineBuiltIn$1(URLPrototype,"toString",(function(){return getInternalURLState(this).serialize()}),{enumerable:!0}),NativeURL){var nativeCreateObjectURL=NativeURL.createObjectURL,nativeRevokeObjectURL=NativeURL.revokeObjectURL;nativeCreateObjectURL&&defineBuiltIn$1(URLConstructor,"createObjectURL",bind(nativeCreateObjectURL,NativeURL)),nativeRevokeObjectURL&&defineBuiltIn$1(URLConstructor,"revokeObjectURL",bind(nativeRevokeObjectURL,NativeURL))}setToStringTag(URLConstructor,"URL"),$$1({global:!0,constructor:!0,forced:!USE_NATIVE_URL,sham:!DESCRIPTORS},{URL:URLConstructor});var sameValue$1=Object.is||function(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t},call$1=functionCall,fixRegExpWellKnownSymbolLogic=fixRegexpWellKnownSymbolLogic,anObject$1=anObject$e,isNullOrUndefined=isNullOrUndefined$5,requireObjectCoercible=requireObjectCoercible$7,sameValue=sameValue$1,toString=toString$7,getMethod=getMethod$5,regExpExec=regexpExecAbstract,util,objectUtil;fixRegExpWellKnownSymbolLogic("search",(function(e,t,r){return[function(t){var r=requireObjectCoercible(this),n=isNullOrUndefined(t)?void 0:getMethod(t,e);return n?call$1(n,t,r):new RegExp(t)[e](toString(r))},function(e){var n=anObject$1(this),i=toString(e),s=r(t,n,i);if(s.done)return s.value;var a=n.lastIndex;sameValue(a,0)||(n.lastIndex=0);var o=regExpExec(n,i);return sameValue(n.lastIndex,a)||(n.lastIndex=a),null===o?-1:o.index}]})),function(e){e.assertEqual=e=>e,e.assertIs=function(e){},e.assertNever=function(e){throw new Error},e.arrayToEnum=e=>{const t={};for(const r of e)t[r]=r;return t},e.getValidEnumValues=t=>{const r=e.objectKeys(t).filter((e=>"number"!=typeof t[t[e]])),n={};for(const e of r)n[e]=t[e];return e.objectValues(n)},e.objectValues=t=>e.objectKeys(t).map((function(e){return t[e]})),e.objectKeys="function"==typeof Object.keys?e=>Object.keys(e):e=>{const t=[];for(const r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.push(r);return t},e.find=(e,t)=>{for(const r of e)if(t(r))return r},e.isInteger="function"==typeof Number.isInteger?e=>Number.isInteger(e):e=>"number"==typeof e&&isFinite(e)&&Math.floor(e)===e,e.joinValues=function(e,t=" | "){return e.map((e=>"string"==typeof e?`'${e}'`:e)).join(t)},e.jsonStringifyReplacer=(e,t)=>"bigint"==typeof t?t.toString():t}(util||(util={})),function(e){e.mergeShapes=(e,t)=>({...e,...t})}(objectUtil||(objectUtil={}));const ZodParsedType=util.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),getParsedType=e=>{switch(typeof e){case"undefined":return ZodParsedType.undefined;case"string":return ZodParsedType.string;case"number":return isNaN(e)?ZodParsedType.nan:ZodParsedType.number;case"boolean":return ZodParsedType.boolean;case"function":return ZodParsedType.function;case"bigint":return ZodParsedType.bigint;case"symbol":return ZodParsedType.symbol;case"object":return Array.isArray(e)?ZodParsedType.array:null===e?ZodParsedType.null:e.then&&"function"==typeof e.then&&e.catch&&"function"==typeof e.catch?ZodParsedType.promise:"undefined"!=typeof Map&&e instanceof Map?ZodParsedType.map:"undefined"!=typeof Set&&e instanceof Set?ZodParsedType.set:"undefined"!=typeof Date&&e instanceof Date?ZodParsedType.date:ZodParsedType.object;default:return ZodParsedType.unknown}},ZodIssueCode=util.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),quotelessJson=e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:");class ZodError extends Error{constructor(e){super(),this.issues=[],this.addIssue=e=>{this.issues=[...this.issues,e]},this.addIssues=(e=[])=>{this.issues=[...this.issues,...e]};const t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}get errors(){return this.issues}format(e){const t=e||function(e){return e.message},r={_errors:[]},n=e=>{for(const i of e.issues)if("invalid_union"===i.code)i.unionErrors.map(n);else if("invalid_return_type"===i.code)n(i.returnTypeError);else if("invalid_arguments"===i.code)n(i.argumentsError);else if(0===i.path.length)r._errors.push(t(i));else{let e=r,n=0;for(;n<i.path.length;){const r=i.path[n];n===i.path.length-1?(e[r]=e[r]||{_errors:[]},e[r]._errors.push(t(i))):e[r]=e[r]||{_errors:[]},e=e[r],n++}}};return n(this),r}toString(){return this.message}get message(){return JSON.stringify(this.issues,util.jsonStringifyReplacer,2)}get isEmpty(){return 0===this.issues.length}flatten(e=(e=>e.message)){const t={},r=[];for(const n of this.issues)n.path.length>0?(t[n.path[0]]=t[n.path[0]]||[],t[n.path[0]].push(e(n))):r.push(e(n));return{formErrors:r,fieldErrors:t}}get formErrors(){return this.flatten()}}ZodError.create=e=>new ZodError(e);const errorMap=(e,t)=>{let r;switch(e.code){case ZodIssueCode.invalid_type:r=e.received===ZodParsedType.undefined?"Required":`Expected ${e.expected}, received ${e.received}`;break;case ZodIssueCode.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(e.expected,util.jsonStringifyReplacer)}`;break;case ZodIssueCode.unrecognized_keys:r=`Unrecognized key(s) in object: ${util.joinValues(e.keys,", ")}`;break;case ZodIssueCode.invalid_union:r="Invalid input";break;case ZodIssueCode.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${util.joinValues(e.options)}`;break;case ZodIssueCode.invalid_enum_value:r=`Invalid enum value. Expected ${util.joinValues(e.options)}, received '${e.received}'`;break;case ZodIssueCode.invalid_arguments:r="Invalid function arguments";break;case ZodIssueCode.invalid_return_type:r="Invalid function return type";break;case ZodIssueCode.invalid_date:r="Invalid date";break;case ZodIssueCode.invalid_string:"object"==typeof e.validation?"includes"in e.validation?(r=`Invalid input: must include "${e.validation.includes}"`,"number"==typeof e.validation.position&&(r=`${r} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?r=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?r=`Invalid input: must end with "${e.validation.endsWith}"`:util.assertNever(e.validation):r="regex"!==e.validation?`Invalid ${e.validation}`:"Invalid";break;case ZodIssueCode.too_small:r="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:"number"===e.type?`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:"date"===e.type?`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:"Invalid input";break;case ZodIssueCode.too_big:r="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:"number"===e.type?`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"bigint"===e.type?`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"date"===e.type?`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:"Invalid input";break;case ZodIssueCode.custom:r="Invalid input";break;case ZodIssueCode.invalid_intersection_types:r="Intersection results could not be merged";break;case ZodIssueCode.not_multiple_of:r=`Number must be a multiple of ${e.multipleOf}`;break;case ZodIssueCode.not_finite:r="Number must be finite";break;default:r=t.defaultError,util.assertNever(e)}return{message:r}};let overrideErrorMap=errorMap;function setErrorMap(e){overrideErrorMap=e}function getErrorMap(){return overrideErrorMap}const makeIssue=e=>{const{data:t,path:r,errorMaps:n,issueData:i}=e,s=[...r,...i.path||[]],a={...i,path:s};let o="";const l=n.filter((e=>!!e)).slice().reverse();for(const e of l)o=e(a,{data:t,defaultError:o}).message;return{...i,path:s,message:i.message||o}},EMPTY_PATH=[];function addIssueToContext(e,t){const r=makeIssue({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,getErrorMap(),errorMap].filter((e=>!!e))});e.common.issues.push(r)}class ParseStatus{constructor(){this.value="valid"}dirty(){"valid"===this.value&&(this.value="dirty")}abort(){"aborted"!==this.value&&(this.value="aborted")}static mergeArray(e,t){const r=[];for(const n of t){if("aborted"===n.status)return INVALID;"dirty"===n.status&&e.dirty(),r.push(n.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,t){const r=[];for(const e of t)r.push({key:await e.key,value:await e.value});return ParseStatus.mergeObjectSync(e,r)}static mergeObjectSync(e,t){const r={};for(const n of t){const{key:t,value:i}=n;if("aborted"===t.status)return INVALID;if("aborted"===i.status)return INVALID;"dirty"===t.status&&e.dirty(),"dirty"===i.status&&e.dirty(),(void 0!==i.value||n.alwaysSet)&&(r[t.value]=i.value)}return{status:e.value,value:r}}}const INVALID=Object.freeze({status:"aborted"}),DIRTY=e=>({status:"dirty",value:e}),OK=e=>({status:"valid",value:e}),isAborted=e=>"aborted"===e.status,isDirty=e=>"dirty"===e.status,isValid=e=>"valid"===e.status,isAsync=e=>"undefined"!=typeof Promise&&e instanceof Promise;var errorUtil;!function(e){e.errToObj=e=>"string"==typeof e?{message:e}:e||{},e.toString=e=>"string"==typeof e?e:null==e?void 0:e.message}(errorUtil||(errorUtil={}));class ParseInputLazyPath{constructor(e,t,r,n){this._cachedPath=[],this.parent=e,this.data=t,this._path=r,this._key=n}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const handleResult=(e,t)=>{if(isValid(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const t=new ZodError(e.common.issues);return this._error=t,this._error}}};function processCreateParams(e){if(!e)return{};const{errorMap:t,invalid_type_error:r,required_error:n,description:i}=e;if(t&&(r||n))throw new Error('Can\'t use "invalid_type_error" or "required_error" in conjunction with custom error map.');if(t)return{errorMap:t,description:i};return{errorMap:(e,t)=>"invalid_type"!==e.code?{message:t.defaultError}:void 0===t.data?{message:null!=n?n:t.defaultError}:{message:null!=r?r:t.defaultError},description:i}}class ZodType{constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this)}get description(){return this._def.description}_getType(e){return getParsedType(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:getParsedType(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new ParseStatus,ctx:{common:e.parent.common,data:e.data,parsedType:getParsedType(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(isAsync(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){const t=this._parse(e);return Promise.resolve(t)}parse(e,t){const r=this.safeParse(e,t);if(r.success)return r.data;throw r.error}safeParse(e,t){var r;const n={common:{issues:[],async:null!==(r=null==t?void 0:t.async)&&void 0!==r&&r,contextualErrorMap:null==t?void 0:t.errorMap},path:(null==t?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:getParsedType(e)},i=this._parseSync({data:e,path:n.path,parent:n});return handleResult(n,i)}async parseAsync(e,t){const r=await this.safeParseAsync(e,t);if(r.success)return r.data;throw r.error}async safeParseAsync(e,t){const r={common:{issues:[],contextualErrorMap:null==t?void 0:t.errorMap,async:!0},path:(null==t?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:getParsedType(e)},n=this._parse({data:e,path:r.path,parent:r}),i=await(isAsync(n)?n:Promise.resolve(n));return handleResult(r,i)}refine(e,t){const r=e=>"string"==typeof t||void 0===t?{message:t}:"function"==typeof t?t(e):t;return this._refinement(((t,n)=>{const i=e(t),s=()=>n.addIssue({code:ZodIssueCode.custom,...r(t)});return"undefined"!=typeof Promise&&i instanceof Promise?i.then((e=>!!e||(s(),!1))):!!i||(s(),!1)}))}refinement(e,t){return this._refinement(((r,n)=>!!e(r)||(n.addIssue("function"==typeof t?t(r,n):t),!1)))}_refinement(e){return new ZodEffects({schema:this,typeName:ZodFirstPartyTypeKind.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}optional(){return ZodOptional.create(this,this._def)}nullable(){return ZodNullable.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return ZodArray.create(this,this._def)}promise(){return ZodPromise.create(this,this._def)}or(e){return ZodUnion.create([this,e],this._def)}and(e){return ZodIntersection.create(this,e,this._def)}transform(e){return new ZodEffects({...processCreateParams(this._def),schema:this,typeName:ZodFirstPartyTypeKind.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t="function"==typeof e?e:()=>e;return new ZodDefault({...processCreateParams(this._def),innerType:this,defaultValue:t,typeName:ZodFirstPartyTypeKind.ZodDefault})}brand(){return new ZodBranded({typeName:ZodFirstPartyTypeKind.ZodBranded,type:this,...processCreateParams(this._def)})}catch(e){const t="function"==typeof e?e:()=>e;return new ZodCatch({...processCreateParams(this._def),innerType:this,catchValue:t,typeName:ZodFirstPartyTypeKind.ZodCatch})}describe(e){return new(0,this.constructor)({...this._def,description:e})}pipe(e){return ZodPipeline.create(this,e)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const cuidRegex=/^c[^\s-]{8,}$/i,cuid2Regex=/^[a-z][a-z0-9]*$/,ulidRegex=/[0-9A-HJKMNP-TV-Z]{26}/,uuidRegex=/^([a-f0-9]{8}-[a-f0-9]{4}-[1-5][a-f0-9]{3}-[a-f0-9]{4}-[a-f0-9]{12}|00000000-0000-0000-0000-000000000000)$/i,emailRegex=/^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\])|(\[IPv6:(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))\])|([A-Za-z0-9]([A-Za-z0-9-]*[A-Za-z0-9])*(\.[A-Za-z]{2,})+))$/,emojiRegex=/^(\p{Extended_Pictographic}|\p{Emoji_Component})+$/u,ipv4Regex=/^(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))$/,ipv6Regex=/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,datetimeRegex=e=>e.precision?e.offset?new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${e.precision}}(([+-]\\d{2}(:?\\d{2})?)|Z)$`):new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${e.precision}}Z$`):0===e.precision?e.offset?new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(([+-]\\d{2}(:?\\d{2})?)|Z)$"):new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}Z$"):e.offset?new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(([+-]\\d{2}(:?\\d{2})?)|Z)$"):new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$");function isValidIP(e,t){return!("v4"!==t&&t||!ipv4Regex.test(e))||!("v6"!==t&&t||!ipv6Regex.test(e))}class ZodString extends ZodType{constructor(){super(...arguments),this._regex=(e,t,r)=>this.refinement((t=>e.test(t)),{validation:t,code:ZodIssueCode.invalid_string,...errorUtil.errToObj(r)}),this.nonempty=e=>this.min(1,errorUtil.errToObj(e)),this.trim=()=>new ZodString({...this._def,checks:[...this._def.checks,{kind:"trim"}]}),this.toLowerCase=()=>new ZodString({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]}),this.toUpperCase=()=>new ZodString({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}_parse(e){this._def.coerce&&(e.data=String(e.data));if(this._getType(e)!==ZodParsedType.string){const t=this._getOrReturnCtx(e);return addIssueToContext(t,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.string,received:t.parsedType}),INVALID}const t=new ParseStatus;let r;for(const n of this._def.checks)if("min"===n.kind)e.data.length<n.value&&(r=this._getOrReturnCtx(e,r),addIssueToContext(r,{code:ZodIssueCode.too_small,minimum:n.value,type:"string",inclusive:!0,exact:!1,message:n.message}),t.dirty());else if("max"===n.kind)e.data.length>n.value&&(r=this._getOrReturnCtx(e,r),addIssueToContext(r,{code:ZodIssueCode.too_big,maximum:n.value,type:"string",inclusive:!0,exact:!1,message:n.message}),t.dirty());else if("length"===n.kind){const i=e.data.length>n.value,s=e.data.length<n.value;(i||s)&&(r=this._getOrReturnCtx(e,r),i?addIssueToContext(r,{code:ZodIssueCode.too_big,maximum:n.value,type:"string",inclusive:!0,exact:!0,message:n.message}):s&&addIssueToContext(r,{code:ZodIssueCode.too_small,minimum:n.value,type:"string",inclusive:!0,exact:!0,message:n.message}),t.dirty())}else if("email"===n.kind)emailRegex.test(e.data)||(r=this._getOrReturnCtx(e,r),addIssueToContext(r,{validation:"email",code:ZodIssueCode.invalid_string,message:n.message}),t.dirty());else if("emoji"===n.kind)emojiRegex.test(e.data)||(r=this._getOrReturnCtx(e,r),addIssueToContext(r,{validation:"emoji",code:ZodIssueCode.invalid_string,message:n.message}),t.dirty());else if("uuid"===n.kind)uuidRegex.test(e.data)||(r=this._getOrReturnCtx(e,r),addIssueToContext(r,{validation:"uuid",code:ZodIssueCode.invalid_string,message:n.message}),t.dirty());else if("cuid"===n.kind)cuidRegex.test(e.data)||(r=this._getOrReturnCtx(e,r),addIssueToContext(r,{validation:"cuid",code:ZodIssueCode.invalid_string,message:n.message}),t.dirty());else if("cuid2"===n.kind)cuid2Regex.test(e.data)||(r=this._getOrReturnCtx(e,r),addIssueToContext(r,{validation:"cuid2",code:ZodIssueCode.invalid_string,message:n.message}),t.dirty());else if("ulid"===n.kind)ulidRegex.test(e.data)||(r=this._getOrReturnCtx(e,r),addIssueToContext(r,{validation:"ulid",code:ZodIssueCode.invalid_string,message:n.message}),t.dirty());else if("url"===n.kind)try{new URL(e.data)}catch(i){r=this._getOrReturnCtx(e,r),addIssueToContext(r,{validation:"url",code:ZodIssueCode.invalid_string,message:n.message}),t.dirty()}else if("regex"===n.kind){n.regex.lastIndex=0;n.regex.test(e.data)||(r=this._getOrReturnCtx(e,r),addIssueToContext(r,{validation:"regex",code:ZodIssueCode.invalid_string,message:n.message}),t.dirty())}else if("trim"===n.kind)e.data=e.data.trim();else if("includes"===n.kind)e.data.includes(n.value,n.position)||(r=this._getOrReturnCtx(e,r),addIssueToContext(r,{code:ZodIssueCode.invalid_string,validation:{includes:n.value,position:n.position},message:n.message}),t.dirty());else if("toLowerCase"===n.kind)e.data=e.data.toLowerCase();else if("toUpperCase"===n.kind)e.data=e.data.toUpperCase();else if("startsWith"===n.kind)e.data.startsWith(n.value)||(r=this._getOrReturnCtx(e,r),addIssueToContext(r,{code:ZodIssueCode.invalid_string,validation:{startsWith:n.value},message:n.message}),t.dirty());else if("endsWith"===n.kind)e.data.endsWith(n.value)||(r=this._getOrReturnCtx(e,r),addIssueToContext(r,{code:ZodIssueCode.invalid_string,validation:{endsWith:n.value},message:n.message}),t.dirty());else if("datetime"===n.kind){datetimeRegex(n).test(e.data)||(r=this._getOrReturnCtx(e,r),addIssueToContext(r,{code:ZodIssueCode.invalid_string,validation:"datetime",message:n.message}),t.dirty())}else"ip"===n.kind?isValidIP(e.data,n.version)||(r=this._getOrReturnCtx(e,r),addIssueToContext(r,{validation:"ip",code:ZodIssueCode.invalid_string,message:n.message}),t.dirty()):util.assertNever(n);return{status:t.value,value:e.data}}_addCheck(e){return new ZodString({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...errorUtil.errToObj(e)})}url(e){return this._addCheck({kind:"url",...errorUtil.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...errorUtil.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...errorUtil.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...errorUtil.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...errorUtil.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...errorUtil.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...errorUtil.errToObj(e)})}datetime(e){var t;return"string"==typeof e?this._addCheck({kind:"datetime",precision:null,offset:!1,message:e}):this._addCheck({kind:"datetime",precision:void 0===(null==e?void 0:e.precision)?null:null==e?void 0:e.precision,offset:null!==(t=null==e?void 0:e.offset)&&void 0!==t&&t,...errorUtil.errToObj(null==e?void 0:e.message)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...errorUtil.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:null==t?void 0:t.position,...errorUtil.errToObj(null==t?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...errorUtil.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...errorUtil.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...errorUtil.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...errorUtil.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...errorUtil.errToObj(t)})}get isDatetime(){return!!this._def.checks.find((e=>"datetime"===e.kind))}get isEmail(){return!!this._def.checks.find((e=>"email"===e.kind))}get isURL(){return!!this._def.checks.find((e=>"url"===e.kind))}get isEmoji(){return!!this._def.checks.find((e=>"emoji"===e.kind))}get isUUID(){return!!this._def.checks.find((e=>"uuid"===e.kind))}get isCUID(){return!!this._def.checks.find((e=>"cuid"===e.kind))}get isCUID2(){return!!this._def.checks.find((e=>"cuid2"===e.kind))}get isULID(){return!!this._def.checks.find((e=>"ulid"===e.kind))}get isIP(){return!!this._def.checks.find((e=>"ip"===e.kind))}get minLength(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}}function floatSafeRemainder(e,t){const r=(e.toString().split(".")[1]||"").length,n=(t.toString().split(".")[1]||"").length,i=r>n?r:n;return parseInt(e.toFixed(i).replace(".",""))%parseInt(t.toFixed(i).replace(".",""))/Math.pow(10,i)}ZodString.create=e=>{var t;return new ZodString({checks:[],typeName:ZodFirstPartyTypeKind.ZodString,coerce:null!==(t=null==e?void 0:e.coerce)&&void 0!==t&&t,...processCreateParams(e)})};class ZodNumber extends ZodType{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){this._def.coerce&&(e.data=Number(e.data));if(this._getType(e)!==ZodParsedType.number){const t=this._getOrReturnCtx(e);return addIssueToContext(t,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.number,received:t.parsedType}),INVALID}let t;const r=new ParseStatus;for(const n of this._def.checks)if("int"===n.kind)util.isInteger(e.data)||(t=this._getOrReturnCtx(e,t),addIssueToContext(t,{code:ZodIssueCode.invalid_type,expected:"integer",received:"float",message:n.message}),r.dirty());else if("min"===n.kind){(n.inclusive?e.data<n.value:e.data<=n.value)&&(t=this._getOrReturnCtx(e,t),addIssueToContext(t,{code:ZodIssueCode.too_small,minimum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),r.dirty())}else if("max"===n.kind){(n.inclusive?e.data>n.value:e.data>=n.value)&&(t=this._getOrReturnCtx(e,t),addIssueToContext(t,{code:ZodIssueCode.too_big,maximum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),r.dirty())}else"multipleOf"===n.kind?0!==floatSafeRemainder(e.data,n.value)&&(t=this._getOrReturnCtx(e,t),addIssueToContext(t,{code:ZodIssueCode.not_multiple_of,multipleOf:n.value,message:n.message}),r.dirty()):"finite"===n.kind?Number.isFinite(e.data)||(t=this._getOrReturnCtx(e,t),addIssueToContext(t,{code:ZodIssueCode.not_finite,message:n.message}),r.dirty()):util.assertNever(n);return{status:r.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,errorUtil.toString(t))}gt(e,t){return this.setLimit("min",e,!1,errorUtil.toString(t))}lte(e,t){return this.setLimit("max",e,!0,errorUtil.toString(t))}lt(e,t){return this.setLimit("max",e,!1,errorUtil.toString(t))}setLimit(e,t,r,n){return new ZodNumber({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:errorUtil.toString(n)}]})}_addCheck(e){return new ZodNumber({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:errorUtil.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:errorUtil.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:errorUtil.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:errorUtil.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:errorUtil.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:errorUtil.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:errorUtil.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:errorUtil.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:errorUtil.toString(e)})}get minValue(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find((e=>"int"===e.kind||"multipleOf"===e.kind&&util.isInteger(e.value)))}get isFinite(){let e=null,t=null;for(const r of this._def.checks){if("finite"===r.kind||"int"===r.kind||"multipleOf"===r.kind)return!0;"min"===r.kind?(null===t||r.value>t)&&(t=r.value):"max"===r.kind&&(null===e||r.value<e)&&(e=r.value)}return Number.isFinite(t)&&Number.isFinite(e)}}ZodNumber.create=e=>new ZodNumber({checks:[],typeName:ZodFirstPartyTypeKind.ZodNumber,coerce:(null==e?void 0:e.coerce)||!1,...processCreateParams(e)});class ZodBigInt extends ZodType{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){this._def.coerce&&(e.data=BigInt(e.data));if(this._getType(e)!==ZodParsedType.bigint){const t=this._getOrReturnCtx(e);return addIssueToContext(t,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.bigint,received:t.parsedType}),INVALID}let t;const r=new ParseStatus;for(const n of this._def.checks)if("min"===n.kind){(n.inclusive?e.data<n.value:e.data<=n.value)&&(t=this._getOrReturnCtx(e,t),addIssueToContext(t,{code:ZodIssueCode.too_small,type:"bigint",minimum:n.value,inclusive:n.inclusive,message:n.message}),r.dirty())}else if("max"===n.kind){(n.inclusive?e.data>n.value:e.data>=n.value)&&(t=this._getOrReturnCtx(e,t),addIssueToContext(t,{code:ZodIssueCode.too_big,type:"bigint",maximum:n.value,inclusive:n.inclusive,message:n.message}),r.dirty())}else"multipleOf"===n.kind?e.data%n.value!==BigInt(0)&&(t=this._getOrReturnCtx(e,t),addIssueToContext(t,{code:ZodIssueCode.not_multiple_of,multipleOf:n.value,message:n.message}),r.dirty()):util.assertNever(n);return{status:r.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,errorUtil.toString(t))}gt(e,t){return this.setLimit("min",e,!1,errorUtil.toString(t))}lte(e,t){return this.setLimit("max",e,!0,errorUtil.toString(t))}lt(e,t){return this.setLimit("max",e,!1,errorUtil.toString(t))}setLimit(e,t,r,n){return new ZodBigInt({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:errorUtil.toString(n)}]})}_addCheck(e){return new ZodBigInt({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:errorUtil.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:errorUtil.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:errorUtil.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:errorUtil.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:errorUtil.toString(t)})}get minValue(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}}ZodBigInt.create=e=>{var t;return new ZodBigInt({checks:[],typeName:ZodFirstPartyTypeKind.ZodBigInt,coerce:null!==(t=null==e?void 0:e.coerce)&&void 0!==t&&t,...processCreateParams(e)})};class ZodBoolean extends ZodType{_parse(e){this._def.coerce&&(e.data=Boolean(e.data));if(this._getType(e)!==ZodParsedType.boolean){const t=this._getOrReturnCtx(e);return addIssueToContext(t,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.boolean,received:t.parsedType}),INVALID}return OK(e.data)}}ZodBoolean.create=e=>new ZodBoolean({typeName:ZodFirstPartyTypeKind.ZodBoolean,coerce:(null==e?void 0:e.coerce)||!1,...processCreateParams(e)});class ZodDate extends ZodType{_parse(e){this._def.coerce&&(e.data=new Date(e.data));if(this._getType(e)!==ZodParsedType.date){const t=this._getOrReturnCtx(e);return addIssueToContext(t,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.date,received:t.parsedType}),INVALID}if(isNaN(e.data.getTime())){return addIssueToContext(this._getOrReturnCtx(e),{code:ZodIssueCode.invalid_date}),INVALID}const t=new ParseStatus;let r;for(const n of this._def.checks)"min"===n.kind?e.data.getTime()<n.value&&(r=this._getOrReturnCtx(e,r),addIssueToContext(r,{code:ZodIssueCode.too_small,message:n.message,inclusive:!0,exact:!1,minimum:n.value,type:"date"}),t.dirty()):"max"===n.kind?e.data.getTime()>n.value&&(r=this._getOrReturnCtx(e,r),addIssueToContext(r,{code:ZodIssueCode.too_big,message:n.message,inclusive:!0,exact:!1,maximum:n.value,type:"date"}),t.dirty()):util.assertNever(n);return{status:t.value,value:new Date(e.data.getTime())}}_addCheck(e){return new ZodDate({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:errorUtil.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:errorUtil.toString(t)})}get minDate(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return null!=e?new Date(e):null}get maxDate(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return null!=e?new Date(e):null}}ZodDate.create=e=>new ZodDate({checks:[],coerce:(null==e?void 0:e.coerce)||!1,typeName:ZodFirstPartyTypeKind.ZodDate,...processCreateParams(e)});class ZodSymbol extends ZodType{_parse(e){if(this._getType(e)!==ZodParsedType.symbol){const t=this._getOrReturnCtx(e);return addIssueToContext(t,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.symbol,received:t.parsedType}),INVALID}return OK(e.data)}}ZodSymbol.create=e=>new ZodSymbol({typeName:ZodFirstPartyTypeKind.ZodSymbol,...processCreateParams(e)});class ZodUndefined extends ZodType{_parse(e){if(this._getType(e)!==ZodParsedType.undefined){const t=this._getOrReturnCtx(e);return addIssueToContext(t,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.undefined,received:t.parsedType}),INVALID}return OK(e.data)}}ZodUndefined.create=e=>new ZodUndefined({typeName:ZodFirstPartyTypeKind.ZodUndefined,...processCreateParams(e)});class ZodNull extends ZodType{_parse(e){if(this._getType(e)!==ZodParsedType.null){const t=this._getOrReturnCtx(e);return addIssueToContext(t,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.null,received:t.parsedType}),INVALID}return OK(e.data)}}ZodNull.create=e=>new ZodNull({typeName:ZodFirstPartyTypeKind.ZodNull,...processCreateParams(e)});class ZodAny extends ZodType{constructor(){super(...arguments),this._any=!0}_parse(e){return OK(e.data)}}ZodAny.create=e=>new ZodAny({typeName:ZodFirstPartyTypeKind.ZodAny,...processCreateParams(e)});class ZodUnknown extends ZodType{constructor(){super(...arguments),this._unknown=!0}_parse(e){return OK(e.data)}}ZodUnknown.create=e=>new ZodUnknown({typeName:ZodFirstPartyTypeKind.ZodUnknown,...processCreateParams(e)});class ZodNever extends ZodType{_parse(e){const t=this._getOrReturnCtx(e);return addIssueToContext(t,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.never,received:t.parsedType}),INVALID}}ZodNever.create=e=>new ZodNever({typeName:ZodFirstPartyTypeKind.ZodNever,...processCreateParams(e)});class ZodVoid extends ZodType{_parse(e){if(this._getType(e)!==ZodParsedType.undefined){const t=this._getOrReturnCtx(e);return addIssueToContext(t,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.void,received:t.parsedType}),INVALID}return OK(e.data)}}ZodVoid.create=e=>new ZodVoid({typeName:ZodFirstPartyTypeKind.ZodVoid,...processCreateParams(e)});class ZodArray extends ZodType{_parse(e){const{ctx:t,status:r}=this._processInputParams(e),n=this._def;if(t.parsedType!==ZodParsedType.array)return addIssueToContext(t,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.array,received:t.parsedType}),INVALID;if(null!==n.exactLength){const e=t.data.length>n.exactLength.value,i=t.data.length<n.exactLength.value;(e||i)&&(addIssueToContext(t,{code:e?ZodIssueCode.too_big:ZodIssueCode.too_small,minimum:i?n.exactLength.value:void 0,maximum:e?n.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:n.exactLength.message}),r.dirty())}if(null!==n.minLength&&t.data.length<n.minLength.value&&(addIssueToContext(t,{code:ZodIssueCode.too_small,minimum:n.minLength.value,type:"array",inclusive:!0,exact:!1,message:n.minLength.message}),r.dirty()),null!==n.maxLength&&t.data.length>n.maxLength.value&&(addIssueToContext(t,{code:ZodIssueCode.too_big,maximum:n.maxLength.value,type:"array",inclusive:!0,exact:!1,message:n.maxLength.message}),r.dirty()),t.common.async)return Promise.all([...t.data].map(((e,r)=>n.type._parseAsync(new ParseInputLazyPath(t,e,t.path,r))))).then((e=>ParseStatus.mergeArray(r,e)));const i=[...t.data].map(((e,r)=>n.type._parseSync(new ParseInputLazyPath(t,e,t.path,r))));return ParseStatus.mergeArray(r,i)}get element(){return this._def.type}min(e,t){return new ZodArray({...this._def,minLength:{value:e,message:errorUtil.toString(t)}})}max(e,t){return new ZodArray({...this._def,maxLength:{value:e,message:errorUtil.toString(t)}})}length(e,t){return new ZodArray({...this._def,exactLength:{value:e,message:errorUtil.toString(t)}})}nonempty(e){return this.min(1,e)}}function deepPartialify(e){if(e instanceof ZodObject){const t={};for(const r in e.shape){const n=e.shape[r];t[r]=ZodOptional.create(deepPartialify(n))}return new ZodObject({...e._def,shape:()=>t})}return e instanceof ZodArray?new ZodArray({...e._def,type:deepPartialify(e.element)}):e instanceof ZodOptional?ZodOptional.create(deepPartialify(e.unwrap())):e instanceof ZodNullable?ZodNullable.create(deepPartialify(e.unwrap())):e instanceof ZodTuple?ZodTuple.create(e.items.map((e=>deepPartialify(e)))):e}ZodArray.create=(e,t)=>new ZodArray({type:e,minLength:null,maxLength:null,exactLength:null,typeName:ZodFirstPartyTypeKind.ZodArray,...processCreateParams(t)});class ZodObject extends ZodType{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(null!==this._cached)return this._cached;const e=this._def.shape(),t=util.objectKeys(e);return this._cached={shape:e,keys:t}}_parse(e){if(this._getType(e)!==ZodParsedType.object){const t=this._getOrReturnCtx(e);return addIssueToContext(t,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.object,received:t.parsedType}),INVALID}const{status:t,ctx:r}=this._processInputParams(e),{shape:n,keys:i}=this._getCached(),s=[];if(!(this._def.catchall instanceof ZodNever&&"strip"===this._def.unknownKeys))for(const e in r.data)i.includes(e)||s.push(e);const a=[];for(const e of i){const t=n[e],i=r.data[e];a.push({key:{status:"valid",value:e},value:t._parse(new ParseInputLazyPath(r,i,r.path,e)),alwaysSet:e in r.data})}if(this._def.catchall instanceof ZodNever){const e=this._def.unknownKeys;if("passthrough"===e)for(const e of s)a.push({key:{status:"valid",value:e},value:{status:"valid",value:r.data[e]}});else if("strict"===e)s.length>0&&(addIssueToContext(r,{code:ZodIssueCode.unrecognized_keys,keys:s}),t.dirty());else if("strip"!==e)throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const e=this._def.catchall;for(const t of s){const n=r.data[t];a.push({key:{status:"valid",value:t},value:e._parse(new ParseInputLazyPath(r,n,r.path,t)),alwaysSet:t in r.data})}}return r.common.async?Promise.resolve().then((async()=>{const e=[];for(const t of a){const r=await t.key;e.push({key:r,value:await t.value,alwaysSet:t.alwaysSet})}return e})).then((e=>ParseStatus.mergeObjectSync(t,e))):ParseStatus.mergeObjectSync(t,a)}get shape(){return this._def.shape()}strict(e){return errorUtil.errToObj,new ZodObject({...this._def,unknownKeys:"strict",...void 0!==e?{errorMap:(t,r)=>{var n,i,s,a;const o=null!==(s=null===(i=(n=this._def).errorMap)||void 0===i?void 0:i.call(n,t,r).message)&&void 0!==s?s:r.defaultError;return"unrecognized_keys"===t.code?{message:null!==(a=errorUtil.errToObj(e).message)&&void 0!==a?a:o}:{message:o}}}:{}})}strip(){return new ZodObject({...this._def,unknownKeys:"strip"})}passthrough(){return new ZodObject({...this._def,unknownKeys:"passthrough"})}extend(e){return new ZodObject({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new ZodObject({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:ZodFirstPartyTypeKind.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new ZodObject({...this._def,catchall:e})}pick(e){const t={};return util.objectKeys(e).forEach((r=>{e[r]&&this.shape[r]&&(t[r]=this.shape[r])})),new ZodObject({...this._def,shape:()=>t})}omit(e){const t={};return util.objectKeys(this.shape).forEach((r=>{e[r]||(t[r]=this.shape[r])})),new ZodObject({...this._def,shape:()=>t})}deepPartial(){return deepPartialify(this)}partial(e){const t={};return util.objectKeys(this.shape).forEach((r=>{const n=this.shape[r];e&&!e[r]?t[r]=n:t[r]=n.optional()})),new ZodObject({...this._def,shape:()=>t})}required(e){const t={};return util.objectKeys(this.shape).forEach((r=>{if(e&&!e[r])t[r]=this.shape[r];else{let e=this.shape[r];for(;e instanceof ZodOptional;)e=e._def.innerType;t[r]=e}})),new ZodObject({...this._def,shape:()=>t})}keyof(){return createZodEnum(util.objectKeys(this.shape))}}ZodObject.create=(e,t)=>new ZodObject({shape:()=>e,unknownKeys:"strip",catchall:ZodNever.create(),typeName:ZodFirstPartyTypeKind.ZodObject,...processCreateParams(t)}),ZodObject.strictCreate=(e,t)=>new ZodObject({shape:()=>e,unknownKeys:"strict",catchall:ZodNever.create(),typeName:ZodFirstPartyTypeKind.ZodObject,...processCreateParams(t)}),ZodObject.lazycreate=(e,t)=>new ZodObject({shape:e,unknownKeys:"strip",catchall:ZodNever.create(),typeName:ZodFirstPartyTypeKind.ZodObject,...processCreateParams(t)});class ZodUnion extends ZodType{_parse(e){const{ctx:t}=this._processInputParams(e),r=this._def.options;if(t.common.async)return Promise.all(r.map((async e=>{const r={...t,common:{...t.common,issues:[]},parent:null};return{result:await e._parseAsync({data:t.data,path:t.path,parent:r}),ctx:r}}))).then((function(e){for(const t of e)if("valid"===t.result.status)return t.result;for(const r of e)if("dirty"===r.result.status)return t.common.issues.push(...r.ctx.common.issues),r.result;const r=e.map((e=>new ZodError(e.ctx.common.issues)));return addIssueToContext(t,{code:ZodIssueCode.invalid_union,unionErrors:r}),INVALID}));{let e;const n=[];for(const i of r){const r={...t,common:{...t.common,issues:[]},parent:null},s=i._parseSync({data:t.data,path:t.path,parent:r});if("valid"===s.status)return s;"dirty"!==s.status||e||(e={result:s,ctx:r}),r.common.issues.length&&n.push(r.common.issues)}if(e)return t.common.issues.push(...e.ctx.common.issues),e.result;const i=n.map((e=>new ZodError(e)));return addIssueToContext(t,{code:ZodIssueCode.invalid_union,unionErrors:i}),INVALID}}get options(){return this._def.options}}ZodUnion.create=(e,t)=>new ZodUnion({options:e,typeName:ZodFirstPartyTypeKind.ZodUnion,...processCreateParams(t)});const getDiscriminator=e=>e instanceof ZodLazy?getDiscriminator(e.schema):e instanceof ZodEffects?getDiscriminator(e.innerType()):e instanceof ZodLiteral?[e.value]:e instanceof ZodEnum?e.options:e instanceof ZodNativeEnum?Object.keys(e.enum):e instanceof ZodDefault?getDiscriminator(e._def.innerType):e instanceof ZodUndefined?[void 0]:e instanceof ZodNull?[null]:null;class ZodDiscriminatedUnion extends ZodType{_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==ZodParsedType.object)return addIssueToContext(t,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.object,received:t.parsedType}),INVALID;const r=this.discriminator,n=t.data[r],i=this.optionsMap.get(n);return i?t.common.async?i._parseAsync({data:t.data,path:t.path,parent:t}):i._parseSync({data:t.data,path:t.path,parent:t}):(addIssueToContext(t,{code:ZodIssueCode.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),INVALID)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,r){const n=new Map;for(const r of t){const t=getDiscriminator(r.shape[e]);if(!t)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const i of t){if(n.has(i))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(i)}`);n.set(i,r)}}return new ZodDiscriminatedUnion({typeName:ZodFirstPartyTypeKind.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:n,...processCreateParams(r)})}}function mergeValues(e,t){const r=getParsedType(e),n=getParsedType(t);if(e===t)return{valid:!0,data:e};if(r===ZodParsedType.object&&n===ZodParsedType.object){const r=util.objectKeys(t),n=util.objectKeys(e).filter((e=>-1!==r.indexOf(e))),i={...e,...t};for(const r of n){const n=mergeValues(e[r],t[r]);if(!n.valid)return{valid:!1};i[r]=n.data}return{valid:!0,data:i}}if(r===ZodParsedType.array&&n===ZodParsedType.array){if(e.length!==t.length)return{valid:!1};const r=[];for(let n=0;n<e.length;n++){const i=mergeValues(e[n],t[n]);if(!i.valid)return{valid:!1};r.push(i.data)}return{valid:!0,data:r}}return r===ZodParsedType.date&&n===ZodParsedType.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}class ZodIntersection extends ZodType{_parse(e){const{status:t,ctx:r}=this._processInputParams(e),n=(e,n)=>{if(isAborted(e)||isAborted(n))return INVALID;const i=mergeValues(e.value,n.value);return i.valid?((isDirty(e)||isDirty(n))&&t.dirty(),{status:t.value,value:i.data}):(addIssueToContext(r,{code:ZodIssueCode.invalid_intersection_types}),INVALID)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then((([e,t])=>n(e,t))):n(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}ZodIntersection.create=(e,t,r)=>new ZodIntersection({left:e,right:t,typeName:ZodFirstPartyTypeKind.ZodIntersection,...processCreateParams(r)});class ZodTuple extends ZodType{_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==ZodParsedType.array)return addIssueToContext(r,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.array,received:r.parsedType}),INVALID;if(r.data.length<this._def.items.length)return addIssueToContext(r,{code:ZodIssueCode.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),INVALID;!this._def.rest&&r.data.length>this._def.items.length&&(addIssueToContext(r,{code:ZodIssueCode.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const n=[...r.data].map(((e,t)=>{const n=this._def.items[t]||this._def.rest;return n?n._parse(new ParseInputLazyPath(r,e,r.path,t)):null})).filter((e=>!!e));return r.common.async?Promise.all(n).then((e=>ParseStatus.mergeArray(t,e))):ParseStatus.mergeArray(t,n)}get items(){return this._def.items}rest(e){return new ZodTuple({...this._def,rest:e})}}ZodTuple.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new ZodTuple({items:e,typeName:ZodFirstPartyTypeKind.ZodTuple,rest:null,...processCreateParams(t)})};class ZodRecord extends ZodType{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==ZodParsedType.object)return addIssueToContext(r,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.object,received:r.parsedType}),INVALID;const n=[],i=this._def.keyType,s=this._def.valueType;for(const e in r.data)n.push({key:i._parse(new ParseInputLazyPath(r,e,r.path,e)),value:s._parse(new ParseInputLazyPath(r,r.data[e],r.path,e))});return r.common.async?ParseStatus.mergeObjectAsync(t,n):ParseStatus.mergeObjectSync(t,n)}get element(){return this._def.valueType}static create(e,t,r){return new ZodRecord(t instanceof ZodType?{keyType:e,valueType:t,typeName:ZodFirstPartyTypeKind.ZodRecord,...processCreateParams(r)}:{keyType:ZodString.create(),valueType:e,typeName:ZodFirstPartyTypeKind.ZodRecord,...processCreateParams(t)})}}class ZodMap extends ZodType{_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==ZodParsedType.map)return addIssueToContext(r,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.map,received:r.parsedType}),INVALID;const n=this._def.keyType,i=this._def.valueType,s=[...r.data.entries()].map((([e,t],s)=>({key:n._parse(new ParseInputLazyPath(r,e,r.path,[s,"key"])),value:i._parse(new ParseInputLazyPath(r,t,r.path,[s,"value"]))})));if(r.common.async){const e=new Map;return Promise.resolve().then((async()=>{for(const r of s){const n=await r.key,i=await r.value;if("aborted"===n.status||"aborted"===i.status)return INVALID;"dirty"!==n.status&&"dirty"!==i.status||t.dirty(),e.set(n.value,i.value)}return{status:t.value,value:e}}))}{const e=new Map;for(const r of s){const n=r.key,i=r.value;if("aborted"===n.status||"aborted"===i.status)return INVALID;"dirty"!==n.status&&"dirty"!==i.status||t.dirty(),e.set(n.value,i.value)}return{status:t.value,value:e}}}}ZodMap.create=(e,t,r)=>new ZodMap({valueType:t,keyType:e,typeName:ZodFirstPartyTypeKind.ZodMap,...processCreateParams(r)});class ZodSet extends ZodType{_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==ZodParsedType.set)return addIssueToContext(r,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.set,received:r.parsedType}),INVALID;const n=this._def;null!==n.minSize&&r.data.size<n.minSize.value&&(addIssueToContext(r,{code:ZodIssueCode.too_small,minimum:n.minSize.value,type:"set",inclusive:!0,exact:!1,message:n.minSize.message}),t.dirty()),null!==n.maxSize&&r.data.size>n.maxSize.value&&(addIssueToContext(r,{code:ZodIssueCode.too_big,maximum:n.maxSize.value,type:"set",inclusive:!0,exact:!1,message:n.maxSize.message}),t.dirty());const i=this._def.valueType;function s(e){const r=new Set;for(const n of e){if("aborted"===n.status)return INVALID;"dirty"===n.status&&t.dirty(),r.add(n.value)}return{status:t.value,value:r}}const a=[...r.data.values()].map(((e,t)=>i._parse(new ParseInputLazyPath(r,e,r.path,t))));return r.common.async?Promise.all(a).then((e=>s(e))):s(a)}min(e,t){return new ZodSet({...this._def,minSize:{value:e,message:errorUtil.toString(t)}})}max(e,t){return new ZodSet({...this._def,maxSize:{value:e,message:errorUtil.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}ZodSet.create=(e,t)=>new ZodSet({valueType:e,minSize:null,maxSize:null,typeName:ZodFirstPartyTypeKind.ZodSet,...processCreateParams(t)});class ZodFunction extends ZodType{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==ZodParsedType.function)return addIssueToContext(t,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.function,received:t.parsedType}),INVALID;function r(e,r){return makeIssue({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,getErrorMap(),errorMap].filter((e=>!!e)),issueData:{code:ZodIssueCode.invalid_arguments,argumentsError:r}})}function n(e,r){return makeIssue({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,getErrorMap(),errorMap].filter((e=>!!e)),issueData:{code:ZodIssueCode.invalid_return_type,returnTypeError:r}})}const i={errorMap:t.common.contextualErrorMap},s=t.data;return this._def.returns instanceof ZodPromise?OK((async(...e)=>{const t=new ZodError([]),a=await this._def.args.parseAsync(e,i).catch((n=>{throw t.addIssue(r(e,n)),t})),o=await s(...a),l=await this._def.returns._def.type.parseAsync(o,i).catch((e=>{throw t.addIssue(n(o,e)),t}));return l})):OK(((...e)=>{const t=this._def.args.safeParse(e,i);if(!t.success)throw new ZodError([r(e,t.error)]);const a=s(...t.data),o=this._def.returns.safeParse(a,i);if(!o.success)throw new ZodError([n(a,o.error)]);return o.data}))}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new ZodFunction({...this._def,args:ZodTuple.create(e).rest(ZodUnknown.create())})}returns(e){return new ZodFunction({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,r){return new ZodFunction({args:e||ZodTuple.create([]).rest(ZodUnknown.create()),returns:t||ZodUnknown.create(),typeName:ZodFirstPartyTypeKind.ZodFunction,...processCreateParams(r)})}}class ZodLazy extends ZodType{get schema(){return this._def.getter()}_parse(e){const{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}}ZodLazy.create=(e,t)=>new ZodLazy({getter:e,typeName:ZodFirstPartyTypeKind.ZodLazy,...processCreateParams(t)});class ZodLiteral extends ZodType{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return addIssueToContext(t,{received:t.data,code:ZodIssueCode.invalid_literal,expected:this._def.value}),INVALID}return{status:"valid",value:e.data}}get value(){return this._def.value}}function createZodEnum(e,t){return new ZodEnum({values:e,typeName:ZodFirstPartyTypeKind.ZodEnum,...processCreateParams(t)})}ZodLiteral.create=(e,t)=>new ZodLiteral({value:e,typeName:ZodFirstPartyTypeKind.ZodLiteral,...processCreateParams(t)});class ZodEnum extends ZodType{_parse(e){if("string"!=typeof e.data){const t=this._getOrReturnCtx(e),r=this._def.values;return addIssueToContext(t,{expected:util.joinValues(r),received:t.parsedType,code:ZodIssueCode.invalid_type}),INVALID}if(-1===this._def.values.indexOf(e.data)){const t=this._getOrReturnCtx(e),r=this._def.values;return addIssueToContext(t,{received:t.data,code:ZodIssueCode.invalid_enum_value,options:r}),INVALID}return OK(e.data)}get options(){return this._def.values}get enum(){const e={};for(const t of this._def.values)e[t]=t;return e}get Values(){const e={};for(const t of this._def.values)e[t]=t;return e}get Enum(){const e={};for(const t of this._def.values)e[t]=t;return e}extract(e){return ZodEnum.create(e)}exclude(e){return ZodEnum.create(this.options.filter((t=>!e.includes(t))))}}ZodEnum.create=createZodEnum;class ZodNativeEnum extends ZodType{_parse(e){const t=util.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==ZodParsedType.string&&r.parsedType!==ZodParsedType.number){const e=util.objectValues(t);return addIssueToContext(r,{expected:util.joinValues(e),received:r.parsedType,code:ZodIssueCode.invalid_type}),INVALID}if(-1===t.indexOf(e.data)){const e=util.objectValues(t);return addIssueToContext(r,{received:r.data,code:ZodIssueCode.invalid_enum_value,options:e}),INVALID}return OK(e.data)}get enum(){return this._def.values}}ZodNativeEnum.create=(e,t)=>new ZodNativeEnum({values:e,typeName:ZodFirstPartyTypeKind.ZodNativeEnum,...processCreateParams(t)});class ZodPromise extends ZodType{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==ZodParsedType.promise&&!1===t.common.async)return addIssueToContext(t,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.promise,received:t.parsedType}),INVALID;const r=t.parsedType===ZodParsedType.promise?t.data:Promise.resolve(t.data);return OK(r.then((e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap}))))}}ZodPromise.create=(e,t)=>new ZodPromise({type:e,typeName:ZodFirstPartyTypeKind.ZodPromise,...processCreateParams(t)});class ZodEffects extends ZodType{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===ZodFirstPartyTypeKind.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:r}=this._processInputParams(e),n=this._def.effect||null;if("preprocess"===n.type){const e=n.transform(r.data);return r.common.async?Promise.resolve(e).then((e=>this._def.schema._parseAsync({data:e,path:r.path,parent:r}))):this._def.schema._parseSync({data:e,path:r.path,parent:r})}const i={addIssue:e=>{addIssueToContext(r,e),e.fatal?t.abort():t.dirty()},get path(){return r.path}};if(i.addIssue=i.addIssue.bind(i),"refinement"===n.type){const e=e=>{const t=n.refinement(e,i);if(r.common.async)return Promise.resolve(t);if(t instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return e};if(!1===r.common.async){const n=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return"aborted"===n.status?INVALID:("dirty"===n.status&&t.dirty(),e(n.value),{status:t.value,value:n.value})}return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then((r=>"aborted"===r.status?INVALID:("dirty"===r.status&&t.dirty(),e(r.value).then((()=>({status:t.value,value:r.value}))))))}if("transform"===n.type){if(!1===r.common.async){const e=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!isValid(e))return e;const s=n.transform(e.value,i);if(s instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:s}}return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then((e=>isValid(e)?Promise.resolve(n.transform(e.value,i)).then((e=>({status:t.value,value:e}))):e))}util.assertNever(n)}}ZodEffects.create=(e,t,r)=>new ZodEffects({schema:e,typeName:ZodFirstPartyTypeKind.ZodEffects,effect:t,...processCreateParams(r)}),ZodEffects.createWithPreprocess=(e,t,r)=>new ZodEffects({schema:t,effect:{type:"preprocess",transform:e},typeName:ZodFirstPartyTypeKind.ZodEffects,...processCreateParams(r)});class ZodOptional extends ZodType{_parse(e){return this._getType(e)===ZodParsedType.undefined?OK(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}ZodOptional.create=(e,t)=>new ZodOptional({innerType:e,typeName:ZodFirstPartyTypeKind.ZodOptional,...processCreateParams(t)});class ZodNullable extends ZodType{_parse(e){return this._getType(e)===ZodParsedType.null?OK(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}ZodNullable.create=(e,t)=>new ZodNullable({innerType:e,typeName:ZodFirstPartyTypeKind.ZodNullable,...processCreateParams(t)});class ZodDefault extends ZodType{_parse(e){const{ctx:t}=this._processInputParams(e);let r=t.data;return t.parsedType===ZodParsedType.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}ZodDefault.create=(e,t)=>new ZodDefault({innerType:e,typeName:ZodFirstPartyTypeKind.ZodDefault,defaultValue:"function"==typeof t.default?t.default:()=>t.default,...processCreateParams(t)});class ZodCatch extends ZodType{_parse(e){const{ctx:t}=this._processInputParams(e),r={...t,common:{...t.common,issues:[]}},n=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return isAsync(n)?n.then((e=>({status:"valid",value:"valid"===e.status?e.value:this._def.catchValue({get error(){return new ZodError(r.common.issues)},input:r.data})}))):{status:"valid",value:"valid"===n.status?n.value:this._def.catchValue({get error(){return new ZodError(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}ZodCatch.create=(e,t)=>new ZodCatch({innerType:e,typeName:ZodFirstPartyTypeKind.ZodCatch,catchValue:"function"==typeof t.catch?t.catch:()=>t.catch,...processCreateParams(t)});class ZodNaN extends ZodType{_parse(e){if(this._getType(e)!==ZodParsedType.nan){const t=this._getOrReturnCtx(e);return addIssueToContext(t,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.nan,received:t.parsedType}),INVALID}return{status:"valid",value:e.data}}}ZodNaN.create=e=>new ZodNaN({typeName:ZodFirstPartyTypeKind.ZodNaN,...processCreateParams(e)});const BRAND=Symbol("zod_brand");class ZodBranded extends ZodType{_parse(e){const{ctx:t}=this._processInputParams(e),r=t.data;return this._def.type._parse({data:r,path:t.path,parent:t})}unwrap(){return this._def.type}}class ZodPipeline extends ZodType{_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.common.async){return(async()=>{const e=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return"aborted"===e.status?INVALID:"dirty"===e.status?(t.dirty(),DIRTY(e.value)):this._def.out._parseAsync({data:e.value,path:r.path,parent:r})})()}{const e=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return"aborted"===e.status?INVALID:"dirty"===e.status?(t.dirty(),{status:"dirty",value:e.value}):this._def.out._parseSync({data:e.value,path:r.path,parent:r})}}static create(e,t){return new ZodPipeline({in:e,out:t,typeName:ZodFirstPartyTypeKind.ZodPipeline})}}const custom=(e,t={},r)=>e?ZodAny.create().superRefine(((n,i)=>{var s,a;if(!e(n)){const e="function"==typeof t?t(n):"string"==typeof t?{message:t}:t,o=null===(a=null!==(s=e.fatal)&&void 0!==s?s:r)||void 0===a||a,l="string"==typeof e?{message:e}:e;i.addIssue({code:"custom",...l,fatal:o})}})):ZodAny.create(),late={object:ZodObject.lazycreate};var ZodFirstPartyTypeKind;!function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline"}(ZodFirstPartyTypeKind||(ZodFirstPartyTypeKind={}));const instanceOfType=(e,t={message:`Input not instance of ${e.name}`})=>custom((t=>t instanceof e),t),stringType=ZodString.create,numberType=ZodNumber.create,nanType=ZodNaN.create,bigIntType=ZodBigInt.create,booleanType=ZodBoolean.create,dateType=ZodDate.create,symbolType=ZodSymbol.create,undefinedType=ZodUndefined.create,nullType=ZodNull.create,anyType=ZodAny.create,unknownType=ZodUnknown.create,neverType=ZodNever.create,voidType=ZodVoid.create,arrayType=ZodArray.create,objectType=ZodObject.create,strictObjectType=ZodObject.strictCreate,unionType=ZodUnion.create,discriminatedUnionType=ZodDiscriminatedUnion.create,intersectionType=ZodIntersection.create,tupleType=ZodTuple.create,recordType=ZodRecord.create,mapType=ZodMap.create,setType=ZodSet.create,functionType=ZodFunction.create,lazyType=ZodLazy.create,literalType=ZodLiteral.create,enumType=ZodEnum.create,nativeEnumType=ZodNativeEnum.create,promiseType=ZodPromise.create,effectsType=ZodEffects.create,optionalType=ZodOptional.create,nullableType=ZodNullable.create,preprocessType=ZodEffects.createWithPreprocess,pipelineType=ZodPipeline.create,ostring=()=>stringType().optional(),onumber=()=>numberType().optional(),oboolean=()=>booleanType().optional(),coerce={string:e=>ZodString.create({...e,coerce:!0}),number:e=>ZodNumber.create({...e,coerce:!0}),boolean:e=>ZodBoolean.create({...e,coerce:!0}),bigint:e=>ZodBigInt.create({...e,coerce:!0}),date:e=>ZodDate.create({...e,coerce:!0})},NEVER=INVALID;var z=Object.freeze({__proto__:null,defaultErrorMap:errorMap,setErrorMap:setErrorMap,getErrorMap:getErrorMap,makeIssue:makeIssue,EMPTY_PATH:EMPTY_PATH,addIssueToContext:addIssueToContext,ParseStatus:ParseStatus,INVALID:INVALID,DIRTY:DIRTY,OK:OK,isAborted:isAborted,isDirty:isDirty,isValid:isValid,isAsync:isAsync,get util(){return util},get objectUtil(){return objectUtil},ZodParsedType:ZodParsedType,getParsedType:getParsedType,ZodType:ZodType,ZodString:ZodString,ZodNumber:ZodNumber,ZodBigInt:ZodBigInt,ZodBoolean:ZodBoolean,ZodDate:ZodDate,ZodSymbol:ZodSymbol,ZodUndefined:ZodUndefined,ZodNull:ZodNull,ZodAny:ZodAny,ZodUnknown:ZodUnknown,ZodNever:ZodNever,ZodVoid:ZodVoid,ZodArray:ZodArray,ZodObject:ZodObject,ZodUnion:ZodUnion,ZodDiscriminatedUnion:ZodDiscriminatedUnion,ZodIntersection:ZodIntersection,ZodTuple:ZodTuple,ZodRecord:ZodRecord,ZodMap:ZodMap,ZodSet:ZodSet,ZodFunction:ZodFunction,ZodLazy:ZodLazy,ZodLiteral:ZodLiteral,ZodEnum:ZodEnum,ZodNativeEnum:ZodNativeEnum,ZodPromise:ZodPromise,ZodEffects:ZodEffects,ZodTransformer:ZodEffects,ZodOptional:ZodOptional,ZodNullable:ZodNullable,ZodDefault:ZodDefault,ZodCatch:ZodCatch,ZodNaN:ZodNaN,BRAND:BRAND,ZodBranded:ZodBranded,ZodPipeline:ZodPipeline,custom:custom,Schema:ZodType,ZodSchema:ZodType,late:late,get ZodFirstPartyTypeKind(){return ZodFirstPartyTypeKind},coerce:coerce,any:anyType,array:arrayType,bigint:bigIntType,boolean:booleanType,date:dateType,discriminatedUnion:discriminatedUnionType,effect:effectsType,enum:enumType,function:functionType,instanceof:instanceOfType,intersection:intersectionType,lazy:lazyType,literal:literalType,map:mapType,nan:nanType,nativeEnum:nativeEnumType,never:neverType,null:nullType,nullable:nullableType,number:numberType,object:objectType,oboolean:oboolean,onumber:onumber,optional:optionalType,ostring:ostring,pipeline:pipelineType,preprocess:preprocessType,promise:promiseType,record:recordType,set:setType,strictObject:strictObjectType,string:stringType,symbol:symbolType,transformer:effectsType,tuple:tupleType,undefined:undefinedType,union:unionType,unknown:unknownType,void:voidType,NEVER:NEVER,ZodIssueCode:ZodIssueCode,quotelessJson:quotelessJson,ZodError:ZodError}),moment$1={exports:{}},module;module=moment$1,module.exports=function(){var e,t;function r(){return e.apply(null,arguments)}function n(t){e=t}function i(e){return e instanceof Array||"[object Array]"===Object.prototype.toString.call(e)}function s(e){return null!=e&&"[object Object]"===Object.prototype.toString.call(e)}function a(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function o(e){if(Object.getOwnPropertyNames)return 0===Object.getOwnPropertyNames(e).length;var t;for(t in e)if(a(e,t))return!1;return!0}function l(e){return void 0===e}function c(e){return"number"==typeof e||"[object Number]"===Object.prototype.toString.call(e)}function h(e){return e instanceof Date||"[object Date]"===Object.prototype.toString.call(e)}function d(e,t){var r,n=[],i=e.length;for(r=0;r<i;++r)n.push(t(e[r],r));return n}function u(e,t){for(var r in t)a(t,r)&&(e[r]=t[r]);return a(t,"toString")&&(e.toString=t.toString),a(t,"valueOf")&&(e.valueOf=t.valueOf),e}function p(e,t,r,n){return Zr(e,t,r,n,!0).utc()}function f(){return{empty:!1,unusedTokens:[],unusedInput:[],overflow:-2,charsLeftOver:0,nullInput:!1,invalidEra:null,invalidMonth:null,invalidFormat:!1,userInvalidated:!1,iso:!1,parsedDateParts:[],era:null,meridiem:null,rfc2822:!1,weekdayMismatch:!1}}function m(e){return null==e._pf&&(e._pf=f()),e._pf}function g(e){if(null==e._isValid){var r=m(e),n=t.call(r.parsedDateParts,(function(e){return null!=e})),i=!isNaN(e._d.getTime())&&r.overflow<0&&!r.empty&&!r.invalidEra&&!r.invalidMonth&&!r.invalidWeekday&&!r.weekdayMismatch&&!r.nullInput&&!r.invalidFormat&&!r.userInvalidated&&(!r.meridiem||r.meridiem&&n);if(e._strict&&(i=i&&0===r.charsLeftOver&&0===r.unusedTokens.length&&void 0===r.bigHour),null!=Object.isFrozen&&Object.isFrozen(e))return i;e._isValid=i}return e._isValid}function y(e){var t=p(NaN);return null!=e?u(m(t),e):m(t).userInvalidated=!0,t}t=Array.prototype.some?Array.prototype.some:function(e){var t,r=Object(this),n=r.length>>>0;for(t=0;t<n;t++)if(t in r&&e.call(this,r[t],t,r))return!0;return!1};var v=r.momentProperties=[],b=!1;function S(e,t){var r,n,i,s=v.length;if(l(t._isAMomentObject)||(e._isAMomentObject=t._isAMomentObject),l(t._i)||(e._i=t._i),l(t._f)||(e._f=t._f),l(t._l)||(e._l=t._l),l(t._strict)||(e._strict=t._strict),l(t._tzm)||(e._tzm=t._tzm),l(t._isUTC)||(e._isUTC=t._isUTC),l(t._offset)||(e._offset=t._offset),l(t._pf)||(e._pf=m(t)),l(t._locale)||(e._locale=t._locale),s>0)for(r=0;r<s;r++)l(i=t[n=v[r]])||(e[n]=i);return e}function E(e){S(this,e),this._d=new Date(null!=e._d?e._d.getTime():NaN),this.isValid()||(this._d=new Date(NaN)),!1===b&&(b=!0,r.updateOffset(this),b=!1)}function C(e){return e instanceof E||null!=e&&null!=e._isAMomentObject}function _(e){!1===r.suppressDeprecationWarnings&&"undefined"!=typeof console&&console.warn&&console.warn("Deprecation warning: "+e)}function T(e,t){var n=!0;return u((function(){if(null!=r.deprecationHandler&&r.deprecationHandler(null,e),n){var i,s,o,l=[],c=arguments.length;for(s=0;s<c;s++){if(i="","object"==typeof arguments[s]){for(o in i+="\n["+s+"] ",arguments[0])a(arguments[0],o)&&(i+=o+": "+arguments[0][o]+", ");i=i.slice(0,-2)}else i=arguments[s];l.push(i)}_(e+"\nArguments: "+Array.prototype.slice.call(l).join("")+"\n"+(new Error).stack),n=!1}return t.apply(this,arguments)}),t)}var x,P={};function w(e,t){null!=r.deprecationHandler&&r.deprecationHandler(e,t),P[e]||(_(t),P[e]=!0)}function I(e){return"undefined"!=typeof Function&&e instanceof Function||"[object Function]"===Object.prototype.toString.call(e)}function k(e){var t,r;for(r in e)a(e,r)&&(I(t=e[r])?this[r]=t:this["_"+r]=t);this._config=e,this._dayOfMonthOrdinalParseLenient=new RegExp((this._dayOfMonthOrdinalParse.source||this._ordinalParse.source)+"|"+/\d{1,2}/.source)}function A(e,t){var r,n=u({},e);for(r in t)a(t,r)&&(s(e[r])&&s(t[r])?(n[r]={},u(n[r],e[r]),u(n[r],t[r])):null!=t[r]?n[r]=t[r]:delete n[r]);for(r in e)a(e,r)&&!a(t,r)&&s(e[r])&&(n[r]=u({},n[r]));return n}function M(e){null!=e&&this.set(e)}r.suppressDeprecationWarnings=!1,r.deprecationHandler=null,x=Object.keys?Object.keys:function(e){var t,r=[];for(t in e)a(e,t)&&r.push(t);return r};var R={sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"};function O(e,t,r){var n=this._calendar[e]||this._calendar.sameElse;return I(n)?n.call(t,r):n}function $(e,t,r){var n=""+Math.abs(e),i=t-n.length;return(e>=0?r?"+":"":"-")+Math.pow(10,Math.max(0,i)).toString().substr(1)+n}var D=/(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|N{1,5}|YYYYYY|YYYYY|YYYY|YY|y{2,4}|yo?|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g,L=/(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g,F={},N={};function B(e,t,r,n){var i=n;"string"==typeof n&&(i=function(){return this[n]()}),e&&(N[e]=i),t&&(N[t[0]]=function(){return $(i.apply(this,arguments),t[1],t[2])}),r&&(N[r]=function(){return this.localeData().ordinal(i.apply(this,arguments),e)})}function V(e){return e.match(/\[[\s\S]/)?e.replace(/^\[|\]$/g,""):e.replace(/\\/g,"")}function z(e){var t,r,n=e.match(D);for(t=0,r=n.length;t<r;t++)N[n[t]]?n[t]=N[n[t]]:n[t]=V(n[t]);return function(t){var i,s="";for(i=0;i<r;i++)s+=I(n[i])?n[i].call(t,e):n[i];return s}}function U(e,t){return e.isValid()?(t=j(t,e.localeData()),F[t]=F[t]||z(t),F[t](e)):e.localeData().invalidDate()}function j(e,t){var r=5;function n(e){return t.longDateFormat(e)||e}for(L.lastIndex=0;r>=0&&L.test(e);)e=e.replace(L,n),L.lastIndex=0,r-=1;return e}var G={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"};function H(e){var t=this._longDateFormat[e],r=this._longDateFormat[e.toUpperCase()];return t||!r?t:(this._longDateFormat[e]=r.match(D).map((function(e){return"MMMM"===e||"MM"===e||"DD"===e||"dddd"===e?e.slice(1):e})).join(""),this._longDateFormat[e])}var Z="Invalid date";function W(){return this._invalidDate}var Y="%d",K=/\d{1,2}/;function q(e){return this._ordinal.replace("%d",e)}var Q={future:"in %s",past:"%s ago",s:"a few seconds",ss:"%d seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",w:"a week",ww:"%d weeks",M:"a month",MM:"%d months",y:"a year",yy:"%d years"};function X(e,t,r,n){var i=this._relativeTime[r];return I(i)?i(e,t,r,n):i.replace(/%d/i,e)}function J(e,t){var r=this._relativeTime[e>0?"future":"past"];return I(r)?r(t):r.replace(/%s/i,t)}var ee={};function te(e,t){var r=e.toLowerCase();ee[r]=ee[r+"s"]=ee[t]=e}function re(e){return"string"==typeof e?ee[e]||ee[e.toLowerCase()]:void 0}function ne(e){var t,r,n={};for(r in e)a(e,r)&&(t=re(r))&&(n[t]=e[r]);return n}var ie={};function se(e,t){ie[e]=t}function ae(e){var t,r=[];for(t in e)a(e,t)&&r.push({unit:t,priority:ie[t]});return r.sort((function(e,t){return e.priority-t.priority})),r}function oe(e){return e%4==0&&e%100!=0||e%400==0}function le(e){return e<0?Math.ceil(e)||0:Math.floor(e)}function ce(e){var t=+e,r=0;return 0!==t&&isFinite(t)&&(r=le(t)),r}function he(e,t){return function(n){return null!=n?(ue(this,e,n),r.updateOffset(this,t),this):de(this,e)}}function de(e,t){return e.isValid()?e._d["get"+(e._isUTC?"UTC":"")+t]():NaN}function ue(e,t,r){e.isValid()&&!isNaN(r)&&("FullYear"===t&&oe(e.year())&&1===e.month()&&29===e.date()?(r=ce(r),e._d["set"+(e._isUTC?"UTC":"")+t](r,e.month(),Xe(r,e.month()))):e._d["set"+(e._isUTC?"UTC":"")+t](r))}function pe(e){return I(this[e=re(e)])?this[e]():this}function fe(e,t){if("object"==typeof e){var r,n=ae(e=ne(e)),i=n.length;for(r=0;r<i;r++)this[n[r].unit](e[n[r].unit])}else if(I(this[e=re(e)]))return this[e](t);return this}var me,ge=/\d/,ye=/\d\d/,ve=/\d{3}/,be=/\d{4}/,Se=/[+-]?\d{6}/,Ee=/\d\d?/,Ce=/\d\d\d\d?/,_e=/\d\d\d\d\d\d?/,Te=/\d{1,3}/,xe=/\d{1,4}/,Pe=/[+-]?\d{1,6}/,we=/\d+/,Ie=/[+-]?\d+/,ke=/Z|[+-]\d\d:?\d\d/gi,Ae=/Z|[+-]\d\d(?::?\d\d)?/gi,Me=/[+-]?\d+(\.\d{1,3})?/,Re=/[0-9]{0,256}['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFF07\uFF10-\uFFEF]{1,256}|[\u0600-\u06FF\/]{1,256}(\s*?[\u0600-\u06FF]{1,256}){1,2}/i;function Oe(e,t,r){me[e]=I(t)?t:function(e,n){return e&&r?r:t}}function $e(e,t){return a(me,e)?me[e](t._strict,t._locale):new RegExp(De(e))}function De(e){return Le(e.replace("\\","").replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g,(function(e,t,r,n,i){return t||r||n||i})))}function Le(e){return e.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}me={};var Fe={};function Ne(e,t){var r,n,i=t;for("string"==typeof e&&(e=[e]),c(t)&&(i=function(e,r){r[t]=ce(e)}),n=e.length,r=0;r<n;r++)Fe[e[r]]=i}function Be(e,t){Ne(e,(function(e,r,n,i){n._w=n._w||{},t(e,n._w,n,i)}))}function Ve(e,t,r){null!=t&&a(Fe,e)&&Fe[e](t,r._a,r,e)}var ze,Ue=0,je=1,Ge=2,He=3,Ze=4,We=5,Ye=6,Ke=7,qe=8;function Qe(e,t){return(e%t+t)%t}function Xe(e,t){if(isNaN(e)||isNaN(t))return NaN;var r=Qe(t,12);return e+=(t-r)/12,1===r?oe(e)?29:28:31-r%7%2}ze=Array.prototype.indexOf?Array.prototype.indexOf:function(e){var t;for(t=0;t<this.length;++t)if(this[t]===e)return t;return-1},B("M",["MM",2],"Mo",(function(){return this.month()+1})),B("MMM",0,0,(function(e){return this.localeData().monthsShort(this,e)})),B("MMMM",0,0,(function(e){return this.localeData().months(this,e)})),te("month","M"),se("month",8),Oe("M",Ee),Oe("MM",Ee,ye),Oe("MMM",(function(e,t){return t.monthsShortRegex(e)})),Oe("MMMM",(function(e,t){return t.monthsRegex(e)})),Ne(["M","MM"],(function(e,t){t[je]=ce(e)-1})),Ne(["MMM","MMMM"],(function(e,t,r,n){var i=r._locale.monthsParse(e,n,r._strict);null!=i?t[je]=i:m(r).invalidMonth=e}));var Je="January_February_March_April_May_June_July_August_September_October_November_December".split("_"),et="Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),tt=/D[oD]?(\[[^\[\]]*\]|\s)+MMMM?/,rt=Re,nt=Re;function it(e,t){return e?i(this._months)?this._months[e.month()]:this._months[(this._months.isFormat||tt).test(t)?"format":"standalone"][e.month()]:i(this._months)?this._months:this._months.standalone}function st(e,t){return e?i(this._monthsShort)?this._monthsShort[e.month()]:this._monthsShort[tt.test(t)?"format":"standalone"][e.month()]:i(this._monthsShort)?this._monthsShort:this._monthsShort.standalone}function at(e,t,r){var n,i,s,a=e.toLocaleLowerCase();if(!this._monthsParse)for(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[],n=0;n<12;++n)s=p([2e3,n]),this._shortMonthsParse[n]=this.monthsShort(s,"").toLocaleLowerCase(),this._longMonthsParse[n]=this.months(s,"").toLocaleLowerCase();return r?"MMM"===t?-1!==(i=ze.call(this._shortMonthsParse,a))?i:null:-1!==(i=ze.call(this._longMonthsParse,a))?i:null:"MMM"===t?-1!==(i=ze.call(this._shortMonthsParse,a))||-1!==(i=ze.call(this._longMonthsParse,a))?i:null:-1!==(i=ze.call(this._longMonthsParse,a))||-1!==(i=ze.call(this._shortMonthsParse,a))?i:null}function ot(e,t,r){var n,i,s;if(this._monthsParseExact)return at.call(this,e,t,r);for(this._monthsParse||(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[]),n=0;n<12;n++){if(i=p([2e3,n]),r&&!this._longMonthsParse[n]&&(this._longMonthsParse[n]=new RegExp("^"+this.months(i,"").replace(".","")+"$","i"),this._shortMonthsParse[n]=new RegExp("^"+this.monthsShort(i,"").replace(".","")+"$","i")),r||this._monthsParse[n]||(s="^"+this.months(i,"")+"|^"+this.monthsShort(i,""),this._monthsParse[n]=new RegExp(s.replace(".",""),"i")),r&&"MMMM"===t&&this._longMonthsParse[n].test(e))return n;if(r&&"MMM"===t&&this._shortMonthsParse[n].test(e))return n;if(!r&&this._monthsParse[n].test(e))return n}}function lt(e,t){var r;if(!e.isValid())return e;if("string"==typeof t)if(/^\d+$/.test(t))t=ce(t);else if(!c(t=e.localeData().monthsParse(t)))return e;return r=Math.min(e.date(),Xe(e.year(),t)),e._d["set"+(e._isUTC?"UTC":"")+"Month"](t,r),e}function ct(e){return null!=e?(lt(this,e),r.updateOffset(this,!0),this):de(this,"Month")}function ht(){return Xe(this.year(),this.month())}function dt(e){return this._monthsParseExact?(a(this,"_monthsRegex")||pt.call(this),e?this._monthsShortStrictRegex:this._monthsShortRegex):(a(this,"_monthsShortRegex")||(this._monthsShortRegex=rt),this._monthsShortStrictRegex&&e?this._monthsShortStrictRegex:this._monthsShortRegex)}function ut(e){return this._monthsParseExact?(a(this,"_monthsRegex")||pt.call(this),e?this._monthsStrictRegex:this._monthsRegex):(a(this,"_monthsRegex")||(this._monthsRegex=nt),this._monthsStrictRegex&&e?this._monthsStrictRegex:this._monthsRegex)}function pt(){function e(e,t){return t.length-e.length}var t,r,n=[],i=[],s=[];for(t=0;t<12;t++)r=p([2e3,t]),n.push(this.monthsShort(r,"")),i.push(this.months(r,"")),s.push(this.months(r,"")),s.push(this.monthsShort(r,""));for(n.sort(e),i.sort(e),s.sort(e),t=0;t<12;t++)n[t]=Le(n[t]),i[t]=Le(i[t]);for(t=0;t<24;t++)s[t]=Le(s[t]);this._monthsRegex=new RegExp("^("+s.join("|")+")","i"),this._monthsShortRegex=this._monthsRegex,this._monthsStrictRegex=new RegExp("^("+i.join("|")+")","i"),this._monthsShortStrictRegex=new RegExp("^("+n.join("|")+")","i")}function ft(e){return oe(e)?366:365}B("Y",0,0,(function(){var e=this.year();return e<=9999?$(e,4):"+"+e})),B(0,["YY",2],0,(function(){return this.year()%100})),B(0,["YYYY",4],0,"year"),B(0,["YYYYY",5],0,"year"),B(0,["YYYYYY",6,!0],0,"year"),te("year","y"),se("year",1),Oe("Y",Ie),Oe("YY",Ee,ye),Oe("YYYY",xe,be),Oe("YYYYY",Pe,Se),Oe("YYYYYY",Pe,Se),Ne(["YYYYY","YYYYYY"],Ue),Ne("YYYY",(function(e,t){t[Ue]=2===e.length?r.parseTwoDigitYear(e):ce(e)})),Ne("YY",(function(e,t){t[Ue]=r.parseTwoDigitYear(e)})),Ne("Y",(function(e,t){t[Ue]=parseInt(e,10)})),r.parseTwoDigitYear=function(e){return ce(e)+(ce(e)>68?1900:2e3)};var mt=he("FullYear",!0);function gt(){return oe(this.year())}function yt(e,t,r,n,i,s,a){var o;return e<100&&e>=0?(o=new Date(e+400,t,r,n,i,s,a),isFinite(o.getFullYear())&&o.setFullYear(e)):o=new Date(e,t,r,n,i,s,a),o}function vt(e){var t,r;return e<100&&e>=0?((r=Array.prototype.slice.call(arguments))[0]=e+400,t=new Date(Date.UTC.apply(null,r)),isFinite(t.getUTCFullYear())&&t.setUTCFullYear(e)):t=new Date(Date.UTC.apply(null,arguments)),t}function bt(e,t,r){var n=7+t-r;return-(7+vt(e,0,n).getUTCDay()-t)%7+n-1}function St(e,t,r,n,i){var s,a,o=1+7*(t-1)+(7+r-n)%7+bt(e,n,i);return o<=0?a=ft(s=e-1)+o:o>ft(e)?(s=e+1,a=o-ft(e)):(s=e,a=o),{year:s,dayOfYear:a}}function Et(e,t,r){var n,i,s=bt(e.year(),t,r),a=Math.floor((e.dayOfYear()-s-1)/7)+1;return a<1?n=a+Ct(i=e.year()-1,t,r):a>Ct(e.year(),t,r)?(n=a-Ct(e.year(),t,r),i=e.year()+1):(i=e.year(),n=a),{week:n,year:i}}function Ct(e,t,r){var n=bt(e,t,r),i=bt(e+1,t,r);return(ft(e)-n+i)/7}function _t(e){return Et(e,this._week.dow,this._week.doy).week}B("w",["ww",2],"wo","week"),B("W",["WW",2],"Wo","isoWeek"),te("week","w"),te("isoWeek","W"),se("week",5),se("isoWeek",5),Oe("w",Ee),Oe("ww",Ee,ye),Oe("W",Ee),Oe("WW",Ee,ye),Be(["w","ww","W","WW"],(function(e,t,r,n){t[n.substr(0,1)]=ce(e)}));var Tt={dow:0,doy:6};function xt(){return this._week.dow}function Pt(){return this._week.doy}function wt(e){var t=this.localeData().week(this);return null==e?t:this.add(7*(e-t),"d")}function It(e){var t=Et(this,1,4).week;return null==e?t:this.add(7*(e-t),"d")}function kt(e,t){return"string"!=typeof e?e:isNaN(e)?"number"==typeof(e=t.weekdaysParse(e))?e:null:parseInt(e,10)}function At(e,t){return"string"==typeof e?t.weekdaysParse(e)%7||7:isNaN(e)?null:e}function Mt(e,t){return e.slice(t,7).concat(e.slice(0,t))}B("d",0,"do","day"),B("dd",0,0,(function(e){return this.localeData().weekdaysMin(this,e)})),B("ddd",0,0,(function(e){return this.localeData().weekdaysShort(this,e)})),B("dddd",0,0,(function(e){return this.localeData().weekdays(this,e)})),B("e",0,0,"weekday"),B("E",0,0,"isoWeekday"),te("day","d"),te("weekday","e"),te("isoWeekday","E"),se("day",11),se("weekday",11),se("isoWeekday",11),Oe("d",Ee),Oe("e",Ee),Oe("E",Ee),Oe("dd",(function(e,t){return t.weekdaysMinRegex(e)})),Oe("ddd",(function(e,t){return t.weekdaysShortRegex(e)})),Oe("dddd",(function(e,t){return t.weekdaysRegex(e)})),Be(["dd","ddd","dddd"],(function(e,t,r,n){var i=r._locale.weekdaysParse(e,n,r._strict);null!=i?t.d=i:m(r).invalidWeekday=e})),Be(["d","e","E"],(function(e,t,r,n){t[n]=ce(e)}));var Rt="Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),Ot="Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),$t="Su_Mo_Tu_We_Th_Fr_Sa".split("_"),Dt=Re,Lt=Re,Ft=Re;function Nt(e,t){var r=i(this._weekdays)?this._weekdays:this._weekdays[e&&!0!==e&&this._weekdays.isFormat.test(t)?"format":"standalone"];return!0===e?Mt(r,this._week.dow):e?r[e.day()]:r}function Bt(e){return!0===e?Mt(this._weekdaysShort,this._week.dow):e?this._weekdaysShort[e.day()]:this._weekdaysShort}function Vt(e){return!0===e?Mt(this._weekdaysMin,this._week.dow):e?this._weekdaysMin[e.day()]:this._weekdaysMin}function zt(e,t,r){var n,i,s,a=e.toLocaleLowerCase();if(!this._weekdaysParse)for(this._weekdaysParse=[],this._shortWeekdaysParse=[],this._minWeekdaysParse=[],n=0;n<7;++n)s=p([2e3,1]).day(n),this._minWeekdaysParse[n]=this.weekdaysMin(s,"").toLocaleLowerCase(),this._shortWeekdaysParse[n]=this.weekdaysShort(s,"").toLocaleLowerCase(),this._weekdaysParse[n]=this.weekdays(s,"").toLocaleLowerCase();return r?"dddd"===t?-1!==(i=ze.call(this._weekdaysParse,a))?i:null:"ddd"===t?-1!==(i=ze.call(this._shortWeekdaysParse,a))?i:null:-1!==(i=ze.call(this._minWeekdaysParse,a))?i:null:"dddd"===t?-1!==(i=ze.call(this._weekdaysParse,a))||-1!==(i=ze.call(this._shortWeekdaysParse,a))||-1!==(i=ze.call(this._minWeekdaysParse,a))?i:null:"ddd"===t?-1!==(i=ze.call(this._shortWeekdaysParse,a))||-1!==(i=ze.call(this._weekdaysParse,a))||-1!==(i=ze.call(this._minWeekdaysParse,a))?i:null:-1!==(i=ze.call(this._minWeekdaysParse,a))||-1!==(i=ze.call(this._weekdaysParse,a))||-1!==(i=ze.call(this._shortWeekdaysParse,a))?i:null}function Ut(e,t,r){var n,i,s;if(this._weekdaysParseExact)return zt.call(this,e,t,r);for(this._weekdaysParse||(this._weekdaysParse=[],this._minWeekdaysParse=[],this._shortWeekdaysParse=[],this._fullWeekdaysParse=[]),n=0;n<7;n++){if(i=p([2e3,1]).day(n),r&&!this._fullWeekdaysParse[n]&&(this._fullWeekdaysParse[n]=new RegExp("^"+this.weekdays(i,"").replace(".","\\.?")+"$","i"),this._shortWeekdaysParse[n]=new RegExp("^"+this.weekdaysShort(i,"").replace(".","\\.?")+"$","i"),this._minWeekdaysParse[n]=new RegExp("^"+this.weekdaysMin(i,"").replace(".","\\.?")+"$","i")),this._weekdaysParse[n]||(s="^"+this.weekdays(i,"")+"|^"+this.weekdaysShort(i,"")+"|^"+this.weekdaysMin(i,""),this._weekdaysParse[n]=new RegExp(s.replace(".",""),"i")),r&&"dddd"===t&&this._fullWeekdaysParse[n].test(e))return n;if(r&&"ddd"===t&&this._shortWeekdaysParse[n].test(e))return n;if(r&&"dd"===t&&this._minWeekdaysParse[n].test(e))return n;if(!r&&this._weekdaysParse[n].test(e))return n}}function jt(e){if(!this.isValid())return null!=e?this:NaN;var t=this._isUTC?this._d.getUTCDay():this._d.getDay();return null!=e?(e=kt(e,this.localeData()),this.add(e-t,"d")):t}function Gt(e){if(!this.isValid())return null!=e?this:NaN;var t=(this.day()+7-this.localeData()._week.dow)%7;return null==e?t:this.add(e-t,"d")}function Ht(e){if(!this.isValid())return null!=e?this:NaN;if(null!=e){var t=At(e,this.localeData());return this.day(this.day()%7?t:t-7)}return this.day()||7}function Zt(e){return this._weekdaysParseExact?(a(this,"_weekdaysRegex")||Kt.call(this),e?this._weekdaysStrictRegex:this._weekdaysRegex):(a(this,"_weekdaysRegex")||(this._weekdaysRegex=Dt),this._weekdaysStrictRegex&&e?this._weekdaysStrictRegex:this._weekdaysRegex)}function Wt(e){return this._weekdaysParseExact?(a(this,"_weekdaysRegex")||Kt.call(this),e?this._weekdaysShortStrictRegex:this._weekdaysShortRegex):(a(this,"_weekdaysShortRegex")||(this._weekdaysShortRegex=Lt),this._weekdaysShortStrictRegex&&e?this._weekdaysShortStrictRegex:this._weekdaysShortRegex)}function Yt(e){return this._weekdaysParseExact?(a(this,"_weekdaysRegex")||Kt.call(this),e?this._weekdaysMinStrictRegex:this._weekdaysMinRegex):(a(this,"_weekdaysMinRegex")||(this._weekdaysMinRegex=Ft),this._weekdaysMinStrictRegex&&e?this._weekdaysMinStrictRegex:this._weekdaysMinRegex)}function Kt(){function e(e,t){return t.length-e.length}var t,r,n,i,s,a=[],o=[],l=[],c=[];for(t=0;t<7;t++)r=p([2e3,1]).day(t),n=Le(this.weekdaysMin(r,"")),i=Le(this.weekdaysShort(r,"")),s=Le(this.weekdays(r,"")),a.push(n),o.push(i),l.push(s),c.push(n),c.push(i),c.push(s);a.sort(e),o.sort(e),l.sort(e),c.sort(e),this._weekdaysRegex=new RegExp("^("+c.join("|")+")","i"),this._weekdaysShortRegex=this._weekdaysRegex,this._weekdaysMinRegex=this._weekdaysRegex,this._weekdaysStrictRegex=new RegExp("^("+l.join("|")+")","i"),this._weekdaysShortStrictRegex=new RegExp("^("+o.join("|")+")","i"),this._weekdaysMinStrictRegex=new RegExp("^("+a.join("|")+")","i")}function qt(){return this.hours()%12||12}function Qt(){return this.hours()||24}function Xt(e,t){B(e,0,0,(function(){return this.localeData().meridiem(this.hours(),this.minutes(),t)}))}function Jt(e,t){return t._meridiemParse}function er(e){return"p"===(e+"").toLowerCase().charAt(0)}B("H",["HH",2],0,"hour"),B("h",["hh",2],0,qt),B("k",["kk",2],0,Qt),B("hmm",0,0,(function(){return""+qt.apply(this)+$(this.minutes(),2)})),B("hmmss",0,0,(function(){return""+qt.apply(this)+$(this.minutes(),2)+$(this.seconds(),2)})),B("Hmm",0,0,(function(){return""+this.hours()+$(this.minutes(),2)})),B("Hmmss",0,0,(function(){return""+this.hours()+$(this.minutes(),2)+$(this.seconds(),2)})),Xt("a",!0),Xt("A",!1),te("hour","h"),se("hour",13),Oe("a",Jt),Oe("A",Jt),Oe("H",Ee),Oe("h",Ee),Oe("k",Ee),Oe("HH",Ee,ye),Oe("hh",Ee,ye),Oe("kk",Ee,ye),Oe("hmm",Ce),Oe("hmmss",_e),Oe("Hmm",Ce),Oe("Hmmss",_e),Ne(["H","HH"],He),Ne(["k","kk"],(function(e,t,r){var n=ce(e);t[He]=24===n?0:n})),Ne(["a","A"],(function(e,t,r){r._isPm=r._locale.isPM(e),r._meridiem=e})),Ne(["h","hh"],(function(e,t,r){t[He]=ce(e),m(r).bigHour=!0})),Ne("hmm",(function(e,t,r){var n=e.length-2;t[He]=ce(e.substr(0,n)),t[Ze]=ce(e.substr(n)),m(r).bigHour=!0})),Ne("hmmss",(function(e,t,r){var n=e.length-4,i=e.length-2;t[He]=ce(e.substr(0,n)),t[Ze]=ce(e.substr(n,2)),t[We]=ce(e.substr(i)),m(r).bigHour=!0})),Ne("Hmm",(function(e,t,r){var n=e.length-2;t[He]=ce(e.substr(0,n)),t[Ze]=ce(e.substr(n))})),Ne("Hmmss",(function(e,t,r){var n=e.length-4,i=e.length-2;t[He]=ce(e.substr(0,n)),t[Ze]=ce(e.substr(n,2)),t[We]=ce(e.substr(i))}));var tr=/[ap]\.?m?\.?/i,rr=he("Hours",!0);function nr(e,t,r){return e>11?r?"pm":"PM":r?"am":"AM"}var ir,sr={calendar:R,longDateFormat:G,invalidDate:Z,ordinal:Y,dayOfMonthOrdinalParse:K,relativeTime:Q,months:Je,monthsShort:et,week:Tt,weekdays:Rt,weekdaysMin:$t,weekdaysShort:Ot,meridiemParse:tr},ar={},or={};function lr(e,t){var r,n=Math.min(e.length,t.length);for(r=0;r<n;r+=1)if(e[r]!==t[r])return r;return n}function cr(e){return e?e.toLowerCase().replace("_","-"):e}function hr(e){for(var t,r,n,i,s=0;s<e.length;){for(t=(i=cr(e[s]).split("-")).length,r=(r=cr(e[s+1]))?r.split("-"):null;t>0;){if(n=ur(i.slice(0,t).join("-")))return n;if(r&&r.length>=t&&lr(i,r)>=t-1)break;t--}s++}return ir}function dr(e){return null!=e.match("^[^/\\\\]*$")}function ur(e){var t=null;if(void 0===ar[e]&&module&&module.exports&&dr(e))try{t=ir._abbr,commonjsRequire("./locale/"+e),pr(t)}catch(t){ar[e]=null}return ar[e]}function pr(e,t){var r;return e&&((r=l(t)?gr(e):fr(e,t))?ir=r:"undefined"!=typeof console&&console.warn&&console.warn("Locale "+e+" not found. Did you forget to load it?")),ir._abbr}function fr(e,t){if(null!==t){var r,n=sr;if(t.abbr=e,null!=ar[e])w("defineLocaleOverride","use moment.updateLocale(localeName, config) to change an existing locale. moment.defineLocale(localeName, config) should only be used for creating a new locale See http://momentjs.com/guides/#/warnings/define-locale/ for more info."),n=ar[e]._config;else if(null!=t.parentLocale)if(null!=ar[t.parentLocale])n=ar[t.parentLocale]._config;else{if(null==(r=ur(t.parentLocale)))return or[t.parentLocale]||(or[t.parentLocale]=[]),or[t.parentLocale].push({name:e,config:t}),null;n=r._config}return ar[e]=new M(A(n,t)),or[e]&&or[e].forEach((function(e){fr(e.name,e.config)})),pr(e),ar[e]}return delete ar[e],null}function mr(e,t){if(null!=t){var r,n,i=sr;null!=ar[e]&&null!=ar[e].parentLocale?ar[e].set(A(ar[e]._config,t)):(null!=(n=ur(e))&&(i=n._config),t=A(i,t),null==n&&(t.abbr=e),(r=new M(t)).parentLocale=ar[e],ar[e]=r),pr(e)}else null!=ar[e]&&(null!=ar[e].parentLocale?(ar[e]=ar[e].parentLocale,e===pr()&&pr(e)):null!=ar[e]&&delete ar[e]);return ar[e]}function gr(e){var t;if(e&&e._locale&&e._locale._abbr&&(e=e._locale._abbr),!e)return ir;if(!i(e)){if(t=ur(e))return t;e=[e]}return hr(e)}function yr(){return x(ar)}function vr(e){var t,r=e._a;return r&&-2===m(e).overflow&&(t=r[je]<0||r[je]>11?je:r[Ge]<1||r[Ge]>Xe(r[Ue],r[je])?Ge:r[He]<0||r[He]>24||24===r[He]&&(0!==r[Ze]||0!==r[We]||0!==r[Ye])?He:r[Ze]<0||r[Ze]>59?Ze:r[We]<0||r[We]>59?We:r[Ye]<0||r[Ye]>999?Ye:-1,m(e)._overflowDayOfYear&&(t<Ue||t>Ge)&&(t=Ge),m(e)._overflowWeeks&&-1===t&&(t=Ke),m(e)._overflowWeekday&&-1===t&&(t=qe),m(e).overflow=t),e}var br=/^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/,Sr=/^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d|))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/,Er=/Z|[+-]\d\d(?::?\d\d)?/,Cr=[["YYYYYY-MM-DD",/[+-]\d{6}-\d\d-\d\d/],["YYYY-MM-DD",/\d{4}-\d\d-\d\d/],["GGGG-[W]WW-E",/\d{4}-W\d\d-\d/],["GGGG-[W]WW",/\d{4}-W\d\d/,!1],["YYYY-DDD",/\d{4}-\d{3}/],["YYYY-MM",/\d{4}-\d\d/,!1],["YYYYYYMMDD",/[+-]\d{10}/],["YYYYMMDD",/\d{8}/],["GGGG[W]WWE",/\d{4}W\d{3}/],["GGGG[W]WW",/\d{4}W\d{2}/,!1],["YYYYDDD",/\d{7}/],["YYYYMM",/\d{6}/,!1],["YYYY",/\d{4}/,!1]],_r=[["HH:mm:ss.SSSS",/\d\d:\d\d:\d\d\.\d+/],["HH:mm:ss,SSSS",/\d\d:\d\d:\d\d,\d+/],["HH:mm:ss",/\d\d:\d\d:\d\d/],["HH:mm",/\d\d:\d\d/],["HHmmss.SSSS",/\d\d\d\d\d\d\.\d+/],["HHmmss,SSSS",/\d\d\d\d\d\d,\d+/],["HHmmss",/\d\d\d\d\d\d/],["HHmm",/\d\d\d\d/],["HH",/\d\d/]],Tr=/^\/?Date\((-?\d+)/i,xr=/^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),?\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|([+-]\d{4}))$/,Pr={UT:0,GMT:0,EDT:-240,EST:-300,CDT:-300,CST:-360,MDT:-360,MST:-420,PDT:-420,PST:-480};function wr(e){var t,r,n,i,s,a,o=e._i,l=br.exec(o)||Sr.exec(o),c=Cr.length,h=_r.length;if(l){for(m(e).iso=!0,t=0,r=c;t<r;t++)if(Cr[t][1].exec(l[1])){i=Cr[t][0],n=!1!==Cr[t][2];break}if(null==i)return void(e._isValid=!1);if(l[3]){for(t=0,r=h;t<r;t++)if(_r[t][1].exec(l[3])){s=(l[2]||" ")+_r[t][0];break}if(null==s)return void(e._isValid=!1)}if(!n&&null!=s)return void(e._isValid=!1);if(l[4]){if(!Er.exec(l[4]))return void(e._isValid=!1);a="Z"}e._f=i+(s||"")+(a||""),Br(e)}else e._isValid=!1}function Ir(e,t,r,n,i,s){var a=[kr(e),et.indexOf(t),parseInt(r,10),parseInt(n,10),parseInt(i,10)];return s&&a.push(parseInt(s,10)),a}function kr(e){var t=parseInt(e,10);return t<=49?2e3+t:t<=999?1900+t:t}function Ar(e){return e.replace(/\([^()]*\)|[\n\t]/g," ").replace(/(\s\s+)/g," ").replace(/^\s\s*/,"").replace(/\s\s*$/,"")}function Mr(e,t,r){return!e||Ot.indexOf(e)===new Date(t[0],t[1],t[2]).getDay()||(m(r).weekdayMismatch=!0,r._isValid=!1,!1)}function Rr(e,t,r){if(e)return Pr[e];if(t)return 0;var n=parseInt(r,10),i=n%100;return(n-i)/100*60+i}function Or(e){var t,r=xr.exec(Ar(e._i));if(r){if(t=Ir(r[4],r[3],r[2],r[5],r[6],r[7]),!Mr(r[1],t,e))return;e._a=t,e._tzm=Rr(r[8],r[9],r[10]),e._d=vt.apply(null,e._a),e._d.setUTCMinutes(e._d.getUTCMinutes()-e._tzm),m(e).rfc2822=!0}else e._isValid=!1}function $r(e){var t=Tr.exec(e._i);null===t?(wr(e),!1===e._isValid&&(delete e._isValid,Or(e),!1===e._isValid&&(delete e._isValid,e._strict?e._isValid=!1:r.createFromInputFallback(e)))):e._d=new Date(+t[1])}function Dr(e,t,r){return null!=e?e:null!=t?t:r}function Lr(e){var t=new Date(r.now());return e._useUTC?[t.getUTCFullYear(),t.getUTCMonth(),t.getUTCDate()]:[t.getFullYear(),t.getMonth(),t.getDate()]}function Fr(e){var t,r,n,i,s,a=[];if(!e._d){for(n=Lr(e),e._w&&null==e._a[Ge]&&null==e._a[je]&&Nr(e),null!=e._dayOfYear&&(s=Dr(e._a[Ue],n[Ue]),(e._dayOfYear>ft(s)||0===e._dayOfYear)&&(m(e)._overflowDayOfYear=!0),r=vt(s,0,e._dayOfYear),e._a[je]=r.getUTCMonth(),e._a[Ge]=r.getUTCDate()),t=0;t<3&&null==e._a[t];++t)e._a[t]=a[t]=n[t];for(;t<7;t++)e._a[t]=a[t]=null==e._a[t]?2===t?1:0:e._a[t];24===e._a[He]&&0===e._a[Ze]&&0===e._a[We]&&0===e._a[Ye]&&(e._nextDay=!0,e._a[He]=0),e._d=(e._useUTC?vt:yt).apply(null,a),i=e._useUTC?e._d.getUTCDay():e._d.getDay(),null!=e._tzm&&e._d.setUTCMinutes(e._d.getUTCMinutes()-e._tzm),e._nextDay&&(e._a[He]=24),e._w&&void 0!==e._w.d&&e._w.d!==i&&(m(e).weekdayMismatch=!0)}}function Nr(e){var t,r,n,i,s,a,o,l,c;null!=(t=e._w).GG||null!=t.W||null!=t.E?(s=1,a=4,r=Dr(t.GG,e._a[Ue],Et(Wr(),1,4).year),n=Dr(t.W,1),((i=Dr(t.E,1))<1||i>7)&&(l=!0)):(s=e._locale._week.dow,a=e._locale._week.doy,c=Et(Wr(),s,a),r=Dr(t.gg,e._a[Ue],c.year),n=Dr(t.w,c.week),null!=t.d?((i=t.d)<0||i>6)&&(l=!0):null!=t.e?(i=t.e+s,(t.e<0||t.e>6)&&(l=!0)):i=s),n<1||n>Ct(r,s,a)?m(e)._overflowWeeks=!0:null!=l?m(e)._overflowWeekday=!0:(o=St(r,n,i,s,a),e._a[Ue]=o.year,e._dayOfYear=o.dayOfYear)}function Br(e){if(e._f!==r.ISO_8601)if(e._f!==r.RFC_2822){e._a=[],m(e).empty=!0;var t,n,i,s,a,o,l,c=""+e._i,h=c.length,d=0;for(l=(i=j(e._f,e._locale).match(D)||[]).length,t=0;t<l;t++)s=i[t],(n=(c.match($e(s,e))||[])[0])&&((a=c.substr(0,c.indexOf(n))).length>0&&m(e).unusedInput.push(a),c=c.slice(c.indexOf(n)+n.length),d+=n.length),N[s]?(n?m(e).empty=!1:m(e).unusedTokens.push(s),Ve(s,n,e)):e._strict&&!n&&m(e).unusedTokens.push(s);m(e).charsLeftOver=h-d,c.length>0&&m(e).unusedInput.push(c),e._a[He]<=12&&!0===m(e).bigHour&&e._a[He]>0&&(m(e).bigHour=void 0),m(e).parsedDateParts=e._a.slice(0),m(e).meridiem=e._meridiem,e._a[He]=Vr(e._locale,e._a[He],e._meridiem),null!==(o=m(e).era)&&(e._a[Ue]=e._locale.erasConvertYear(o,e._a[Ue])),Fr(e),vr(e)}else Or(e);else wr(e)}function Vr(e,t,r){var n;return null==r?t:null!=e.meridiemHour?e.meridiemHour(t,r):null!=e.isPM?((n=e.isPM(r))&&t<12&&(t+=12),n||12!==t||(t=0),t):t}function zr(e){var t,r,n,i,s,a,o=!1,l=e._f.length;if(0===l)return m(e).invalidFormat=!0,void(e._d=new Date(NaN));for(i=0;i<l;i++)s=0,a=!1,t=S({},e),null!=e._useUTC&&(t._useUTC=e._useUTC),t._f=e._f[i],Br(t),g(t)&&(a=!0),s+=m(t).charsLeftOver,s+=10*m(t).unusedTokens.length,m(t).score=s,o?s<n&&(n=s,r=t):(null==n||s<n||a)&&(n=s,r=t,a&&(o=!0));u(e,r||t)}function Ur(e){if(!e._d){var t=ne(e._i),r=void 0===t.day?t.date:t.day;e._a=d([t.year,t.month,r,t.hour,t.minute,t.second,t.millisecond],(function(e){return e&&parseInt(e,10)})),Fr(e)}}function jr(e){var t=new E(vr(Gr(e)));return t._nextDay&&(t.add(1,"d"),t._nextDay=void 0),t}function Gr(e){var t=e._i,r=e._f;return e._locale=e._locale||gr(e._l),null===t||void 0===r&&""===t?y({nullInput:!0}):("string"==typeof t&&(e._i=t=e._locale.preparse(t)),C(t)?new E(vr(t)):(h(t)?e._d=t:i(r)?zr(e):r?Br(e):Hr(e),g(e)||(e._d=null),e))}function Hr(e){var t=e._i;l(t)?e._d=new Date(r.now()):h(t)?e._d=new Date(t.valueOf()):"string"==typeof t?$r(e):i(t)?(e._a=d(t.slice(0),(function(e){return parseInt(e,10)})),Fr(e)):s(t)?Ur(e):c(t)?e._d=new Date(t):r.createFromInputFallback(e)}function Zr(e,t,r,n,a){var l={};return!0!==t&&!1!==t||(n=t,t=void 0),!0!==r&&!1!==r||(n=r,r=void 0),(s(e)&&o(e)||i(e)&&0===e.length)&&(e=void 0),l._isAMomentObject=!0,l._useUTC=l._isUTC=a,l._l=r,l._i=e,l._f=t,l._strict=n,jr(l)}function Wr(e,t,r,n){return Zr(e,t,r,n,!1)}r.createFromInputFallback=T("value provided is not in a recognized RFC2822 or ISO format. moment construction falls back to js Date(), which is not reliable across all browsers and versions. Non RFC2822/ISO date formats are discouraged. Please refer to http://momentjs.com/guides/#/warnings/js-date/ for more info.",(function(e){e._d=new Date(e._i+(e._useUTC?" UTC":""))})),r.ISO_8601=function(){},r.RFC_2822=function(){};var Yr=T("moment().min is deprecated, use moment.max instead. http://momentjs.com/guides/#/warnings/min-max/",(function(){var e=Wr.apply(null,arguments);return this.isValid()&&e.isValid()?e<this?this:e:y()})),Kr=T("moment().max is deprecated, use moment.min instead. http://momentjs.com/guides/#/warnings/min-max/",(function(){var e=Wr.apply(null,arguments);return this.isValid()&&e.isValid()?e>this?this:e:y()}));function qr(e,t){var r,n;if(1===t.length&&i(t[0])&&(t=t[0]),!t.length)return Wr();for(r=t[0],n=1;n<t.length;++n)t[n].isValid()&&!t[n][e](r)||(r=t[n]);return r}function Qr(){return qr("isBefore",[].slice.call(arguments,0))}function Xr(){return qr("isAfter",[].slice.call(arguments,0))}var Jr=function(){return Date.now?Date.now():+new Date},en=["year","quarter","month","week","day","hour","minute","second","millisecond"];function tn(e){var t,r,n=!1,i=en.length;for(t in e)if(a(e,t)&&(-1===ze.call(en,t)||null!=e[t]&&isNaN(e[t])))return!1;for(r=0;r<i;++r)if(e[en[r]]){if(n)return!1;parseFloat(e[en[r]])!==ce(e[en[r]])&&(n=!0)}return!0}function rn(){return this._isValid}function nn(){return wn(NaN)}function sn(e){var t=ne(e),r=t.year||0,n=t.quarter||0,i=t.month||0,s=t.week||t.isoWeek||0,a=t.day||0,o=t.hour||0,l=t.minute||0,c=t.second||0,h=t.millisecond||0;this._isValid=tn(t),this._milliseconds=+h+1e3*c+6e4*l+1e3*o*60*60,this._days=+a+7*s,this._months=+i+3*n+12*r,this._data={},this._locale=gr(),this._bubble()}function an(e){return e instanceof sn}function on(e){return e<0?-1*Math.round(-1*e):Math.round(e)}function ln(e,t,r){var n,i=Math.min(e.length,t.length),s=Math.abs(e.length-t.length),a=0;for(n=0;n<i;n++)(r&&e[n]!==t[n]||!r&&ce(e[n])!==ce(t[n]))&&a++;return a+s}function cn(e,t){B(e,0,0,(function(){var e=this.utcOffset(),r="+";return e<0&&(e=-e,r="-"),r+$(~~(e/60),2)+t+$(~~e%60,2)}))}cn("Z",":"),cn("ZZ",""),Oe("Z",Ae),Oe("ZZ",Ae),Ne(["Z","ZZ"],(function(e,t,r){r._useUTC=!0,r._tzm=dn(Ae,e)}));var hn=/([\+\-]|\d\d)/gi;function dn(e,t){var r,n,i=(t||"").match(e);return null===i?null:0===(n=60*(r=((i[i.length-1]||[])+"").match(hn)||["-",0,0])[1]+ce(r[2]))?0:"+"===r[0]?n:-n}function un(e,t){var n,i;return t._isUTC?(n=t.clone(),i=(C(e)||h(e)?e.valueOf():Wr(e).valueOf())-n.valueOf(),n._d.setTime(n._d.valueOf()+i),r.updateOffset(n,!1),n):Wr(e).local()}function pn(e){return-Math.round(e._d.getTimezoneOffset())}function fn(e,t,n){var i,s=this._offset||0;if(!this.isValid())return null!=e?this:NaN;if(null!=e){if("string"==typeof e){if(null===(e=dn(Ae,e)))return this}else Math.abs(e)<16&&!n&&(e*=60);return!this._isUTC&&t&&(i=pn(this)),this._offset=e,this._isUTC=!0,null!=i&&this.add(i,"m"),s!==e&&(!t||this._changeInProgress?Rn(this,wn(e-s,"m"),1,!1):this._changeInProgress||(this._changeInProgress=!0,r.updateOffset(this,!0),this._changeInProgress=null)),this}return this._isUTC?s:pn(this)}function mn(e,t){return null!=e?("string"!=typeof e&&(e=-e),this.utcOffset(e,t),this):-this.utcOffset()}function gn(e){return this.utcOffset(0,e)}function yn(e){return this._isUTC&&(this.utcOffset(0,e),this._isUTC=!1,e&&this.subtract(pn(this),"m")),this}function vn(){if(null!=this._tzm)this.utcOffset(this._tzm,!1,!0);else if("string"==typeof this._i){var e=dn(ke,this._i);null!=e?this.utcOffset(e):this.utcOffset(0,!0)}return this}function bn(e){return!!this.isValid()&&(e=e?Wr(e).utcOffset():0,(this.utcOffset()-e)%60==0)}function Sn(){return this.utcOffset()>this.clone().month(0).utcOffset()||this.utcOffset()>this.clone().month(5).utcOffset()}function En(){if(!l(this._isDSTShifted))return this._isDSTShifted;var e,t={};return S(t,this),(t=Gr(t))._a?(e=t._isUTC?p(t._a):Wr(t._a),this._isDSTShifted=this.isValid()&&ln(t._a,e.toArray())>0):this._isDSTShifted=!1,this._isDSTShifted}function Cn(){return!!this.isValid()&&!this._isUTC}function _n(){return!!this.isValid()&&this._isUTC}function Tn(){return!!this.isValid()&&this._isUTC&&0===this._offset}r.updateOffset=function(){};var xn=/^(-|\+)?(?:(\d*)[. ])?(\d+):(\d+)(?::(\d+)(\.\d*)?)?$/,Pn=/^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/;function wn(e,t){var r,n,i,s=e,o=null;return an(e)?s={ms:e._milliseconds,d:e._days,M:e._months}:c(e)||!isNaN(+e)?(s={},t?s[t]=+e:s.milliseconds=+e):(o=xn.exec(e))?(r="-"===o[1]?-1:1,s={y:0,d:ce(o[Ge])*r,h:ce(o[He])*r,m:ce(o[Ze])*r,s:ce(o[We])*r,ms:ce(on(1e3*o[Ye]))*r}):(o=Pn.exec(e))?(r="-"===o[1]?-1:1,s={y:In(o[2],r),M:In(o[3],r),w:In(o[4],r),d:In(o[5],r),h:In(o[6],r),m:In(o[7],r),s:In(o[8],r)}):null==s?s={}:"object"==typeof s&&("from"in s||"to"in s)&&(i=An(Wr(s.from),Wr(s.to)),(s={}).ms=i.milliseconds,s.M=i.months),n=new sn(s),an(e)&&a(e,"_locale")&&(n._locale=e._locale),an(e)&&a(e,"_isValid")&&(n._isValid=e._isValid),n}function In(e,t){var r=e&&parseFloat(e.replace(",","."));return(isNaN(r)?0:r)*t}function kn(e,t){var r={};return r.months=t.month()-e.month()+12*(t.year()-e.year()),e.clone().add(r.months,"M").isAfter(t)&&--r.months,r.milliseconds=+t-+e.clone().add(r.months,"M"),r}function An(e,t){var r;return e.isValid()&&t.isValid()?(t=un(t,e),e.isBefore(t)?r=kn(e,t):((r=kn(t,e)).milliseconds=-r.milliseconds,r.months=-r.months),r):{milliseconds:0,months:0}}function Mn(e,t){return function(r,n){var i;return null===n||isNaN(+n)||(w(t,"moment()."+t+"(period, number) is deprecated. Please use moment()."+t+"(number, period). See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info."),i=r,r=n,n=i),Rn(this,wn(r,n),e),this}}function Rn(e,t,n,i){var s=t._milliseconds,a=on(t._days),o=on(t._months);e.isValid()&&(i=null==i||i,o&&lt(e,de(e,"Month")+o*n),a&&ue(e,"Date",de(e,"Date")+a*n),s&&e._d.setTime(e._d.valueOf()+s*n),i&&r.updateOffset(e,a||o))}wn.fn=sn.prototype,wn.invalid=nn;var On=Mn(1,"add"),$n=Mn(-1,"subtract");function Dn(e){return"string"==typeof e||e instanceof String}function Ln(e){return C(e)||h(e)||Dn(e)||c(e)||Nn(e)||Fn(e)||null==e}function Fn(e){var t,r,n=s(e)&&!o(e),i=!1,l=["years","year","y","months","month","M","days","day","d","dates","date","D","hours","hour","h","minutes","minute","m","seconds","second","s","milliseconds","millisecond","ms"],c=l.length;for(t=0;t<c;t+=1)r=l[t],i=i||a(e,r);return n&&i}function Nn(e){var t=i(e),r=!1;return t&&(r=0===e.filter((function(t){return!c(t)&&Dn(e)})).length),t&&r}function Bn(e){var t,r,n=s(e)&&!o(e),i=!1,l=["sameDay","nextDay","lastDay","nextWeek","lastWeek","sameElse"];for(t=0;t<l.length;t+=1)r=l[t],i=i||a(e,r);return n&&i}function Vn(e,t){var r=e.diff(t,"days",!0);return r<-6?"sameElse":r<-1?"lastWeek":r<0?"lastDay":r<1?"sameDay":r<2?"nextDay":r<7?"nextWeek":"sameElse"}function zn(e,t){1===arguments.length&&(arguments[0]?Ln(arguments[0])?(e=arguments[0],t=void 0):Bn(arguments[0])&&(t=arguments[0],e=void 0):(e=void 0,t=void 0));var n=e||Wr(),i=un(n,this).startOf("day"),s=r.calendarFormat(this,i)||"sameElse",a=t&&(I(t[s])?t[s].call(this,n):t[s]);return this.format(a||this.localeData().calendar(s,this,Wr(n)))}function Un(){return new E(this)}function jn(e,t){var r=C(e)?e:Wr(e);return!(!this.isValid()||!r.isValid())&&("millisecond"===(t=re(t)||"millisecond")?this.valueOf()>r.valueOf():r.valueOf()<this.clone().startOf(t).valueOf())}function Gn(e,t){var r=C(e)?e:Wr(e);return!(!this.isValid()||!r.isValid())&&("millisecond"===(t=re(t)||"millisecond")?this.valueOf()<r.valueOf():this.clone().endOf(t).valueOf()<r.valueOf())}function Hn(e,t,r,n){var i=C(e)?e:Wr(e),s=C(t)?t:Wr(t);return!!(this.isValid()&&i.isValid()&&s.isValid())&&("("===(n=n||"()")[0]?this.isAfter(i,r):!this.isBefore(i,r))&&(")"===n[1]?this.isBefore(s,r):!this.isAfter(s,r))}function Zn(e,t){var r,n=C(e)?e:Wr(e);return!(!this.isValid()||!n.isValid())&&("millisecond"===(t=re(t)||"millisecond")?this.valueOf()===n.valueOf():(r=n.valueOf(),this.clone().startOf(t).valueOf()<=r&&r<=this.clone().endOf(t).valueOf()))}function Wn(e,t){return this.isSame(e,t)||this.isAfter(e,t)}function Yn(e,t){return this.isSame(e,t)||this.isBefore(e,t)}function Kn(e,t,r){var n,i,s;if(!this.isValid())return NaN;if(!(n=un(e,this)).isValid())return NaN;switch(i=6e4*(n.utcOffset()-this.utcOffset()),t=re(t)){case"year":s=qn(this,n)/12;break;case"month":s=qn(this,n);break;case"quarter":s=qn(this,n)/3;break;case"second":s=(this-n)/1e3;break;case"minute":s=(this-n)/6e4;break;case"hour":s=(this-n)/36e5;break;case"day":s=(this-n-i)/864e5;break;case"week":s=(this-n-i)/6048e5;break;default:s=this-n}return r?s:le(s)}function qn(e,t){if(e.date()<t.date())return-qn(t,e);var r=12*(t.year()-e.year())+(t.month()-e.month()),n=e.clone().add(r,"months");return-(r+(t-n<0?(t-n)/(n-e.clone().add(r-1,"months")):(t-n)/(e.clone().add(r+1,"months")-n)))||0}function Qn(){return this.clone().locale("en").format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ")}function Xn(e){if(!this.isValid())return null;var t=!0!==e,r=t?this.clone().utc():this;return r.year()<0||r.year()>9999?U(r,t?"YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYYYY-MM-DD[T]HH:mm:ss.SSSZ"):I(Date.prototype.toISOString)?t?this.toDate().toISOString():new Date(this.valueOf()+60*this.utcOffset()*1e3).toISOString().replace("Z",U(r,"Z")):U(r,t?"YYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYY-MM-DD[T]HH:mm:ss.SSSZ")}function Jn(){if(!this.isValid())return"moment.invalid(/* "+this._i+" */)";var e,t,r,n,i="moment",s="";return this.isLocal()||(i=0===this.utcOffset()?"moment.utc":"moment.parseZone",s="Z"),e="["+i+'("]',t=0<=this.year()&&this.year()<=9999?"YYYY":"YYYYYY",r="-MM-DD[T]HH:mm:ss.SSS",n=s+'[")]',this.format(e+t+r+n)}function ei(e){e||(e=this.isUtc()?r.defaultFormatUtc:r.defaultFormat);var t=U(this,e);return this.localeData().postformat(t)}function ti(e,t){return this.isValid()&&(C(e)&&e.isValid()||Wr(e).isValid())?wn({to:this,from:e}).locale(this.locale()).humanize(!t):this.localeData().invalidDate()}function ri(e){return this.from(Wr(),e)}function ni(e,t){return this.isValid()&&(C(e)&&e.isValid()||Wr(e).isValid())?wn({from:this,to:e}).locale(this.locale()).humanize(!t):this.localeData().invalidDate()}function ii(e){return this.to(Wr(),e)}function si(e){var t;return void 0===e?this._locale._abbr:(null!=(t=gr(e))&&(this._locale=t),this)}r.defaultFormat="YYYY-MM-DDTHH:mm:ssZ",r.defaultFormatUtc="YYYY-MM-DDTHH:mm:ss[Z]";var ai=T("moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.",(function(e){return void 0===e?this.localeData():this.locale(e)}));function oi(){return this._locale}var li=1e3,ci=60*li,hi=60*ci,di=3506328*hi;function ui(e,t){return(e%t+t)%t}function pi(e,t,r){return e<100&&e>=0?new Date(e+400,t,r)-di:new Date(e,t,r).valueOf()}function fi(e,t,r){return e<100&&e>=0?Date.UTC(e+400,t,r)-di:Date.UTC(e,t,r)}function mi(e){var t,n;if(void 0===(e=re(e))||"millisecond"===e||!this.isValid())return this;switch(n=this._isUTC?fi:pi,e){case"year":t=n(this.year(),0,1);break;case"quarter":t=n(this.year(),this.month()-this.month()%3,1);break;case"month":t=n(this.year(),this.month(),1);break;case"week":t=n(this.year(),this.month(),this.date()-this.weekday());break;case"isoWeek":t=n(this.year(),this.month(),this.date()-(this.isoWeekday()-1));break;case"day":case"date":t=n(this.year(),this.month(),this.date());break;case"hour":t=this._d.valueOf(),t-=ui(t+(this._isUTC?0:this.utcOffset()*ci),hi);break;case"minute":t=this._d.valueOf(),t-=ui(t,ci);break;case"second":t=this._d.valueOf(),t-=ui(t,li)}return this._d.setTime(t),r.updateOffset(this,!0),this}function gi(e){var t,n;if(void 0===(e=re(e))||"millisecond"===e||!this.isValid())return this;switch(n=this._isUTC?fi:pi,e){case"year":t=n(this.year()+1,0,1)-1;break;case"quarter":t=n(this.year(),this.month()-this.month()%3+3,1)-1;break;case"month":t=n(this.year(),this.month()+1,1)-1;break;case"week":t=n(this.year(),this.month(),this.date()-this.weekday()+7)-1;break;case"isoWeek":t=n(this.year(),this.month(),this.date()-(this.isoWeekday()-1)+7)-1;break;case"day":case"date":t=n(this.year(),this.month(),this.date()+1)-1;break;case"hour":t=this._d.valueOf(),t+=hi-ui(t+(this._isUTC?0:this.utcOffset()*ci),hi)-1;break;case"minute":t=this._d.valueOf(),t+=ci-ui(t,ci)-1;break;case"second":t=this._d.valueOf(),t+=li-ui(t,li)-1}return this._d.setTime(t),r.updateOffset(this,!0),this}function yi(){return this._d.valueOf()-6e4*(this._offset||0)}function vi(){return Math.floor(this.valueOf()/1e3)}function bi(){return new Date(this.valueOf())}function Si(){var e=this;return[e.year(),e.month(),e.date(),e.hour(),e.minute(),e.second(),e.millisecond()]}function Ei(){var e=this;return{years:e.year(),months:e.month(),date:e.date(),hours:e.hours(),minutes:e.minutes(),seconds:e.seconds(),milliseconds:e.milliseconds()}}function Ci(){return this.isValid()?this.toISOString():null}function _i(){return g(this)}function Ti(){return u({},m(this))}function xi(){return m(this).overflow}function Pi(){return{input:this._i,format:this._f,locale:this._locale,isUTC:this._isUTC,strict:this._strict}}function wi(e,t){var n,i,s,a=this._eras||gr("en")._eras;for(n=0,i=a.length;n<i;++n)switch("string"==typeof a[n].since&&(s=r(a[n].since).startOf("day"),a[n].since=s.valueOf()),typeof a[n].until){case"undefined":a[n].until=1/0;break;case"string":s=r(a[n].until).startOf("day").valueOf(),a[n].until=s.valueOf()}return a}function Ii(e,t,r){var n,i,s,a,o,l=this.eras();for(e=e.toUpperCase(),n=0,i=l.length;n<i;++n)if(s=l[n].name.toUpperCase(),a=l[n].abbr.toUpperCase(),o=l[n].narrow.toUpperCase(),r)switch(t){case"N":case"NN":case"NNN":if(a===e)return l[n];break;case"NNNN":if(s===e)return l[n];break;case"NNNNN":if(o===e)return l[n]}else if([s,a,o].indexOf(e)>=0)return l[n]}function ki(e,t){var n=e.since<=e.until?1:-1;return void 0===t?r(e.since).year():r(e.since).year()+(t-e.offset)*n}function Ai(){var e,t,r,n=this.localeData().eras();for(e=0,t=n.length;e<t;++e){if(r=this.clone().startOf("day").valueOf(),n[e].since<=r&&r<=n[e].until)return n[e].name;if(n[e].until<=r&&r<=n[e].since)return n[e].name}return""}function Mi(){var e,t,r,n=this.localeData().eras();for(e=0,t=n.length;e<t;++e){if(r=this.clone().startOf("day").valueOf(),n[e].since<=r&&r<=n[e].until)return n[e].narrow;if(n[e].until<=r&&r<=n[e].since)return n[e].narrow}return""}function Ri(){var e,t,r,n=this.localeData().eras();for(e=0,t=n.length;e<t;++e){if(r=this.clone().startOf("day").valueOf(),n[e].since<=r&&r<=n[e].until)return n[e].abbr;if(n[e].until<=r&&r<=n[e].since)return n[e].abbr}return""}function Oi(){var e,t,n,i,s=this.localeData().eras();for(e=0,t=s.length;e<t;++e)if(n=s[e].since<=s[e].until?1:-1,i=this.clone().startOf("day").valueOf(),s[e].since<=i&&i<=s[e].until||s[e].until<=i&&i<=s[e].since)return(this.year()-r(s[e].since).year())*n+s[e].offset;return this.year()}function $i(e){return a(this,"_erasNameRegex")||zi.call(this),e?this._erasNameRegex:this._erasRegex}function Di(e){return a(this,"_erasAbbrRegex")||zi.call(this),e?this._erasAbbrRegex:this._erasRegex}function Li(e){return a(this,"_erasNarrowRegex")||zi.call(this),e?this._erasNarrowRegex:this._erasRegex}function Fi(e,t){return t.erasAbbrRegex(e)}function Ni(e,t){return t.erasNameRegex(e)}function Bi(e,t){return t.erasNarrowRegex(e)}function Vi(e,t){return t._eraYearOrdinalRegex||we}function zi(){var e,t,r=[],n=[],i=[],s=[],a=this.eras();for(e=0,t=a.length;e<t;++e)n.push(Le(a[e].name)),r.push(Le(a[e].abbr)),i.push(Le(a[e].narrow)),s.push(Le(a[e].name)),s.push(Le(a[e].abbr)),s.push(Le(a[e].narrow));this._erasRegex=new RegExp("^("+s.join("|")+")","i"),this._erasNameRegex=new RegExp("^("+n.join("|")+")","i"),this._erasAbbrRegex=new RegExp("^("+r.join("|")+")","i"),this._erasNarrowRegex=new RegExp("^("+i.join("|")+")","i")}function Ui(e,t){B(0,[e,e.length],0,t)}function ji(e){return Ki.call(this,e,this.week(),this.weekday(),this.localeData()._week.dow,this.localeData()._week.doy)}function Gi(e){return Ki.call(this,e,this.isoWeek(),this.isoWeekday(),1,4)}function Hi(){return Ct(this.year(),1,4)}function Zi(){return Ct(this.isoWeekYear(),1,4)}function Wi(){var e=this.localeData()._week;return Ct(this.year(),e.dow,e.doy)}function Yi(){var e=this.localeData()._week;return Ct(this.weekYear(),e.dow,e.doy)}function Ki(e,t,r,n,i){var s;return null==e?Et(this,n,i).year:(t>(s=Ct(e,n,i))&&(t=s),qi.call(this,e,t,r,n,i))}function qi(e,t,r,n,i){var s=St(e,t,r,n,i),a=vt(s.year,0,s.dayOfYear);return this.year(a.getUTCFullYear()),this.month(a.getUTCMonth()),this.date(a.getUTCDate()),this}function Qi(e){return null==e?Math.ceil((this.month()+1)/3):this.month(3*(e-1)+this.month()%3)}B("N",0,0,"eraAbbr"),B("NN",0,0,"eraAbbr"),B("NNN",0,0,"eraAbbr"),B("NNNN",0,0,"eraName"),B("NNNNN",0,0,"eraNarrow"),B("y",["y",1],"yo","eraYear"),B("y",["yy",2],0,"eraYear"),B("y",["yyy",3],0,"eraYear"),B("y",["yyyy",4],0,"eraYear"),Oe("N",Fi),Oe("NN",Fi),Oe("NNN",Fi),Oe("NNNN",Ni),Oe("NNNNN",Bi),Ne(["N","NN","NNN","NNNN","NNNNN"],(function(e,t,r,n){var i=r._locale.erasParse(e,n,r._strict);i?m(r).era=i:m(r).invalidEra=e})),Oe("y",we),Oe("yy",we),Oe("yyy",we),Oe("yyyy",we),Oe("yo",Vi),Ne(["y","yy","yyy","yyyy"],Ue),Ne(["yo"],(function(e,t,r,n){var i;r._locale._eraYearOrdinalRegex&&(i=e.match(r._locale._eraYearOrdinalRegex)),r._locale.eraYearOrdinalParse?t[Ue]=r._locale.eraYearOrdinalParse(e,i):t[Ue]=parseInt(e,10)})),B(0,["gg",2],0,(function(){return this.weekYear()%100})),B(0,["GG",2],0,(function(){return this.isoWeekYear()%100})),Ui("gggg","weekYear"),Ui("ggggg","weekYear"),Ui("GGGG","isoWeekYear"),Ui("GGGGG","isoWeekYear"),te("weekYear","gg"),te("isoWeekYear","GG"),se("weekYear",1),se("isoWeekYear",1),Oe("G",Ie),Oe("g",Ie),Oe("GG",Ee,ye),Oe("gg",Ee,ye),Oe("GGGG",xe,be),Oe("gggg",xe,be),Oe("GGGGG",Pe,Se),Oe("ggggg",Pe,Se),Be(["gggg","ggggg","GGGG","GGGGG"],(function(e,t,r,n){t[n.substr(0,2)]=ce(e)})),Be(["gg","GG"],(function(e,t,n,i){t[i]=r.parseTwoDigitYear(e)})),B("Q",0,"Qo","quarter"),te("quarter","Q"),se("quarter",7),Oe("Q",ge),Ne("Q",(function(e,t){t[je]=3*(ce(e)-1)})),B("D",["DD",2],"Do","date"),te("date","D"),se("date",9),Oe("D",Ee),Oe("DD",Ee,ye),Oe("Do",(function(e,t){return e?t._dayOfMonthOrdinalParse||t._ordinalParse:t._dayOfMonthOrdinalParseLenient})),Ne(["D","DD"],Ge),Ne("Do",(function(e,t){t[Ge]=ce(e.match(Ee)[0])}));var Xi=he("Date",!0);function Ji(e){var t=Math.round((this.clone().startOf("day")-this.clone().startOf("year"))/864e5)+1;return null==e?t:this.add(e-t,"d")}B("DDD",["DDDD",3],"DDDo","dayOfYear"),te("dayOfYear","DDD"),se("dayOfYear",4),Oe("DDD",Te),Oe("DDDD",ve),Ne(["DDD","DDDD"],(function(e,t,r){r._dayOfYear=ce(e)})),B("m",["mm",2],0,"minute"),te("minute","m"),se("minute",14),Oe("m",Ee),Oe("mm",Ee,ye),Ne(["m","mm"],Ze);var es=he("Minutes",!1);B("s",["ss",2],0,"second"),te("second","s"),se("second",15),Oe("s",Ee),Oe("ss",Ee,ye),Ne(["s","ss"],We);var ts,rs,ns=he("Seconds",!1);for(B("S",0,0,(function(){return~~(this.millisecond()/100)})),B(0,["SS",2],0,(function(){return~~(this.millisecond()/10)})),B(0,["SSS",3],0,"millisecond"),B(0,["SSSS",4],0,(function(){return 10*this.millisecond()})),B(0,["SSSSS",5],0,(function(){return 100*this.millisecond()})),B(0,["SSSSSS",6],0,(function(){return 1e3*this.millisecond()})),B(0,["SSSSSSS",7],0,(function(){return 1e4*this.millisecond()})),B(0,["SSSSSSSS",8],0,(function(){return 1e5*this.millisecond()})),B(0,["SSSSSSSSS",9],0,(function(){return 1e6*this.millisecond()})),te("millisecond","ms"),se("millisecond",16),Oe("S",Te,ge),Oe("SS",Te,ye),Oe("SSS",Te,ve),ts="SSSS";ts.length<=9;ts+="S")Oe(ts,we);function is(e,t){t[Ye]=ce(1e3*("0."+e))}for(ts="S";ts.length<=9;ts+="S")Ne(ts,is);function ss(){return this._isUTC?"UTC":""}function as(){return this._isUTC?"Coordinated Universal Time":""}rs=he("Milliseconds",!1),B("z",0,0,"zoneAbbr"),B("zz",0,0,"zoneName");var os=E.prototype;function ls(e){return Wr(1e3*e)}function cs(){return Wr.apply(null,arguments).parseZone()}function hs(e){return e}os.add=On,os.calendar=zn,os.clone=Un,os.diff=Kn,os.endOf=gi,os.format=ei,os.from=ti,os.fromNow=ri,os.to=ni,os.toNow=ii,os.get=pe,os.invalidAt=xi,os.isAfter=jn,os.isBefore=Gn,os.isBetween=Hn,os.isSame=Zn,os.isSameOrAfter=Wn,os.isSameOrBefore=Yn,os.isValid=_i,os.lang=ai,os.locale=si,os.localeData=oi,os.max=Kr,os.min=Yr,os.parsingFlags=Ti,os.set=fe,os.startOf=mi,os.subtract=$n,os.toArray=Si,os.toObject=Ei,os.toDate=bi,os.toISOString=Xn,os.inspect=Jn,"undefined"!=typeof Symbol&&null!=Symbol.for&&(os[Symbol.for("nodejs.util.inspect.custom")]=function(){return"Moment<"+this.format()+">"}),os.toJSON=Ci,os.toString=Qn,os.unix=vi,os.valueOf=yi,os.creationData=Pi,os.eraName=Ai,os.eraNarrow=Mi,os.eraAbbr=Ri,os.eraYear=Oi,os.year=mt,os.isLeapYear=gt,os.weekYear=ji,os.isoWeekYear=Gi,os.quarter=os.quarters=Qi,os.month=ct,os.daysInMonth=ht,os.week=os.weeks=wt,os.isoWeek=os.isoWeeks=It,os.weeksInYear=Wi,os.weeksInWeekYear=Yi,os.isoWeeksInYear=Hi,os.isoWeeksInISOWeekYear=Zi,os.date=Xi,os.day=os.days=jt,os.weekday=Gt,os.isoWeekday=Ht,os.dayOfYear=Ji,os.hour=os.hours=rr,os.minute=os.minutes=es,os.second=os.seconds=ns,os.millisecond=os.milliseconds=rs,os.utcOffset=fn,os.utc=gn,os.local=yn,os.parseZone=vn,os.hasAlignedHourOffset=bn,os.isDST=Sn,os.isLocal=Cn,os.isUtcOffset=_n,os.isUtc=Tn,os.isUTC=Tn,os.zoneAbbr=ss,os.zoneName=as,os.dates=T("dates accessor is deprecated. Use date instead.",Xi),os.months=T("months accessor is deprecated. Use month instead",ct),os.years=T("years accessor is deprecated. Use year instead",mt),os.zone=T("moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/",mn),os.isDSTShifted=T("isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information",En);var ds=M.prototype;function us(e,t,r,n){var i=gr(),s=p().set(n,t);return i[r](s,e)}function ps(e,t,r){if(c(e)&&(t=e,e=void 0),e=e||"",null!=t)return us(e,t,r,"month");var n,i=[];for(n=0;n<12;n++)i[n]=us(e,n,r,"month");return i}function fs(e,t,r,n){"boolean"==typeof e?(c(t)&&(r=t,t=void 0),t=t||""):(r=t=e,e=!1,c(t)&&(r=t,t=void 0),t=t||"");var i,s=gr(),a=e?s._week.dow:0,o=[];if(null!=r)return us(t,(r+a)%7,n,"day");for(i=0;i<7;i++)o[i]=us(t,(i+a)%7,n,"day");return o}function ms(e,t){return ps(e,t,"months")}function gs(e,t){return ps(e,t,"monthsShort")}function ys(e,t,r){return fs(e,t,r,"weekdays")}function vs(e,t,r){return fs(e,t,r,"weekdaysShort")}function bs(e,t,r){return fs(e,t,r,"weekdaysMin")}ds.calendar=O,ds.longDateFormat=H,ds.invalidDate=W,ds.ordinal=q,ds.preparse=hs,ds.postformat=hs,ds.relativeTime=X,ds.pastFuture=J,ds.set=k,ds.eras=wi,ds.erasParse=Ii,ds.erasConvertYear=ki,ds.erasAbbrRegex=Di,ds.erasNameRegex=$i,ds.erasNarrowRegex=Li,ds.months=it,ds.monthsShort=st,ds.monthsParse=ot,ds.monthsRegex=ut,ds.monthsShortRegex=dt,ds.week=_t,ds.firstDayOfYear=Pt,ds.firstDayOfWeek=xt,ds.weekdays=Nt,ds.weekdaysMin=Vt,ds.weekdaysShort=Bt,ds.weekdaysParse=Ut,ds.weekdaysRegex=Zt,ds.weekdaysShortRegex=Wt,ds.weekdaysMinRegex=Yt,ds.isPM=er,ds.meridiem=nr,pr("en",{eras:[{since:"0001-01-01",until:1/0,offset:1,name:"Anno Domini",narrow:"AD",abbr:"AD"},{since:"0000-12-31",until:-1/0,offset:1,name:"Before Christ",narrow:"BC",abbr:"BC"}],dayOfMonthOrdinalParse:/\d{1,2}(th|st|nd|rd)/,ordinal:function(e){var t=e%10;return e+(1===ce(e%100/10)?"th":1===t?"st":2===t?"nd":3===t?"rd":"th")}}),r.lang=T("moment.lang is deprecated. Use moment.locale instead.",pr),r.langData=T("moment.langData is deprecated. Use moment.localeData instead.",gr);var Ss=Math.abs;function Es(){var e=this._data;return this._milliseconds=Ss(this._milliseconds),this._days=Ss(this._days),this._months=Ss(this._months),e.milliseconds=Ss(e.milliseconds),e.seconds=Ss(e.seconds),e.minutes=Ss(e.minutes),e.hours=Ss(e.hours),e.months=Ss(e.months),e.years=Ss(e.years),this}function Cs(e,t,r,n){var i=wn(t,r);return e._milliseconds+=n*i._milliseconds,e._days+=n*i._days,e._months+=n*i._months,e._bubble()}function _s(e,t){return Cs(this,e,t,1)}function Ts(e,t){return Cs(this,e,t,-1)}function xs(e){return e<0?Math.floor(e):Math.ceil(e)}function Ps(){var e,t,r,n,i,s=this._milliseconds,a=this._days,o=this._months,l=this._data;return s>=0&&a>=0&&o>=0||s<=0&&a<=0&&o<=0||(s+=864e5*xs(Is(o)+a),a=0,o=0),l.milliseconds=s%1e3,e=le(s/1e3),l.seconds=e%60,t=le(e/60),l.minutes=t%60,r=le(t/60),l.hours=r%24,a+=le(r/24),o+=i=le(ws(a)),a-=xs(Is(i)),n=le(o/12),o%=12,l.days=a,l.months=o,l.years=n,this}function ws(e){return 4800*e/146097}function Is(e){return 146097*e/4800}function ks(e){if(!this.isValid())return NaN;var t,r,n=this._milliseconds;if("month"===(e=re(e))||"quarter"===e||"year"===e)switch(t=this._days+n/864e5,r=this._months+ws(t),e){case"month":return r;case"quarter":return r/3;case"year":return r/12}else switch(t=this._days+Math.round(Is(this._months)),e){case"week":return t/7+n/6048e5;case"day":return t+n/864e5;case"hour":return 24*t+n/36e5;case"minute":return 1440*t+n/6e4;case"second":return 86400*t+n/1e3;case"millisecond":return Math.floor(864e5*t)+n;default:throw new Error("Unknown unit "+e)}}function As(){return this.isValid()?this._milliseconds+864e5*this._days+this._months%12*2592e6+31536e6*ce(this._months/12):NaN}function Ms(e){return function(){return this.as(e)}}var Rs=Ms("ms"),Os=Ms("s"),$s=Ms("m"),Ds=Ms("h"),Ls=Ms("d"),Fs=Ms("w"),Ns=Ms("M"),Bs=Ms("Q"),Vs=Ms("y");function zs(){return wn(this)}function Us(e){return e=re(e),this.isValid()?this[e+"s"]():NaN}function js(e){return function(){return this.isValid()?this._data[e]:NaN}}var Gs=js("milliseconds"),Hs=js("seconds"),Zs=js("minutes"),Ws=js("hours"),Ys=js("days"),Ks=js("months"),qs=js("years");function Qs(){return le(this.days()/7)}var Xs=Math.round,Js={ss:44,s:45,m:45,h:22,d:26,w:null,M:11};function ea(e,t,r,n,i){return i.relativeTime(t||1,!!r,e,n)}function ta(e,t,r,n){var i=wn(e).abs(),s=Xs(i.as("s")),a=Xs(i.as("m")),o=Xs(i.as("h")),l=Xs(i.as("d")),c=Xs(i.as("M")),h=Xs(i.as("w")),d=Xs(i.as("y")),u=s<=r.ss&&["s",s]||s<r.s&&["ss",s]||a<=1&&["m"]||a<r.m&&["mm",a]||o<=1&&["h"]||o<r.h&&["hh",o]||l<=1&&["d"]||l<r.d&&["dd",l];return null!=r.w&&(u=u||h<=1&&["w"]||h<r.w&&["ww",h]),(u=u||c<=1&&["M"]||c<r.M&&["MM",c]||d<=1&&["y"]||["yy",d])[2]=t,u[3]=+e>0,u[4]=n,ea.apply(null,u)}function ra(e){return void 0===e?Xs:"function"==typeof e&&(Xs=e,!0)}function na(e,t){return void 0!==Js[e]&&(void 0===t?Js[e]:(Js[e]=t,"s"===e&&(Js.ss=t-1),!0))}function ia(e,t){if(!this.isValid())return this.localeData().invalidDate();var r,n,i=!1,s=Js;return"object"==typeof e&&(t=e,e=!1),"boolean"==typeof e&&(i=e),"object"==typeof t&&(s=Object.assign({},Js,t),null!=t.s&&null==t.ss&&(s.ss=t.s-1)),n=ta(this,!i,s,r=this.localeData()),i&&(n=r.pastFuture(+this,n)),r.postformat(n)}var sa=Math.abs;function aa(e){return(e>0)-(e<0)||+e}function oa(){if(!this.isValid())return this.localeData().invalidDate();var e,t,r,n,i,s,a,o,l=sa(this._milliseconds)/1e3,c=sa(this._days),h=sa(this._months),d=this.asSeconds();return d?(e=le(l/60),t=le(e/60),l%=60,e%=60,r=le(h/12),h%=12,n=l?l.toFixed(3).replace(/\.?0+$/,""):"",i=d<0?"-":"",s=aa(this._months)!==aa(d)?"-":"",a=aa(this._days)!==aa(d)?"-":"",o=aa(this._milliseconds)!==aa(d)?"-":"",i+"P"+(r?s+r+"Y":"")+(h?s+h+"M":"")+(c?a+c+"D":"")+(t||e||l?"T":"")+(t?o+t+"H":"")+(e?o+e+"M":"")+(l?o+n+"S":"")):"P0D"}var la=sn.prototype;return la.isValid=rn,la.abs=Es,la.add=_s,la.subtract=Ts,la.as=ks,la.asMilliseconds=Rs,la.asSeconds=Os,la.asMinutes=$s,la.asHours=Ds,la.asDays=Ls,la.asWeeks=Fs,la.asMonths=Ns,la.asQuarters=Bs,la.asYears=Vs,la.valueOf=As,la._bubble=Ps,la.clone=zs,la.get=Us,la.milliseconds=Gs,la.seconds=Hs,la.minutes=Zs,la.hours=Ws,la.days=Ys,la.weeks=Qs,la.months=Ks,la.years=qs,la.humanize=ia,la.toISOString=oa,la.toString=oa,la.toJSON=oa,la.locale=si,la.localeData=oi,la.toIsoString=T("toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)",oa),la.lang=ai,B("X",0,0,"unix"),B("x",0,0,"valueOf"),Oe("x",Ie),Oe("X",Me),Ne("X",(function(e,t,r){r._d=new Date(1e3*parseFloat(e))})),Ne("x",(function(e,t,r){r._d=new Date(ce(e))})),
2
2
  //! moment.js
3
- r.version="2.29.4",n(Wr),r.fn=os,r.min=Qr,r.max=Xr,r.now=Jr,r.utc=p,r.unix=ls,r.months=ms,r.isDate=h,r.locale=pr,r.invalid=y,r.duration=wn,r.isMoment=C,r.weekdays=ys,r.parseZone=cs,r.localeData=gr,r.isDuration=an,r.monthsShort=gs,r.weekdaysMin=bs,r.defineLocale=fr,r.updateLocale=mr,r.locales=yr,r.weekdaysShort=vs,r.normalizeUnits=re,r.relativeTimeRounding=ra,r.relativeTimeThreshold=na,r.calendarFormat=Vn,r.prototype=os,r.HTML5_FMT={DATETIME_LOCAL:"YYYY-MM-DDTHH:mm",DATETIME_LOCAL_SECONDS:"YYYY-MM-DDTHH:mm:ss",DATETIME_LOCAL_MS:"YYYY-MM-DDTHH:mm:ss.SSS",DATE:"YYYY-MM-DD",TIME:"HH:mm",TIME_SECONDS:"HH:mm:ss",TIME_MS:"HH:mm:ss.SSS",WEEK:"GGGG-[W]WW",MONTH:"YYYY-MM"},r}();var moment=moment$1.exports;const ZSession=z.object({id:z.string().min(1),created:z.date().or(z.string()).transform((e=>moment(e).toDate())),expire:z.boolean().default(!1).optional()}).strict(),ZOptions=z.object({localStorageKey:z.string().min(3).default("pxss"),keepSession:z.number().int().min(3).default(10)});class Session{get current(){return this._current}get noSession(){return new URLSearchParams(window.location.search).has("noSession")}get id(){if(this.noSession)return null;const e=window.localStorage.getItem(this.localStorageKey);if(null===e)return null;const t=ZSession.safeParse(JSON.parse(e));if(!t.success)return this.unset(),null;const r=t.data;return moment(r.created).add(this.options.keepSession,"seconds").isBefore(moment())?(this.unset(),null):r.id}get localStorageKey(){return this.options.localStorageKey}constructor(e){this.options=ZOptions.parse(e||{})}set(e){ZSession.shape.id.parse(e),this._current=e;const t={id:e,created:moment().toDate(),expire:!1};window.localStorage.setItem(this.localStorageKey,JSON.stringify(t))}unset(){window.localStorage.removeItem(this.localStorageKey)}}const ZErrorMessage=z.object({type:z.literal("error"),code:z.number().int(),reason:z.string(),verbosity:z.number()}),ZLoveLetter=z.object({type:z.literal("letter"),reason:z.string().startsWith("LL: "),code:z.number(),verbosity:z.number()}),ZSessionId=z.object({type:z.literal("sessionId"),sessionId:z.string()});function zat(e,t){const r=null!=t?t:e,n=r===e?"i":e;return r._def.acl=n,r}const WebSdkSettings=z.object({conf:zat(z.object({fullscreenButton:zat(z.boolean().default(!0).describe(["Full-Screen Button|","Override Enable/Disable the full screen overlay-button."].join("\n"))).optional(),stopButton:zat(z.boolean().default(!0).describe(["Stop Button|","Override Enable/Disable the stop overlay-button."].join("\n"))).optional(),audioButton:zat(z.boolean().default(!1).describe(["Audio Button|","Override Enable/Disable the audio overlay-button."].join("\n"))).optional(),infoButton:zat(z.boolean().default(!1).describe(["Info Button|","Override Enable/Disable the info overlay-button."].join("\n"))).optional(),micButton:zat(z.boolean().default(!1).describe(["Mic Button|","Override Enable/Disable the microphone overlay-button."].join("\n"))).optional(),settingsButton:zat(z.boolean().default(!1).describe(["Settings Button|","Override Enable/Disable the settings overlay-button."].join("\n"))).optional(),connectionStrengthIcon:zat(z.boolean().default(!1).describe(["Connection Strength|","Override Enable/Disable the connection strength overlay-icon."].join("\n"))).optional()})).optional(),init:zat(z.object({KeyboardInput:zat(z.boolean().default(!0).describe(["KeyboardInput|","Override keyboard input property of the integration."].join("\n"))).optional(),MouseInput:zat(z.boolean().default(!0).describe(["MouseInput|","Override mouse input property of the integration."].join("\n"))).optional(),GamepadInput:zat(z.boolean().describe(["GamepadInput|","Override game input property of the integration."].join("\n"))).optional(),TouchInput:zat(z.boolean().describe(["TouchInput|","Override touch input property of the integration."].join("\n"))).optional(),XRControllerInput:zat(z.boolean().describe(["XRControllerInput|","Override xr controller input property of the integration."].join("\n"))).optional(),UseMic:zat(z.boolean().describe(["UseMic|","Override use mic property of the integration."].join("\n"))).optional(),FakeMouseWithTouches:zat(z.boolean().describe(["FakeMouseWithTouches|","Override fake mouse with touches property of the integration."].join("\n"))).optional(),ForceMonoAudio:zat(z.boolean().describe(["ForceMonoAudio|","Override force mono property of the integration."].join("\n"))).optional(),HoveringMouse:zat(z.boolean().describe(["HoveringMouse|","Override hovering mouse property of the integration."].join("\n"))).optional(),MatchViewportRes:zat(z.boolean().describe(["MatchViewportRes|","Override match viewport res property of the integration."].join("\n"))).optional(),SuppressBrowserKeys:zat(z.boolean().describe(["SuppressBrowserKeys|","Override suppress browser keys property of the integration."].join("\n"))).optional()})).optional()}).strict(),ZStreamInfo=z.object({type:z.literal("streamInfo"),streamInfo:z.object({guid:z.string(),autoPlay:z.boolean().optional(),touchCapable:z.boolean().optional(),resolution:z.object({width:z.number().int().nonnegative(),height:z.number().int().nonnegative(),dynamic:z.boolean().optional(),fixed:z.boolean().optional()}).optional(),meta:z.object({friendlyName:z.string().optional(),ueVersion:z.string().optional(),version:z.string().optional(),mouseLock:z.boolean().optional()}).optional(),webSdkSettings:WebSdkSettings.optional(),afk:z.object({enabled:z.boolean().describe("Enables / Disables AFK functionality."),warn:z.number().int().nonnegative().describe("Time in seconds, after last interaction, when the first warning will be triggered."),error:z.number().int().nonnegative().describe("Time in seconds, after warn trigger, when a more pushy warning will be triggered."),action:z.number().int().nonnegative().describe("Time in seconds, after error trigger, the actual disconnection action will take place.")},{description:"AFK stands for 'away from keyboard' and describes a timeout based on activity of the actual project. All execution of these settings are prone to frontend and therefore no full security measure for abuse! These settings can be overwritten by shareId, but would overwrite the settings given through frontend configuration."}).optional()})}),ZStats=z.object({type:z.literal("stats"),stats:z.object({codecs:z.custom(),candidatePair:z.custom(),localCandidates:z.custom(),remoteCandidates:z.custom(),DataChannelStats:z.custom(),bytesReceived:z.number(),packetsLost:z.number(),frameWidth:z.number(),frameHeight:z.number(),framesDecoded:z.number(),framesPerSecond:z.number(),framesDropped:z.number(),videoCodec:z.string(),audioCodec:z.string(),browserInfo:z.object({userAgent:z.string(),platform:z.string().nullable(),language:z.string()}).passthrough().partial(),currentRTT:z.number(),sessionRunTime:z.string(),controlsStreamInput:z.string().refine((e=>"true"===e||"false"===e)),videoEncoderAvgQP:z.number(),videoBitrate:z.number(),audioBitrate:z.number()}).passthrough().partial()}),ZPing=z.object({type:z.literal("ping"),message:z.string()}),ZQueue=z.object({type:z.literal("queue"),queue:z.object({index:z.number().int().optional(),queueLength:z.number().int().optional(),waited:z.number().optional(),estimatedWaitTime:z.number().optional(),averageWaitTime:z.number().optional(),valueType:z.enum(["milliseconds","seconds","minutes","hours","days"])})}),ZVersion=z.object({type:z.literal("version"),version:z.string().optional()}),Send={stats:ZStats},ArcwareSettingsSchema=z.object({session:z.string().optional(),token:z.string().optional(),bypass:z.boolean().optional(),errorHandler:z.function().args(ZErrorMessage).returns(z.void()).optional(),queueHandler:z.function().args(ZQueue).returns(z.void()).optional(),sessionIdHandler:z.function().args(z.string()).returns(z.void()).optional(),loveLetterHandler:z.function().args(ZLoveLetter).returns(z.void()).optional(),fullscreenButton:z.boolean().optional(),settingsButton:z.boolean().optional(),infoButton:z.boolean().optional(),audioButton:z.boolean().optional(),micButton:z.boolean().optional(),stopButton:z.boolean().optional(),connectionStrengthIcon:z.boolean().optional(),shareId:z.string().startsWith("share-").optional(),projectId:z.string().optional(),loveLetterLogging:z.boolean().optional(),connectionIdentifierLoggingDisabled:z.boolean().optional()}),DefaultUrl="wss://signalling-client.ragnarok.arcware.cloud";Vt.Log=(e,t,r)=>{},Vt.Info=(e,t,r)=>{},Vt.Warning=(e,t,r)=>{console.warn(t,e)},Vt.Error=(e,t,r)=>{(null==t?void 0:t.startsWith("unhandled Stat Type"))||console.error(t,e)};class ArcwareConfig extends Pt{static PickIdsOfUrl(){const{pathname:e}=new URL(window.location.href),t=e.split("/");return{projectId:t.find((e=>z.string().uuid().safeParse(e).success)),shareId:t.find((e=>z.string().startsWith("share-").safeParse(e).success))}}constructor(e){var t,r;if(!new URL(window.location.href).search.slice(1).split("&").find((e=>e.startsWith("df-")))&&!e.settings.shareId&&!e.settings.projectId)throw new Error("ShareId or ProjectId must be specified.");const n=ArcwareSettingsSchema.parse(e.settings);e.initialSettings||(e.initialSettings={}),(null===(t=e.initialSettings)||void 0===t?void 0:t.hasOwnProperty("AutoConnect"))||(e.initialSettings.AutoConnect=!1),(null===(r=e.initialSettings)||void 0===r?void 0:r.hasOwnProperty("AFKTimeout"))||(e.initialSettings.AFKTimeout=600),e.initialSettings.ss||(e.initialSettings.ss=DefaultUrl),super(e),this.VERSION="0.1.2",this.settings=n,this.session=new Session,this._initialSettings=e.initialSettings,this.setFlagEnabled(Ot.AFKDetection,!0),this.setFlagEnabled(Ot.BrowserSendOffer,!0)}get urlFlags(){var e;let t="";if(this.settings.shareId&&(t+=`&sh=${this.settings.shareId}`),this.settings.projectId&&(t+=`&p=${this.settings.projectId}`),"string"==typeof this.settings.session)t+=`&s=${this.settings.session}`;else{const e=this.session.id;e&&(t+=`&s=${e}`,t+="&r=true")}this.settings.bypass&&(t+="&b=true"),this.settings.token&&(t+=`&t=${this.settings.token}`);const r=null!==(e=new URLSearchParams(window.location.search).get("rId"))&&void 0!==e?e:void 0;r&&(t+=`&rId=${r}`);const n=new URL(window.location.href).search.slice(1).split("&").find((e=>e.startsWith("df-")));return n&&(t+=`&${n}`),t}get initialSettings(){return this._initialSettings}modifyInitialSettings(e){this.setFlagEnabled(Ot.HoveringMouseMode,e)}}var call=functionCall,hasOwn=hasOwnProperty_1,isPrototypeOf=objectIsPrototypeOf,regExpFlags=regexpFlags$1,RegExpPrototype$1=RegExp.prototype,regexpGetFlags=function(e){var t=e.flags;return void 0!==t||"flags"in RegExpPrototype$1||hasOwn(e,"flags")||!isPrototypeOf(RegExpPrototype$1,e)?t:call(regExpFlags,e)},PROPER_FUNCTION_NAME=functionName.PROPER,defineBuiltIn=defineBuiltIn$8,anObject=anObject$e,$toString=toString$7,fails=fails$k,getRegExpFlags=regexpGetFlags,TO_STRING="toString",RegExpPrototype=RegExp.prototype,nativeToString=RegExpPrototype[TO_STRING],NOT_GENERIC=fails((function(){return"/a/b"!=nativeToString.call({source:"a",flags:"b"})})),INCORRECT_NAME=PROPER_FUNCTION_NAME&&nativeToString.name!=TO_STRING;function UrlBuilder(e,t){const r=new URL(decodeURIComponent(e())),n=r.searchParams;let i=t;return i&&(i.startsWith("?")&&(i=i.substring(1)),i.split("&").forEach((e=>{const[t,r]=e.split("=");n.append(t,r)}))),r.toString()}function ApplyUrlHack(){const e=jt.prototype.setWebRtcPlayerController;jt.prototype.setWebRtcPlayerController=function(t){const r=t.signallingUrlBuilder;t.signallingUrlBuilder=()=>UrlBuilder(r,this.config.urlFlags),e.call(this,t)}}(NOT_GENERIC||INCORRECT_NAME)&&defineBuiltIn(RegExp.prototype,TO_STRING,(function(){var e=anObject(this);return"/"+$toString(e.source)+"/"+$toString(getRegExpFlags(e))}),{unsafe:!0});class EventHandler{add(e){return this.callbacks.find((t=>t===e))?null:(this.callbacks.push(e),e)}remove(e){const t=this.callbacks.find((t=>t===e));return t&&this.callbacks.splice(this.callbacks.indexOf(t),1),!!t}constructor(){this.callbacks=new Array}static Emit(e,t){e.callbacks.forEach((e=>e(t)))}}function Stats(e){return ZStats.shape.stats.parse({codecs:e.codecs,candidatePair:e.candidatePair,localCandidates:e.localCandidates,remoteCandidates:e.remoteCandidates,DataChannelStats:e.DataChannelStats,bytesReceived:e.inboundVideoStats.bytesReceived,packetsLost:e.inboundVideoStats.packetsLost,frameWidth:e.inboundVideoStats.frameWidth,frameHeight:e.inboundVideoStats.frameHeight,framesDecoded:e.inboundVideoStats.framesDecoded,framesPerSecond:e.inboundVideoStats.framesPerSecond,framesDropped:e.inboundVideoStats.framesDropped,videoCodec:e.inboundVideoStats.codecId,audioCodec:e.inboundAudioStats.codecId,browserInfo:{userAgent:navigator.userAgent,platform:navigator.oscpu||navigator.platform||null,language:navigator.language},currentRTT:e.candidatePair.currentRoundTripTime,sessionRunTime:e.sessionStats.runTime,controlsStreamInput:e.sessionStats.controlsStreamInput,videoEncoderAvgQP:e.sessionStats.videoEncoderAvgQP,videoBitrate:e.inboundVideoStats.bitrate,audioBitrate:e.inboundAudioStats.bitrate})}var lodash={exports:{}};
3
+ r.version="2.29.4",n(Wr),r.fn=os,r.min=Qr,r.max=Xr,r.now=Jr,r.utc=p,r.unix=ls,r.months=ms,r.isDate=h,r.locale=pr,r.invalid=y,r.duration=wn,r.isMoment=C,r.weekdays=ys,r.parseZone=cs,r.localeData=gr,r.isDuration=an,r.monthsShort=gs,r.weekdaysMin=bs,r.defineLocale=fr,r.updateLocale=mr,r.locales=yr,r.weekdaysShort=vs,r.normalizeUnits=re,r.relativeTimeRounding=ra,r.relativeTimeThreshold=na,r.calendarFormat=Vn,r.prototype=os,r.HTML5_FMT={DATETIME_LOCAL:"YYYY-MM-DDTHH:mm",DATETIME_LOCAL_SECONDS:"YYYY-MM-DDTHH:mm:ss",DATETIME_LOCAL_MS:"YYYY-MM-DDTHH:mm:ss.SSS",DATE:"YYYY-MM-DD",TIME:"HH:mm",TIME_SECONDS:"HH:mm:ss",TIME_MS:"HH:mm:ss.SSS",WEEK:"GGGG-[W]WW",MONTH:"YYYY-MM"},r}();var moment=moment$1.exports;const ZSession=z.object({id:z.string().min(1),created:z.date().or(z.string()).transform((e=>moment(e).toDate())),expire:z.boolean().default(!1).optional()}).strict(),ZOptions=z.object({localStorageKey:z.string().min(3).default("pxss"),keepSession:z.number().int().min(3).default(10)});class Session{get current(){return this._current}get noSession(){return new URLSearchParams(window.location.search).has("noSession")}get id(){if(this.noSession)return null;const e=window.localStorage.getItem(this.localStorageKey);if(null===e)return null;const t=ZSession.safeParse(JSON.parse(e));if(!t.success)return this.unset(),null;const r=t.data;return moment(r.created).add(this.options.keepSession,"seconds").isBefore(moment())?(this.unset(),null):r.id}get localStorageKey(){return this.options.localStorageKey}constructor(e){this.options=ZOptions.parse(e||{})}set(e){ZSession.shape.id.parse(e),this._current=e;const t={id:e,created:moment().toDate(),expire:!1};window.localStorage.setItem(this.localStorageKey,JSON.stringify(t))}unset(){window.localStorage.removeItem(this.localStorageKey)}}const ZErrorMessage=z.object({type:z.literal("error"),code:z.number().int(),reason:z.string(),verbosity:z.number()}),ZLoveLetter=z.object({type:z.literal("letter"),reason:z.string().startsWith("LL: "),code:z.number(),verbosity:z.number()}),ZSessionId=z.object({type:z.literal("sessionId"),sessionId:z.string()});function zat(e,t){const r=null!=t?t:e,n=r===e?"i":e;return r._def.acl=n,r}const WebSdkSettings=z.object({conf:zat(z.object({fullscreenButton:zat(z.boolean().default(!0).describe(["Full-Screen Button|","Override Enable/Disable the full screen overlay-button."].join("\n"))).optional(),stopButton:zat(z.boolean().default(!0).describe(["Stop Button|","Override Enable/Disable the stop overlay-button."].join("\n"))).optional(),audioButton:zat(z.boolean().default(!1).describe(["Audio Button|","Override Enable/Disable the audio overlay-button."].join("\n"))).optional(),infoButton:zat(z.boolean().default(!1).describe(["Info Button|","Override Enable/Disable the info overlay-button."].join("\n"))).optional(),micButton:zat(z.boolean().default(!1).describe(["Mic Button|","Override Enable/Disable the microphone overlay-button."].join("\n"))).optional(),settingsButton:zat(z.boolean().default(!1).describe(["Settings Button|","Override Enable/Disable the settings overlay-button."].join("\n"))).optional(),connectionStrengthIcon:zat(z.boolean().default(!1).describe(["Connection Strength|","Override Enable/Disable the connection strength overlay-icon."].join("\n"))).optional()})).optional(),init:zat(z.object({KeyboardInput:zat(z.boolean().default(!0).describe(["KeyboardInput|","Override keyboard input property of the integration."].join("\n"))).optional(),MouseInput:zat(z.boolean().default(!0).describe(["MouseInput|","Override mouse input property of the integration."].join("\n"))).optional(),GamepadInput:zat(z.boolean().describe(["GamepadInput|","Override game input property of the integration."].join("\n"))).optional(),TouchInput:zat(z.boolean().describe(["TouchInput|","Override touch input property of the integration."].join("\n"))).optional(),XRControllerInput:zat(z.boolean().describe(["XRControllerInput|","Override xr controller input property of the integration."].join("\n"))).optional(),UseMic:zat(z.boolean().describe(["UseMic|","Override use mic property of the integration."].join("\n"))).optional(),FakeMouseWithTouches:zat(z.boolean().describe(["FakeMouseWithTouches|","Override fake mouse with touches property of the integration."].join("\n"))).optional(),ForceMonoAudio:zat(z.boolean().describe(["ForceMonoAudio|","Override force mono property of the integration."].join("\n"))).optional(),HoveringMouse:zat(z.boolean().describe(["HoveringMouse|","Override hovering mouse property of the integration."].join("\n"))).optional(),MatchViewportRes:zat(z.boolean().describe(["MatchViewportRes|","Override match viewport res property of the integration."].join("\n"))).optional(),SuppressBrowserKeys:zat(z.boolean().describe(["SuppressBrowserKeys|","Override suppress browser keys property of the integration."].join("\n"))).optional()})).optional()}).strict(),ZStreamInfo=z.object({type:z.literal("streamInfo"),streamInfo:z.object({guid:z.string(),autoPlay:z.boolean().optional(),touchCapable:z.boolean().optional(),resolution:z.object({width:z.number().int().nonnegative(),height:z.number().int().nonnegative(),dynamic:z.boolean().optional(),fixed:z.boolean().optional()}).optional(),meta:z.object({friendlyName:z.string().optional(),ueVersion:z.string().optional(),version:z.string().optional(),mouseLock:z.boolean().optional()}).optional(),webSdkSettings:WebSdkSettings.optional(),afk:z.object({enabled:z.boolean().describe("Enables / Disables AFK functionality."),warn:z.number().int().nonnegative().describe("Time in seconds, after last interaction, when the first warning will be triggered."),error:z.number().int().nonnegative().describe("Time in seconds, after warn trigger, when a more pushy warning will be triggered."),action:z.number().int().nonnegative().describe("Time in seconds, after error trigger, the actual disconnection action will take place.")},{description:"AFK stands for 'away from keyboard' and describes a timeout based on activity of the actual project. All execution of these settings are prone to frontend and therefore no full security measure for abuse! These settings can be overwritten by shareId, but would overwrite the settings given through frontend configuration."}).optional()})}),ZStats=z.object({type:z.literal("stats"),stats:z.object({codecs:z.custom(),candidatePair:z.custom(),localCandidates:z.custom(),remoteCandidates:z.custom(),DataChannelStats:z.custom(),bytesReceived:z.number(),packetsLost:z.number(),frameWidth:z.number(),frameHeight:z.number(),framesDecoded:z.number(),framesPerSecond:z.number(),framesDropped:z.number(),videoCodec:z.string(),audioCodec:z.string(),browserInfo:z.object({userAgent:z.string(),platform:z.string().nullable(),language:z.string()}).passthrough().partial(),currentRTT:z.number(),sessionRunTime:z.string(),controlsStreamInput:z.string().refine((e=>"true"===e||"false"===e)),videoEncoderAvgQP:z.number(),videoBitrate:z.number(),audioBitrate:z.number()}).passthrough().partial()}),ZPing=z.object({type:z.literal("ping"),message:z.string()}),ZQueue=z.object({type:z.literal("queue"),queue:z.object({index:z.number().int().optional(),queueLength:z.number().int().optional(),waited:z.number().optional(),estimatedWaitTime:z.number().optional(),averageWaitTime:z.number().optional(),valueType:z.enum(["milliseconds","seconds","minutes","hours","days"])})}),ZVersion=z.object({type:z.literal("version"),version:z.string().optional()}),Send={stats:ZStats},ArcwareSettingsSchema=z.object({session:z.string().optional(),token:z.string().optional(),bypass:z.boolean().optional(),errorHandler:z.function().args(ZErrorMessage).returns(z.void()).optional(),queueHandler:z.function().args(ZQueue).returns(z.void()).optional(),sessionIdHandler:z.function().args(z.string()).returns(z.void()).optional(),loveLetterHandler:z.function().args(ZLoveLetter).returns(z.void()).optional(),fullscreenButton:z.boolean().optional(),settingsButton:z.boolean().optional(),infoButton:z.boolean().optional(),audioButton:z.boolean().optional(),micButton:z.boolean().optional(),stopButton:z.boolean().optional(),connectionStrengthIcon:z.boolean().optional(),shareId:z.string().startsWith("share-").optional(),projectId:z.string().optional(),loveLetterLogging:z.boolean().optional(),connectionIdentifierLoggingDisabled:z.boolean().optional()}),DefaultUrl="wss://signalling-client.ragnarok.arcware.cloud";Vt.Log=(e,t,r)=>{},Vt.Info=(e,t,r)=>{},Vt.Warning=(e,t,r)=>{console.warn(t,e)},Vt.Error=(e,t,r)=>{(null==t?void 0:t.startsWith("unhandled Stat Type"))||console.error(t,e)};class ArcwareConfig extends Pt{static PickIdsOfUrl(){const{pathname:e}=new URL(window.location.href),t=e.split("/");return{projectId:t.find((e=>z.string().uuid().safeParse(e).success)),shareId:t.find((e=>z.string().startsWith("share-").safeParse(e).success))}}constructor(e){var t,r;if(!new URL(window.location.href).search.slice(1).split("&").find((e=>e.startsWith("df-")))&&!e.settings.shareId&&!e.settings.projectId)throw new Error("ShareId or ProjectId must be specified.");const n=ArcwareSettingsSchema.parse(e.settings);e.initialSettings||(e.initialSettings={}),(null===(t=e.initialSettings)||void 0===t?void 0:t.hasOwnProperty("AutoConnect"))||(e.initialSettings.AutoConnect=!1),(null===(r=e.initialSettings)||void 0===r?void 0:r.hasOwnProperty("AFKTimeout"))||(e.initialSettings.AFKTimeout=600),e.initialSettings.ss||(e.initialSettings.ss=DefaultUrl),super(e),this.VERSION="0.1.3",this.settings=n,this.session=new Session,this._initialSettings=e.initialSettings,this.setFlagEnabled(Ot.AFKDetection,!0),this.setFlagEnabled(Ot.BrowserSendOffer,!0)}get urlFlags(){var e;let t="";if(this.settings.shareId&&(t+=`&sh=${this.settings.shareId}`),this.settings.projectId&&(t+=`&p=${this.settings.projectId}`),"string"==typeof this.settings.session)t+=`&s=${this.settings.session}`;else{const e=this.session.id;e&&(t+=`&s=${e}`,t+="&r=true")}this.settings.bypass&&(t+="&b=true"),this.settings.token&&(t+=`&t=${this.settings.token}`);const r=null!==(e=new URLSearchParams(window.location.search).get("rId"))&&void 0!==e?e:void 0;r&&(t+=`&rId=${r}`);const n=new URL(window.location.href).search.slice(1).split("&").find((e=>e.startsWith("df-")));return n&&(t+=`&${n}`),t}get initialSettings(){return this._initialSettings}modifyInitialSettings(e){this.setFlagEnabled(Ot.HoveringMouseMode,e)}}var call=functionCall,hasOwn=hasOwnProperty_1,isPrototypeOf=objectIsPrototypeOf,regExpFlags=regexpFlags$1,RegExpPrototype$1=RegExp.prototype,regexpGetFlags=function(e){var t=e.flags;return void 0!==t||"flags"in RegExpPrototype$1||hasOwn(e,"flags")||!isPrototypeOf(RegExpPrototype$1,e)?t:call(regExpFlags,e)},PROPER_FUNCTION_NAME=functionName.PROPER,defineBuiltIn=defineBuiltIn$8,anObject=anObject$e,$toString=toString$7,fails=fails$k,getRegExpFlags=regexpGetFlags,TO_STRING="toString",RegExpPrototype=RegExp.prototype,nativeToString=RegExpPrototype[TO_STRING],NOT_GENERIC=fails((function(){return"/a/b"!=nativeToString.call({source:"a",flags:"b"})})),INCORRECT_NAME=PROPER_FUNCTION_NAME&&nativeToString.name!=TO_STRING;function UrlBuilder(e,t){const r=new URL(decodeURIComponent(e())),n=r.searchParams;let i=t;return i&&(i.startsWith("?")&&(i=i.substring(1)),i.split("&").forEach((e=>{const[t,r]=e.split("=");n.append(t,r)}))),r.toString()}function ApplyUrlHack(){const e=jt.prototype.setWebRtcPlayerController;jt.prototype.setWebRtcPlayerController=function(t){const r=t.signallingUrlBuilder;t.signallingUrlBuilder=()=>UrlBuilder(r,this.config.urlFlags),e.call(this,t)}}(NOT_GENERIC||INCORRECT_NAME)&&defineBuiltIn(RegExp.prototype,TO_STRING,(function(){var e=anObject(this);return"/"+$toString(e.source)+"/"+$toString(getRegExpFlags(e))}),{unsafe:!0});class EventHandler{add(e){return this.callbacks.find((t=>t===e))?null:(this.callbacks.push(e),e)}remove(e){const t=this.callbacks.find((t=>t===e));return t&&this.callbacks.splice(this.callbacks.indexOf(t),1),!!t}constructor(){this.callbacks=new Array}static Emit(e,t){e.callbacks.forEach((e=>e(t)))}}function Stats(e){return ZStats.shape.stats.parse({codecs:e.codecs,candidatePair:e.candidatePair,localCandidates:e.localCandidates,remoteCandidates:e.remoteCandidates,DataChannelStats:e.DataChannelStats,bytesReceived:e.inboundVideoStats.bytesReceived,packetsLost:e.inboundVideoStats.packetsLost,frameWidth:e.inboundVideoStats.frameWidth,frameHeight:e.inboundVideoStats.frameHeight,framesDecoded:e.inboundVideoStats.framesDecoded,framesPerSecond:e.inboundVideoStats.framesPerSecond,framesDropped:e.inboundVideoStats.framesDropped,videoCodec:e.inboundVideoStats.codecId,audioCodec:e.inboundAudioStats.codecId,browserInfo:{userAgent:navigator.userAgent,platform:navigator.oscpu||navigator.platform||null,language:navigator.language},currentRTT:e.candidatePair.currentRoundTripTime,sessionRunTime:e.sessionStats.runTime,controlsStreamInput:e.sessionStats.controlsStreamInput,videoEncoderAvgQP:e.sessionStats.videoEncoderAvgQP,videoBitrate:e.inboundVideoStats.bitrate,audioBitrate:e.inboundAudioStats.bitrate})}var lodash={exports:{}};
4
4
  /**
5
5
  * @license
6
6
  * Lodash <https://lodash.com/>