"use strict";(self.webpackChunk_jupyter_collaboration_extension=self.webpackChunk_jupyter_collaboration_extension||[]).push([[784],{7198(t,e,s){s.d(e,{HT:()=>n,cy:()=>a});const n=Array.from,a=Array.isArray},6527(t,e,s){s.d(e,{EK:()=>o,vo:()=>r});var n=s(7198),a=s(6132);const r=(t,e)=>{if(null==t||null==e)return((t,e)=>t===e)(t,e);if(t.constructor!==e.constructor)return!1;if(t===e)return!0;switch(t.constructor){case ArrayBuffer:t=new Uint8Array(t),e=new Uint8Array(e);case Uint8Array:if(t.byteLength!==e.byteLength)return!1;for(let s=0;s<t.length;s++)if(t[s]!==e[s])return!1;break;case Set:if(t.size!==e.size)return!1;for(const s of t)if(!e.has(s))return!1;break;case Map:if(t.size!==e.size)return!1;for(const s of t.keys())if(!e.has(s)||!r(t.get(s),e.get(s)))return!1;break;case Object:if(a.Bw(t)!==a.Bw(e))return!1;for(const s in t)if(!a.i5(t,s)||!r(t[s],e[s]))return!1;break;case Array:if(t.length!==e.length)return!1;for(let s=0;s<t.length;s++)if(!r(t[s],e[s]))return!1;break;default:return!1}return!0},o=(t,e)=>e.includes(t);n.cy},6505(t,e,s){s.d(e,{_4:()=>a,vt:()=>n});const n=()=>new Map,a=(t,e,s)=>{let n=t.get(e);return void 0===n&&t.set(e,n=s()),n}},6132(t,e,s){s.d(e,{Bw:()=>r,Tj:()=>a,i5:()=>o}),Object.assign;const n=Object.keys,a=(t,e)=>{const s=[];for(const n in t)s.push(e(t[n],n));return s},r=t=>n(t).length,o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);Object.freeze},1370(t,e,s){s.d(e,{c:()=>o});var n=s(6505),a=s(9279),r=s(7198);class o{constructor(){this._observers=n.vt()}on(t,e){n._4(this._observers,t,a.vt).add(e)}once(t,e){const s=(...n)=>{this.off(t,s),e(...n)};this.on(t,s)}off(t,e){const s=this._observers.get(t);void 0!==s&&(s.delete(e),0===s.size&&this._observers.delete(t))}emit(t,e){return r.HT((this._observers.get(t)||n.vt()).values()).forEach(t=>t(...e))}destroy(){this._observers=n.vt()}}},9279(t,e,s){s.d(e,{vt:()=>n});const n=()=>new Set},482(t,e,s){s.d(e,{_g:()=>n});const n=Date.now},7784(t,e,s){s.d(e,{X3:()=>d,_g:()=>h,tQ:()=>u,ww:()=>i});var n=s(6214),a=s(3721),r=s(482),o=s(801),l=s(1370),c=s(6527);s(2206);class i extends l.c{constructor(t){super(),this.doc=t,this.clientID=t.clientID,this.states=new Map,this.meta=new Map,this._checkInterval=setInterval(()=>{const t=r._g();null!==this.getLocalState()&&15e3<=t-this.meta.get(this.clientID).lastUpdated&&this.setLocalState(this.getLocalState());const e=[];this.meta.forEach((s,n)=>{n!==this.clientID&&3e4<=t-s.lastUpdated&&this.states.has(n)&&e.push(n)}),e.length>0&&h(this,e,"timeout")},o.RI(3e3)),t.on("destroy",()=>{this.destroy()}),this.setLocalState({})}destroy(){this.emit("destroy",[this]),this.setLocalState(null),super.destroy(),clearInterval(this._checkInterval)}getLocalState(){return this.states.get(this.clientID)||null}setLocalState(t){const e=this.clientID,s=this.meta.get(e),n=void 0===s?0:s.clock+1,a=this.states.get(e);null===t?this.states.delete(e):this.states.set(e,t),this.meta.set(e,{clock:n,lastUpdated:r._g()});const o=[],l=[],i=[],h=[];null===t?h.push(e):null==a?null!=t&&o.push(e):(l.push(e),c.vo(a,t)||i.push(e)),(o.length>0||i.length>0||h.length>0)&&this.emit("change",[{added:o,updated:i,removed:h},"local"]),this.emit("update",[{added:o,updated:l,removed:h},"local"])}setLocalStateField(t,e){const s=this.getLocalState();null!==s&&this.setLocalState({...s,[t]:e})}getStates(){return this.states}}const h=(t,e,s)=>{const n=[];for(let s=0;s<e.length;s++){const a=e[s];if(t.states.has(a)){if(t.states.delete(a),a===t.clientID){const e=t.meta.get(a);t.meta.set(a,{clock:e.clock+1,lastUpdated:r._g()})}n.push(a)}}n.length>0&&(t.emit("change",[{added:[],updated:[],removed:n},s]),t.emit("update",[{added:[],updated:[],removed:n},s]))},d=(t,e,s=t.states)=>{const a=e.length,r=n.xv();n.zd(r,a);for(let o=0;o<a;o++){const a=e[o],l=s.get(a)||null,c=t.meta.get(a).clock;n.zd(r,a),n.zd(r,c),n.Qj(r,JSON.stringify(l))}return n.Fo(r)},u=(t,e,s)=>{const n=a.$C(e),o=r._g(),l=[],i=[],h=[],d=[],u=a.cw(n);for(let e=0;e<u;e++){const e=a.cw(n);let s=a.cw(n);const r=JSON.parse(a.t3(n)),u=t.meta.get(e),g=t.states.get(e),f=void 0===u?0:u.clock;(f<s||f===s&&null===r&&t.states.has(e))&&(null===r?e===t.clientID&&null!=t.getLocalState()?s++:t.states.delete(e):t.states.set(e,r),t.meta.set(e,{clock:s,lastUpdated:o}),void 0===u&&null!==r?l.push(e):void 0!==u&&null===r?d.push(e):null!==r&&(c.vo(r,g)||h.push(e),i.push(e)))}(l.length>0||h.length>0||d.length>0)&&t.emit("change",[{added:l,updated:h,removed:d},s]),(l.length>0||i.length>0||d.length>0)&&t.emit("update",[{added:l,updated:i,removed:d},s])}}}]);