playhtml 2.0.0 → 2.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -3
- package/dist/main.d.ts +0 -9
- package/dist/playhtml.es.js +108 -105
- package/dist/playhtml.umd.js +7 -7
- package/package.json +1 -1
package/dist/playhtml.umd.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
(function(L,_){typeof exports=="object"&&typeof module<"u"?_(exports):typeof define=="function"&&define.amd?define(["exports"],_):(L=typeof globalThis<"u"?globalThis:L||self,_(L.playhtml={}))})(this,function(L){"use strict";var zc=Object.defineProperty;var Oc=(L,_,q)=>_ in L?zc(L,_,{enumerable:!0,configurable:!0,writable:!0,value:q}):L[_]=q;var b=(L,_,q)=>(Oc(L,typeof _!="symbol"?_+"":_,q),q);const _=()=>new Map,q=s=>{const e=_();return s.forEach((t,n)=>{e.set(n,t)}),e},K=(s,e,t)=>{let n=s.get(e);return n===void 0&&s.set(e,n=t()),n},di=(s,e)=>{const t=[];for(const[n,i]of s)t.push(e(i,n));return t},fi=(s,e)=>{for(const[t,n]of s)if(e(n,t))return!0;return!1},re=()=>new Set,vt=s=>s[s.length-1],gi=(s,e)=>{for(let t=0;t<e.length;t++)s.push(e[t])},Q=Array.from,pi=Array.isArray,ki=String.fromCharCode,mi=s=>s.toLowerCase(),bi=/^\s*/g,wi=s=>s.replace(bi,""),yi=/([A-Z])/g,Ss=(s,e)=>wi(s.replace(yi,t=>`${e}${mi(t)}`)),_i=s=>{const e=unescape(encodeURIComponent(s)),t=e.length,n=new Uint8Array(t);for(let i=0;i<t;i++)n[i]=e.codePointAt(i);return n},je=typeof TextEncoder<"u"?new TextEncoder:null,Si=je?s=>je.encode(s):_i;let Me=typeof TextDecoder>"u"?null:new TextDecoder("utf-8",{fatal:!0,ignoreBOM:!0});Me&&Me.decode(new Uint8Array).length===1&&(Me=null);const Ds=s=>s===void 0?null:s;class Di{constructor(){this.map=new Map}setItem(e,t){this.map.set(e,t)}getItem(e){return this.map.get(e)}}let Es=new Di,At=!0;try{typeof localStorage<"u"&&(Es=localStorage,At=!1)}catch{}const Cs=Es,Ei=s=>At||addEventListener("storage",s),Ci=s=>At||removeEventListener("storage",s),vi=Object.assign,Ai=Object.keys,xi=(s,e)=>{for(const t in s)e(s[t],t)},Ii=(s,e)=>{const t=[];for(const n in s)t.push(e(s[n],n));return t},Ze=s=>Ai(s).length,Li=s=>{for(const e in s)return!1;return!0},ji=(s,e)=>{for(const t in s)if(!e(s[t],t))return!1;return!0},vs=(s,e)=>Object.prototype.hasOwnProperty.call(s,e),Mi=(s,e)=>s===e||Ze(s)===Ze(e)&&ji(s,(t,n)=>(t!==void 0||vs(e,n))&&e[n]===t),xt=(s,e,t=0)=>{try{for(;t<s.length;t++)s[t](...e)}finally{t<s.length&&xt(s,e,t+1)}},Ti=s=>s,Ui=(s,e)=>s===e,Te=(s,e)=>{if(s==null||e==null)return Ui(s,e);if(s.constructor!==e.constructor)return!1;if(s===e)return!0;switch(s.constructor){case ArrayBuffer:s=new Uint8Array(s),e=new Uint8Array(e);case Uint8Array:{if(s.byteLength!==e.byteLength)return!1;for(let t=0;t<s.length;t++)if(s[t]!==e[t])return!1;break}case Set:{if(s.size!==e.size)return!1;for(const t of s)if(!e.has(t))return!1;break}case Map:{if(s.size!==e.size)return!1;for(const t of s.keys())if(!e.has(t)||!Te(s.get(t),e.get(t)))return!1;break}case Object:if(Ze(s)!==Ze(e))return!1;for(const t in s)if(!vs(s,t)||!Te(s[t],e[t]))return!1;break;case Array:if(s.length!==e.length)return!1;for(let t=0;t<s.length;t++)if(!Te(s[t],e[t]))return!1;break;default:return!1}return!0},zi=(s,e)=>e.includes(s),we=typeof process<"u"&&process.release&&/node|io\.js/.test(process.release.name),As=typeof window<"u"&&typeof document<"u"&&!we;let N;const Oi=()=>{if(N===void 0)if(we){N=_();const s=process.argv;let e=null;for(let t=0;t<s.length;t++){const n=s[t];n[0]==="-"?(e!==null&&N.set(e,""),e=n):e!==null&&(N.set(e,n),e=null)}e!==null&&N.set(e,"")}else typeof location=="object"?(N=_(),(location.search||"?").slice(1).split("&").forEach(s=>{if(s.length!==0){const[e,t]=s.split("=");N.set(`--${Ss(e,"-")}`,t),N.set(`-${Ss(e,"-")}`,t)}})):N=_();return N},It=s=>Oi().has(s),Lt=s=>Ds(we?process.env[s.toUpperCase()]:Cs.getItem(s));(s=>It("--"+s)||Lt(s)!==null)("production");const xs=we&&zi(process.env.FORCE_COLOR,["true","1","2"]),Ri=!It("no-colors")&&(!we||process.stdout.isTTY||xs)&&(!we||It("color")||xs||Lt("COLORTERM")!==null||(Lt("TERM")||"").includes("color")),Y=Math.floor,et=Math.abs,jt=(s,e)=>s<e?s:e,oe=(s,e)=>s>e?s:e,Ni=Math.pow,Is=s=>s!==0?s<0:1/s<0,Ls=1,js=2,Mt=4,Tt=8,Ue=32,J=64,T=128,tt=31,Ut=63,ce=127,Bi=2147483647,Ms=Number.MAX_SAFE_INTEGER,Fi=Number.isInteger||(s=>typeof s=="number"&&isFinite(s)&&Y(s)===s);class ze{constructor(){this.cpos=0,this.cbuf=new Uint8Array(100),this.bufs=[]}}const j=()=>new ze,zt=s=>{let e=s.cpos;for(let t=0;t<s.bufs.length;t++)e+=s.bufs[t].length;return e},S=s=>{const e=new Uint8Array(zt(s));let t=0;for(let n=0;n<s.bufs.length;n++){const i=s.bufs[n];e.set(i,t),t+=i.length}return e.set(qt(s.cbuf.buffer,0,s.cpos),t),e},Vi=(s,e)=>{const t=s.cbuf.length;t-s.cpos<e&&(s.bufs.push(qt(s.cbuf.buffer,0,s.cpos)),s.cbuf=new Uint8Array(oe(t,e)*2),s.cpos=0)},A=(s,e)=>{const t=s.cbuf.length;s.cpos===t&&(s.bufs.push(s.cbuf),s.cbuf=new Uint8Array(t*2),s.cpos=0),s.cbuf[s.cpos++]=e},Ot=A,p=(s,e)=>{for(;e>ce;)A(s,T|ce&e),e=Y(e/128);A(s,ce&e)},Rt=(s,e)=>{const t=Is(e);for(t&&(e=-e),A(s,(e>Ut?T:0)|(t?J:0)|Ut&e),e=Y(e/64);e>0;)A(s,(e>ce?T:0)|ce&e),e=Y(e/128)},Nt=new Uint8Array(3e4),Hi=Nt.length/3,$i=(s,e)=>{if(e.length<Hi){const t=je.encodeInto(e,Nt).written||0;p(s,t);for(let n=0;n<t;n++)A(s,Nt[n])}else D(s,Si(e))},qi=(s,e)=>{const t=unescape(encodeURIComponent(e)),n=t.length;p(s,n);for(let i=0;i<n;i++)A(s,t.codePointAt(i))},ae=je&&je.encodeInto?$i:qi,st=(s,e)=>{const t=s.cbuf.length,n=s.cpos,i=jt(t-n,e.length),r=e.length-i;s.cbuf.set(e.subarray(0,i),n),s.cpos+=i,r>0&&(s.bufs.push(s.cbuf),s.cbuf=new Uint8Array(oe(t*2,r)),s.cbuf.set(e.subarray(i)),s.cpos=r)},D=(s,e)=>{p(s,e.byteLength),st(s,e)},Bt=(s,e)=>{Vi(s,e);const t=new DataView(s.cbuf.buffer,s.cpos,e);return s.cpos+=e,t},Ki=(s,e)=>Bt(s,4).setFloat32(0,e,!1),Yi=(s,e)=>Bt(s,8).setFloat64(0,e,!1),Ji=(s,e)=>Bt(s,8).setBigInt64(0,e,!1),Ts=new DataView(new ArrayBuffer(4)),Xi=s=>(Ts.setFloat32(0,s),Ts.getFloat32(0)===s),Oe=(s,e)=>{switch(typeof e){case"string":A(s,119),ae(s,e);break;case"number":Fi(e)&&et(e)<=Bi?(A(s,125),Rt(s,e)):Xi(e)?(A(s,124),Ki(s,e)):(A(s,123),Yi(s,e));break;case"bigint":A(s,122),Ji(s,e);break;case"object":if(e===null)A(s,126);else if(pi(e)){A(s,117),p(s,e.length);for(let t=0;t<e.length;t++)Oe(s,e[t])}else if(e instanceof Uint8Array)A(s,116),D(s,e);else{A(s,118);const t=Object.keys(e);p(s,t.length);for(let n=0;n<t.length;n++){const i=t[n];ae(s,i),Oe(s,e[i])}}break;case"boolean":A(s,e?120:121);break;default:A(s,127)}};class Us extends ze{constructor(e){super(),this.w=e,this.s=null,this.count=0}write(e){this.s===e?this.count++:(this.count>0&&p(this,this.count-1),this.count=1,this.w(this,e),this.s=e)}}const zs=s=>{s.count>0&&(Rt(s.encoder,s.count===1?s.s:-s.s),s.count>1&&p(s.encoder,s.count-2))};class nt{constructor(){this.encoder=new ze,this.s=0,this.count=0}write(e){this.s===e?this.count++:(zs(this),this.count=1,this.s=e)}toUint8Array(){return zs(this),S(this.encoder)}}const Os=s=>{if(s.count>0){const e=s.diff*2+(s.count===1?0:1);Rt(s.encoder,e),s.count>1&&p(s.encoder,s.count-2)}};class Ft{constructor(){this.encoder=new ze,this.s=0,this.count=0,this.diff=0}write(e){this.diff===e-this.s?(this.s=e,this.count++):(Os(this),this.count=1,this.diff=e-this.s,this.s=e)}toUint8Array(){return Os(this),S(this.encoder)}}class Gi{constructor(){this.sarr=[],this.s="",this.lensE=new nt}write(e){this.s+=e,this.s.length>19&&(this.sarr.push(this.s),this.s=""),this.lensE.write(e.length)}toUint8Array(){const e=new ze;return this.sarr.push(this.s),this.s="",ae(e,this.sarr.join("")),st(e,this.lensE.toUint8Array()),S(e)}}const X=s=>new Error(s),B=()=>{throw X("Method unimplemented")},F=()=>{throw X("Unexpected case")},Rs=X("Unexpected end of array"),Ns=X("Integer out of Range");class it{constructor(e){this.arr=e,this.pos=0}}const Z=s=>new it(s),Wi=s=>s.pos!==s.arr.length,Pi=(s,e)=>{const t=qt(s.arr.buffer,s.pos+s.arr.byteOffset,e);return s.pos+=e,t},M=s=>Pi(s,k(s)),ye=s=>s.arr[s.pos++],k=s=>{let e=0,t=1;const n=s.arr.length;for(;s.pos<n;){const i=s.arr[s.pos++];if(e=e+(i&ce)*t,t*=128,i<T)return e;if(e>Ms)throw Ns}throw Rs},Vt=s=>{let e=s.arr[s.pos++],t=e&Ut,n=64;const i=(e&J)>0?-1:1;if(!(e&T))return i*t;const r=s.arr.length;for(;s.pos<r;){if(e=s.arr[s.pos++],t=t+(e&ce)*n,n*=128,e<T)return i*t;if(t>Ms)throw Ns}throw Rs},ee=Me?s=>Me.decode(M(s)):s=>{let e=k(s);if(e===0)return"";{let t=String.fromCodePoint(ye(s));if(--e<100)for(;e--;)t+=String.fromCodePoint(ye(s));else for(;e>0;){const n=e<1e4?e:1e4,i=s.arr.subarray(s.pos,s.pos+n);s.pos+=n,t+=String.fromCodePoint.apply(null,i),e-=n}return decodeURIComponent(escape(t))}},Ht=(s,e)=>{const t=new DataView(s.arr.buffer,s.arr.byteOffset+s.pos,e);return s.pos+=e,t},Qi=[s=>{},s=>null,Vt,s=>Ht(s,4).getFloat32(0,!1),s=>Ht(s,8).getFloat64(0,!1),s=>Ht(s,8).getBigInt64(0,!1),s=>!1,s=>!0,ee,s=>{const e=k(s),t={};for(let n=0;n<e;n++){const i=ee(s);t[i]=Re(s)}return t},s=>{const e=k(s),t=[];for(let n=0;n<e;n++)t.push(Re(s));return t},M],Re=s=>Qi[127-ye(s)](s);class Bs extends it{constructor(e,t){super(e),this.reader=t,this.s=null,this.count=0}read(){return this.count===0&&(this.s=this.reader(this),Wi(this)?this.count=k(this)+1:this.count=-1),this.count--,this.s}}class rt extends it{constructor(e){super(e),this.s=0,this.count=0}read(){if(this.count===0){this.s=Vt(this);const e=Is(this.s);this.count=1,e&&(this.s=-this.s,this.count=k(this)+2)}return this.count--,this.s}}class $t extends it{constructor(e){super(e),this.s=0,this.count=0,this.diff=0}read(){if(this.count===0){const e=Vt(this),t=e&1;this.diff=Y(e/2),this.count=1,t&&(this.count=k(this)+2)}return this.s+=this.diff,this.count--,this.s}}class Zi{constructor(e){this.decoder=new rt(e),this.str=ee(this.decoder),this.spos=0}read(){const e=this.spos+this.decoder.read(),t=this.str.slice(this.spos,e);return this.spos=e,t}}const Fs=s=>new Uint8Array(s),qt=(s,e,t)=>new Uint8Array(s,e,t),er=s=>new Uint8Array(s),tr=s=>{let e="";for(let t=0;t<s.byteLength;t++)e+=ki(s[t]);return btoa(e)},sr=s=>Buffer.from(s.buffer,s.byteOffset,s.byteLength).toString("base64"),nr=s=>{const e=atob(s),t=Fs(e.length);for(let n=0;n<e.length;n++)t[n]=e.charCodeAt(n);return t},ir=s=>{const e=Buffer.from(s,"base64");return new Uint8Array(e.buffer,e.byteOffset,e.byteLength)},rr=As?tr:sr,or=As?nr:ir,cr=s=>{const e=Fs(s.byteLength);return e.set(s),e},Vs=new Map;class ar{constructor(e){this.room=e,this.onmessage=null,this._onChange=t=>t.key===e&&this.onmessage!==null&&this.onmessage({data:or(t.newValue||"")}),Ei(this._onChange)}postMessage(e){Cs.setItem(this.room,rr(er(e)))}close(){Ci(this._onChange)}}const lr=typeof BroadcastChannel>"u"?ar:BroadcastChannel,Kt=s=>K(Vs,s,()=>{const e=re(),t=new lr(s);return t.onmessage=n=>e.forEach(i=>i(n.data,"broadcastchannel")),{bc:t,subs:e}}),hr=(s,e)=>(Kt(s).subs.add(e),e),ur=(s,e)=>{const t=Kt(s),n=t.subs.delete(e);return n&&t.subs.size===0&&(t.bc.close(),Vs.delete(s)),n},_e=(s,e,t=null)=>{const n=Kt(s);n.bc.postMessage(e),n.subs.forEach(i=>i(e,t))},le=Date.now;class ot{constructor(){this._observers=_()}on(e,t){K(this._observers,e,re).add(t)}once(e,t){const n=(...i)=>{this.off(e,n),t(...i)};this.on(e,n)}off(e,t){const n=this._observers.get(e);n!==void 0&&(n.delete(t),n.size===0&&this._observers.delete(e))}emit(e,t){return Q((this._observers.get(e)||_()).values()).forEach(n=>n(...t))}destroy(){this._observers=_()}}const dr=crypto.getRandomValues.bind(crypto),Hs=()=>dr(new Uint32Array(1))[0],fr=[1e7]+-1e3+-4e3+-8e3+-1e11,gr=()=>fr.replace(/[018]/g,s=>(s^Hs()&15>>s/4).toString(16)),Se=s=>new Promise(s);Promise.all.bind(Promise);class pr{constructor(e,t){this.left=e,this.right=t}}const G=(s,e)=>new pr(s,e);typeof DOMParser<"u"&&new DOMParser;const kr=s=>di(s,(e,t)=>`${t}:${e};`).join(""),W=Symbol,$s=W(),qs=W(),mr=W(),br=W(),wr=W(),Ks=W(),yr=W(),Ys=W(),_r=W(),Sr=s=>{const e=[];let t=0;for(;t<s.length;t++){const n=s[t];n.constructor===String||n.constructor===Number||n.constructor===Object&&e.push(JSON.stringify(n))}return e},Dr={[$s]:G("font-weight","bold"),[qs]:G("font-weight","normal"),[mr]:G("color","blue"),[wr]:G("color","green"),[br]:G("color","grey"),[Ks]:G("color","red"),[yr]:G("color","purple"),[Ys]:G("color","orange"),[_r]:G("color","black")},Er=Ri?s=>{const e=[],t=[],n=_();let i=[],r=0;for(;r<s.length;r++){const o=s[r],c=Dr[o];if(c!==void 0)n.set(c.left,c.right);else if(o.constructor===String||o.constructor===Number){const a=kr(n);r>0||a.length>0?(e.push("%c"+o),t.push(a)):e.push(o)}else break}for(r>0&&(i=t,i.unshift(e.join("")));r<s.length;r++){const o=s[r];o instanceof Symbol||i.push(o)}return i}:Sr,Cr=(...s)=>{console.log(...Er(s)),vr.forEach(e=>e.print(s))},vr=re(),Js=s=>({[Symbol.iterator](){return this},next:s}),Ar=(s,e)=>Js(()=>{let t;do t=s.next();while(!t.done&&!e(t.value));return t}),Yt=(s,e)=>Js(()=>{const{done:t,value:n}=s.next();return{done:t,value:t?void 0:e(n)}});class Jt{constructor(e,t){this.clock=e,this.len=t}}class Ne{constructor(){this.clients=new Map}}const Xs=(s,e,t)=>e.clients.forEach((n,i)=>{const r=s.doc.store.clients.get(i);for(let o=0;o<n.length;o++){const c=n[o];gn(s,r,c.clock,c.len,t)}}),xr=(s,e)=>{let t=0,n=s.length-1;for(;t<=n;){const i=Y((t+n)/2),r=s[i],o=r.clock;if(o<=e){if(e<o+r.len)return i;t=i+1}else n=i-1}return null},Gs=(s,e)=>{const t=s.clients.get(e.client);return t!==void 0&&xr(t,e.clock)!==null},Xt=s=>{s.clients.forEach(e=>{e.sort((i,r)=>i.clock-r.clock);let t,n;for(t=1,n=1;t<e.length;t++){const i=e[n-1],r=e[t];i.clock+i.len>=r.clock?i.len=oe(i.len,r.clock+r.len-i.clock):(n<t&&(e[n]=r),n++)}e.length=n})},Ir=s=>{const e=new Ne;for(let t=0;t<s.length;t++)s[t].clients.forEach((n,i)=>{if(!e.clients.has(i)){const r=n.slice();for(let o=t+1;o<s.length;o++)gi(r,s[o].clients.get(i)||[]);e.clients.set(i,r)}});return Xt(e),e},ct=(s,e,t,n)=>{K(s.clients,e,()=>[]).push(new Jt(t,n))},Lr=()=>new Ne,jr=s=>{const e=Lr();return s.clients.forEach((t,n)=>{const i=[];for(let r=0;r<t.length;r++){const o=t[r];if(o.deleted){const c=o.id.clock;let a=o.length;if(r+1<t.length)for(let l=t[r+1];r+1<t.length&&l.deleted;l=t[++r+1])a+=l.length;i.push(new Jt(c,a))}}i.length>0&&e.clients.set(n,i)}),e},De=(s,e)=>{p(s.restEncoder,e.clients.size),Q(e.clients.entries()).sort((t,n)=>n[0]-t[0]).forEach(([t,n])=>{s.resetDsCurVal(),p(s.restEncoder,t);const i=n.length;p(s.restEncoder,i);for(let r=0;r<i;r++){const o=n[r];s.writeDsClock(o.clock),s.writeDsLen(o.len)}})},Gt=s=>{const e=new Ne,t=k(s.restDecoder);for(let n=0;n<t;n++){s.resetDsCurVal();const i=k(s.restDecoder),r=k(s.restDecoder);if(r>0){const o=K(e.clients,i,()=>[]);for(let c=0;c<r;c++)o.push(new Jt(s.readDsClock(),s.readDsLen()))}}return e},Ws=(s,e,t)=>{const n=new Ne,i=k(s.restDecoder);for(let r=0;r<i;r++){s.resetDsCurVal();const o=k(s.restDecoder),c=k(s.restDecoder),a=t.clients.get(o)||[],l=x(t,o);for(let h=0;h<c;h++){const u=s.readDsClock(),d=u+s.readDsLen();if(u<l){l<d&&ct(n,o,l,d-l);let f=V(a,u),g=a[f];for(!g.deleted&&g.id.clock<u&&(a.splice(f+1,0,St(e,g,u-g.id.clock)),f++);f<a.length&&(g=a[f++],g.id.clock<d);)g.deleted||(d<g.id.clock+g.length&&a.splice(f,0,St(e,g,d-g.id.clock)),g.delete(e))}else ct(n,o,u,d-u)}}if(n.clients.size>0){const r=new he;return p(r.restEncoder,0),De(r,n),r.toUint8Array()}return null},Ps=Hs;class Ee extends ot{constructor({guid:e=gr(),collectionid:t=null,gc:n=!0,gcFilter:i=()=>!0,meta:r=null,autoLoad:o=!1,shouldLoad:c=!0}={}){super(),this.gc=n,this.gcFilter=i,this.clientID=Ps(),this.guid=e,this.collectionid=t,this.share=new Map,this.store=new un,this._transaction=null,this._transactionCleanups=[],this.subdocs=new Set,this._item=null,this.shouldLoad=c,this.autoLoad=o,this.meta=r,this.isLoaded=!1,this.isSynced=!1,this.whenLoaded=Se(l=>{this.on("load",()=>{this.isLoaded=!0,l(this)})});const a=()=>Se(l=>{const h=u=>{(u===void 0||u===!0)&&(this.off("sync",h),l())};this.on("sync",h)});this.on("sync",l=>{l===!1&&this.isSynced&&(this.whenSynced=a()),this.isSynced=l===void 0||l===!0,this.isLoaded||this.emit("load",[])}),this.whenSynced=a()}load(){const e=this._item;e!==null&&!this.shouldLoad&&y(e.parent.doc,t=>{t.subdocsLoaded.add(this)},null,!0),this.shouldLoad=!0}getSubdocs(){return this.subdocs}getSubdocGuids(){return new Set(Q(this.subdocs).map(e=>e.guid))}transact(e,t=null){return y(this,e,t)}get(e,t=I){const n=K(this.share,e,()=>{const r=new t;return r._integrate(this,null),r}),i=n.constructor;if(t!==I&&i!==t)if(i===I){const r=new t;r._map=n._map,n._map.forEach(o=>{for(;o!==null;o=o.left)o.parent=r}),r._start=n._start;for(let o=r._start;o!==null;o=o.right)o.parent=r;return r._length=n._length,this.share.set(e,r),r._integrate(this,null),r}else throw new Error(`Type with the name ${e} has already been defined with a different constructor`);return n}getArray(e=""){return this.get(e,Ae)}getText(e=""){return this.get(e,Ie)}getMap(e=""){return this.get(e,ue)}getXmlFragment(e=""){return this.get(e,de)}toJSON(){const e={};return this.share.forEach((t,n)=>{e[n]=t.toJSON()}),e}destroy(){Q(this.subdocs).forEach(t=>t.destroy());const e=this._item;if(e!==null){this._item=null;const t=e.content;t.doc=new Ee({guid:this.guid,...t.opts,shouldLoad:!1}),t.doc._item=e,y(e.parent.doc,n=>{const i=t.doc;e.deleted||n.subdocsAdded.add(i),n.subdocsRemoved.add(this)},null,!0)}this.emit("destroyed",[!0]),this.emit("destroy",[this]),super.destroy()}on(e,t){super.on(e,t)}off(e,t){super.off(e,t)}}class Qs{constructor(e){this.restDecoder=e}resetDsCurVal(){}readDsClock(){return k(this.restDecoder)}readDsLen(){return k(this.restDecoder)}}class Zs extends Qs{readLeftID(){return w(k(this.restDecoder),k(this.restDecoder))}readRightID(){return w(k(this.restDecoder),k(this.restDecoder))}readClient(){return k(this.restDecoder)}readInfo(){return ye(this.restDecoder)}readString(){return ee(this.restDecoder)}readParentInfo(){return k(this.restDecoder)===1}readTypeRef(){return k(this.restDecoder)}readLen(){return k(this.restDecoder)}readAny(){return Re(this.restDecoder)}readBuf(){return cr(M(this.restDecoder))}readJSON(){return JSON.parse(ee(this.restDecoder))}readKey(){return ee(this.restDecoder)}}class Mr{constructor(e){this.dsCurrVal=0,this.restDecoder=e}resetDsCurVal(){this.dsCurrVal=0}readDsClock(){return this.dsCurrVal+=k(this.restDecoder),this.dsCurrVal}readDsLen(){const e=k(this.restDecoder)+1;return this.dsCurrVal+=e,e}}class Ce extends Mr{constructor(e){super(e),this.keys=[],k(e),this.keyClockDecoder=new $t(M(e)),this.clientDecoder=new rt(M(e)),this.leftClockDecoder=new $t(M(e)),this.rightClockDecoder=new $t(M(e)),this.infoDecoder=new Bs(M(e),ye),this.stringDecoder=new Zi(M(e)),this.parentInfoDecoder=new Bs(M(e),ye),this.typeRefDecoder=new rt(M(e)),this.lenDecoder=new rt(M(e))}readLeftID(){return new ve(this.clientDecoder.read(),this.leftClockDecoder.read())}readRightID(){return new ve(this.clientDecoder.read(),this.rightClockDecoder.read())}readClient(){return this.clientDecoder.read()}readInfo(){return this.infoDecoder.read()}readString(){return this.stringDecoder.read()}readParentInfo(){return this.parentInfoDecoder.read()===1}readTypeRef(){return this.typeRefDecoder.read()}readLen(){return this.lenDecoder.read()}readAny(){return Re(this.restDecoder)}readBuf(){return M(this.restDecoder)}readJSON(){return Re(this.restDecoder)}readKey(){const e=this.keyClockDecoder.read();if(e<this.keys.length)return this.keys[e];{const t=this.stringDecoder.read();return this.keys.push(t),t}}}class en{constructor(){this.restEncoder=j()}toUint8Array(){return S(this.restEncoder)}resetDsCurVal(){}writeDsClock(e){p(this.restEncoder,e)}writeDsLen(e){p(this.restEncoder,e)}}class Be extends en{writeLeftID(e){p(this.restEncoder,e.client),p(this.restEncoder,e.clock)}writeRightID(e){p(this.restEncoder,e.client),p(this.restEncoder,e.clock)}writeClient(e){p(this.restEncoder,e)}writeInfo(e){Ot(this.restEncoder,e)}writeString(e){ae(this.restEncoder,e)}writeParentInfo(e){p(this.restEncoder,e?1:0)}writeTypeRef(e){p(this.restEncoder,e)}writeLen(e){p(this.restEncoder,e)}writeAny(e){Oe(this.restEncoder,e)}writeBuf(e){D(this.restEncoder,e)}writeJSON(e){ae(this.restEncoder,JSON.stringify(e))}writeKey(e){ae(this.restEncoder,e)}}class tn{constructor(){this.restEncoder=j(),this.dsCurrVal=0}toUint8Array(){return S(this.restEncoder)}resetDsCurVal(){this.dsCurrVal=0}writeDsClock(e){const t=e-this.dsCurrVal;this.dsCurrVal=e,p(this.restEncoder,t)}writeDsLen(e){e===0&&F(),p(this.restEncoder,e-1),this.dsCurrVal+=e}}class he extends tn{constructor(){super(),this.keyMap=new Map,this.keyClock=0,this.keyClockEncoder=new Ft,this.clientEncoder=new nt,this.leftClockEncoder=new Ft,this.rightClockEncoder=new Ft,this.infoEncoder=new Us(Ot),this.stringEncoder=new Gi,this.parentInfoEncoder=new Us(Ot),this.typeRefEncoder=new nt,this.lenEncoder=new nt}toUint8Array(){const e=j();return p(e,0),D(e,this.keyClockEncoder.toUint8Array()),D(e,this.clientEncoder.toUint8Array()),D(e,this.leftClockEncoder.toUint8Array()),D(e,this.rightClockEncoder.toUint8Array()),D(e,S(this.infoEncoder)),D(e,this.stringEncoder.toUint8Array()),D(e,S(this.parentInfoEncoder)),D(e,this.typeRefEncoder.toUint8Array()),D(e,this.lenEncoder.toUint8Array()),st(e,S(this.restEncoder)),S(e)}writeLeftID(e){this.clientEncoder.write(e.client),this.leftClockEncoder.write(e.clock)}writeRightID(e){this.clientEncoder.write(e.client),this.rightClockEncoder.write(e.clock)}writeClient(e){this.clientEncoder.write(e)}writeInfo(e){this.infoEncoder.write(e)}writeString(e){this.stringEncoder.write(e)}writeParentInfo(e){this.parentInfoEncoder.write(e?1:0)}writeTypeRef(e){this.typeRefEncoder.write(e)}writeLen(e){this.lenEncoder.write(e)}writeAny(e){Oe(this.restEncoder,e)}writeBuf(e){D(this.restEncoder,e)}writeJSON(e){Oe(this.restEncoder,e)}writeKey(e){const t=this.keyMap.get(e);t===void 0?(this.keyClockEncoder.write(this.keyClock++),this.stringEncoder.write(e)):this.keyClockEncoder.write(t)}}const Tr=(s,e,t,n)=>{n=oe(n,e[0].id.clock);const i=V(e,n);p(s.restEncoder,e.length-i),s.writeClient(t),p(s.restEncoder,n);const r=e[i];r.write(s,n-r.id.clock);for(let o=i+1;o<e.length;o++)e[o].write(s,0)},Wt=(s,e,t)=>{const n=new Map;t.forEach((i,r)=>{x(e,r)>i&&n.set(r,i)}),lt(e).forEach((i,r)=>{t.has(r)||n.set(r,0)}),p(s.restEncoder,n.size),Q(n.entries()).sort((i,r)=>r[0]-i[0]).forEach(([i,r])=>{Tr(s,e.clients.get(i),i,r)})},Ur=(s,e)=>{const t=_(),n=k(s.restDecoder);for(let i=0;i<n;i++){const r=k(s.restDecoder),o=new Array(r),c=s.readClient();let a=k(s.restDecoder);t.set(c,{i:0,refs:o});for(let l=0;l<r;l++){const h=s.readInfo();switch(tt&h){case 0:{const u=s.readLen();o[l]=new O(w(c,a),u),a+=u;break}case 10:{const u=k(s.restDecoder);o[l]=new R(w(c,a),u),a+=u;break}default:{const u=(h&(J|T))===0,d=new v(w(c,a),null,(h&T)===T?s.readLeftID():null,null,(h&J)===J?s.readRightID():null,u?s.readParentInfo()?e.get(s.readString()):s.readLeftID():null,u&&(h&Ue)===Ue?s.readString():null,Bn(s,h));o[l]=d,a+=d.length}}}}return t},zr=(s,e,t)=>{const n=[];let i=Q(t.keys()).sort((f,g)=>f-g);if(i.length===0)return null;const r=()=>{if(i.length===0)return null;let f=t.get(i[i.length-1]);for(;f.refs.length===f.i;)if(i.pop(),i.length>0)f=t.get(i[i.length-1]);else return null;return f};let o=r();if(o===null&&n.length===0)return null;const c=new un,a=new Map,l=(f,g)=>{const m=a.get(f);(m==null||m>g)&&a.set(f,g)};let h=o.refs[o.i++];const u=new Map,d=()=>{for(const f of n){const g=f.id.client,m=t.get(g);m?(m.i--,c.clients.set(g,m.refs.slice(m.i)),t.delete(g),m.i=0,m.refs=[]):c.clients.set(g,[f]),i=i.filter(U=>U!==g)}n.length=0};for(;;){if(h.constructor!==R){const g=K(u,h.id.client,()=>x(e,h.id.client))-h.id.clock;if(g<0)n.push(h),l(h.id.client,h.id.clock-1),d();else{const m=h.getMissing(s,e);if(m!==null){n.push(h);const U=t.get(m)||{refs:[],i:0};if(U.refs.length===U.i)l(m,x(e,m)),d();else{h=U.refs[U.i++];continue}}else(g===0||g<h.length)&&(h.integrate(s,g),u.set(h.id.client,h.id.clock+h.length))}}if(n.length>0)h=n.pop();else if(o!==null&&o.i<o.refs.length)h=o.refs[o.i++];else{if(o=r(),o===null)break;h=o.refs[o.i++]}}if(c.clients.size>0){const f=new he;return Wt(f,c,new Map),p(f.restEncoder,0),{missing:a,update:f.toUint8Array()}}return null},Or=(s,e)=>Wt(s,e.doc.store,e.beforeState),Rr=(s,e,t,n=new Ce(s))=>y(e,i=>{i.local=!1;let r=!1;const o=i.doc,c=o.store,a=Ur(n,o),l=zr(i,c,a),h=c.pendingStructs;if(h){for(const[d,f]of h.missing)if(f<x(c,d)){r=!0;break}if(l){for(const[d,f]of l.missing){const g=h.missing.get(d);(g==null||g>f)&&h.missing.set(d,f)}h.update=ut([h.update,l.update])}}else c.pendingStructs=l;const u=Ws(n,i,c);if(c.pendingDs){const d=new Ce(Z(c.pendingDs));k(d.restDecoder);const f=Ws(d,i,c);u&&f?c.pendingDs=ut([u,f]):c.pendingDs=u||f}else c.pendingDs=u;if(r){const d=c.pendingStructs.update;c.pendingStructs=null,sn(i.doc,d)}},t,!1),sn=(s,e,t,n=Ce)=>{const i=Z(e);Rr(i,s,t,new n(i))},nn=(s,e,t)=>sn(s,e,t,Zs),Nr=(s,e,t=new Map)=>{Wt(s,e.store,t),De(s,jr(e.store))},Br=(s,e=new Uint8Array([0]),t=new he)=>{const n=rn(e);Nr(t,s,n);const i=[t.toUint8Array()];if(s.store.pendingDs&&i.push(s.store.pendingDs),s.store.pendingStructs&&i.push(Zr(s.store.pendingStructs.update,e)),i.length>1){if(t.constructor===Be)return Pr(i.map((r,o)=>o===0?r:to(r)));if(t.constructor===he)return ut(i)}return i[0]},Pt=(s,e)=>Br(s,e,new Be),Fr=s=>{const e=new Map,t=k(s.restDecoder);for(let n=0;n<t;n++){const i=k(s.restDecoder),r=k(s.restDecoder);e.set(i,r)}return e},rn=s=>Fr(new Qs(Z(s))),on=(s,e)=>(p(s.restEncoder,e.size),Q(e.entries()).sort((t,n)=>n[0]-t[0]).forEach(([t,n])=>{p(s.restEncoder,t),p(s.restEncoder,n)}),s),Vr=(s,e)=>on(s,lt(e.store)),Hr=(s,e=new tn)=>(s instanceof Map?on(e,s):Vr(e,s),e.toUint8Array()),$r=s=>Hr(s,new en);class qr{constructor(){this.l=[]}}const cn=()=>new qr,an=(s,e)=>s.l.push(e),ln=(s,e)=>{const t=s.l,n=t.length;s.l=t.filter(i=>e!==i),n===s.l.length&&console.error("[yjs] Tried to remove event handler that doesn't exist.")},hn=(s,e,t)=>xt(s.l,[e,t]);class ve{constructor(e,t){this.client=e,this.clock=t}}const at=(s,e)=>s===e||s!==null&&e!==null&&s.client===e.client&&s.clock===e.clock,w=(s,e)=>new ve(s,e),Kr=s=>{for(const[e,t]of s.doc.share.entries())if(t===s)return e;throw F()},Fe=(s,e)=>e===void 0?!s.deleted:e.sv.has(s.id.client)&&(e.sv.get(s.id.client)||0)>s.id.clock&&!Gs(e.ds,s.id),Qt=(s,e)=>{const t=K(s.meta,Qt,re),n=s.doc.store;t.has(e)||(e.sv.forEach((i,r)=>{i<x(n,r)&&te(s,w(r,i))}),Xs(s,e.ds,i=>{}),t.add(e))};class un{constructor(){this.clients=new Map,this.pendingStructs=null,this.pendingDs=null}}const lt=s=>{const e=new Map;return s.clients.forEach((t,n)=>{const i=t[t.length-1];e.set(n,i.id.clock+i.length)}),e},x=(s,e)=>{const t=s.clients.get(e);if(t===void 0)return 0;const n=t[t.length-1];return n.id.clock+n.length},dn=(s,e)=>{let t=s.clients.get(e.id.client);if(t===void 0)t=[],s.clients.set(e.id.client,t);else{const n=t[t.length-1];if(n.id.clock+n.length!==e.id.clock)throw F()}t.push(e)},V=(s,e)=>{let t=0,n=s.length-1,i=s[n],r=i.id.clock;if(r===e)return n;let o=Y(e/(r+i.length-1)*n);for(;t<=n;){if(i=s[o],r=i.id.clock,r<=e){if(e<r+i.length)return o;t=o+1}else n=o-1;o=Y((t+n)/2)}throw F()},Zt=(s,e)=>{const t=s.clients.get(e.client);return t[V(t,e.clock)]},es=(s,e,t)=>{const n=V(e,t),i=e[n];return i.id.clock<t&&i instanceof v?(e.splice(n+1,0,St(s,i,t-i.id.clock)),n+1):n},te=(s,e)=>{const t=s.doc.store.clients.get(e.client);return t[es(s,t,e.clock)]},fn=(s,e,t)=>{const n=e.clients.get(t.client),i=V(n,t.clock),r=n[i];return t.clock!==r.id.clock+r.length-1&&r.constructor!==O&&n.splice(i+1,0,St(s,r,t.clock-r.id.clock+1)),r},Yr=(s,e,t)=>{const n=s.clients.get(e.id.client);n[V(n,e.id.clock)]=t},gn=(s,e,t,n,i)=>{if(n===0)return;const r=t+n;let o=es(s,e,t),c;do c=e[o++],r<c.id.clock+c.length&&es(s,e,r),i(c);while(o<e.length&&e[o].id.clock<r)};class Jr{constructor(e,t,n){this.doc=e,this.deleteSet=new Ne,this.beforeState=lt(e.store),this.afterState=new Map,this.changed=new Map,this.changedParentTypes=new Map,this._mergeStructs=[],this.origin=t,this.meta=new Map,this.local=n,this.subdocsAdded=new Set,this.subdocsRemoved=new Set,this.subdocsLoaded=new Set,this._needFormattingCleanup=!1}}const pn=(s,e)=>e.deleteSet.clients.size===0&&!fi(e.afterState,(t,n)=>e.beforeState.get(n)!==t)?!1:(Xt(e.deleteSet),Or(s,e),De(s,e.deleteSet),!0),kn=(s,e,t)=>{const n=e._item;(n===null||n.id.clock<(s.beforeState.get(n.id.client)||0)&&!n.deleted)&&K(s.changed,e,re).add(t)},ht=(s,e)=>{let t=s[e],n=s[e-1],i=e;for(;i>0;t=n,n=s[--i-1]){if(n.deleted===t.deleted&&n.constructor===t.constructor&&n.mergeWith(t)){t instanceof v&&t.parentSub!==null&&t.parent._map.get(t.parentSub)===t&&t.parent._map.set(t.parentSub,n);continue}break}const r=e-i;return r&&s.splice(e+1-r,r),r},Xr=(s,e,t)=>{for(const[n,i]of s.clients.entries()){const r=e.clients.get(n);for(let o=i.length-1;o>=0;o--){const c=i[o],a=c.clock+c.len;for(let l=V(r,c.clock),h=r[l];l<r.length&&h.id.clock<a;h=r[++l]){const u=r[l];if(c.clock+c.len<=u.id.clock)break;u instanceof v&&u.deleted&&!u.keep&&t(u)&&u.gc(e,!1)}}}},Gr=(s,e)=>{s.clients.forEach((t,n)=>{const i=e.clients.get(n);for(let r=t.length-1;r>=0;r--){const o=t[r],c=jt(i.length-1,1+V(i,o.clock+o.len-1));for(let a=c,l=i[a];a>0&&l.id.clock>=o.clock;l=i[a])a-=1+ht(i,a)}})},mn=(s,e)=>{if(e<s.length){const t=s[e],n=t.doc,i=n.store,r=t.deleteSet,o=t._mergeStructs;try{Xt(r),t.afterState=lt(t.doc.store),n.emit("beforeObserverCalls",[t,n]);const c=[];t.changed.forEach((a,l)=>c.push(()=>{(l._item===null||!l._item.deleted)&&l._callObserver(t,a)})),c.push(()=>{t.changedParentTypes.forEach((a,l)=>{l._dEH.l.length>0&&(l._item===null||!l._item.deleted)&&(a=a.filter(h=>h.target._item===null||!h.target._item.deleted),a.forEach(h=>{h.currentTarget=l,h._path=null}),a.sort((h,u)=>h.path.length-u.path.length),hn(l._dEH,a,t))})}),c.push(()=>n.emit("afterTransaction",[t,n])),xt(c,[]),t._needFormattingCleanup&&po(t)}finally{n.gc&&Xr(r,i,n.gcFilter),Gr(r,i),t.afterState.forEach((h,u)=>{const d=t.beforeState.get(u)||0;if(d!==h){const f=i.clients.get(u),g=oe(V(f,d),1);for(let m=f.length-1;m>=g;)m-=1+ht(f,m)}});for(let h=o.length-1;h>=0;h--){const{client:u,clock:d}=o[h].id,f=i.clients.get(u),g=V(f,d);g+1<f.length&&ht(f,g+1)>1||g>0&&ht(f,g)}if(!t.local&&t.afterState.get(n.clientID)!==t.beforeState.get(n.clientID)&&(Cr(Ys,$s,"[yjs] ",qs,Ks,"Changed the client-id because another client seems to be using it."),n.clientID=Ps()),n.emit("afterTransactionCleanup",[t,n]),n._observers.has("update")){const h=new Be;pn(h,t)&&n.emit("update",[h.toUint8Array(),t.origin,n,t])}if(n._observers.has("updateV2")){const h=new he;pn(h,t)&&n.emit("updateV2",[h.toUint8Array(),t.origin,n,t])}const{subdocsAdded:c,subdocsLoaded:a,subdocsRemoved:l}=t;(c.size>0||l.size>0||a.size>0)&&(c.forEach(h=>{h.clientID=n.clientID,h.collectionid==null&&(h.collectionid=n.collectionid),n.subdocs.add(h)}),l.forEach(h=>n.subdocs.delete(h)),n.emit("subdocs",[{loaded:a,added:c,removed:l},n,t]),l.forEach(h=>h.destroy())),s.length<=e+1?(n._transactionCleanups=[],n.emit("afterAllTransactions",[n,s])):mn(s,e+1)}}},y=(s,e,t=null,n=!0)=>{const i=s._transactionCleanups;let r=!1,o=null;s._transaction===null&&(r=!0,s._transaction=new Jr(s,t,n),i.push(s._transaction),i.length===1&&s.emit("beforeAllTransactions",[s]),s.emit("beforeTransaction",[s._transaction,s]));try{o=e(s._transaction)}finally{if(r){const c=s._transaction===i[0];s._transaction=null,c&&mn(i,0)}}return o};function*Wr(s){const e=k(s.restDecoder);for(let t=0;t<e;t++){const n=k(s.restDecoder),i=s.readClient();let r=k(s.restDecoder);for(let o=0;o<n;o++){const c=s.readInfo();if(c===10){const a=k(s.restDecoder);yield new R(w(i,r),a),r+=a}else if(tt&c){const a=(c&(J|T))===0,l=new v(w(i,r),null,(c&T)===T?s.readLeftID():null,null,(c&J)===J?s.readRightID():null,a?s.readParentInfo()?s.readString():s.readLeftID():null,a&&(c&Ue)===Ue?s.readString():null,Bn(s,c));yield l,r+=l.length}else{const a=s.readLen();yield new O(w(i,r),a),r+=a}}}}class ts{constructor(e,t){this.gen=Wr(e),this.curr=null,this.done=!1,this.filterSkips=t,this.next()}next(){do this.curr=this.gen.next().value||null;while(this.filterSkips&&this.curr!==null&&this.curr.constructor===R);return this.curr}}class ss{constructor(e){this.currClient=0,this.startClock=0,this.written=0,this.encoder=e,this.clientStructs=[]}}const Pr=s=>ut(s,Zs,Be),Qr=(s,e)=>{if(s.constructor===O){const{client:t,clock:n}=s.id;return new O(w(t,n+e),s.length-e)}else if(s.constructor===R){const{client:t,clock:n}=s.id;return new R(w(t,n+e),s.length-e)}else{const t=s,{client:n,clock:i}=t.id;return new v(w(n,i+e),null,w(n,i+e-1),null,t.rightOrigin,t.parent,t.parentSub,t.content.splice(e))}},ut=(s,e=Ce,t=he)=>{if(s.length===1)return s[0];const n=s.map(h=>new e(Z(h)));let i=n.map(h=>new ts(h,!0)),r=null;const o=new t,c=new ss(o);for(;i=i.filter(d=>d.curr!==null),i.sort((d,f)=>{if(d.curr.id.client===f.curr.id.client){const g=d.curr.id.clock-f.curr.id.clock;return g===0?d.curr.constructor===f.curr.constructor?0:d.curr.constructor===R?1:-1:g}else return f.curr.id.client-d.curr.id.client}),i.length!==0;){const h=i[0],u=h.curr.id.client;if(r!==null){let d=h.curr,f=!1;for(;d!==null&&d.id.clock+d.length<=r.struct.id.clock+r.struct.length&&d.id.client>=r.struct.id.client;)d=h.next(),f=!0;if(d===null||d.id.client!==u||f&&d.id.clock>r.struct.id.clock+r.struct.length)continue;if(u!==r.struct.id.client)se(c,r.struct,r.offset),r={struct:d,offset:0},h.next();else if(r.struct.id.clock+r.struct.length<d.id.clock)if(r.struct.constructor===R)r.struct.length=d.id.clock+d.length-r.struct.id.clock;else{se(c,r.struct,r.offset);const g=d.id.clock-r.struct.id.clock-r.struct.length;r={struct:new R(w(u,r.struct.id.clock+r.struct.length),g),offset:0}}else{const g=r.struct.id.clock+r.struct.length-d.id.clock;g>0&&(r.struct.constructor===R?r.struct.length-=g:d=Qr(d,g)),r.struct.mergeWith(d)||(se(c,r.struct,r.offset),r={struct:d,offset:0},h.next())}}else r={struct:h.curr,offset:0},h.next();for(let d=h.curr;d!==null&&d.id.client===u&&d.id.clock===r.struct.id.clock+r.struct.length&&d.constructor!==R;d=h.next())se(c,r.struct,r.offset),r={struct:d,offset:0}}r!==null&&(se(c,r.struct,r.offset),r=null),ns(c);const a=n.map(h=>Gt(h)),l=Ir(a);return De(o,l),o.toUint8Array()},Zr=(s,e,t=Ce,n=he)=>{const i=rn(e),r=new n,o=new ss(r),c=new t(Z(s)),a=new ts(c,!1);for(;a.curr;){const h=a.curr,u=h.id.client,d=i.get(u)||0;if(a.curr.constructor===R){a.next();continue}if(h.id.clock+h.length>d)for(se(o,h,oe(d-h.id.clock,0)),a.next();a.curr&&a.curr.id.client===u;)se(o,a.curr,0),a.next();else for(;a.curr&&a.curr.id.client===u&&a.curr.id.clock+a.curr.length<=d;)a.next()}ns(o);const l=Gt(c);return De(r,l),r.toUint8Array()},bn=s=>{s.written>0&&(s.clientStructs.push({written:s.written,restEncoder:S(s.encoder.restEncoder)}),s.encoder.restEncoder=j(),s.written=0)},se=(s,e,t)=>{s.written>0&&s.currClient!==e.id.client&&bn(s),s.written===0&&(s.currClient=e.id.client,s.encoder.writeClient(e.id.client),p(s.encoder.restEncoder,e.id.clock+t)),e.write(s.encoder,t),s.written++},ns=s=>{bn(s);const e=s.encoder.restEncoder;p(e,s.clientStructs.length);for(let t=0;t<s.clientStructs.length;t++){const n=s.clientStructs[t];p(e,n.written),st(e,n.restEncoder)}},eo=(s,e,t,n)=>{const i=new t(Z(s)),r=new ts(i,!1),o=new n,c=new ss(o);for(let l=r.curr;l!==null;l=r.next())se(c,e(l),0);ns(c);const a=Gt(i);return De(o,a),o.toUint8Array()},to=s=>eo(s,Ti,Ce,Be),wn="You must not compute changes after the event-handler fired.";class dt{constructor(e,t){this.target=e,this.currentTarget=e,this.transaction=t,this._changes=null,this._keys=null,this._delta=null,this._path=null}get path(){return this._path||(this._path=so(this.currentTarget,this.target))}deletes(e){return Gs(this.transaction.deleteSet,e.id)}get keys(){if(this._keys===null){if(this.transaction.doc._transactionCleanups.length===0)throw X(wn);const e=new Map,t=this.target;this.transaction.changed.get(t).forEach(i=>{if(i!==null){const r=t._map.get(i);let o,c;if(this.adds(r)){let a=r.left;for(;a!==null&&this.adds(a);)a=a.left;if(this.deletes(r))if(a!==null&&this.deletes(a))o="delete",c=vt(a.content.getContent());else return;else a!==null&&this.deletes(a)?(o="update",c=vt(a.content.getContent())):(o="add",c=void 0)}else if(this.deletes(r))o="delete",c=vt(r.content.getContent());else return;e.set(i,{action:o,oldValue:c})}}),this._keys=e}return this._keys}get delta(){return this.changes.delta}adds(e){return e.id.clock>=(this.transaction.beforeState.get(e.id.client)||0)}get changes(){let e=this._changes;if(e===null){if(this.transaction.doc._transactionCleanups.length===0)throw X(wn);const t=this.target,n=re(),i=re(),r=[];if(e={added:n,deleted:i,delta:r,keys:this.keys},this.transaction.changed.get(t).has(null)){let c=null;const a=()=>{c&&r.push(c)};for(let l=t._start;l!==null;l=l.right)l.deleted?this.deletes(l)&&!this.adds(l)&&((c===null||c.delete===void 0)&&(a(),c={delete:0}),c.delete+=l.length,i.add(l)):this.adds(l)?((c===null||c.insert===void 0)&&(a(),c={insert:[]}),c.insert=c.insert.concat(l.content.getContent()),n.add(l)):((c===null||c.retain===void 0)&&(a(),c={retain:0}),c.retain+=l.length);c!==null&&c.retain===void 0&&a()}this._changes=e}return e}}const so=(s,e)=>{const t=[];for(;e._item!==null&&e!==s;){if(e._item.parentSub!==null)t.unshift(e._item.parentSub);else{let n=0,i=e._item.parent._start;for(;i!==e._item&&i!==null;)i.deleted||n++,i=i.right;t.unshift(n)}e=e._item.parent}return t},yn=80;let is=0;class no{constructor(e,t){e.marker=!0,this.p=e,this.index=t,this.timestamp=is++}}const io=s=>{s.timestamp=is++},_n=(s,e,t)=>{s.p.marker=!1,s.p=e,e.marker=!0,s.index=t,s.timestamp=is++},ro=(s,e,t)=>{if(s.length>=yn){const n=s.reduce((i,r)=>i.timestamp<r.timestamp?i:r);return _n(n,e,t),n}else{const n=new no(e,t);return s.push(n),n}},ft=(s,e)=>{if(s._start===null||e===0||s._searchMarker===null)return null;const t=s._searchMarker.length===0?null:s._searchMarker.reduce((r,o)=>et(e-r.index)<et(e-o.index)?r:o);let n=s._start,i=0;for(t!==null&&(n=t.p,i=t.index,io(t));n.right!==null&&i<e;){if(!n.deleted&&n.countable){if(e<i+n.length)break;i+=n.length}n=n.right}for(;n.left!==null&&i>e;)n=n.left,!n.deleted&&n.countable&&(i-=n.length);for(;n.left!==null&&n.left.id.client===n.id.client&&n.left.id.clock+n.left.length===n.id.clock;)n=n.left,!n.deleted&&n.countable&&(i-=n.length);return t!==null&&et(t.index-i)<n.parent.length/yn?(_n(t,n,i),t):ro(s._searchMarker,n,i)},Ve=(s,e,t)=>{for(let n=s.length-1;n>=0;n--){const i=s[n];if(t>0){let r=i.p;for(r.marker=!1;r&&(r.deleted||!r.countable);)r=r.left,r&&!r.deleted&&r.countable&&(i.index-=r.length);if(r===null||r.marker===!0){s.splice(n,1);continue}i.p=r,r.marker=!0}(e<i.index||t>0&&e===i.index)&&(i.index=oe(e,i.index+t))}},gt=(s,e,t)=>{const n=s,i=e.changedParentTypes;for(;K(i,s,()=>[]).push(t),s._item!==null;)s=s._item.parent;hn(n._eH,t,e)};class I{constructor(){this._item=null,this._map=new Map,this._start=null,this.doc=null,this._length=0,this._eH=cn(),this._dEH=cn(),this._searchMarker=null}get parent(){return this._item?this._item.parent:null}_integrate(e,t){this.doc=e,this._item=t}_copy(){throw B()}clone(){throw B()}_write(e){}get _first(){let e=this._start;for(;e!==null&&e.deleted;)e=e.right;return e}_callObserver(e,t){!e.local&&this._searchMarker&&(this._searchMarker.length=0)}observe(e){an(this._eH,e)}observeDeep(e){an(this._dEH,e)}unobserve(e){ln(this._eH,e)}unobserveDeep(e){ln(this._dEH,e)}toJSON(){}}const Sn=(s,e,t)=>{e<0&&(e=s._length+e),t<0&&(t=s._length+t);let n=t-e;const i=[];let r=s._start;for(;r!==null&&n>0;){if(r.countable&&!r.deleted){const o=r.content.getContent();if(o.length<=e)e-=o.length;else{for(let c=e;c<o.length&&n>0;c++)i.push(o[c]),n--;e=0}}r=r.right}return i},Dn=s=>{const e=[];let t=s._start;for(;t!==null;){if(t.countable&&!t.deleted){const n=t.content.getContent();for(let i=0;i<n.length;i++)e.push(n[i])}t=t.right}return e},He=(s,e)=>{let t=0,n=s._start;for(;n!==null;){if(n.countable&&!n.deleted){const i=n.content.getContent();for(let r=0;r<i.length;r++)e(i[r],t++,s)}n=n.right}},En=(s,e)=>{const t=[];return He(s,(n,i)=>{t.push(e(n,i,s))}),t},oo=s=>{let e=s._start,t=null,n=0;return{[Symbol.iterator](){return this},next:()=>{if(t===null){for(;e!==null&&e.deleted;)e=e.right;if(e===null)return{done:!0,value:void 0};t=e.content.getContent(),n=0,e=e.right}const i=t[n++];return t.length<=n&&(t=null),{done:!1,value:i}}}},Cn=(s,e)=>{const t=ft(s,e);let n=s._start;for(t!==null&&(n=t.p,e-=t.index);n!==null;n=n.right)if(!n.deleted&&n.countable){if(e<n.length)return n.content.getContent()[e];e-=n.length}},pt=(s,e,t,n)=>{let i=t;const r=s.doc,o=r.clientID,c=r.store,a=t===null?e._start:t.right;let l=[];const h=()=>{l.length>0&&(i=new v(w(o,x(c,o)),i,i&&i.lastId,a,a&&a.id,e,null,new ge(l)),i.integrate(s,0),l=[])};n.forEach(u=>{if(u===null)l.push(u);else switch(u.constructor){case Number:case Object:case Boolean:case Array:case String:l.push(u);break;default:switch(h(),u.constructor){case Uint8Array:case ArrayBuffer:i=new v(w(o,x(c,o)),i,i&&i.lastId,a,a&&a.id,e,null,new qe(new Uint8Array(u))),i.integrate(s,0);break;case Ee:i=new v(w(o,x(c,o)),i,i&&i.lastId,a,a&&a.id,e,null,new Ye(u)),i.integrate(s,0);break;default:if(u instanceof I)i=new v(w(o,x(c,o)),i,i&&i.lastId,a,a&&a.id,e,null,new P(u)),i.integrate(s,0);else throw new Error("Unexpected content type in insert operation")}}}),h()},vn=X("Length exceeded!"),An=(s,e,t,n)=>{if(t>e._length)throw vn;if(t===0)return e._searchMarker&&Ve(e._searchMarker,t,n.length),pt(s,e,null,n);const i=t,r=ft(e,t);let o=e._start;for(r!==null&&(o=r.p,t-=r.index,t===0&&(o=o.prev,t+=o&&o.countable&&!o.deleted?o.length:0));o!==null;o=o.right)if(!o.deleted&&o.countable){if(t<=o.length){t<o.length&&te(s,w(o.id.client,o.id.clock+t));break}t-=o.length}return e._searchMarker&&Ve(e._searchMarker,i,n.length),pt(s,e,o,n)},co=(s,e,t)=>{let i=(e._searchMarker||[]).reduce((r,o)=>o.index>r.index?o:r,{index:0,p:e._start}).p;if(i)for(;i.right;)i=i.right;return pt(s,e,i,t)},xn=(s,e,t,n)=>{if(n===0)return;const i=t,r=n,o=ft(e,t);let c=e._start;for(o!==null&&(c=o.p,t-=o.index);c!==null&&t>0;c=c.right)!c.deleted&&c.countable&&(t<c.length&&te(s,w(c.id.client,c.id.clock+t)),t-=c.length);for(;n>0&&c!==null;)c.deleted||(n<c.length&&te(s,w(c.id.client,c.id.clock+n)),c.delete(s),n-=c.length),c=c.right;if(n>0)throw vn;e._searchMarker&&Ve(e._searchMarker,i,-r+n)},kt=(s,e,t)=>{const n=e._map.get(t);n!==void 0&&n.delete(s)},rs=(s,e,t,n)=>{const i=e._map.get(t)||null,r=s.doc,o=r.clientID;let c;if(n==null)c=new ge([n]);else switch(n.constructor){case Number:case Object:case Boolean:case Array:case String:c=new ge([n]);break;case Uint8Array:c=new qe(n);break;case Ee:c=new Ye(n);break;default:if(n instanceof I)c=new P(n);else throw new Error("Unexpected content type")}new v(w(o,x(r.store,o)),i,i&&i.lastId,null,null,e,t,c).integrate(s,0)},os=(s,e)=>{const t=s._map.get(e);return t!==void 0&&!t.deleted?t.content.getContent()[t.length-1]:void 0},In=s=>{const e={};return s._map.forEach((t,n)=>{t.deleted||(e[n]=t.content.getContent()[t.length-1])}),e},Ln=(s,e)=>{const t=s._map.get(e);return t!==void 0&&!t.deleted},mt=s=>Ar(s.entries(),e=>!e[1].deleted);class ao extends dt{constructor(e,t){super(e,t),this._transaction=t}}class Ae extends I{constructor(){super(),this._prelimContent=[],this._searchMarker=[]}static from(e){const t=new Ae;return t.push(e),t}_integrate(e,t){super._integrate(e,t),this.insert(0,this._prelimContent),this._prelimContent=null}_copy(){return new Ae}clone(){const e=new Ae;return e.insert(0,this.toArray().map(t=>t instanceof I?t.clone():t)),e}get length(){return this._prelimContent===null?this._length:this._prelimContent.length}_callObserver(e,t){super._callObserver(e,t),gt(this,e,new ao(this,e))}insert(e,t){this.doc!==null?y(this.doc,n=>{An(n,this,e,t)}):this._prelimContent.splice(e,0,...t)}push(e){this.doc!==null?y(this.doc,t=>{co(t,this,e)}):this._prelimContent.push(...e)}unshift(e){this.insert(0,e)}delete(e,t=1){this.doc!==null?y(this.doc,n=>{xn(n,this,e,t)}):this._prelimContent.splice(e,t)}get(e){return Cn(this,e)}toArray(){return Dn(this)}slice(e=0,t=this.length){return Sn(this,e,t)}toJSON(){return this.map(e=>e instanceof I?e.toJSON():e)}map(e){return En(this,e)}forEach(e){He(this,e)}[Symbol.iterator](){return oo(this)}_write(e){e.writeTypeRef(To)}}const lo=s=>new Ae;class ho extends dt{constructor(e,t,n){super(e,t),this.keysChanged=n}}class ue extends I{constructor(e){super(),this._prelimContent=null,e===void 0?this._prelimContent=new Map:this._prelimContent=new Map(e)}_integrate(e,t){super._integrate(e,t),this._prelimContent.forEach((n,i)=>{this.set(i,n)}),this._prelimContent=null}_copy(){return new ue}clone(){const e=new ue;return this.forEach((t,n)=>{e.set(n,t instanceof I?t.clone():t)}),e}_callObserver(e,t){gt(this,e,new ho(this,e,t))}toJSON(){const e={};return this._map.forEach((t,n)=>{if(!t.deleted){const i=t.content.getContent()[t.length-1];e[n]=i instanceof I?i.toJSON():i}}),e}get size(){return[...mt(this._map)].length}keys(){return Yt(mt(this._map),e=>e[0])}values(){return Yt(mt(this._map),e=>e[1].content.getContent()[e[1].length-1])}entries(){return Yt(mt(this._map),e=>[e[0],e[1].content.getContent()[e[1].length-1]])}forEach(e){this._map.forEach((t,n)=>{t.deleted||e(t.content.getContent()[t.length-1],n,this)})}[Symbol.iterator](){return this.entries()}delete(e){this.doc!==null?y(this.doc,t=>{kt(t,this,e)}):this._prelimContent.delete(e)}set(e,t){return this.doc!==null?y(this.doc,n=>{rs(n,this,e,t)}):this._prelimContent.set(e,t),t}get(e){return os(this,e)}has(e){return Ln(this,e)}clear(){this.doc!==null?y(this.doc,e=>{this.forEach(function(t,n,i){kt(e,i,n)})}):this._prelimContent.clear()}_write(e){e.writeTypeRef(Uo)}}const uo=s=>new ue,ne=(s,e)=>s===e||typeof s=="object"&&typeof e=="object"&&s&&e&&Mi(s,e);class cs{constructor(e,t,n,i){this.left=e,this.right=t,this.index=n,this.currentAttributes=i}forward(){switch(this.right===null&&F(),this.right.content.constructor){case C:this.right.deleted||xe(this.currentAttributes,this.right.content);break;default:this.right.deleted||(this.index+=this.right.length);break}this.left=this.right,this.right=this.right.right}}const jn=(s,e,t)=>{for(;e.right!==null&&t>0;){switch(e.right.content.constructor){case C:e.right.deleted||xe(e.currentAttributes,e.right.content);break;default:e.right.deleted||(t<e.right.length&&te(s,w(e.right.id.client,e.right.id.clock+t)),e.index+=e.right.length,t-=e.right.length);break}e.left=e.right,e.right=e.right.right}return e},bt=(s,e,t)=>{const n=new Map,i=ft(e,t);if(i){const r=new cs(i.p.left,i.p,i.index,n);return jn(s,r,t-i.index)}else{const r=new cs(null,e._start,0,n);return jn(s,r,t)}},Mn=(s,e,t,n)=>{for(;t.right!==null&&(t.right.deleted===!0||t.right.content.constructor===C&&ne(n.get(t.right.content.key),t.right.content.value));)t.right.deleted||n.delete(t.right.content.key),t.forward();const i=s.doc,r=i.clientID;n.forEach((o,c)=>{const a=t.left,l=t.right,h=new v(w(r,x(i.store,r)),a,a&&a.lastId,l,l&&l.id,e,null,new C(c,o));h.integrate(s,0),t.right=h,t.forward()})},xe=(s,e)=>{const{key:t,value:n}=e;n===null?s.delete(t):s.set(t,n)},Tn=(s,e)=>{for(;s.right!==null;){if(!(s.right.deleted||s.right.content.constructor===C&&ne(e[s.right.content.key]||null,s.right.content.value)))break;s.forward()}},Un=(s,e,t,n)=>{const i=s.doc,r=i.clientID,o=new Map;for(const c in n){const a=n[c],l=t.currentAttributes.get(c)||null;if(!ne(l,a)){o.set(c,l);const{left:h,right:u}=t;t.right=new v(w(r,x(i.store,r)),h,h&&h.lastId,u,u&&u.id,e,null,new C(c,a)),t.right.integrate(s,0),t.forward()}}return o},as=(s,e,t,n,i)=>{t.currentAttributes.forEach((d,f)=>{i[f]===void 0&&(i[f]=null)});const r=s.doc,o=r.clientID;Tn(t,i);const c=Un(s,e,t,i),a=n.constructor===String?new H(n):n instanceof I?new P(n):new fe(n);let{left:l,right:h,index:u}=t;e._searchMarker&&Ve(e._searchMarker,t.index,a.getLength()),h=new v(w(o,x(r.store,o)),l,l&&l.lastId,h,h&&h.id,e,null,a),h.integrate(s,0),t.right=h,t.index=u,t.forward(),Mn(s,e,t,c)},zn=(s,e,t,n,i)=>{const r=s.doc,o=r.clientID;Tn(t,i);const c=Un(s,e,t,i);e:for(;t.right!==null&&(n>0||c.size>0&&(t.right.deleted||t.right.content.constructor===C));){if(!t.right.deleted)switch(t.right.content.constructor){case C:{const{key:a,value:l}=t.right.content,h=i[a];if(h!==void 0){if(ne(h,l))c.delete(a);else{if(n===0)break e;c.set(a,l)}t.right.delete(s)}else t.currentAttributes.set(a,l);break}default:n<t.right.length&&te(s,w(t.right.id.client,t.right.id.clock+n)),n-=t.right.length;break}t.forward()}if(n>0){let a="";for(;n>0;n--)a+=`
|
|
2
|
-
`;t.right=new v(w(o,
|
|
3
|
-
`?o.insert.slice(0,-1):o.insert;(typeof c!="string"||c.length>0)&&as(n,this,i,c,o.attributes||{})}else o.retain!==void 0?zn(n,this,i,o.retain,o.attributes||{}):o.delete!==void 0&&Rn(n,i,o.delete)}}):this._pending.push(()=>this.applyDelta(e))}toDelta(e,t,n){const i=[],r=new Map,o=this.doc;let c="",a=this._start;function l(){if(c.length>0){const u={};let d=!1;r.forEach((g,m)=>{d=!0,u[m]=g});const f={insert:c};d&&(f.attributes=u),i.push(f),c=""}}const h=()=>{for(;a!==null;){if(Fe(a,e)||t!==void 0&&Fe(a,t))switch(a.content.constructor){case H:{const u=r.get("ychange");e!==void 0&&!Fe(a,e)?(u===void 0||u.user!==a.id.client||u.type!=="removed")&&(l(),r.set("ychange",n?n("removed",a.id):{type:"removed"})):t!==void 0&&!Fe(a,t)?(u===void 0||u.user!==a.id.client||u.type!=="added")&&(l(),r.set("ychange",n?n("added",a.id):{type:"added"})):u!==void 0&&(l(),r.delete("ychange")),c+=a.content.str;break}case P:case fe:{l();const u={insert:a.content.getContent()[0]};if(r.size>0){const d={};u.attributes=d,r.forEach((f,g)=>{d[g]=f})}i.push(u);break}case C:Fe(a,e)&&(l(),xe(r,a.content));break}a=a.right}l()};return e||t?y(o,u=>{e&&Qt(u,e),t&&Qt(u,t),h()},"cleanup"):h(),i}insert(e,t,n){if(t.length<=0)return;const i=this.doc;i!==null?y(i,r=>{const o=bt(r,this,e);n||(n={},o.currentAttributes.forEach((c,a)=>{n[a]=c})),as(r,this,o,t,n)}):this._pending.push(()=>this.insert(e,t,n))}insertEmbed(e,t,n={}){const i=this.doc;i!==null?y(i,r=>{const o=bt(r,this,e);as(r,this,o,t,n)}):this._pending.push(()=>this.insertEmbed(e,t,n))}delete(e,t){if(t===0)return;const n=this.doc;n!==null?y(n,i=>{Rn(i,bt(i,this,e),t)}):this._pending.push(()=>this.delete(e,t))}format(e,t,n){if(t===0)return;const i=this.doc;i!==null?y(i,r=>{const o=bt(r,this,e);o.right!==null&&zn(r,this,o,t,n)}):this._pending.push(()=>this.format(e,t,n))}removeAttribute(e){this.doc!==null?y(this.doc,t=>{kt(t,this,e)}):this._pending.push(()=>this.removeAttribute(e))}setAttribute(e,t){this.doc!==null?y(this.doc,n=>{rs(n,this,e,t)}):this._pending.push(()=>this.setAttribute(e,t))}getAttribute(e){return os(this,e)}getAttributes(){return In(this)}_write(e){e.writeTypeRef(zo)}}const mo=s=>new Ie;class ls{constructor(e,t=()=>!0){this._filter=t,this._root=e,this._currentNode=e._start,this._firstCall=!0}[Symbol.iterator](){return this}next(){let e=this._currentNode,t=e&&e.content&&e.content.type;if(e!==null&&(!this._firstCall||e.deleted||!this._filter(t)))do if(t=e.content.type,!e.deleted&&(t.constructor===$e||t.constructor===de)&&t._start!==null)e=t._start;else for(;e!==null;)if(e.right!==null){e=e.right;break}else e.parent===this._root?e=null:e=e.parent._item;while(e!==null&&(e.deleted||!this._filter(e.content.type)));return this._firstCall=!1,e===null?{value:void 0,done:!0}:(this._currentNode=e,{value:e.content.type,done:!1})}}class de extends I{constructor(){super(),this._prelimContent=[]}get firstChild(){const e=this._first;return e?e.content.getContent()[0]:null}_integrate(e,t){super._integrate(e,t),this.insert(0,this._prelimContent),this._prelimContent=null}_copy(){return new de}clone(){const e=new de;return e.insert(0,this.toArray().map(t=>t instanceof I?t.clone():t)),e}get length(){return this._prelimContent===null?this._length:this._prelimContent.length}createTreeWalker(e){return new ls(this,e)}querySelector(e){e=e.toUpperCase();const n=new ls(this,i=>i.nodeName&&i.nodeName.toUpperCase()===e).next();return n.done?null:n.value}querySelectorAll(e){return e=e.toUpperCase(),Q(new ls(this,t=>t.nodeName&&t.nodeName.toUpperCase()===e))}_callObserver(e,t){gt(this,e,new yo(this,t,e))}toString(){return En(this,e=>e.toString()).join("")}toJSON(){return this.toString()}toDOM(e=document,t={},n){const i=e.createDocumentFragment();return n!==void 0&&n._createAssociation(i,this),He(this,r=>{i.insertBefore(r.toDOM(e,t,n),null)}),i}insert(e,t){this.doc!==null?y(this.doc,n=>{An(n,this,e,t)}):this._prelimContent.splice(e,0,...t)}insertAfter(e,t){if(this.doc!==null)y(this.doc,n=>{const i=e&&e instanceof I?e._item:e;pt(n,this,i,t)});else{const n=this._prelimContent,i=e===null?0:n.findIndex(r=>r===e)+1;if(i===0&&e!==null)throw X("Reference item not found");n.splice(i,0,...t)}}delete(e,t=1){this.doc!==null?y(this.doc,n=>{xn(n,this,e,t)}):this._prelimContent.splice(e,t)}toArray(){return Dn(this)}push(e){this.insert(this.length,e)}unshift(e){this.insert(0,e)}get(e){return Cn(this,e)}slice(e=0,t=this.length){return Sn(this,e,t)}forEach(e){He(this,e)}_write(e){e.writeTypeRef(Ro)}}const bo=s=>new de;class $e extends de{constructor(e="UNDEFINED"){super(),this.nodeName=e,this._prelimAttrs=new Map}get nextSibling(){const e=this._item?this._item.next:null;return e?e.content.type:null}get prevSibling(){const e=this._item?this._item.prev:null;return e?e.content.type:null}_integrate(e,t){super._integrate(e,t),this._prelimAttrs.forEach((n,i)=>{this.setAttribute(i,n)}),this._prelimAttrs=null}_copy(){return new $e(this.nodeName)}clone(){const e=new $e(this.nodeName),t=this.getAttributes();return xi(t,(n,i)=>{typeof n=="string"&&e.setAttribute(i,n)}),e.insert(0,this.toArray().map(n=>n instanceof I?n.clone():n)),e}toString(){const e=this.getAttributes(),t=[],n=[];for(const c in e)n.push(c);n.sort();const i=n.length;for(let c=0;c<i;c++){const a=n[c];t.push(a+'="'+e[a]+'"')}const r=this.nodeName.toLocaleLowerCase(),o=t.length>0?" "+t.join(" "):"";return`<${r}${o}>${super.toString()}</${r}>`}removeAttribute(e){this.doc!==null?y(this.doc,t=>{kt(t,this,e)}):this._prelimAttrs.delete(e)}setAttribute(e,t){this.doc!==null?y(this.doc,n=>{rs(n,this,e,t)}):this._prelimAttrs.set(e,t)}getAttribute(e){return os(this,e)}hasAttribute(e){return Ln(this,e)}getAttributes(){return In(this)}toDOM(e=document,t={},n){const i=e.createElement(this.nodeName),r=this.getAttributes();for(const o in r){const c=r[o];typeof c=="string"&&i.setAttribute(o,c)}return He(this,o=>{i.appendChild(o.toDOM(e,t,n))}),n!==void 0&&n._createAssociation(i,this),i}_write(e){e.writeTypeRef(Oo),e.writeKey(this.nodeName)}}const wo=s=>new $e(s.readKey());class yo extends dt{constructor(e,t,n){super(e,n),this.childListChanged=!1,this.attributesChanged=new Set,t.forEach(i=>{i===null?this.childListChanged=!0:this.attributesChanged.add(i)})}}class wt extends ue{constructor(e){super(),this.hookName=e}_copy(){return new wt(this.hookName)}clone(){const e=new wt(this.hookName);return this.forEach((t,n)=>{e.set(n,t)}),e}toDOM(e=document,t={},n){const i=t[this.hookName];let r;return i!==void 0?r=i.createDom(this):r=document.createElement(this.hookName),r.setAttribute("data-yjs-hook",this.hookName),n!==void 0&&n._createAssociation(r,this),r}_write(e){e.writeTypeRef(No),e.writeKey(this.hookName)}}const _o=s=>new wt(s.readKey());class yt extends Ie{get nextSibling(){const e=this._item?this._item.next:null;return e?e.content.type:null}get prevSibling(){const e=this._item?this._item.prev:null;return e?e.content.type:null}_copy(){return new yt}clone(){const e=new yt;return e.applyDelta(this.toDelta()),e}toDOM(e=document,t,n){const i=e.createTextNode(this.toString());return n!==void 0&&n._createAssociation(i,this),i}toString(){return this.toDelta().map(e=>{const t=[];for(const i in e.attributes){const r=[];for(const o in e.attributes[i])r.push({key:o,value:e.attributes[i][o]});r.sort((o,c)=>o.key<c.key?-1:1),t.push({nodeName:i,attrs:r})}t.sort((i,r)=>i.nodeName<r.nodeName?-1:1);let n="";for(let i=0;i<t.length;i++){const r=t[i];n+=`<${r.nodeName}`;for(let o=0;o<r.attrs.length;o++){const c=r.attrs[o];n+=` ${c.key}="${c.value}"`}n+=">"}n+=e.insert;for(let i=t.length-1;i>=0;i--)n+=`</${t[i].nodeName}>`;return n}).join("")}toJSON(){return this.toString()}_write(e){e.writeTypeRef(Bo)}}const So=s=>new yt;class hs{constructor(e,t){this.id=e,this.length=t}get deleted(){throw B()}mergeWith(e){return!1}write(e,t,n){throw B()}integrate(e,t){throw B()}}const Do=0;class O extends hs{get deleted(){return!0}delete(){}mergeWith(e){return this.constructor!==e.constructor?!1:(this.length+=e.length,!0)}integrate(e,t){t>0&&(this.id.clock+=t,this.length-=t),dn(e.doc.store,this)}write(e,t){e.writeInfo(Do),e.writeLen(this.length-t)}getMissing(e,t){return null}}class qe{constructor(e){this.content=e}getLength(){return 1}getContent(){return[this.content]}isCountable(){return!0}copy(){return new qe(this.content)}splice(e){throw B()}mergeWith(e){return!1}integrate(e,t){}delete(e){}gc(e){}write(e,t){e.writeBuf(this.content)}getRef(){return 3}}const Eo=s=>new qe(s.readBuf());class Ke{constructor(e){this.len=e}getLength(){return this.len}getContent(){return[]}isCountable(){return!1}copy(){return new Ke(this.len)}splice(e){const t=new Ke(this.len-e);return this.len=e,t}mergeWith(e){return this.len+=e.len,!0}integrate(e,t){ct(e.deleteSet,t.id.client,t.id.clock,this.len),t.markDeleted()}delete(e){}gc(e){}write(e,t){e.writeLen(this.len-t)}getRef(){return 1}}const Co=s=>new Ke(s.readLen()),Nn=(s,e)=>new Ee({guid:s,...e,shouldLoad:e.shouldLoad||e.autoLoad||!1});class Ye{constructor(e){e._item&&console.error("This document was already integrated as a sub-document. You should create a second instance instead with the same guid."),this.doc=e;const t={};this.opts=t,e.gc||(t.gc=!1),e.autoLoad&&(t.autoLoad=!0),e.meta!==null&&(t.meta=e.meta)}getLength(){return 1}getContent(){return[this.doc]}isCountable(){return!0}copy(){return new Ye(Nn(this.doc.guid,this.opts))}splice(e){throw B()}mergeWith(e){return!1}integrate(e,t){this.doc._item=t,e.subdocsAdded.add(this.doc),this.doc.shouldLoad&&e.subdocsLoaded.add(this.doc)}delete(e){e.subdocsAdded.has(this.doc)?e.subdocsAdded.delete(this.doc):e.subdocsRemoved.add(this.doc)}gc(e){}write(e,t){e.writeString(this.doc.guid),e.writeAny(this.opts)}getRef(){return 9}}const vo=s=>new Ye(Nn(s.readString(),s.readAny()));class fe{constructor(e){this.embed=e}getLength(){return 1}getContent(){return[this.embed]}isCountable(){return!0}copy(){return new fe(this.embed)}splice(e){throw B()}mergeWith(e){return!1}integrate(e,t){}delete(e){}gc(e){}write(e,t){e.writeJSON(this.embed)}getRef(){return 5}}const Ao=s=>new fe(s.readJSON());class C{constructor(e,t){this.key=e,this.value=t}getLength(){return 1}getContent(){return[]}isCountable(){return!1}copy(){return new C(this.key,this.value)}splice(e){throw B()}mergeWith(e){return!1}integrate(e,t){const n=t.parent;n._searchMarker=null,n._hasFormatting=!0}delete(e){}gc(e){}write(e,t){e.writeKey(this.key),e.writeJSON(this.value)}getRef(){return 6}}const xo=s=>new C(s.readKey(),s.readJSON());class _t{constructor(e){this.arr=e}getLength(){return this.arr.length}getContent(){return this.arr}isCountable(){return!0}copy(){return new _t(this.arr)}splice(e){const t=new _t(this.arr.slice(e));return this.arr=this.arr.slice(0,e),t}mergeWith(e){return this.arr=this.arr.concat(e.arr),!0}integrate(e,t){}delete(e){}gc(e){}write(e,t){const n=this.arr.length;e.writeLen(n-t);for(let i=t;i<n;i++){const r=this.arr[i];e.writeString(r===void 0?"undefined":JSON.stringify(r))}}getRef(){return 2}}const Io=s=>{const e=s.readLen(),t=[];for(let n=0;n<e;n++){const i=s.readString();i==="undefined"?t.push(void 0):t.push(JSON.parse(i))}return new _t(t)};class ge{constructor(e){this.arr=e}getLength(){return this.arr.length}getContent(){return this.arr}isCountable(){return!0}copy(){return new ge(this.arr)}splice(e){const t=new ge(this.arr.slice(e));return this.arr=this.arr.slice(0,e),t}mergeWith(e){return this.arr=this.arr.concat(e.arr),!0}integrate(e,t){}delete(e){}gc(e){}write(e,t){const n=this.arr.length;e.writeLen(n-t);for(let i=t;i<n;i++){const r=this.arr[i];e.writeAny(r)}}getRef(){return 8}}const Lo=s=>{const e=s.readLen(),t=[];for(let n=0;n<e;n++)t.push(s.readAny());return new ge(t)};class H{constructor(e){this.str=e}getLength(){return this.str.length}getContent(){return this.str.split("")}isCountable(){return!0}copy(){return new H(this.str)}splice(e){const t=new H(this.str.slice(e));this.str=this.str.slice(0,e);const n=this.str.charCodeAt(e-1);return n>=55296&&n<=56319&&(this.str=this.str.slice(0,e-1)+"�",t.str="�"+t.str.slice(1)),t}mergeWith(e){return this.str+=e.str,!0}integrate(e,t){}delete(e){}gc(e){}write(e,t){e.writeString(t===0?this.str:this.str.slice(t))}getRef(){return 4}}const jo=s=>new H(s.readString()),Mo=[lo,uo,mo,wo,bo,_o,So],To=0,Uo=1,zo=2,Oo=3,Ro=4,No=5,Bo=6;class P{constructor(e){this.type=e}getLength(){return 1}getContent(){return[this.type]}isCountable(){return!0}copy(){return new P(this.type._copy())}splice(e){throw B()}mergeWith(e){return!1}integrate(e,t){this.type._integrate(e.doc,t)}delete(e){let t=this.type._start;for(;t!==null;)t.deleted?t.id.clock<(e.beforeState.get(t.id.client)||0)&&e._mergeStructs.push(t):t.delete(e),t=t.right;this.type._map.forEach(n=>{n.deleted?n.id.clock<(e.beforeState.get(n.id.client)||0)&&e._mergeStructs.push(n):n.delete(e)}),e.changed.delete(this.type)}gc(e){let t=this.type._start;for(;t!==null;)t.gc(e,!0),t=t.right;this.type._start=null,this.type._map.forEach(n=>{for(;n!==null;)n.gc(e,!0),n=n.left}),this.type._map=new Map}write(e,t){this.type._write(e)}getRef(){return 7}}const Fo=s=>new P(Mo[s.readTypeRef()](s)),St=(s,e,t)=>{const{client:n,clock:i}=e.id,r=new v(w(n,i+t),e,w(n,i+t-1),e.right,e.rightOrigin,e.parent,e.parentSub,e.content.splice(t));return e.deleted&&r.markDeleted(),e.keep&&(r.keep=!0),e.redone!==null&&(r.redone=w(e.redone.client,e.redone.clock+t)),e.right=r,r.right!==null&&(r.right.left=r),s._mergeStructs.push(r),r.parentSub!==null&&r.right===null&&r.parent._map.set(r.parentSub,r),e.length=t,r};class v extends hs{constructor(e,t,n,i,r,o,c,a){super(e,a.getLength()),this.origin=n,this.left=t,this.right=i,this.rightOrigin=r,this.parent=o,this.parentSub=c,this.redone=null,this.content=a,this.info=this.content.isCountable()?js:0}set marker(e){(this.info&Tt)>0!==e&&(this.info^=Tt)}get marker(){return(this.info&Tt)>0}get keep(){return(this.info&Ls)>0}set keep(e){this.keep!==e&&(this.info^=Ls)}get countable(){return(this.info&js)>0}get deleted(){return(this.info&Mt)>0}set deleted(e){this.deleted!==e&&(this.info^=Mt)}markDeleted(){this.info|=Mt}getMissing(e,t){if(this.origin&&this.origin.client!==this.id.client&&this.origin.clock>=x(t,this.origin.client))return this.origin.client;if(this.rightOrigin&&this.rightOrigin.client!==this.id.client&&this.rightOrigin.clock>=x(t,this.rightOrigin.client))return this.rightOrigin.client;if(this.parent&&this.parent.constructor===ve&&this.id.client!==this.parent.client&&this.parent.clock>=x(t,this.parent.client))return this.parent.client;if(this.origin&&(this.left=fn(e,t,this.origin),this.origin=this.left.lastId),this.rightOrigin&&(this.right=te(e,this.rightOrigin),this.rightOrigin=this.right.id),(this.left&&this.left.constructor===O||this.right&&this.right.constructor===O)&&(this.parent=null),!this.parent)this.left&&this.left.constructor===v&&(this.parent=this.left.parent,this.parentSub=this.left.parentSub),this.right&&this.right.constructor===v&&(this.parent=this.right.parent,this.parentSub=this.right.parentSub);else if(this.parent.constructor===ve){const n=Zt(t,this.parent);n.constructor===O?this.parent=null:this.parent=n.content.type}return null}integrate(e,t){if(t>0&&(this.id.clock+=t,this.left=fn(e,e.doc.store,w(this.id.client,this.id.clock-1)),this.origin=this.left.lastId,this.content=this.content.splice(t),this.length-=t),this.parent){if(!this.left&&(!this.right||this.right.left!==null)||this.left&&this.left.right!==this.right){let n=this.left,i;if(n!==null)i=n.right;else if(this.parentSub!==null)for(i=this.parent._map.get(this.parentSub)||null;i!==null&&i.left!==null;)i=i.left;else i=this.parent._start;const r=new Set,o=new Set;for(;i!==null&&i!==this.right;){if(o.add(i),r.add(i),at(this.origin,i.origin)){if(i.id.client<this.id.client)n=i,r.clear();else if(at(this.rightOrigin,i.rightOrigin))break}else if(i.origin!==null&&o.has(Zt(e.doc.store,i.origin)))r.has(Zt(e.doc.store,i.origin))||(n=i,r.clear());else break;i=i.right}this.left=n}if(this.left!==null){const n=this.left.right;this.right=n,this.left.right=this}else{let n;if(this.parentSub!==null)for(n=this.parent._map.get(this.parentSub)||null;n!==null&&n.left!==null;)n=n.left;else n=this.parent._start,this.parent._start=this;this.right=n}this.right!==null?this.right.left=this:this.parentSub!==null&&(this.parent._map.set(this.parentSub,this),this.left!==null&&this.left.delete(e)),this.parentSub===null&&this.countable&&!this.deleted&&(this.parent._length+=this.length),dn(e.doc.store,this),this.content.integrate(e,this),kn(e,this.parent,this.parentSub),(this.parent._item!==null&&this.parent._item.deleted||this.parentSub!==null&&this.right!==null)&&this.delete(e)}else new O(this.id,this.length).integrate(e,0)}get next(){let e=this.right;for(;e!==null&&e.deleted;)e=e.right;return e}get prev(){let e=this.left;for(;e!==null&&e.deleted;)e=e.left;return e}get lastId(){return this.length===1?this.id:w(this.id.client,this.id.clock+this.length-1)}mergeWith(e){if(this.constructor===e.constructor&&at(e.origin,this.lastId)&&this.right===e&&at(this.rightOrigin,e.rightOrigin)&&this.id.client===e.id.client&&this.id.clock+this.length===e.id.clock&&this.deleted===e.deleted&&this.redone===null&&e.redone===null&&this.content.constructor===e.content.constructor&&this.content.mergeWith(e.content)){const t=this.parent._searchMarker;return t&&t.forEach(n=>{n.p===e&&(n.p=this,!this.deleted&&this.countable&&(n.index-=this.length))}),e.keep&&(this.keep=!0),this.right=e.right,this.right!==null&&(this.right.left=this),this.length+=e.length,!0}return!1}delete(e){if(!this.deleted){const t=this.parent;this.countable&&this.parentSub===null&&(t._length-=this.length),this.markDeleted(),ct(e.deleteSet,this.id.client,this.id.clock,this.length),kn(e,t,this.parentSub),this.content.delete(e)}}gc(e,t){if(!this.deleted)throw F();this.content.gc(e),t?Yr(e,this,new O(this.id,this.length)):this.content=new Ke(this.length)}write(e,t){const n=t>0?w(this.id.client,this.id.clock+t-1):this.origin,i=this.rightOrigin,r=this.parentSub,o=this.content.getRef()&tt|(n===null?0:T)|(i===null?0:J)|(r===null?0:Ue);if(e.writeInfo(o),n!==null&&e.writeLeftID(n),i!==null&&e.writeRightID(i),n===null&&i===null){const c=this.parent;if(c._item!==void 0){const a=c._item;if(a===null){const l=Kr(c);e.writeParentInfo(!0),e.writeString(l)}else e.writeParentInfo(!1),e.writeLeftID(a.id)}else c.constructor===String?(e.writeParentInfo(!0),e.writeString(c)):c.constructor===ve?(e.writeParentInfo(!1),e.writeLeftID(c)):F();r!==null&&e.writeString(r)}this.content.write(e,t)}}const Bn=(s,e)=>Vo[e&tt](s),Vo=[()=>{F()},Co,Io,Eo,jo,Ao,xo,Fo,Lo,vo,()=>{F()}],Ho=10;class R extends hs{get deleted(){return!0}delete(){}mergeWith(e){return this.constructor!==e.constructor?!1:(this.length+=e.length,!0)}integrate(e,t){F()}write(e,t){e.writeInfo(Ho),p(e.restEncoder,this.length-t)}getMissing(e,t){return null}}const Fn=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:{},Vn="__ $YJS$ __";Fn[Vn]===!0&&console.error("Yjs was already imported. This breaks constructor checks and will lead to issues! - https://github.com/yjs/yjs/issues/438"),Fn[Vn]=!0;const Hn=0,us=1,$n=2,ds=(s,e)=>{p(s,Hn);const t=$r(e);D(s,t)},qn=(s,e,t)=>{p(s,us),D(s,Pt(e,t))},$o=(s,e,t)=>qn(e,t,M(s)),Kn=(s,e,t)=>{try{nn(e,M(s),t)}catch(n){console.error("Caught error while handling a Yjs update",n)}},qo=(s,e)=>{p(s,$n),D(s,e)},Ko=Kn,Yo=(s,e,t,n)=>{const i=k(s);switch(i){case Hn:$o(s,e,t);break;case us:Kn(s,t,n);break;case $n:Ko(s,t,n);break;default:throw new Error("Unknown message type")}return i},Jo=0,Xo=(s,e,t)=>{switch(k(s)){case Jo:t(e,ee(s))}},fs=3e4;class Go extends ot{constructor(e){super(),this.doc=e,this.clientID=e.clientID,this.states=new Map,this.meta=new Map,this._checkInterval=setInterval(()=>{const t=le();this.getLocalState()!==null&&fs/2<=t-this.meta.get(this.clientID).lastUpdated&&this.setLocalState(this.getLocalState());const n=[];this.meta.forEach((i,r)=>{r!==this.clientID&&fs<=t-i.lastUpdated&&this.states.has(r)&&n.push(r)}),n.length>0&&gs(this,n,"timeout")},Y(fs/10)),e.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(e){const t=this.clientID,n=this.meta.get(t),i=n===void 0?0:n.clock+1,r=this.states.get(t);e===null?this.states.delete(t):this.states.set(t,e),this.meta.set(t,{clock:i,lastUpdated:le()});const o=[],c=[],a=[],l=[];e===null?l.push(t):r==null?e!=null&&o.push(t):(c.push(t),Te(r,e)||a.push(t)),(o.length>0||a.length>0||l.length>0)&&this.emit("change",[{added:o,updated:a,removed:l},"local"]),this.emit("update",[{added:o,updated:c,removed:l},"local"])}setLocalStateField(e,t){const n=this.getLocalState();n!==null&&this.setLocalState({...n,[e]:t})}getStates(){return this.states}}const gs=(s,e,t)=>{const n=[];for(let i=0;i<e.length;i++){const r=e[i];if(s.states.has(r)){if(s.states.delete(r),r===s.clientID){const o=s.meta.get(r);s.meta.set(r,{clock:o.clock+1,lastUpdated:le()})}n.push(r)}}n.length>0&&(s.emit("change",[{added:[],updated:[],removed:n},t]),s.emit("update",[{added:[],updated:[],removed:n},t]))},Je=(s,e,t=s.states)=>{const n=e.length,i=j();p(i,n);for(let r=0;r<n;r++){const o=e[r],c=t.get(o)||null,a=s.meta.get(o).clock;p(i,o),p(i,a),ae(i,JSON.stringify(c))}return S(i)},Wo=(s,e,t)=>{const n=Z(e),i=le(),r=[],o=[],c=[],a=[],l=k(n);for(let h=0;h<l;h++){const u=k(n);let d=k(n);const f=JSON.parse(ee(n)),g=s.meta.get(u),m=s.states.get(u),U=g===void 0?0:g.clock;(U<d||U===d&&f===null&&s.states.has(u))&&(f===null?u===s.clientID&&s.getLocalState()!=null?d++:s.states.delete(u):s.states.set(u,f),s.meta.set(u,{clock:d,lastUpdated:i}),g===void 0&&f!==null?r.push(u):g!==void 0&&f===null?a.push(u):f!==null&&(Te(f,m)||c.push(u),o.push(u)))}(r.length>0||c.length>0||a.length>0)&&s.emit("change",[{added:r,updated:c,removed:a},t]),(r.length>0||o.length>0||a.length>0)&&s.emit("update",[{added:r,updated:o,removed:a},t])},Po=s=>Ii(s,(e,t)=>`${encodeURIComponent(t)}=${encodeURIComponent(e)}`).join("&");var pe=0,Yn=3,Le=1,Qo=2;function Zo(s,e){if(!s)throw new Error(e)}var Xe=[];Xe[pe]=(s,e,t,n,i)=>{p(s,pe);const r=Yo(e,s,t.doc,t);n&&r===us&&!t.synced&&(t.synced=!0)},Xe[Yn]=(s,e,t,n,i)=>{p(s,Le),D(s,Je(t.awareness,Array.from(t.awareness.getStates().keys())))},Xe[Le]=(s,e,t,n,i)=>{Wo(t.awareness,M(e),t)},Xe[Qo]=(s,e,t,n,i)=>{Xo(e,t.doc,(r,o)=>ec(t,o))};var Jn=3e4;function ec(s,e){console.warn(`Permission denied to access ${s.url}.
|
|
4
|
-
${e}`)}function Xn(s,e,t){const n=Z(e),i=j(),r=k(n),o=s.messageHandlers[r];return o?o(i,n,s,t,r):console.error("Unable to compute message"),i}function Gn(s){if(s.shouldConnect&&s.ws===null){const e=new s._WS(s.url);e.binaryType="arraybuffer",s.ws=e,s.wsconnecting=!0,s.wsconnected=!1,s.synced=!1,e.onmessage=t=>{if(t.data==="ping"){e.send("pong");return}s.wsLastMessageReceived=le();const n=Xn(s,new Uint8Array(t.data),!0);zt(n)>1&&e.send(S(n))},e.onerror=t=>{s.emit("connection-error",[t,s])},e.onclose=t=>{s.emit("connection-close",[t,s]),s.ws=null,s.wsconnecting=!1,s.wsconnected?(s.wsconnected=!1,s.synced=!1,gs(s.awareness,Array.from(s.awareness.getStates().keys()).filter(n=>n!==s.doc.clientID),s),s.emit("status",[{status:"disconnected"}])):s.wsUnsuccessfulReconnects++,setTimeout(Gn,jt(Ni(2,s.wsUnsuccessfulReconnects)*100,s.maxBackoffTime),s)},e.onopen=()=>{s.wsLastMessageReceived=le(),s.wsconnecting=!1,s.wsconnected=!0,s.wsUnsuccessfulReconnects=0,s.emit("status",[{status:"connected"}]);const t=j();if(p(t,pe),ds(t,s.doc),e.send(S(t)),s.awareness.getLocalState()!==null){const n=j();p(n,Le),D(n,Je(s.awareness,[s.doc.clientID])),e.send(S(n))}},s.emit("status",[{status:"connecting"}])}}function ps(s,e){const t=s.ws;s.wsconnected&&t&&t.readyState===t.OPEN&&t.send(e),s.bcconnected&&_e(s.bcChannel,e,s)}var tc=class extends ot{constructor(e,t,n,{connect:i=!0,awareness:r=new Go(n),params:o={},WebSocketPolyfill:c=WebSocket,resyncInterval:a=-1,maxBackoffTime:l=2500,disableBc:h=!1}={}){super();b(this,"maxBackoffTime");b(this,"bcChannel");b(this,"url");b(this,"roomname");b(this,"doc");b(this,"_WS");b(this,"awareness");b(this,"wsconnected");b(this,"wsconnecting");b(this,"bcconnected");b(this,"disableBc");b(this,"wsUnsuccessfulReconnects");b(this,"messageHandlers");b(this,"_synced");b(this,"ws");b(this,"wsLastMessageReceived");b(this,"shouldConnect");b(this,"_resyncInterval");b(this,"_bcSubscriber");b(this,"_updateHandler");b(this,"_awarenessUpdateHandler");b(this,"_unloadHandler");b(this,"_checkInterval");for(;e[e.length-1]==="/";)e=e.slice(0,e.length-1);const u=Po(o);this.maxBackoffTime=l,this.bcChannel=e+"/"+t,this.url=e+"/"+t+(u.length===0?"":"?"+u),this.roomname=t,this.doc=n,this._WS=c,this.awareness=r,this.wsconnected=!1,this.wsconnecting=!1,this.bcconnected=!1,this.disableBc=h,this.wsUnsuccessfulReconnects=0,this.messageHandlers=Xe.slice(),this._synced=!1,this.ws=null,this.wsLastMessageReceived=0,this.shouldConnect=i,this._resyncInterval=0,a>0&&(this._resyncInterval=setInterval(()=>{if(this.ws&&this.ws.readyState===WebSocket.OPEN){const d=j();p(d,pe),ds(d,n),this.ws.send(S(d))}},a)),this._bcSubscriber=(d,f)=>{if(f!==this){const g=Xn(this,new Uint8Array(d),!1);zt(g)>1&&_e(this.bcChannel,S(g),this)}},this._updateHandler=(d,f)=>{if(f!==this){const g=j();p(g,pe),qo(g,d),ps(this,S(g))}},this.doc.on("update",this._updateHandler),this._awarenessUpdateHandler=({added:d,updated:f,removed:g},m)=>{const U=d.concat(f).concat(g),We=j();p(We,Le),D(We,Je(r,U)),ps(this,S(We))},this._unloadHandler=()=>{gs(this.awareness,[n.clientID],"window unload")},typeof window<"u"?window.addEventListener("unload",this._unloadHandler):typeof process<"u"&&process.on("exit",this._unloadHandler),r.on("update",this._awarenessUpdateHandler),this._checkInterval=setInterval(()=>{this.wsconnected&&Jn<le()-this.wsLastMessageReceived&&(Zo(this.ws!==null,"ws must not be null"),this.ws.close())},Jn/10),i&&this.connect()}get synced(){return this._synced}set synced(e){this._synced!==e&&(this._synced=e,this.emit("synced",[e]),this.emit("sync",[e]))}destroy(){this._resyncInterval!==0&&clearInterval(this._resyncInterval),clearInterval(this._checkInterval),this.disconnect(),typeof window<"u"?window.removeEventListener("unload",this._unloadHandler):typeof process<"u"&&process.off("exit",this._unloadHandler),this.awareness.off("update",this._awarenessUpdateHandler),this.doc.off("update",this._updateHandler),super.destroy()}connectBc(){if(this.disableBc)return;this.bcconnected||(hr(this.bcChannel,this._bcSubscriber),this.bcconnected=!0);const e=j();p(e,pe),ds(e,this.doc),_e(this.bcChannel,S(e),this);const t=j();p(t,pe),qn(t,this.doc),_e(this.bcChannel,S(t),this);const n=j();p(n,Yn),_e(this.bcChannel,S(n),this);const i=j();p(i,Le),D(i,Je(this.awareness,[this.doc.clientID])),_e(this.bcChannel,S(i),this)}disconnectBc(){const e=j();p(e,Le),D(e,Je(this.awareness,[this.doc.clientID],new Map)),ps(this,S(e)),this.bcconnected&&(ur(this.bcChannel,this._bcSubscriber),this.bcconnected=!1)}disconnect(){this.shouldConnect=!1,this.disconnectBc(),this.ws!==null&&this.ws.close()}connect(){this.shouldConnect=!0,!this.wsconnected&&this.ws===null&&(Gn(this),this.connectBc())}};function Wn(){if(crypto.randomUUID)return crypto.randomUUID();let s=new Date().getTime(),e=typeof performance<"u"&&performance.now&&performance.now()*1e3||0;return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(t){let n=Math.random()*16;return s>0?(n=(s+n)%16|0,s=Math.floor(s/16)):(n=(e+n)%16|0,e=Math.floor(e/16)),(t==="x"?n:n&3|8).toString(16)})}var sc=class extends tc{constructor(s,e,t,n={}){const i=`${s.startsWith("localhost:")||s.startsWith("127.0.0.1:")?"ws":"wss"}://${s}/party`;n.params===void 0?n.params={_pk:Wn()}:n.params._pk=Wn(),super(i,e,t,n)}};const ke=s=>Se((e,t)=>{s.onerror=n=>t(new Error(n.target.error)),s.onsuccess=n=>e(n.target.result)}),nc=(s,e)=>Se((t,n)=>{const i=indexedDB.open(s);i.onupgradeneeded=r=>e(r.target.result),i.onerror=r=>n(X(r.target.error)),i.onsuccess=r=>{const o=r.target.result;o.onversionchange=()=>{o.close()},typeof addEventListener<"u"&&addEventListener("unload",()=>o.close()),t(o)}}),ic=s=>ke(indexedDB.deleteDatabase(s)),rc=(s,e)=>e.forEach(t=>s.createObjectStore.apply(s,t)),Ge=(s,e,t="readwrite")=>{const n=s.transaction(e,t);return e.map(i=>fc(n,i))},Pn=(s,e)=>ke(s.count(e)),oc=(s,e)=>ke(s.get(e)),Qn=(s,e)=>ke(s.delete(e)),cc=(s,e,t)=>ke(s.put(e,t)),ks=(s,e)=>ke(s.add(e)),ac=(s,e,t)=>ke(s.getAll(e,t)),lc=(s,e,t)=>{let n=null;return dc(s,e,i=>(n=i,!1),t).then(()=>n)},hc=(s,e=null)=>lc(s,e,"prev"),uc=(s,e)=>Se((t,n)=>{s.onerror=n,s.onsuccess=async i=>{const r=i.target.result;if(r===null||await e(r)===!1)return t();r.continue()}}),dc=(s,e,t,n="next")=>uc(s.openKeyCursor(e,n),i=>t(i.key)),fc=(s,e)=>s.objectStore(e),gc=(s,e)=>IDBKeyRange.upperBound(s,e),pc=(s,e)=>IDBKeyRange.lowerBound(s,e),ms="custom",Zn="updates",ei=500,ti=(s,e=()=>{},t=()=>{})=>{const[n]=Ge(s.db,[Zn]);return ac(n,pc(s._dbref,!1)).then(i=>{s._destroyed||(e(n),y(s.doc,()=>{i.forEach(r=>nn(s.doc,r))},s,!1),t(n))}).then(()=>hc(n).then(i=>{s._dbref=i+1})).then(()=>Pn(n).then(i=>{s._dbsize=i})).then(()=>n)},kc=(s,e=!0)=>ti(s).then(t=>{(e||s._dbsize>=ei)&&ks(t,Pt(s.doc)).then(()=>Qn(t,gc(s._dbref,!0))).then(()=>Pn(t).then(n=>{s._dbsize=n}))});class mc extends ot{constructor(e,t){super(),this.doc=t,this.name=e,this._dbref=0,this._dbsize=0,this._destroyed=!1,this.db=null,this.synced=!1,this._db=nc(e,n=>rc(n,[["updates",{autoIncrement:!0}],["custom"]])),this.whenSynced=Se(n=>this.on("synced",()=>n(this))),this._db.then(n=>{this.db=n,ti(this,o=>ks(o,Pt(t)),()=>{if(this._destroyed)return this;this.synced=!0,this.emit("synced",[this])})}),this._storeTimeout=1e3,this._storeTimeoutId=null,this._storeUpdate=(n,i)=>{if(this.db&&i!==this){const[r]=Ge(this.db,[Zn]);ks(r,n),++this._dbsize>=ei&&(this._storeTimeoutId!==null&&clearTimeout(this._storeTimeoutId),this._storeTimeoutId=setTimeout(()=>{kc(this,!1),this._storeTimeoutId=null},this._storeTimeout))}},t.on("update",this._storeUpdate),this.destroy=this.destroy.bind(this),t.on("destroy",this.destroy)}destroy(){return this._storeTimeoutId&&clearTimeout(this._storeTimeoutId),this.doc.off("update",this._storeUpdate),this.doc.off("destroy",this.destroy),this._destroyed=!0,this._db.then(e=>{e.close()})}clearData(){return this.destroy().then(()=>{ic(this.name)})}get(e){return this._db.then(t=>{const[n]=Ge(t,[ms],"readonly");return oc(n,e)})}set(e,t){return this._db.then(n=>{const[i]=Ge(n,[ms]);return cc(i,t,e)})}del(e){return this._db.then(t=>{const[n]=Ge(t,[ms]);return Qn(n,e)})}}const Yc="",bc={ctrlKey:"Control",altKey:"Alt",shiftKey:"Shift",metaKey:"Meta"},wc="can-duplicate-to";var E=(s=>(s.CanPlay="can-play",s.CanMove="can-move",s.CanSpin="can-spin",s.CanGrow="can-grow",s.CanToggle="can-toggle",s.CanDuplicate="can-duplicate",s.CanPost="can-post",s))(E||{});function yc(s){return s.id}function si(s){return document.getElementById(s)}function _c(s){return s&&s.__esModule&&Object.prototype.hasOwnProperty.call(s,"default")?s.default:s}var Sc=["2 girls 1 cup","2g1c","4r5e","5h1t","5hit","5ht","666","@$$","a s s","a s shole","a55","a55hole","a_s_s","abbo","abeed","abuse","acrotomophilia","aeolus","africoon","ahole","alabama hot pocket","alaskan pipeline","alligator bait","alligatorbait","amcik","anal","analannie","analprobe","analsex","andskota","anilingus","anus","apeshit","ar5e","arabush","arabushs","areola","areole","argie","armo","armos","aroused","arrse","arschloch","arse","arsehole","aryan","ash0le","ash0les","asholes","ass monkey","ass","ass-fucker","ass-hat","ass-pirate","assbag","assbagger","assbandit","assbang","assbanged","assbanger","assbangs","assbite","assblaster","assclown","asscock","asscowboy","asscracker","asses","assface","assfuck","assfucker","assfukka","assgoblin","assh0le","assh0lez","asshat","asshead","assho1e","asshole","assholes","assholz","asshopper","asshore","assjacker","assjockey","asskiss","asskisser","assklown","asslick","asslicker","asslover","assman","assmaster","assmonkey","assmunch","assmuncher","assnigger","asspacker","asspirate","asspuppies","assrammer","assranger","assshit","assshole","asssucker","asswad","asswhole","asswhore","asswipe","asswipes","auto erotic","autoerotic","ayir","azazel","azz","azzhole","b a s t a r d","b i t c h","b o o b","b!+ch","b!tch","b!tchin","b*tch","b00b","b00bies","b00biez","b00bs","b00bz","b17ch","b1tch","b7ch","babeland","babes","baby batter","baby juice","backdoor","backdoorman","badfuck","bagging","ball gag","ball gravy","ball kicking","ball licking","ball sack","ball sucking","ballbag","balllicker","ballsack","bampot","bangbro","bangbros","bangbus","banger","banging","bareback","barely legal","barelylegal","barenaked","barf","barface","barfface","bassterd","bassterds","bastard","bastardo","bastards","bastardz","basterds","basterdz","bastinado","bawdy","bazongas","bazooms","bbw","bdsm","beaner","beaners","beaney","beaneys","beardedclam","beastality","beastial","beastiality","beastility","beatch","beatoff","beatyourmeat","beaver cleaver","beaver lips","beef curtains","beeyotch","bellend","beotch","bestial","bestiality","bi curious","bi+ch","bi7ch","biatch","bicurious","big black","big breasts","big knockers","big tits","bigass","bigbastard","bigbreasts","bigbutt","bigtits","bimbo","bimbos","bint","birdlock","bitch","bitchass","bitched","bitcher","bitchers","bitches","bitchez","bitchin","bitching","bitchslap","bitchtit","bitchy","biteme","bitties","black cock","blackcock","blackman","blackout","blacks","blonde action","blonde on blonde action","blonde on blonde","bloodclaat","bloody","blow j","blow job","blow your l","blow your load","blowjob","blowjobs","blue waffle","bluegum","bluegums","blumpkin","bo ob","bo obs","boang","boche","boches","bodily","boffing","bogan","bohunk","boink","boiolas","bollick","bollock","bollocks","bollok","bollox","bombers","bombing","bomd","bondage","boned","boner","boners","bong","bookie","boong","boonga","boongas","boongs","boonie","boonies","booobs","boooobs","booooobs","booooooobs","bootee","bootlip","bootlips","boozer","boozy","bosch","bosche","bosches","boschs","bosomy","bounty bar","bounty bars","bountybar","brea5t","breastjob","breastlover","breastman","brown shower","brown showers","brunette action","btch","buceta","buddhahead","buddhaheads","buffies","bugger","buggered","buggery","bukake","bukkake","bullcrap","bulldike","bulldyke","bullet vibe","bullshit","bullshits","bullshitted","bullturds","bumblefuck","bumfuck","bung hole","bung","bunga","bungas","bunghole","bunny fucker","burr head","burr heads","burrhead","burrheads","butchbabes","butchdike","butchdyke","butt plug","butt-pirate","buttbang","buttcheeks","buttface","buttfuck","buttfucker","buttfuckers","butthead","butthole","buttman","buttmuch","buttmunch","buttmuncher","buttpirate","buttplug","buttstain","buttwipe","byatch","c u n t","c-0-c-k","c-o-c-k","c-u-n-t","c.0.c.k","c.o.c.k.","c.u.n.t","c0ck","c0cks","c0cksucker","c0k","cabron","caca","cacker","cahone","camel jockey","camel jockeys","camel toe","cameljockey","cameltoe","camgirl","camslut","camwhore","carpet muncher","carpetmuncher","carruth","cawk","cawks","cazzo","cervix","chav","cheese eating surrender monkey","cheese eating surrender monkies","cheeseeating surrender monkey","cheeseeating surrender monkies","cheesehead","cheeseheads","cherrypopper","chickslick","china swede","china swedes","chinaman","chinamen","chinaswede","chinaswedes","chinc","chincs","ching chong","ching chongs","chinga","chingchong","chingchongs","chink","chinks","chinky","choad","chocolate rosebuds","chode","chodes","chonkies","chonky","chonkys","chraa","christ killer","christ killers","chug","chugs","chuj","chunger","chungers","chunkies","chunkys","chute","cipa","circlejerk","cl1t","clamdigger","clamdiver","clamps","clansman","clansmen","clanswoman","clanswomen","cleveland steamer","clit","clitface","clitfuck","clitoris","clitorus","clits","clitty","clogwog","clover clamps","clusterfuck","cnts","cntz","cnut","cocain","cocaine","cock","cock-head","cock-sucker","cockbite","cockblock","cockblocker","cockburger","cockcowboy","cockface","cockfight","cockfucker","cockhead","cockholster","cockjockey","cockknob","cockknocker","cockknoker","cocklicker","cocklover","cockmaster","cockmongler","cockmongruel","cockmonkey","cockmunch","cockmuncher","cocknob","cocknose","cocknugget","cockqueen","cockrider","cocks","cockshit","cocksman","cocksmith","cocksmoker","cocksucer","cocksuck","cocksucked","cocksucker","cocksucking","cocksucks","cocksuka","cocksukka","cocktease","cocky","cohee","coital","coitus","cok","cokmuncher","coksucka","commie","condom","coochie","coochy","coolie","coolies","cooly","coon ass","coon asses","coonass","coonasses","coondog","coons","cooter","coprolagnia","coprophilia","copulate","corksucker","cornhole","cra5h","crabs","crackcocain","cracker","crackpipe","crackwhore","crap","crapola","crapper","crappy","creampie","crotch","crotchjockey","crotchmonkey","crotchrot","cuck","cum face","cum licker","cum","cumbubble","cumdumpster","cumfest","cumguzzler","cuming","cumjockey","cumlickr","cumm","cummer","cummin","cumming","cumquat","cumqueen","cums","cumshot","cumshots","cumslut","cumstain","cumsucker","cumtart","cunilingus","cunillingus","cunn","cunnie","cunnilingus","cunntt","cunny","cunt","cunteyed","cuntface","cuntfuck","cuntfucker","cunthole","cunthunter","cuntlick","cuntlicker","cuntlicking","cuntrag","cunts","cuntslut","cuntsucker","cuntz","curry muncher","curry munchers","currymuncher","currymunchers","cushi","cushis","cyalis","cyberfuc","cyberfuck","cyberfucked","cyberfucker","cyberfuckers","cyberfucking","cybersex","cyberslimer","d0ng","d0uch3","d0uche","d1ck","d1ld0","d1ldo","d4mn","dago","dagos","dahmer","damm","dammit","damn","damnation","damned","damnit","darkey","darkeys","darkie","darkies","darky","date rape","daterape","datnigga","dawgie style","dawgie-style","daygo","deapthroat","deep throat","deep throating","deepaction","deepthroat","deepthroating","defecate","deggo","dego","degos","demon","dendrophilia","destroyyourpussy","deth","diaper daddy","diaper head","diaper heads","diaperdaddy","diaperhead","diaperheads","dick pic","dick","dick-ish","dickbag","dickbeater","dickbeaters","dickbrain","dickdipper","dickface","dickflipper","dickforbrains","dickfuck","dickhead","dickheads","dickhole","dickish","dickjuice","dickless","dicklick","dicklicker","dickman","dickmilk","dickmonger","dickpic","dickripper","dicks","dicksipper","dickslap","dickslicker","dicksucker","dickwad","dickweasel","dickweed","dickwhipper","dickwod","dickzipper","diddle","dike","dild0","dild0s","dildo","dildos","dilf","diligaf","dilld0","dilld0s","dillweed","dimwit","dingle","dingleberries","dingleberry","dink","dinks","dipship","dipshit","dipstick","dirsa","dirty pillows","dirty sanchez","dix","dixiedike","dixiedyke","dlck","dog style","dog-fucker","doggie style","doggie","doggie-style","doggiestyle","doggin","dogging","doggy style","doggy-style","doggystyle","dolcett","domination","dominatricks","dominatrics","dominatrix","dommes","dong","donkey punch","donkeypunch","donkeyribber","doochbag","doodoo","doofus","dookie","doosh","dot head","dot heads","dothead","dotheads","double dong","double penetration","doubledong","doublepenetration","douch3","douche bag","douche","douche-fag","douchebag","douchebags","douchewaffle","douchey","dp action","dp","dpaction","dragqueen","dragqween","dripdick","dry hump","dryhump","duche","dudette","dumass","dumb ass","dumbass","dumbasses","dumbbitch","dumbfuck","dumbshit","dumshit","dune coon","dune coons","dupa","dvda","dyefly","dyke","dykes","dziwka","earotics","easyslut","eat my ass","eat my","eatadick","eatballs","eathairpie","eatme","eatmyass","eatpussy","ecchi","ejackulate","ejakulate","ekrem","ekto","enculer","enema","enlargement","erect","erection","ero","erotic","erotism","escort","esqua","essohbee","ethical slut","evl","excrement","exkwew","extacy","extasy","f u c k e r","f u c k e","f u c k","f u k","f*ck","f-u-c-k","f.u.c.k","f4nny","f_u_c_k","facefucker","fack","faeces","faen","fag","fag1t","fagbag","faget","fagfucker","fagg","fagg1t","fagged","fagging","faggit","faggitt","faggot","faggotcock","faggs","fagit","fagot","fagots","fags","fagt","fagtard","fagz","faig","faigs","faigt","fanculo","fannybandit","fannyflaps","fannyfucker","fanyy","fartknocker","fastfuck","fatah","fatfuck","fatfucker","fatso","fck","fckcum","fckd","fcuk","fcuker","fcuking","fecal","feck","fecker","feg","felatio","felch","felcher","felching","fellate","fellatio","feltch","feltcher","feltching","female squirting","femalesquirtin","femalesquirting","femdom","fetish","ficken","figging","fingerbang","fingerfood","fingerfuck","fingerfucked","fingerfucker","fingerfuckers","fingerfucking","fingerfucks","fingering","fisted","fister","fistfuck","fistfucked","fistfucker","fistfuckers","fistfucking","fistfuckings","fistfucks","fisting","fisty","fitt","flamer","flange","flasher","flikker","flipping the bird","flogthelog","floo","floozy","flydie","flydye","foad","fok","fondle","foobar","fook","fooker","foot fetish","footaction","footfetish","footfuck","footfucker","footjob","footlicker","footstar","foreskin","forni","fornicate","fotze","foursome","fourtwenty","freakfuck","freakyfucker","freefuck","freex","frigg","frigga","frigger","frotting","fucck","fuck","fuck-tard","fucka","fuckable","fuckass","fuckbag","fuckbitch","fuckbook","fuckboy","fuckbrain","fuckbuddy","fuckbutt","fuckd","fucked","fuckedup","fucker","fuckers","fuckersucker","fuckface","fuckfest","fuckfreak","fuckfriend","fuckhead","fuckheads","fuckher","fuckhole","fuckin","fuckina","fucking","fuckingbitch","fuckings","fuckingshitmotherfucker","fuckinnuts","fuckinright","fuckit","fuckknob","fuckme","fuckmeat","fuckmehard","fuckmonkey","fuckn","fucknugget","fucknut","fucknuts","fucknutt","fucknutz","fuckoff","fuckpig","fuckpuppet","fuckr","fucks","fuckstick","fucktard","fucktards","fucktoy","fucktrophy","fuckup","fuckwad","fuckwhit","fuckwhore","fuckwit","fuckwitt","fuckyomama","fuckyou","fudge packer","fudgepacker","fugly","fuk","fukah","fuken","fuker","fukin","fuking","fukk","fukkah","fukken","fukker","fukkin","fukking","fuks","fuktard","fuktards","fukwhit","fukwit","funfuck","fungus","futanari","futanary","futkretzn","fuuck","fux","fux0r","fuxor","fvck","fvk","fxck","g-spot","g00k","gae","gai","gang bang","gangbang","gangbanged","gangbanger","gangbangs","gangsta","ganja","gassyass","gator bait","gatorbait","gay sex","gayass","gaybob","gayboy","gaydo","gaygirl","gaylord","gaymuthafuckinwhore","gays","gaysex","gaytard","gaywad","gayz","geezer","geni","genital","genitals","getiton","gey","gfy","ghay","ghey","giant cock","gigolo","ginzo","ginzos","gipp","gippo","gippos","gipps","girl on top","girl on","girls gone wild","givehead","glans","glazeddonut","goatcx","goatse","gob","god dammit","god damn","god damnit","god-dam","god-damned","godam","godammit","godamn","godamnit","goddam","goddamit","goddamm","goddammit","goddamn","goddamned","goddamnes","goddamnit","goddamnmuthafucker","godsdamn","gokkun","golden shower","goldenshower","golliwog","golliwogs","gonad","gonads","gonorrehea","gonzagas","goo girl","gooch","goodpoop","gook eye","gook eyes","gook","gookeye","gookeyes","gookies","gooks","gooky","gora","goras","goregasm","gotohell","goy","goyim","greaseball","greaseballs","groe","groid","groids","grope","grostulation","group sex","gspot","gstring","gtfo","gub","gubba","gubbas","gubs","guido","guiena","guineas","guizi","gummer","guro","gwailo","gwailos","gweilo","gweilos","gyopo","gyopos","gyp","gyped","gypo","gypos","gypp","gypped","gyppie","gyppies","gyppo","gyppos","gyppy","gyppys","gypsys","h e l l","h o m","h00r","h0ar","h0m0","h0mo","h0r","h0re","h4x0r","hadji","hadjis","hairyback","hairybacks","haji","hajis","hajji","hajjis","half breed","half caste","halfbreed","halfcaste","hamas","hamflap","hand job","handjob","haole","haoles","hapa","hard core","hardcore","hardcoresex","hardon","harem","he11","headfuck","hebe","hebes","heeb","heebs","hell","hells","helvete","hentai","heroin","herp","herpes","herpy","heshe","hijacker","hijacking","hillbillies","hillbilly","hindoo","hiscock","hitler","hitlerism","hitlerist","hoar","hoare","hobag","hodgie","hoe","hoer","hoes","holestuffer","hom0","homey","homo","homobangers","homodumbshit","homoey","honger","honkers","honkey","honkeys","honkie","honkies","honky","hooch","hooker","hookers","hoor","hoore","hootch","hooter","hooters","hore","hori","horis","hork","horndawg","horndog","horney","horniest","horny","horseshit","hosejob","hoser","hot carl","hot chick","hotcarl","hotdamn","hotpussy","hotsex","hottotrot","how to kill","how to murder","howtokill","howtomurdep","huevon","huge fat","hugefat","hui","hummer","humped","humper","humpher","humphim","humpin","humping","hussy","hustler","hymen","hymie","hymies","iblowu","ike","ikes","ikey","ikeymo","ikeymos","ikwe","illegal","illegals","inbred","incest","indon","indons","injun","injuns","insest","intercourse","interracial","intheass","inthebuff","israels","j3rk0ff","jack off","jack-off","jackass","jackhole","jackoff","jackshit","jacktheripper","jail bait","jailbait","jap","japcrap","japie","japies","japs","jebus","jelly donut","jerk off","jerk","jerk-off","jerk0ff","jerked","jerkoff","jerries","jerry","jewboy","jewed","jewess","jiga","jigaboo","jigaboos","jigarooni","jigaroonis","jigg","jigga","jiggabo","jiggaboo","jiggabos","jiggas","jigger","jiggerboo","jiggers","jiggs","jiggy","jigs","jihad","jijjiboo","jijjiboos","jimfish","jisim","jism","jiss","jiz","jizim","jizin","jizjuice","jizm","jizn","jizz","jizzd","jizzed","jizzim","jizzin","jizzn","jizzum","jugg","juggs","jugs","jungle bunnies","jungle bunny","junglebunny","junkie","junky","kacap","kacapas","kacaps","kaffer","kaffir","kaffre","kafir","kanake","kanker","katsap","katsaps","kawk","khokhol","khokhols","kicking","kigger","kike","kikes","kimchis","kinbaku","kink","kinkster","kinky","kinkyJesus","kissass","kiunt","kkk","klan","klansman","klansmen","klanswoman","klanswomen","klootzak","knobbing","knobead","knobed","knobend","knobhead","knobjocky","knobjokey","knobz","knockers","knulle","kock","kondum","kondums","kooch","kooches","koon","kootch","krap","krappy","kraut","krauts","kuffar","kuk","kuksuger","kum","kumbubble","kumbullbe","kumer","kummer","kumming","kumquat","kums","kunilingus","kunnilingus","kunt","kunts","kuntz","kurac","kurwa","kushi","kushis","kusi","kwa","kwai lo","kwai los","kwif","kyke","kykes","kyopo","kyopos","kyrpa","l3i+ch","l3i\\+ch","l3itch","labia","lapdance","leather restraint","leather straight","leatherrestraint","lebos","lech","lemon party","lemonparty","leper","lesbain","lesbayn","lesbin","lesbo","lesbos","lez","lezbe","lezbefriends","lezbian","lezbians","lezbo","lezbos","lezz","lezzian","lezzie","lezzies","lezzo","lezzy","libido","licker","licking","lickme","lilniglet","limey","limpdick","limy","lingerie","lipshits","lipshitz","livesex","loadedgun","loin","loins","lolita","lovebone","lovegoo","lovegun","lovejuice","lovemaking","lovemuscle","lovepistol","loverocket","lowlife","lsd","lubejob","lubra","lucifer","luckycammeltoe","lugan","lugans","lust","lusting","lusty","lynch","m-fucking","m0f0","m0fo","m45terbate","ma5terb8","ma5terbate","mabuno","mabunos","macaca","macacas","mafugly","magicwand","mahbuno","mahbunos","make me come","makemecome","makemecum","male squirting","mamhoon","mams","manhater","manpaste","maricon","maricón","marijuana","masochist","masokist","massa","massterbait","masstrbait","masstrbate","mastabate","mastabater","master-bate","masterb8","masterbaiter","masterbat","masterbat3","masterbate","masterbates","masterbating","masterbation","masterbations","masterblaster","mastrabator","masturbat","masturbate","masturbating","masturbation","mattressprincess","mau mau","mau maus","maumau","maumaus","mcfagget","meatbeatter","meatrack","menage","merd","mgger","mggor","mibun","mick","mickeyfinn","mideast","mierda","milf","minge","minger","mo-fo","mockey","mockie","mocky","mof0","mofo","moky","molest","molestation","molester","molestor","moneyshot","mong","monkleigh","moolie","moon cricket","moon crickets","mooncricket","mooncrickets","mormon","moron","moskal","moskals","moslem","mosshead","motha fucker","motha fuker","motha fukkah","motha fukker","mothafuck","mothafucka","mothafuckas","mothafuckaz","mothafucked","mothafucker","mothafuckers","mothafuckin","mothafucking","mothafuckings","mothafucks","mother fucker","mother fukah","mother fuker","mother fukkah","mother fukker","mother-fucker","motherfuck","motherfucka","motherfucked","motherfucker","motherfuckers","motherfuckin","motherfucking","motherfuckings","motherfuckka","motherfucks","motherfvcker","motherlovebone","mothrfucker","mouliewop","mound of venus","moundofvenus","mr hands","mrhands","mtherfucker","mthrfuck","mthrfucker","mthrfucking","mtrfck","mtrfuck","mtrfucker","muff diver","muff","muffdive","muffdiver","muffdiving","muffindiver","mufflikcer","muffpuff","muie","mulatto","mulkku","muncher","mung","munging","munt","munter","muschi","mutha fucker","mutha fukah","mutha fuker","mutha fukkah","mutha fukker","muthafecker","muthafuckaz","muthafucker","muthafuckker","muther","mutherfucker","mutherfucking","muthrfucking","mzungu","mzungus","n1gga","n1gger","n1gr","nad","nads","naked","nambla","nappy","nastt","nasty","nastybitch","nastyho","nastyslut","nastywhore","nawashi","nazi","nazis","nazism","necked","necro","needthedick","negres","negress","negro","negroes","negroid","negros","neonazi","nepesaurio","nig nog","nig","niga","nigar","nigars","nigas","nigers","nigette","nigettes","nigg","nigg3r","nigg4h","nigga","niggah","niggahs","niggar","niggaracci","niggard","niggarded","niggarding","niggardliness","niggardlinesss","niggardly","niggards","niggars","niggas","niggaz","nigger","niggerhead","niggerhole","niggers","niggle","niggled","niggles","niggling","nigglings","niggor","niggress","niggresses","nigguh","nigguhs","niggur","niggurs","niglet","nignog","nigor","nigors","nigr","nigra","nigras","nigre","nigres","nigress","nigs","nigur","niiger","niigr","nimphomania","nimrod","ninny","nip","nipple","nipplering","nipples","nips","nittit","nlgger","nlggor","nob jokey","nob","nobhead","nobjocky","nobjokey","nofuckingway","nog","nookey","nookie","nooky","noonan","nooner","nsfw images","nsfw","nudger","nudie","nudies","numbnuts","nut sack","nutbutter","nutfucker","nutsack","nutten","nymph","nympho","nymphomania","o c k","octopussy","omorashi","one cup two girls","one guy one jar","one guy","one jar","ontherag","orafis","orally","orga","orgasim","orgasim;","orgasims","orgasm","orgasmic","orgasms","orgasum","orgies","orgy","oriface","orifice","orifiss","orospu","osama","ovum","ovums","p e n i s","p i s","p u s s y","p.u.s.s.y.","p0rn","packi","packie","packy","paddy","paedophile","paki","pakie","pakis","paky","palesimian","pancake face","pancake faces","panooch","pansies","pansy","panti","pantie","panties","panty","paska","pastie","pasty","payo","pcp","pearlnecklace","pecker","peckerhead","peckerwood","pedo","pedobear","pedophile","pedophilia","pedophiliac","peeenus","peeenusss","peehole","peenus","peepee","peepshow","peepshpw","pegging","peinus","pen1s","penas","pendejo","pendy","penetrate","penetration","peni5","penial","penile","penis","penis-breath","penises","penisfucker","penisland","penislick","penislicker","penispuffer","penthouse","penus","penuus","perse","perv","perversion","peyote","phalli","phallic","phone sex","phonesex","phuc","phuck","phuk","phuked","phuker","phuking","phukked","phukker","phukking","phuks","phungky","phuq","pi55","picaninny","piccaninny","picka","pickaninnies","pickaninny","piece of shit","pieceofshit","piefke","piefkes","pierdol","pigfucker","piker","pikey","piky","pillowbiter","pillu","pimmel","pimp","pimped","pimper","pimpis","pimpjuic","pimpjuice","pimpsimp","pindick","pinko","pis","pises","pisin","pising","pisof","piss pig","piss","piss-off","pissed","pisser","pissers","pisses","pissflap","pissflaps","pisshead","pissin","pissing","pissoff","pisspig","pistol","pizda","playboy","playgirl","pleasure chest","pleasurechest","pocha","pochas","pocho","pochos","pocketpool","pohm","pohms","polac","polack","polacks","polak","pole smoker","polesmoker","pollock","pollocks","pommie grant","pommie grants","pommy","ponyplay","poof","poon","poonani","poonany","poontang","poontsee","poop chute","poopchute","pooper","pooperscooper","pooping","poorwhitetrash","popimp","porch monkey","porch monkies","porchmonkey","porn","pornflick","pornking","porno","pornography","pornos","pornprincess","pound town","poundtown","pplicker","pr0n","pr1c","pr1ck","pr1k","prairie nigger","prairie niggers","premature","preteen","pric","prickhead","pricks","prig","prince albert piercing","pron","prostitute","pthc","pu55i","pu55y","pube","pubes","pubic","pubiclice","pubis","pud","pudboy","pudd","puddboy","puke","pula","pule","punani","punanny","punany","punkass","punky","punta","puntang","purinapricness","pusies","puss","pusse","pussee","pussi","pussie","pussies","pussy","pussycat","pussydestroyer","pussyeater","pussyfart","pussyfucker","pussylicker","pussylicking","pussylips","pussylover","pussypalace","pussypounder","pussys","pusy","puta","puto","puuke","puuker","qahbeh","quashie","queaf","queef","queerhole","queero","queers","queerz","quickie","quicky","quiff","quim","qweers","qweerz","qweir","r-tard","r-tards","r5e","ra8s","raghead","ragheads","rape","raped","raper","raping","rapist","rautenberg","rearend","rearentry","recktum","rectal","rectum","rectus","redleg","redlegs","redlight","redneck","rednecks","redskin","redskins","reefer","reestie","reetard","reich","renob","rentafuck","rere","retard","retarded","retards","retardz","reverse cowgirl","reversecowgirl","rigger","rimjaw","rimjob","rimming","ritard","rosebuds","rosy palm and her 5 sisters","rosy palm","rosypalm","rosypalmandher5sisters","rosypalmandherefivesisters","round eyes","roundeye","rtard","rtards","rumprammer","ruski","russki","russkie","rusty trombone","rustytrombone","s h i t","s hit","s&m","s-h-1-t","s-h-i-t","s-o-b","s.h.i.t.","s.o.b.","s0b","s_h_i_t","sac","sadis","sadism","sadist","sadom","sambo","sambos","samckdaddy","sanchez","sand nigger","sand niggers","sandm","sandnigger","santorum","sausagequeen","scag","scallywag","scank","scantily","scat","schaffer","scheiss","schizo","schlampe","schlong","schmuck","schvartse","schvartsen","schwartze","schwartzen","scissoring","screwed","screwing","screwyou","scroat","scrog","scrote","scrotum","scrud","seduce","semen","seppo","seppos","septics","sex","sexcam","sexed","sexfarm","sexhound","sexhouse","sexi","sexing","sexkitten","sexo","sexpot","sexslave","sextogo","sextoy","sextoys","sexual","sexually","sexwhore","sexx","sexxi","sexxx","sexxxi","sexxxy","sexxy","sexy","sexymoma","sexyslim","sh!+","sh!t","sh1t","sh1ter","sh1ts","sh1tter","sh1tz","shag","shagger","shaggin","shagging","shamedame","sharmuta","sharmute","shat","shav","shaved beaver","shaved pussy","shavedbeaver","shavedpussy","shawtypimp","sheeney","shemale","shhit","shi+","shibari","shibary","shinola","shipal","shit ass","shit","shit-ass","shit-bag","shit-bagger","shit-brain","shit-breath","shit-cunt","shit-dick","shit-eating","shit-face","shit-faced","shit-fit","shit-head","shit-heel","shit-hole","shit-house","shit-load","shit-pot","shit-spitter","shit-stain","shitass","shitbag","shitbagger","shitblimp","shitbrain","shitbreath","shitcan","shitcunt","shitdick","shite","shiteater","shiteating","shited","shitey","shitface","shitfaced","shitfit","shitforbrains","shitfuck","shitfucker","shitfull","shithapens","shithappens","shithead","shitheel","shithole","shithouse","shiting","shitings","shitlist","shitload","shitola","shitoutofluck","shitpot","shits","shitspitter","shitstain","shitt","shitted","shitter","shitters","shittiest","shitting","shittings","shitty","shity","shitz","shiz","shiznit","shortfuck","shota","shrimping","shylock","shylocks","shyt","shyte","shytty","shyty","simp","sissy","sixsixsix","sixtynine","sixtyniner","skag","skanck","skank","skankbitch","skankee","skankey","skankfuck","skanks","skankwhore","skanky","skankybitch","skankywhore","skeet","skinflute","skribz","skullfuck","skum","skumbag","skurwysyn","skwa","skwe","slag","slanteye","slanty","slapper","sleezeball","slideitin","slimeball","slimebucket","slopehead","slopeheads","sloper","slopers","slopes","slopey","slopeys","slopies","slopy","slut","slutbag","slutbucket","slutdumper","slutkiss","sluts","slutt","slutting","slutty","slutwear","slutwhore","slutz","smack","smackthemonkey","smeg","smegma","smoker","smut","smutty","snatchpatch","snigger","sniggered","sniggering","sniggers","snowback","snowballing","snownigger","snuff","socksucker","sodom","sodomise","sodomite","sodomize","sodomy","son of a bitch","son of a whore","son-of-a-bitch","son-of-a-whore","sonofabitch","sonofbitch","sooties","sooty","souse","soused","soyboy","spac","spade","spades","spaghettibender","spaghettinigger","spank","spankthemonkey","spastic","spearchucker","spearchuckers","sperm","spermacide","spermbag","spermhearder","spermherder","sphencter","spic","spick","spicks","spics","spierdalaj","spig","spigotty","spik","spiks","spitter","splittail","splooge","spludge","spooge","spread legs","spreadeagle","spunk","spunky","sqeh","squa","squarehead","squareheads","squaw","squinty","squirting","stagg","steamy","stfu","stiffy","stoned","stoner","strap on","strapon","strappado","stringer","strip club","stripclub","stroke","stroking","stuinties","stupidfuck","stupidfucker","style doggy","suckdick","sucked","sucker","sucking","suckme","suckmyass","suckmydick","suckmytit","suckoff","sucks","suicide girl","suicide girls","suicidegirl","suicidegirls","suka","sultrywoman","sultrywomen","sumofabiatch","swallower","swalow","swamp guinea","swamp guineas","swastika","syphilis","t i t","t i ts","t1t","t1tt1e5","t1tties","taboo","tacohead","tacoheads","taff","take off your","tar babies","tar baby","tarbaby","tard","taste my","tastemy","tawdry","tea bagging","teabagging","teat","teets","teez","terd","terror","terrorist","teste","testee","testes","testical","testicle","testicles","testis","thicklip","thicklips","thirdeye","thirdleg","threesome","threeway","throating","thumbzilla","thundercunt","tied up","tig ol bitties","tig old bitties","tight white","timber nigger","timber niggers","timbernigger","tinkle","tit","titbitnipply","titfuck","titfucker","titfuckin","titi","titjob","titlicker","titlover","tits","titt","tittie","tittie5","tittiefucker","titties","tittis","titty","tittyfuck","tittyfucker","tittys","tittywank","titwank","tity","to murder","toke","tongethruster","tongue in a","tongueina","tonguethrust","tonguetramp","toots","topless","tortur","torture","tosser","towel head","towel heads","towelhead","trailertrash","tramp","trannie","tranny","transsexual","transvestite","trashy","tribadism","triplex","trisexual","trois","trojan","trots","tub girl","tubgirl","tuckahoe","tunneloflove","turd burgler","turnon","tush","tushy","tw4t","twat","twathead","twatlips","twats","twatty","twatwaffle","twink","twinkie","two girls one cup","twobitwhore","twunt","twunter","udge packer","ukrop","unclefucker","undressing","unfuckable","upskirt","uptheass","upthebutt","urethra play","urethraplay","urophilia","usama","ussys","uzi","v a g i n a","v14gra","v1gra","v4gra","va-j-j","va1jina","vag","vag1na","vagiina","vaj1na","vajina","valium","venus mound","vgra","vibr","vibrater","vibrator","vigra","violet wand","virgin","virginbreaker","vittu","vixen","vjayjay","vodka","vomit","vorarephilia","voyeurweb","voyuer","vullva","vulva","w00se","w0p","wab","wad","wang","wank","wanker","wanking","wanky","waysted","wazoo","weenie","weewee","weiner","welcher","wench","wet dream","wetb","wetback","wetbacks","wetdream","wetspot","wh00r","wh0re","wh0reface","whacker","whash","whigger","whiggers","whiskeydick","whiskydick","whit","white power","white trash","whitenigger","whitepower","whites","whitetrash","whitey","whiteys","whities","whoar","whop","whoralicious","whore","whorealicious","whorebag","whored","whoreface","whorefucker","whorehopper","whorehouse","whores","whoring","wichser","wigga","wiggas","wigger","wiggers","willie","willies","williewanker","willy","wn","wog","wogs","woose","wop","worldsex","wrapping men","wrinkled starfish","wtf","wuss","wuzzie","x-rated","x-rated2g1c","xkwe","xrated","xtc","xx","xxx","xxxxxx","yank","yaoi","yarpie","yarpies","yeasty","yed","yellow showers","yellowman","yellowshowers","yid","yids","yiffy","yobbo","yourboobs","yourpenis","yourtits","yury","zabourah","zigabo","zigabos","zipperhead","zipperheads","zoophile","zoophilia","🖕"];const Dc=_c(Sc),Ec=(s,e=300)=>{let t;return function(...n){clearTimeout(t),t=setTimeout(()=>s.apply(this,n),e)}},ni=`url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='44' height='53' viewport='0 0 100 100' style='fill:black;font-size:26px;'><text y='40%'>🚿</text></svg>")
|
|
1
|
+
(function(M,_){typeof exports=="object"&&typeof module<"u"?_(exports):typeof define=="function"&&define.amd?define(["exports"],_):(M=typeof globalThis<"u"?globalThis:M||self,_(M.playhtml={}))})(this,function(M){"use strict";var zc=Object.defineProperty;var Oc=(M,_,q)=>_ in M?zc(M,_,{enumerable:!0,configurable:!0,writable:!0,value:q}):M[_]=q;var b=(M,_,q)=>(Oc(M,typeof _!="symbol"?_+"":_,q),q);const _=()=>new Map,q=s=>{const e=_();return s.forEach((t,n)=>{e.set(n,t)}),e},K=(s,e,t)=>{let n=s.get(e);return n===void 0&&s.set(e,n=t()),n},ui=(s,e)=>{const t=[];for(const[n,i]of s)t.push(e(i,n));return t},di=(s,e)=>{for(const[t,n]of s)if(e(n,t))return!0;return!1},oe=()=>new Set,vt=s=>s[s.length-1],fi=(s,e)=>{for(let t=0;t<e.length;t++)s.push(e[t])},Q=Array.from,gi=Array.isArray,pi=String.fromCharCode,ki=s=>s.toLowerCase(),mi=/^\s*/g,bi=s=>s.replace(mi,""),wi=/([A-Z])/g,Ss=(s,e)=>bi(s.replace(wi,t=>`${e}${ki(t)}`)),yi=s=>{const e=unescape(encodeURIComponent(s)),t=e.length,n=new Uint8Array(t);for(let i=0;i<t;i++)n[i]=e.codePointAt(i);return n},je=typeof TextEncoder<"u"?new TextEncoder:null,_i=je?s=>je.encode(s):yi;let Me=typeof TextDecoder>"u"?null:new TextDecoder("utf-8",{fatal:!0,ignoreBOM:!0});Me&&Me.decode(new Uint8Array).length===1&&(Me=null);const Ds=s=>s===void 0?null:s;class Si{constructor(){this.map=new Map}setItem(e,t){this.map.set(e,t)}getItem(e){return this.map.get(e)}}let Es=new Si,xt=!0;try{typeof localStorage<"u"&&(Es=localStorage,xt=!1)}catch{}const Cs=Es,Di=s=>xt||addEventListener("storage",s),Ei=s=>xt||removeEventListener("storage",s),Ci=Object.assign,vi=Object.keys,xi=(s,e)=>{for(const t in s)e(s[t],t)},Ai=(s,e)=>{const t=[];for(const n in s)t.push(e(s[n],n));return t},Ze=s=>vi(s).length,Ii=s=>{for(const e in s)return!1;return!0},Li=(s,e)=>{for(const t in s)if(!e(s[t],t))return!1;return!0},vs=(s,e)=>Object.prototype.hasOwnProperty.call(s,e),ji=(s,e)=>s===e||Ze(s)===Ze(e)&&Li(s,(t,n)=>(t!==void 0||vs(e,n))&&e[n]===t),At=(s,e,t=0)=>{try{for(;t<s.length;t++)s[t](...e)}finally{t<s.length&&At(s,e,t+1)}},Mi=s=>s,Ti=(s,e)=>s===e,Te=(s,e)=>{if(s==null||e==null)return Ti(s,e);if(s.constructor!==e.constructor)return!1;if(s===e)return!0;switch(s.constructor){case ArrayBuffer:s=new Uint8Array(s),e=new Uint8Array(e);case Uint8Array:{if(s.byteLength!==e.byteLength)return!1;for(let t=0;t<s.length;t++)if(s[t]!==e[t])return!1;break}case Set:{if(s.size!==e.size)return!1;for(const t of s)if(!e.has(t))return!1;break}case Map:{if(s.size!==e.size)return!1;for(const t of s.keys())if(!e.has(t)||!Te(s.get(t),e.get(t)))return!1;break}case Object:if(Ze(s)!==Ze(e))return!1;for(const t in s)if(!vs(s,t)||!Te(s[t],e[t]))return!1;break;case Array:if(s.length!==e.length)return!1;for(let t=0;t<s.length;t++)if(!Te(s[t],e[t]))return!1;break;default:return!1}return!0},Ui=(s,e)=>e.includes(s),we=typeof process<"u"&&process.release&&/node|io\.js/.test(process.release.name),xs=typeof window<"u"&&typeof document<"u"&&!we;let N;const zi=()=>{if(N===void 0)if(we){N=_();const s=process.argv;let e=null;for(let t=0;t<s.length;t++){const n=s[t];n[0]==="-"?(e!==null&&N.set(e,""),e=n):e!==null&&(N.set(e,n),e=null)}e!==null&&N.set(e,"")}else typeof location=="object"?(N=_(),(location.search||"?").slice(1).split("&").forEach(s=>{if(s.length!==0){const[e,t]=s.split("=");N.set(`--${Ss(e,"-")}`,t),N.set(`-${Ss(e,"-")}`,t)}})):N=_();return N},It=s=>zi().has(s),Lt=s=>Ds(we?process.env[s.toUpperCase()]:Cs.getItem(s));(s=>It("--"+s)||Lt(s)!==null)("production");const As=we&&Ui(process.env.FORCE_COLOR,["true","1","2"]),Oi=!It("no-colors")&&(!we||process.stdout.isTTY||As)&&(!we||It("color")||As||Lt("COLORTERM")!==null||(Lt("TERM")||"").includes("color")),Y=Math.floor,et=Math.abs,jt=(s,e)=>s<e?s:e,ce=(s,e)=>s>e?s:e,Ri=Math.pow,Is=s=>s!==0?s<0:1/s<0,Ls=1,js=2,Mt=4,Tt=8,Ue=32,J=64,T=128,tt=31,Ut=63,ae=127,Ni=2147483647,Ms=Number.MAX_SAFE_INTEGER,Bi=Number.isInteger||(s=>typeof s=="number"&&isFinite(s)&&Y(s)===s);class ze{constructor(){this.cpos=0,this.cbuf=new Uint8Array(100),this.bufs=[]}}const L=()=>new ze,zt=s=>{let e=s.cpos;for(let t=0;t<s.bufs.length;t++)e+=s.bufs[t].length;return e},S=s=>{const e=new Uint8Array(zt(s));let t=0;for(let n=0;n<s.bufs.length;n++){const i=s.bufs[n];e.set(i,t),t+=i.length}return e.set(qt(s.cbuf.buffer,0,s.cpos),t),e},Fi=(s,e)=>{const t=s.cbuf.length;t-s.cpos<e&&(s.bufs.push(qt(s.cbuf.buffer,0,s.cpos)),s.cbuf=new Uint8Array(ce(t,e)*2),s.cpos=0)},x=(s,e)=>{const t=s.cbuf.length;s.cpos===t&&(s.bufs.push(s.cbuf),s.cbuf=new Uint8Array(t*2),s.cpos=0),s.cbuf[s.cpos++]=e},Ot=x,p=(s,e)=>{for(;e>ae;)x(s,T|ae&e),e=Y(e/128);x(s,ae&e)},Rt=(s,e)=>{const t=Is(e);for(t&&(e=-e),x(s,(e>Ut?T:0)|(t?J:0)|Ut&e),e=Y(e/64);e>0;)x(s,(e>ae?T:0)|ae&e),e=Y(e/128)},Nt=new Uint8Array(3e4),Vi=Nt.length/3,Hi=(s,e)=>{if(e.length<Vi){const t=je.encodeInto(e,Nt).written||0;p(s,t);for(let n=0;n<t;n++)x(s,Nt[n])}else D(s,_i(e))},$i=(s,e)=>{const t=unescape(encodeURIComponent(e)),n=t.length;p(s,n);for(let i=0;i<n;i++)x(s,t.codePointAt(i))},le=je&&je.encodeInto?Hi:$i,st=(s,e)=>{const t=s.cbuf.length,n=s.cpos,i=jt(t-n,e.length),r=e.length-i;s.cbuf.set(e.subarray(0,i),n),s.cpos+=i,r>0&&(s.bufs.push(s.cbuf),s.cbuf=new Uint8Array(ce(t*2,r)),s.cbuf.set(e.subarray(i)),s.cpos=r)},D=(s,e)=>{p(s,e.byteLength),st(s,e)},Bt=(s,e)=>{Fi(s,e);const t=new DataView(s.cbuf.buffer,s.cpos,e);return s.cpos+=e,t},qi=(s,e)=>Bt(s,4).setFloat32(0,e,!1),Ki=(s,e)=>Bt(s,8).setFloat64(0,e,!1),Yi=(s,e)=>Bt(s,8).setBigInt64(0,e,!1),Ts=new DataView(new ArrayBuffer(4)),Ji=s=>(Ts.setFloat32(0,s),Ts.getFloat32(0)===s),Oe=(s,e)=>{switch(typeof e){case"string":x(s,119),le(s,e);break;case"number":Bi(e)&&et(e)<=Ni?(x(s,125),Rt(s,e)):Ji(e)?(x(s,124),qi(s,e)):(x(s,123),Ki(s,e));break;case"bigint":x(s,122),Yi(s,e);break;case"object":if(e===null)x(s,126);else if(gi(e)){x(s,117),p(s,e.length);for(let t=0;t<e.length;t++)Oe(s,e[t])}else if(e instanceof Uint8Array)x(s,116),D(s,e);else{x(s,118);const t=Object.keys(e);p(s,t.length);for(let n=0;n<t.length;n++){const i=t[n];le(s,i),Oe(s,e[i])}}break;case"boolean":x(s,e?120:121);break;default:x(s,127)}};class Us extends ze{constructor(e){super(),this.w=e,this.s=null,this.count=0}write(e){this.s===e?this.count++:(this.count>0&&p(this,this.count-1),this.count=1,this.w(this,e),this.s=e)}}const zs=s=>{s.count>0&&(Rt(s.encoder,s.count===1?s.s:-s.s),s.count>1&&p(s.encoder,s.count-2))};class nt{constructor(){this.encoder=new ze,this.s=0,this.count=0}write(e){this.s===e?this.count++:(zs(this),this.count=1,this.s=e)}toUint8Array(){return zs(this),S(this.encoder)}}const Os=s=>{if(s.count>0){const e=s.diff*2+(s.count===1?0:1);Rt(s.encoder,e),s.count>1&&p(s.encoder,s.count-2)}};class Ft{constructor(){this.encoder=new ze,this.s=0,this.count=0,this.diff=0}write(e){this.diff===e-this.s?(this.s=e,this.count++):(Os(this),this.count=1,this.diff=e-this.s,this.s=e)}toUint8Array(){return Os(this),S(this.encoder)}}class Xi{constructor(){this.sarr=[],this.s="",this.lensE=new nt}write(e){this.s+=e,this.s.length>19&&(this.sarr.push(this.s),this.s=""),this.lensE.write(e.length)}toUint8Array(){const e=new ze;return this.sarr.push(this.s),this.s="",le(e,this.sarr.join("")),st(e,this.lensE.toUint8Array()),S(e)}}const X=s=>new Error(s),B=()=>{throw X("Method unimplemented")},F=()=>{throw X("Unexpected case")},Rs=X("Unexpected end of array"),Ns=X("Integer out of Range");class it{constructor(e){this.arr=e,this.pos=0}}const Z=s=>new it(s),Gi=s=>s.pos!==s.arr.length,Wi=(s,e)=>{const t=qt(s.arr.buffer,s.pos+s.arr.byteOffset,e);return s.pos+=e,t},j=s=>Wi(s,k(s)),ye=s=>s.arr[s.pos++],k=s=>{let e=0,t=1;const n=s.arr.length;for(;s.pos<n;){const i=s.arr[s.pos++];if(e=e+(i&ae)*t,t*=128,i<T)return e;if(e>Ms)throw Ns}throw Rs},Vt=s=>{let e=s.arr[s.pos++],t=e&Ut,n=64;const i=(e&J)>0?-1:1;if(!(e&T))return i*t;const r=s.arr.length;for(;s.pos<r;){if(e=s.arr[s.pos++],t=t+(e&ae)*n,n*=128,e<T)return i*t;if(t>Ms)throw Ns}throw Rs},ee=Me?s=>Me.decode(j(s)):s=>{let e=k(s);if(e===0)return"";{let t=String.fromCodePoint(ye(s));if(--e<100)for(;e--;)t+=String.fromCodePoint(ye(s));else for(;e>0;){const n=e<1e4?e:1e4,i=s.arr.subarray(s.pos,s.pos+n);s.pos+=n,t+=String.fromCodePoint.apply(null,i),e-=n}return decodeURIComponent(escape(t))}},Ht=(s,e)=>{const t=new DataView(s.arr.buffer,s.arr.byteOffset+s.pos,e);return s.pos+=e,t},Pi=[s=>{},s=>null,Vt,s=>Ht(s,4).getFloat32(0,!1),s=>Ht(s,8).getFloat64(0,!1),s=>Ht(s,8).getBigInt64(0,!1),s=>!1,s=>!0,ee,s=>{const e=k(s),t={};for(let n=0;n<e;n++){const i=ee(s);t[i]=Re(s)}return t},s=>{const e=k(s),t=[];for(let n=0;n<e;n++)t.push(Re(s));return t},j],Re=s=>Pi[127-ye(s)](s);class Bs extends it{constructor(e,t){super(e),this.reader=t,this.s=null,this.count=0}read(){return this.count===0&&(this.s=this.reader(this),Gi(this)?this.count=k(this)+1:this.count=-1),this.count--,this.s}}class rt extends it{constructor(e){super(e),this.s=0,this.count=0}read(){if(this.count===0){this.s=Vt(this);const e=Is(this.s);this.count=1,e&&(this.s=-this.s,this.count=k(this)+2)}return this.count--,this.s}}class $t extends it{constructor(e){super(e),this.s=0,this.count=0,this.diff=0}read(){if(this.count===0){const e=Vt(this),t=e&1;this.diff=Y(e/2),this.count=1,t&&(this.count=k(this)+2)}return this.s+=this.diff,this.count--,this.s}}class Qi{constructor(e){this.decoder=new rt(e),this.str=ee(this.decoder),this.spos=0}read(){const e=this.spos+this.decoder.read(),t=this.str.slice(this.spos,e);return this.spos=e,t}}const Fs=s=>new Uint8Array(s),qt=(s,e,t)=>new Uint8Array(s,e,t),Zi=s=>new Uint8Array(s),er=s=>{let e="";for(let t=0;t<s.byteLength;t++)e+=pi(s[t]);return btoa(e)},tr=s=>Buffer.from(s.buffer,s.byteOffset,s.byteLength).toString("base64"),sr=s=>{const e=atob(s),t=Fs(e.length);for(let n=0;n<e.length;n++)t[n]=e.charCodeAt(n);return t},nr=s=>{const e=Buffer.from(s,"base64");return new Uint8Array(e.buffer,e.byteOffset,e.byteLength)},ir=xs?er:tr,rr=xs?sr:nr,or=s=>{const e=Fs(s.byteLength);return e.set(s),e},Vs=new Map;class cr{constructor(e){this.room=e,this.onmessage=null,this._onChange=t=>t.key===e&&this.onmessage!==null&&this.onmessage({data:rr(t.newValue||"")}),Di(this._onChange)}postMessage(e){Cs.setItem(this.room,ir(Zi(e)))}close(){Ei(this._onChange)}}const ar=typeof BroadcastChannel>"u"?cr:BroadcastChannel,Kt=s=>K(Vs,s,()=>{const e=oe(),t=new ar(s);return t.onmessage=n=>e.forEach(i=>i(n.data,"broadcastchannel")),{bc:t,subs:e}}),lr=(s,e)=>(Kt(s).subs.add(e),e),hr=(s,e)=>{const t=Kt(s),n=t.subs.delete(e);return n&&t.subs.size===0&&(t.bc.close(),Vs.delete(s)),n},_e=(s,e,t=null)=>{const n=Kt(s);n.bc.postMessage(e),n.subs.forEach(i=>i(e,t))},he=Date.now;class ot{constructor(){this._observers=_()}on(e,t){K(this._observers,e,oe).add(t)}once(e,t){const n=(...i)=>{this.off(e,n),t(...i)};this.on(e,n)}off(e,t){const n=this._observers.get(e);n!==void 0&&(n.delete(t),n.size===0&&this._observers.delete(e))}emit(e,t){return Q((this._observers.get(e)||_()).values()).forEach(n=>n(...t))}destroy(){this._observers=_()}}const ur=crypto.getRandomValues.bind(crypto),Hs=()=>ur(new Uint32Array(1))[0],dr=[1e7]+-1e3+-4e3+-8e3+-1e11,fr=()=>dr.replace(/[018]/g,s=>(s^Hs()&15>>s/4).toString(16)),Se=s=>new Promise(s);Promise.all.bind(Promise);class gr{constructor(e,t){this.left=e,this.right=t}}const G=(s,e)=>new gr(s,e);typeof DOMParser<"u"&&new DOMParser;const pr=s=>ui(s,(e,t)=>`${t}:${e};`).join(""),W=Symbol,$s=W(),qs=W(),kr=W(),mr=W(),br=W(),Ks=W(),wr=W(),Ys=W(),yr=W(),_r=s=>{const e=[];let t=0;for(;t<s.length;t++){const n=s[t];n.constructor===String||n.constructor===Number||n.constructor===Object&&e.push(JSON.stringify(n))}return e},Sr={[$s]:G("font-weight","bold"),[qs]:G("font-weight","normal"),[kr]:G("color","blue"),[br]:G("color","green"),[mr]:G("color","grey"),[Ks]:G("color","red"),[wr]:G("color","purple"),[Ys]:G("color","orange"),[yr]:G("color","black")},Dr=Oi?s=>{const e=[],t=[],n=_();let i=[],r=0;for(;r<s.length;r++){const o=s[r],c=Sr[o];if(c!==void 0)n.set(c.left,c.right);else if(o.constructor===String||o.constructor===Number){const a=pr(n);r>0||a.length>0?(e.push("%c"+o),t.push(a)):e.push(o)}else break}for(r>0&&(i=t,i.unshift(e.join("")));r<s.length;r++){const o=s[r];o instanceof Symbol||i.push(o)}return i}:_r,Er=(...s)=>{console.log(...Dr(s)),Cr.forEach(e=>e.print(s))},Cr=oe(),Js=s=>({[Symbol.iterator](){return this},next:s}),vr=(s,e)=>Js(()=>{let t;do t=s.next();while(!t.done&&!e(t.value));return t}),Yt=(s,e)=>Js(()=>{const{done:t,value:n}=s.next();return{done:t,value:t?void 0:e(n)}});class Jt{constructor(e,t){this.clock=e,this.len=t}}class Ne{constructor(){this.clients=new Map}}const Xs=(s,e,t)=>e.clients.forEach((n,i)=>{const r=s.doc.store.clients.get(i);for(let o=0;o<n.length;o++){const c=n[o];gn(s,r,c.clock,c.len,t)}}),xr=(s,e)=>{let t=0,n=s.length-1;for(;t<=n;){const i=Y((t+n)/2),r=s[i],o=r.clock;if(o<=e){if(e<o+r.len)return i;t=i+1}else n=i-1}return null},Gs=(s,e)=>{const t=s.clients.get(e.client);return t!==void 0&&xr(t,e.clock)!==null},Xt=s=>{s.clients.forEach(e=>{e.sort((i,r)=>i.clock-r.clock);let t,n;for(t=1,n=1;t<e.length;t++){const i=e[n-1],r=e[t];i.clock+i.len>=r.clock?i.len=ce(i.len,r.clock+r.len-i.clock):(n<t&&(e[n]=r),n++)}e.length=n})},Ar=s=>{const e=new Ne;for(let t=0;t<s.length;t++)s[t].clients.forEach((n,i)=>{if(!e.clients.has(i)){const r=n.slice();for(let o=t+1;o<s.length;o++)fi(r,s[o].clients.get(i)||[]);e.clients.set(i,r)}});return Xt(e),e},ct=(s,e,t,n)=>{K(s.clients,e,()=>[]).push(new Jt(t,n))},Ir=()=>new Ne,Lr=s=>{const e=Ir();return s.clients.forEach((t,n)=>{const i=[];for(let r=0;r<t.length;r++){const o=t[r];if(o.deleted){const c=o.id.clock;let a=o.length;if(r+1<t.length)for(let l=t[r+1];r+1<t.length&&l.deleted;l=t[++r+1])a+=l.length;i.push(new Jt(c,a))}}i.length>0&&e.clients.set(n,i)}),e},De=(s,e)=>{p(s.restEncoder,e.clients.size),Q(e.clients.entries()).sort((t,n)=>n[0]-t[0]).forEach(([t,n])=>{s.resetDsCurVal(),p(s.restEncoder,t);const i=n.length;p(s.restEncoder,i);for(let r=0;r<i;r++){const o=n[r];s.writeDsClock(o.clock),s.writeDsLen(o.len)}})},Gt=s=>{const e=new Ne,t=k(s.restDecoder);for(let n=0;n<t;n++){s.resetDsCurVal();const i=k(s.restDecoder),r=k(s.restDecoder);if(r>0){const o=K(e.clients,i,()=>[]);for(let c=0;c<r;c++)o.push(new Jt(s.readDsClock(),s.readDsLen()))}}return e},Ws=(s,e,t)=>{const n=new Ne,i=k(s.restDecoder);for(let r=0;r<i;r++){s.resetDsCurVal();const o=k(s.restDecoder),c=k(s.restDecoder),a=t.clients.get(o)||[],l=A(t,o);for(let h=0;h<c;h++){const u=s.readDsClock(),d=u+s.readDsLen();if(u<l){l<d&&ct(n,o,l,d-l);let f=V(a,u),g=a[f];for(!g.deleted&&g.id.clock<u&&(a.splice(f+1,0,St(e,g,u-g.id.clock)),f++);f<a.length&&(g=a[f++],g.id.clock<d);)g.deleted||(d<g.id.clock+g.length&&a.splice(f,0,St(e,g,d-g.id.clock)),g.delete(e))}else ct(n,o,u,d-u)}}if(n.clients.size>0){const r=new ue;return p(r.restEncoder,0),De(r,n),r.toUint8Array()}return null},Ps=Hs;class Ee extends ot{constructor({guid:e=fr(),collectionid:t=null,gc:n=!0,gcFilter:i=()=>!0,meta:r=null,autoLoad:o=!1,shouldLoad:c=!0}={}){super(),this.gc=n,this.gcFilter=i,this.clientID=Ps(),this.guid=e,this.collectionid=t,this.share=new Map,this.store=new un,this._transaction=null,this._transactionCleanups=[],this.subdocs=new Set,this._item=null,this.shouldLoad=c,this.autoLoad=o,this.meta=r,this.isLoaded=!1,this.isSynced=!1,this.whenLoaded=Se(l=>{this.on("load",()=>{this.isLoaded=!0,l(this)})});const a=()=>Se(l=>{const h=u=>{(u===void 0||u===!0)&&(this.off("sync",h),l())};this.on("sync",h)});this.on("sync",l=>{l===!1&&this.isSynced&&(this.whenSynced=a()),this.isSynced=l===void 0||l===!0,this.isLoaded||this.emit("load",[])}),this.whenSynced=a()}load(){const e=this._item;e!==null&&!this.shouldLoad&&y(e.parent.doc,t=>{t.subdocsLoaded.add(this)},null,!0),this.shouldLoad=!0}getSubdocs(){return this.subdocs}getSubdocGuids(){return new Set(Q(this.subdocs).map(e=>e.guid))}transact(e,t=null){return y(this,e,t)}get(e,t=I){const n=K(this.share,e,()=>{const r=new t;return r._integrate(this,null),r}),i=n.constructor;if(t!==I&&i!==t)if(i===I){const r=new t;r._map=n._map,n._map.forEach(o=>{for(;o!==null;o=o.left)o.parent=r}),r._start=n._start;for(let o=r._start;o!==null;o=o.right)o.parent=r;return r._length=n._length,this.share.set(e,r),r._integrate(this,null),r}else throw new Error(`Type with the name ${e} has already been defined with a different constructor`);return n}getArray(e=""){return this.get(e,xe)}getText(e=""){return this.get(e,Ie)}getMap(e=""){return this.get(e,de)}getXmlFragment(e=""){return this.get(e,fe)}toJSON(){const e={};return this.share.forEach((t,n)=>{e[n]=t.toJSON()}),e}destroy(){Q(this.subdocs).forEach(t=>t.destroy());const e=this._item;if(e!==null){this._item=null;const t=e.content;t.doc=new Ee({guid:this.guid,...t.opts,shouldLoad:!1}),t.doc._item=e,y(e.parent.doc,n=>{const i=t.doc;e.deleted||n.subdocsAdded.add(i),n.subdocsRemoved.add(this)},null,!0)}this.emit("destroyed",[!0]),this.emit("destroy",[this]),super.destroy()}on(e,t){super.on(e,t)}off(e,t){super.off(e,t)}}class Qs{constructor(e){this.restDecoder=e}resetDsCurVal(){}readDsClock(){return k(this.restDecoder)}readDsLen(){return k(this.restDecoder)}}class Zs extends Qs{readLeftID(){return w(k(this.restDecoder),k(this.restDecoder))}readRightID(){return w(k(this.restDecoder),k(this.restDecoder))}readClient(){return k(this.restDecoder)}readInfo(){return ye(this.restDecoder)}readString(){return ee(this.restDecoder)}readParentInfo(){return k(this.restDecoder)===1}readTypeRef(){return k(this.restDecoder)}readLen(){return k(this.restDecoder)}readAny(){return Re(this.restDecoder)}readBuf(){return or(j(this.restDecoder))}readJSON(){return JSON.parse(ee(this.restDecoder))}readKey(){return ee(this.restDecoder)}}class jr{constructor(e){this.dsCurrVal=0,this.restDecoder=e}resetDsCurVal(){this.dsCurrVal=0}readDsClock(){return this.dsCurrVal+=k(this.restDecoder),this.dsCurrVal}readDsLen(){const e=k(this.restDecoder)+1;return this.dsCurrVal+=e,e}}class Ce extends jr{constructor(e){super(e),this.keys=[],k(e),this.keyClockDecoder=new $t(j(e)),this.clientDecoder=new rt(j(e)),this.leftClockDecoder=new $t(j(e)),this.rightClockDecoder=new $t(j(e)),this.infoDecoder=new Bs(j(e),ye),this.stringDecoder=new Qi(j(e)),this.parentInfoDecoder=new Bs(j(e),ye),this.typeRefDecoder=new rt(j(e)),this.lenDecoder=new rt(j(e))}readLeftID(){return new ve(this.clientDecoder.read(),this.leftClockDecoder.read())}readRightID(){return new ve(this.clientDecoder.read(),this.rightClockDecoder.read())}readClient(){return this.clientDecoder.read()}readInfo(){return this.infoDecoder.read()}readString(){return this.stringDecoder.read()}readParentInfo(){return this.parentInfoDecoder.read()===1}readTypeRef(){return this.typeRefDecoder.read()}readLen(){return this.lenDecoder.read()}readAny(){return Re(this.restDecoder)}readBuf(){return j(this.restDecoder)}readJSON(){return Re(this.restDecoder)}readKey(){const e=this.keyClockDecoder.read();if(e<this.keys.length)return this.keys[e];{const t=this.stringDecoder.read();return this.keys.push(t),t}}}class en{constructor(){this.restEncoder=L()}toUint8Array(){return S(this.restEncoder)}resetDsCurVal(){}writeDsClock(e){p(this.restEncoder,e)}writeDsLen(e){p(this.restEncoder,e)}}class Be extends en{writeLeftID(e){p(this.restEncoder,e.client),p(this.restEncoder,e.clock)}writeRightID(e){p(this.restEncoder,e.client),p(this.restEncoder,e.clock)}writeClient(e){p(this.restEncoder,e)}writeInfo(e){Ot(this.restEncoder,e)}writeString(e){le(this.restEncoder,e)}writeParentInfo(e){p(this.restEncoder,e?1:0)}writeTypeRef(e){p(this.restEncoder,e)}writeLen(e){p(this.restEncoder,e)}writeAny(e){Oe(this.restEncoder,e)}writeBuf(e){D(this.restEncoder,e)}writeJSON(e){le(this.restEncoder,JSON.stringify(e))}writeKey(e){le(this.restEncoder,e)}}class tn{constructor(){this.restEncoder=L(),this.dsCurrVal=0}toUint8Array(){return S(this.restEncoder)}resetDsCurVal(){this.dsCurrVal=0}writeDsClock(e){const t=e-this.dsCurrVal;this.dsCurrVal=e,p(this.restEncoder,t)}writeDsLen(e){e===0&&F(),p(this.restEncoder,e-1),this.dsCurrVal+=e}}class ue extends tn{constructor(){super(),this.keyMap=new Map,this.keyClock=0,this.keyClockEncoder=new Ft,this.clientEncoder=new nt,this.leftClockEncoder=new Ft,this.rightClockEncoder=new Ft,this.infoEncoder=new Us(Ot),this.stringEncoder=new Xi,this.parentInfoEncoder=new Us(Ot),this.typeRefEncoder=new nt,this.lenEncoder=new nt}toUint8Array(){const e=L();return p(e,0),D(e,this.keyClockEncoder.toUint8Array()),D(e,this.clientEncoder.toUint8Array()),D(e,this.leftClockEncoder.toUint8Array()),D(e,this.rightClockEncoder.toUint8Array()),D(e,S(this.infoEncoder)),D(e,this.stringEncoder.toUint8Array()),D(e,S(this.parentInfoEncoder)),D(e,this.typeRefEncoder.toUint8Array()),D(e,this.lenEncoder.toUint8Array()),st(e,S(this.restEncoder)),S(e)}writeLeftID(e){this.clientEncoder.write(e.client),this.leftClockEncoder.write(e.clock)}writeRightID(e){this.clientEncoder.write(e.client),this.rightClockEncoder.write(e.clock)}writeClient(e){this.clientEncoder.write(e)}writeInfo(e){this.infoEncoder.write(e)}writeString(e){this.stringEncoder.write(e)}writeParentInfo(e){this.parentInfoEncoder.write(e?1:0)}writeTypeRef(e){this.typeRefEncoder.write(e)}writeLen(e){this.lenEncoder.write(e)}writeAny(e){Oe(this.restEncoder,e)}writeBuf(e){D(this.restEncoder,e)}writeJSON(e){Oe(this.restEncoder,e)}writeKey(e){const t=this.keyMap.get(e);t===void 0?(this.keyClockEncoder.write(this.keyClock++),this.stringEncoder.write(e)):this.keyClockEncoder.write(t)}}const Mr=(s,e,t,n)=>{n=ce(n,e[0].id.clock);const i=V(e,n);p(s.restEncoder,e.length-i),s.writeClient(t),p(s.restEncoder,n);const r=e[i];r.write(s,n-r.id.clock);for(let o=i+1;o<e.length;o++)e[o].write(s,0)},Wt=(s,e,t)=>{const n=new Map;t.forEach((i,r)=>{A(e,r)>i&&n.set(r,i)}),lt(e).forEach((i,r)=>{t.has(r)||n.set(r,0)}),p(s.restEncoder,n.size),Q(n.entries()).sort((i,r)=>r[0]-i[0]).forEach(([i,r])=>{Mr(s,e.clients.get(i),i,r)})},Tr=(s,e)=>{const t=_(),n=k(s.restDecoder);for(let i=0;i<n;i++){const r=k(s.restDecoder),o=new Array(r),c=s.readClient();let a=k(s.restDecoder);t.set(c,{i:0,refs:o});for(let l=0;l<r;l++){const h=s.readInfo();switch(tt&h){case 0:{const u=s.readLen();o[l]=new O(w(c,a),u),a+=u;break}case 10:{const u=k(s.restDecoder);o[l]=new R(w(c,a),u),a+=u;break}default:{const u=(h&(J|T))===0,d=new v(w(c,a),null,(h&T)===T?s.readLeftID():null,null,(h&J)===J?s.readRightID():null,u?s.readParentInfo()?e.get(s.readString()):s.readLeftID():null,u&&(h&Ue)===Ue?s.readString():null,Bn(s,h));o[l]=d,a+=d.length}}}}return t},Ur=(s,e,t)=>{const n=[];let i=Q(t.keys()).sort((f,g)=>f-g);if(i.length===0)return null;const r=()=>{if(i.length===0)return null;let f=t.get(i[i.length-1]);for(;f.refs.length===f.i;)if(i.pop(),i.length>0)f=t.get(i[i.length-1]);else return null;return f};let o=r();if(o===null&&n.length===0)return null;const c=new un,a=new Map,l=(f,g)=>{const m=a.get(f);(m==null||m>g)&&a.set(f,g)};let h=o.refs[o.i++];const u=new Map,d=()=>{for(const f of n){const g=f.id.client,m=t.get(g);m?(m.i--,c.clients.set(g,m.refs.slice(m.i)),t.delete(g),m.i=0,m.refs=[]):c.clients.set(g,[f]),i=i.filter(U=>U!==g)}n.length=0};for(;;){if(h.constructor!==R){const g=K(u,h.id.client,()=>A(e,h.id.client))-h.id.clock;if(g<0)n.push(h),l(h.id.client,h.id.clock-1),d();else{const m=h.getMissing(s,e);if(m!==null){n.push(h);const U=t.get(m)||{refs:[],i:0};if(U.refs.length===U.i)l(m,A(e,m)),d();else{h=U.refs[U.i++];continue}}else(g===0||g<h.length)&&(h.integrate(s,g),u.set(h.id.client,h.id.clock+h.length))}}if(n.length>0)h=n.pop();else if(o!==null&&o.i<o.refs.length)h=o.refs[o.i++];else{if(o=r(),o===null)break;h=o.refs[o.i++]}}if(c.clients.size>0){const f=new ue;return Wt(f,c,new Map),p(f.restEncoder,0),{missing:a,update:f.toUint8Array()}}return null},zr=(s,e)=>Wt(s,e.doc.store,e.beforeState),Or=(s,e,t,n=new Ce(s))=>y(e,i=>{i.local=!1;let r=!1;const o=i.doc,c=o.store,a=Tr(n,o),l=Ur(i,c,a),h=c.pendingStructs;if(h){for(const[d,f]of h.missing)if(f<A(c,d)){r=!0;break}if(l){for(const[d,f]of l.missing){const g=h.missing.get(d);(g==null||g>f)&&h.missing.set(d,f)}h.update=ut([h.update,l.update])}}else c.pendingStructs=l;const u=Ws(n,i,c);if(c.pendingDs){const d=new Ce(Z(c.pendingDs));k(d.restDecoder);const f=Ws(d,i,c);u&&f?c.pendingDs=ut([u,f]):c.pendingDs=u||f}else c.pendingDs=u;if(r){const d=c.pendingStructs.update;c.pendingStructs=null,sn(i.doc,d)}},t,!1),sn=(s,e,t,n=Ce)=>{const i=Z(e);Or(i,s,t,new n(i))},nn=(s,e,t)=>sn(s,e,t,Zs),Rr=(s,e,t=new Map)=>{Wt(s,e.store,t),De(s,Lr(e.store))},Nr=(s,e=new Uint8Array([0]),t=new ue)=>{const n=rn(e);Rr(t,s,n);const i=[t.toUint8Array()];if(s.store.pendingDs&&i.push(s.store.pendingDs),s.store.pendingStructs&&i.push(Qr(s.store.pendingStructs.update,e)),i.length>1){if(t.constructor===Be)return Wr(i.map((r,o)=>o===0?r:eo(r)));if(t.constructor===ue)return ut(i)}return i[0]},Pt=(s,e)=>Nr(s,e,new Be),Br=s=>{const e=new Map,t=k(s.restDecoder);for(let n=0;n<t;n++){const i=k(s.restDecoder),r=k(s.restDecoder);e.set(i,r)}return e},rn=s=>Br(new Qs(Z(s))),on=(s,e)=>(p(s.restEncoder,e.size),Q(e.entries()).sort((t,n)=>n[0]-t[0]).forEach(([t,n])=>{p(s.restEncoder,t),p(s.restEncoder,n)}),s),Fr=(s,e)=>on(s,lt(e.store)),Vr=(s,e=new tn)=>(s instanceof Map?on(e,s):Fr(e,s),e.toUint8Array()),Hr=s=>Vr(s,new en);class $r{constructor(){this.l=[]}}const cn=()=>new $r,an=(s,e)=>s.l.push(e),ln=(s,e)=>{const t=s.l,n=t.length;s.l=t.filter(i=>e!==i),n===s.l.length&&console.error("[yjs] Tried to remove event handler that doesn't exist.")},hn=(s,e,t)=>At(s.l,[e,t]);class ve{constructor(e,t){this.client=e,this.clock=t}}const at=(s,e)=>s===e||s!==null&&e!==null&&s.client===e.client&&s.clock===e.clock,w=(s,e)=>new ve(s,e),qr=s=>{for(const[e,t]of s.doc.share.entries())if(t===s)return e;throw F()},Fe=(s,e)=>e===void 0?!s.deleted:e.sv.has(s.id.client)&&(e.sv.get(s.id.client)||0)>s.id.clock&&!Gs(e.ds,s.id),Qt=(s,e)=>{const t=K(s.meta,Qt,oe),n=s.doc.store;t.has(e)||(e.sv.forEach((i,r)=>{i<A(n,r)&&te(s,w(r,i))}),Xs(s,e.ds,i=>{}),t.add(e))};class un{constructor(){this.clients=new Map,this.pendingStructs=null,this.pendingDs=null}}const lt=s=>{const e=new Map;return s.clients.forEach((t,n)=>{const i=t[t.length-1];e.set(n,i.id.clock+i.length)}),e},A=(s,e)=>{const t=s.clients.get(e);if(t===void 0)return 0;const n=t[t.length-1];return n.id.clock+n.length},dn=(s,e)=>{let t=s.clients.get(e.id.client);if(t===void 0)t=[],s.clients.set(e.id.client,t);else{const n=t[t.length-1];if(n.id.clock+n.length!==e.id.clock)throw F()}t.push(e)},V=(s,e)=>{let t=0,n=s.length-1,i=s[n],r=i.id.clock;if(r===e)return n;let o=Y(e/(r+i.length-1)*n);for(;t<=n;){if(i=s[o],r=i.id.clock,r<=e){if(e<r+i.length)return o;t=o+1}else n=o-1;o=Y((t+n)/2)}throw F()},Zt=(s,e)=>{const t=s.clients.get(e.client);return t[V(t,e.clock)]},es=(s,e,t)=>{const n=V(e,t),i=e[n];return i.id.clock<t&&i instanceof v?(e.splice(n+1,0,St(s,i,t-i.id.clock)),n+1):n},te=(s,e)=>{const t=s.doc.store.clients.get(e.client);return t[es(s,t,e.clock)]},fn=(s,e,t)=>{const n=e.clients.get(t.client),i=V(n,t.clock),r=n[i];return t.clock!==r.id.clock+r.length-1&&r.constructor!==O&&n.splice(i+1,0,St(s,r,t.clock-r.id.clock+1)),r},Kr=(s,e,t)=>{const n=s.clients.get(e.id.client);n[V(n,e.id.clock)]=t},gn=(s,e,t,n,i)=>{if(n===0)return;const r=t+n;let o=es(s,e,t),c;do c=e[o++],r<c.id.clock+c.length&&es(s,e,r),i(c);while(o<e.length&&e[o].id.clock<r)};class Yr{constructor(e,t,n){this.doc=e,this.deleteSet=new Ne,this.beforeState=lt(e.store),this.afterState=new Map,this.changed=new Map,this.changedParentTypes=new Map,this._mergeStructs=[],this.origin=t,this.meta=new Map,this.local=n,this.subdocsAdded=new Set,this.subdocsRemoved=new Set,this.subdocsLoaded=new Set,this._needFormattingCleanup=!1}}const pn=(s,e)=>e.deleteSet.clients.size===0&&!di(e.afterState,(t,n)=>e.beforeState.get(n)!==t)?!1:(Xt(e.deleteSet),zr(s,e),De(s,e.deleteSet),!0),kn=(s,e,t)=>{const n=e._item;(n===null||n.id.clock<(s.beforeState.get(n.id.client)||0)&&!n.deleted)&&K(s.changed,e,oe).add(t)},ht=(s,e)=>{let t=s[e],n=s[e-1],i=e;for(;i>0;t=n,n=s[--i-1]){if(n.deleted===t.deleted&&n.constructor===t.constructor&&n.mergeWith(t)){t instanceof v&&t.parentSub!==null&&t.parent._map.get(t.parentSub)===t&&t.parent._map.set(t.parentSub,n);continue}break}const r=e-i;return r&&s.splice(e+1-r,r),r},Jr=(s,e,t)=>{for(const[n,i]of s.clients.entries()){const r=e.clients.get(n);for(let o=i.length-1;o>=0;o--){const c=i[o],a=c.clock+c.len;for(let l=V(r,c.clock),h=r[l];l<r.length&&h.id.clock<a;h=r[++l]){const u=r[l];if(c.clock+c.len<=u.id.clock)break;u instanceof v&&u.deleted&&!u.keep&&t(u)&&u.gc(e,!1)}}}},Xr=(s,e)=>{s.clients.forEach((t,n)=>{const i=e.clients.get(n);for(let r=t.length-1;r>=0;r--){const o=t[r],c=jt(i.length-1,1+V(i,o.clock+o.len-1));for(let a=c,l=i[a];a>0&&l.id.clock>=o.clock;l=i[a])a-=1+ht(i,a)}})},mn=(s,e)=>{if(e<s.length){const t=s[e],n=t.doc,i=n.store,r=t.deleteSet,o=t._mergeStructs;try{Xt(r),t.afterState=lt(t.doc.store),n.emit("beforeObserverCalls",[t,n]);const c=[];t.changed.forEach((a,l)=>c.push(()=>{(l._item===null||!l._item.deleted)&&l._callObserver(t,a)})),c.push(()=>{t.changedParentTypes.forEach((a,l)=>{l._dEH.l.length>0&&(l._item===null||!l._item.deleted)&&(a=a.filter(h=>h.target._item===null||!h.target._item.deleted),a.forEach(h=>{h.currentTarget=l,h._path=null}),a.sort((h,u)=>h.path.length-u.path.length),hn(l._dEH,a,t))})}),c.push(()=>n.emit("afterTransaction",[t,n])),At(c,[]),t._needFormattingCleanup&&go(t)}finally{n.gc&&Jr(r,i,n.gcFilter),Xr(r,i),t.afterState.forEach((h,u)=>{const d=t.beforeState.get(u)||0;if(d!==h){const f=i.clients.get(u),g=ce(V(f,d),1);for(let m=f.length-1;m>=g;)m-=1+ht(f,m)}});for(let h=o.length-1;h>=0;h--){const{client:u,clock:d}=o[h].id,f=i.clients.get(u),g=V(f,d);g+1<f.length&&ht(f,g+1)>1||g>0&&ht(f,g)}if(!t.local&&t.afterState.get(n.clientID)!==t.beforeState.get(n.clientID)&&(Er(Ys,$s,"[yjs] ",qs,Ks,"Changed the client-id because another client seems to be using it."),n.clientID=Ps()),n.emit("afterTransactionCleanup",[t,n]),n._observers.has("update")){const h=new Be;pn(h,t)&&n.emit("update",[h.toUint8Array(),t.origin,n,t])}if(n._observers.has("updateV2")){const h=new ue;pn(h,t)&&n.emit("updateV2",[h.toUint8Array(),t.origin,n,t])}const{subdocsAdded:c,subdocsLoaded:a,subdocsRemoved:l}=t;(c.size>0||l.size>0||a.size>0)&&(c.forEach(h=>{h.clientID=n.clientID,h.collectionid==null&&(h.collectionid=n.collectionid),n.subdocs.add(h)}),l.forEach(h=>n.subdocs.delete(h)),n.emit("subdocs",[{loaded:a,added:c,removed:l},n,t]),l.forEach(h=>h.destroy())),s.length<=e+1?(n._transactionCleanups=[],n.emit("afterAllTransactions",[n,s])):mn(s,e+1)}}},y=(s,e,t=null,n=!0)=>{const i=s._transactionCleanups;let r=!1,o=null;s._transaction===null&&(r=!0,s._transaction=new Yr(s,t,n),i.push(s._transaction),i.length===1&&s.emit("beforeAllTransactions",[s]),s.emit("beforeTransaction",[s._transaction,s]));try{o=e(s._transaction)}finally{if(r){const c=s._transaction===i[0];s._transaction=null,c&&mn(i,0)}}return o};function*Gr(s){const e=k(s.restDecoder);for(let t=0;t<e;t++){const n=k(s.restDecoder),i=s.readClient();let r=k(s.restDecoder);for(let o=0;o<n;o++){const c=s.readInfo();if(c===10){const a=k(s.restDecoder);yield new R(w(i,r),a),r+=a}else if(tt&c){const a=(c&(J|T))===0,l=new v(w(i,r),null,(c&T)===T?s.readLeftID():null,null,(c&J)===J?s.readRightID():null,a?s.readParentInfo()?s.readString():s.readLeftID():null,a&&(c&Ue)===Ue?s.readString():null,Bn(s,c));yield l,r+=l.length}else{const a=s.readLen();yield new O(w(i,r),a),r+=a}}}}class ts{constructor(e,t){this.gen=Gr(e),this.curr=null,this.done=!1,this.filterSkips=t,this.next()}next(){do this.curr=this.gen.next().value||null;while(this.filterSkips&&this.curr!==null&&this.curr.constructor===R);return this.curr}}class ss{constructor(e){this.currClient=0,this.startClock=0,this.written=0,this.encoder=e,this.clientStructs=[]}}const Wr=s=>ut(s,Zs,Be),Pr=(s,e)=>{if(s.constructor===O){const{client:t,clock:n}=s.id;return new O(w(t,n+e),s.length-e)}else if(s.constructor===R){const{client:t,clock:n}=s.id;return new R(w(t,n+e),s.length-e)}else{const t=s,{client:n,clock:i}=t.id;return new v(w(n,i+e),null,w(n,i+e-1),null,t.rightOrigin,t.parent,t.parentSub,t.content.splice(e))}},ut=(s,e=Ce,t=ue)=>{if(s.length===1)return s[0];const n=s.map(h=>new e(Z(h)));let i=n.map(h=>new ts(h,!0)),r=null;const o=new t,c=new ss(o);for(;i=i.filter(d=>d.curr!==null),i.sort((d,f)=>{if(d.curr.id.client===f.curr.id.client){const g=d.curr.id.clock-f.curr.id.clock;return g===0?d.curr.constructor===f.curr.constructor?0:d.curr.constructor===R?1:-1:g}else return f.curr.id.client-d.curr.id.client}),i.length!==0;){const h=i[0],u=h.curr.id.client;if(r!==null){let d=h.curr,f=!1;for(;d!==null&&d.id.clock+d.length<=r.struct.id.clock+r.struct.length&&d.id.client>=r.struct.id.client;)d=h.next(),f=!0;if(d===null||d.id.client!==u||f&&d.id.clock>r.struct.id.clock+r.struct.length)continue;if(u!==r.struct.id.client)se(c,r.struct,r.offset),r={struct:d,offset:0},h.next();else if(r.struct.id.clock+r.struct.length<d.id.clock)if(r.struct.constructor===R)r.struct.length=d.id.clock+d.length-r.struct.id.clock;else{se(c,r.struct,r.offset);const g=d.id.clock-r.struct.id.clock-r.struct.length;r={struct:new R(w(u,r.struct.id.clock+r.struct.length),g),offset:0}}else{const g=r.struct.id.clock+r.struct.length-d.id.clock;g>0&&(r.struct.constructor===R?r.struct.length-=g:d=Pr(d,g)),r.struct.mergeWith(d)||(se(c,r.struct,r.offset),r={struct:d,offset:0},h.next())}}else r={struct:h.curr,offset:0},h.next();for(let d=h.curr;d!==null&&d.id.client===u&&d.id.clock===r.struct.id.clock+r.struct.length&&d.constructor!==R;d=h.next())se(c,r.struct,r.offset),r={struct:d,offset:0}}r!==null&&(se(c,r.struct,r.offset),r=null),ns(c);const a=n.map(h=>Gt(h)),l=Ar(a);return De(o,l),o.toUint8Array()},Qr=(s,e,t=Ce,n=ue)=>{const i=rn(e),r=new n,o=new ss(r),c=new t(Z(s)),a=new ts(c,!1);for(;a.curr;){const h=a.curr,u=h.id.client,d=i.get(u)||0;if(a.curr.constructor===R){a.next();continue}if(h.id.clock+h.length>d)for(se(o,h,ce(d-h.id.clock,0)),a.next();a.curr&&a.curr.id.client===u;)se(o,a.curr,0),a.next();else for(;a.curr&&a.curr.id.client===u&&a.curr.id.clock+a.curr.length<=d;)a.next()}ns(o);const l=Gt(c);return De(r,l),r.toUint8Array()},bn=s=>{s.written>0&&(s.clientStructs.push({written:s.written,restEncoder:S(s.encoder.restEncoder)}),s.encoder.restEncoder=L(),s.written=0)},se=(s,e,t)=>{s.written>0&&s.currClient!==e.id.client&&bn(s),s.written===0&&(s.currClient=e.id.client,s.encoder.writeClient(e.id.client),p(s.encoder.restEncoder,e.id.clock+t)),e.write(s.encoder,t),s.written++},ns=s=>{bn(s);const e=s.encoder.restEncoder;p(e,s.clientStructs.length);for(let t=0;t<s.clientStructs.length;t++){const n=s.clientStructs[t];p(e,n.written),st(e,n.restEncoder)}},Zr=(s,e,t,n)=>{const i=new t(Z(s)),r=new ts(i,!1),o=new n,c=new ss(o);for(let l=r.curr;l!==null;l=r.next())se(c,e(l),0);ns(c);const a=Gt(i);return De(o,a),o.toUint8Array()},eo=s=>Zr(s,Mi,Ce,Be),wn="You must not compute changes after the event-handler fired.";class dt{constructor(e,t){this.target=e,this.currentTarget=e,this.transaction=t,this._changes=null,this._keys=null,this._delta=null,this._path=null}get path(){return this._path||(this._path=to(this.currentTarget,this.target))}deletes(e){return Gs(this.transaction.deleteSet,e.id)}get keys(){if(this._keys===null){if(this.transaction.doc._transactionCleanups.length===0)throw X(wn);const e=new Map,t=this.target;this.transaction.changed.get(t).forEach(i=>{if(i!==null){const r=t._map.get(i);let o,c;if(this.adds(r)){let a=r.left;for(;a!==null&&this.adds(a);)a=a.left;if(this.deletes(r))if(a!==null&&this.deletes(a))o="delete",c=vt(a.content.getContent());else return;else a!==null&&this.deletes(a)?(o="update",c=vt(a.content.getContent())):(o="add",c=void 0)}else if(this.deletes(r))o="delete",c=vt(r.content.getContent());else return;e.set(i,{action:o,oldValue:c})}}),this._keys=e}return this._keys}get delta(){return this.changes.delta}adds(e){return e.id.clock>=(this.transaction.beforeState.get(e.id.client)||0)}get changes(){let e=this._changes;if(e===null){if(this.transaction.doc._transactionCleanups.length===0)throw X(wn);const t=this.target,n=oe(),i=oe(),r=[];if(e={added:n,deleted:i,delta:r,keys:this.keys},this.transaction.changed.get(t).has(null)){let c=null;const a=()=>{c&&r.push(c)};for(let l=t._start;l!==null;l=l.right)l.deleted?this.deletes(l)&&!this.adds(l)&&((c===null||c.delete===void 0)&&(a(),c={delete:0}),c.delete+=l.length,i.add(l)):this.adds(l)?((c===null||c.insert===void 0)&&(a(),c={insert:[]}),c.insert=c.insert.concat(l.content.getContent()),n.add(l)):((c===null||c.retain===void 0)&&(a(),c={retain:0}),c.retain+=l.length);c!==null&&c.retain===void 0&&a()}this._changes=e}return e}}const to=(s,e)=>{const t=[];for(;e._item!==null&&e!==s;){if(e._item.parentSub!==null)t.unshift(e._item.parentSub);else{let n=0,i=e._item.parent._start;for(;i!==e._item&&i!==null;)i.deleted||n++,i=i.right;t.unshift(n)}e=e._item.parent}return t},yn=80;let is=0;class so{constructor(e,t){e.marker=!0,this.p=e,this.index=t,this.timestamp=is++}}const no=s=>{s.timestamp=is++},_n=(s,e,t)=>{s.p.marker=!1,s.p=e,e.marker=!0,s.index=t,s.timestamp=is++},io=(s,e,t)=>{if(s.length>=yn){const n=s.reduce((i,r)=>i.timestamp<r.timestamp?i:r);return _n(n,e,t),n}else{const n=new so(e,t);return s.push(n),n}},ft=(s,e)=>{if(s._start===null||e===0||s._searchMarker===null)return null;const t=s._searchMarker.length===0?null:s._searchMarker.reduce((r,o)=>et(e-r.index)<et(e-o.index)?r:o);let n=s._start,i=0;for(t!==null&&(n=t.p,i=t.index,no(t));n.right!==null&&i<e;){if(!n.deleted&&n.countable){if(e<i+n.length)break;i+=n.length}n=n.right}for(;n.left!==null&&i>e;)n=n.left,!n.deleted&&n.countable&&(i-=n.length);for(;n.left!==null&&n.left.id.client===n.id.client&&n.left.id.clock+n.left.length===n.id.clock;)n=n.left,!n.deleted&&n.countable&&(i-=n.length);return t!==null&&et(t.index-i)<n.parent.length/yn?(_n(t,n,i),t):io(s._searchMarker,n,i)},Ve=(s,e,t)=>{for(let n=s.length-1;n>=0;n--){const i=s[n];if(t>0){let r=i.p;for(r.marker=!1;r&&(r.deleted||!r.countable);)r=r.left,r&&!r.deleted&&r.countable&&(i.index-=r.length);if(r===null||r.marker===!0){s.splice(n,1);continue}i.p=r,r.marker=!0}(e<i.index||t>0&&e===i.index)&&(i.index=ce(e,i.index+t))}},gt=(s,e,t)=>{const n=s,i=e.changedParentTypes;for(;K(i,s,()=>[]).push(t),s._item!==null;)s=s._item.parent;hn(n._eH,t,e)};class I{constructor(){this._item=null,this._map=new Map,this._start=null,this.doc=null,this._length=0,this._eH=cn(),this._dEH=cn(),this._searchMarker=null}get parent(){return this._item?this._item.parent:null}_integrate(e,t){this.doc=e,this._item=t}_copy(){throw B()}clone(){throw B()}_write(e){}get _first(){let e=this._start;for(;e!==null&&e.deleted;)e=e.right;return e}_callObserver(e,t){!e.local&&this._searchMarker&&(this._searchMarker.length=0)}observe(e){an(this._eH,e)}observeDeep(e){an(this._dEH,e)}unobserve(e){ln(this._eH,e)}unobserveDeep(e){ln(this._dEH,e)}toJSON(){}}const Sn=(s,e,t)=>{e<0&&(e=s._length+e),t<0&&(t=s._length+t);let n=t-e;const i=[];let r=s._start;for(;r!==null&&n>0;){if(r.countable&&!r.deleted){const o=r.content.getContent();if(o.length<=e)e-=o.length;else{for(let c=e;c<o.length&&n>0;c++)i.push(o[c]),n--;e=0}}r=r.right}return i},Dn=s=>{const e=[];let t=s._start;for(;t!==null;){if(t.countable&&!t.deleted){const n=t.content.getContent();for(let i=0;i<n.length;i++)e.push(n[i])}t=t.right}return e},He=(s,e)=>{let t=0,n=s._start;for(;n!==null;){if(n.countable&&!n.deleted){const i=n.content.getContent();for(let r=0;r<i.length;r++)e(i[r],t++,s)}n=n.right}},En=(s,e)=>{const t=[];return He(s,(n,i)=>{t.push(e(n,i,s))}),t},ro=s=>{let e=s._start,t=null,n=0;return{[Symbol.iterator](){return this},next:()=>{if(t===null){for(;e!==null&&e.deleted;)e=e.right;if(e===null)return{done:!0,value:void 0};t=e.content.getContent(),n=0,e=e.right}const i=t[n++];return t.length<=n&&(t=null),{done:!1,value:i}}}},Cn=(s,e)=>{const t=ft(s,e);let n=s._start;for(t!==null&&(n=t.p,e-=t.index);n!==null;n=n.right)if(!n.deleted&&n.countable){if(e<n.length)return n.content.getContent()[e];e-=n.length}},pt=(s,e,t,n)=>{let i=t;const r=s.doc,o=r.clientID,c=r.store,a=t===null?e._start:t.right;let l=[];const h=()=>{l.length>0&&(i=new v(w(o,A(c,o)),i,i&&i.lastId,a,a&&a.id,e,null,new pe(l)),i.integrate(s,0),l=[])};n.forEach(u=>{if(u===null)l.push(u);else switch(u.constructor){case Number:case Object:case Boolean:case Array:case String:l.push(u);break;default:switch(h(),u.constructor){case Uint8Array:case ArrayBuffer:i=new v(w(o,A(c,o)),i,i&&i.lastId,a,a&&a.id,e,null,new qe(new Uint8Array(u))),i.integrate(s,0);break;case Ee:i=new v(w(o,A(c,o)),i,i&&i.lastId,a,a&&a.id,e,null,new Ye(u)),i.integrate(s,0);break;default:if(u instanceof I)i=new v(w(o,A(c,o)),i,i&&i.lastId,a,a&&a.id,e,null,new P(u)),i.integrate(s,0);else throw new Error("Unexpected content type in insert operation")}}}),h()},vn=X("Length exceeded!"),xn=(s,e,t,n)=>{if(t>e._length)throw vn;if(t===0)return e._searchMarker&&Ve(e._searchMarker,t,n.length),pt(s,e,null,n);const i=t,r=ft(e,t);let o=e._start;for(r!==null&&(o=r.p,t-=r.index,t===0&&(o=o.prev,t+=o&&o.countable&&!o.deleted?o.length:0));o!==null;o=o.right)if(!o.deleted&&o.countable){if(t<=o.length){t<o.length&&te(s,w(o.id.client,o.id.clock+t));break}t-=o.length}return e._searchMarker&&Ve(e._searchMarker,i,n.length),pt(s,e,o,n)},oo=(s,e,t)=>{let i=(e._searchMarker||[]).reduce((r,o)=>o.index>r.index?o:r,{index:0,p:e._start}).p;if(i)for(;i.right;)i=i.right;return pt(s,e,i,t)},An=(s,e,t,n)=>{if(n===0)return;const i=t,r=n,o=ft(e,t);let c=e._start;for(o!==null&&(c=o.p,t-=o.index);c!==null&&t>0;c=c.right)!c.deleted&&c.countable&&(t<c.length&&te(s,w(c.id.client,c.id.clock+t)),t-=c.length);for(;n>0&&c!==null;)c.deleted||(n<c.length&&te(s,w(c.id.client,c.id.clock+n)),c.delete(s),n-=c.length),c=c.right;if(n>0)throw vn;e._searchMarker&&Ve(e._searchMarker,i,-r+n)},kt=(s,e,t)=>{const n=e._map.get(t);n!==void 0&&n.delete(s)},rs=(s,e,t,n)=>{const i=e._map.get(t)||null,r=s.doc,o=r.clientID;let c;if(n==null)c=new pe([n]);else switch(n.constructor){case Number:case Object:case Boolean:case Array:case String:c=new pe([n]);break;case Uint8Array:c=new qe(n);break;case Ee:c=new Ye(n);break;default:if(n instanceof I)c=new P(n);else throw new Error("Unexpected content type")}new v(w(o,A(r.store,o)),i,i&&i.lastId,null,null,e,t,c).integrate(s,0)},os=(s,e)=>{const t=s._map.get(e);return t!==void 0&&!t.deleted?t.content.getContent()[t.length-1]:void 0},In=s=>{const e={};return s._map.forEach((t,n)=>{t.deleted||(e[n]=t.content.getContent()[t.length-1])}),e},Ln=(s,e)=>{const t=s._map.get(e);return t!==void 0&&!t.deleted},mt=s=>vr(s.entries(),e=>!e[1].deleted);class co extends dt{constructor(e,t){super(e,t),this._transaction=t}}class xe extends I{constructor(){super(),this._prelimContent=[],this._searchMarker=[]}static from(e){const t=new xe;return t.push(e),t}_integrate(e,t){super._integrate(e,t),this.insert(0,this._prelimContent),this._prelimContent=null}_copy(){return new xe}clone(){const e=new xe;return e.insert(0,this.toArray().map(t=>t instanceof I?t.clone():t)),e}get length(){return this._prelimContent===null?this._length:this._prelimContent.length}_callObserver(e,t){super._callObserver(e,t),gt(this,e,new co(this,e))}insert(e,t){this.doc!==null?y(this.doc,n=>{xn(n,this,e,t)}):this._prelimContent.splice(e,0,...t)}push(e){this.doc!==null?y(this.doc,t=>{oo(t,this,e)}):this._prelimContent.push(...e)}unshift(e){this.insert(0,e)}delete(e,t=1){this.doc!==null?y(this.doc,n=>{An(n,this,e,t)}):this._prelimContent.splice(e,t)}get(e){return Cn(this,e)}toArray(){return Dn(this)}slice(e=0,t=this.length){return Sn(this,e,t)}toJSON(){return this.map(e=>e instanceof I?e.toJSON():e)}map(e){return En(this,e)}forEach(e){He(this,e)}[Symbol.iterator](){return ro(this)}_write(e){e.writeTypeRef(Mo)}}const ao=s=>new xe;class lo extends dt{constructor(e,t,n){super(e,t),this.keysChanged=n}}class de extends I{constructor(e){super(),this._prelimContent=null,e===void 0?this._prelimContent=new Map:this._prelimContent=new Map(e)}_integrate(e,t){super._integrate(e,t),this._prelimContent.forEach((n,i)=>{this.set(i,n)}),this._prelimContent=null}_copy(){return new de}clone(){const e=new de;return this.forEach((t,n)=>{e.set(n,t instanceof I?t.clone():t)}),e}_callObserver(e,t){gt(this,e,new lo(this,e,t))}toJSON(){const e={};return this._map.forEach((t,n)=>{if(!t.deleted){const i=t.content.getContent()[t.length-1];e[n]=i instanceof I?i.toJSON():i}}),e}get size(){return[...mt(this._map)].length}keys(){return Yt(mt(this._map),e=>e[0])}values(){return Yt(mt(this._map),e=>e[1].content.getContent()[e[1].length-1])}entries(){return Yt(mt(this._map),e=>[e[0],e[1].content.getContent()[e[1].length-1]])}forEach(e){this._map.forEach((t,n)=>{t.deleted||e(t.content.getContent()[t.length-1],n,this)})}[Symbol.iterator](){return this.entries()}delete(e){this.doc!==null?y(this.doc,t=>{kt(t,this,e)}):this._prelimContent.delete(e)}set(e,t){return this.doc!==null?y(this.doc,n=>{rs(n,this,e,t)}):this._prelimContent.set(e,t),t}get(e){return os(this,e)}has(e){return Ln(this,e)}clear(){this.doc!==null?y(this.doc,e=>{this.forEach(function(t,n,i){kt(e,i,n)})}):this._prelimContent.clear()}_write(e){e.writeTypeRef(To)}}const ho=s=>new de,ne=(s,e)=>s===e||typeof s=="object"&&typeof e=="object"&&s&&e&&ji(s,e);class cs{constructor(e,t,n,i){this.left=e,this.right=t,this.index=n,this.currentAttributes=i}forward(){switch(this.right===null&&F(),this.right.content.constructor){case C:this.right.deleted||Ae(this.currentAttributes,this.right.content);break;default:this.right.deleted||(this.index+=this.right.length);break}this.left=this.right,this.right=this.right.right}}const jn=(s,e,t)=>{for(;e.right!==null&&t>0;){switch(e.right.content.constructor){case C:e.right.deleted||Ae(e.currentAttributes,e.right.content);break;default:e.right.deleted||(t<e.right.length&&te(s,w(e.right.id.client,e.right.id.clock+t)),e.index+=e.right.length,t-=e.right.length);break}e.left=e.right,e.right=e.right.right}return e},bt=(s,e,t)=>{const n=new Map,i=ft(e,t);if(i){const r=new cs(i.p.left,i.p,i.index,n);return jn(s,r,t-i.index)}else{const r=new cs(null,e._start,0,n);return jn(s,r,t)}},Mn=(s,e,t,n)=>{for(;t.right!==null&&(t.right.deleted===!0||t.right.content.constructor===C&&ne(n.get(t.right.content.key),t.right.content.value));)t.right.deleted||n.delete(t.right.content.key),t.forward();const i=s.doc,r=i.clientID;n.forEach((o,c)=>{const a=t.left,l=t.right,h=new v(w(r,A(i.store,r)),a,a&&a.lastId,l,l&&l.id,e,null,new C(c,o));h.integrate(s,0),t.right=h,t.forward()})},Ae=(s,e)=>{const{key:t,value:n}=e;n===null?s.delete(t):s.set(t,n)},Tn=(s,e)=>{for(;s.right!==null;){if(!(s.right.deleted||s.right.content.constructor===C&&ne(e[s.right.content.key]||null,s.right.content.value)))break;s.forward()}},Un=(s,e,t,n)=>{const i=s.doc,r=i.clientID,o=new Map;for(const c in n){const a=n[c],l=t.currentAttributes.get(c)||null;if(!ne(l,a)){o.set(c,l);const{left:h,right:u}=t;t.right=new v(w(r,A(i.store,r)),h,h&&h.lastId,u,u&&u.id,e,null,new C(c,a)),t.right.integrate(s,0),t.forward()}}return o},as=(s,e,t,n,i)=>{t.currentAttributes.forEach((d,f)=>{i[f]===void 0&&(i[f]=null)});const r=s.doc,o=r.clientID;Tn(t,i);const c=Un(s,e,t,i),a=n.constructor===String?new H(n):n instanceof I?new P(n):new ge(n);let{left:l,right:h,index:u}=t;e._searchMarker&&Ve(e._searchMarker,t.index,a.getLength()),h=new v(w(o,A(r.store,o)),l,l&&l.lastId,h,h&&h.id,e,null,a),h.integrate(s,0),t.right=h,t.index=u,t.forward(),Mn(s,e,t,c)},zn=(s,e,t,n,i)=>{const r=s.doc,o=r.clientID;Tn(t,i);const c=Un(s,e,t,i);e:for(;t.right!==null&&(n>0||c.size>0&&(t.right.deleted||t.right.content.constructor===C));){if(!t.right.deleted)switch(t.right.content.constructor){case C:{const{key:a,value:l}=t.right.content,h=i[a];if(h!==void 0){if(ne(h,l))c.delete(a);else{if(n===0)break e;c.set(a,l)}t.right.delete(s)}else t.currentAttributes.set(a,l);break}default:n<t.right.length&&te(s,w(t.right.id.client,t.right.id.clock+n)),n-=t.right.length;break}t.forward()}if(n>0){let a="";for(;n>0;n--)a+=`
|
|
2
|
+
`;t.right=new v(w(o,A(r.store,o)),t.left,t.left&&t.left.lastId,t.right,t.right&&t.right.id,e,null,new H(a)),t.right.integrate(s,0),t.forward()}Mn(s,e,t,c)},On=(s,e,t,n,i)=>{let r=e;const o=_();for(;r&&(!r.countable||r.deleted);){if(!r.deleted&&r.content.constructor===C){const l=r.content;o.set(l.key,l)}r=r.right}let c=0,a=!1;for(;e!==r;){if(t===e&&(a=!0),!e.deleted){const l=e.content;switch(l.constructor){case C:{const{key:h,value:u}=l,d=n.get(h)||null;(o.get(h)!==l||d===u)&&(e.delete(s),c++,!a&&(i.get(h)||null)===u&&d!==u&&(d===null?i.delete(h):i.set(h,d))),!a&&!e.deleted&&Ae(i,l);break}}}e=e.right}return c},uo=(s,e)=>{for(;e&&e.right&&(e.right.deleted||!e.right.countable);)e=e.right;const t=new Set;for(;e&&(e.deleted||!e.countable);){if(!e.deleted&&e.content.constructor===C){const n=e.content.key;t.has(n)?e.delete(s):t.add(n)}e=e.left}},fo=s=>{let e=0;return y(s.doc,t=>{let n=s._start,i=s._start,r=_();const o=q(r);for(;i;){if(i.deleted===!1)switch(i.content.constructor){case C:Ae(o,i.content);break;default:e+=On(t,n,i,r,o),r=q(o),n=i;break}i=i.right}}),e},go=s=>{const e=new Set,t=s.doc;for(const[n,i]of s.afterState.entries()){const r=s.beforeState.get(n)||0;i!==r&&gn(s,t.store.clients.get(n),r,i,o=>{!o.deleted&&o.content.constructor===C&&o.constructor!==O&&e.add(o.parent)})}y(t,n=>{Xs(s,s.deleteSet,i=>{if(i instanceof O||!i.parent._hasFormatting||e.has(i.parent))return;const r=i.parent;i.content.constructor===C?e.add(r):uo(n,i)});for(const i of e)fo(i)})},Rn=(s,e,t)=>{const n=t,i=q(e.currentAttributes),r=e.right;for(;t>0&&e.right!==null;){if(e.right.deleted===!1)switch(e.right.content.constructor){case P:case ge:case H:t<e.right.length&&te(s,w(e.right.id.client,e.right.id.clock+t)),t-=e.right.length,e.right.delete(s);break}e.forward()}r&&On(s,r,e.right,i,e.currentAttributes);const o=(e.left||e.right).parent;return o._searchMarker&&Ve(o._searchMarker,e.index,-n+t),e};class po extends dt{constructor(e,t,n){super(e,t),this.childListChanged=!1,this.keysChanged=new Set,n.forEach(i=>{i===null?this.childListChanged=!0:this.keysChanged.add(i)})}get changes(){if(this._changes===null){const e={keys:this.keys,delta:this.delta,added:new Set,deleted:new Set};this._changes=e}return this._changes}get delta(){if(this._delta===null){const e=this.target.doc,t=[];y(e,n=>{const i=new Map,r=new Map;let o=this.target._start,c=null;const a={};let l="",h=0,u=0;const d=()=>{if(c!==null){let f=null;switch(c){case"delete":u>0&&(f={delete:u}),u=0;break;case"insert":(typeof l=="object"||l.length>0)&&(f={insert:l},i.size>0&&(f.attributes={},i.forEach((g,m)=>{g!==null&&(f.attributes[m]=g)}))),l="";break;case"retain":h>0&&(f={retain:h},Ii(a)||(f.attributes=Ci({},a))),h=0;break}f&&t.push(f),c=null}};for(;o!==null;){switch(o.content.constructor){case P:case ge:this.adds(o)?this.deletes(o)||(d(),c="insert",l=o.content.getContent()[0],d()):this.deletes(o)?(c!=="delete"&&(d(),c="delete"),u+=1):o.deleted||(c!=="retain"&&(d(),c="retain"),h+=1);break;case H:this.adds(o)?this.deletes(o)||(c!=="insert"&&(d(),c="insert"),l+=o.content.str):this.deletes(o)?(c!=="delete"&&(d(),c="delete"),u+=o.length):o.deleted||(c!=="retain"&&(d(),c="retain"),h+=o.length);break;case C:{const{key:f,value:g}=o.content;if(this.adds(o)){if(!this.deletes(o)){const m=i.get(f)||null;ne(m,g)?g!==null&&o.delete(n):(c==="retain"&&d(),ne(g,r.get(f)||null)?delete a[f]:a[f]=g)}}else if(this.deletes(o)){r.set(f,g);const m=i.get(f)||null;ne(m,g)||(c==="retain"&&d(),a[f]=m)}else if(!o.deleted){r.set(f,g);const m=a[f];m!==void 0&&(ne(m,g)?m!==null&&o.delete(n):(c==="retain"&&d(),g===null?delete a[f]:a[f]=g))}o.deleted||(c==="insert"&&d(),Ae(i,o.content));break}}o=o.right}for(d();t.length>0;){const f=t[t.length-1];if(f.retain!==void 0&&f.attributes===void 0)t.pop();else break}}),this._delta=t}return this._delta}}class Ie extends I{constructor(e){super(),this._pending=e!==void 0?[()=>this.insert(0,e)]:[],this._searchMarker=[],this._hasFormatting=!1}get length(){return this._length}_integrate(e,t){super._integrate(e,t);try{this._pending.forEach(n=>n())}catch(n){console.error(n)}this._pending=null}_copy(){return new Ie}clone(){const e=new Ie;return e.applyDelta(this.toDelta()),e}_callObserver(e,t){super._callObserver(e,t);const n=new po(this,e,t);gt(this,e,n),!e.local&&this._hasFormatting&&(e._needFormattingCleanup=!0)}toString(){let e="",t=this._start;for(;t!==null;)!t.deleted&&t.countable&&t.content.constructor===H&&(e+=t.content.str),t=t.right;return e}toJSON(){return this.toString()}applyDelta(e,{sanitize:t=!0}={}){this.doc!==null?y(this.doc,n=>{const i=new cs(null,this._start,0,new Map);for(let r=0;r<e.length;r++){const o=e[r];if(o.insert!==void 0){const c=!t&&typeof o.insert=="string"&&r===e.length-1&&i.right===null&&o.insert.slice(-1)===`
|
|
3
|
+
`?o.insert.slice(0,-1):o.insert;(typeof c!="string"||c.length>0)&&as(n,this,i,c,o.attributes||{})}else o.retain!==void 0?zn(n,this,i,o.retain,o.attributes||{}):o.delete!==void 0&&Rn(n,i,o.delete)}}):this._pending.push(()=>this.applyDelta(e))}toDelta(e,t,n){const i=[],r=new Map,o=this.doc;let c="",a=this._start;function l(){if(c.length>0){const u={};let d=!1;r.forEach((g,m)=>{d=!0,u[m]=g});const f={insert:c};d&&(f.attributes=u),i.push(f),c=""}}const h=()=>{for(;a!==null;){if(Fe(a,e)||t!==void 0&&Fe(a,t))switch(a.content.constructor){case H:{const u=r.get("ychange");e!==void 0&&!Fe(a,e)?(u===void 0||u.user!==a.id.client||u.type!=="removed")&&(l(),r.set("ychange",n?n("removed",a.id):{type:"removed"})):t!==void 0&&!Fe(a,t)?(u===void 0||u.user!==a.id.client||u.type!=="added")&&(l(),r.set("ychange",n?n("added",a.id):{type:"added"})):u!==void 0&&(l(),r.delete("ychange")),c+=a.content.str;break}case P:case ge:{l();const u={insert:a.content.getContent()[0]};if(r.size>0){const d={};u.attributes=d,r.forEach((f,g)=>{d[g]=f})}i.push(u);break}case C:Fe(a,e)&&(l(),Ae(r,a.content));break}a=a.right}l()};return e||t?y(o,u=>{e&&Qt(u,e),t&&Qt(u,t),h()},"cleanup"):h(),i}insert(e,t,n){if(t.length<=0)return;const i=this.doc;i!==null?y(i,r=>{const o=bt(r,this,e);n||(n={},o.currentAttributes.forEach((c,a)=>{n[a]=c})),as(r,this,o,t,n)}):this._pending.push(()=>this.insert(e,t,n))}insertEmbed(e,t,n={}){const i=this.doc;i!==null?y(i,r=>{const o=bt(r,this,e);as(r,this,o,t,n)}):this._pending.push(()=>this.insertEmbed(e,t,n))}delete(e,t){if(t===0)return;const n=this.doc;n!==null?y(n,i=>{Rn(i,bt(i,this,e),t)}):this._pending.push(()=>this.delete(e,t))}format(e,t,n){if(t===0)return;const i=this.doc;i!==null?y(i,r=>{const o=bt(r,this,e);o.right!==null&&zn(r,this,o,t,n)}):this._pending.push(()=>this.format(e,t,n))}removeAttribute(e){this.doc!==null?y(this.doc,t=>{kt(t,this,e)}):this._pending.push(()=>this.removeAttribute(e))}setAttribute(e,t){this.doc!==null?y(this.doc,n=>{rs(n,this,e,t)}):this._pending.push(()=>this.setAttribute(e,t))}getAttribute(e){return os(this,e)}getAttributes(){return In(this)}_write(e){e.writeTypeRef(Uo)}}const ko=s=>new Ie;class ls{constructor(e,t=()=>!0){this._filter=t,this._root=e,this._currentNode=e._start,this._firstCall=!0}[Symbol.iterator](){return this}next(){let e=this._currentNode,t=e&&e.content&&e.content.type;if(e!==null&&(!this._firstCall||e.deleted||!this._filter(t)))do if(t=e.content.type,!e.deleted&&(t.constructor===$e||t.constructor===fe)&&t._start!==null)e=t._start;else for(;e!==null;)if(e.right!==null){e=e.right;break}else e.parent===this._root?e=null:e=e.parent._item;while(e!==null&&(e.deleted||!this._filter(e.content.type)));return this._firstCall=!1,e===null?{value:void 0,done:!0}:(this._currentNode=e,{value:e.content.type,done:!1})}}class fe extends I{constructor(){super(),this._prelimContent=[]}get firstChild(){const e=this._first;return e?e.content.getContent()[0]:null}_integrate(e,t){super._integrate(e,t),this.insert(0,this._prelimContent),this._prelimContent=null}_copy(){return new fe}clone(){const e=new fe;return e.insert(0,this.toArray().map(t=>t instanceof I?t.clone():t)),e}get length(){return this._prelimContent===null?this._length:this._prelimContent.length}createTreeWalker(e){return new ls(this,e)}querySelector(e){e=e.toUpperCase();const n=new ls(this,i=>i.nodeName&&i.nodeName.toUpperCase()===e).next();return n.done?null:n.value}querySelectorAll(e){return e=e.toUpperCase(),Q(new ls(this,t=>t.nodeName&&t.nodeName.toUpperCase()===e))}_callObserver(e,t){gt(this,e,new wo(this,t,e))}toString(){return En(this,e=>e.toString()).join("")}toJSON(){return this.toString()}toDOM(e=document,t={},n){const i=e.createDocumentFragment();return n!==void 0&&n._createAssociation(i,this),He(this,r=>{i.insertBefore(r.toDOM(e,t,n),null)}),i}insert(e,t){this.doc!==null?y(this.doc,n=>{xn(n,this,e,t)}):this._prelimContent.splice(e,0,...t)}insertAfter(e,t){if(this.doc!==null)y(this.doc,n=>{const i=e&&e instanceof I?e._item:e;pt(n,this,i,t)});else{const n=this._prelimContent,i=e===null?0:n.findIndex(r=>r===e)+1;if(i===0&&e!==null)throw X("Reference item not found");n.splice(i,0,...t)}}delete(e,t=1){this.doc!==null?y(this.doc,n=>{An(n,this,e,t)}):this._prelimContent.splice(e,t)}toArray(){return Dn(this)}push(e){this.insert(this.length,e)}unshift(e){this.insert(0,e)}get(e){return Cn(this,e)}slice(e=0,t=this.length){return Sn(this,e,t)}forEach(e){He(this,e)}_write(e){e.writeTypeRef(Oo)}}const mo=s=>new fe;class $e extends fe{constructor(e="UNDEFINED"){super(),this.nodeName=e,this._prelimAttrs=new Map}get nextSibling(){const e=this._item?this._item.next:null;return e?e.content.type:null}get prevSibling(){const e=this._item?this._item.prev:null;return e?e.content.type:null}_integrate(e,t){super._integrate(e,t),this._prelimAttrs.forEach((n,i)=>{this.setAttribute(i,n)}),this._prelimAttrs=null}_copy(){return new $e(this.nodeName)}clone(){const e=new $e(this.nodeName),t=this.getAttributes();return xi(t,(n,i)=>{typeof n=="string"&&e.setAttribute(i,n)}),e.insert(0,this.toArray().map(n=>n instanceof I?n.clone():n)),e}toString(){const e=this.getAttributes(),t=[],n=[];for(const c in e)n.push(c);n.sort();const i=n.length;for(let c=0;c<i;c++){const a=n[c];t.push(a+'="'+e[a]+'"')}const r=this.nodeName.toLocaleLowerCase(),o=t.length>0?" "+t.join(" "):"";return`<${r}${o}>${super.toString()}</${r}>`}removeAttribute(e){this.doc!==null?y(this.doc,t=>{kt(t,this,e)}):this._prelimAttrs.delete(e)}setAttribute(e,t){this.doc!==null?y(this.doc,n=>{rs(n,this,e,t)}):this._prelimAttrs.set(e,t)}getAttribute(e){return os(this,e)}hasAttribute(e){return Ln(this,e)}getAttributes(){return In(this)}toDOM(e=document,t={},n){const i=e.createElement(this.nodeName),r=this.getAttributes();for(const o in r){const c=r[o];typeof c=="string"&&i.setAttribute(o,c)}return He(this,o=>{i.appendChild(o.toDOM(e,t,n))}),n!==void 0&&n._createAssociation(i,this),i}_write(e){e.writeTypeRef(zo),e.writeKey(this.nodeName)}}const bo=s=>new $e(s.readKey());class wo extends dt{constructor(e,t,n){super(e,n),this.childListChanged=!1,this.attributesChanged=new Set,t.forEach(i=>{i===null?this.childListChanged=!0:this.attributesChanged.add(i)})}}class wt extends de{constructor(e){super(),this.hookName=e}_copy(){return new wt(this.hookName)}clone(){const e=new wt(this.hookName);return this.forEach((t,n)=>{e.set(n,t)}),e}toDOM(e=document,t={},n){const i=t[this.hookName];let r;return i!==void 0?r=i.createDom(this):r=document.createElement(this.hookName),r.setAttribute("data-yjs-hook",this.hookName),n!==void 0&&n._createAssociation(r,this),r}_write(e){e.writeTypeRef(Ro),e.writeKey(this.hookName)}}const yo=s=>new wt(s.readKey());class yt extends Ie{get nextSibling(){const e=this._item?this._item.next:null;return e?e.content.type:null}get prevSibling(){const e=this._item?this._item.prev:null;return e?e.content.type:null}_copy(){return new yt}clone(){const e=new yt;return e.applyDelta(this.toDelta()),e}toDOM(e=document,t,n){const i=e.createTextNode(this.toString());return n!==void 0&&n._createAssociation(i,this),i}toString(){return this.toDelta().map(e=>{const t=[];for(const i in e.attributes){const r=[];for(const o in e.attributes[i])r.push({key:o,value:e.attributes[i][o]});r.sort((o,c)=>o.key<c.key?-1:1),t.push({nodeName:i,attrs:r})}t.sort((i,r)=>i.nodeName<r.nodeName?-1:1);let n="";for(let i=0;i<t.length;i++){const r=t[i];n+=`<${r.nodeName}`;for(let o=0;o<r.attrs.length;o++){const c=r.attrs[o];n+=` ${c.key}="${c.value}"`}n+=">"}n+=e.insert;for(let i=t.length-1;i>=0;i--)n+=`</${t[i].nodeName}>`;return n}).join("")}toJSON(){return this.toString()}_write(e){e.writeTypeRef(No)}}const _o=s=>new yt;class hs{constructor(e,t){this.id=e,this.length=t}get deleted(){throw B()}mergeWith(e){return!1}write(e,t,n){throw B()}integrate(e,t){throw B()}}const So=0;class O extends hs{get deleted(){return!0}delete(){}mergeWith(e){return this.constructor!==e.constructor?!1:(this.length+=e.length,!0)}integrate(e,t){t>0&&(this.id.clock+=t,this.length-=t),dn(e.doc.store,this)}write(e,t){e.writeInfo(So),e.writeLen(this.length-t)}getMissing(e,t){return null}}class qe{constructor(e){this.content=e}getLength(){return 1}getContent(){return[this.content]}isCountable(){return!0}copy(){return new qe(this.content)}splice(e){throw B()}mergeWith(e){return!1}integrate(e,t){}delete(e){}gc(e){}write(e,t){e.writeBuf(this.content)}getRef(){return 3}}const Do=s=>new qe(s.readBuf());class Ke{constructor(e){this.len=e}getLength(){return this.len}getContent(){return[]}isCountable(){return!1}copy(){return new Ke(this.len)}splice(e){const t=new Ke(this.len-e);return this.len=e,t}mergeWith(e){return this.len+=e.len,!0}integrate(e,t){ct(e.deleteSet,t.id.client,t.id.clock,this.len),t.markDeleted()}delete(e){}gc(e){}write(e,t){e.writeLen(this.len-t)}getRef(){return 1}}const Eo=s=>new Ke(s.readLen()),Nn=(s,e)=>new Ee({guid:s,...e,shouldLoad:e.shouldLoad||e.autoLoad||!1});class Ye{constructor(e){e._item&&console.error("This document was already integrated as a sub-document. You should create a second instance instead with the same guid."),this.doc=e;const t={};this.opts=t,e.gc||(t.gc=!1),e.autoLoad&&(t.autoLoad=!0),e.meta!==null&&(t.meta=e.meta)}getLength(){return 1}getContent(){return[this.doc]}isCountable(){return!0}copy(){return new Ye(Nn(this.doc.guid,this.opts))}splice(e){throw B()}mergeWith(e){return!1}integrate(e,t){this.doc._item=t,e.subdocsAdded.add(this.doc),this.doc.shouldLoad&&e.subdocsLoaded.add(this.doc)}delete(e){e.subdocsAdded.has(this.doc)?e.subdocsAdded.delete(this.doc):e.subdocsRemoved.add(this.doc)}gc(e){}write(e,t){e.writeString(this.doc.guid),e.writeAny(this.opts)}getRef(){return 9}}const Co=s=>new Ye(Nn(s.readString(),s.readAny()));class ge{constructor(e){this.embed=e}getLength(){return 1}getContent(){return[this.embed]}isCountable(){return!0}copy(){return new ge(this.embed)}splice(e){throw B()}mergeWith(e){return!1}integrate(e,t){}delete(e){}gc(e){}write(e,t){e.writeJSON(this.embed)}getRef(){return 5}}const vo=s=>new ge(s.readJSON());class C{constructor(e,t){this.key=e,this.value=t}getLength(){return 1}getContent(){return[]}isCountable(){return!1}copy(){return new C(this.key,this.value)}splice(e){throw B()}mergeWith(e){return!1}integrate(e,t){const n=t.parent;n._searchMarker=null,n._hasFormatting=!0}delete(e){}gc(e){}write(e,t){e.writeKey(this.key),e.writeJSON(this.value)}getRef(){return 6}}const xo=s=>new C(s.readKey(),s.readJSON());class _t{constructor(e){this.arr=e}getLength(){return this.arr.length}getContent(){return this.arr}isCountable(){return!0}copy(){return new _t(this.arr)}splice(e){const t=new _t(this.arr.slice(e));return this.arr=this.arr.slice(0,e),t}mergeWith(e){return this.arr=this.arr.concat(e.arr),!0}integrate(e,t){}delete(e){}gc(e){}write(e,t){const n=this.arr.length;e.writeLen(n-t);for(let i=t;i<n;i++){const r=this.arr[i];e.writeString(r===void 0?"undefined":JSON.stringify(r))}}getRef(){return 2}}const Ao=s=>{const e=s.readLen(),t=[];for(let n=0;n<e;n++){const i=s.readString();i==="undefined"?t.push(void 0):t.push(JSON.parse(i))}return new _t(t)};class pe{constructor(e){this.arr=e}getLength(){return this.arr.length}getContent(){return this.arr}isCountable(){return!0}copy(){return new pe(this.arr)}splice(e){const t=new pe(this.arr.slice(e));return this.arr=this.arr.slice(0,e),t}mergeWith(e){return this.arr=this.arr.concat(e.arr),!0}integrate(e,t){}delete(e){}gc(e){}write(e,t){const n=this.arr.length;e.writeLen(n-t);for(let i=t;i<n;i++){const r=this.arr[i];e.writeAny(r)}}getRef(){return 8}}const Io=s=>{const e=s.readLen(),t=[];for(let n=0;n<e;n++)t.push(s.readAny());return new pe(t)};class H{constructor(e){this.str=e}getLength(){return this.str.length}getContent(){return this.str.split("")}isCountable(){return!0}copy(){return new H(this.str)}splice(e){const t=new H(this.str.slice(e));this.str=this.str.slice(0,e);const n=this.str.charCodeAt(e-1);return n>=55296&&n<=56319&&(this.str=this.str.slice(0,e-1)+"�",t.str="�"+t.str.slice(1)),t}mergeWith(e){return this.str+=e.str,!0}integrate(e,t){}delete(e){}gc(e){}write(e,t){e.writeString(t===0?this.str:this.str.slice(t))}getRef(){return 4}}const Lo=s=>new H(s.readString()),jo=[ao,ho,ko,bo,mo,yo,_o],Mo=0,To=1,Uo=2,zo=3,Oo=4,Ro=5,No=6;class P{constructor(e){this.type=e}getLength(){return 1}getContent(){return[this.type]}isCountable(){return!0}copy(){return new P(this.type._copy())}splice(e){throw B()}mergeWith(e){return!1}integrate(e,t){this.type._integrate(e.doc,t)}delete(e){let t=this.type._start;for(;t!==null;)t.deleted?t.id.clock<(e.beforeState.get(t.id.client)||0)&&e._mergeStructs.push(t):t.delete(e),t=t.right;this.type._map.forEach(n=>{n.deleted?n.id.clock<(e.beforeState.get(n.id.client)||0)&&e._mergeStructs.push(n):n.delete(e)}),e.changed.delete(this.type)}gc(e){let t=this.type._start;for(;t!==null;)t.gc(e,!0),t=t.right;this.type._start=null,this.type._map.forEach(n=>{for(;n!==null;)n.gc(e,!0),n=n.left}),this.type._map=new Map}write(e,t){this.type._write(e)}getRef(){return 7}}const Bo=s=>new P(jo[s.readTypeRef()](s)),St=(s,e,t)=>{const{client:n,clock:i}=e.id,r=new v(w(n,i+t),e,w(n,i+t-1),e.right,e.rightOrigin,e.parent,e.parentSub,e.content.splice(t));return e.deleted&&r.markDeleted(),e.keep&&(r.keep=!0),e.redone!==null&&(r.redone=w(e.redone.client,e.redone.clock+t)),e.right=r,r.right!==null&&(r.right.left=r),s._mergeStructs.push(r),r.parentSub!==null&&r.right===null&&r.parent._map.set(r.parentSub,r),e.length=t,r};class v extends hs{constructor(e,t,n,i,r,o,c,a){super(e,a.getLength()),this.origin=n,this.left=t,this.right=i,this.rightOrigin=r,this.parent=o,this.parentSub=c,this.redone=null,this.content=a,this.info=this.content.isCountable()?js:0}set marker(e){(this.info&Tt)>0!==e&&(this.info^=Tt)}get marker(){return(this.info&Tt)>0}get keep(){return(this.info&Ls)>0}set keep(e){this.keep!==e&&(this.info^=Ls)}get countable(){return(this.info&js)>0}get deleted(){return(this.info&Mt)>0}set deleted(e){this.deleted!==e&&(this.info^=Mt)}markDeleted(){this.info|=Mt}getMissing(e,t){if(this.origin&&this.origin.client!==this.id.client&&this.origin.clock>=A(t,this.origin.client))return this.origin.client;if(this.rightOrigin&&this.rightOrigin.client!==this.id.client&&this.rightOrigin.clock>=A(t,this.rightOrigin.client))return this.rightOrigin.client;if(this.parent&&this.parent.constructor===ve&&this.id.client!==this.parent.client&&this.parent.clock>=A(t,this.parent.client))return this.parent.client;if(this.origin&&(this.left=fn(e,t,this.origin),this.origin=this.left.lastId),this.rightOrigin&&(this.right=te(e,this.rightOrigin),this.rightOrigin=this.right.id),(this.left&&this.left.constructor===O||this.right&&this.right.constructor===O)&&(this.parent=null),!this.parent)this.left&&this.left.constructor===v&&(this.parent=this.left.parent,this.parentSub=this.left.parentSub),this.right&&this.right.constructor===v&&(this.parent=this.right.parent,this.parentSub=this.right.parentSub);else if(this.parent.constructor===ve){const n=Zt(t,this.parent);n.constructor===O?this.parent=null:this.parent=n.content.type}return null}integrate(e,t){if(t>0&&(this.id.clock+=t,this.left=fn(e,e.doc.store,w(this.id.client,this.id.clock-1)),this.origin=this.left.lastId,this.content=this.content.splice(t),this.length-=t),this.parent){if(!this.left&&(!this.right||this.right.left!==null)||this.left&&this.left.right!==this.right){let n=this.left,i;if(n!==null)i=n.right;else if(this.parentSub!==null)for(i=this.parent._map.get(this.parentSub)||null;i!==null&&i.left!==null;)i=i.left;else i=this.parent._start;const r=new Set,o=new Set;for(;i!==null&&i!==this.right;){if(o.add(i),r.add(i),at(this.origin,i.origin)){if(i.id.client<this.id.client)n=i,r.clear();else if(at(this.rightOrigin,i.rightOrigin))break}else if(i.origin!==null&&o.has(Zt(e.doc.store,i.origin)))r.has(Zt(e.doc.store,i.origin))||(n=i,r.clear());else break;i=i.right}this.left=n}if(this.left!==null){const n=this.left.right;this.right=n,this.left.right=this}else{let n;if(this.parentSub!==null)for(n=this.parent._map.get(this.parentSub)||null;n!==null&&n.left!==null;)n=n.left;else n=this.parent._start,this.parent._start=this;this.right=n}this.right!==null?this.right.left=this:this.parentSub!==null&&(this.parent._map.set(this.parentSub,this),this.left!==null&&this.left.delete(e)),this.parentSub===null&&this.countable&&!this.deleted&&(this.parent._length+=this.length),dn(e.doc.store,this),this.content.integrate(e,this),kn(e,this.parent,this.parentSub),(this.parent._item!==null&&this.parent._item.deleted||this.parentSub!==null&&this.right!==null)&&this.delete(e)}else new O(this.id,this.length).integrate(e,0)}get next(){let e=this.right;for(;e!==null&&e.deleted;)e=e.right;return e}get prev(){let e=this.left;for(;e!==null&&e.deleted;)e=e.left;return e}get lastId(){return this.length===1?this.id:w(this.id.client,this.id.clock+this.length-1)}mergeWith(e){if(this.constructor===e.constructor&&at(e.origin,this.lastId)&&this.right===e&&at(this.rightOrigin,e.rightOrigin)&&this.id.client===e.id.client&&this.id.clock+this.length===e.id.clock&&this.deleted===e.deleted&&this.redone===null&&e.redone===null&&this.content.constructor===e.content.constructor&&this.content.mergeWith(e.content)){const t=this.parent._searchMarker;return t&&t.forEach(n=>{n.p===e&&(n.p=this,!this.deleted&&this.countable&&(n.index-=this.length))}),e.keep&&(this.keep=!0),this.right=e.right,this.right!==null&&(this.right.left=this),this.length+=e.length,!0}return!1}delete(e){if(!this.deleted){const t=this.parent;this.countable&&this.parentSub===null&&(t._length-=this.length),this.markDeleted(),ct(e.deleteSet,this.id.client,this.id.clock,this.length),kn(e,t,this.parentSub),this.content.delete(e)}}gc(e,t){if(!this.deleted)throw F();this.content.gc(e),t?Kr(e,this,new O(this.id,this.length)):this.content=new Ke(this.length)}write(e,t){const n=t>0?w(this.id.client,this.id.clock+t-1):this.origin,i=this.rightOrigin,r=this.parentSub,o=this.content.getRef()&tt|(n===null?0:T)|(i===null?0:J)|(r===null?0:Ue);if(e.writeInfo(o),n!==null&&e.writeLeftID(n),i!==null&&e.writeRightID(i),n===null&&i===null){const c=this.parent;if(c._item!==void 0){const a=c._item;if(a===null){const l=qr(c);e.writeParentInfo(!0),e.writeString(l)}else e.writeParentInfo(!1),e.writeLeftID(a.id)}else c.constructor===String?(e.writeParentInfo(!0),e.writeString(c)):c.constructor===ve?(e.writeParentInfo(!1),e.writeLeftID(c)):F();r!==null&&e.writeString(r)}this.content.write(e,t)}}const Bn=(s,e)=>Fo[e&tt](s),Fo=[()=>{F()},Eo,Ao,Do,Lo,vo,xo,Bo,Io,Co,()=>{F()}],Vo=10;class R extends hs{get deleted(){return!0}delete(){}mergeWith(e){return this.constructor!==e.constructor?!1:(this.length+=e.length,!0)}integrate(e,t){F()}write(e,t){e.writeInfo(Vo),p(e.restEncoder,this.length-t)}getMissing(e,t){return null}}const Fn=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:{},Vn="__ $YJS$ __";Fn[Vn]===!0&&console.error("Yjs was already imported. This breaks constructor checks and will lead to issues! - https://github.com/yjs/yjs/issues/438"),Fn[Vn]=!0;const Hn=0,us=1,$n=2,ds=(s,e)=>{p(s,Hn);const t=Hr(e);D(s,t)},qn=(s,e,t)=>{p(s,us),D(s,Pt(e,t))},Ho=(s,e,t)=>qn(e,t,j(s)),Kn=(s,e,t)=>{try{nn(e,j(s),t)}catch(n){console.error("Caught error while handling a Yjs update",n)}},$o=(s,e)=>{p(s,$n),D(s,e)},qo=Kn,Ko=(s,e,t,n)=>{const i=k(s);switch(i){case Hn:Ho(s,e,t);break;case us:Kn(s,t,n);break;case $n:qo(s,t,n);break;default:throw new Error("Unknown message type")}return i},Yo=0,Jo=(s,e,t)=>{switch(k(s)){case Yo:t(e,ee(s))}},fs=3e4;class Xo extends ot{constructor(e){super(),this.doc=e,this.clientID=e.clientID,this.states=new Map,this.meta=new Map,this._checkInterval=setInterval(()=>{const t=he();this.getLocalState()!==null&&fs/2<=t-this.meta.get(this.clientID).lastUpdated&&this.setLocalState(this.getLocalState());const n=[];this.meta.forEach((i,r)=>{r!==this.clientID&&fs<=t-i.lastUpdated&&this.states.has(r)&&n.push(r)}),n.length>0&&gs(this,n,"timeout")},Y(fs/10)),e.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(e){const t=this.clientID,n=this.meta.get(t),i=n===void 0?0:n.clock+1,r=this.states.get(t);e===null?this.states.delete(t):this.states.set(t,e),this.meta.set(t,{clock:i,lastUpdated:he()});const o=[],c=[],a=[],l=[];e===null?l.push(t):r==null?e!=null&&o.push(t):(c.push(t),Te(r,e)||a.push(t)),(o.length>0||a.length>0||l.length>0)&&this.emit("change",[{added:o,updated:a,removed:l},"local"]),this.emit("update",[{added:o,updated:c,removed:l},"local"])}setLocalStateField(e,t){const n=this.getLocalState();n!==null&&this.setLocalState({...n,[e]:t})}getStates(){return this.states}}const gs=(s,e,t)=>{const n=[];for(let i=0;i<e.length;i++){const r=e[i];if(s.states.has(r)){if(s.states.delete(r),r===s.clientID){const o=s.meta.get(r);s.meta.set(r,{clock:o.clock+1,lastUpdated:he()})}n.push(r)}}n.length>0&&(s.emit("change",[{added:[],updated:[],removed:n},t]),s.emit("update",[{added:[],updated:[],removed:n},t]))},Je=(s,e,t=s.states)=>{const n=e.length,i=L();p(i,n);for(let r=0;r<n;r++){const o=e[r],c=t.get(o)||null,a=s.meta.get(o).clock;p(i,o),p(i,a),le(i,JSON.stringify(c))}return S(i)},Go=(s,e,t)=>{const n=Z(e),i=he(),r=[],o=[],c=[],a=[],l=k(n);for(let h=0;h<l;h++){const u=k(n);let d=k(n);const f=JSON.parse(ee(n)),g=s.meta.get(u),m=s.states.get(u),U=g===void 0?0:g.clock;(U<d||U===d&&f===null&&s.states.has(u))&&(f===null?u===s.clientID&&s.getLocalState()!=null?d++:s.states.delete(u):s.states.set(u,f),s.meta.set(u,{clock:d,lastUpdated:i}),g===void 0&&f!==null?r.push(u):g!==void 0&&f===null?a.push(u):f!==null&&(Te(f,m)||c.push(u),o.push(u)))}(r.length>0||c.length>0||a.length>0)&&s.emit("change",[{added:r,updated:c,removed:a},t]),(r.length>0||o.length>0||a.length>0)&&s.emit("update",[{added:r,updated:o,removed:a},t])},Wo=s=>Ai(s,(e,t)=>`${encodeURIComponent(t)}=${encodeURIComponent(e)}`).join("&");var ke=0,Yn=3,Le=1,Po=2;function Qo(s,e){if(!s)throw new Error(e)}var Xe=[];Xe[ke]=(s,e,t,n,i)=>{p(s,ke);const r=Ko(e,s,t.doc,t);n&&r===us&&!t.synced&&(t.synced=!0)},Xe[Yn]=(s,e,t,n,i)=>{p(s,Le),D(s,Je(t.awareness,Array.from(t.awareness.getStates().keys())))},Xe[Le]=(s,e,t,n,i)=>{Go(t.awareness,j(e),t)},Xe[Po]=(s,e,t,n,i)=>{Jo(e,t.doc,(r,o)=>Zo(t,o))};var Jn=3e4;function Zo(s,e){console.warn(`Permission denied to access ${s.url}.
|
|
4
|
+
${e}`)}function Xn(s,e,t){const n=Z(e),i=L(),r=k(n),o=s.messageHandlers[r];return o?o(i,n,s,t,r):console.error("Unable to compute message"),i}function Gn(s){if(s.shouldConnect&&s.ws===null){const e=new s._WS(s.url);e.binaryType="arraybuffer",s.ws=e,s.wsconnecting=!0,s.wsconnected=!1,s.synced=!1,e.onmessage=t=>{if(t.data==="ping"){e.send("pong");return}s.wsLastMessageReceived=he();const n=Xn(s,new Uint8Array(t.data),!0);zt(n)>1&&e.send(S(n))},e.onerror=t=>{s.emit("connection-error",[t,s])},e.onclose=t=>{s.emit("connection-close",[t,s]),s.ws=null,s.wsconnecting=!1,s.wsconnected?(s.wsconnected=!1,s.synced=!1,gs(s.awareness,Array.from(s.awareness.getStates().keys()).filter(n=>n!==s.doc.clientID),s),s.emit("status",[{status:"disconnected"}])):s.wsUnsuccessfulReconnects++,setTimeout(Gn,jt(Ri(2,s.wsUnsuccessfulReconnects)*100,s.maxBackoffTime),s)},e.onopen=()=>{s.wsLastMessageReceived=he(),s.wsconnecting=!1,s.wsconnected=!0,s.wsUnsuccessfulReconnects=0,s.emit("status",[{status:"connected"}]);const t=L();if(p(t,ke),ds(t,s.doc),e.send(S(t)),s.awareness.getLocalState()!==null){const n=L();p(n,Le),D(n,Je(s.awareness,[s.doc.clientID])),e.send(S(n))}},s.emit("status",[{status:"connecting"}])}}function ps(s,e){const t=s.ws;s.wsconnected&&t&&t.readyState===t.OPEN&&t.send(e),s.bcconnected&&_e(s.bcChannel,e,s)}var ec=class extends ot{constructor(e,t,n,{connect:i=!0,awareness:r=new Xo(n),params:o={},WebSocketPolyfill:c=WebSocket,resyncInterval:a=-1,maxBackoffTime:l=2500,disableBc:h=!1}={}){super();b(this,"maxBackoffTime");b(this,"bcChannel");b(this,"url");b(this,"roomname");b(this,"doc");b(this,"_WS");b(this,"awareness");b(this,"wsconnected");b(this,"wsconnecting");b(this,"bcconnected");b(this,"disableBc");b(this,"wsUnsuccessfulReconnects");b(this,"messageHandlers");b(this,"_synced");b(this,"ws");b(this,"wsLastMessageReceived");b(this,"shouldConnect");b(this,"_resyncInterval");b(this,"_bcSubscriber");b(this,"_updateHandler");b(this,"_awarenessUpdateHandler");b(this,"_unloadHandler");b(this,"_checkInterval");for(;e[e.length-1]==="/";)e=e.slice(0,e.length-1);const u=Wo(o);this.maxBackoffTime=l,this.bcChannel=e+"/"+t,this.url=e+"/"+t+(u.length===0?"":"?"+u),this.roomname=t,this.doc=n,this._WS=c,this.awareness=r,this.wsconnected=!1,this.wsconnecting=!1,this.bcconnected=!1,this.disableBc=h,this.wsUnsuccessfulReconnects=0,this.messageHandlers=Xe.slice(),this._synced=!1,this.ws=null,this.wsLastMessageReceived=0,this.shouldConnect=i,this._resyncInterval=0,a>0&&(this._resyncInterval=setInterval(()=>{if(this.ws&&this.ws.readyState===WebSocket.OPEN){const d=L();p(d,ke),ds(d,n),this.ws.send(S(d))}},a)),this._bcSubscriber=(d,f)=>{if(f!==this){const g=Xn(this,new Uint8Array(d),!1);zt(g)>1&&_e(this.bcChannel,S(g),this)}},this._updateHandler=(d,f)=>{if(f!==this){const g=L();p(g,ke),$o(g,d),ps(this,S(g))}},this.doc.on("update",this._updateHandler),this._awarenessUpdateHandler=({added:d,updated:f,removed:g},m)=>{const U=d.concat(f).concat(g),We=L();p(We,Le),D(We,Je(r,U)),ps(this,S(We))},this._unloadHandler=()=>{gs(this.awareness,[n.clientID],"window unload")},typeof window<"u"?window.addEventListener("unload",this._unloadHandler):typeof process<"u"&&process.on("exit",this._unloadHandler),r.on("update",this._awarenessUpdateHandler),this._checkInterval=setInterval(()=>{this.wsconnected&&Jn<he()-this.wsLastMessageReceived&&(Qo(this.ws!==null,"ws must not be null"),this.ws.close())},Jn/10),i&&this.connect()}get synced(){return this._synced}set synced(e){this._synced!==e&&(this._synced=e,this.emit("synced",[e]),this.emit("sync",[e]))}destroy(){this._resyncInterval!==0&&clearInterval(this._resyncInterval),clearInterval(this._checkInterval),this.disconnect(),typeof window<"u"?window.removeEventListener("unload",this._unloadHandler):typeof process<"u"&&process.off("exit",this._unloadHandler),this.awareness.off("update",this._awarenessUpdateHandler),this.doc.off("update",this._updateHandler),super.destroy()}connectBc(){if(this.disableBc)return;this.bcconnected||(lr(this.bcChannel,this._bcSubscriber),this.bcconnected=!0);const e=L();p(e,ke),ds(e,this.doc),_e(this.bcChannel,S(e),this);const t=L();p(t,ke),qn(t,this.doc),_e(this.bcChannel,S(t),this);const n=L();p(n,Yn),_e(this.bcChannel,S(n),this);const i=L();p(i,Le),D(i,Je(this.awareness,[this.doc.clientID])),_e(this.bcChannel,S(i),this)}disconnectBc(){const e=L();p(e,Le),D(e,Je(this.awareness,[this.doc.clientID],new Map)),ps(this,S(e)),this.bcconnected&&(hr(this.bcChannel,this._bcSubscriber),this.bcconnected=!1)}disconnect(){this.shouldConnect=!1,this.disconnectBc(),this.ws!==null&&this.ws.close()}connect(){this.shouldConnect=!0,!this.wsconnected&&this.ws===null&&(Gn(this),this.connectBc())}};function Wn(){if(crypto.randomUUID)return crypto.randomUUID();let s=new Date().getTime(),e=typeof performance<"u"&&performance.now&&performance.now()*1e3||0;return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(t){let n=Math.random()*16;return s>0?(n=(s+n)%16|0,s=Math.floor(s/16)):(n=(e+n)%16|0,e=Math.floor(e/16)),(t==="x"?n:n&3|8).toString(16)})}var tc=class extends ec{constructor(s,e,t,n={}){const i=`${s.startsWith("localhost:")||s.startsWith("127.0.0.1:")?"ws":"wss"}://${s}/party`;n.params===void 0?n.params={_pk:Wn()}:n.params._pk=Wn(),super(i,e,t,n)}};const me=s=>Se((e,t)=>{s.onerror=n=>t(new Error(n.target.error)),s.onsuccess=n=>e(n.target.result)}),sc=(s,e)=>Se((t,n)=>{const i=indexedDB.open(s);i.onupgradeneeded=r=>e(r.target.result),i.onerror=r=>n(X(r.target.error)),i.onsuccess=r=>{const o=r.target.result;o.onversionchange=()=>{o.close()},typeof addEventListener<"u"&&addEventListener("unload",()=>o.close()),t(o)}}),nc=s=>me(indexedDB.deleteDatabase(s)),ic=(s,e)=>e.forEach(t=>s.createObjectStore.apply(s,t)),Ge=(s,e,t="readwrite")=>{const n=s.transaction(e,t);return e.map(i=>dc(n,i))},Pn=(s,e)=>me(s.count(e)),rc=(s,e)=>me(s.get(e)),Qn=(s,e)=>me(s.delete(e)),oc=(s,e,t)=>me(s.put(e,t)),ks=(s,e)=>me(s.add(e)),cc=(s,e,t)=>me(s.getAll(e,t)),ac=(s,e,t)=>{let n=null;return uc(s,e,i=>(n=i,!1),t).then(()=>n)},lc=(s,e=null)=>ac(s,e,"prev"),hc=(s,e)=>Se((t,n)=>{s.onerror=n,s.onsuccess=async i=>{const r=i.target.result;if(r===null||await e(r)===!1)return t();r.continue()}}),uc=(s,e,t,n="next")=>hc(s.openKeyCursor(e,n),i=>t(i.key)),dc=(s,e)=>s.objectStore(e),fc=(s,e)=>IDBKeyRange.upperBound(s,e),gc=(s,e)=>IDBKeyRange.lowerBound(s,e),ms="custom",Zn="updates",ei=500,ti=(s,e=()=>{},t=()=>{})=>{const[n]=Ge(s.db,[Zn]);return cc(n,gc(s._dbref,!1)).then(i=>{s._destroyed||(e(n),y(s.doc,()=>{i.forEach(r=>nn(s.doc,r))},s,!1),t(n))}).then(()=>lc(n).then(i=>{s._dbref=i+1})).then(()=>Pn(n).then(i=>{s._dbsize=i})).then(()=>n)},pc=(s,e=!0)=>ti(s).then(t=>{(e||s._dbsize>=ei)&&ks(t,Pt(s.doc)).then(()=>Qn(t,fc(s._dbref,!0))).then(()=>Pn(t).then(n=>{s._dbsize=n}))});class kc extends ot{constructor(e,t){super(),this.doc=t,this.name=e,this._dbref=0,this._dbsize=0,this._destroyed=!1,this.db=null,this.synced=!1,this._db=sc(e,n=>ic(n,[["updates",{autoIncrement:!0}],["custom"]])),this.whenSynced=Se(n=>this.on("synced",()=>n(this))),this._db.then(n=>{this.db=n,ti(this,o=>ks(o,Pt(t)),()=>{if(this._destroyed)return this;this.synced=!0,this.emit("synced",[this])})}),this._storeTimeout=1e3,this._storeTimeoutId=null,this._storeUpdate=(n,i)=>{if(this.db&&i!==this){const[r]=Ge(this.db,[Zn]);ks(r,n),++this._dbsize>=ei&&(this._storeTimeoutId!==null&&clearTimeout(this._storeTimeoutId),this._storeTimeoutId=setTimeout(()=>{pc(this,!1),this._storeTimeoutId=null},this._storeTimeout))}},t.on("update",this._storeUpdate),this.destroy=this.destroy.bind(this),t.on("destroy",this.destroy)}destroy(){return this._storeTimeoutId&&clearTimeout(this._storeTimeoutId),this.doc.off("update",this._storeUpdate),this.doc.off("destroy",this.destroy),this._destroyed=!0,this._db.then(e=>{e.close()})}clearData(){return this.destroy().then(()=>{nc(this.name)})}get(e){return this._db.then(t=>{const[n]=Ge(t,[ms],"readonly");return rc(n,e)})}set(e,t){return this._db.then(n=>{const[i]=Ge(n,[ms]);return oc(i,t,e)})}del(e){return this._db.then(t=>{const[n]=Ge(t,[ms]);return Qn(n,e)})}}const Yc="",mc={ctrlKey:"Control",altKey:"Alt",shiftKey:"Shift",metaKey:"Meta"},bc="can-duplicate-to";var E=(s=>(s.CanPlay="can-play",s.CanMove="can-move",s.CanSpin="can-spin",s.CanGrow="can-grow",s.CanToggle="can-toggle",s.CanDuplicate="can-duplicate",s.CanPost="can-post",s))(E||{});function wc(s){return s.id}function si(s){return document.getElementById(s)}function yc(s){return s&&s.__esModule&&Object.prototype.hasOwnProperty.call(s,"default")?s.default:s}var _c=["2 girls 1 cup","2g1c","4r5e","5h1t","5hit","5ht","666","@$$","a s s","a s shole","a55","a55hole","a_s_s","abbo","abeed","abuse","acrotomophilia","aeolus","africoon","ahole","alabama hot pocket","alaskan pipeline","alligator bait","alligatorbait","amcik","anal","analannie","analprobe","analsex","andskota","anilingus","anus","apeshit","ar5e","arabush","arabushs","areola","areole","argie","armo","armos","aroused","arrse","arschloch","arse","arsehole","aryan","ash0le","ash0les","asholes","ass monkey","ass","ass-fucker","ass-hat","ass-pirate","assbag","assbagger","assbandit","assbang","assbanged","assbanger","assbangs","assbite","assblaster","assclown","asscock","asscowboy","asscracker","asses","assface","assfuck","assfucker","assfukka","assgoblin","assh0le","assh0lez","asshat","asshead","assho1e","asshole","assholes","assholz","asshopper","asshore","assjacker","assjockey","asskiss","asskisser","assklown","asslick","asslicker","asslover","assman","assmaster","assmonkey","assmunch","assmuncher","assnigger","asspacker","asspirate","asspuppies","assrammer","assranger","assshit","assshole","asssucker","asswad","asswhole","asswhore","asswipe","asswipes","auto erotic","autoerotic","ayir","azazel","azz","azzhole","b a s t a r d","b i t c h","b o o b","b!+ch","b!tch","b!tchin","b*tch","b00b","b00bies","b00biez","b00bs","b00bz","b17ch","b1tch","b7ch","babeland","babes","baby batter","baby juice","backdoor","backdoorman","badfuck","bagging","ball gag","ball gravy","ball kicking","ball licking","ball sack","ball sucking","ballbag","balllicker","ballsack","bampot","bangbro","bangbros","bangbus","banger","banging","bareback","barely legal","barelylegal","barenaked","barf","barface","barfface","bassterd","bassterds","bastard","bastardo","bastards","bastardz","basterds","basterdz","bastinado","bawdy","bazongas","bazooms","bbw","bdsm","beaner","beaners","beaney","beaneys","beardedclam","beastality","beastial","beastiality","beastility","beatch","beatoff","beatyourmeat","beaver cleaver","beaver lips","beef curtains","beeyotch","bellend","beotch","bestial","bestiality","bi curious","bi+ch","bi7ch","biatch","bicurious","big black","big breasts","big knockers","big tits","bigass","bigbastard","bigbreasts","bigbutt","bigtits","bimbo","bimbos","bint","birdlock","bitch","bitchass","bitched","bitcher","bitchers","bitches","bitchez","bitchin","bitching","bitchslap","bitchtit","bitchy","biteme","bitties","black cock","blackcock","blackman","blackout","blacks","blonde action","blonde on blonde action","blonde on blonde","bloodclaat","bloody","blow j","blow job","blow your l","blow your load","blowjob","blowjobs","blue waffle","bluegum","bluegums","blumpkin","bo ob","bo obs","boang","boche","boches","bodily","boffing","bogan","bohunk","boink","boiolas","bollick","bollock","bollocks","bollok","bollox","bombers","bombing","bomd","bondage","boned","boner","boners","bong","bookie","boong","boonga","boongas","boongs","boonie","boonies","booobs","boooobs","booooobs","booooooobs","bootee","bootlip","bootlips","boozer","boozy","bosch","bosche","bosches","boschs","bosomy","bounty bar","bounty bars","bountybar","brea5t","breastjob","breastlover","breastman","brown shower","brown showers","brunette action","btch","buceta","buddhahead","buddhaheads","buffies","bugger","buggered","buggery","bukake","bukkake","bullcrap","bulldike","bulldyke","bullet vibe","bullshit","bullshits","bullshitted","bullturds","bumblefuck","bumfuck","bung hole","bung","bunga","bungas","bunghole","bunny fucker","burr head","burr heads","burrhead","burrheads","butchbabes","butchdike","butchdyke","butt plug","butt-pirate","buttbang","buttcheeks","buttface","buttfuck","buttfucker","buttfuckers","butthead","butthole","buttman","buttmuch","buttmunch","buttmuncher","buttpirate","buttplug","buttstain","buttwipe","byatch","c u n t","c-0-c-k","c-o-c-k","c-u-n-t","c.0.c.k","c.o.c.k.","c.u.n.t","c0ck","c0cks","c0cksucker","c0k","cabron","caca","cacker","cahone","camel jockey","camel jockeys","camel toe","cameljockey","cameltoe","camgirl","camslut","camwhore","carpet muncher","carpetmuncher","carruth","cawk","cawks","cazzo","cervix","chav","cheese eating surrender monkey","cheese eating surrender monkies","cheeseeating surrender monkey","cheeseeating surrender monkies","cheesehead","cheeseheads","cherrypopper","chickslick","china swede","china swedes","chinaman","chinamen","chinaswede","chinaswedes","chinc","chincs","ching chong","ching chongs","chinga","chingchong","chingchongs","chink","chinks","chinky","choad","chocolate rosebuds","chode","chodes","chonkies","chonky","chonkys","chraa","christ killer","christ killers","chug","chugs","chuj","chunger","chungers","chunkies","chunkys","chute","cipa","circlejerk","cl1t","clamdigger","clamdiver","clamps","clansman","clansmen","clanswoman","clanswomen","cleveland steamer","clit","clitface","clitfuck","clitoris","clitorus","clits","clitty","clogwog","clover clamps","clusterfuck","cnts","cntz","cnut","cocain","cocaine","cock","cock-head","cock-sucker","cockbite","cockblock","cockblocker","cockburger","cockcowboy","cockface","cockfight","cockfucker","cockhead","cockholster","cockjockey","cockknob","cockknocker","cockknoker","cocklicker","cocklover","cockmaster","cockmongler","cockmongruel","cockmonkey","cockmunch","cockmuncher","cocknob","cocknose","cocknugget","cockqueen","cockrider","cocks","cockshit","cocksman","cocksmith","cocksmoker","cocksucer","cocksuck","cocksucked","cocksucker","cocksucking","cocksucks","cocksuka","cocksukka","cocktease","cocky","cohee","coital","coitus","cok","cokmuncher","coksucka","commie","condom","coochie","coochy","coolie","coolies","cooly","coon ass","coon asses","coonass","coonasses","coondog","coons","cooter","coprolagnia","coprophilia","copulate","corksucker","cornhole","cra5h","crabs","crackcocain","cracker","crackpipe","crackwhore","crap","crapola","crapper","crappy","creampie","crotch","crotchjockey","crotchmonkey","crotchrot","cuck","cum face","cum licker","cum","cumbubble","cumdumpster","cumfest","cumguzzler","cuming","cumjockey","cumlickr","cumm","cummer","cummin","cumming","cumquat","cumqueen","cums","cumshot","cumshots","cumslut","cumstain","cumsucker","cumtart","cunilingus","cunillingus","cunn","cunnie","cunnilingus","cunntt","cunny","cunt","cunteyed","cuntface","cuntfuck","cuntfucker","cunthole","cunthunter","cuntlick","cuntlicker","cuntlicking","cuntrag","cunts","cuntslut","cuntsucker","cuntz","curry muncher","curry munchers","currymuncher","currymunchers","cushi","cushis","cyalis","cyberfuc","cyberfuck","cyberfucked","cyberfucker","cyberfuckers","cyberfucking","cybersex","cyberslimer","d0ng","d0uch3","d0uche","d1ck","d1ld0","d1ldo","d4mn","dago","dagos","dahmer","damm","dammit","damn","damnation","damned","damnit","darkey","darkeys","darkie","darkies","darky","date rape","daterape","datnigga","dawgie style","dawgie-style","daygo","deapthroat","deep throat","deep throating","deepaction","deepthroat","deepthroating","defecate","deggo","dego","degos","demon","dendrophilia","destroyyourpussy","deth","diaper daddy","diaper head","diaper heads","diaperdaddy","diaperhead","diaperheads","dick pic","dick","dick-ish","dickbag","dickbeater","dickbeaters","dickbrain","dickdipper","dickface","dickflipper","dickforbrains","dickfuck","dickhead","dickheads","dickhole","dickish","dickjuice","dickless","dicklick","dicklicker","dickman","dickmilk","dickmonger","dickpic","dickripper","dicks","dicksipper","dickslap","dickslicker","dicksucker","dickwad","dickweasel","dickweed","dickwhipper","dickwod","dickzipper","diddle","dike","dild0","dild0s","dildo","dildos","dilf","diligaf","dilld0","dilld0s","dillweed","dimwit","dingle","dingleberries","dingleberry","dink","dinks","dipship","dipshit","dipstick","dirsa","dirty pillows","dirty sanchez","dix","dixiedike","dixiedyke","dlck","dog style","dog-fucker","doggie style","doggie","doggie-style","doggiestyle","doggin","dogging","doggy style","doggy-style","doggystyle","dolcett","domination","dominatricks","dominatrics","dominatrix","dommes","dong","donkey punch","donkeypunch","donkeyribber","doochbag","doodoo","doofus","dookie","doosh","dot head","dot heads","dothead","dotheads","double dong","double penetration","doubledong","doublepenetration","douch3","douche bag","douche","douche-fag","douchebag","douchebags","douchewaffle","douchey","dp action","dp","dpaction","dragqueen","dragqween","dripdick","dry hump","dryhump","duche","dudette","dumass","dumb ass","dumbass","dumbasses","dumbbitch","dumbfuck","dumbshit","dumshit","dune coon","dune coons","dupa","dvda","dyefly","dyke","dykes","dziwka","earotics","easyslut","eat my ass","eat my","eatadick","eatballs","eathairpie","eatme","eatmyass","eatpussy","ecchi","ejackulate","ejakulate","ekrem","ekto","enculer","enema","enlargement","erect","erection","ero","erotic","erotism","escort","esqua","essohbee","ethical slut","evl","excrement","exkwew","extacy","extasy","f u c k e r","f u c k e","f u c k","f u k","f*ck","f-u-c-k","f.u.c.k","f4nny","f_u_c_k","facefucker","fack","faeces","faen","fag","fag1t","fagbag","faget","fagfucker","fagg","fagg1t","fagged","fagging","faggit","faggitt","faggot","faggotcock","faggs","fagit","fagot","fagots","fags","fagt","fagtard","fagz","faig","faigs","faigt","fanculo","fannybandit","fannyflaps","fannyfucker","fanyy","fartknocker","fastfuck","fatah","fatfuck","fatfucker","fatso","fck","fckcum","fckd","fcuk","fcuker","fcuking","fecal","feck","fecker","feg","felatio","felch","felcher","felching","fellate","fellatio","feltch","feltcher","feltching","female squirting","femalesquirtin","femalesquirting","femdom","fetish","ficken","figging","fingerbang","fingerfood","fingerfuck","fingerfucked","fingerfucker","fingerfuckers","fingerfucking","fingerfucks","fingering","fisted","fister","fistfuck","fistfucked","fistfucker","fistfuckers","fistfucking","fistfuckings","fistfucks","fisting","fisty","fitt","flamer","flange","flasher","flikker","flipping the bird","flogthelog","floo","floozy","flydie","flydye","foad","fok","fondle","foobar","fook","fooker","foot fetish","footaction","footfetish","footfuck","footfucker","footjob","footlicker","footstar","foreskin","forni","fornicate","fotze","foursome","fourtwenty","freakfuck","freakyfucker","freefuck","freex","frigg","frigga","frigger","frotting","fucck","fuck","fuck-tard","fucka","fuckable","fuckass","fuckbag","fuckbitch","fuckbook","fuckboy","fuckbrain","fuckbuddy","fuckbutt","fuckd","fucked","fuckedup","fucker","fuckers","fuckersucker","fuckface","fuckfest","fuckfreak","fuckfriend","fuckhead","fuckheads","fuckher","fuckhole","fuckin","fuckina","fucking","fuckingbitch","fuckings","fuckingshitmotherfucker","fuckinnuts","fuckinright","fuckit","fuckknob","fuckme","fuckmeat","fuckmehard","fuckmonkey","fuckn","fucknugget","fucknut","fucknuts","fucknutt","fucknutz","fuckoff","fuckpig","fuckpuppet","fuckr","fucks","fuckstick","fucktard","fucktards","fucktoy","fucktrophy","fuckup","fuckwad","fuckwhit","fuckwhore","fuckwit","fuckwitt","fuckyomama","fuckyou","fudge packer","fudgepacker","fugly","fuk","fukah","fuken","fuker","fukin","fuking","fukk","fukkah","fukken","fukker","fukkin","fukking","fuks","fuktard","fuktards","fukwhit","fukwit","funfuck","fungus","futanari","futanary","futkretzn","fuuck","fux","fux0r","fuxor","fvck","fvk","fxck","g-spot","g00k","gae","gai","gang bang","gangbang","gangbanged","gangbanger","gangbangs","gangsta","ganja","gassyass","gator bait","gatorbait","gay sex","gayass","gaybob","gayboy","gaydo","gaygirl","gaylord","gaymuthafuckinwhore","gays","gaysex","gaytard","gaywad","gayz","geezer","geni","genital","genitals","getiton","gey","gfy","ghay","ghey","giant cock","gigolo","ginzo","ginzos","gipp","gippo","gippos","gipps","girl on top","girl on","girls gone wild","givehead","glans","glazeddonut","goatcx","goatse","gob","god dammit","god damn","god damnit","god-dam","god-damned","godam","godammit","godamn","godamnit","goddam","goddamit","goddamm","goddammit","goddamn","goddamned","goddamnes","goddamnit","goddamnmuthafucker","godsdamn","gokkun","golden shower","goldenshower","golliwog","golliwogs","gonad","gonads","gonorrehea","gonzagas","goo girl","gooch","goodpoop","gook eye","gook eyes","gook","gookeye","gookeyes","gookies","gooks","gooky","gora","goras","goregasm","gotohell","goy","goyim","greaseball","greaseballs","groe","groid","groids","grope","grostulation","group sex","gspot","gstring","gtfo","gub","gubba","gubbas","gubs","guido","guiena","guineas","guizi","gummer","guro","gwailo","gwailos","gweilo","gweilos","gyopo","gyopos","gyp","gyped","gypo","gypos","gypp","gypped","gyppie","gyppies","gyppo","gyppos","gyppy","gyppys","gypsys","h e l l","h o m","h00r","h0ar","h0m0","h0mo","h0r","h0re","h4x0r","hadji","hadjis","hairyback","hairybacks","haji","hajis","hajji","hajjis","half breed","half caste","halfbreed","halfcaste","hamas","hamflap","hand job","handjob","haole","haoles","hapa","hard core","hardcore","hardcoresex","hardon","harem","he11","headfuck","hebe","hebes","heeb","heebs","hell","hells","helvete","hentai","heroin","herp","herpes","herpy","heshe","hijacker","hijacking","hillbillies","hillbilly","hindoo","hiscock","hitler","hitlerism","hitlerist","hoar","hoare","hobag","hodgie","hoe","hoer","hoes","holestuffer","hom0","homey","homo","homobangers","homodumbshit","homoey","honger","honkers","honkey","honkeys","honkie","honkies","honky","hooch","hooker","hookers","hoor","hoore","hootch","hooter","hooters","hore","hori","horis","hork","horndawg","horndog","horney","horniest","horny","horseshit","hosejob","hoser","hot carl","hot chick","hotcarl","hotdamn","hotpussy","hotsex","hottotrot","how to kill","how to murder","howtokill","howtomurdep","huevon","huge fat","hugefat","hui","hummer","humped","humper","humpher","humphim","humpin","humping","hussy","hustler","hymen","hymie","hymies","iblowu","ike","ikes","ikey","ikeymo","ikeymos","ikwe","illegal","illegals","inbred","incest","indon","indons","injun","injuns","insest","intercourse","interracial","intheass","inthebuff","israels","j3rk0ff","jack off","jack-off","jackass","jackhole","jackoff","jackshit","jacktheripper","jail bait","jailbait","jap","japcrap","japie","japies","japs","jebus","jelly donut","jerk off","jerk","jerk-off","jerk0ff","jerked","jerkoff","jerries","jerry","jewboy","jewed","jewess","jiga","jigaboo","jigaboos","jigarooni","jigaroonis","jigg","jigga","jiggabo","jiggaboo","jiggabos","jiggas","jigger","jiggerboo","jiggers","jiggs","jiggy","jigs","jihad","jijjiboo","jijjiboos","jimfish","jisim","jism","jiss","jiz","jizim","jizin","jizjuice","jizm","jizn","jizz","jizzd","jizzed","jizzim","jizzin","jizzn","jizzum","jugg","juggs","jugs","jungle bunnies","jungle bunny","junglebunny","junkie","junky","kacap","kacapas","kacaps","kaffer","kaffir","kaffre","kafir","kanake","kanker","katsap","katsaps","kawk","khokhol","khokhols","kicking","kigger","kike","kikes","kimchis","kinbaku","kink","kinkster","kinky","kinkyJesus","kissass","kiunt","kkk","klan","klansman","klansmen","klanswoman","klanswomen","klootzak","knobbing","knobead","knobed","knobend","knobhead","knobjocky","knobjokey","knobz","knockers","knulle","kock","kondum","kondums","kooch","kooches","koon","kootch","krap","krappy","kraut","krauts","kuffar","kuk","kuksuger","kum","kumbubble","kumbullbe","kumer","kummer","kumming","kumquat","kums","kunilingus","kunnilingus","kunt","kunts","kuntz","kurac","kurwa","kushi","kushis","kusi","kwa","kwai lo","kwai los","kwif","kyke","kykes","kyopo","kyopos","kyrpa","l3i+ch","l3i\\+ch","l3itch","labia","lapdance","leather restraint","leather straight","leatherrestraint","lebos","lech","lemon party","lemonparty","leper","lesbain","lesbayn","lesbin","lesbo","lesbos","lez","lezbe","lezbefriends","lezbian","lezbians","lezbo","lezbos","lezz","lezzian","lezzie","lezzies","lezzo","lezzy","libido","licker","licking","lickme","lilniglet","limey","limpdick","limy","lingerie","lipshits","lipshitz","livesex","loadedgun","loin","loins","lolita","lovebone","lovegoo","lovegun","lovejuice","lovemaking","lovemuscle","lovepistol","loverocket","lowlife","lsd","lubejob","lubra","lucifer","luckycammeltoe","lugan","lugans","lust","lusting","lusty","lynch","m-fucking","m0f0","m0fo","m45terbate","ma5terb8","ma5terbate","mabuno","mabunos","macaca","macacas","mafugly","magicwand","mahbuno","mahbunos","make me come","makemecome","makemecum","male squirting","mamhoon","mams","manhater","manpaste","maricon","maricón","marijuana","masochist","masokist","massa","massterbait","masstrbait","masstrbate","mastabate","mastabater","master-bate","masterb8","masterbaiter","masterbat","masterbat3","masterbate","masterbates","masterbating","masterbation","masterbations","masterblaster","mastrabator","masturbat","masturbate","masturbating","masturbation","mattressprincess","mau mau","mau maus","maumau","maumaus","mcfagget","meatbeatter","meatrack","menage","merd","mgger","mggor","mibun","mick","mickeyfinn","mideast","mierda","milf","minge","minger","mo-fo","mockey","mockie","mocky","mof0","mofo","moky","molest","molestation","molester","molestor","moneyshot","mong","monkleigh","moolie","moon cricket","moon crickets","mooncricket","mooncrickets","mormon","moron","moskal","moskals","moslem","mosshead","motha fucker","motha fuker","motha fukkah","motha fukker","mothafuck","mothafucka","mothafuckas","mothafuckaz","mothafucked","mothafucker","mothafuckers","mothafuckin","mothafucking","mothafuckings","mothafucks","mother fucker","mother fukah","mother fuker","mother fukkah","mother fukker","mother-fucker","motherfuck","motherfucka","motherfucked","motherfucker","motherfuckers","motherfuckin","motherfucking","motherfuckings","motherfuckka","motherfucks","motherfvcker","motherlovebone","mothrfucker","mouliewop","mound of venus","moundofvenus","mr hands","mrhands","mtherfucker","mthrfuck","mthrfucker","mthrfucking","mtrfck","mtrfuck","mtrfucker","muff diver","muff","muffdive","muffdiver","muffdiving","muffindiver","mufflikcer","muffpuff","muie","mulatto","mulkku","muncher","mung","munging","munt","munter","muschi","mutha fucker","mutha fukah","mutha fuker","mutha fukkah","mutha fukker","muthafecker","muthafuckaz","muthafucker","muthafuckker","muther","mutherfucker","mutherfucking","muthrfucking","mzungu","mzungus","n1gga","n1gger","n1gr","nad","nads","naked","nambla","nappy","nastt","nasty","nastybitch","nastyho","nastyslut","nastywhore","nawashi","nazi","nazis","nazism","necked","necro","needthedick","negres","negress","negro","negroes","negroid","negros","neonazi","nepesaurio","nig nog","nig","niga","nigar","nigars","nigas","nigers","nigette","nigettes","nigg","nigg3r","nigg4h","nigga","niggah","niggahs","niggar","niggaracci","niggard","niggarded","niggarding","niggardliness","niggardlinesss","niggardly","niggards","niggars","niggas","niggaz","nigger","niggerhead","niggerhole","niggers","niggle","niggled","niggles","niggling","nigglings","niggor","niggress","niggresses","nigguh","nigguhs","niggur","niggurs","niglet","nignog","nigor","nigors","nigr","nigra","nigras","nigre","nigres","nigress","nigs","nigur","niiger","niigr","nimphomania","nimrod","ninny","nip","nipple","nipplering","nipples","nips","nittit","nlgger","nlggor","nob jokey","nob","nobhead","nobjocky","nobjokey","nofuckingway","nog","nookey","nookie","nooky","noonan","nooner","nsfw images","nsfw","nudger","nudie","nudies","numbnuts","nut sack","nutbutter","nutfucker","nutsack","nutten","nymph","nympho","nymphomania","o c k","octopussy","omorashi","one cup two girls","one guy one jar","one guy","one jar","ontherag","orafis","orally","orga","orgasim","orgasim;","orgasims","orgasm","orgasmic","orgasms","orgasum","orgies","orgy","oriface","orifice","orifiss","orospu","osama","ovum","ovums","p e n i s","p i s","p u s s y","p.u.s.s.y.","p0rn","packi","packie","packy","paddy","paedophile","paki","pakie","pakis","paky","palesimian","pancake face","pancake faces","panooch","pansies","pansy","panti","pantie","panties","panty","paska","pastie","pasty","payo","pcp","pearlnecklace","pecker","peckerhead","peckerwood","pedo","pedobear","pedophile","pedophilia","pedophiliac","peeenus","peeenusss","peehole","peenus","peepee","peepshow","peepshpw","pegging","peinus","pen1s","penas","pendejo","pendy","penetrate","penetration","peni5","penial","penile","penis","penis-breath","penises","penisfucker","penisland","penislick","penislicker","penispuffer","penthouse","penus","penuus","perse","perv","perversion","peyote","phalli","phallic","phone sex","phonesex","phuc","phuck","phuk","phuked","phuker","phuking","phukked","phukker","phukking","phuks","phungky","phuq","pi55","picaninny","piccaninny","picka","pickaninnies","pickaninny","piece of shit","pieceofshit","piefke","piefkes","pierdol","pigfucker","piker","pikey","piky","pillowbiter","pillu","pimmel","pimp","pimped","pimper","pimpis","pimpjuic","pimpjuice","pimpsimp","pindick","pinko","pis","pises","pisin","pising","pisof","piss pig","piss","piss-off","pissed","pisser","pissers","pisses","pissflap","pissflaps","pisshead","pissin","pissing","pissoff","pisspig","pistol","pizda","playboy","playgirl","pleasure chest","pleasurechest","pocha","pochas","pocho","pochos","pocketpool","pohm","pohms","polac","polack","polacks","polak","pole smoker","polesmoker","pollock","pollocks","pommie grant","pommie grants","pommy","ponyplay","poof","poon","poonani","poonany","poontang","poontsee","poop chute","poopchute","pooper","pooperscooper","pooping","poorwhitetrash","popimp","porch monkey","porch monkies","porchmonkey","porn","pornflick","pornking","porno","pornography","pornos","pornprincess","pound town","poundtown","pplicker","pr0n","pr1c","pr1ck","pr1k","prairie nigger","prairie niggers","premature","preteen","pric","prickhead","pricks","prig","prince albert piercing","pron","prostitute","pthc","pu55i","pu55y","pube","pubes","pubic","pubiclice","pubis","pud","pudboy","pudd","puddboy","puke","pula","pule","punani","punanny","punany","punkass","punky","punta","puntang","purinapricness","pusies","puss","pusse","pussee","pussi","pussie","pussies","pussy","pussycat","pussydestroyer","pussyeater","pussyfart","pussyfucker","pussylicker","pussylicking","pussylips","pussylover","pussypalace","pussypounder","pussys","pusy","puta","puto","puuke","puuker","qahbeh","quashie","queaf","queef","queerhole","queero","queers","queerz","quickie","quicky","quiff","quim","qweers","qweerz","qweir","r-tard","r-tards","r5e","ra8s","raghead","ragheads","rape","raped","raper","raping","rapist","rautenberg","rearend","rearentry","recktum","rectal","rectum","rectus","redleg","redlegs","redlight","redneck","rednecks","redskin","redskins","reefer","reestie","reetard","reich","renob","rentafuck","rere","retard","retarded","retards","retardz","reverse cowgirl","reversecowgirl","rigger","rimjaw","rimjob","rimming","ritard","rosebuds","rosy palm and her 5 sisters","rosy palm","rosypalm","rosypalmandher5sisters","rosypalmandherefivesisters","round eyes","roundeye","rtard","rtards","rumprammer","ruski","russki","russkie","rusty trombone","rustytrombone","s h i t","s hit","s&m","s-h-1-t","s-h-i-t","s-o-b","s.h.i.t.","s.o.b.","s0b","s_h_i_t","sac","sadis","sadism","sadist","sadom","sambo","sambos","samckdaddy","sanchez","sand nigger","sand niggers","sandm","sandnigger","santorum","sausagequeen","scag","scallywag","scank","scantily","scat","schaffer","scheiss","schizo","schlampe","schlong","schmuck","schvartse","schvartsen","schwartze","schwartzen","scissoring","screwed","screwing","screwyou","scroat","scrog","scrote","scrotum","scrud","seduce","semen","seppo","seppos","septics","sex","sexcam","sexed","sexfarm","sexhound","sexhouse","sexi","sexing","sexkitten","sexo","sexpot","sexslave","sextogo","sextoy","sextoys","sexual","sexually","sexwhore","sexx","sexxi","sexxx","sexxxi","sexxxy","sexxy","sexy","sexymoma","sexyslim","sh!+","sh!t","sh1t","sh1ter","sh1ts","sh1tter","sh1tz","shag","shagger","shaggin","shagging","shamedame","sharmuta","sharmute","shat","shav","shaved beaver","shaved pussy","shavedbeaver","shavedpussy","shawtypimp","sheeney","shemale","shhit","shi+","shibari","shibary","shinola","shipal","shit ass","shit","shit-ass","shit-bag","shit-bagger","shit-brain","shit-breath","shit-cunt","shit-dick","shit-eating","shit-face","shit-faced","shit-fit","shit-head","shit-heel","shit-hole","shit-house","shit-load","shit-pot","shit-spitter","shit-stain","shitass","shitbag","shitbagger","shitblimp","shitbrain","shitbreath","shitcan","shitcunt","shitdick","shite","shiteater","shiteating","shited","shitey","shitface","shitfaced","shitfit","shitforbrains","shitfuck","shitfucker","shitfull","shithapens","shithappens","shithead","shitheel","shithole","shithouse","shiting","shitings","shitlist","shitload","shitola","shitoutofluck","shitpot","shits","shitspitter","shitstain","shitt","shitted","shitter","shitters","shittiest","shitting","shittings","shitty","shity","shitz","shiz","shiznit","shortfuck","shota","shrimping","shylock","shylocks","shyt","shyte","shytty","shyty","simp","sissy","sixsixsix","sixtynine","sixtyniner","skag","skanck","skank","skankbitch","skankee","skankey","skankfuck","skanks","skankwhore","skanky","skankybitch","skankywhore","skeet","skinflute","skribz","skullfuck","skum","skumbag","skurwysyn","skwa","skwe","slag","slanteye","slanty","slapper","sleezeball","slideitin","slimeball","slimebucket","slopehead","slopeheads","sloper","slopers","slopes","slopey","slopeys","slopies","slopy","slut","slutbag","slutbucket","slutdumper","slutkiss","sluts","slutt","slutting","slutty","slutwear","slutwhore","slutz","smack","smackthemonkey","smeg","smegma","smoker","smut","smutty","snatchpatch","snigger","sniggered","sniggering","sniggers","snowback","snowballing","snownigger","snuff","socksucker","sodom","sodomise","sodomite","sodomize","sodomy","son of a bitch","son of a whore","son-of-a-bitch","son-of-a-whore","sonofabitch","sonofbitch","sooties","sooty","souse","soused","soyboy","spac","spade","spades","spaghettibender","spaghettinigger","spank","spankthemonkey","spastic","spearchucker","spearchuckers","sperm","spermacide","spermbag","spermhearder","spermherder","sphencter","spic","spick","spicks","spics","spierdalaj","spig","spigotty","spik","spiks","spitter","splittail","splooge","spludge","spooge","spread legs","spreadeagle","spunk","spunky","sqeh","squa","squarehead","squareheads","squaw","squinty","squirting","stagg","steamy","stfu","stiffy","stoned","stoner","strap on","strapon","strappado","stringer","strip club","stripclub","stroke","stroking","stuinties","stupidfuck","stupidfucker","style doggy","suckdick","sucked","sucker","sucking","suckme","suckmyass","suckmydick","suckmytit","suckoff","sucks","suicide girl","suicide girls","suicidegirl","suicidegirls","suka","sultrywoman","sultrywomen","sumofabiatch","swallower","swalow","swamp guinea","swamp guineas","swastika","syphilis","t i t","t i ts","t1t","t1tt1e5","t1tties","taboo","tacohead","tacoheads","taff","take off your","tar babies","tar baby","tarbaby","tard","taste my","tastemy","tawdry","tea bagging","teabagging","teat","teets","teez","terd","terror","terrorist","teste","testee","testes","testical","testicle","testicles","testis","thicklip","thicklips","thirdeye","thirdleg","threesome","threeway","throating","thumbzilla","thundercunt","tied up","tig ol bitties","tig old bitties","tight white","timber nigger","timber niggers","timbernigger","tinkle","tit","titbitnipply","titfuck","titfucker","titfuckin","titi","titjob","titlicker","titlover","tits","titt","tittie","tittie5","tittiefucker","titties","tittis","titty","tittyfuck","tittyfucker","tittys","tittywank","titwank","tity","to murder","toke","tongethruster","tongue in a","tongueina","tonguethrust","tonguetramp","toots","topless","tortur","torture","tosser","towel head","towel heads","towelhead","trailertrash","tramp","trannie","tranny","transsexual","transvestite","trashy","tribadism","triplex","trisexual","trois","trojan","trots","tub girl","tubgirl","tuckahoe","tunneloflove","turd burgler","turnon","tush","tushy","tw4t","twat","twathead","twatlips","twats","twatty","twatwaffle","twink","twinkie","two girls one cup","twobitwhore","twunt","twunter","udge packer","ukrop","unclefucker","undressing","unfuckable","upskirt","uptheass","upthebutt","urethra play","urethraplay","urophilia","usama","ussys","uzi","v a g i n a","v14gra","v1gra","v4gra","va-j-j","va1jina","vag","vag1na","vagiina","vaj1na","vajina","valium","venus mound","vgra","vibr","vibrater","vibrator","vigra","violet wand","virgin","virginbreaker","vittu","vixen","vjayjay","vodka","vomit","vorarephilia","voyeurweb","voyuer","vullva","vulva","w00se","w0p","wab","wad","wang","wank","wanker","wanking","wanky","waysted","wazoo","weenie","weewee","weiner","welcher","wench","wet dream","wetb","wetback","wetbacks","wetdream","wetspot","wh00r","wh0re","wh0reface","whacker","whash","whigger","whiggers","whiskeydick","whiskydick","whit","white power","white trash","whitenigger","whitepower","whites","whitetrash","whitey","whiteys","whities","whoar","whop","whoralicious","whore","whorealicious","whorebag","whored","whoreface","whorefucker","whorehopper","whorehouse","whores","whoring","wichser","wigga","wiggas","wigger","wiggers","willie","willies","williewanker","willy","wn","wog","wogs","woose","wop","worldsex","wrapping men","wrinkled starfish","wtf","wuss","wuzzie","x-rated","x-rated2g1c","xkwe","xrated","xtc","xx","xxx","xxxxxx","yank","yaoi","yarpie","yarpies","yeasty","yed","yellow showers","yellowman","yellowshowers","yid","yids","yiffy","yobbo","yourboobs","yourpenis","yourtits","yury","zabourah","zigabo","zigabos","zipperhead","zipperheads","zoophile","zoophilia","🖕"];const Sc=yc(_c),Dc=(s,e=300)=>{let t;return function(...n){clearTimeout(t),t=setTimeout(()=>s.apply(this,n),e)}},ni=`url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='44' height='53' viewport='0 0 100 100' style='fill:black;font-size:26px;'><text y='40%'>🚿</text></svg>")
|
|
5
5
|
16 0,
|
|
6
|
-
auto`,
|
|
7
|
-
<span class="guestbook-entry-timestamp">${h} at ${a}</span><span class="guestbook-entry-name"></span> <span class="guestbook-entry-message"></span>`,i.prepend(o),o.querySelector(".guestbook-entry-name")&&(o.querySelector(".guestbook-entry-name").innerText=r.name),o.querySelector(".guestbook-entry-message")&&(o.querySelector(".guestbook-entry-message").innerText=r.message),e.add(r.id)}),t({addedEntries:e})},additionalSetup:({getElement:s,getData:e,setData:t})=>{const n=s();n.addEventListener("submit",i=>{i.preventDefault(),i.stopImmediatePropagation();const r=e(),o=new FormData(i.target);function c(){const u=n.querySelector('input[name="message"]');u&&(u.value="")}const a=Object.fromEntries(o.entries());if(!a.name)return c(),!1;if(
|
|
6
|
+
auto`,Ec=`url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='40' height='48' viewport='0 0 100 100' style='fill:black;font-size:24px;'><text y='50%'>✂️</text></svg>") 16 0,auto`;function ii(s,{getData:e,getElement:t,getLocalData:n,setLocalData:i}){const r=e(),o=n(),c=t();if(o.isHovering=!0,s.altKey){if(r.scale<=.5){c.style.cursor="not-allowed";return}c.style.cursor=Ec}else{if(r.scale>=r.maxScale){c.style.cursor="not-allowed";return}c.style.cursor=ni}i(o)}function Dt(s){if("touches"in s){const{clientX:e,clientY:t}=s.touches[0];return{clientX:e,clientY:t}}return{clientX:s.clientX,clientY:s.clientY}}const ri={[E.CanMove]:{defaultData:{x:0,y:0},defaultLocalData:{startMouseX:0,startMouseY:0},updateElement:({element:s,data:e})=>{s.style.transform=`translate(${e.x}px, ${e.y}px)`},onDragStart:(s,{setLocalData:e})=>{const{clientX:t,clientY:n}=Dt(s);e({startMouseX:t,startMouseY:n})},onDrag:(s,{data:e,localData:t,setData:n,setLocalData:i,element:r})=>{const{clientX:o,clientY:c}=Dt(s),{top:a,left:l,bottom:h,right:u}=r.getBoundingClientRect();u>window.outerWidth&&o>t.startMouseX||h>window.innerHeight&&c>t.startMouseY||l<0&&o<t.startMouseX||a<0&&c<t.startMouseY||(n({x:e.x+o-t.startMouseX,y:e.y+c-t.startMouseY}),i({startMouseX:o,startMouseY:c}))},resetShortcut:"shiftKey"},[E.CanSpin]:{defaultData:{rotation:0},defaultLocalData:{startMouseX:0},updateElement:({element:s,data:e})=>{s.style.transform=`rotate(${e.rotation}deg)`},onDragStart:(s,{setLocalData:e})=>{const{clientX:t}=Dt(s);e({startMouseX:t})},onDrag:(s,{data:e,localData:t,setData:n,setLocalData:i})=>{const{clientX:r}=Dt(s);let o=Math.abs(r-t.startMouseX)*2,c=e.rotation;r>t.startMouseX?c+=o:r<t.startMouseX&&(c-=o),n({rotation:c}),i({startMouseX:r})},resetShortcut:"shiftKey"},[E.CanToggle]:{defaultData:!1,updateElement:({element:s,data:e})=>{s.classList.toggle("clicked",e)},onClick:(s,{data:e,setData:t})=>{t(!e)},resetShortcut:"shiftKey"},[E.CanGrow]:{defaultData:{scale:1},defaultLocalData:{maxScale:2,isHovering:!1},updateElement:({element:s,data:e})=>{s.style.transform=`scale(${e.scale})`},onClick:(s,{data:e,element:t,setData:n,localData:i})=>{let{scale:r}=e;if(s.altKey){if(e.scale<=.5)return;r-=.1}else{if(t.style.cursor=ni,e.scale>=i.maxScale)return;r+=.1}n({...e,scale:r})},additionalSetup:s=>{s.getElement().addEventListener("mouseenter",e=>{ii(e,s);const t=n=>ii(n,s);document.addEventListener("keydown",t),document.addEventListener("keyup",t),s.getElement().addEventListener("mouseleave",n=>{document.removeEventListener("keydown",t),document.removeEventListener("keyup",t)})})},resetShortcut:"shiftKey"},[E.CanPost]:{defaultData:[],defaultLocalData:{addedEntries:new Set},updateElement:({data:s,localData:{addedEntries:e},setLocalData:t})=>{const n=s.filter(r=>!e.has(r.id)),i=si("guestbookMessages");n.forEach(r=>{const o=document.createElement("div");o.classList.add("guestbook-entry");const c=new Date(r.timestamp),a=c.toTimeString().split(" ")[0],l=c.toDateString()===new Date().toDateString(),h=(()=>{const u=new Date;return u.getFullYear()!==c.getFullYear()||u.getMonth()!==c.getMonth()?"Sometime before":l?"Today":u.getDate()-c.getDate()===1?"Yesterday":u.getDate()-c.getDate()<7?"This week":"Sometime before"})();o.innerHTML=`
|
|
7
|
+
<span class="guestbook-entry-timestamp">${h} at ${a}</span><span class="guestbook-entry-name"></span> <span class="guestbook-entry-message"></span>`,i.prepend(o),o.querySelector(".guestbook-entry-name")&&(o.querySelector(".guestbook-entry-name").innerText=r.name),o.querySelector(".guestbook-entry-message")&&(o.querySelector(".guestbook-entry-message").innerText=r.message),e.add(r.id)}),t({addedEntries:e})},additionalSetup:({getElement:s,getData:e,setData:t})=>{const n=s();n.addEventListener("submit",i=>{i.preventDefault(),i.stopImmediatePropagation();const r=e(),o=new FormData(i.target);function c(){const u=n.querySelector('input[name="message"]');u&&(u.value="")}const a=Object.fromEntries(o.entries());if(!a.name)return c(),!1;if(Sc.some(u=>{const d=new RegExp(`\\b${u}\\b`,"gi");return d.test(a.message)||d.test(a.name)}))return alert("now why would you try to do something like that?"),c(),!1;const l=Date.now(),h={name:"someone",message:"something",...a,timestamp:l,id:`${l}-${a.name}`};return t([...r,h]),c(),!1})}},[E.CanDuplicate]:{defaultData:[],defaultLocalData:[],updateElement:({data:s,localData:e,setLocalData:t,element:n})=>{var h;const i=n.getAttribute(E.CanDuplicate),r=document.getElementById(i);let o=document.getElementById((h=e.slice(-1))==null?void 0:h[0])??null;if(!r){console.error(`Element with id ${i} not found. Cannot duplicate.`);return}const c=n.getAttribute(bc);function a(u){if(c){const d=document.getElementById(c)||document.querySelector(c);if(d){d.appendChild(u);return}}r.parentNode.insertBefore(u,(o||r).nextSibling)}const l=new Set(e);for(const u of s){if(l.has(u))continue;const d=r.cloneNode(!0);Object.assign(d,{...r}),d.id=u,a(d),e.push(u),window.playhtml.setupPlayElement(d),o=d}t(e)},onClick:(s,{data:e,element:t,setData:n})=>{const r=t.getAttribute(E.CanDuplicate)+"-"+Math.random().toString(36).substr(2,9);n([...e,r])}}};class Cc{constructor({element:e,onChange:t,onAwarenessChange:n,defaultData:i,defaultLocalData:r,myDefaultAwareness:o,data:c,awareness:a,updateElement:l,updateElementAwareness:h,onClick:u,onDrag:d,onDragStart:f,additionalSetup:g,resetShortcut:m,debounceMs:U,triggerAwarenessUpdate:We}){b(this,"defaultData");b(this,"localData");b(this,"awareness",[]);b(this,"selfAwareness");b(this,"element");b(this,"_data");b(this,"onChange");b(this,"onAwarenessChange");b(this,"debouncedOnChange");b(this,"resetShortcut");b(this,"updateElement");b(this,"updateElementAwareness");b(this,"triggerAwarenessUpdate");this.element=e,this.defaultData=i instanceof Function?i(e):i,this.localData=r instanceof Function?r(e):r,this.triggerAwarenessUpdate=We,this.onChange=t,this.resetShortcut=m,this.debouncedOnChange=Dc(this.onChange,U),this.onAwarenessChange=n,this.updateElement=l,this.updateElementAwareness=h;const li=c===void 0?this.defaultData:c;a!==void 0&&(this.__awareness=a);const hi=o instanceof Function?o(e):o;hi!==void 0&&this.setLocalAwareness(hi),this._data=li,this.__data=li,u&&e.addEventListener("click",z=>{u(z,this.getEventHandlerData())}),d&&(e.addEventListener("touchstart",z=>{z.preventDefault(),f&&f(z,this.getEventHandlerData());const Pe=be=>{be.preventDefault(),d(be,this.getEventHandlerData())},Qe=be=>{document.removeEventListener("touchmove",Pe),document.removeEventListener("touchend",Qe)};document.addEventListener("touchmove",Pe),document.addEventListener("touchend",Qe)}),e.addEventListener("mousedown",z=>{f&&f(z,this.getEventHandlerData());const Pe=be=>{be.preventDefault(),d(be,this.getEventHandlerData())},Qe=be=>{document.removeEventListener("mousemove",Pe),document.removeEventListener("mouseup",Qe)};document.addEventListener("mousemove",Pe),document.addEventListener("mouseup",Qe)})),g&&g(this.getSetupData()),m&&(e.title||(e.title=`Hold down the ${mc[m]} key while clicking to reset.`),e.reset=this.reset,e.addEventListener("click",z=>{switch(m){case"ctrlKey":if(!z.ctrlKey)return;break;case"altKey":if(!z.altKey)return;break;case"shiftKey":if(!z.shiftKey)return;break;case"metaKey":if(!z.metaKey)return;break;default:return}this.reset(),z.preventDefault(),z.stopPropagation()}))}get data(){return this._data}setLocalData(e){this.localData=e}set __data(e){this._data=e,this.updateElement(this.getEventHandlerData())}set __awareness(e){this.updateElementAwareness&&(this.awareness=e,this.updateElementAwareness(this.getAwarenessEventHandlerData()))}getEventHandlerData(){return{element:this.element,data:this.data,localData:this.localData,awareness:this.awareness,setData:e=>this.setData(e),setLocalData:e=>this.setLocalData(e),setLocalAwareness:e=>this.setLocalAwareness(e)}}getAwarenessEventHandlerData(){return{...this.getEventHandlerData(),myAwareness:this.selfAwareness}}getSetupData(){return{getElement:()=>this.element,getData:()=>this.data,getLocalData:()=>this.localData,getAwareness:()=>this.awareness,setData:e=>this.setData(e),setLocalData:e=>this.setLocalData(e),setLocalAwareness:e=>this.setLocalAwareness(e)}}setData(e){this.onChange(e)}setLocalAwareness(e){var t;e!==this.selfAwareness&&(this.selfAwareness=e,this.onAwarenessChange(e),(t=this.triggerAwarenessUpdate)==null||t.call(this))}setDataDebounced(e){this.debouncedOnChange(e)}reset(){this.setData(this.defaultData)}}const vc="playhtml.spencerc99.partykit.dev",bs=new Ee,xc=window.location.href;let ie,$,re;const oi=new Map;let ws=!0;function ys({room:s=xc,host:e=vc}={}){if(!ws){console.error("playhtml already set up!");return}const t=e;console.log(`࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂
|
|
8
8
|
࿂࿂࿂࿂ ࿂ ࿂ ࿂ ࿂ ࿂ ࿂࿂࿂࿂
|
|
9
9
|
࿂࿂࿂࿂ booting up playhtml... ࿂࿂࿂࿂
|
|
10
10
|
࿂࿂࿂࿂ https://playhtml.fun ࿂࿂࿂࿂
|
|
11
11
|
࿂࿂࿂࿂ ࿂ ࿂ ࿂ ࿂ ࿂࿂࿂࿂
|
|
12
|
-
࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂`),
|
|
12
|
+
࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂`),ie=new tc(t,s,bs),$=bs.getMap("playhtml-global"),re=new Map,new kc(s,bs),Et.globalData=$,Et.elementHandlers=re,ie.on("sync",n=>{n||console.error("Issue connecting to yjs..."),Mc()})}setTimeout(()=>{ie||(console.log("You are using a deprecated version of playhtml. Please call `playhtml.init()` explicitly rather than just importing the library. Refer to https://github.com/spencerc99/playhtml#usage for reference."),ys())},3e3);function Ac(s,e){const t=ie.awareness.getLocalState();return((t==null?void 0:t[s])??{})[e]}function _s(s){return s instanceof HTMLElement}function Ic(s,e,t,n){const i=$.get(e),r={...t,data:i.get(n)??t.defaultData,awareness:Ac(e,n)??t.myDefaultAwareness!==void 0?[t.myDefaultAwareness]:void 0,element:s,onChange:o=>{i.get(n)!==o&&i.set(n,o)},onAwarenessChange:o=>{var a;const c=((a=ie.awareness.getLocalState())==null?void 0:a[e])||{};c[n]!==o&&(c[n]=o,ie.awareness.setLocalStateField(e,c))},triggerAwarenessUpdate:()=>{ci()}};return new Cc(r)}function Lc(s){return s.defaultData!==void 0&&s.updateElement!==void 0}function jc(s,e){if(s===E.CanPlay){const t=e;return{defaultData:t.defaultData,defaultLocalData:t.defaultLocalData,myDefaultAwareness:t.myDefaultAwareness,updateElement:t.updateElement,updateElementAwareness:t.updateElementAwareness,onDrag:t.onDrag,onDragStart:t.onDragStart,onClick:t.onClick,additionalSetup:t.additionalSetup,resetShortcut:t.resetShortcut,debounceMs:t.debounceMs}}return ri[s]}function ci(){const s=new Map;function e(t,n,i,r){s.has(t)||s.set(t,new Map);const o=s.get(t);o.has(n)||o.set(n,new Map),o.get(n).set(i,r)}ie.awareness.getStates().forEach((t,n)=>{var i;for(const[r,o]of Object.entries(t)){const c=re.get(r);if(c)for(const[a,l]of c){if(!(a in o))continue;const h=o[a];e(r,a,n,h)}}for(const[r,o]of s){const c=re.get(r);if(c)for(const[a,l]of c){const h=(i=o.get(a))==null?void 0:i.values();if(!h)continue;let u=Array.from(h);l.__awareness=u}}})}function Mc(){console.log("[PLAYHTML]: Setting up elements... Time to have some fun 🛝");for(const s of Object.values(E)){const e=Array.from(document.querySelectorAll(`[${s}]`)).filter(_s);if(e.length)for(let t=0;t<e.length;t++){const n=e[t];Ct(n,s)}}ws&&($.observe(s=>{s.changes.keys.forEach((e,t)=>{e.action==="add"&&$.set(t,$.get(t))})}),ie.awareness.on("change",()=>ci()),ws=!1)}const Et={init:ys,setupPlayElement:ai,globalData:void 0,elementHandlers:void 0};window.playhtml=Et;function Tc(s){if(re.has(s))return;re.set(s,new Map),s!==E.CanPlay&&ri[s],$.get(s)||$.set(s,new de);const e=$.get(s);e.observe(t=>{t.changes.keys.forEach((n,i)=>{const r=re.get(s);if(n.action==="add"){const o=si(i);if(!_s(o)){console.log(`Element ${i} not an HTML element. Ignoring.`);return}Ct(o,s)}else if(n.action==="update"){const o=r.get(i);o.__data=e.get(i)}else n.action==="delete"?r.delete(i):console.log(`Unhandled action: ${n.action}`)})})}function Uc(s,e){const t=s.getAttribute(e);switch(e){case E.CanPlay:case E.CanMove:case E.CanSpin:case E.CanGrow:case E.CanToggle:case E.CanPost:return!0;case E.CanDuplicate:return t?(document.getElementById(t)||console.warn(`${E.CanDuplicate} element (${s.id}) duplicate element ("${t}") not found.`),!0):!1;default:return console.error(`Unhandled tag found in validation: ${e}`),!1}}function Ct(s,e){var c;if(!Uc(s,e))return;if(!s.id){const a=s.getAttribute("selector-id");if(a){const l=oi.get(a)??0;s.id=btoa(`${e}-${a}-${l}`),oi.set(a,l+1)}else s.id=btoa(`${e}-${s.innerHTML}}`)}const t=wc(s);if(!t){console.error(`Element ${s} does not have an acceptable ID. Please add an ID to the element to register it as a playhtml element.`);return}Tc(e);const n=re.get(e);if(n.has(t))return;const i=jc(e,s);if(!Lc(i)){console.error(`Element ${t} does not have proper info to initial a playhtml element. Please refer to https://github.com/spencerc99/playhtml#can-play for troubleshooting help.`);return}const r=$.get(e),o=Ic(s,e,i,t);n.set(t,o),r.get(t)===void 0&&i.defaultData!==void 0&&r.set(t,i.defaultData),(c=o.triggerAwarenessUpdate)==null||c.call(o),s.classList.add("__playhtml-element"),s.classList.add(`__playhtml-${e}`),s.style.setProperty("--jiggle-delay",`${Math.random()*1}s;}`)}function ai(s){if(!_s(s)){console.log(`Element ${s.id} not an HTML element. Ignoring.`);return}for(const e of Object.values(E))s.hasAttribute(e)&&Ct(s,e)}M.initPlayHTML=ys,M.playhtml=Et,M.setupPlayElement=ai,M.setupPlayElementForTag=Ct,Object.defineProperty(M,Symbol.toStringTag,{value:"Module"})});
|