!functiont(e,n,r){functioni(s,u){if(!n[s]){if(!e[s]){varl="function"==typeofrequire&&require;if(!u&&l)returnl(s,!0);if(o)returno(s,!0);thrownewError("Cannot find module '"+s+"'")}varp=n[s]={exports:{}};e[s][0].call(p.exports,function(t){varn=e[s][1][t];returni(n?n:t)},p,p.exports,t,e,n,r)}returnn[s].exports}for(varo="function"==typeofrequire&&require,s=0;s<r.length;s++)i(r[s]);returni}({1:[function(t,e){varn,r;n=t("./ConnectorClass"),r=function(t,e,r,i){varo,s,u,l,p,c,a,h;for(cinn)u=n[c],t[c]=u;returnt.setIsBoundToY(),h=function(e){returne.uid.creator===r.getUserId()&&"string"!=typeofe.uid.op_number&&"_temp"!==r.getUserId()?t.broadcast(e):void0},null!=t.invokeSync&&r.setInvokeSyncHandler(t.invokeSync),i.push(h),s=function(t){vare,n;n=[];for(cint)e=t[c],n.push({user:c,state:e});returnn},a=function(t){vare,n,r,i;for(n={},r=0,i=t.length;i>r;r++)e=t[r],n[e.user]=e.state;returnn},p=function(){returns(r.getOperationCounter())},l=function(t){vare,n,i;returni=a(t),e=r._encode(i),n={hb:e,state_vector:s(r.getOperationCounter())}},o=function(t,n){returne.applyOp(t,n)},t.getStateVector=p,t.getHB=l,t.applyHB=o,null==t.receive_handlers&&(t.receive_handlers=[]),t.receive_handlers.push(function(t,n){returnn.uid.creator!==r.getUserId()?e.applyOp(n):void0})},e.exports=r},{"./ConnectorClass":2}],2:[function(t,e){e.exports={init:function(t){vare;returne=function(e){returnfunction(n,r){if(null!=t[n]){if(null==r||r.some(function(e){returne===t[n]}))returne[n]=t[n];thrownewError("You can set the '"+n+"' option to one of the following choices: "+JSON.encode(r))}thrownewError("You must specify "+n+", when initializing the Connector!")}}(this),e("syncMethod",["syncAll","master-slave"]),e("role",["master","slave"]),e("user_id"),"function"==typeofthis.on_user_id_set&&this.on_user_id_set(this.user_id),this.perform_send_again=null!=t.perform_send_again?t.perform_send_again:!0,"master"===this.role&&(this.syncMethod="syncAll"),this.is_synced=!1,this.connections={},null==this.receive_handlers&&(this.receive_handlers=[]),this.connections={},this.current_sync_target=null,this.sent_hb_to_all_users=!1,this.is_initialized=!0},onUserEvent:function(t){returnnull==this.connections_listeners&&(this.connections_listeners=[]),this.connections_listeners.push(t)},isRoleMaster:function(){return"master"===this.role},isRoleSlave:function(){return"slave"===this.role},findNewSyncTarget:function(){vart,e,n;if(this.current_sync_target=null,"syncAll"===this.syncMethod){n=this.connections;for(einn)if(t=n[e],!t.is_synced){this.performSync(e);break}}returnnull==this.current_sync_target&&this.setStateSynced(),null},userLeft:function(t){vare,n,r,i,o;if(deletethis.connections[t],this.findNewSyncTarget(),null!=this.connections_listeners){for(i=this.connections_listeners,o=[],n=0,r=i.length;r>n;n++)e=i[n],o.push(e({action:"userLeft",user:t}));returno}},userJoined:function(t,e){varn,r,i,o,s,u;if(null==e)thrownewError("Internal: You must specify the role of the joined user! E.g. userJoined('uid:3939','slave')");if(null==(r=this.connections)[t]&&(r[t]={}),this.connections[t].is_synced=!1,this.is_synced&&"syncAll"!==this.syncMethod||("syncAll"===this.syncMethod?this.performSync(t):"master"===e&&this.performSyncWithMaster(t)),null!=this.connections_listeners){for(s=this.connections_listeners,u=[],i=0,o=s.length;o>i;i++)n=s[i],u.push(n({action:"userJoined",user:t,role:e}));returnu}},whenSynced:function(t){returnt.constructore===Function&&(t=[t]),this.is_synced?t[0].apply(this,t.slice(1)):(null==this.compute_when_synced&&(this.compute_when_synced=[]),this.compute_when_synced.push(t))},onReceive:function(t){returnthis.receive_handlers.push(t)},performSync:function(t){vare,n,r,i,o;if(null==this.current_sync_target&&(this.current_sync_target=t,this.send(t,{sync_step:"getHB",send_again:"true",data:[]}),!this.sent_hb_to_all_users)){for(this.sent_hb_to_all_users=!0,e=this.getHB([]).hb,r=[],i=0,o=e.length;o>i;i++)n=e[i],r.push(n),r.length>10&&(this.broadcast({sync_step:"applyHB_",data:r}),r=[]);returnthis.broadcast({sync_step:"applyHB