diff --git a/docs/index.91bffa56.js b/docs/index.274a73f5.js similarity index 99% rename from docs/index.91bffa56.js rename to docs/index.274a73f5.js index 8a3bac8..5f47bc4 100644 --- a/docs/index.91bffa56.js +++ b/docs/index.274a73f5.js @@ -4601,8 +4601,8 @@ e.exports=function(e,t,n){"use asm";var r=function e(e,t){// k in bytes e=e|0;t=t|0;var n=0,r=0,o=0,a=0,l=0,u=0,s=0,c=0,d=0,f=0,p=0,h=0,m=0,g=0;o=i[t+320>>2]|0;l=i[t+324>>2]|0;s=i[t+328>>2]|0;d=i[t+332>>2]|0;p=i[t+336>>2]|0;for(n=0;(n|0)<(e|0);n=n+64|0){a=o;u=l;c=s;f=d;h=p;for(r=0;(r|0)<64;r=r+4|0){g=i[n+r>>2]|0;m=((o<<5|o>>>27)+(l&s|~l&d)|0)+((g+p|0)+1518500249|0)|0;p=d;d=s;s=l<<30|l>>>2;l=o;o=m;i[e+r>>2]=g}for(r=e+64|0;(r|0)<(e+80|0);r=r+4|0){g=(i[r-12>>2]^i[r-32>>2]^i[r-56>>2]^i[r-64>>2])<<1|(i[r-12>>2]^i[r-32>>2]^i[r-56>>2]^i[r-64>>2])>>>31;m=((o<<5|o>>>27)+(l&s|~l&d)|0)+((g+p|0)+1518500249|0)|0;p=d;d=s;s=l<<30|l>>>2;l=o;o=m;i[r>>2]=g}for(r=e+80|0;(r|0)<(e+160|0);r=r+4|0){g=(i[r-12>>2]^i[r-32>>2]^i[r-56>>2]^i[r-64>>2])<<1|(i[r-12>>2]^i[r-32>>2]^i[r-56>>2]^i[r-64>>2])>>>31;m=((o<<5|o>>>27)+(l^s^d)|0)+((g+p|0)+1859775393|0)|0;p=d;d=s;s=l<<30|l>>>2;l=o;o=m;i[r>>2]=g}for(r=e+160|0;(r|0)<(e+240|0);r=r+4|0){g=(i[r-12>>2]^i[r-32>>2]^i[r-56>>2]^i[r-64>>2])<<1|(i[r-12>>2]^i[r-32>>2]^i[r-56>>2]^i[r-64>>2])>>>31;m=((o<<5|o>>>27)+(l&s|l&d|s&d)|0)+((g+p|0)-1894007588|0)|0;p=d;d=s;s=l<<30|l>>>2;l=o;o=m;i[r>>2]=g}for(r=e+240|0;(r|0)<(e+320|0);r=r+4|0){g=(i[r-12>>2]^i[r-32>>2]^i[r-56>>2]^i[r-64>>2])<<1|(i[r-12>>2]^i[r-32>>2]^i[r-56>>2]^i[r-64>>2])>>>31;m=((o<<5|o>>>27)+(l^s^d)|0)+((g+p|0)-899497514|0)|0;p=d;d=s;s=l<<30|l>>>2;l=o;o=m;i[r>>2]=g}o=o+a|0;l=l+u|0;s=s+c|0;d=d+f|0;p=p+h|0}i[t+320>>2]=o;i[t+324>>2]=l;i[t+328>>2]=s;i[t+332>>2]=d;i[t+336>>2]=p};var i=new e.Int32Array(n);return{hash:r}};/***/},/* 6 *//***/function(e,t){var n=this,r=void 0;"undefined"!=typeof self&&void 0!==self.FileReaderSync&&(r=new self.FileReaderSync);// Convert a binary string and write it to the heap. // A binary string is expected to only contain char codes < 256. var i=function(e,t,n,r,i,o){var a=void 0,l=o%4,u=(i+l)%4,s=i-u;switch(l){case 0:t[o]=e.charCodeAt(r+3);case 1:t[o+1-(l<<1)|0]=e.charCodeAt(r+2);case 2:t[o+2-(l<<1)|0]=e.charCodeAt(r+1);case 3:t[o+3-(l<<1)|0]=e.charCodeAt(r)}if(!(i>2]=e.charCodeAt(r+a)<<24|e.charCodeAt(r+a+1)<<16|e.charCodeAt(r+a+2)<<8|e.charCodeAt(r+a+3);switch(u){case 3:t[o+s+1|0]=e.charCodeAt(r+s+2);case 2:t[o+s+2|0]=e.charCodeAt(r+s+1);case 1:t[o+s+3|0]=e.charCodeAt(r+s)}}},o=function(e,t,n,r,i,o){var a=void 0,l=o%4,u=(i+l)%4,s=i-u;switch(l){case 0:t[o]=e[r+3];case 1:t[o+1-(l<<1)|0]=e[r+2];case 2:t[o+2-(l<<1)|0]=e[r+1];case 3:t[o+3-(l<<1)|0]=e[r]}if(!(i>2|0]=e[r+a]<<24|e[r+a+1]<<16|e[r+a+2]<<8|e[r+a+3];switch(u){case 3:t[o+s+1|0]=e[r+s+2];case 2:t[o+s+2|0]=e[r+s+1];case 1:t[o+s+3|0]=e[r+s]}}},a=function(e,t,n,i,o,a){var l=void 0,u=a%4,s=(o+u)%4,c=o-s,d=new Uint8Array(r.readAsArrayBuffer(e.slice(i,i+o)));switch(u){case 0:t[a]=d[3];case 1:t[a+1-(u<<1)|0]=d[2];case 2:t[a+2-(u<<1)|0]=d[1];case 3:t[a+3-(u<<1)|0]=d[0]}if(!(o>2|0]=d[l]<<24|d[l+1]<<16|d[l+2]<<8|d[l+3];switch(s){case 3:t[a+c+1|0]=d[c+2];case 2:t[a+c+2|0]=d[c+1];case 1:t[a+c+3|0]=d[c]}}};e.exports=function(e,t,r,l,u,s){if("string"==typeof e)return i(e,t,r,l,u,s);if(e instanceof Array||n&&n.Buffer&&n.Buffer.isBuffer(e))return o(e,t,r,l,u,s);if(e instanceof ArrayBuffer)return o(new Uint8Array(e),t,r,l,u,s);if(e.buffer instanceof ArrayBuffer)return o(new Uint8Array(e.buffer,e.byteOffset,e.byteLength),t,r,l,u,s);if(e instanceof Blob)return a(e,t,r,l,u,s);throw Error("Unsupported data type.")};/***/},/* 7 *//***/function(e,t,n){var r,i=function(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")},o=(r=function(e,t){for(var n=0;n cb -,n.onmessage=function(e){var t=e.data.id,n=i[t];delete i[t],null!=e.data.error?n(Error("Rusha worker error: "+e.data.error)):n(null,e.data.hash)}),i[r]=t,n.postMessage({id:r,data:e}),r+=1}}),f.register("hn8D3",function(e,n){t(e.exports,"default",function(){return u});var r=f("disEZ"),i=f("fJNo6"),o=f("9BzA6"),a="Lobby",l="Station",u=/*#__PURE__*/function(){function e(t){(0,r._)(this,e),this.doc={users:{},rooms:{}},this.userID="",this.isStation=!1,this.userSettings={displayName:"",room:a,role:"student",dateJoined:Date.now(),handRaised:!1,connections:[{id:"",target:{}}],timestamp:Date.now(),tombstone:!1},this.userID=t,this.initUser(),this.initRooms(0)}return(0,i._)(e,[{key:"init",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;this.userSettings.role=e,this.userID.startsWith(l)&&(this.isStation=!0),this.initUser(),this.initRooms(t),this.heartbeatID&&clearInterval(this.heartbeatID);var n=this;this.heartbeatID=setInterval(function(){n.heartBeat()},1e4)}},{key:"initUser",value:function(){this.userSettings.displayName=this.userID,this.userSettings.room=this.isStation?this.userID:a,this.userSettings.dateJoined=Date.now(),this.userSettings.timestamp=Date.now(),this.userSettings.tombstone=!1,this.doc.users[this.userID]=this.userSettings}},{// basic initialize rooms configuration -key:"initRooms",value:function(e){for(var t=1;t<=e;t++)this.addRoom(!1,"Room "+t);this.addRoom(!1,a),this.isStation&&this.addRoom(!0,this.userID)}},{key:"toJSON",value:function(e){return e||(e=this.doc),{rooms:this.filterTombstones((0,o.clone)(e.rooms)),users:this.filterTombstones((0,o.clone)(e.users))}}},{key:"filterTombstones",value:function(e){var t={};for(var n in e)e[n].tombstone||(t[n]=e[n],delete t[n].tombstone,delete t[n].timestamp);return t}},{key:"getUsers",value:function(){return this.filterTombstones(this.doc.users)}},{key:"getUsersInRoom",value:function(e){var t=this.doc.getMap("users").toJSON(),n=[];for(var r in t)t[r].room===e&&n.push(r);return n}},{key:"addRoom",value:function(e,t){if(t)this.doc.rooms[t]={studentPublicState:"",teacherPublicState:"",teacherPrivateState:"",timestamp:e?Date.now():0,tombstone:!1},this.update(e);else{var n=Object.keys(this.doc.rooms).filter(function(e){return e.match(/Room/)}).map(function(e){return e.split(" ")[1]}).map(function(e){return parseInt(e)}).sort(),r=1,i=!0,o=!1,a=void 0;try{for(var l,u=n[Symbol.iterator]();!(i=(l=u.next()).done)&&l.value===r;i=!0)r++}catch(e){o=!0,a=e}finally{try{i||null==u.return||u.return()}finally{if(o)throw a}}return this.addRoom(!0,"Room "+r)}}},{key:"gotoRoom",value:function(e){this.isRoomAlive(e)?this.userSettings.room=e:this.userSettings.room=a,this.userSettings.timestamp=Date.now(),this.userSettings.tombstone=!1,this.doc.users[this.userID]=this.userSettings,this.update(!0)}},{key:"isRoomAlive",value:function(e){return this.doc.rooms[e]&&!this.doc.rooms[e].tombstone}},{key:"isUserAlive",value:function(e){return this.doc.users[e]&&!this.doc.users[e].tombstone}},{key:"encode",value:function(){return(0,o.clone)(this.doc)}},{key:"update",value:function(){var e=!(arguments.length>0)||void 0===arguments[0]||arguments[0];this.callback&&this.callback(e)}},{key:"merge",value:function(e){var t,n=this.doc.rooms,r=this.doc.users;for(var i in e.rooms)n[i]?n[i].timestamp1&&void 0!==arguments[1]&&arguments[1];this.doc.users[e].tombstone=!0,this.doc.users[e].timestamp=Date.now(),e.startsWith(l)&&this.isRoomAlive(e)&&this.removeRoom(e),t&&this.update(!0)}},{key:"removeRoom",value:function(e){for(var t in this.doc.rooms[e].tombstone=!0,this.doc.rooms[e].timestamp=Date.now(),e.startsWith(l)&&this.isUserAlive(e)&&this.removeUser(e),this.doc.users)this.isUserAlive(t)&&this.doc.users[t].room===e&&(this.doc.users[t].room=a,this.doc.users[t].timestamp=Date.now())}},{key:"heartBeat",value:function(){var e=Date.now();this.userSettings.timestamp=e,this.userSettings.tombstone=!1,this.doc.users[this.userID]=this.userSettings;var t=[];for(var n in this.doc.users)this.isUserAlive(n)&&(this.doc.users[n].timestamp||0)+6e51&&void 0!==arguments[1]?arguments[1]:0;this.userSettings.role=e,this.userID.startsWith(l)&&(this.isStation=!0),this.initUser(),this.initRooms(t),this.heartbeatID&&clearInterval(this.heartbeatID);var n=this;this.heartbeatID=setInterval(function(){n.heartBeat()},1e5)}},{key:"initUser",value:function(){this.userSettings.displayName=this.userID,this.userSettings.room=this.isStation?this.userID:a,this.userSettings.dateJoined=Date.now(),this.userSettings.timestamp=Date.now(),this.userSettings.tombstone=!1,this.doc.users[this.userID]=this.userSettings}},{// basic initialize rooms configuration +key:"initRooms",value:function(e){for(var t=1;t<=e;t++)this.addRoom(!1,"Room "+t);this.addRoom(!1,a),this.isStation&&this.addRoom(!0,this.userID)}},{key:"toJSON",value:function(e){return e||(e=this.doc),{rooms:this.filterTombstones((0,o.clone)(e.rooms)),users:this.filterTombstones((0,o.clone)(e.users))}}},{key:"filterTombstones",value:function(e){var t={};for(var n in e)e[n].tombstone||(t[n]=e[n],delete t[n].tombstone,delete t[n].timestamp);return t}},{key:"getUsers",value:function(){return this.filterTombstones(this.doc.users)}},{key:"getUsersInRoom",value:function(e){var t=this.doc.getMap("users").toJSON(),n=[];for(var r in t)t[r].room===e&&n.push(r);return n}},{key:"addRoom",value:function(e,t){if(t)this.doc.rooms[t]={studentPublicState:"",teacherPublicState:"",teacherPrivateState:"",timestamp:e?Date.now():0,tombstone:!1},this.update(e);else{var n=Object.keys(this.doc.rooms).filter(function(e){return e.match(/Room/)}).map(function(e){return e.split(" ")[1]}).map(function(e){return parseInt(e)}).sort(),r=1,i=!0,o=!1,a=void 0;try{for(var l,u=n[Symbol.iterator]();!(i=(l=u.next()).done)&&l.value===r;i=!0)r++}catch(e){o=!0,a=e}finally{try{i||null==u.return||u.return()}finally{if(o)throw a}}return this.addRoom(!0,"Room "+r)}}},{key:"gotoRoom",value:function(e){this.isRoomAlive(e)?this.userSettings.room=e:this.userSettings.room=a,this.userSettings.timestamp=Date.now(),this.userSettings.tombstone=!1,this.doc.users[this.userID]=this.userSettings,this.update(!0)}},{key:"isRoomAlive",value:function(e){return this.doc.rooms[e]&&!this.doc.rooms[e].tombstone}},{key:"isUserAlive",value:function(e){return this.doc.users[e]&&!this.doc.users[e].tombstone}},{key:"encode",value:function(){return(0,o.clone)(this.doc)}},{key:"update",value:function(){var e=!(arguments.length>0)||void 0===arguments[0]||arguments[0];this.callback&&this.callback(e)}},{key:"merge",value:function(e){var t,n=this.doc.rooms,r=this.doc.users;for(var i in e.rooms)n[i]?n[i].timestamp1&&void 0!==arguments[1]&&arguments[1];this.doc.users[e].tombstone=!0,this.doc.users[e].timestamp=Date.now(),e.startsWith(l)&&this.isRoomAlive(e)&&this.removeRoom(e),t&&this.update(!0)}},{key:"removeRoom",value:function(e){for(var t in this.doc.rooms[e].tombstone=!0,this.doc.rooms[e].timestamp=Date.now(),e.startsWith(l)&&this.isUserAlive(e)&&this.removeUser(e),this.doc.users)this.isUserAlive(t)&&this.doc.users[t].room===e&&(this.doc.users[t].room=a,this.doc.users[t].timestamp=Date.now())}},{key:"heartBeat",value:function(){var e=Date.now();this.userSettings.timestamp=e,this.userSettings.tombstone=!1,this.doc.users[this.userID]=this.userSettings;var t=[];for(var n in this.doc.users)this.isUserAlive(n)&&(this.doc.users[n].timestamp||0)+6e6>2]|0;l=r[t+324>>2]|0;u=r[t+328>>2]|0;d=r[t+332>>2]|0;p=r[t+336>>2]|0;for(n=0;(n|0)<(e|0);n=n+64|0){a=o;s=l;c=u;f=d;h=p;for(i=0;(i|0)<64;i=i+4|0){g=r[n+i>>2]|0;m=((o<<5|o>>>27)+(l&u|~l&d)|0)+((g+p|0)+1518500249|0)|0;p=d;d=u;u=l<<30|l>>>2;l=o;o=m;r[e+i>>2]=g}for(i=e+64|0;(i|0)<(e+80|0);i=i+4|0){g=(r[i-12>>2]^r[i-32>>2]^r[i-56>>2]^r[i-64>>2])<<1|(r[i-12>>2]^r[i-32>>2]^r[i-56>>2]^r[i-64>>2])>>>31;m=((o<<5|o>>>27)+(l&u|~l&d)|0)+((g+p|0)+1518500249|0)|0;p=d;d=u;u=l<<30|l>>>2;l=o;o=m;r[i>>2]=g}for(i=e+80|0;(i|0)<(e+160|0);i=i+4|0){g=(r[i-12>>2]^r[i-32>>2]^r[i-56>>2]^r[i-64>>2])<<1|(r[i-12>>2]^r[i-32>>2]^r[i-56>>2]^r[i-64>>2])>>>31;m=((o<<5|o>>>27)+(l^u^d)|0)+((g+p|0)+1859775393|0)|0;p=d;d=u;u=l<<30|l>>>2;l=o;o=m;r[i>>2]=g}for(i=e+160|0;(i|0)<(e+240|0);i=i+4|0){g=(r[i-12>>2]^r[i-32>>2]^r[i-56>>2]^r[i-64>>2])<<1|(r[i-12>>2]^r[i-32>>2]^r[i-56>>2]^r[i-64>>2])>>>31;m=((o<<5|o>>>27)+(l&u|l&d|u&d)|0)+((g+p|0)-1894007588|0)|0;p=d;d=u;u=l<<30|l>>>2;l=o;o=m;r[i>>2]=g}for(i=e+240|0;(i|0)<(e+320|0);i=i+4|0){g=(r[i-12>>2]^r[i-32>>2]^r[i-56>>2]^r[i-64>>2])<<1|(r[i-12>>2]^r[i-32>>2]^r[i-56>>2]^r[i-64>>2])>>>31;m=((o<<5|o>>>27)+(l^u^d)|0)+((g+p|0)-899497514|0)|0;p=d;d=u;u=l<<30|l>>>2;l=o;o=m;r[i>>2]=g}o=o+a|0;l=l+s|0;u=u+c|0;d=d+f|0;p=p+h|0}r[t+320>>2]=o;r[t+324>>2]=l;r[t+328>>2]=u;r[t+332>>2]=d;r[t+336>>2]=p}return{hash:i}};/***/},/* 6 *//***/function(e,t){var n=this,r=void 0;"undefined"!=typeof self&&void 0!==self.FileReaderSync&&(r=new self.FileReaderSync);// Convert a binary string and write it to the heap. // A binary string is expected to only contain char codes < 256. var i=function(e,t,n,r,i,o){var a=void 0,l=o%4,s=(i+l)%4,u=i-s;switch(l){case 0:t[o]=e.charCodeAt(r+3);case 1:t[o+1-(l<<1)|0]=e.charCodeAt(r+2);case 2:t[o+2-(l<<1)|0]=e.charCodeAt(r+1);case 3:t[o+3-(l<<1)|0]=e.charCodeAt(r)}if(!(i>2]=e.charCodeAt(r+a)<<24|e.charCodeAt(r+a+1)<<16|e.charCodeAt(r+a+2)<<8|e.charCodeAt(r+a+3);switch(s){case 3:t[o+u+1|0]=e.charCodeAt(r+u+2);case 2:t[o+u+2|0]=e.charCodeAt(r+u+1);case 1:t[o+u+3|0]=e.charCodeAt(r+u)}}},o=function(e,t,n,r,i,o){var a=void 0,l=o%4,s=(i+l)%4,u=i-s;switch(l){case 0:t[o]=e[r+3];case 1:t[o+1-(l<<1)|0]=e[r+2];case 2:t[o+2-(l<<1)|0]=e[r+1];case 3:t[o+3-(l<<1)|0]=e[r]}if(!(i>2|0]=e[r+a]<<24|e[r+a+1]<<16|e[r+a+2]<<8|e[r+a+3];switch(s){case 3:t[o+u+1|0]=e[r+u+2];case 2:t[o+u+2|0]=e[r+u+1];case 1:t[o+u+3|0]=e[r+u]}}},a=function(e,t,n,i,o,a){var l=void 0,s=a%4,u=(o+s)%4,c=o-u,d=new Uint8Array(r.readAsArrayBuffer(e.slice(i,i+o)));switch(s){case 0:t[a]=d[3];case 1:t[a+1-(s<<1)|0]=d[2];case 2:t[a+2-(s<<1)|0]=d[1];case 3:t[a+3-(s<<1)|0]=d[0]}if(!(o>2|0]=d[l]<<24|d[l+1]<<16|d[l+2]<<8|d[l+3];switch(u){case 3:t[a+c+1|0]=d[c+2];case 2:t[a+c+2|0]=d[c+1];case 1:t[a+c+3|0]=d[c]}}};e.exports=function(e,t,r,l,s,u){if("string"==typeof e)return i(e,t,r,l,s,u);if(e instanceof Array||n&&n.Buffer&&n.Buffer.isBuffer(e))return o(e,t,r,l,s,u);if(e instanceof ArrayBuffer)return o(new Uint8Array(e),t,r,l,s,u);if(e.buffer instanceof ArrayBuffer)return o(new Uint8Array(e.buffer,e.byteOffset,e.byteLength),t,r,l,s,u);if(e instanceof Blob)return a(e,t,r,l,s,u);throw Error("Unsupported data type.")};/***/},/* 7 *//***/function(e,t,n){var r=function(){function e(e,t){for(var n=0;n cb -,n.onmessage=function(e){let t=e.data.id,n=i[t];delete i[t],null!=e.data.error?n(Error("Rusha worker error: "+e.data.error)):n(null,e.data.hash)}),i[r]=t,n.postMessage({id:r,data:e}),r+=1}}),d.register("fN8HE",function(e,t){r(e.exports,"default",function(){return a});var n=d("74PtA");let i="Lobby",o="Station";class a{init(e,t=0){this.userSettings.role=e,this.userID.startsWith(o)&&(this.isStation=!0),this.initUser(),this.initRooms(t),this.heartbeatID&&clearInterval(this.heartbeatID);let n=this;this.heartbeatID=setInterval(()=>{n.heartBeat()},1e4)}initUser(){this.userSettings.displayName=this.userID,this.userSettings.room=this.isStation?this.userID:i,this.userSettings.dateJoined=Date.now(),this.userSettings.timestamp=Date.now(),this.userSettings.tombstone=!1,this.doc.users[this.userID]=this.userSettings}// basic initialize rooms configuration -initRooms(e){for(let t=1;t<=e;t++)this.addRoom(!1,"Room "+t);this.addRoom(!1,i),this.isStation&&this.addRoom(!0,this.userID)}toJSON(e){return e||(e=this.doc),{rooms:this.filterTombstones((0,n.clone)(e.rooms)),users:this.filterTombstones((0,n.clone)(e.users))}}filterTombstones(e){let t={};for(let n in e)e[n].tombstone||(t[n]=e[n],delete t[n].tombstone,delete t[n].timestamp);return t}getUsers(){return this.filterTombstones(this.doc.users)}getUsersInRoom(e){let t=this.doc.getMap("users").toJSON(),n=[];for(let r in t)t[r].room===e&&n.push(r);return n}addRoom(e,t){if(t)this.doc.rooms[t]={studentPublicState:"",teacherPublicState:"",teacherPrivateState:"",timestamp:e?Date.now():0,tombstone:!1},this.update(e);else{let e=Object.keys(this.doc.rooms).filter(e=>e.match(/Room/)).map(e=>e.split(" ")[1]).map(e=>parseInt(e)).sort(),t=1;for(let n of e){if(n!==t)break;t++}return this.addRoom(!0,"Room "+t)}}gotoRoom(e){this.isRoomAlive(e)?this.userSettings.room=e:this.userSettings.room=i,this.userSettings.timestamp=Date.now(),this.userSettings.tombstone=!1,this.doc.users[this.userID]=this.userSettings,this.update(!0)}isRoomAlive(e){return this.doc.rooms[e]&&!this.doc.rooms[e].tombstone}isUserAlive(e){return this.doc.users[e]&&!this.doc.users[e].tombstone}encode(){return(0,n.clone)(this.doc)}update(e=!0){this.callback&&this.callback(e)}merge(e){let t=this.doc.rooms,r=this.doc.users;for(let n in e.rooms)t[n]?t[n].timestamp{n.heartBeat()},1e5)}initUser(){this.userSettings.displayName=this.userID,this.userSettings.room=this.isStation?this.userID:i,this.userSettings.dateJoined=Date.now(),this.userSettings.timestamp=Date.now(),this.userSettings.tombstone=!1,this.doc.users[this.userID]=this.userSettings}// basic initialize rooms configuration +initRooms(e){for(let t=1;t<=e;t++)this.addRoom(!1,"Room "+t);this.addRoom(!1,i),this.isStation&&this.addRoom(!0,this.userID)}toJSON(e){return e||(e=this.doc),{rooms:this.filterTombstones((0,n.clone)(e.rooms)),users:this.filterTombstones((0,n.clone)(e.users))}}filterTombstones(e){let t={};for(let n in e)e[n].tombstone||(t[n]=e[n],delete t[n].tombstone,delete t[n].timestamp);return t}getUsers(){return this.filterTombstones(this.doc.users)}getUsersInRoom(e){let t=this.doc.getMap("users").toJSON(),n=[];for(let r in t)t[r].room===e&&n.push(r);return n}addRoom(e,t){if(t)this.doc.rooms[t]={studentPublicState:"",teacherPublicState:"",teacherPrivateState:"",timestamp:e?Date.now():0,tombstone:!1},this.update(e);else{let e=Object.keys(this.doc.rooms).filter(e=>e.match(/Room/)).map(e=>e.split(" ")[1]).map(e=>parseInt(e)).sort(),t=1;for(let n of e){if(n!==t)break;t++}return this.addRoom(!0,"Room "+t)}}gotoRoom(e){this.isRoomAlive(e)?this.userSettings.room=e:this.userSettings.room=i,this.userSettings.timestamp=Date.now(),this.userSettings.tombstone=!1,this.doc.users[this.userID]=this.userSettings,this.update(!0)}isRoomAlive(e){return this.doc.rooms[e]&&!this.doc.rooms[e].tombstone}isUserAlive(e){return this.doc.users[e]&&!this.doc.users[e].tombstone}encode(){return(0,n.clone)(this.doc)}update(e=!0){this.callback&&this.callback(e)}merge(e){let t=this.doc.rooms,r=this.doc.users;for(let n in e.rooms)t[n]?t[n].timestampEdrys - Lite \ No newline at end of file +Edrys - Lite \ No newline at end of file