1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[205],{43781:function(t){t.exports={prettyPrint:function(t,e){var n,s,i,o,r,a;for(s=(e=e||{}).indent_size||4,i=e.indent_char||" ",r=e.brace_style||"collapse",o=0==e.max_char?1/0:e.max_char||70,a=e.unformatted||["a","span","bdo","em","strong","dfn","code","samp","kbd","var","cite","abbr","acronym","q","sub","sup","tt","i","b","big","small","u","s","strike","font","ins","del","pre","address","dt","h1","h2","h3","h4","h5","h6"],(n=new function(){return this.pos=0,this.token="",this.current_mode="CONTENT",this.tags={parent:"parent1",parentcount:1,parent1:""},this.tag_type="",this.token_text=this.last_token=this.last_text=this.token_type="",this.Utils={whitespace:"\n\r ".split(""),single_token:"br,input,link,meta,!doctype,basefont,base,area,hr,wbr,param,img,isindex,?xml,embed,?php,?,?=".split(","),extra_liners:"head,body,/html".split(","),in_array:function(t,e){for(var n=0;n<e.length;n++)if(t===e[n])return!0;return!1}},this.get_content=function(){for(var t="",e=[],n=!1;"<"!==this.input.charAt(this.pos);){if(this.pos>=this.input.length)return e.length?e.join(""):["","TK_EOF"];if(t=this.input.charAt(this.pos),this.pos++,this.line_char_count++,this.Utils.in_array(t,this.Utils.whitespace)){e.length&&(n=!0),this.line_char_count--;continue}if(n){if(this.line_char_count>=this.max_char){e.push("\n");for(var s=0;s<this.indent_level;s++)e.push(this.indent_string);this.line_char_count=0}else e.push(" "),this.line_char_count++;n=!1}e.push(t)}return e.length?e.join(""):""},this.get_contents_to=function(t){if(this.pos==this.input.length)return["","TK_EOF"];var e="",n=RegExp("</"+t+"\\s*>","igm");n.lastIndex=this.pos;var s=n.exec(this.input),i=s?s.index:this.input.length;return this.pos<i&&(e=this.input.substring(this.pos,i),this.pos=i),e},this.record_tag=function(t){this.tags[t+"count"]?this.tags[t+"count"]++:this.tags[t+"count"]=1,this.tags[t+this.tags[t+"count"]]=this.indent_level,this.tags[t+this.tags[t+"count"]+"parent"]=this.tags.parent,this.tags.parent=t+this.tags[t+"count"]},this.retrieve_tag=function(t){if(this.tags[t+"count"]){for(var e=this.tags.parent;e&&t+this.tags[t+"count"]!==e;)e=this.tags[e+"parent"];e&&(this.indent_level=this.tags[t+this.tags[t+"count"]],this.tags.parent=this.tags[e+"parent"]),delete this.tags[t+this.tags[t+"count"]+"parent"],delete this.tags[t+this.tags[t+"count"]],1==this.tags[t+"count"]?delete this.tags[t+"count"]:this.tags[t+"count"]--}},this.get_tag=function(){var t,e,n,s="",i=[],o=!1;do{if(this.pos>=this.input.length)return i.length?i.join(""):["","TK_EOF"];if(s=this.input.charAt(this.pos),this.pos++,this.line_char_count++,this.Utils.in_array(s,this.Utils.whitespace)){o=!0,this.line_char_count--;continue}"'"!==s&&'"'!==s||i[1]&&"!"===i[1]||(s+=this.get_unformatted(s),o=!0),"="===s&&(o=!1),i.length&&"="!==i[i.length-1]&&">"!==s&&o&&(this.line_char_count>=this.max_char?(this.print_newline(!1,i),this.line_char_count=0):(i.push(" "),this.line_char_count++),o=!1),"<"===s&&(e=this.pos-1),i.push(s)}while(">"!==s);var r=i.join("");t=-1!=r.indexOf(" ")?r.indexOf(" "):r.indexOf(">");var c=r.substring(1,t).toLowerCase();if("/"===r.charAt(r.length-2)||this.Utils.in_array(c,this.Utils.single_token))this.tag_type="SINGLE";else if("script"===c)this.record_tag(c),this.tag_type="SCRIPT";else if("style"===c)this.record_tag(c),this.tag_type="STYLE";else if(this.Utils.in_array(c,a)){var h=this.get_unformatted("</"+c+">",r);i.push(h),e>0&&this.Utils.in_array(this.input.charAt(e-1),this.Utils.whitespace)&&i.splice(0,0,this.input.charAt(e-1)),n=this.pos-1,this.Utils.in_array(this.input.charAt(n+1),this.Utils.whitespace)&&i.push(this.input.charAt(n+1)),this.tag_type="SINGLE"}else if("!"===c.charAt(0)){if(-1!=c.indexOf("[if")){if(-1!=r.indexOf("!IE")){var h=this.get_unformatted("-->",r);i.push(h)}this.tag_type="START"}else if(-1!=c.indexOf("[endif"))this.tag_type="END",this.unindent();else if(-1!=c.indexOf("[cdata[")){var h=this.get_unformatted("]]>",r);i.push(h),this.tag_type="SINGLE"}else{var h=this.get_unformatted("-->",r);i.push(h),this.tag_type="SINGLE"}}else"/"===c.charAt(0)?(this.retrieve_tag(c.substring(1)),this.tag_type="END"):(this.record_tag(c),this.tag_type="START"),this.Utils.in_array(c,this.Utils.extra_liners)&&this.print_newline(!0,this.output);return i.join("")},this.get_unformatted=function(t,e){if(e&&-1!=e.toLowerCase().indexOf(t))return"";var n="",s="",i=!0;do{if(this.pos>=this.input.length)break;if(n=this.input.charAt(this.pos),this.pos++,this.Utils.in_array(n,this.Utils.whitespace)){if(!i){this.line_char_count--;continue}if("\n"===n||"\r"===n){s+="\n",this.line_char_count=0;continue}}s+=n,this.line_char_count++,i=!0}while(-1==s.toLowerCase().indexOf(t));return s},this.get_token=function(){var t;if("TK_TAG_SCRIPT"===this.last_token||"TK_TAG_STYLE"===this.last_token){var e=this.last_token.substr(7);
1return"string"!=typeof(t=this.get_contents_to(e))?t:[t,"TK_"+e]}return"CONTENT"===this.current_mode?"string"!=typeof(t=this.get_content())?t:[t,"TK_CONTENT"]:"TAG"===this.current_mode?"string"!=typeof(t=this.get_tag())?t:[t,"TK_TAG_"+this.tag_type]:void 0},this.get_full_indent=function(t){return(t=this.indent_level+t||0)<1?"":Array(t+1).join(this.indent_string)},this.printer=function(t,e,n,s,i){this.input=t||"",this.output=[],this.indent_character=e,this.indent_string="",this.indent_size=n,this.brace_style=i,this.indent_level=0,this.max_char=s,this.line_char_count=0;for(var o=0;o<this.indent_size;o++)this.indent_string+=this.indent_character;this.print_newline=function(t,e){if(this.line_char_count=0,e&&e.length){if(!t)for(;this.Utils.in_array(e[e.length-1],this.Utils.whitespace);)e.pop();e.push("\n");for(var n=0;n<this.indent_level;n++)e.push(this.indent_string)}},this.print_token=function(t){this.output.push(t)},this.indent=function(){this.indent_level++},this.unindent=function(){this.indent_level>0&&this.indent_level--}},this}).printer(t,i,s,o,r);;){var c=n.get_token();if(n.token_text=c[0],n.token_type=c[1],"TK_EOF"===n.token_type)break;switch(n.token_type){case"TK_TAG_START":n.print_newline(!1,n.output),n.print_token(n.token_text),n.indent(),n.current_mode="CONTENT";break;case"TK_TAG_STYLE":case"TK_TAG_SCRIPT":n.print_newline(!1,n.output),n.print_token(n.token_text),n.current_mode="CONTENT";break;case"TK_TAG_END":if("TK_CONTENT"===n.last_token&&""===n.last_text){var h=n.token_text.match(/\w+/)[0],u=n.output[n.output.length-1].match(/<\s*(\w+)/);(null===u||u[1]!==h)&&n.print_newline(!0,n.output)}n.print_token(n.token_text),n.current_mode="CONTENT";break;case"TK_TAG_SINGLE":var l=n.token_text.match(/^\s*<([a-z]+)/i);l&&n.Utils.in_array(l[1],a)||n.print_newline(!1,n.output),n.print_token(n.token_text),n.current_mode="CONTENT";break;case"TK_CONTENT":""!==n.token_text&&n.print_token(n.token_text),n.current_mode="TAG";break;case"TK_STYLE":case"TK_SCRIPT":if(""!==n.token_text){n.output.push("\n");var d=n.token_text;if("TK_SCRIPT"==n.token_type)var p="function"==typeof js_beautify&&js_beautify;else if("TK_STYLE"==n.token_type)var p="function"==typeof css_beautify&&css_beautify;if("keep"==e.indent_scripts)var f=0;else if("separate"==e.indent_scripts)var f=-n.indent_level;else var f=1;var g=n.get_full_indent(f);if(p)d=p(d.replace(/^\s*/,g),e);else{var m=d.match(/^\s*/)[0].match(/[^\n\r]*$/)[0].split(n.indent_string).length-1,y=n.get_full_indent(f-m);d=d.replace(/^\s*/,g).replace(/\r\n|\r|\n/g,"\n"+y).replace(/\s*$/,"")}d&&(n.print_token(d),n.print_newline(!0,n.output))}n.current_mode="TAG"}n.last_token=n.token_type,n.last_text=n.token_text}return n.output.join("")}}},73487:function(t,e,n){"use strict";n.d(e,{z:function(){return i}});var s=n(2784);function i(t,e=[]){return(0,s.useEffect)(()=>()=>t(),e)}},67702:function(t,e,n){"use strict";n.d(e,{JL:function(){return p}});var s=n(69180),i=n(52780),o=n(27191),r=n(36069),a=n(38564),c=n(68053);let h=t=>{let e=document.createElement("span");e.classList.add("ProseMirror-yjs-cursor"),e.setAttribute("style",`border-color: ${t.color}`);let n=document.createElement("div");n.setAttribute("style",`background-color: ${t.color}`),n.insertBefore(document.createTextNode(t.name),null);let s=document.createTextNode("â "),i=document.createTextNode("â ");return e.insertBefore(s,null),e.insertBefore(n,null),e.insertBefore(i,null),e},u=t=>({style:`background-color: ${t.color}70`,class:"ProseMirror-yjs-selection"}),l=/^#[0-9a-fA-F]{6}$/,d=(t,e,n,o)=>{let h=a.Gt.getState(t),u=h.doc,d=[];return null!=h.snapshot||null!=h.prevSnapshot||null===h.binding?i.EH.create(t.doc,[]):(e.getStates().forEac
1h((e,a)=>{if(a!==u.clientID&&null!=e.cursor){let p=e.user||{};null==p.color?p.color="#ffa500":l.test(p.color)||console.warn("A user uses an unsupported color format",p),null==p.name&&(p.name=`User: ${a}`);let f=(0,r.SF)(u,h.type,s.og(e.cursor.anchor),h.binding.mapping),g=(0,r.SF)(u,h.type,s.og(e.cursor.head),h.binding.mapping);if(null!==f&&null!==g){let e=c.Fp(t.doc.content.size-1,0);f=c.VV(f,e),g=c.VV(g,e),d.push(i.p.widget(g,()=>n(p),{key:a+"",side:10}));let s=c.VV(f,g),r=c.Fp(f,g);d.push(i.p.inline(s,r,o(p),{inclusiveEnd:!0,inclusiveStart:!1}))}}}),i.EH.create(t.doc,d))},p=(t,{cursorBuilder:e=h,selectionBuilder:n=u,getSelection:i=t=>t.selection}={},c="cursor")=>new o.Sy({key:a.uJ,state:{init:(s,i)=>d(i,t,e,n),apply(s,i,o,r){let c=a.Gt.getState(r),h=s.getMeta(a.uJ);return c&&c.isChangeOrigin||h&&h.awarenessUpdated?d(r,t,e,n):i.map(s.mapping,s.doc)}},props:{decorations:t=>a.uJ.getState(t)},view:e=>{let n=()=>{e.docView&&(0,r.US)(e,a.uJ,{awarenessUpdated:!0})},o=()=>{let n=a.Gt.getState(e.state),o=t.getLocalState()||{};if(null!=n.binding){if(e.hasFocus()){let a=i(e.state),h=(0,r.JR)(a.anchor,n.type,n.binding.mapping),u=(0,r.JR)(a.head,n.type,n.binding.mapping);null!=o.cursor&&s.Uq(s.og(o.cursor.anchor),h)&&s.Uq(s.og(o.cursor.head),u)||t.setLocalStateField(c,{anch
1or:h,head:u})}else null!=o.cursor&&null!==(0,r.SF)(n.doc,n.type,s.og(o.cursor.anchor),n.binding.mapping)&&t.setLocalStateField(c,null)}};return t.on("change",n),e.dom.addEventListener("focusin",o),e.dom.addEventListener("focusout",o),{update:o,destroy:()=>{e.dom.removeEventListener("focusin",o),e.dom.removeEventListener("focusout",o),t.off("change",n),t.setLocalStateField(c,null)}}}})},79522:function(t,e,n){"use strict";var s,i,o,r;n.d(e,{$c:function(){return i},CL:function(){return E},NI:function(){return P},QX:function(){return I},nw:function(){return x},pi:function(){return O},rN:function(){return N}});let a=Math.floor,c=(t,e)=>t<e?t:e,h=(t,e)=>t>e?t:e,u=Number.MAX_SAFE_INTEGER,l="undefined"!=typeof TextEncoder?new TextEncoder:null,d=l?t=>l.encode(t):t=>{let e=unescape(encodeURIComponent(t)),n=e.length,s=new Uint8Array(n);for(let t=0;t<n;t++)s[t]=e.codePointAt(t);return s},p="undefined"==typeof TextDecoder?null:new TextDecoder("utf-8",{fatal:!0,ignoreBOM:!0});p&&1===p.decode(new Uint8Array).length&&(p=null);let f=(t,e)=>{let n=t.cbuf.length;t.cpos===n&&(t.bufs.push(t.cbuf),t.cbuf=new Uint8Array(2*n),t.cpos=0),t.cbuf[t.cpos++]=e},g=(t,e)=>{for(;e>127;)f(t,128|127&e),e=a(e/128);f(t,127&e)},m=new Uint8Array(3e4),y=m.length/3,b=l&&l.encodeInto?(t,e)=>{if(e.length<y){let n=l.encodeInto(e,m).written||0;g(t,n);for(let e=0;e<n;e++)f(t,m[e])}else v(t,d(e))}:(t,e)=>{let n=unescape(encodeURIComponent(e)),s=n.length;g(t,s);for(let e=0;e<s;e++)f(t,n.codePointAt(e))},w=(t,e)=>{let n=t.cbuf.length,s=t.cpos,i=c(n-s,e.length),o=e.length-i;t.cbuf.set(e.subarray(0,i),s),t.cpos+=i,o>0&&(t.bufs.push(t.cbuf),t.cbuf=new Uint8Array(h(2*n,o)),t.cbuf.set(e.subarray(i)),t.cpos=o)},v=(t,e)=>{g(t,e.byteLength),w(t,e)},_=t=>Error(t),S=_("Unexpected end of array"),k=_("Integer out of Range"),C=(t,e)=>{let n=new Uint8Array(t.arr.buffer,t.pos+t.arr.byteOffset,e);return t.pos+=e,n},A=t=>C(t,D(t)),T=t=>t.arr[t.pos++],D=t=>{let e=0,n=1,s=t.arr.length;for(;t.pos<s;){let s=t.arr[t.pos++];if(e+=(127&s)*n,n*=128,s<128)return e;if(e>u)throw k}throw S},U=p?t=>p.decode(A(t)):t=>{let e=D(t);if(0===e)return"";{let n=String.fromCodePoint(T(t));if(--e<100)for(;e--;)n+=String.fromCodePoint(T(t));else for(;e>0;){let s=e<1e4?e:1e4,i=t.arr.subarray(t.pos,t.pos+s);t.pos+=s,n+=String.fromCodePoint.apply(null,i),e-=s}return decodeURIComponent(escape(n))}};(o=s||(s={}))[o.Token=0]="Token",o[o.PermissionDenied=1]="PermissionDenied",o[o.Authenticated=2]="Authenticated";let E=(t,e)=>{g(t,s.Token),b(t,e)},x=(t,e,n)=>{switch(D(t)){case s.PermissionDenied:e(U(t));break;case s.Authenticated:n(U(t))}},O={code:1009,reason:"Message Too Big"},P={code:4401,reason:"Unauthorized"},N={code:4403,reason:"Forbidden"},I=t=>Array.from(t.entries()).map(([t,e])=>({clientId:t,...e}));(r=i||(i={}))[r.Connecting=0]="Connecting",r[r.Open=1]="Open",r[r.Closing=2]="Closing",r[r.Closed=3]="Closed"},44058:function(t,e,n){"use strict";let s;n.d(e,{Ui:function(){return t7},cA:function(){return tV}});var i,o,r,a,c,h=n(79522),u=n(69180);async function l(t){return new Promise((e,n)=>{setTimeout(e,t)})}function d(t,e){let n=e.delay;if(0===n)return 0;if(e.factor&&(n*=Math.pow(e.factor,t.attemptNum-1),0!==e.maxDelay&&(n=Math.min(n,e.maxDelay))),e.jitter){let t=Math.ceil(e.minDelay),s=Math.floor(n);n=Math.floor(Math.random()*(s-t+1))+t}return Math.round(n)}async function p(t,e){var n;let s=((n=e)||(n={}),{delay:void 0===n.delay?200:n.delay,initialDelay:void 0===n.initialDelay?0:n.initialDelay,minDelay:void 0===n.minDelay?0:n.minDelay,maxDelay:void 0===n.maxDelay?0:n.maxDelay,factor:void 0===n.factor?0:n.factor,maxAttempts:void 0===n.maxAttempts?3:n.maxAttempts,timeout:void 0===n.timeout?0:n.timeout,jitter:!0===n.jitter,handleError:void 0===n.handleError?null:n.handleError,handleTimeout:void 0===n.handleTimeout?null:n.handleTimeout,beforeAttempt:void 0===n.beforeAttempt?null:n.beforeAttempt,calculateDelay:void 0===n.calculateDelay?null:n.calculateDelay});for(let t of["delay","initialDelay","minDelay","maxDelay","maxAttempts","timeout"]){let e=s[t];if(!Number.isInteger(e)||e<0)throw Error(`Value for ${t} must be an integer greater than or equal to 0`)}if(s.factor.constructor!==Number||s.factor<0)throw Error("Value for factor must be a number greater than or equal to 0");if(s.delay<s.minDelay)throw Error(`delay cannot be less than minDelay (delay: ${s.delay}, minDelay: ${s.minDelay}`);let i={attemptNum:0,attemptsRemaining:s.maxAttempts?s.maxAttempts:-1,aborted:!1,abort(){i.aborted=!0}},o=s.calculateDelay||d;async function r(){if(s.beforeAttempt&&s.beforeAttempt(i,s),i.aborted){let t=Error("Attempt aborted");throw t.code="ATTEMPT_ABORTED",t}let e=async t=>{if(s.handleError&&await s.handleError(t,i,s),i.aborted||0===i.attemptsRemaining)throw t;i.attemptNum++;let e=o(i,s);return e&&await l(e),r()};return(i.attemptsRemaining>0&&i.attemptsRemaining--,s.timeout)?new Promise((n,o)=>{let r=setTimeout(()=>{if(s.handleTimeout)try{n(s.handleTimeout(i,s))}catch(t){o(t)}else{let t=Error(`Retry timeout (attemptNum: ${i.attemptNum}, timeout: ${s.timeout})`);t.code="ATTEMPT_TIMEOUT",o(t)}},s.timeout);t(i,s).then(t=>{clearTimeout(r),n(t)}
1).catch(t=>{clearTimeout(r),e(t).then(n).catch(o)})}):t(i,s).catch(e)}let a=s.calculateDelay?s.calculateDelay(i,s):s.initialDelay;return a&&await l(a),r()}var f=n(34406),g=n(48834).lW;let m=()=>new Map,y=(t,e,n)=>{let s=t.get(e);return void 0===s&&t.set(e,s=n()),s},b=()=>new Set,w=Array.from,v=String.fromCharCode,_=t=>t.toLowerCase(),S=/^\s*/g,k=t=>t.replace(S,""),C=/([A-Z])/g,A=(t,e)=>k(t.replace(C,t=>`${e}${_(t)}`)),T="undefined"!=typeof TextEncoder?new TextEncoder:null,D=T?t=>T.encode(t):t=>{let e=unescape(encodeURIComponent(t)),n=e.length,s=new Uint8Array(n);for(let t=0;t<n;t++)s[t]=e.codePointAt(t);return s},U="undefined"==typeof TextDecoder?null:new TextDecoder("utf-8",{fatal:!0,ignoreBOM:!0});U&&1===U.decode(new Uint8Array).length&&(U=null);let E=t=>void 0===t?null:t,x=new class{constructor(){this.map=new Map}setItem(t,e){this.map.set(t,e)}getItem(t){return this.map.get(t)}},O=!0;try{"undefined"!=typeof localStorage&&localStorage&&(x=localStorage,O=!1)}catch(t){}let P=x,N=t=>O||addEventListener("storage",t),I=t=>O||removeEventListener("storage",t),M=Object.keys,L=(t,e)=>{let n=[];for(let s in t)n.push(e(t[s],s));return n},R=t=>M(t).length,$=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),j=(t,e)=>t===e,B=(t,e)=>{if(null==t||null==e)return j(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 n=0;n<t.length;n++)if(t[n]!==e[n])return!1;break;case Set:if(t.size!==e.size)return!1;for(let n of t)if(!e.has(n))return!1;break;case Map:if(t.size!==e.size)return!1;for(let n of t.keys())if(!e.has(n)||!B(t.get(n),e.get(n)))return!1;break;case Object:if(R(t)!==R(e))return!1;for(let n in t)if(!$(t,n)||!B(t[n],e[n]))return!1;break;case Array:if(t.length!==e.length)return!1;for(let n=0;n<t.length;n++)if(!B(t[n],e[n]))return!1;break;default:return!1}return!0},V=void 0!==f&&f.release&&/node|io\.js/.test(f.release.name)&&"[object process]"===Object.prototype.toString.call(void 0!==f?f:0),F="undefined"!=typeof window&&"undefined"!=typeof document&&!V;"undefined"!=typeof navigator&&/Mac/.test(navigator.platform);let Q=()=>{if(void 0===s){if(V){s=m();let t=f.argv,e=null;for(let n=0;n<t.length;n++){let i=t[n];"-"===i[0]?(null!==e&&s.set(e,""),e=i):null!==e&&(s.set(e,i),e=null)}null!==e&&s.set(e,"")}else"object"==typeof location?(s=m(),(location.search||"?").slice(1).split("&").forEach(t=>{if(0!==t.length){let[e,n]=t.split("=");s.set(`--${A(e,"-")}`,n),s.set(`-${A(e,"-")}`,n)}})):s=m()}return s},H=t=>Q().has(t),K=t=>V?E(f.env[t.toUpperCase()]):E(P.getItem(t));H("--"+(i="production"))||K(i);let G=V&&["true","1","2"].includes(f.env.FORCE_COLOR);!H("no-colors")&&(!V||f.stdout.isTTY||G)&&(!V||H("color")||G||null!==K("COLORTERM")||(K("TERM")||"").includes("color"));let W=Math.floor,q=(t,e)=>t<e?t:e,z=(t,e)=>t>e?t:e,J=Number.MAX_SAFE_INTEGER;class Y{constructor(){this.cpos=0,this.cbuf=new Uint8Array(100),this.bufs=[]}}let X=()=>new Y,Z=t=>{let e=t.cpos;for(let n=0;n<t.bufs.length;n++)e+=t.bufs[n].length;return e},tt=t=>{let e=new Uint8Array(Z(t)),n=0;for(let s=0;s<t.bufs.length;s++){let i=t.bufs[s];e.set(i,n),n+=i.length}return e.set(new Uint8Array(t.cbuf.buffer,0,t.cpos),n),e},te=(t,e)=>{let n=t.cbuf.length;t.cpos===n&&(t.bufs.push(t.cbuf),t.cbuf=new Uint8Array(2*n),t.cpos=0),t.cbuf[t.cpos++]=e},tn=(t,e)=>{for(;e>127;)te(t,128|127&e),e=W(e/128);te(t,127&e)},ts=new Uint8Array(3e4),ti=ts.length/3,to=T&&T.encodeInto?(t,e)=>{if(e.length<ti){let n=T.encodeInto(e,ts).written||0;tn(t,n);for(let e=0;e<n;e++)te(t,ts[e])}else ta(t,D(e))}:(t,e)=>{let n=unescape(encodeURIComponent(e)),s=n.length;tn(t,s);for(let e=0;e<s;e++)te(t,n.codePointAt(e))},tr=(t,e)=>{let n=t.cbuf.length,s=t.cpos,i=q(n-s,e.length),o=e.length-i;t.cbuf.set(e.subarray(0,i),s),t.cpos+=i,o>0&&(t.bufs.push(t.cbuf),t.cbuf=new Uint8Array(z(2*n,o)),t.cbuf.set(e.subarray(i)),t.cpos=o)},ta=(t,e)=>{tn(t,e.byteLength),tr(t,e)},tc=t=>Error(t),th=tc("Unexpected end of array"),tu=tc("Integer out of Range");class tl{constructor(t){this.arr=t,this.pos=0}}let td=t=>new tl(t),tp=(t,e)=>{let n=new Uint8Array(t.arr.buffer,t.pos+t.arr.byteOffset,e);return t.pos+=e,n},tf=t=>tp(t,tm(t)),tg=t=>t.arr[t.pos++],tm=t=>{let e=0,n=1,s=t.arr.length;for(;t.pos<s;){let s=t.arr[t.pos++];
1if(e+=(127&s)*n,n*=128,s<128)return e;if(e>J)throw tu}throw th},ty=t=>{let e=t.arr[t.pos++],n=63&e,s=64,i=(64&e)>0?-1:1;if((128&e)==0)return i*n;let o=t.arr.length;for(;t.pos<o;){if(n+=(127&(e=t.arr[t.pos++]))*s,s*=128,e<128)return i*n;if(n>J)throw tu}throw th},tb=U?t=>U.decode(tf(t)):t=>{let e=tm(t);if(0===e)return"";{let n=String.fromCodePoint(tg(t));if(--e<100)for(;e--;)n+=String.fromCodePoint(tg(t));else for(;e>0;){let s=e<1e4?e:1e4,i=t.arr.subarray(t.pos,t.pos+s);t.pos+=s,n+=String.fromCodePoint.apply(null,i),e-=s}return decodeURIComponent(escape(n))}},tw=t=>{let e=t.pos,n=tb(t);return t.pos=e,n},tv=t=>new Uint8Array(t),t_=(t,e,n)=>new Uint8Array(t,e,n),tS=t=>new Uint8Array(t),tk=F?t=>{let e="";for(let n=0;n<t.byteLength;n++)e+=v(t[n]);return btoa(e)}:t=>g.from(t.buffer,t.byteOffset,t.byteLength).toString("base64"),tC=F?t=>{let e=atob(t),n=tv(e.length);for(let t=0;t<e.length;t++)n[t]=e.charCodeAt(t);return n}:t=>{let e=g.from(t,"base64");return t_(e.buffer,e.byteOffset,e.byteLength)},tA=new Map,tT="undefined"==typeof BroadcastChannel?class{constructor(t){this.room=t,this.onmessage=null,this._onChange=e=>e.key===t&&null!==this.onmessage&&this.onmessage({data:tC(e.newValue||"")}),N(this._onChange)}postMessage(t){P.setItem(this.room,tk(tS(t)))}close(){I(this._onChange)}}:BroadcastChannel,tD=t=>y(tA,t,()=>{let e=b(),n=new tT(t);return n.onmessage=t=>e.forEach(e=>e(t.data,"broadcastchannel")),{bc:n,subs:e}}),tU=(t,e)=>(tD(t).subs.add(e),e),tE=(t,e)=>{let n=tD(t),s=n.subs.delete(e);return s&&0===n.subs.size&&(n.bc.close(),tA.delete(t)),s},tx=(t,e,n=null)=>{let s=tD(t);s.bc.postMessage(e),s.subs.forEach(t=>t(e,n))},tO=()=>{let t=!0;return(e,n)=>{if(t){t=!1;try{e()}finally{t=!0}}else void 0!==n&&n()}},tP=Date.now;class tN{constructor(){this._observers=m()}on(t,e){y(this._observers,t,b).add(e)}once(t,e){let n=(...s)=>{this.off(t,n),e(...s)};this.on(t,n)}off(t,e){let n=this._observers.get(t);void 0!==n&&(n.delete(e),0===n.size&&this._observers.delete(t))}emit(t,e){return w((this._observers.get(t)||m()).values()).forEach(t=>t(...e))}destroy(){this._observers=m()}}class tI extends tN{constructor(t){super(),this.doc=t,this.clientID=t.clientID,this.states=new Map,this.meta=new Map,this._checkInterval=setInterval(()=>{let t=tP();null!==this.getLocalState()&&15e3<=t-this.meta.get(this.clientID).lastUpdated&&this.setLocalState(this.getLocalState());let e=[];this.meta.forEach((n,s)=>{s!==this.clientID&&3e4<=t-n.lastUpdated&&this.states.has(s)&&e.push(s)}),e.length>0&&tM(this,e,"timeout")},W(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){let e=this.clientID,n=this.meta.get(e),s=void 0===n?0:n.clock+1,i=this.states.get(e);null===t?this.states.delete(e):this.states.set(e,t),this.meta.set(e,{clock:s,lastUpdated:tP()});let o=[],r=[],a=[],c=[];null===t?c.push(e):null==i?null!=t&&o.push(e):(r.push(e),B(i,t)||a.push(e)),(o.length>0||a.length>0||c.length>0)&&this.emit("change",[{added:o,updated:a,removed:c},"local"]),this.emit("update",[{added:o,updated:r,removed:c},"local"])}setLocalStateField(t,e){let n=this.getLocalState();null!==n&&this.setLocalState({...n,[t]:e})}getStates(){return this.states}}let tM=(t,e,n)=>{let s=[];for(let n=0;n<e.length;n++){let i=e[n];if(t.states.has(i)){if(t.states.delete(i),i===t.clientID){let e=t.meta.get(i);t.meta.set(i,{clock:e.clock+1,lastUpdated:tP()})}s.push(i)}}s.length>0&&(t.emit("change",[{added:[],updated:[],removed:s},n]),t.emit("update",[{added:[],updated:[],removed:s},n]))},tL=(t,e,n=t.states)=>{let s=e.length,i=X();tn(i,s);for(let o=0;o<s;o++){let s=e[o],r=n.get(s)||null,a=t.meta.get(s).clock;tn(i,s),tn(i,a),to(i,JSON.stringify(r))}return tt(i)},tR=(t,e,n)=>{let s=td(e),i=tP(),o=[],r=[],a=[],c=[],h=tm(s);for(let e=0;e<h;e++){let e=tm(s),n=tm(s),h=JSON.parse(tb(s)),u=t.meta.get(e),l=t.states.get(e),d=void 0===u?0:u.clock;(d<n||d===n&&null===h&&t.states.has(e))&&(null===h?e===t.clientID&&null!=t.getLocalState()?n++:t.states.delete(e):t.states.set(e,h),t.meta.set(e,{clock:n,lastUpdated:i}),void 0===u&&null!==h?o.push(e):void 0!==u&&null===h?c.push(e):null!==h&&(B(h,l)||a.push(e),r.push(e)))}(o.length>0||a.length>0||c.length>0)&&t.emit("change",[{added:o,updated:a,removed:c},n]),(o.length>0||r.length>0||c.length>0)&&t.emit("update",[{added:o,updated:r,removed:c},n])};class t${constructor(){this.callbacks={}}on(t,e){return this.callbacks[t]||(this.callbacks[t]=[]),this.callbacks[t].push(e),this}emit(t,...e){let n=this.callbacks[t];
1return n&&n.forEach(t=>t.apply(this,e)),this}off(t,e){let n=this.callbacks[t];return n&&(e?this.callbacks[t]=n.filter(t=>t!==e):delete this.callbacks[t]),this}removeAllListeners(){this.callbacks={}}}let tj=t=>L(t,(t,e)=>`${encodeURIComponent(e)}=${encodeURIComponent(t)}`).join("&");(o=a||(a={}))[o.Sync=0]="Sync",o[o.Awareness=1]="Awareness",o[o.Auth=2]="Auth",o[o.QueryAwareness=3]="QueryAwareness",o[o.Stateless=5]="Stateless",o[o.CLOSE=7]="CLOSE",o[o.SyncStatus=8]="SyncStatus",(r=c||(c={})).Connecting="connecting",r.Connected="connected",r.Disconnected="disconnected";class tB{constructor(t){this.data=t,this.encoder=X(),this.decoder=td(new Uint8Array(this.data))}peekVarString(){return tw(this.decoder)}readVarUint(){return tm(this.decoder)}readVarString(){return tb(this.decoder)}readVarUint8Array(){return tf(this.decoder)}writeVarUint(t){return tn(this.encoder,t)}writeVarString(t){return to(this.encoder,t)}writeVarUint8Array(t){return ta(this.encoder,t)}length(){return Z(this.encoder)}}class tV extends t${constructor(t){if(super(),this.messageQueue=[],this.configuration={url:"",document:void 0,WebSocketPolyfill:void 0,parameters:{},connect:!0,broadcast:!0,forceSyncInterval:!1,messageReconnectTimeout:3e4,delay:1e3,initialDelay:0,factor:2,maxAttempts:0,minDelay:1e3,maxDelay:3e4,jitter:!0,timeout:0,onOpen:()=>null,onConnect:()=>null,onMessage:()=>null,onOutgoingMessage:()=>null,onStatus:()=>null,onDisconnect:()=>null,onClose:()=>null,onDestroy:()=>null,onAwarenessUpdate:()=>null,onAwarenessChange:()=>null,quiet:!1,providerMap:new Map},this.webSocket=null,this.webSocketHandlers={},this.shouldConnect=!0,this.status=c.Disconnected,this.lastMessageReceived=0,this.identifier=0,this.intervals={forceSync:null,connectionChecker:null},this.connectionAttempt=null,this.receivedOnOpenPayload=void 0,this.receivedOnStatusPayload=void 0,this.closeTries=0,this.setConfiguration(t),this.configuration.WebSocketPolyfill=t.WebSocketPolyfill?t.WebSocketPolyfill:WebSocket,this.on("open",this.configuration.onOpen),this.on("open",this.onOpen.bind(this)),this.on("connect",this.configuration.onConnect),this.on("message",this.configuration.onMessage),this.on("outgoingMessage",this.configuration.onOutgoingMessage),this.on("status",this.configuration.onStatus),this.on("status",this.onStatus.bind(this)),this.on("disconnect",this.configuration.onDisconnect),this.on("close",this.configuration.onClose),this.on("destroy",this.configuration.onDestroy),this.on("awarenessUpdate",this.configuration.onAwarenessUpdate),this.on("awarenessChange",this.configuration.onAwarenessChange),this.on("close",this.onClose.bind(this)),this.on("message",this.onMessage.bind(this)),this.intervals.connectionChecker=setInterval(this.checkConnection.bind(this),this.configuration.messageReconnectTimeout/10),void 0!==t.connect&&(this.shouldConnect=t.connect),!this.shouldConnect)return;this.connect()}async onOpen(t){this.receivedOnOpenPayload=t}async onStatus(t){this.receivedOnStatusPayload=t}attach(t){let e;return this.configuration.providerMap.set(t.configuration.name,t),this.status===c.Disconnected&&this.shouldConnect&&(e=this.connect()),this.receivedOnOpenPayload&&t.onOpen(this.receivedOnOpenPayload),this.receivedOnStatusPayload&&t.onStatus(this.receivedOnStatusPayload),e}detach(t){this.configuration.providerMap.delete(t.configuration.name)}setConfiguration(t={}){this.configuration={...this.configuration,...t}}async connect(){if(this.status===c.Connected)return;this.cancelWebsocketRetry&&(this.cancelWebsocketRetry(),this.cancelWebsocketRetry=void 0),this.receivedOnOpenPayload=void 0,this.receivedOnStatusPayload=void 0,this.shouldConnect=!0;let{retryPromise:t,cancelFunc:e}=(()=>{let t=!1,e=p(this.createWebSocketConnection.bind(this),{delay:this.configuration.delay,initialDelay:this.configuration.initialDelay,factor:this.configuration.factor,maxAttempts:this.configuration.maxAttempts,minDelay:this.configuration.minDelay,maxDelay:this.configuration.maxDelay,jitter:this.configuration.jitter,timeout:this.configuration.timeout,beforeAttempt:e=>{(!this.shouldConnect||t)&&e.abort()}}).catch(t=>{if(t&&"ATTEMPT_ABORTED"!==t.code)throw t});return{retryPromise:e,cancelFunc:()=>{t=!0}}})();return this.cancelWebsocketRetry=e,t}attachWebSocketListeners(t,e){let{identifier:n}=t;this.webSocketHandlers[n]={message:t=>
1this.emit("message",t),close:t=>this.emit("close",{event:t}),open:t=>this.emit("open",t),error:t=>{e(t)}};let s=this.webSocketHandlers[t.identifier];Object.keys(s).forEach(e=>{t.addEventListener(e,s[e])})}cleanupWebSocket(){if(!this.webSocket)return;let{identifier:t}=this.webSocket,e=this.webSocketHandlers[t];Object.keys(e).forEach(n=>{var s;null===(s=this.webSocket)||void 0===s||s.removeEventListener(n,e[n]),delete this.webSocketHandlers[t]}),this.webSocket.close(),this.webSocket=null}createWebSocketConnection(){return new Promise((t,e)=>{this.webSocket&&(this.messageQueue=[],this.cleanupWebSocket()),this.lastMessageReceived=0,this.identifier+=1;let n=new this.configuration.WebSocketPolyfill(this.url);n.binaryType="arraybuffer",n.identifier=this.identifier,this.attachWebSocketListeners(n,e),this.webSocket=n,this.status=c.Connecting,this.emit("status",{status:c.Connecting}),this.connectionAttempt={resolve:t,reject:e}})}onMessage(t){var e;this.resolveConnectionAttempt(),this.lastMessageReceived=tP();let n=new tB(t.data),s=n.peekVarString();null===(e=this.configuration.providerMap.get(s))||void 0===e||e.onMessage(t)}resolveConnectionAttempt(){this.connectionAttempt&&(this.connectionAttempt.resolve(),this.connectionAttempt=null,this.status=c.Connected,this.emit("status",{status:c.Connected}),this.emit("connect"),this.messageQueue.forEach(t=>this.send(t)),this.messageQueue=[])}stopConnectionAttempt(){this.connectionAttempt=null}rejectConnectionAttempt(){var t;null===(t=this.connectionAttempt)||void 0===t||t.reject(),this.connectionAttempt=null}checkConnection(){var t;this.status!==c.Connected||!this.lastMessageReceived||this.configuration.messageReconnectTimeout>=tP()-this.lastMessageReceived||(this.closeTries+=1,this.closeTries>2?(this.onClose({event:{code:4408,reason:"forced"}}),this.closeTries=0):(null===(t=this.webSocket)||void 0===t||t.close(),this.messageQueue=[]))}get serverUrl(){for(;"/"===this.configuration.url[this.configuration.url.length-1];)return this.configuration.url.slice(0,this.configuration.url.length-1);return this.configuration.url}get url(){let t=tj(this.configuration.parameters);return`${this.serverUrl}${0===t.length?"":`?${t}`}`}disconnect(){if(this.shouldConnect=!1,null!==this.webSocket)try{this.webSocket.close(),this.messageQueue=[]}catch{}}send(t){var e;(null===(e=this.webSocket)||void 0===e?void 0:e.readyState)===h.$c.Open?this.webSocket.send(t):this.messageQueue.push(t)}onClose({event:t}){if(this.closeTries=0,this.cleanupWebSocket(),this.status===c.Connected&&(this.status=c.Disconnected,this.emit("status",{status:c.Disconnected}),this.emit("disconnect",{event:t}
1)),t.code===h.NI.code&&(t.reason===h.NI.reason?console.warn("[HocuspocusProvider] An authentication token is required, but you didnât send one. Try adding a `token` to your HocuspocusProvider configuration. Wonât try again."):console.warn(`[HocuspocusProvider] Connection closed with status Unauthorized: ${t.reason}`),this.shouldConnect=!1),t.code===h.rN.code&&!this.configuration.quiet){console.warn("[HocuspocusProvider] The provided authentication token isnât allowed to connect to this server. Will try again.");return}t.code===h.pi.code&&(console.warn(`[HocuspocusProvider] Connection closed with status MessageTooBig: ${t.reason}`),this.shouldConnect=!1),this.connectionAttempt?this.rejectConnectionAttempt():this.shouldConnect&&this.connect(),this.shouldConnect||this.status===c.Disconnected||(this.status=c.Disconnected,this.emit("status",{status:c.Disconnected}),this.emit("disconnect",{event:t}))}destroy(){this.emit("destroy"),this.intervals.forceSync&&clearInterval(this.intervals.forceSync),clearInterval(this.intervals.connectionChecker),this.stopConnectionAttempt(),this.disconnect(),this.removeAllListeners(),this.cleanupWebSocket()}}let tF=(t,e)=>{tn(t,0);let n=u.gJ(e);ta(t,n)},tQ=(t,e,n)=>{tn(t,1),ta(t,u.D$(e,n))},tH=(t,e,n)=>tQ(e,n,tf(t)),tK=(t,e,n)=>{try{u.NG(e,tf(t),n)}catch(t){console.error("Caught error while handling a Yjs update",t)}},tG=(t,e)=>{tn(t,2),ta(t,e)},tW=(t,e,n,s)=>{let i=tm(t);switch(i){case 0:tH(t,e,n);break;case 1:case 2:tK(t,n,s);break;default:throw Error("Unknown message type")}return i};class tq{constructor(){this.encoder=X()}get(t){return t.encoder}toUint8Array(){return tt(this.encoder)}}class tz{constructor(t){this.broadcasted=!1,this.message=t}setBroadcasted(t){return this.broadcasted=t,this}apply(t,e){let{message:n}=this,s=n.readVarUint(),i=n.length();switch(s){case a.Sync:this.applySyncMessage(t,e);break;case a.Awareness:this.applyAwarenessMessage(t);break;case a.Auth:this.applyAuthMessage(t);break;case a.QueryAwareness:this.applyQueryAwarenessMessage(t);break;case a.Stateless:t.receiveStateless(tb(n.decoder));break;case a.SyncStatus:this.applySyncStatusMessage(t,1===ty(n.decoder));break;default:throw Error(`Canât apply message of unknown type: ${s}`)}n.length()>i+1&&(this.broadcasted?t.broadcast(tq,{encoder:n.encoder}):t.send(tq,{encoder:n.encoder}))}applySyncMessage(t,e){let{message:n}=this;n.writeVarUint(a.Sync);let s=tW(n.decoder,n.encoder,t.document,t);e&&1===s&&(t.synced=!0)}applySyncStatusMessage(t,e){e&&t.decrementUnsyncedChanges()}applyAwarenessMessage(t){if(!t.awareness)return;let{message:e}=this;tR(t.awareness,e.readVarUint8Array(),t)}applyAuthMessage(t){let{message:e}=this;(0,h.nw)(e.decoder,t.permissionDeniedHandler.bind(t),t.authenticatedHandler.bind(t))}applyQueryAwarenessMessage(t){if(!t.awareness)return;let{message:e}=this;e.writeVarUint(a.Awareness),e.writeVarUint8Array(tL(t.awareness,Array.from(t.awareness.getStates().keys())))}}class tJ{constructor(t,e={}){this.message=new t,this.encoder=this.message.get(e)}create(){return tt(this.encoder)}send(t){null==t||t.send(this.create())}broadcast(t){tx(t,this.create())}}class tY extends tq{constructor(){super(...arguments),this.type=a.Auth,this.description="Authentication"}get(t){if(void 0===t.token)throw Error("The authentication message requires `token` as an argument.");return to(this.encoder,t.documentName),tn(this.encoder,this.type),(0,h.CL)(this.encoder,t.token),this.encoder}}class tX extends tq{constructor(){super(...arguments),this.type=a.Awareness,this.description="Awareness states update"}get(t){let e;if(void 0===t.awareness)throw Error("The awareness message requires awareness as an argument");if(void 0===t.clients)throw Error("The awareness message requires clients as an argument");return to(this.encoder,t.documentName),tn(this.encoder,this.type),e=void 0===t.states?tL(t.awareness,t.clients):tL(t.awareness,t.clients,t.states),ta(this.encoder,e),this.encoder}}class tZ extends tq{constructor(){super(...arguments),this.type=a.CLOSE,this.description="Ask the server to close the connection"}get(t){return to(this.encoder,t.documentName),tn(this.encoder,this.type),this.encoder}}class t0 extends tq{constructor(){super(...arguments),this.type=a.QueryAwareness,this.description="Queries awareness states"}get(t){return to(this.encoder,t.documentName),tn(this.encoder,this.type),this.encoder}}class t1 extends tq{constructor(){super(...arguments),this.type=a.Stateless,this.description="A stateless message"}get(t){var e;return to(this.encoder,t.documentName),tn(this.encoder,this.type),to(this.encoder,null!==(e=t.payload)&&void 0!==e?e:""),this.encoder}}class t2 extends tq{constructor(){super(...arguments),this.type=a.Sync,this.description="First sync step"}get(t){if(void 0===t.document)throw Error("The sync step one message requires document as an argument");return to(this.encoder,t.documentName),tn(this.encoder,this.type),tF(this.encoder,t.document),this.encoder}}class t8 extends tq{constructor(){super(...arguments),this.type=a.Sync,this.description="Second sync step"}get(t){if(void 0===t.document)throw Error("The sync step two message requires document as an argument");return to(this.encoder,t.documentName),tn(this.encoder,this.type),tQ(this.encoder,t.document),this.encoder}}class t4 extends tq{constructor(){super(...arguments),this.type=a.Sync,this.description="A document update"}get(t){return to(this.encoder,t.documentName),tn(this.encoder,this.type),tG(this.encoder,t.update),this.encoder}}
1class t3 extends Error{constructor(){super(...arguments),this.code=1001}}class t7 extends t${constructor(t){var e,n,s;super(),this.configuration={name:"",document:void 0,awareness:void 0,token:null,parameters:{},broadcast:!0,forceSyncInterval:!1,onAuthenticated:()=>null,onAuthenticationFailed:()=>null,onOpen:()=>null,onConnect:()=>null,onMessage:()=>null,onOutgoingMessage:()=>null,onStatus:()=>null,onSynced:()=>null,onDisconnect:()=>null,onClose:()=>null,onDestroy:()=>null,onAwarenessUpdate:()=>null,onAwarenessChange:()=>null,onStateless:()=>null,quiet:!1,connect:!0,preserveConnection:!0},this.subscribedToBroadcastChannel=!1,this.isSynced=!1,this.unsyncedChanges=0,this.status=c.Disconnected,this.isAuthenticated=!1,this.authorizedScope=void 0,this.mux=tO(),this.intervals={forceSync:null},this.isConnected=!0,this.boundBroadcastChannelSubscriber=this.broadcastChannelSubscriber.bind(this),this.boundPageUnload=this.pageUnload.bind(this),this.boundOnOpen=this.onOpen.bind(this),this.boundOnClose=this.onClose.bind(this),this.boundOnStatus=this.onStatus.bind(this),this.forwardConnect=t=>this.emit("connect",t),this.forwardOpen=t=>this.emit("open",t),this.forwardClose=t=>this.emit("close",t),this.forwardDisconnect=t=>this.emit("disconnect",t),this.forwardDestroy=t=>this.emit("destroy",t),this.setConfiguration(t),this.configuration.document=t.document?t.document:new u.QW,this.configuration.awareness=void 0!==t.awareness?t.awareness:new tI(this.document),this.on("open",this.configuration.onOpen),this.on("message",this.configuration.onMessage),this.on("outgoingMessage",this.configuration.onOutgoingMessage),this.on("synced",this.configuration.onSynced),this.on("destroy",this.configuration.onDestroy),this.on("awarenessUpdate",this.configuration.onAwarenessUpdate),this.on("awarenessChange",this.configuration.onAwarenessChange),this.on("stateless",this.configuration.onStateless),this.on("authenticated",this.configuration.onAuthenticated),this.on("authenticationFailed",this.configuration.onAuthenticationFailed),this.configuration.websocketProvider.on("connect",this.configuration.onConnect),this.configuration.websocketProvider.on("connect",this.forwardConnect),this.configuration.websocketProvider.on("open",this.boundOnOpen),this.configuration.websocketProvider.on("open",this.forwardOpen),this.configuration.websocketProvider.on("close",this.boundOnClose),this.configuration.websocketProvider.on("close",this.configuration.onClose),this.configuration.websocketProvider.on("close",this.forwardClose),this.configuration.websocketProvider.on("status",this.boundOnStatus),this.configuration.websocketProvider.on("disconnect",this.configuration.onDisconnect),this.configuration.websocketProvider.on("disconnect",this.forwardDisconnect),this.configuration.websocketProvider.on("destroy",this.configuration.onDestroy),this.configuration.websocketProvider.on("destroy",this.forwardDestroy),null===(e=this.awareness)||void 0===e||e.on("update",()=>{this.emit("awarenessUpdate",{states:(0,h.QX)(this.awareness.getStates())})}),null===(n=this.awareness)||void 0===n||n.on("change",()=>{this.emit("awarenessChange",{states:(0,h.QX)(this.awareness.getStates())})}),this.document.on("update",this.documentUpdateHandler.bind(this)),null===(s=this.awareness)||void 0===s||s.on("update",this.awarenessUpdateHandler.bind(this)),this.registerEventListeners(),this.configuration.forceSyncInterval&&(this.intervals.forceSync=setInterval(this.forceSync.bind(this),this.configuration.forceSyncInterval)),this.configuration.websocketProvider.attach(this)}onStatus({status:t}){this.status=t,this.configuration.onStatus({status:t}),this.emit("status",{status:t})}setConfiguration(t={}){!t.websocketProvider&&t.url&&(this.configuration.websocketProvider=new tV({url:t.url,connect:t.connect,parameters:t.parameters})),this.configuration={...this.configuration,...t}}get document(){return this.configuration.document}get awareness(){return this.configuration.awareness}get hasUnsyncedChanges(){return this.unsyncedChanges>0}incrementUnsyncedChanges(){this.unsyncedChanges+=1,this.emit("unsyncedChanges",this.unsyncedCh
1anges)}decrementUnsyncedChanges(){this.unsyncedChanges-=1,0===this.unsyncedChanges&&(this.synced=!0),this.emit("unsyncedChanges",this.unsyncedChanges)}forceSync(){this.send(t2,{document:this.document,documentName:this.configuration.name})}pageUnload(){this.awareness&&tM(this.awareness,[this.document.clientID],"window unload")}registerEventListeners(){"undefined"!=typeof window&&window.addEventListener("unload",this.boundPageUnload)}sendStateless(t){this.send(t1,{documentName:this.configuration.name,payload:t})}documentUpdateHandler(t,e){e!==this&&(this.incrementUnsyncedChanges(),this.send(t4,{update:t,documentName:this.configuration.name},!0))}awarenessUpdateHandler({added:t,updated:e,removed:n},s){let i=t.concat(e).concat(n);this.send(tX,{awareness:this.awareness,clients:i,documentName:this.configuration.name},!0)}get synced(){return this.isSynced}set synced(t){this.isSynced!==t&&(this.isSynced=t,this.emit("synced",{state:t}),this.emit("sync",{state:t}))}receiveStateless(t){this.emit("stateless",{payload:t})}get isAuthenticationRequired(){return!!this.configuration.token&&!this.isAuthenticated}async connect(){return this.configuration.broadcast&&this.subscribeToBroadcastChannel(),this.configuration.websocketProvider.shouldConnect=!0,this.configuration.websocketProvider.attach(this)}disconnect(){this.disconnectBroadcastChannel(),this.configuration.websocketProvider.detach(this),this.isConnected=!1,this.configuration.preserveConnection||this.configuration.websocketProvider.disconnect()}async onOpen(t){let e;this.isAuthenticated=!1,this.isConnected=!0,this.emit("open",{event:t});try{e=await this.getToken()}catch(t){this.permissionDeniedHandler(`Failed to get token: ${t}`);return}this.isAuthenticationRequired&&this.send(tY,{token:e,documentName:this.configuration.name}),this.startSync()}async getToken(){if("function"==typeof this.configuration.token){let t=await this.configuration.token();return t}return this.configuration.token}startSync(){this.incrementUnsyncedChanges(),this.send(t2,{document:this.document,documentName:this.configuration.name}
1),this.awareness&&null!==this.awareness.getLocalState()&&this.send(tX,{awareness:this.awareness,clients:[this.document.clientID],documentName:this.configuration.name})}send(t,e,n=!1){if(!this.isConnected)return;n&&this.mux(()=>{this.broadcast(t,e)});let s=new tJ(t,e);this.emit("outgoingMessage",{message:s.message}),s.send(this.configuration.websocketProvider)}onMessage(t){let e=new tB(t.data),n=e.readVarString();e.writeVarString(n),this.emit("message",{event:t,message:new tB(t.data)}),new tz(e).apply(this,!0)}onClose(t){this.isAuthenticated=!1,this.synced=!1,this.awareness&&tM(this.awareness,Array.from(this.awareness.getStates().keys()).filter(t=>t!==this.document.clientID),this)}destroy(){this.emit("destroy"),this.intervals.forceSync&&clearInterval(this.intervals.forceSync),this.awareness&&(tM(this.awareness,[this.document.clientID],"provider destroy"),this.awareness.off("update",this.awarenessUpdateHandler),this.awareness.destroy()),this.document.off("update",this.documentUpdateHandler),this.removeAllListeners(),this.configuration.websocketProvider.off("connect",this.configuration.onConnect),this.configuration.websocketProvider.off("connect",this.forwardConnect),this.configuration.websocketProvider.off("open",this.boundOnOpen),this.configuration.websocketProvider.off("open",this.forwardOpen),this.configuration.websocketProvider.off("close",this.boundOnClose),this.configuration.websocketProvider.off("close",this.configuration.onClose),this.configuration.websocketProvider.off("close",this.forwardClose),this.configuration.websocketProvider.off("status",this.boundOnStatus),this.configuration.websocketProvider.off("disconnect",this.configuration.onDisconnect),this.configuration.websocketProvider.off("disconnect",this.forwardDisconnect),this.configuration.websocketProvider.off("destroy",this.configuration.onDestroy),this.configuration.websocketProvider.off("destroy",this.forwardDestroy),this.send(tZ,{documentName:this.configuration.name}),this.disconnect(),"undefined"!=typeof window&&window.removeEventListener("unload",this.boundPageUnload)}permissionDeniedHandler(t){this.emit("authenticationFailed",{reason:t}),this.isAuthenticated=!1,this.disconnect(),this.status=c.Disconnected}authenticatedHandler(t){this.isAuthenticated=!0,this.authorizedScope=t,this.emit("authenticated")}get broadcastChannel(){return`${this.configuration.name}`}broadcastChannelSubscriber(t){this.mux(()=>{let e=new tB(t),n=e.readVarString();e.writeVarString(n),new tz(e).setBroadcasted(!0).apply(this,!1)})}subscribeToBroadcastChannel(){this.subscribedToBroadcastChannel||(tU(this.broadcastChannel,this.boundBroadcastChannelSubscriber),this.subscribedToBroadcastChannel=!0),this.mux(()=>{this.broadcast(t2,{document:this.document,documentName:this.configuration.name}),this.broadcast(t8,{document:this.document,documentName:this.configuration.name}),this.broadcast(t0,{document:this.document,documentName:this.configuration.name}),this.awareness&&this.broadcast(tX,{awareness:this.awareness,clients:[this.document.clientID],document:this.document,documentName:this.configuration.name})})}disconnectBroadcastChannel(){this.awareness&&this.send(tX,{awareness:this.awareness,clients:[this.document.clientID],states:new Map,documentName:this.configuration.name},!0),this.subscribedToBroadcastChannel&&(tE(this.broadcastChannel,this.boundBroadcastChannelSubscriber),this.subscribedToBroadcastChannel=!1)}broadcast(t,e){this.configuration.broadcast&&this.subscribedToBroadcastChannel&&new tJ(t,e).broadcast(this.broadcastChannel)}setAwarenessField(t,e){if(!this.awareness)throw new t3(`Cannot set awareness field "${t}" to ${JSON.stringify(e)}. You have disabled Awareness for this provider by explicitly passing awareness: null in the provider configuration.`);this.awareness.setLocalStateField(t,e)}}crypto.getRandomValues.bind(crypto)},64652:function(t,e,n){"use strict";n.d(e,{ZT:function(){return T}});var s=n(72338);let i=(0,s.DS)({find:/--$/,replace:"â"}),o=(0,s.DS)({find:/\.\.\.$/,replace:"â¦"}),r=(0,s.DS)({find:/(?:^|[\s{[(<'"\u2018\u201C])(")$/,replace:"â"}),a=(0,s.DS)({find:/"$/,replace:"â"}),c=(0,s.DS)({find:/(?:^|[\s{[(<'"\u2018\u201C])(')$/,replace:"â"}),h=(0,s.DS)({find:/'$/,replace:"â"}),u=(0,s.DS)({find:/<-$/,replace:"â"}),l=(0,s.DS)({find:/->$/,replace:"â"}),d=(0,s.DS)({find:/\(c\)$/,replace:"\xa9"}),p=(0,s.DS)({find:/\(tm\)$/,replace:"â¢"}),f=(0,s.DS)({find:/\(sm\)$/,replace:"â "}),g=(0,s.DS)({find:/\(r\)$/,replace:"\xae"}),m=(0,s.DS)({find:/(?:^|\s)(1\/2)$/,replace:"\xbd"}),y=(0,s.DS)({find:/\+\/-$/,replace:"\xb1"}),b=(0,s.DS)({find:/!=$/,replace:"â "}),w=(0,s.DS)({find:/<<$/,replace:"\xab"}),v=(0,s.DS)({find:/>>$/,replace:"\xbb"}),_=(0,s.DS)({find:/\d+\s?([*x])\s?\d+$/,replace:"\xd7"}),S=(0,s.DS)({find:/\^2$/,replace:"\xb2"}),k=(0,s.DS)({find:/\^3$/,replace:"\xb3"}),C=(0,s.DS)({find:/(?:^|\s)(1\/4)$/,replace:"\xbc"}),A=(0,s.DS)({find:/(?:^|\s)(3\/4)$/,replace:"\xbe"}),T=s.hj.create({name:"typography",addInputRules(){let t=[];
1return!1!==this.options.emDash&&t.push(i),!1!==this.options.ellipsis&&t.push(o),!1!==this.options.openDoubleQuote&&t.push(r),!1!==this.options.closeDoubleQuote&&t.push(a),!1!==this.options.openSingleQuote&&t.push(c),!1!==this.options.closeSingleQuote&&t.push(h),!1!==this.options.leftArrow&&t.push(u),!1!==this.options.rightArrow&&t.push(l),!1!==this.options.copyright&&t.push(d),!1!==this.options.trademark&&t.push(p),!1!==this.options.servicemark&&t.push(f),!1!==this.options.registeredTrademark&&t.push(g),!1!==this.options.oneHalf&&t.push(m),!1!==this.options.plusMinus&&t.push(y),!1!==this.options.notEqual&&t.push(b),!1!==this.options.laquo&&t.push(w),!1!==this.options.raquo&&t.push(v),!1!==this.options.multiplication&&t.push(_),!1!==this.options.superscriptTwo&&t.push(S),!1!==this.options.superscriptThree&&t.push(k),!1!==this.options.oneQuarter&&t.push(C),!1!==this.options.threeQuarters&&t.push(A),t}})},60589:function(t,e,n){"use strict";n.d(e,{yP:function(){return f},QX:function(){return u},sc:function(){return S},UE:function(){return _},_w:function(){return c},IV:function(){return d},Lj:function(){return a},U2:function(){return l},go:function(){return g},S_:function(){return y},X3:function(){return r},gz:function(){return p},ay:function(){return h}});let s=t=>new Promise(t);var i=n(55924);let o=t=>s((e,n)=>{t.onerror=t=>n(Error(t.target.error)),t.onblocked=()=>location.reload(),t.onsuccess=t=>e(t.target.result)}),r=(t,e)=>s((n,s)=>{let o=indexedDB.open(t);o.onupgradeneeded=t=>e(t.target.result),o.onerror=t=>s(i.Ue(t.target.error)),o.onblocked=()=>location.reload(),o.onsuccess=t=>{let e=t.target.result;e.onversionchange=()=>{e.close()},"undefined"!=typeof addEventListener&&addEventListener("unload",()=>e.close()),n(e)}}),a=t=>o(indexedDB.deleteDatabase(t)),c=(t,e)=>e.forEach(e=>t.createObjectStore.apply(t,e)),h=(t,e,n="readwrite")=>{let s=t.transaction(e,n);return e.map(t=>v(s,t))},u=(t,e)=>o(t.count(e)),l=(t,e)=>o(t.get(e)),d=(t,e)=>o(t.delete(e)),p=(t,e,n)=>o(t.put(e,n)),f=(t,e)=>o(t.add(e)),g=(t,e)=>o(t.getAll(e)),m=(t,e,n)=>{let s=null;return w(t,e,t=>(s=t,!1),n).then(()=>s)},y=(t,e=null)=>m(t,e,"prev"),b=(t,e)=>s((n,s)=>{t.onerror=s,t.onsuccess=t=>{let s=t.target.result;if(null===s||!1===e(s))return n();s.continue()}}),w=(t,e,n,s="next")=>b(t.openKeyCursor(e,s),t=>n(t.key)),v=(t,e)=>t.objectStore(e),_=(t,e)=>IDBKeyRange.upperBound(t,e),S=(t,e)=>IDBKeyRange.lowerBound(t,e)},6092:function(t,e,n){"use strict";n.d(e,{y:function(){return r}});var s=n(22395),i=n(78254);let o=Array.from;class r{constructor(){this._observers=s.Ue()}on(t,e){s.Yu(this._observers,t,i.Ue).add(e)}once(t,e){let n=(...s)=>{this.off(t,n),e(...s)};this.on(t,n)}off(t,e){let n=this._observers.get(t);void 0!==n&&(n.delete(e),0===n.size&&this._observers.delete(t))}emit(t,e){return o((this._observers.get(t)||s.Ue()).values()).forEach(t=>t(...e))}destroy(){this._observers=s.Ue()}}},52518:function(t,e,n){"use strict";n.d(e,{Z:function(){return s}});var s=null}}]); 2//# sourceMappingURL=205-e832025a06c52f7a.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.