this.length)return"";if((n=void 0===n||n>this.length?this.length:n)<=0)return"";if((n>>>=0)<=(t>>>=0))return"";for(e=e||"utf8";;)switch(e){case"hex":var i=this,r=t,s=n,c=i.length;(!s||s<0||c this.length)return"";if((n=void 0===n||n>this.length?this.length:n)<=0)return"";if((n>>>=0)<=(t>>>=0))return"";for(e=e||"utf8";;)switch(e){case"hex":var i=this,r=t,s=n,c=i.length;(!s||s<0||ct&&(e+=" ... "),">>=0,isFinite(n)?(n>>>=0,void 0===o&&(o="utf8")):(o=n,n=void 0)}var a=this.length-t;if((void 0===n||a>1,d=-7,u=n?a-1:0,f=n?-1:1,a=e[t+u];for(u+=f,i=a&(1<<-d)-1,a>>=-d,d+=s;0
':t.innerHTML='Download '+e.name+'
'):console.error("No such progress-helper element exist.",e)}}},t={handle:function(a){a.autoTranslateText=!1,a.language="en",a.googKey="AIzaSyCgB5hmFY74WYB-EoWkhr9cAGr6TiTHrEE",a.Translator={TranslateText:function(e,t){var n=document.createElement("script"),e=(n.type="text/javascript",encodeURIComponent(e)),o="method"+a.token(),o=(window[o]=function(e){e.data&&e.data.translations[0]&&t?t(e.data.translations[0].translatedText):e.error&&"Daily Limit Exceeded"===e.error.message?console.error('Text translation failed. Error message: "Daily Limit Exceeded."'):e.error?console.error(e.error.message):console.error(e)},"https://www.googleapis.com/language/translate/v2?key="+a.googKey+"&target="+(a.language||"en-US")+"&callback=window."+o+"&q="+e);n.src=o,document.getElementsByTagName("head")[0].appendChild(n)},getListOfLanguages:function(t){var n=new XMLHttpRequest,e=(n.onreadystatechange=function(){var e;n.readyState==XMLHttpRequest.DONE&&((e=JSON.parse(n.responseText))&&e.data&&e.data.languages?t(e.data.languages):e.error&&"Daily Limit Exceeded"===e.error.message?console.error('Text translation failed. Error message: "Daily Limit Exceeded."'):e.error?console.error(e.error.message):console.error(e))},"https://www.googleapis.com/language/translate/v2/languages?key="+a.googKey+"&target=en");n.open("GET",e,!0),n.send(null)}}}};function I(t){if(P.socketAutoReConnect=!0,P.socket)t&&t(P.socket);else{if(void 0===n)if("undefined"!=typeof FirebaseConnection)window.SocketConnection=FirebaseConnection;else{if("undefined"==typeof PubNubConnection)throw"SocketConnection.js seems missed.";window.SocketConnection=PubNubConnection}new n(P,function(e){t&&t(P.socket)})}}function Me(n,o){P.socket.emit("join-room",{sessionid:P.sessionid,session:P.session,mediaConstraints:P.mediaConstraints,sdpConstraints:P.sdpConstraints,streams:Re(),extra:P.extra,password:void 0!==P.password&&"object"!==ze(P.password)?P.password:""},function(e,t){if(!0===e){if(P.enableLogs&&console.log("isRoomJoined: ",e," roomid: ",P.sessionid),P.peers[P.sessionid])return;j.onNegotiationNeeded(n)}!1===e&&P.enableLogs&&console.warn("isRoomJoined: ",t," roomid: ",P.sessionid),o(e,P.sessionid,t)})}function Oe(n){P.enableLogs&&console.log("Sending open-room signal to socket.io"),P.waitingForLocalMedia=!1,P.socket.emit("open-room",{sessionid:P.sessionid,session:P.session,mediaConstraints:P.mediaConstraints,sdpConstraints:P.sdpConstraints,streams:Re(),extra:P.extra,identifier:P.publicRoomIdentifier,password:void 0!==P.password&&"object"!==ze(P.password)?P.password:""},function(e,t){!0===e&&(P.enableLogs&&console.log("isRoomOpened: ",e," roomid: ",P.sessionid),n(e,P.sessionid)),!1===e&&(P.enableLogs&&console.warn("isRoomOpened: ",t," roomid: ",P.sessionid),n(e,P.sessionid,t))})}function Re(){try{return P.streamEvents.selectAll("local").map(function(e){return{streamid:e.streamid,tracks:e.stream.getTracks().length}})}catch(e){return[]}}function Pe(e,n){var t,o;P.dontCaptureUserMedia||e.isDataOnly?n():(t={},e.localPeerSdpConstraints.OfferToReceiveAudio&&(t.audio=P.mediaConstraints.audio),e.localPeerSdpConstraints.OfferToReceiveVideo&&(t.video=P.mediaConstraints.video),(o=e.session||P.session).oneway&&"two-way"!==o.audio&&"two-way"!==o.video&&"two-way"!==o.screen?n():((o=o.oneway&&o.audio&&"two-way"===o.audio?{audio:!0}:o).audio||o.video||o.screen)&&(o.screen?"Edge"===DetectRTC.browser.name?navigator.getDisplayMedia({video:!0,audio:x(P)}).then(function(e){e.isScreen=!0,j.onGettingLocalMedia(e),!o.audio&&!o.video||x(P)?n(e):P.invokeGetUserMedia(null,n)},function(e){console.error("Unable to capture screen on Edge. HTTPs and version 17+ is required.")}):P.getScreenConstraints(function(e,t){P.invokeGetUserMedia({audio:!!x(P)&&le(t),video:t,isScreen:!0},!o.audio&&!o.video||x(P)?n:P.invokeGetUserMedia(null,n))}):(o.audio||o.video)&&P.invokeGetUserMedia(null,n,o)))}function je(e,t){e?(t.audio&&_(e,"audio").forEach(function(e){e.applyConstraints(t.audio)}),t.video&&_(e,"video").forEach(function(e){e.applyConstraints(t.video)})):P.enableLogs&&console.error("No stream to applyConstraints.")}function Ne(t,e,n){e?j.replaceTrack(t,e,n):P.peers.getAllParticipants().forEach(function(e){j.replaceTrack(t,e,n)})}D=D||{useDefaultDevices:!0},(P=this).channel=P.sessionid=(L||location.href.replace(/\/|:|#|\?|\$|\^|%|\.|`|~|!|\+|@|\[|\||]|\|*. /g,"").split("\n").join("").split("\r").join(""))+"",j=new z(P),Ee={},j.onGettingLocalMedia=function(t,a){if(a=a||function(){},Ee[t.streamid])a();else{Ee[t.streamid]=!0;try{t.type="local"}catch(e){}P.setStreamEndHandler(t),F(t,function(e){e.id=t.streamid,e.muted=!0,e.volume=0,-1===P.attachStreams.indexOf(t)&&P.attachStreams.push(t),void 0!==k&&k.setHandlers(t,!0,P),P.streamEvents[t.streamid]={stream:t,type:"local",mediaElement:e,userid:P.userid,extra:P.extra,streamid:t.streamid,isAudioMuted:!0};try{var n=P,o=P.streamEvents[t.streamid];if(o.stream&&_(o.stream,"audio").length){if(!n||!o)throw"Both arguments are required.";if(n.onspeaking&&n.onsilence){if("undefined"==typeof hark)throw"hark.js not found.";hark(o.stream,{onspeaking:function(){n.onspeaking(o)},onsilence:function(){n.onsilence(o)},onvolumechange:function(e,t){n.onvolumechange&&n.onvolumechange(Fe({volume:e,threshold:t},o))}})}}U(P,P.streamEvents[t.streamid]),P.onstream(P.streamEvents[t.streamid])}catch(e){}a()},P)}},j.onGettingRemoteMedia=function(t,n){try{t.type="remote"}catch(e){}P.setStreamEndHandler(t,"remote-stream"),F(t,function(e){e.id=t.streamid,void 0!==k&&k.setHandlers(t,!1,P),P.streamEvents[t.streamid]={stream:t,type:"remote",userid:n,extra:P.peers[n]?P.peers[n].extra:{},mediaElement:e,streamid:t.streamid},U(P,P.streamEvents[t.streamid]),P.onstream(P.streamEvents[t.streamid])},P)},j.onRemovingRemoteMedia=function(e,t){var n=(n=P.streamEvents[e.streamid])||{stream:e,type:"remote",userid:t,extra:P.peers[t]?P.peers[t].extra:{},streamid:e.streamid,mediaElement:P.streamEvents[e.streamid]?P.streamEvents[e.streamid].mediaElement:null};P.peersBackup[n.userid]&&(n.extra=P.peersBackup[n.userid].extra),P.onstreamended(n),delete P.streamEvents[e.streamid]},j.onNegotiationNeeded=function(e,t,n){n=n||function(){};var o={remoteUserId:t=t||e.remoteUserId,message:e=e||"",sender:P.userid};e.remoteUserId&&e.message&&e.sender&&(o=e),I(function(){P.socket.emit(P.socketMessageEvent,o,n)})},j.onUserLeft=function(e){P.deletePeer(e)},j.disconnectWith=function(e,t){P.socket&&P.socket.emit("disconnect-with",e,t||function(){}),P.deletePeer(e)},P.socketOptions={transport:"polling"},P.openOrJoin=function(e,r){r=r||function(){},P.checkPresence(e,function(e,t){var n,o,a,i;e?(P.sessionid=t,e=!!P.session.oneway,n=c(P.session),o={OfferToReceiveAudio:P.sdpConstraints.mandatory.OfferToReceiveAudio,OfferToReceiveVideo:P.sdpConstraints.mandatory.OfferToReceiveVideo},a={OfferToReceiveAudio:e?!!P.session.audio:P.sdpConstraints.mandatory.OfferToReceiveAudio,OfferToReceiveVideo:e?!!P.session.video||!!P.session.screen:P.sdpConstraints.mandatory.OfferToReceiveVideo},Pe((i={remoteUserId:P.sessionid,message:{newParticipationRequest:!0,isOneWay:e,isDataOnly:n,localPeerSdpConstraints:a,remotePeerSdpConstraints:o},sender:P.userid}).message,function(){Me(i,r)})):(P.waitingForLocalMedia=!0,P.isInitiator=!0,P.sessionid=t||P.sessionid,c(P.session)?Oe(r):P.captureUserMedia(function(){Oe(r)}))})},P.waitingForLocalMedia=!1,P.open=function(e,t){t=t||function(){},P.waitingForLocalMedia=!0,P.isInitiator=!0,P.sessionid=e||P.sessionid,I(function(){c(P.session)?Oe(t):P.captureUserMedia(function(){Oe(t)})})},P.peersBackup={},P.deletePeer=function(e){if(e&&P.peers[e]){var t={userid:e,extra:P.peers[e]?P.peers[e].extra:{}};if(P.peersBackup[t.userid]&&(t.extra=P.peersBackup[t.userid].extra),P.onleave(t),P.peers[e]){P.peers[e].streams.forEach(function(e){e.stop()});t=P.peers[e].peer;if(t&&"closed"!==t.iceConnectionState)try{t.close()}catch(e){}P.peers[e]&&(P.peers[e].peer=null,delete P.peers[e])}}},P.rejoin=function(e){var t;!P.isInitiator&&e&&Object.keys(e).length&&(t={},P.peers[e.remoteUserId]&&(t=P.peers[e.remoteUserId].extra,P.deletePeer(e.remoteUserId)),e&&e.remoteUserId&&(P.join(e.remoteUserId),P.onReConnecting({userid:e.remoteUserId,extra:t})))},P.join=function(e,t){P.sessionid=!!e&&(e.sessionid||e.remoteUserId||e)||P.sessionid,P.sessionid+="";var n=!1,o=!1,a=!1,i=!1,r=((e&&e.session||!e||"string"==typeof e)&&(a=!!(e=e&&e.session||P.session).oneway,i=c(e),o={OfferToReceiveAudio:P.sdpConstraints.mandatory.OfferToReceiveAudio,OfferToReceiveVideo:P.sdpConstraints.mandatory.OfferToReceiveVideo},n={OfferToReceiveAudio:a?!!P.session.audio:P.sdpConstraints.mandatory.OfferToReceiveAudio,OfferToReceiveVideo:a?!!P.session.video||!!P.session.screen:P.sdpConstraints.mandatory.OfferToReceiveVideo}),function(){}),s=("function"==typeof(t=t||{})&&(r=t,t={}),void 0!==t.localPeerSdpConstraints&&(n=t.localPeerSdpConstraints),void 0!==t.remotePeerSdpConstraints&&(o=t.remotePeerSdpConstraints),void 0!==t.isOneWay&&(a=t.isOneWay),void 0!==t.isDataOnly&&(i=t.isDataOnly),{remoteUserId:P.sessionid,message:{newParticipationRequest:!0,isOneWay:a,isDataOnly:i,localPeerSdpConstraints:n,remotePeerSdpConstraints:o},sender:P.userid});return Pe(s.message,function(){I(function(){Me(s,r)})}),s},P.publicRoomIdentifier="",P.getUserMedia=P.captureUserMedia=function(o,a){o=o||function(){};var i=a||P.session;P.dontCaptureUserMedia||c(i)?o():(i.audio||i.video||i.screen)&&(i.screen?"Edge"===DetectRTC.browser.name?navigator.getDisplayMedia({video:!0,audio:x(P)}).then(function(e){if(e.isScreen=!0,j.onGettingLocalMedia(e),!i.audio&&!i.video||x(P))o(e);else{var t,n={};for(t in i)"screen"!==t&&(n[t]=i[t]);P.invokeGetUserMedia(a,o,n)}},function(e){console.error("Unable to capture screen on Edge. HTTPs and version 17+ is required.")}):P.getScreenConstraints(function(e,t){if(e)throw e;P.invokeGetUserMedia({audio:!!x(P)&&le(t),video:t,isScreen:!0},function(e){if(!i.audio&&!i.video||x(P))o(e);else{var t,n={};for(t in i)"screen"!==t&&(n[t]=i[t]);P.invokeGetUserMedia(a,o,n)}})}):(i.audio||i.video)&&P.invokeGetUserMedia(a,o,i))},P.onbeforeunload=function(e,t){P.closeBeforeUnload&&(P.peers.getAllParticipants().forEach(function(e){j.onNegotiationNeeded({userLeft:!0},e),P.peers[e]&&P.peers[e].peer&&P.peers[e].peer.close(),delete P.peers[e]}),t||P.closeSocket(),P.isInitiator=!1)},window.ignoreBeforeUnload?P.closeBeforeUnload=!1:(P.closeBeforeUnload=!0,window.addEventListener("beforeunload",P.onbeforeunload,!1)),P.userid=f(),P.changeUserId=function(e,t){t=t||function(){},P.userid=e||f(),P.socket.emit("changed-uuid",P.userid,t)},P.extra={},P.attachStreams=[],P.session={audio:!0,video:!0},P.enableFileSharing=!1,P.bandwidth={screen:!1,audio:!1,video:!1},P.codecs={audio:"opus",video:"VP9"},P.processSdp=function(e){return function(){var t=!1;try{if("undefined"==typeof RTCRtpTransceiver)return;if(!("currentDirection"in RTCRtpTransceiver.prototype))return;var e=new S;try{e.addTransceiver("audio"),t=!0}catch(e){}e.close()}catch(e){t=!1}return t&&function(){var t=!1;try{var e=new S({sdpSemantics:"unified-plan"});try{var n=e.getConfiguration(),t="unified-plan"==n.sdpSemantics||(n.sdpSemantics,!1)}catch(e){t=!1}}catch(e){t=!1}return t}()}()||"Safari"!==DetectRTC.browser.name&&("VP8"===P.codecs.video.toUpperCase()&&(e=E.preferCodec(e,"vp8")),"VP9"===P.codecs.video.toUpperCase()&&(e=E.preferCodec(e,"vp9")),"H264"===P.codecs.video.toUpperCase()&&(e=E.preferCodec(e,"h264")),"G722"===P.codecs.audio&&(e=E.removeNonG722(e)),"Firefox"!==DetectRTC.browser.name&&((P.bandwidth.video||P.bandwidth.screen)&&(e=E.setApplicationSpecificBandwidth(e,P.bandwidth,!!P.session.screen)),P.bandwidth.video&&(e=E.setVideoBitrates(e,{min:8*P.bandwidth.video*1024,max:8*P.bandwidth.video*1024})),P.bandwidth.audio&&(e=E.setOpusAttributes(e,{maxaveragebitrate:8*P.bandwidth.audio*1024,maxplaybackrate:8*P.bandwidth.audio*1024,stereo:1,maxptime:3})))),e},void 0!==E&&(P.BandwidthHandler=P.CodecsHandler=E),P.mediaConstraints={audio:{mandatory:{},optional:P.bandwidth.audio?[{bandwidth:8*P.bandwidth.audio*1024||1048576}]:[]},video:{mandatory:{},optional:P.bandwidth.video?[{bandwidth:8*P.bandwidth.video*1024||1048576},{facingMode:"user"}]:[{facingMode:"user"}]}},"Firefox"===DetectRTC.browser.name&&(P.mediaConstraints={audio:!0,video:!0}),D.useDefaultDevices||DetectRTC.isMobileDevice||DetectRTC.load(function(){var t,n;if(DetectRTC.MediaDevices.forEach(function(e){"audioinput"===e.kind&&!1!==P.mediaConstraints.audio&&(t=e),"videoinput"===e.kind&&!1!==P.mediaConstraints.video&&(n=e)}),t){if("Firefox"===DetectRTC.browser.name)return void(!0!==P.mediaConstraints.audio?P.mediaConstraints.audio.deviceId=t.id:P.mediaConstraints.audio={deviceId:t.id});1==P.mediaConstraints.audio&&(P.mediaConstraints.audio={mandatory:{},optional:[]}),P.mediaConstraints.audio.optional||(P.mediaConstraints.audio.optional=[]);var e=[{sourceId:t.id}];P.mediaConstraints.audio.optional=e.concat(P.mediaConstraints.audio.optional)}n&&("Firefox"===DetectRTC.browser.name?!0!==P.mediaConstraints.video?P.mediaConstraints.video.deviceId=n.id:P.mediaConstraints.video={deviceId:n.id}:(1==P.mediaConstraints.video&&(P.mediaConstraints.video={mandatory:{},optional:[]}),P.mediaConstraints.video.optional||(P.mediaConstraints.video.optional=[]),e=[{sourceId:n.id}],P.mediaConstraints.video.optional=e.concat(P.mediaConstraints.video.optional)))}),P.sdpConstraints={mandatory:{OfferToReceiveAudio:!0,OfferToReceiveVideo:!0},optional:[{VoiceActivityDetection:!1}]},P.sdpSemantics=null,P.iceCandidatePoolSize=null,P.bundlePolicy=null,P.rtcpMuxPolicy=null,P.iceTransportPolicy=null,P.optionalArgument={optional:[{DtlsSrtpKeyAgreement:!0},{googImprovedWifiBwe:!0},{googScreencastMinBitrate:300},{googIPv6:!0},{googDscp:!0},{googCpuUnderuseThreshold:55},{googCpuOveruseThreshold:85},{googSuspendBelowMinBitrate:!0},{googCpuOveruseDetection:!0}],mandatory:{}},P.iceServers=l(P),P.candidates={host:!0,stun:!0,turn:!0},P.iceProtocols={tcp:!0,udp:!0},P.onopen=function(e){P.enableLogs&&console.info("Data connection has been opened between you & ",e.userid)},P.onclose=function(e){P.enableLogs&&console.warn("Data connection has been closed between you & ",e.userid)},P.onerror=function(e){P.enableLogs&&console.error(e.userid,"data-error",e)},P.onmessage=function(e){P.enableLogs&&console.debug("data-message",e.userid,e.data)},P.send=function(e,t){P.peers.send(e,t)},P.close=P.disconnect=P.leave=function(){P.onbeforeunload(!1,!0)},P.closeEntireSession=function(t){t=t||function(){},P.socket.emit("close-entire-session",function e(){P.getAllParticipants().length?setTimeout(e,100):(P.onEntireSessionClosed({sessionid:P.sessionid,userid:P.userid,extra:P.extra}),P.changeUserId(null,function(){P.close(),t()}))})},P.onEntireSessionClosed=function(e){P.enableLogs&&console.info("Entire session is closed: ",e.sessionid,e.extra)},P.onstream=function(e){var t=P.videosContainer,t=(t.insertBefore(e.mediaElement,t.firstChild),e.mediaElement.play());void 0===t?setTimeout(function(){e.mediaElement.play()},2e3):t.catch(function(){}).then(function(){setTimeout(function(){e.mediaElement.play()},2e3)})},P.onstreamended=function(e){e.mediaElement||(e.mediaElement=document.getElementById(e.streamid)),e.mediaElement&&e.mediaElement.parentNode&&e.mediaElement.parentNode.removeChild(e.mediaElement)},P.direction="many-to-many",P.removeStream=function(t,n){var o;P.attachStreams.forEach(function(e){e.id===t&&(o=e)}),o?(P.peers.getAllParticipants().forEach(function(e){if(!n||e===n){e=P.peers[e];try{e.peer.removeStream(o)}catch(e){}}}),P.renegotiate()):console.warn("No such stream exist.",t)},P.addStream=function(n,t){if(n.getTracks)return-1===P.attachStreams.indexOf(n)&&(n.streamid||(n.streamid=n.id),P.attachStreams.push(n)),void P.renegotiate(t);function o(e){n.streamCallback&&n.streamCallback(e),P.renegotiate(t)}c(n)?P.renegotiate(t):(n.audio||n.video||n.screen)&&(n.screen?"Edge"===DetectRTC.browser.name?navigator.getDisplayMedia({video:!0,audio:x(P)}).then(function(e){e.isScreen=!0,j.onGettingLocalMedia(e),!n.audio&&!n.video||x(P)?o(e):P.invokeGetUserMedia(null,function(e){o(e)})},function(e){console.error("Unable to capture screen on Edge. HTTPs and version 17+ is required.")}):P.getScreenConstraints(function(e,t){if(e)return"PermissionDeniedError"===e?(n.streamCallback&&n.streamCallback(null),void(P.enableLogs&&console.error("User rejected to share his screen."))):alert(e);P.invokeGetUserMedia({audio:!!x(P)&&le(t),video:t,isScreen:!0},function(e){!n.audio&&!n.video||x(P)?o(e):P.invokeGetUserMedia(null,function(e){o(e)})})}):(n.audio||n.video)&&P.invokeGetUserMedia(null,o))},P.invokeGetUserMedia=function(n,o,e){e=e||P.session,we({onGettingLocalMedia:function(e){var t=n.video;t&&(t.mediaSource||t.mozMediaSource||t.mandatory&&t.mandatory.chromeMediaSource)&&(e.isScreen=!0),e.isScreen||(e.isVideo=!!_(e,"video").length,e.isAudio=!e.isVideo&&_(e,"audio").length),j.onGettingLocalMedia(e,function(){"function"==typeof o&&o(e)})},onLocalMediaError:function(e,t){j.onLocalMediaError(e,t)},localMediaConstraints:(n=n||P.mediaConstraints)||{audio:!!e.audio&&n.audio,video:!!e.video&&n.video}})},P.applyConstraints=function(t,e){var n;C&&C.prototype.applyConstraints?e?je(n=P.streamEvents[e]?P.streamEvents[e].stream:n,t):P.attachStreams.forEach(function(e){je(e,t)}):alert("track.applyConstraints is NOT supported in your browser.")},P.replaceTrack=function(n,t,o){if(n=n||{},S.prototype.getSenders)if(n instanceof C)Ne(n,t,o);else{if(n instanceof w)return _(n,"video").length&&Ne(_(n,"video")[0],t,!0),void(_(n,"audio").length&&Ne(_(n,"audio")[0],t,!1));if(c(n))throw"connection.replaceTrack requires audio and/or video and/or screen.";(n.audio||n.video||n.screen)&&(n.screen?"Edge"===DetectRTC.browser.name?navigator.getDisplayMedia({video:!0,audio:x(P)}).then(function(e){e.isScreen=!0,j.onGettingLocalMedia(e),!n.audio&&!n.video||x(P)?a(e):P.invokeGetUserMedia(null,a)},function(e){console.error("Unable to capture screen on Edge. HTTPs and version 17+ is required.")}):P.getScreenConstraints(function(e,t){if(e)return alert(e);P.invokeGetUserMedia({audio:!!x(P)&&le(t),video:t,isScreen:!0},!n.audio&&!n.video||x(P)?a:P.invokeGetUserMedia(null,a))}):(n.audio||n.video)&&P.invokeGetUserMedia(null,a))}else P.addStream(n);function a(e){P.replaceTrack(e,t,o||n.video||n.screen)}},P.resetTrack=function(e,n){(e="string"==typeof(e=e||P.getAllParticipants())?[e]:e).forEach(function(e){var t=P.peers[e].peer;void 0!==n&&!0!==n||!t.lastVideoTrack||P.replaceTrack(t.lastVideoTrack,e,!0),void 0!==n&&!1!==n||!t.lastAudioTrack||P.replaceTrack(t.lastAudioTrack,e,!1)})},P.renegotiate=function(e){e?j.renegotiatePeer(e):P.peers.getAllParticipants().forEach(function(e){j.renegotiatePeer(e)})},P.setStreamEndHandler=function(o,a){var e;o&&o.addEventListener&&(a=!!a,!o.alreadySetEndHandler)&&(o.alreadySetEndHandler=!0,e="ended","oninactive"in o&&(e="inactive"),o.addEventListener(e,function(){o.idInstance&¤tUserMediaRequest.remove(o.idInstance),a||(t=[],P.attachStreams.forEach(function(e){e.id!=o.id&&t.push(e)}),P.attachStreams=t);var e,t,n=(n=P.streamEvents[o.streamid])||{stream:o,streamid:o.streamid,type:a?"remote":"local",userid:P.userid,extra:P.extra,mediaElement:P.streamEvents[o.streamid]?P.streamEvents[o.streamid].mediaElement:null};a&&P.peers[n.userid]&&(e=P.peers[n.userid].peer,t=[],e.getRemoteStreams().forEach(function(e){e.id!=o.id&&t.push(e)}),P.peers[n.userid].streams=t),n.userid===P.userid&&"remote"===n.type||(P.peersBackup[n.userid]&&(n.extra=P.peersBackup[n.userid].extra),P.onstreamended(n),delete P.streamEvents[o.streamid])},!1))},P.onMediaError=function(e,t){P.enableLogs&&console.error(e,t)},P.autoCloseEntireSession=!1,P.filesContainer=P.videosContainer=document.body||document.documentElement,P.isInitiator=!1,P.shareFile=j.shareFile,i.handle(P),t.handle(P),P.token=f,P.onNewParticipant=function(e,t){P.acceptParticipationRequest(e,t)},P.acceptParticipationRequest=function(e,t){t.successCallback&&(t.successCallback(),delete t.successCallback),j.createNewPeer(e,t)},void 0!==k&&(P.StreamsHandler=k),P.onleave=function(e){},P.invokeSelectFileDialog=function(e){var t=new Ue;t.accept="*.*",t.selectSingleFile(e)},P.onmute=function(e){var t;e&&e.mediaElement&&("both"===e.muteType||"video"===e.muteType?(e.mediaElement.src=null,void 0!==(t=e.mediaElement.pause())?t.then(function(){e.mediaElement.poster=e.snapshot||"https://cdn.webrtc-experiment.com/images/muted.png"}):e.mediaElement.poster=e.snapshot||"https://cdn.webrtc-experiment.com/images/muted.png"):"audio"===e.muteType&&(e.mediaElement.muted=!0))},P.onunmute=function(e){e&&e.mediaElement&&e.stream&&("both"===e.unmuteType||"video"===e.unmuteType?(e.mediaElement.poster=null,e.mediaElement.srcObject=e.stream,e.mediaElement.play()):"audio"===e.unmuteType&&(e.mediaElement.muted=!1))},P.onExtraDataUpdated=function(e){e.status="online",P.onUserStatusChanged(e,!0)},P.getAllParticipants=function(e){return P.peers.getAllParticipants(e)},void 0!==k&&(k.onSyncNeeded=function(t,n,o){P.peers.getAllParticipants().forEach(function(e){j.onNegotiationNeeded({streamid:t,action:n,streamSyncNeeded:!0,type:o||"both"},e)})}),P.connectSocket=function(e){I(e)},P.closeSocket=function(){try{De.a.sockets={}}catch(e){}P.socket&&("function"==typeof P.socket.disconnect&&P.socket.disconnect(),"function"==typeof P.socket.resetProps&&P.socket.resetProps(),P.socket=null)},P.getSocket=function(e){return!e&&P.enableLogs&&console.warn("getSocket.callback paramter is required."),e=e||function(){},P.socket?e(P.socket):I(function(){e(P.socket)}),P.socket},P.getRemoteStreams=j.getRemoteStreams,Ae=["selectFirst","selectAll","forEach"],P.streamEvents={selectFirst:function(e){return P.streamEvents.selectAll(e)[0]},selectAll:function(n){"video"==(n="audio"==(n="screen"==(n="remote"==(n="local"==(n=n||{local:!0,remote:!0,isScreen:!0,isAudio:!0,isVideo:!0})?{local:!0}:n)?{remote:!0}:n)?{isScreen:!0}:n)?{isAudio:!0}:n)&&(n={isVideo:!0});var o=[];return Object.keys(P.streamEvents).forEach(function(e){var t=P.streamEvents[e];-1===Ae.indexOf(e)&&(e=!0,n.local&&"local"===t.type&&(e=!1),n.remote&&"remote"===t.type&&(e=!1),n.isScreen&&t.stream.isScreen&&(e=!1),n.isVideo&&t.stream.isVideo&&(e=!1),n.isAudio&&t.stream.isAudio&&(e=!1),!1===(e=n.userid&&t.userid===n.userid?!1:e)&&o.push(t))}),o}},P.socketURL="/",P.socketMessageEvent="RTCMultiConnection-Message",P.socketCustomEvent="RTCMultiConnection-Custom-Message",P.DetectRTC=DetectRTC,P.setCustomSocketEvent=function(e){e&&(P.socketCustomEvent=e),P.socket&&P.socket.emit("set-custom-socket-event-listener",P.socketCustomEvent)},P.getNumberOfBroadcastViewers=function(e,t){P.socket&&e&&t&&P.socket.emit("get-number-of-users-in-specific-broadcast",e,t)},P.onNumberOfBroadcastViewersUpdated=function(e){P.enableLogs&&P.isInitiator&&console.info("Number of broadcast (",e.broadcastId,") viewers",e.numberOfBroadcastViewers)},P.onUserStatusChanged=function(e,t){P.enableLogs&&!t&&console.info(e.userid,e.status)},P.getUserMediaHandler=we,P.multiPeersHandler=j,P.enableLogs=!0,P.setCustomSocketHandler=function(e){void 0!==n&&(n=e)},P.chunkSize=4e4,P.maxParticipantsAllowed=1e3,P.disconnectWith=j.disconnectWith,P.checkPresence=function(e,o){e=e||P.sessionid,"SSEConnection"!==n.name?P.socket?P.socket.emit("check-presence",e+"",function(e,t,n){P.enableLogs&&console.log("checkPresence.isRoomExist: ",e," roomid: ",t),o(e,t,n)}):P.connectSocket(function(){P.checkPresence(e,o)}):SSEConnection.checkPresence(e,function(e,t,n){if(!P.socket)return e||(P.userid=t),void P.connectSocket(function(){o(e,t,n)});o(e,t)})},P.onReadyForOffer=function(e,t){P.multiPeersHandler.createNewPeer(e,t)},P.setUserPreferences=function(e){return P.dontAttachStream&&(e.dontAttachLocalStream=!0),P.dontGetRemoteStream&&(e.dontGetRemoteStream=!0),e},P.updateExtraData=function(){P.socket.emit("extra-data-updated",P.extra)},P.enableScalableBroadcast=!1,P.maxRelayLimitPerUser=3,P.dontCaptureUserMedia=!1,P.dontAttachStream=!1,P.dontGetRemoteStream=!1,P.onReConnecting=function(e){P.enableLogs&&console.info("ReConnecting with",e.userid,"...")},P.beforeAddingStream=function(e){return e},P.beforeRemovingStream=function(e){return e},P.checkIfChromeExtensionAvailable=_e,"undefined"!=typeof isFirefoxExtensionAvailable&&(P.checkIfChromeExtensionAvailable=isFirefoxExtensionAvailable),P.getChromeExtensionStatus=Te,P.getScreenConstraints=function(n,e){x(P,e)&&(e=!0);var o,a=function(e,t){e||(t=P.modifyScreenConstraints(t),n(e,t))};Se?a(null,{mozMediaSource:"window",mediaSource:"window"}):(o={mandatory:{chromeMediaSource:R,maxWidth:1920'+f.localization("Missing mame config")+"");var c=s.split("|");Z.coreFileName="".concat(f.system,"-").concat(c[0]),a="1"===c[1],z.element(f.elements.buttons.saveState)&&G(f.elements.buttons.saveState,!a),z.element(f.elements.buttons.loadState)&&G(f.elements.buttons.loadState,!a),G(te.contextMenu.querySelectorAll("ul li").item(2),!a),G(te.contextMenu.querySelectorAll("ul li").item(3),!a),d=2===f.coreVer?"":f.system.concat("-old-").concat(c[0],"-wasm.data"),c[0]?(X.wasm&&r?h=!0:(c.innerHTML=''+f.localization("Webassembly support is not detected in this browser")+"",d=""),d&&(A.db?A.get(d,function(e){e&&e.version===n?2===b.coreVer?L(e.data):((e=e.data.slice?e.data.slice(12):e.data.subarray(12)).set([55,122,188,175,39,28,0,3],0),L(e)):u(d,n)}):u(d,n))):c.innerHTML=''+f.localization("Unsupported Game")+""}else{var l,d=!1;if(X.wasm&&r?(l="wasm",d=!0,"n64"!==f.system||e||(l="legacy-wasm"),h=!0):i&&(d=!0,l="asmjs","n64"!==f.system||e||(l="legacy-asmjs")),!0!==(d="undefined"!=typeof EJS_CUSTOM_COREFILE?EJS_CUSTOM_COREFILE:d))return void(c.innerHTML=''+f.localization("Please upgrade your browser to the latest version")+"");d=2===f.coreVer?t+"-"+l+".data":t+"-old-"+l+".data","undefined"!=typeof EJS_CUSTOM_COREFILE&&(d=EJS_CUSTOM_COREFILE),A.db?A.get(d,function(e){!e||e.version!==n||"undefined"!=typeof EJS_DEBUG_XX&&!0===EJS_DEBUG_XX?u(d,n):2===b.coreVer?L(e.data):((e=e.data.slice?e.data.slice(12):e.data.subarray(12)).set([55,122,188,175,39,28,0,3],0),L(e))}):u(d,n)}2!==f.coreVer||"undefined"!=typeof EJS_DEBUG_XX&&!0===EJS_DEBUG_XX||z.element(f.elements.buttons.gamepad)&&G(f.elements.buttons.gamepad,!0),o||z.element(f.elements.buttons.netplay)&&G(f.elements.buttons.netplay,!0),z.element(f.elements.buttons.saveState)&&G(f.elements.buttons.saveState,!a),z.element(f.elements.buttons.loadState)&&G(f.elements.buttons.loadState,!a),G(te.contextMenu.querySelectorAll("ul li").item(2),!a),G(te.contextMenu.querySelectorAll("ul li").item(3),!a),b.setStatesSupported(a)}).catch(function(e){D(e,t,b)}),clearInterval(n),Z.romdb=d)},500),!1;var t,f,n}var k=function(){d.db&&d.getAll(function(e){Array.isArray(e)&&10'+s.localization("Control Settings")+'
\n \n
\n
"+s.localization("Press keyboard or gamepad")+"
"+s.localization("Press escape (esc) to clear")):t+="
Press keyboard
"+s.localization("Press escape (esc) to clear"),r.querySelector(".".concat(b.classNames["key-setting-popup"])).innerHTML=t,e.stopPropagation()})})},setCacheDialog:function(){var t=this;t.elements.dialogs.cache.innerHTML='\n \n "),B.call(this,t.elements.dialogs.cache.querySelector(".".concat(b.classNames["btn-cancel"])),"click",function(e){return G(t.elements.dialogs.cache,!0),t.elements.container.focus(),e.stopPropagation(),!1}),B.call(this,t.elements.dialogs.cache.querySelector(".".concat(b.classNames["dialog-title"]," a")),"click",function(e){return m.romdb&&(m.romdb.clear(),t.elements.dialogs.cache.querySelector(".".concat(b.classNames["dialog-content"])).innerHTML='Cheats
\n '+h.localization("Netplay")+'
\n \n \n
\n \n \n \n \n '+h.localization("Room Name")+" \n "+h.localization("Players")+' \n \n \n \n \n \n \n \n \n \n
\n \n \n \n \n '+h.localization("Player")+" \n "+h.localization("Name")+" \n \n \n \n 1 \n "+h.localization("Name")+" 1 \n \n \n \n 2 \n "+h.localization("Name")+" 2 \n \n \n \n 3 \n "+h.localization("Name")+" 3 \n \n \n \n \n 4 \n "+h.localization("Name")+' 4 \n \n ";b.players.forEach(function(e,t){var n=null;e?(b.connection.peers[e]?n=b.connection.peers[e].extra:b.connection.userid===e&&(n=b.connection.extra),o+="
",h.elements.widgets.netplay.innerHTML=o},500),n=h.elements.dialogs.netplay.querySelector("#modal-9de6c4e9ce2b9361"),i=h.elements.dialogs.netplay.querySelector("#modal-85cd7a1c543a484a"),o=h.elements.dialogs.netplay.querySelector("#modal-7d8fd50ed642340b"),a=h.elements.dialogs.netplay.querySelector("#modal-5aa765d61d8327de"),l={},b.connection=new De.a,(e=p.socketUrl).endsWith("/")||(e+="/"),b.connection.socketURL="/",b.connection.socketURL=e,b.connection.socketMessageEvent="emulatorjs-message",b.connection.socketCustomEvent="emulatorjs-custom-message",e=W.info(),b.connection.extra={name:b.playerName,game_id:h.config.gameId,browser_name:e.name,room_name:" ",domain:document.domain},b.connection.socketMessageEvent="netplay",b.connection.enableFileSharing=!0,b.connection.enableLogs=!1,b.connection.session={data:!0},b.connection.sdpConstraints.mandatory={OfferToReceiveAudio:!1,OfferToReceiveVideo:!1},b.connection.onclose=function(e){},b.connection.iceServers=[{urls:"turn:turn.emulatorjs.com:3478",credential:"dSnmrtehverella",username:"ejs"},{urls:["stun:stun.l.google.com:19302","stun:stun1.l.google.com:19302","stun:stun2.l.google.com:19302","stun:stun.l.google.com:19302?transport=udp"]}],b.connection.maxParticipantsAllowed=4,s=b.netPlayInitFrame=0,c=!1,Module.postMainLoop=function(){var e,t;if(b.currentFrame=parseInt(b.currentFrameNum(),10),b.connected)if(s+=1,b.connection.isInitiator)if(1<=s){for(var n=[],o=b.currentFrame-1;o[".concat(a,"] ").concat(o," ").concat(t.room_name," ").concat(t.current,"/").concat(t.max," ").concat(e," "),B.call(p,n.querySelector(".".concat(b.classNames["btn-join-room"])),"click",f),c.appendChild(n)}),c.querySelectorAll("tr").forEach(function(e){r.includes(e.id)||c.removeChild(e)})),b.loadRoomsListTimer=setTimeout(b.loadRoomsList,2e3)}).catch(function(e){console.log("Network Error",e),b.loadRoomsListTimer=setTimeout(b.loadRoomsList,2e3)})},b.openRoom=function(e){b.stopLoadRooms(),G(e.elements.dialogs.netplay.querySelector(".".concat(b.classNames["netplay-roomlist"])),!0),G(e.elements.dialogs.netplay.querySelector(".".concat(b.classNames["netplay-room"])),!1),G(e.elements.dialogs.netplay.querySelector(".".concat(b.classNames["btn-create-room"])),!0),G(e.elements.dialogs.netplay.querySelector(".".concat(b.classNames["btn-quit"])),!1),b.resetCheat(),G(e.elements.buttons.cheat,!0);var e=e.elements.dialogs.netplay.querySelector(".".concat(b.classNames["netplay-room"])),t=e.querySelector("[data-room-password]"),o=(null===b.connection.password?G(t,!0):(G(t,!1),t.querySelector("span").innerText=b.connection.password),e.querySelector("tbody"));o.innerHTML="",e.querySelector("strong").innerText=l.room_name,b.players.forEach(function(e,t){var n=null;e&&(b.connection.peers[e]?n=b.connection.peers[e].extra:b.connection.userid===e&&(n=b.connection.extra),n&&n.name)&&((e=document.createElement("tr")).innerHTML="".concat(t+1," ").concat(n.name," "),o.appendChild(e))})},B.call(this,a.querySelector(".".concat(b.classNames["modal__btn-primary"])),"click",function(e){var t=a.querySelector(".".concat(b.classNames["netplay-room-password-input"])).value,t=(b.showLoading.call(h),b.connection.password=t,a.getAttribute("data-id"));b.connection.join(t,function(e,t,n){u(e,0,n),e&&a.classList.remove(H({"is-open":!0}))}),e.stopPropagation()}),B.call(this,n.querySelector(".".concat(b.classNames["modal__btn-primary"])),"click",function(e){var t=(t=n.querySelector(".".concat(b.classNames["netplay-player-name"])).value).replace(/<|>/g,"");n.querySelector(".".concat(b.classNames.modal__errmsg)).innerHTML="",t.trim()&&(b.playerName=t.trim(),b.connection.extra.name=t.trim(),g.close()),e.stopPropagation()}),B.call(this,i.querySelector(".".concat(b.classNames["modal__btn-primary"])),"click",function(e){var t=(t=i.querySelector(".".concat(b.classNames["netplay-room-name-input"])).value).replace(/<|>/g,""),n=i.querySelector("select[data-max-players] option:checked").value;4<(n=n<2?2:n)&&(n=4);for(var o=0;o t&&(e+=" ... "),">>=0,isFinite(n)?(n>>>=0,void 0===o&&(o="utf8")):(o=n,n=void 0)}var a=this.length-t;if((void 0===n||a>1,d=-7,u=n?a-1:0,f=n?-1:1,a=e[t+u];for(u+=f,i=a&(1<<-d)-1,a>>=-d,d+=s;0
':t.innerHTML='Download '+e.name+'
'):console.error("No such progress-helper element exist.",e)}}},t={handle:function(a){a.autoTranslateText=!1,a.language="en",a.googKey="AIzaSyCgB5hmFY74WYB-EoWkhr9cAGr6TiTHrEE",a.Translator={TranslateText:function(e,t){var n=document.createElement("script"),e=(n.type="text/javascript",encodeURIComponent(e)),o="method"+a.token(),o=(window[o]=function(e){e.data&&e.data.translations[0]&&t?t(e.data.translations[0].translatedText):e.error&&"Daily Limit Exceeded"===e.error.message?console.error('Text translation failed. Error message: "Daily Limit Exceeded."'):e.error?console.error(e.error.message):console.error(e)},"https://www.googleapis.com/language/translate/v2?key="+a.googKey+"&target="+(a.language||"en-US")+"&callback=window."+o+"&q="+e);n.src=o,document.getElementsByTagName("head")[0].appendChild(n)},getListOfLanguages:function(t){var n=new XMLHttpRequest,e=(n.onreadystatechange=function(){var e;n.readyState==XMLHttpRequest.DONE&&((e=JSON.parse(n.responseText))&&e.data&&e.data.languages?t(e.data.languages):e.error&&"Daily Limit Exceeded"===e.error.message?console.error('Text translation failed. Error message: "Daily Limit Exceeded."'):e.error?console.error(e.error.message):console.error(e))},"https://www.googleapis.com/language/translate/v2/languages?key="+a.googKey+"&target=en");n.open("GET",e,!0),n.send(null)}}}};function I(t){if(P.socketAutoReConnect=!0,P.socket)t&&t(P.socket);else{if(void 0===n)if("undefined"!=typeof FirebaseConnection)window.SocketConnection=FirebaseConnection;else{if("undefined"==typeof PubNubConnection)throw"SocketConnection.js seems missed.";window.SocketConnection=PubNubConnection}new n(P,function(e){t&&t(P.socket)})}}function Me(n,o){P.socket.emit("join-room",{sessionid:P.sessionid,session:P.session,mediaConstraints:P.mediaConstraints,sdpConstraints:P.sdpConstraints,streams:Re(),extra:P.extra,password:void 0!==P.password&&"object"!==ze(P.password)?P.password:""},function(e,t){if(!0===e){if(P.enableLogs&&console.log("isRoomJoined: ",e," roomid: ",P.sessionid),P.peers[P.sessionid])return;j.onNegotiationNeeded(n)}!1===e&&P.enableLogs&&console.warn("isRoomJoined: ",t," roomid: ",P.sessionid),o(e,P.sessionid,t)})}function Oe(n){P.enableLogs&&console.log("Sending open-room signal to socket.io"),P.waitingForLocalMedia=!1,P.socket.emit("open-room",{sessionid:P.sessionid,session:P.session,mediaConstraints:P.mediaConstraints,sdpConstraints:P.sdpConstraints,streams:Re(),extra:P.extra,identifier:P.publicRoomIdentifier,password:void 0!==P.password&&"object"!==ze(P.password)?P.password:""},function(e,t){!0===e&&(P.enableLogs&&console.log("isRoomOpened: ",e," roomid: ",P.sessionid),n(e,P.sessionid)),!1===e&&(P.enableLogs&&console.warn("isRoomOpened: ",t," roomid: ",P.sessionid),n(e,P.sessionid,t))})}function Re(){try{return P.streamEvents.selectAll("local").map(function(e){return{streamid:e.streamid,tracks:e.stream.getTracks().length}})}catch(e){return[]}}function Pe(e,n){var t,o;P.dontCaptureUserMedia||e.isDataOnly?n():(t={},e.localPeerSdpConstraints.OfferToReceiveAudio&&(t.audio=P.mediaConstraints.audio),e.localPeerSdpConstraints.OfferToReceiveVideo&&(t.video=P.mediaConstraints.video),(o=e.session||P.session).oneway&&"two-way"!==o.audio&&"two-way"!==o.video&&"two-way"!==o.screen?n():((o=o.oneway&&o.audio&&"two-way"===o.audio?{audio:!0}:o).audio||o.video||o.screen)&&(o.screen?"Edge"===DetectRTC.browser.name?navigator.getDisplayMedia({video:!0,audio:x(P)}).then(function(e){e.isScreen=!0,j.onGettingLocalMedia(e),!o.audio&&!o.video||x(P)?n(e):P.invokeGetUserMedia(null,n)},function(e){console.error("Unable to capture screen on Edge. HTTPs and version 17+ is required.")}):P.getScreenConstraints(function(e,t){P.invokeGetUserMedia({audio:!!x(P)&&le(t),video:t,isScreen:!0},!o.audio&&!o.video||x(P)?n:P.invokeGetUserMedia(null,n))}):(o.audio||o.video)&&P.invokeGetUserMedia(null,n,o)))}function je(e,t){e?(t.audio&&_(e,"audio").forEach(function(e){e.applyConstraints(t.audio)}),t.video&&_(e,"video").forEach(function(e){e.applyConstraints(t.video)})):P.enableLogs&&console.error("No stream to applyConstraints.")}function Ne(t,e,n){e?j.replaceTrack(t,e,n):P.peers.getAllParticipants().forEach(function(e){j.replaceTrack(t,e,n)})}D=D||{useDefaultDevices:!0},(P=this).channel=P.sessionid=(L||location.href.replace(/\/|:|#|\?|\$|\^|%|\.|`|~|!|\+|@|\[|\||]|\|*. /g,"").split("\n").join("").split("\r").join(""))+"",j=new z(P),Ee={},j.onGettingLocalMedia=function(t,a){if(a=a||function(){},Ee[t.streamid])a();else{Ee[t.streamid]=!0;try{t.type="local"}catch(e){}P.setStreamEndHandler(t),F(t,function(e){e.id=t.streamid,e.muted=!0,e.volume=0,-1===P.attachStreams.indexOf(t)&&P.attachStreams.push(t),void 0!==k&&k.setHandlers(t,!0,P),P.streamEvents[t.streamid]={stream:t,type:"local",mediaElement:e,userid:P.userid,extra:P.extra,streamid:t.streamid,isAudioMuted:!0};try{var n=P,o=P.streamEvents[t.streamid];if(o.stream&&_(o.stream,"audio").length){if(!n||!o)throw"Both arguments are required.";if(n.onspeaking&&n.onsilence){if("undefined"==typeof hark)throw"hark.js not found.";hark(o.stream,{onspeaking:function(){n.onspeaking(o)},onsilence:function(){n.onsilence(o)},onvolumechange:function(e,t){n.onvolumechange&&n.onvolumechange(Fe({volume:e,threshold:t},o))}})}}U(P,P.streamEvents[t.streamid]),P.onstream(P.streamEvents[t.streamid])}catch(e){}a()},P)}},j.onGettingRemoteMedia=function(t,n){try{t.type="remote"}catch(e){}P.setStreamEndHandler(t,"remote-stream"),F(t,function(e){e.id=t.streamid,void 0!==k&&k.setHandlers(t,!1,P),P.streamEvents[t.streamid]={stream:t,type:"remote",userid:n,extra:P.peers[n]?P.peers[n].extra:{},mediaElement:e,streamid:t.streamid},U(P,P.streamEvents[t.streamid]),P.onstream(P.streamEvents[t.streamid])},P)},j.onRemovingRemoteMedia=function(e,t){var n=(n=P.streamEvents[e.streamid])||{stream:e,type:"remote",userid:t,extra:P.peers[t]?P.peers[t].extra:{},streamid:e.streamid,mediaElement:P.streamEvents[e.streamid]?P.streamEvents[e.streamid].mediaElement:null};P.peersBackup[n.userid]&&(n.extra=P.peersBackup[n.userid].extra),P.onstreamended(n),delete P.streamEvents[e.streamid]},j.onNegotiationNeeded=function(e,t,n){n=n||function(){};var o={remoteUserId:t=t||e.remoteUserId,message:e=e||"",sender:P.userid};e.remoteUserId&&e.message&&e.sender&&(o=e),I(function(){P.socket.emit(P.socketMessageEvent,o,n)})},j.onUserLeft=function(e){P.deletePeer(e)},j.disconnectWith=function(e,t){P.socket&&P.socket.emit("disconnect-with",e,t||function(){}),P.deletePeer(e)},P.socketOptions={transport:"polling"},P.openOrJoin=function(e,r){r=r||function(){},P.checkPresence(e,function(e,t){var n,o,a,i;e?(P.sessionid=t,e=!!P.session.oneway,n=c(P.session),o={OfferToReceiveAudio:P.sdpConstraints.mandatory.OfferToReceiveAudio,OfferToReceiveVideo:P.sdpConstraints.mandatory.OfferToReceiveVideo},a={OfferToReceiveAudio:e?!!P.session.audio:P.sdpConstraints.mandatory.OfferToReceiveAudio,OfferToReceiveVideo:e?!!P.session.video||!!P.session.screen:P.sdpConstraints.mandatory.OfferToReceiveVideo},Pe((i={remoteUserId:P.sessionid,message:{newParticipationRequest:!0,isOneWay:e,isDataOnly:n,localPeerSdpConstraints:a,remotePeerSdpConstraints:o},sender:P.userid}).message,function(){Me(i,r)})):(P.waitingForLocalMedia=!0,P.isInitiator=!0,P.sessionid=t||P.sessionid,c(P.session)?Oe(r):P.captureUserMedia(function(){Oe(r)}))})},P.waitingForLocalMedia=!1,P.open=function(e,t){t=t||function(){},P.waitingForLocalMedia=!0,P.isInitiator=!0,P.sessionid=e||P.sessionid,I(function(){c(P.session)?Oe(t):P.captureUserMedia(function(){Oe(t)})})},P.peersBackup={},P.deletePeer=function(e){if(e&&P.peers[e]){var t={userid:e,extra:P.peers[e]?P.peers[e].extra:{}};if(P.peersBackup[t.userid]&&(t.extra=P.peersBackup[t.userid].extra),P.onleave(t),P.peers[e]){P.peers[e].streams.forEach(function(e){e.stop()});t=P.peers[e].peer;if(t&&"closed"!==t.iceConnectionState)try{t.close()}catch(e){}P.peers[e]&&(P.peers[e].peer=null,delete P.peers[e])}}},P.rejoin=function(e){var t;!P.isInitiator&&e&&Object.keys(e).length&&(t={},P.peers[e.remoteUserId]&&(t=P.peers[e.remoteUserId].extra,P.deletePeer(e.remoteUserId)),e&&e.remoteUserId&&(P.join(e.remoteUserId),P.onReConnecting({userid:e.remoteUserId,extra:t})))},P.join=function(e,t){P.sessionid=!!e&&(e.sessionid||e.remoteUserId||e)||P.sessionid,P.sessionid+="";var n=!1,o=!1,a=!1,i=!1,r=((e&&e.session||!e||"string"==typeof e)&&(a=!!(e=e&&e.session||P.session).oneway,i=c(e),o={OfferToReceiveAudio:P.sdpConstraints.mandatory.OfferToReceiveAudio,OfferToReceiveVideo:P.sdpConstraints.mandatory.OfferToReceiveVideo},n={OfferToReceiveAudio:a?!!P.session.audio:P.sdpConstraints.mandatory.OfferToReceiveAudio,OfferToReceiveVideo:a?!!P.session.video||!!P.session.screen:P.sdpConstraints.mandatory.OfferToReceiveVideo}),function(){}),s=("function"==typeof(t=t||{})&&(r=t,t={}),void 0!==t.localPeerSdpConstraints&&(n=t.localPeerSdpConstraints),void 0!==t.remotePeerSdpConstraints&&(o=t.remotePeerSdpConstraints),void 0!==t.isOneWay&&(a=t.isOneWay),void 0!==t.isDataOnly&&(i=t.isDataOnly),{remoteUserId:P.sessionid,message:{newParticipationRequest:!0,isOneWay:a,isDataOnly:i,localPeerSdpConstraints:n,remotePeerSdpConstraints:o},sender:P.userid});return Pe(s.message,function(){I(function(){Me(s,r)})}),s},P.publicRoomIdentifier="",P.getUserMedia=P.captureUserMedia=function(o,a){o=o||function(){};var i=a||P.session;P.dontCaptureUserMedia||c(i)?o():(i.audio||i.video||i.screen)&&(i.screen?"Edge"===DetectRTC.browser.name?navigator.getDisplayMedia({video:!0,audio:x(P)}).then(function(e){if(e.isScreen=!0,j.onGettingLocalMedia(e),!i.audio&&!i.video||x(P))o(e);else{var t,n={};for(t in i)"screen"!==t&&(n[t]=i[t]);P.invokeGetUserMedia(a,o,n)}},function(e){console.error("Unable to capture screen on Edge. HTTPs and version 17+ is required.")}):P.getScreenConstraints(function(e,t){if(e)throw e;P.invokeGetUserMedia({audio:!!x(P)&&le(t),video:t,isScreen:!0},function(e){if(!i.audio&&!i.video||x(P))o(e);else{var t,n={};for(t in i)"screen"!==t&&(n[t]=i[t]);P.invokeGetUserMedia(a,o,n)}})}):(i.audio||i.video)&&P.invokeGetUserMedia(a,o,i))},P.onbeforeunload=function(e,t){P.closeBeforeUnload&&(P.peers.getAllParticipants().forEach(function(e){j.onNegotiationNeeded({userLeft:!0},e),P.peers[e]&&P.peers[e].peer&&P.peers[e].peer.close(),delete P.peers[e]}),t||P.closeSocket(),P.isInitiator=!1)},window.ignoreBeforeUnload?P.closeBeforeUnload=!1:(P.closeBeforeUnload=!0,window.addEventListener("beforeunload",P.onbeforeunload,!1)),P.userid=f(),P.changeUserId=function(e,t){t=t||function(){},P.userid=e||f(),P.socket.emit("changed-uuid",P.userid,t)},P.extra={},P.attachStreams=[],P.session={audio:!0,video:!0},P.enableFileSharing=!1,P.bandwidth={screen:!1,audio:!1,video:!1},P.codecs={audio:"opus",video:"VP9"},P.processSdp=function(e){return function(){var t=!1;try{if("undefined"==typeof RTCRtpTransceiver)return;if(!("currentDirection"in RTCRtpTransceiver.prototype))return;var e=new S;try{e.addTransceiver("audio"),t=!0}catch(e){}e.close()}catch(e){t=!1}return t&&function(){var t=!1;try{var e=new S({sdpSemantics:"unified-plan"});try{var n=e.getConfiguration(),t="unified-plan"==n.sdpSemantics||(n.sdpSemantics,!1)}catch(e){t=!1}}catch(e){t=!1}return t}()}()||"Safari"!==DetectRTC.browser.name&&("VP8"===P.codecs.video.toUpperCase()&&(e=E.preferCodec(e,"vp8")),"VP9"===P.codecs.video.toUpperCase()&&(e=E.preferCodec(e,"vp9")),"H264"===P.codecs.video.toUpperCase()&&(e=E.preferCodec(e,"h264")),"G722"===P.codecs.audio&&(e=E.removeNonG722(e)),"Firefox"!==DetectRTC.browser.name&&((P.bandwidth.video||P.bandwidth.screen)&&(e=E.setApplicationSpecificBandwidth(e,P.bandwidth,!!P.session.screen)),P.bandwidth.video&&(e=E.setVideoBitrates(e,{min:8*P.bandwidth.video*1024,max:8*P.bandwidth.video*1024})),P.bandwidth.audio&&(e=E.setOpusAttributes(e,{maxaveragebitrate:8*P.bandwidth.audio*1024,maxplaybackrate:8*P.bandwidth.audio*1024,stereo:1,maxptime:3})))),e},void 0!==E&&(P.BandwidthHandler=P.CodecsHandler=E),P.mediaConstraints={audio:{mandatory:{},optional:P.bandwidth.audio?[{bandwidth:8*P.bandwidth.audio*1024||1048576}]:[]},video:{mandatory:{},optional:P.bandwidth.video?[{bandwidth:8*P.bandwidth.video*1024||1048576},{facingMode:"user"}]:[{facingMode:"user"}]}},"Firefox"===DetectRTC.browser.name&&(P.mediaConstraints={audio:!0,video:!0}),D.useDefaultDevices||DetectRTC.isMobileDevice||DetectRTC.load(function(){var t,n;if(DetectRTC.MediaDevices.forEach(function(e){"audioinput"===e.kind&&!1!==P.mediaConstraints.audio&&(t=e),"videoinput"===e.kind&&!1!==P.mediaConstraints.video&&(n=e)}),t){if("Firefox"===DetectRTC.browser.name)return void(!0!==P.mediaConstraints.audio?P.mediaConstraints.audio.deviceId=t.id:P.mediaConstraints.audio={deviceId:t.id});1==P.mediaConstraints.audio&&(P.mediaConstraints.audio={mandatory:{},optional:[]}),P.mediaConstraints.audio.optional||(P.mediaConstraints.audio.optional=[]);var e=[{sourceId:t.id}];P.mediaConstraints.audio.optional=e.concat(P.mediaConstraints.audio.optional)}n&&("Firefox"===DetectRTC.browser.name?!0!==P.mediaConstraints.video?P.mediaConstraints.video.deviceId=n.id:P.mediaConstraints.video={deviceId:n.id}:(1==P.mediaConstraints.video&&(P.mediaConstraints.video={mandatory:{},optional:[]}),P.mediaConstraints.video.optional||(P.mediaConstraints.video.optional=[]),e=[{sourceId:n.id}],P.mediaConstraints.video.optional=e.concat(P.mediaConstraints.video.optional)))}),P.sdpConstraints={mandatory:{OfferToReceiveAudio:!0,OfferToReceiveVideo:!0},optional:[{VoiceActivityDetection:!1}]},P.sdpSemantics=null,P.iceCandidatePoolSize=null,P.bundlePolicy=null,P.rtcpMuxPolicy=null,P.iceTransportPolicy=null,P.optionalArgument={optional:[{DtlsSrtpKeyAgreement:!0},{googImprovedWifiBwe:!0},{googScreencastMinBitrate:300},{googIPv6:!0},{googDscp:!0},{googCpuUnderuseThreshold:55},{googCpuOveruseThreshold:85},{googSuspendBelowMinBitrate:!0},{googCpuOveruseDetection:!0}],mandatory:{}},P.iceServers=l(P),P.candidates={host:!0,stun:!0,turn:!0},P.iceProtocols={tcp:!0,udp:!0},P.onopen=function(e){P.enableLogs&&console.info("Data connection has been opened between you & ",e.userid)},P.onclose=function(e){P.enableLogs&&console.warn("Data connection has been closed between you & ",e.userid)},P.onerror=function(e){P.enableLogs&&console.error(e.userid,"data-error",e)},P.onmessage=function(e){P.enableLogs&&console.debug("data-message",e.userid,e.data)},P.send=function(e,t){P.peers.send(e,t)},P.close=P.disconnect=P.leave=function(){P.onbeforeunload(!1,!0)},P.closeEntireSession=function(t){t=t||function(){},P.socket.emit("close-entire-session",function e(){P.getAllParticipants().length?setTimeout(e,100):(P.onEntireSessionClosed({sessionid:P.sessionid,userid:P.userid,extra:P.extra}),P.changeUserId(null,function(){P.close(),t()}))})},P.onEntireSessionClosed=function(e){P.enableLogs&&console.info("Entire session is closed: ",e.sessionid,e.extra)},P.onstream=function(e){var t=P.videosContainer,t=(t.insertBefore(e.mediaElement,t.firstChild),e.mediaElement.play());void 0===t?setTimeout(function(){e.mediaElement.play()},2e3):t.catch(function(){}).then(function(){setTimeout(function(){e.mediaElement.play()},2e3)})},P.onstreamended=function(e){e.mediaElement||(e.mediaElement=document.getElementById(e.streamid)),e.mediaElement&&e.mediaElement.parentNode&&e.mediaElement.parentNode.removeChild(e.mediaElement)},P.direction="many-to-many",P.removeStream=function(t,n){var o;P.attachStreams.forEach(function(e){e.id===t&&(o=e)}),o?(P.peers.getAllParticipants().forEach(function(e){if(!n||e===n){e=P.peers[e];try{e.peer.removeStream(o)}catch(e){}}}),P.renegotiate()):console.warn("No such stream exist.",t)},P.addStream=function(n,t){if(n.getTracks)return-1===P.attachStreams.indexOf(n)&&(n.streamid||(n.streamid=n.id),P.attachStreams.push(n)),void P.renegotiate(t);function o(e){n.streamCallback&&n.streamCallback(e),P.renegotiate(t)}c(n)?P.renegotiate(t):(n.audio||n.video||n.screen)&&(n.screen?"Edge"===DetectRTC.browser.name?navigator.getDisplayMedia({video:!0,audio:x(P)}).then(function(e){e.isScreen=!0,j.onGettingLocalMedia(e),!n.audio&&!n.video||x(P)?o(e):P.invokeGetUserMedia(null,function(e){o(e)})},function(e){console.error("Unable to capture screen on Edge. HTTPs and version 17+ is required.")}):P.getScreenConstraints(function(e,t){if(e)return"PermissionDeniedError"===e?(n.streamCallback&&n.streamCallback(null),void(P.enableLogs&&console.error("User rejected to share his screen."))):alert(e);P.invokeGetUserMedia({audio:!!x(P)&&le(t),video:t,isScreen:!0},function(e){!n.audio&&!n.video||x(P)?o(e):P.invokeGetUserMedia(null,function(e){o(e)})})}):(n.audio||n.video)&&P.invokeGetUserMedia(null,o))},P.invokeGetUserMedia=function(n,o,e){e=e||P.session,we({onGettingLocalMedia:function(e){var t=n.video;t&&(t.mediaSource||t.mozMediaSource||t.mandatory&&t.mandatory.chromeMediaSource)&&(e.isScreen=!0),e.isScreen||(e.isVideo=!!_(e,"video").length,e.isAudio=!e.isVideo&&_(e,"audio").length),j.onGettingLocalMedia(e,function(){"function"==typeof o&&o(e)})},onLocalMediaError:function(e,t){j.onLocalMediaError(e,t)},localMediaConstraints:(n=n||P.mediaConstraints)||{audio:!!e.audio&&n.audio,video:!!e.video&&n.video}})},P.applyConstraints=function(t,e){var n;C&&C.prototype.applyConstraints?e?je(n=P.streamEvents[e]?P.streamEvents[e].stream:n,t):P.attachStreams.forEach(function(e){je(e,t)}):alert("track.applyConstraints is NOT supported in your browser.")},P.replaceTrack=function(n,t,o){if(n=n||{},S.prototype.getSenders)if(n instanceof C)Ne(n,t,o);else{if(n instanceof w)return _(n,"video").length&&Ne(_(n,"video")[0],t,!0),void(_(n,"audio").length&&Ne(_(n,"audio")[0],t,!1));if(c(n))throw"connection.replaceTrack requires audio and/or video and/or screen.";(n.audio||n.video||n.screen)&&(n.screen?"Edge"===DetectRTC.browser.name?navigator.getDisplayMedia({video:!0,audio:x(P)}).then(function(e){e.isScreen=!0,j.onGettingLocalMedia(e),!n.audio&&!n.video||x(P)?a(e):P.invokeGetUserMedia(null,a)},function(e){console.error("Unable to capture screen on Edge. HTTPs and version 17+ is required.")}):P.getScreenConstraints(function(e,t){if(e)return alert(e);P.invokeGetUserMedia({audio:!!x(P)&&le(t),video:t,isScreen:!0},!n.audio&&!n.video||x(P)?a:P.invokeGetUserMedia(null,a))}):(n.audio||n.video)&&P.invokeGetUserMedia(null,a))}else P.addStream(n);function a(e){P.replaceTrack(e,t,o||n.video||n.screen)}},P.resetTrack=function(e,n){(e="string"==typeof(e=e||P.getAllParticipants())?[e]:e).forEach(function(e){var t=P.peers[e].peer;void 0!==n&&!0!==n||!t.lastVideoTrack||P.replaceTrack(t.lastVideoTrack,e,!0),void 0!==n&&!1!==n||!t.lastAudioTrack||P.replaceTrack(t.lastAudioTrack,e,!1)})},P.renegotiate=function(e){e?j.renegotiatePeer(e):P.peers.getAllParticipants().forEach(function(e){j.renegotiatePeer(e)})},P.setStreamEndHandler=function(o,a){var e;o&&o.addEventListener&&(a=!!a,!o.alreadySetEndHandler)&&(o.alreadySetEndHandler=!0,e="ended","oninactive"in o&&(e="inactive"),o.addEventListener(e,function(){o.idInstance&¤tUserMediaRequest.remove(o.idInstance),a||(t=[],P.attachStreams.forEach(function(e){e.id!=o.id&&t.push(e)}),P.attachStreams=t);var e,t,n=(n=P.streamEvents[o.streamid])||{stream:o,streamid:o.streamid,type:a?"remote":"local",userid:P.userid,extra:P.extra,mediaElement:P.streamEvents[o.streamid]?P.streamEvents[o.streamid].mediaElement:null};a&&P.peers[n.userid]&&(e=P.peers[n.userid].peer,t=[],e.getRemoteStreams().forEach(function(e){e.id!=o.id&&t.push(e)}),P.peers[n.userid].streams=t),n.userid===P.userid&&"remote"===n.type||(P.peersBackup[n.userid]&&(n.extra=P.peersBackup[n.userid].extra),P.onstreamended(n),delete P.streamEvents[o.streamid])},!1))},P.onMediaError=function(e,t){P.enableLogs&&console.error(e,t)},P.autoCloseEntireSession=!1,P.filesContainer=P.videosContainer=document.body||document.documentElement,P.isInitiator=!1,P.shareFile=j.shareFile,i.handle(P),t.handle(P),P.token=f,P.onNewParticipant=function(e,t){P.acceptParticipationRequest(e,t)},P.acceptParticipationRequest=function(e,t){t.successCallback&&(t.successCallback(),delete t.successCallback),j.createNewPeer(e,t)},void 0!==k&&(P.StreamsHandler=k),P.onleave=function(e){},P.invokeSelectFileDialog=function(e){var t=new Ue;t.accept="*.*",t.selectSingleFile(e)},P.onmute=function(e){var t;e&&e.mediaElement&&("both"===e.muteType||"video"===e.muteType?(e.mediaElement.src=null,void 0!==(t=e.mediaElement.pause())?t.then(function(){e.mediaElement.poster=e.snapshot||"https://cdn.webrtc-experiment.com/images/muted.png"}):e.mediaElement.poster=e.snapshot||"https://cdn.webrtc-experiment.com/images/muted.png"):"audio"===e.muteType&&(e.mediaElement.muted=!0))},P.onunmute=function(e){e&&e.mediaElement&&e.stream&&("both"===e.unmuteType||"video"===e.unmuteType?(e.mediaElement.poster=null,e.mediaElement.srcObject=e.stream,e.mediaElement.play()):"audio"===e.unmuteType&&(e.mediaElement.muted=!1))},P.onExtraDataUpdated=function(e){e.status="online",P.onUserStatusChanged(e,!0)},P.getAllParticipants=function(e){return P.peers.getAllParticipants(e)},void 0!==k&&(k.onSyncNeeded=function(t,n,o){P.peers.getAllParticipants().forEach(function(e){j.onNegotiationNeeded({streamid:t,action:n,streamSyncNeeded:!0,type:o||"both"},e)})}),P.connectSocket=function(e){I(e)},P.closeSocket=function(){try{De.a.sockets={}}catch(e){}P.socket&&("function"==typeof P.socket.disconnect&&P.socket.disconnect(),"function"==typeof P.socket.resetProps&&P.socket.resetProps(),P.socket=null)},P.getSocket=function(e){return!e&&P.enableLogs&&console.warn("getSocket.callback paramter is required."),e=e||function(){},P.socket?e(P.socket):I(function(){e(P.socket)}),P.socket},P.getRemoteStreams=j.getRemoteStreams,Ae=["selectFirst","selectAll","forEach"],P.streamEvents={selectFirst:function(e){return P.streamEvents.selectAll(e)[0]},selectAll:function(n){"video"==(n="audio"==(n="screen"==(n="remote"==(n="local"==(n=n||{local:!0,remote:!0,isScreen:!0,isAudio:!0,isVideo:!0})?{local:!0}:n)?{remote:!0}:n)?{isScreen:!0}:n)?{isAudio:!0}:n)&&(n={isVideo:!0});var o=[];return Object.keys(P.streamEvents).forEach(function(e){var t=P.streamEvents[e];-1===Ae.indexOf(e)&&(e=!0,n.local&&"local"===t.type&&(e=!1),n.remote&&"remote"===t.type&&(e=!1),n.isScreen&&t.stream.isScreen&&(e=!1),n.isVideo&&t.stream.isVideo&&(e=!1),n.isAudio&&t.stream.isAudio&&(e=!1),!1===(e=n.userid&&t.userid===n.userid?!1:e)&&o.push(t))}),o}},P.socketURL="/",P.socketMessageEvent="RTCMultiConnection-Message",P.socketCustomEvent="RTCMultiConnection-Custom-Message",P.DetectRTC=DetectRTC,P.setCustomSocketEvent=function(e){e&&(P.socketCustomEvent=e),P.socket&&P.socket.emit("set-custom-socket-event-listener",P.socketCustomEvent)},P.getNumberOfBroadcastViewers=function(e,t){P.socket&&e&&t&&P.socket.emit("get-number-of-users-in-specific-broadcast",e,t)},P.onNumberOfBroadcastViewersUpdated=function(e){P.enableLogs&&P.isInitiator&&console.info("Number of broadcast (",e.broadcastId,") viewers",e.numberOfBroadcastViewers)},P.onUserStatusChanged=function(e,t){P.enableLogs&&!t&&console.info(e.userid,e.status)},P.getUserMediaHandler=we,P.multiPeersHandler=j,P.enableLogs=!0,P.setCustomSocketHandler=function(e){void 0!==n&&(n=e)},P.chunkSize=4e4,P.maxParticipantsAllowed=1e3,P.disconnectWith=j.disconnectWith,P.checkPresence=function(e,o){e=e||P.sessionid,"SSEConnection"!==n.name?P.socket?P.socket.emit("check-presence",e+"",function(e,t,n){P.enableLogs&&console.log("checkPresence.isRoomExist: ",e," roomid: ",t),o(e,t,n)}):P.connectSocket(function(){P.checkPresence(e,o)}):SSEConnection.checkPresence(e,function(e,t,n){if(!P.socket)return e||(P.userid=t),void P.connectSocket(function(){o(e,t,n)});o(e,t)})},P.onReadyForOffer=function(e,t){P.multiPeersHandler.createNewPeer(e,t)},P.setUserPreferences=function(e){return P.dontAttachStream&&(e.dontAttachLocalStream=!0),P.dontGetRemoteStream&&(e.dontGetRemoteStream=!0),e},P.updateExtraData=function(){P.socket.emit("extra-data-updated",P.extra)},P.enableScalableBroadcast=!1,P.maxRelayLimitPerUser=3,P.dontCaptureUserMedia=!1,P.dontAttachStream=!1,P.dontGetRemoteStream=!1,P.onReConnecting=function(e){P.enableLogs&&console.info("ReConnecting with",e.userid,"...")},P.beforeAddingStream=function(e){return e},P.beforeRemovingStream=function(e){return e},P.checkIfChromeExtensionAvailable=_e,"undefined"!=typeof isFirefoxExtensionAvailable&&(P.checkIfChromeExtensionAvailable=isFirefoxExtensionAvailable),P.getChromeExtensionStatus=Te,P.getScreenConstraints=function(n,e){x(P,e)&&(e=!0);var o,a=function(e,t){e||(t=P.modifyScreenConstraints(t),n(e,t))};Se?a(null,{mozMediaSource:"window",mediaSource:"window"}):(o={mandatory:{chromeMediaSource:R,maxWidth:1920'+f.localization("Missing mame config")+"");var c=s.split("|");Z.coreFileName="".concat(f.system,"-").concat(c[0]),a="1"===c[1],z.element(f.elements.buttons.saveState)&&G(f.elements.buttons.saveState,!a),z.element(f.elements.buttons.loadState)&&G(f.elements.buttons.loadState,!a),G(te.contextMenu.querySelectorAll("ul li").item(2),!a),G(te.contextMenu.querySelectorAll("ul li").item(3),!a),d=2===f.coreVer?"":f.system.concat("-old-").concat(c[0],"-wasm.data"),c[0]?(X.wasm&&r?h=!0:(c.innerHTML=''+f.localization("Webassembly support is not detected in this browser")+"",d=""),d&&(A.db?A.get(d,function(e){e&&e.version===n?2===b.coreVer?L(e.data):((e=e.data.slice?e.data.slice(12):e.data.subarray(12)).set([55,122,188,175,39,28,0,3],0),L(e)):u(d,n)}):u(d,n))):c.innerHTML=''+f.localization("Unsupported Game")+""}else{var l,d=!1;if(X.wasm&&r?(l="wasm",d=!0,"n64"!==f.system||e||(l="legacy-wasm"),h=!0):i&&(d=!0,l="asmjs","n64"!==f.system||e||(l="legacy-asmjs")),!0!==(d="undefined"!=typeof EJS_CUSTOM_COREFILE?EJS_CUSTOM_COREFILE:d))return void(c.innerHTML=''+f.localization("Please upgrade your browser to the latest version")+"");d=2===f.coreVer?t+"-"+l+".data":t+"-old-"+l+".data","undefined"!=typeof EJS_CUSTOM_COREFILE&&(d=EJS_CUSTOM_COREFILE),A.db?A.get(d,function(e){!e||e.version!==n||"undefined"!=typeof EJS_DEBUG_XX&&!0===EJS_DEBUG_XX?u(d,n):2===b.coreVer?L(e.data):((e=e.data.slice?e.data.slice(12):e.data.subarray(12)).set([55,122,188,175,39,28,0,3],0),L(e))}):u(d,n)}2!==f.coreVer||"undefined"!=typeof EJS_DEBUG_XX&&!0===EJS_DEBUG_XX||z.element(f.elements.buttons.gamepad)&&G(f.elements.buttons.gamepad,!0),o||z.element(f.elements.buttons.netplay)&&G(f.elements.buttons.netplay,!0),z.element(f.elements.buttons.saveState)&&G(f.elements.buttons.saveState,!a),z.element(f.elements.buttons.loadState)&&G(f.elements.buttons.loadState,!a),G(te.contextMenu.querySelectorAll("ul li").item(2),!a),G(te.contextMenu.querySelectorAll("ul li").item(3),!a),b.setStatesSupported(a)}).catch(function(e){D(e,t,b)}),clearInterval(n),Z.romdb=d)},500),!1;var t,f,n}var k=function(){d.db&&d.getAll(function(e){Array.isArray(e)&&10'+s.localization("Control Settings")+'
\n \n
\n
"+s.localization("Press keyboard or gamepad")+"
"+s.localization("Press escape (esc) to clear")):t+="
Press keyboard
"+s.localization("Press escape (esc) to clear"),r.querySelector(".".concat(b.classNames["key-setting-popup"])).innerHTML=t,e.stopPropagation()})})},setCacheDialog:function(){var t=this;t.elements.dialogs.cache.innerHTML='\n \n "),B.call(this,t.elements.dialogs.cache.querySelector(".".concat(b.classNames["btn-cancel"])),"click",function(e){return G(t.elements.dialogs.cache,!0),t.elements.container.focus(),e.stopPropagation(),!1}),B.call(this,t.elements.dialogs.cache.querySelector(".".concat(b.classNames["dialog-title"]," a")),"click",function(e){return m.romdb&&(m.romdb.clear(),t.elements.dialogs.cache.querySelector(".".concat(b.classNames["dialog-content"])).innerHTML='Cheats
\n '+h.localization("Netplay")+'
\n \n \n
\n \n \n \n \n '+h.localization("Room Name")+" \n "+h.localization("Players")+' \n \n \n \n \n \n \n \n \n \n
\n \n \n \n \n '+h.localization("Player")+" \n "+h.localization("Name")+" \n \n \n \n 1 \n "+h.localization("Name")+" 1 \n \n \n \n 2 \n "+h.localization("Name")+" 2 \n \n \n \n 3 \n "+h.localization("Name")+" 3 \n \n \n \n \n 4 \n "+h.localization("Name")+' 4 \n \n ";b.players.forEach(function(e,t){var n=null;e?(b.connection.peers[e]?n=b.connection.peers[e].extra:b.connection.userid===e&&(n=b.connection.extra),o+="
",h.elements.widgets.netplay.innerHTML=o},500),n=h.elements.dialogs.netplay.querySelector("#modal-9de6c4e9ce2b9361"),i=h.elements.dialogs.netplay.querySelector("#modal-85cd7a1c543a484a"),o=h.elements.dialogs.netplay.querySelector("#modal-7d8fd50ed642340b"),a=h.elements.dialogs.netplay.querySelector("#modal-5aa765d61d8327de"),l={},b.connection=new De.a,(e=p.socketUrl).endsWith("/")||(e+="/"),b.connection.socketURL="/",b.connection.socketURL=e,b.connection.socketMessageEvent="emulatorjs-message",b.connection.socketCustomEvent="emulatorjs-custom-message",e=W.info(),b.connection.extra={name:b.playerName,game_id:h.config.gameId,browser_name:e.name,room_name:" ",domain:document.domain},b.connection.socketMessageEvent="netplay",b.connection.enableFileSharing=!0,b.connection.enableLogs=!1,b.connection.session={data:!0},b.connection.sdpConstraints.mandatory={OfferToReceiveAudio:!1,OfferToReceiveVideo:!1},b.connection.onclose=function(e){},b.connection.iceServers=[{urls:"turn:turn.emulatorjs.com:3478",credential:"dSnmrtehverella",username:"ejs"},{urls:["stun:stun.l.google.com:19302","stun:stun1.l.google.com:19302","stun:stun2.l.google.com:19302","stun:stun.l.google.com:19302?transport=udp"]}],b.connection.maxParticipantsAllowed=4,s=b.netPlayInitFrame=0,c=!1,Module.postMainLoop=function(){var e,t;if(b.currentFrame=parseInt(b.currentFrameNum(),10),b.connected)if(s+=1,b.connection.isInitiator)if(1<=s){for(var n=[],o=b.currentFrame-1;o[".concat(a,"] ").concat(o," ").concat(t.room_name," ").concat(t.current,"/").concat(t.max," ").concat(e," "),B.call(p,n.querySelector(".".concat(b.classNames["btn-join-room"])),"click",f),c.appendChild(n)}),c.querySelectorAll("tr").forEach(function(e){r.includes(e.id)||c.removeChild(e)})),b.loadRoomsListTimer=setTimeout(b.loadRoomsList,2e3)}).catch(function(e){console.log("Network Error",e),b.loadRoomsListTimer=setTimeout(b.loadRoomsList,2e3)})},b.openRoom=function(e){b.stopLoadRooms(),G(e.elements.dialogs.netplay.querySelector(".".concat(b.classNames["netplay-roomlist"])),!0),G(e.elements.dialogs.netplay.querySelector(".".concat(b.classNames["netplay-room"])),!1),G(e.elements.dialogs.netplay.querySelector(".".concat(b.classNames["btn-create-room"])),!0),G(e.elements.dialogs.netplay.querySelector(".".concat(b.classNames["btn-quit"])),!1),b.resetCheat(),G(e.elements.buttons.cheat,!0);var e=e.elements.dialogs.netplay.querySelector(".".concat(b.classNames["netplay-room"])),t=e.querySelector("[data-room-password]"),o=(null===b.connection.password?G(t,!0):(G(t,!1),t.querySelector("span").innerText=b.connection.password),e.querySelector("tbody"));o.innerHTML="",e.querySelector("strong").innerText=l.room_name,b.players.forEach(function(e,t){var n=null;e&&(b.connection.peers[e]?n=b.connection.peers[e].extra:b.connection.userid===e&&(n=b.connection.extra),n&&n.name)&&((e=document.createElement("tr")).innerHTML="".concat(t+1," ").concat(n.name," "),o.appendChild(e))})},B.call(this,a.querySelector(".".concat(b.classNames["modal__btn-primary"])),"click",function(e){var t=a.querySelector(".".concat(b.classNames["netplay-room-password-input"])).value,t=(b.showLoading.call(h),b.connection.password=t,a.getAttribute("data-id"));b.connection.join(t,function(e,t,n){u(e,0,n),e&&a.classList.remove(H({"is-open":!0}))}),e.stopPropagation()}),B.call(this,n.querySelector(".".concat(b.classNames["modal__btn-primary"])),"click",function(e){var t=(t=n.querySelector(".".concat(b.classNames["netplay-player-name"])).value).replace(/<|>/g,"");n.querySelector(".".concat(b.classNames.modal__errmsg)).innerHTML="",t.trim()&&(b.playerName=t.trim(),b.connection.extra.name=t.trim(),g.close()),e.stopPropagation()}),B.call(this,i.querySelector(".".concat(b.classNames["modal__btn-primary"])),"click",function(e){var t=(t=i.querySelector(".".concat(b.classNames["netplay-room-name-input"])).value).replace(/<|>/g,""),n=i.querySelector("select[data-max-players] option:checked").value;4<(n=n<2?2:n)&&(n=4);for(var o=0;o
`ja-JA` - Japanese
+`chi-CHI` - Chinese
+`hi-HI` - Hindi
+`ar-AR` - Arabic
+`jv-JV` - Javanese
+`ben-BEN` - Bengali
+`ru-RU` - Russian
+`de-GER` - German
+`ko-KO` - Korean
+`af-FR` - French
default: `en-US`
@@ -26,10 +35,12 @@ If the language file is not found or there was an error fetching the file, the e
translated for `pt-BR` by [@cesarcristianodeoliveira](https://github.com/cesarcristianodeoliveira)
translated for `es-ES` by [@cesarcristianodeoliveira](https://github.com/cesarcristianodeoliveira)
translated for `el-GR` by [@imneckro](https://github.com/imneckro)
-translated for `ja-JA` by [@allancoding](https://github.com/allancoding)
+translated for `ja-JA`, `chi-CHI`, `hi-HI`, `ar-AR`, `jv-JV`, `ben-BEN`, `ru-RU`, `de-GER`, `ko-KO`, `af-FR` by [@allancoding](https://github.com/allancoding)
## contributing
download the default `en.json` file and simply translate all the words that start with the `-` (remove the dash afterwards) then perform a pull request or open an issue with the file uploaded and I will add your work
Please contribute!!
+
+Enything that is incorrect or needs to be fix please perform a pull request!
\ No newline at end of file
diff --git a/data/localization/ru-RU.json b/data/localization/ru-RU.json
new file mode 100644
index 0000000..4c0c65a
--- /dev/null
+++ b/data/localization/ru-RU.json
@@ -0,0 +1,194 @@
+{
+ "i18n": {
+ "restart": "Начать сначала",
+ "play": "Играть",
+ "pause": "Пауза",
+ "played": "Играл",
+ "volume": "Громкость",
+ "mute": "Отключить звук (F9)",
+ "unmute": "Включить звук (F9)",
+ "enterFullscreen": "Войти в полноэкранный режим",
+ "exitFullscreen": "Выйти из полноэкранного режима",
+ "settings": "Настройки",
+ "saveState": "Сохранить состояние (Shift + F2)",
+ "loadState": "Загрузить состояние (Shift + F4)",
+ "screenRecord": "Начать запись экрана",
+ "netplay": "Сетевая игра",
+ "gamepad": "Настройки управления",
+ "cheat": "Читы",
+ "menuBack": "Вернуться в предыдущее меню",
+ "normal": "Нормальный",
+ "all": "Все",
+ "reset": "Сбросить",
+ "disabled": "Отключено",
+ "enabled": "Включено",
+ "playNow": "Играть сейчас"
+ },
+ "normalOptions": {
+ "shader": {
+ "label": "Шейдер",
+ "options": {
+ "disabled": "Отключено",
+ "2xScaleHQ.glslp": "2xScaleHQ",
+ "4xScaleHQ.glslp": "4xScaleHQ",
+ "crt-easymode.glslp": "ЭЛТ простой режим",
+ "crt-aperture.glslp": "ЭЛТ-диафрагма",
+ "crt-geom.glslp": "ЭЛТ геометрия"
+ },
+ "default": "disabled"
+ },
+ "virtual-gamepad": {
+ "label": "Виртуальный геймпад",
+ "options": {
+ "disabled": "Отключено",
+ "enabled": "Включено"
+ },
+ "default": "enabled"
+ }
+ },
+ "Control Settings": "Настройки управления",
+ "Player 1": "Игрок 1",
+ "Player 2": "Игрок 2",
+ "Player 3": "Игрок 3",
+ "Player 4": "Игрок 4",
+ "Update": "Обновить",
+ "Reset": "Сбросить",
+ "Clear": "Очистить",
+ "Cancel": "Отменить",
+ "Close": "Закрыть",
+ "Empty": "Пустой",
+ "Loading": "Загрузка",
+ "Submit": "Отправить",
+ "Description": "Описание",
+ "Code": "Код",
+ "Add Cheat Code": "Добавить чит-код",
+ "OK": "ОК",
+ "Add Cheat": "Добавить чит",
+ "Cache Manager": "Менеджер кеша",
+ "Press keyboard or gamepad": "Нажмите клавиатуру или геймпад",
+ "Gamepad": "Геймпад",
+ "Keyboard": "Клавиатура",
+ "Set": "Установить",
+ "QUICK SAVE STATE": "БЫСТРОЕ СОХРАНЕНИЕ",
+ "QUICK LOAD STATE": "СОСТОЯНИЕ БЫСТРОЙ ЗАГРУЗКИ",
+ "CHANGE STATE SLOT": "ИЗМЕНИТЬ СОСТОЯНИЕ СЛОТА",
+ "INSERT COIN": "ВСТАВЬТЕ МОНЕТУ",
+ "Press escape (esc) to clear": "Нажмите escape (esc)",
+ "Netplay": " чтобы очистить",
+ "Rooms": "Сетевая игра",
+ "Players": "Комнаты",
+ "Player": "Игроки",
+ "Room Name": "Игрок",
+ "Password": "Название комнаты",
+ "Name": "Пароль",
+ "Quit Room": "Имя",
+ "Create a Room": "Выйти из комнаты",
+ "Set Player Name": "Создать комнату",
+ "Player Name": "Установить имя игрока",
+ "Password (optional)": "Имя игрока",
+ "Select": "Пароль (необязательно)",
+ "Start": "Выбрать",
+ "Menu": "Старт",
+ "Decompress Game Core": "Меню",
+ "Decompress Game Data": "Распаковать игровое ядро",
+ "Decompress Game Patch": "Распаковать игровые данные",
+ "Download Game Data": " Распаковать игровой патч",
+ "Download Game Core": "Загрузить игровые данные",
+ "Network Error": "Загрузить игровое ядро",
+ "Default": "Сетевая ошибка",
+ "default": "По умолчанию",
+ "Save State Location": "по умолчанию",
+ "Save State Slot": "Сохранить местоположение состояния",
+ "Color Palette": "Сохранить ячейку состояния",
+ "No Sprite Limit": "Цветовая палитра",
+ "Enabled": "Без ограничений по спрайтам",
+ "Disabled": "Включено",
+ "enabled": "Отключено",
+ "disabled": "включено",
+ "Low": "отключено",
+ "High": "Низкий",
+ "Very High": "Высокий",
+ "4 Players Support": "Очень высокий",
+ "Turbo Enable": "Поддержка 4 игроков",
+ "None": "Турбо включить",
+ "Both": "Нет",
+ "Region": "Оба",
+ "SuperFX Overclock": "Регион",
+ "Sound Quality": "Разгон SuperFX",
+ "GB Colorization": "Качество звука",
+ "auto": "GB раскрашивание",
+ "internal": "авто",
+ "Internal Palette": "внутренний",
+ "GBC - Blue": "Внутренняя палитра",
+ "GBC - Brown": "GBC Синий",
+ "GBC - Dark Blue": "ГБК Браун",
+ "GBC - Dark Brown": "GBC темно-синий",
+ "GBC - Dark Green": "GBC темно-коричневый",
+ "GBC - Grayscale": "GBC темно-зеленый",
+ "GBC - Green": "GBC Оттенки серого",
+ "GBC - Inverted": "GBC Зеленый",
+ "GBC - Orange": "GBC перевернутый",
+ "GBC - Red": "GBC Оранжевый",
+ "GBC - Pastel Mix": "GBC Красный",
+ "GBC - Yellow": "Пастельный микс GBC",
+ "Frameskip": "GBC Желтый",
+ "Solar sensor level": "Пропуск кадров",
+ "Enable Turbo Buttons": "Уровень солнечного датчика",
+ "Turbo Delay in frames": "Включить турбо-кнопки",
+ "Auto": " Турбо-задержка в кадрах",
+ "Aspect Ratio (Need to refresh page)": "Авто",
+ "16:9 Resolution": "Соотношение сторон (необходимо обновить страницу)",
+ "4:3 Resolution": "Разрешение 16:9",
+ "Player 1 Pak": "Разрешение 4:3",
+ "Player 2 Pak": "Игрок 1 пакет",
+ "Player 3 Pak": "Пакет игроков 2",
+ "Player 4 Pak": "Игрок 3 пакет",
+ "none": "Игрок 4 пакет",
+ "memory": "нет",
+ "rumble": "память",
+ "Screen layout": "гул",
+ "right/left": "Раскладка экрана",
+ "left/right": "право/лево",
+ "bottom/top": "влево/вправо",
+ "top/bottom": "низ/верх",
+ "top only": "сверху/снизу",
+ "bottom only": "только сверху",
+ "quick switch": "только снизу",
+ "hybrid/bottom": "быстрый переключатель",
+ "hybrid/top": "гибрид/низ",
+ "Screen Rotation": "гибрид/топ",
+ "CPU speed": "Поворот экрана",
+ "Sound output": "скорость процессора",
+ "mono": "Вывод звука",
+ "stereo": "моно",
+ "OFF": "стерео",
+ "ON": "ВЫКЛ.",
+ "Fast Blitter": "ВКЛ",
+ "Bios": "Быстрый налет",
+ "Enable second memory card": "биос",
+ "Pad 1 Type": "Включить вторую карту памяти",
+ "Pad 2 Type": "Пэд 1 Тип",
+ "Pad 3 Type": "Пэд 2 Тип",
+ "Pad 4 Type": "Пэд 3 Тип",
+ "standard": "Пэд 4 Тип",
+ "analog": "стандарт",
+ "negcon": "аналоговый",
+ "Enable Vibration": "негкон",
+ "Enable interlacing mode(s)": "Включить вибрацию",
+ "Enhanced resolution (slow)": "Включить режим чересстрочной развертки",
+ "Enhanced resolution speed hack": "Улучшенное разрешение (медленно)",
+ "Aspect ratio": "Хак с увеличенной скоростью разрешения",
+ "CPU overclock": "Соотношение сторон",
+ "Force Neo Geo mode": "Разгон процессора",
+ "Diagnostic Input": "Принудительный режим Neo Geo",
+ "download": "Диагностический ввод",
+ "keep in browser": "скачать",
+ "Webassembly support is not detected in this browser": "держать в браузере",
+ "Please upgrade your browser to the latest version": "Поддержка Webassembly не обнаружена в этом браузере",
+ "Missing mame config": "Пожалуйста",
+ "Stop Screen Recording": " обновите браузер до последней версии",
+ "Start Screen Recording": "Отсутствует конфигурация мамы",
+ "Take Screenshot": "Остановить запись экрана",
+ "Quick Save": "Начать запись экрана",
+ "Quick Load": "Сделать снимок экрана"
+}
\ No newline at end of file
diff --git a/data/minify/package.json b/data/minify/package.json
index fd6cb51..a95e8f5 100644
--- a/data/minify/package.json
+++ b/data/minify/package.json
@@ -9,7 +9,7 @@
},
"repository": {
"type": "git",
- "url": "git+https://github.com/ethanaobrien/youtube-downloader.git"
+ "url": "git+https://github.com/ethanaobrien/emulatorjs.git"
},
"author": "Ethan O'Brien",
"bugs": {
diff --git a/docs/Contributors.md b/docs/Contributors.md
new file mode 100644
index 0000000..15c2a42
--- /dev/null
+++ b/docs/Contributors.md
@@ -0,0 +1,94 @@
+
+
+
+
+
+
+![Ethan Avatar]
+
+**[![Badge Ethan GitHub]][Ethan GitHub]**
+
+
+
+
+
+
+# Contributors
+
+
+
+
+![Archiver Avatar]
+
+***Documentation Design***
+
+**[![Badge Archiver GitHub]][Archiver GitHub]**
+
+**[![Badge Archiver Marked]][Archiver Marked]**
+
+
+
+
+
+
+![Allan Avatar]
+
+***Various Fixes & Additions***
+
+**[![Badge Allan GitHub]][Allan GitHub]**
+
+**[![Badge Allan Website]][Allan Website]**
+
+
+
+
+
+[![Avatar Nekro]][GitHub Nekro]
+[![Avatar Grey]][GitHub Grey]
+[![Avatar Kyle]][GitHub Kyle]
+
+