@wangeditor-next/yjs-for-react 0.1.0

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.
Files changed (49) hide show
  1. package/CHANGELOG.md +0 -0
  2. package/README.md +4 -0
  3. package/dist/hooks/use-editor-static.d.ts +4 -0
  4. package/dist/hooks/useDecorateRemoteCursors.d.ts +24 -0
  5. package/dist/hooks/useDecorateRemoteCursors.d.ts.map +1 -0
  6. package/dist/hooks/useRemoteCursorEditor.d.ts +3 -0
  7. package/dist/hooks/useRemoteCursorEditor.d.ts.map +1 -0
  8. package/dist/hooks/useRemoteCursorOverlayPositions.d.ts +18 -0
  9. package/dist/hooks/useRemoteCursorOverlayPositions.d.ts.map +1 -0
  10. package/dist/hooks/useRemoteCursorStateStore.d.ts +4 -0
  11. package/dist/hooks/useRemoteCursorStateStore.d.ts.map +1 -0
  12. package/dist/hooks/useRemoteCursorStates.d.ts +3 -0
  13. package/dist/hooks/useRemoteCursorStates.d.ts.map +1 -0
  14. package/dist/hooks/useUnsetCursorPositionOnBlur.d.ts +2 -0
  15. package/dist/hooks/useUnsetCursorPositionOnBlur.d.ts.map +1 -0
  16. package/dist/hooks/utils.d.ts +3 -0
  17. package/dist/hooks/utils.d.ts.map +1 -0
  18. package/dist/index.cjs +453 -0
  19. package/dist/index.cjs.map +1 -0
  20. package/dist/index.d.ts +4 -0
  21. package/dist/index.d.ts.map +1 -0
  22. package/dist/index.esm.js +40 -0
  23. package/dist/index.esm.js.map +1 -0
  24. package/dist/index.global.js +31877 -0
  25. package/dist/index.global.js.map +1 -0
  26. package/dist/index.js +40 -0
  27. package/dist/index.js.map +1 -0
  28. package/dist/types.d.ts +1 -0
  29. package/dist/types.d.ts.map +1 -0
  30. package/dist/utils/getCursorRange.d.ts +3 -0
  31. package/dist/utils/getCursorRange.d.ts.map +1 -0
  32. package/dist/utils/getOverlayPosition.d.ts +23 -0
  33. package/dist/utils/getOverlayPosition.d.ts.map +1 -0
  34. package/dist/utils/react-editor-to-dom-range-safe.d.ts +3 -0
  35. package/dist/utils/react-editor-to-dom-range-safe.d.ts.map +1 -0
  36. package/package.json +54 -0
  37. package/rollup.config.js +28 -0
  38. package/src/hooks/use-editor-static.tsx +18 -0
  39. package/src/hooks/useRemoteCursorEditor.ts +14 -0
  40. package/src/hooks/useRemoteCursorOverlayPositions.tsx +131 -0
  41. package/src/hooks/useRemoteCursorStateStore.ts +85 -0
  42. package/src/hooks/useRemoteCursorStates.ts +22 -0
  43. package/src/hooks/utils.ts +54 -0
  44. package/src/index.ts +11 -0
  45. package/src/types.ts +1 -0
  46. package/src/utils/getCursorRange.ts +34 -0
  47. package/src/utils/getOverlayPosition.ts +107 -0
  48. package/src/utils/react-editor-to-dom-range-safe.ts +10 -0
  49. package/tsconfig.json +8 -0
package/dist/index.js ADDED
@@ -0,0 +1,40 @@
1
+ !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("react"),require("slate"),require("yjs"),require("@wangeditor-next/editor")):"function"==typeof define&&define.amd?define(["exports","react","slate","yjs","@wangeditor-next/editor"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).WangEditorCodeHighLight={},t.e,t.slate,t.Y,t.editor)}(this,(function(t,e,r,n,o){"use strict";function i(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}function a(t){if(t&&t.__esModule)return t;var e=Object.create(null);return t&&Object.keys(t).forEach((function(r){if("default"!==r){var n=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(e,r,n.get?n:{enumerable:!0,get:function(){return t[r]}})}})),e.default=t,Object.freeze(e)}var u=i(e),c=a(n),f=e.createContext(null),s=function(){var t=e.useContext(f);return t||console.warn("The `useEditorStatic` hook must be used inside the <EditorContext> component's context."),t},l=function(){return l=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var o in e=arguments[r])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},l.apply(this,arguments)};function v(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,o,i=r.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(n=i.next()).done;)a.push(n.value)}catch(t){o={error:t}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return a}"function"==typeof SuppressedError&&SuppressedError;var d="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function h(t){var e={exports:{}};return t(e,e.exports),e.exports
2
+ /**
3
+ * @license React
4
+ * use-sync-external-store-shim.production.min.js
5
+ *
6
+ * Copyright (c) Facebook, Inc. and its affiliates.
7
+ *
8
+ * This source code is licensed under the MIT license found in the
9
+ * LICENSE file in the root directory of this source tree.
10
+ */}var p="function"==typeof Object.is?Object.is:function(t,e){return t===e&&(0!==t||1/t==1/e)||t!=t&&e!=e},y=u.default.useState,g=u.default.useEffect,b=u.default.useLayoutEffect,m=u.default.useDebugValue;function w(t){var e=t.getSnapshot;t=t.value;try{var r=e();return!p(t,r)}catch(t){return!0}}var x="undefined"==typeof window||void 0===window.document||void 0===window.document.createElement?function(t,e){return e()}:function(t,e){var r=e(),n=y({inst:{value:r,getSnapshot:e}}),o=n[0].inst,i=n[1];return b((function(){o.value=r,o.getSnapshot=e,w(o)&&i({inst:o})}),[t,r,e]),g((function(){return w(o)&&i({inst:o}),t((function(){w(o)&&i({inst:o})}))}),[t]),m(r),r},O={useSyncExternalStore:void 0!==u.default.useSyncExternalStore?u.default.useSyncExternalStore:x};
11
+ /**
12
+ * @license React
13
+ * use-sync-external-store-shim.development.js
14
+ *
15
+ * Copyright (c) Facebook, Inc. and its affiliates.
16
+ *
17
+ * This source code is licensed under the MIT license found in the
18
+ * LICENSE file in the root directory of this source tree.
19
+ */
20
+ h((function(t,e){}));var S=h((function(t){t.exports=O}));
21
+ /**
22
+ * @license React
23
+ * use-sync-external-store-shim/with-selector.production.min.js
24
+ *
25
+ * Copyright (c) Facebook, Inc. and its affiliates.
26
+ *
27
+ * This source code is licensed under the MIT license found in the
28
+ * LICENSE file in the root directory of this source tree.
29
+ */var E="function"==typeof Object.is?Object.is:function(t,e){return t===e&&(0!==t||1/t==1/e)||t!=t&&e!=e},T=S.useSyncExternalStore,j=u.default.useRef,P=u.default.useEffect,R=u.default.useMemo,A=u.default.useDebugValue,C={useSyncExternalStoreWithSelector:function(t,e,r,n,o){var i=j(null);if(null===i.current){var a={hasValue:!1,value:null};i.current=a}else a=i.current;i=R((function(){function t(t){if(!c){if(c=!0,i=t,t=n(t),void 0!==o&&a.hasValue){var e=a.value;if(o(e,t))return u=e}return u=t}if(e=u,E(i,t))return e;var r=n(t);return void 0!==o&&o(e,r)?e:(i=t,u=r)}var i,u,c=!1,f=void 0===r?null:r;return[function(){return t(e())},null===f?void 0:function(){return t(f())}]}),[e,r,n,o]);var u=T(t,i[0],i[1]);return P((function(){a.hasValue=!0,a.value=u}),[u]),A(u),u}};
30
+ /**
31
+ * @license React
32
+ * use-sync-external-store-shim/with-selector.development.js
33
+ *
34
+ * Copyright (c) Facebook, Inc. and its affiliates.
35
+ *
36
+ * This source code is licensed under the MIT license found in the
37
+ * LICENSE file in the root directory of this source tree.
38
+ */
39
+ h((function(t,e){}));var k,L,z=h((function(t){t.exports=C})),M=function(t){return t&&t.Math==Math&&t},_=M("object"==typeof globalThis&&globalThis)||M("object"==typeof window&&window)||M("object"==typeof self&&self)||M("object"==typeof d&&d)||function(){return this}()||Function("return this")(),D=Function.prototype,I=D.bind,F=D.call,N=I&&I.bind(F),W=I?function(t){return t&&N(F,t)}:function(t){return t&&function(){return F.apply(t,arguments)}},G=function(t){try{return!!t()}catch(t){return!0}},X=W({}.toString),V=W("".slice),B=function(t){return V(X(t),8,-1)},q=_.Object,Y=W("".split),U=G((function(){return!q("z").propertyIsEnumerable(0)}))?function(t){return"String"==B(t)?Y(t,""):q(t)}:q,H=_.TypeError,K=function(t){if(null==t)throw H("Can't call method on "+t);return t},J=function(t){return U(K(t))},$=Object.defineProperty,Q=function(t,e){try{$(_,t,{value:e,configurable:!0,writable:!0})}catch(r){_[t]=e}return e},Z="__core-js_shared__",tt=_[Z]||Q(Z,{}),et=h((function(t){(t.exports=function(t,e){return tt[t]||(tt[t]=void 0!==e?e:{})})("versions",[]).push({version:"3.19.3",mode:"global",copyright:"© 2021 Denis Pushkarev (zloirock.ru)"})})),rt=_.Object,nt=function(t){return rt(K(t))},ot=W({}.hasOwnProperty),it=Object.hasOwn||function(t,e){return ot(nt(t),e)},at=0,ut=Math.random(),ct=W(1..toString),ft=function(t){return"Symbol("+(void 0===t?"":t)+")_"+ct(++at+ut,36)},st=function(t){return"function"==typeof t},lt=function(t,e){return arguments.length<2?(r=_[t],st(r)?r:void 0):_[t]&&_[t][e];var r},vt=lt("navigator","userAgent")||"",dt=_.process,ht=_.Deno,pt=dt&&dt.versions||ht&&ht.version,yt=pt&&pt.v8;yt&&(L=(k=yt.split("."))[0]>0&&k[0]<4?1:+(k[0]+k[1])),!L&&vt&&(!(k=vt.match(/Edge\/(\d+)/))||k[1]>=74)&&(k=vt.match(/Chrome\/(\d+)/))&&(L=+k[1]);var gt,bt=L,mt=!!Object.getOwnPropertySymbols&&!G((function(){var t=Symbol();return!String(t)||!(Object(t)instanceof Symbol)||!Symbol.sham&&bt&&bt<41})),wt=mt&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,xt=et("wks"),Ot=_.Symbol,St=Ot&&Ot.for,Et=wt?Ot:Ot&&Ot.withoutSetter||ft,Tt=function(t){if(!it(xt,t)||!mt&&"string"!=typeof xt[t]){var e="Symbol."+t;mt&&it(Ot,t)?xt[t]=Ot[t]:xt[t]=wt&&St?St(e):Et(e)}return xt[t]},jt=function(t){return"object"==typeof t?null!==t:st(t)},Pt=_.String,Rt=_.TypeError,At=function(t){if(jt(t))return t;throw Rt(Pt(t)+" is not an object")},Ct=!G((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]})),kt=_.document,Lt=jt(kt)&&jt(kt.createElement),zt=function(t){return Lt?kt.createElement(t):{}},Mt=!Ct&&!G((function(){return 7!=Object.defineProperty(zt("div"),"a",{get:function(){return 7}}).a})),_t=Function.prototype.call,Dt=_t.bind?_t.bind(_t):function(){return _t.apply(_t,arguments)},It=W({}.isPrototypeOf),Ft=_.Object,Nt=wt?function(t){return"symbol"==typeof t}:function(t){var e=lt("Symbol");return st(e)&&It(e.prototype,Ft(t))},Wt=_.String,Gt=function(t){try{return Wt(t)}catch(t){return"Object"}},Xt=_.TypeError,Vt=function(t){if(st(t))return t;throw Xt(Gt(t)+" is not a function")},Bt=function(t,e){var r=t[e];return null==r?void 0:Vt(r)},qt=_.TypeError,Yt=_.TypeError,Ut=Tt("toPrimitive"),Ht=function(t,e){if(!jt(t)||Nt(t))return t;var r,n=Bt(t,Ut);if(n){if(void 0===e&&(e="default"),r=Dt(n,t,e),!jt(r)||Nt(r))return r;throw Yt("Can't convert object to primitive value")}return void 0===e&&(e="number"),function(t,e){var r,n;if("string"===e&&st(r=t.toString)&&!jt(n=Dt(r,t)))return n;if(st(r=t.valueOf)&&!jt(n=Dt(r,t)))return n;if("string"!==e&&st(r=t.toString)&&!jt(n=Dt(r,t)))return n;throw qt("Can't convert object to primitive value")}(t,e)},Kt=function(t){var e=Ht(t,"string");return Nt(e)?e:e+""},Jt=_.TypeError,$t=Object.defineProperty,Qt={f:Ct?$t:function(t,e,r){if(At(t),e=Kt(e),At(r),Mt)try{return $t(t,e,r)}catch(t){}if("get"in r||"set"in r)throw Jt("Accessors not supported");return"value"in r&&(t[e]=r.value),t}},Zt=Math.ceil,te=Math.floor,ee=function(t){var e=+t;return e!=e||0===e?0:(e>0?te:Zt)(e)},re=Math.max,ne=Math.min,oe=function(t,e){var r=ee(t);return r<0?re(r+e,0):ne(r,e)},ie=Math.min,ae=function(t){return(e=t.length)>0?ie(ee(e),9007199254740991):0;var e},ue=function(t){return function(e,r,n){var o,i=J(e),a=ae(i),u=oe(n,a);if(t&&r!=r){for(;a>u;)if((o=i[u++])!=o)return!0}else for(;a>u;u++)if((t||u in i)&&i[u]===r)return t||u||0;return!t&&-1}},ce={includes:ue(!0),indexOf:ue(!1)},fe={},se=ce.indexOf,le=W([].push),ve=function(t,e){var r,n=J(t),o=0,i=[];for(r in n)!it(fe,r)&&it(n,r)&&le(i,r);for(;e.length>o;)it(n,r=e[o++])&&(~se(i,r)||le(i,r));return i},de=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],he=Object.keys||function(t){return ve(t,de)},pe=Ct?Object.defineProperties:function(t,e){At(t);for(var r,n=J(e),o=he(e),i=o.length,a=0;i>a;)Qt.f(t,r=o[a++],n[r]);return t},ye=lt("document","documentElement"),ge=et("keys"),be=function(t){return ge[t]||(ge[t]=ft(t))},me="prototype",we="script",xe=be("IE_PROTO"),Oe=function(){},Se=function(t){return"<"+we+">"+t+"</"+we+">"},Ee=function(t){t.write(Se("")),t.close();var e=t.parentWindow.Object;return t=null,e},Te=function(){try{gt=new ActiveXObject("htmlfile")}catch(t){}var t,e,r;Te="undefined"!=typeof document?document.domain&&gt?Ee(gt):(e=zt("iframe"),r="java"+we+":",e.style.display="none",ye.appendChild(e),e.src=String(r),(t=e.contentWindow.document).open(),t.write(Se("document.F=Object")),t.close(),t.F):Ee(gt);for(var n=de.length;n--;)delete Te[me][de[n]];return Te()};fe[xe]=!0;var je=Object.create||function(t,e){var r;return null!==t?(Oe[me]=At(t),r=new Oe,Oe[me]=null,r[xe]=t):r=Te(),void 0===e?r:pe(r,e)},Pe=Tt("unscopables"),Re=Array.prototype;null==Re[Pe]&&Qt.f(Re,Pe,{configurable:!0,value:je(null)});var Ae=function(t){Re[Pe][t]=!0},Ce={},ke=W(Function.toString);st(tt.inspectSource)||(tt.inspectSource=function(t){return ke(t)});var Le,ze,Me,_e=tt.inspectSource,De=_.WeakMap,Ie=st(De)&&/native code/.test(_e(De)),Fe=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}},Ne=Ct?function(t,e,r){return Qt.f(t,e,Fe(1,r))}:function(t,e,r){return t[e]=r,t},We="Object already initialized",Ge=_.TypeError,Xe=_.WeakMap;if(Ie||tt.state){var Ve=tt.state||(tt.state=new Xe),Be=W(Ve.get),qe=W(Ve.has),Ye=W(Ve.set);Le=function(t,e){if(qe(Ve,t))throw new Ge(We);return e.facade=t,Ye(Ve,t,e),e},ze=function(t){return Be(Ve,t)||{}},Me=function(t){return qe(Ve,t)}}else{var Ue=be("state");fe[Ue]=!0,Le=function(t,e){if(it(t,Ue))throw new Ge(We);return e.facade=t,Ne(t,Ue,e),e},ze=function(t){return it(t,Ue)?t[Ue]:{}},Me=function(t){return it(t,Ue)}}var He,Ke,Je,$e={set:Le,get:ze,has:Me,enforce:function(t){return Me(t)?ze(t):Le(t,{})},getterFor:function(t){return function(e){var r;if(!jt(e)||(r=ze(e)).type!==t)throw Ge("Incompatible receiver, "+t+" required");return r}}},Qe={}.propertyIsEnumerable,Ze=Object.getOwnPropertyDescriptor,tr={f:Ze&&!Qe.call({1:2},1)?function(t){var e=Ze(this,t);return!!e&&e.enumerable}:Qe},er=Object.getOwnPropertyDescriptor,rr={f:Ct?er:function(t,e){if(t=J(t),e=Kt(e),Mt)try{return er(t,e)}catch(t){}if(it(t,e))return Fe(!Dt(tr.f,t,e),t[e])}},nr=Function.prototype,or=Ct&&Object.getOwnPropertyDescriptor,ir=it(nr,"name"),ar={EXISTS:ir,PROPER:ir&&"something"===function(){}.name,CONFIGURABLE:ir&&(!Ct||Ct&&or(nr,"name").configurable)},ur=h((function(t){var e=ar.CONFIGURABLE,r=$e.get,n=$e.enforce,o=String(String).split("String");(t.exports=function(t,r,i,a){var u,c=!!a&&!!a.unsafe,f=!!a&&!!a.enumerable,s=!!a&&!!a.noTargetGet,l=a&&void 0!==a.name?a.name:r;st(i)&&("Symbol("===String(l).slice(0,7)&&(l="["+String(l).replace(/^Symbol\(([^)]*)\)/,"$1")+"]"),(!it(i,"name")||e&&i.name!==l)&&Ne(i,"name",l),(u=n(i)).source||(u.source=o.join("string"==typeof l?l:""))),t!==_?(c?!s&&t[r]&&(f=!0):delete t[r],f?t[r]=i:Ne(t,r,i)):f?t[r]=i:Q(r,i)})(Function.prototype,"toString",(function(){return st(this)&&r(this).source||_e(this)}))})),cr=de.concat("length","prototype"),fr={f:Object.getOwnPropertyNames||function(t){return ve(t,cr)}},sr={f:Object.getOwnPropertySymbols},lr=W([].concat),vr=lt("Reflect","ownKeys")||function(t){var e=fr.f(At(t)),r=sr.f;return r?lr(e,r(t)):e},dr=function(t,e){for(var r=vr(e),n=Qt.f,o=rr.f,i=0;i<r.length;i++){var a=r[i];it(t,a)||n(t,a,o(e,a))}},hr=/#|\.prototype\./,pr=function(t,e){var r=gr[yr(t)];return r==mr||r!=br&&(st(e)?G(e):!!e)},yr=pr.normalize=function(t){return String(t).replace(hr,".").toLowerCase()},gr=pr.data={},br=pr.NATIVE="N",mr=pr.POLYFILL="P",wr=pr,xr=rr.f,Or=function(t,e){var r,n,o,i,a,u=t.target,c=t.global,f=t.stat;if(r=c?_:f?_[u]||Q(u,{}):(_[u]||{}).prototype)for(n in e){if(i=e[n],o=t.noTargetGet?(a=xr(r,n))&&a.value:r[n],!wr(c?n:u+(f?".":"#")+n,t.forced)&&void 0!==o){if(typeof i==typeof o)continue;dr(i,o)}(t.sham||o&&o.sham)&&Ne(i,"sham",!0),ur(r,n,i,t)}},Sr=!G((function(){function t(){}return t.prototype.constructor=null,Object.getPrototypeOf(new t)!==t.prototype})),Er=be("IE_PROTO"),Tr=_.Object,jr=Tr.prototype,Pr=Sr?Tr.getPrototypeOf:function(t){var e=nt(t);if(it(e,Er))return e[Er];var r=e.constructor;return st(r)&&e instanceof r?r.prototype:e instanceof Tr?jr:null},Rr=Tt("iterator"),Ar=!1;[].keys&&("next"in(Je=[].keys())?(Ke=Pr(Pr(Je)))!==Object.prototype&&(He=Ke):Ar=!0);var Cr=null==He||G((function(){var t={};return He[Rr].call(t)!==t}));Cr&&(He={}),st(He[Rr])||ur(He,Rr,(function(){return this}));var kr={IteratorPrototype:He,BUGGY_SAFARI_ITERATORS:Ar},Lr=Qt.f,zr=Tt("toStringTag"),Mr=function(t,e,r){t&&!it(t=r?t:t.prototype,zr)&&Lr(t,zr,{configurable:!0,value:e})},_r=kr.IteratorPrototype,Dr=function(){return this},Ir=_.String,Fr=_.TypeError,Nr=Object.setPrototypeOf||("__proto__"in{}?function(){var t,e=!1,r={};try{(t=W(Object.getOwnPropertyDescriptor(Object.prototype,"__proto__").set))(r,[]),e=r instanceof Array}catch(t){}return function(r,n){return At(r),function(t){if("object"==typeof t||st(t))return t;throw Fr("Can't set "+Ir(t)+" as a prototype")}(n),e?t(r,n):r.__proto__=n,r}}():void 0),Wr=ar.PROPER,Gr=ar.CONFIGURABLE,Xr=kr.IteratorPrototype,Vr=kr.BUGGY_SAFARI_ITERATORS,Br=Tt("iterator"),qr="keys",Yr="values",Ur="entries",Hr=function(){return this},Kr=function(t,e,r,n,o,i,a){!function(t,e,r,n){var o=e+" Iterator";t.prototype=je(_r,{next:Fe(+!n,r)}),Mr(t,o,!1),Ce[o]=Dr}(r,e,n);var u,c,f,s=function(t){if(t===o&&p)return p;if(!Vr&&t in d)return d[t];switch(t){case qr:case Yr:case Ur:return function(){return new r(this,t)}}return function(){return new r(this)}},l=e+" Iterator",v=!1,d=t.prototype,h=d[Br]||d["@@iterator"]||o&&d[o],p=!Vr&&h||s(o),y="Array"==e&&d.entries||h;if(y&&(u=Pr(y.call(new t)))!==Object.prototype&&u.next&&(Pr(u)!==Xr&&(Nr?Nr(u,Xr):st(u[Br])||ur(u,Br,Hr)),Mr(u,l,!0)),Wr&&o==Yr&&h&&h.name!==Yr&&(Gr?Ne(d,"name",Yr):(v=!0,p=function(){return Dt(h,this)})),o)if(c={values:s(Yr),keys:i?p:s(qr),entries:s(Ur)},a)for(f in c)(Vr||v||!(f in d))&&ur(d,f,c[f]);else Or({target:e,proto:!0,forced:Vr||v},c);return d[Br]!==p&&ur(d,Br,p,{name:o}),Ce[e]=p,c},Jr="Array Iterator",$r=$e.set,Qr=$e.getterFor(Jr),Zr=Kr(Array,"Array",(function(t,e){$r(this,{type:Jr,target:J(t),index:0,kind:e})}),(function(){var t=Qr(this),e=t.target,r=t.kind,n=t.index++;return!e||n>=e.length?(t.target=void 0,{value:void 0,done:!0}):"keys"==r?{value:n,done:!1}:"values"==r?{value:e[n],done:!1}:{value:[n,e[n]],done:!1}}),"values");Ce.Arguments=Ce.Array,Ae("keys"),Ae("values"),Ae("entries");var tn={};tn[Tt("toStringTag")]="z";var en="[object z]"===String(tn),rn=Tt("toStringTag"),nn=_.Object,on="Arguments"==B(function(){return arguments}()),an=en?B:function(t){var e,r,n;return void 0===t?"Undefined":null===t?"Null":"string"==typeof(r=function(t,e){try{return t[e]}catch(t){}}(e=nn(t),rn))?r:on?B(e):"Object"==(n=B(e))&&st(e.callee)?"Arguments":n},un=en?{}.toString:function(){return"[object "+an(this)+"]"};en||ur(Object.prototype,"toString",un,{unsafe:!0});var cn=_.String,fn=function(t){if("Symbol"===an(t))throw TypeError("Cannot convert a Symbol value to a string");return cn(t)},sn=ar.PROPER,ln="toString",vn=RegExp.prototype,dn=vn[ln],hn=W((function(){var t=At(this),e="";return t.global&&(e+="g"),t.ignoreCase&&(e+="i"),t.multiline&&(e+="m"),t.dotAll&&(e+="s"),t.unicode&&(e+="u"),t.sticky&&(e+="y"),e})),pn=G((function(){return"/a/b"!=dn.call({source:"a",flags:"b"})})),yn=sn&&dn.name!=ln;(pn||yn)&&ur(RegExp.prototype,ln,(function(){var t=At(this),e=fn(t.source),r=t.flags;return"/"+e+"/"+fn(void 0===r&&It(vn,t)&&!("flags"in vn)?hn(t):r)}),{unsafe:!0});var gn=function(t,e,r){var n=Kt(e);n in t?Qt.f(t,n,Fe(0,r)):t[n]=r},bn=_.Array,mn=Math.max,wn=fr.f,xn="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[],On=function(t){try{return wn(t)}catch(t){return function(t,e,r){for(var n=ae(t),o=oe(e,n),i=oe(void 0===r?n:r,n),a=bn(mn(i-o,0)),u=0;o<i;o++,u++)gn(a,u,t[o]);return a.length=u,a}(xn)}},Sn={f:function(t){return xn&&"Window"==B(t)?On(t):wn(J(t))}},En=G((function(){if("function"==typeof ArrayBuffer){var t=new ArrayBuffer(8);Object.isExtensible(t)&&Object.defineProperty(t,"a",{value:8})}})),Tn=Object.isExtensible,jn=G((function(){Tn(1)}))||En?function(t){return!!jt(t)&&((!En||"ArrayBuffer"!=B(t))&&(!Tn||Tn(t)))}:Tn,Pn=!G((function(){return Object.isExtensible(Object.preventExtensions({}))})),Rn=h((function(t){var e=Qt.f,r=!1,n=ft("meta"),o=0,i=function(t){e(t,n,{value:{objectID:"O"+o++,weakData:{}}})},a=t.exports={enable:function(){a.enable=function(){},r=!0;var t=fr.f,e=W([].splice),o={};o[n]=1,t(o).length&&(fr.f=function(r){for(var o=t(r),i=0,a=o.length;i<a;i++)if(o[i]===n){e(o,i,1);break}return o},Or({target:"Object",stat:!0,forced:!0},{getOwnPropertyNames:Sn.f}))},fastKey:function(t,e){if(!jt(t))return"symbol"==typeof t?t:("string"==typeof t?"S":"P")+t;if(!it(t,n)){if(!jn(t))return"F";if(!e)return"E";i(t)}return t[n].objectID},getWeakData:function(t,e){if(!it(t,n)){if(!jn(t))return!0;if(!e)return!1;i(t)}return t[n].weakData},onFreeze:function(t){return Pn&&r&&jn(t)&&!it(t,n)&&i(t),t}};fe[n]=!0})),An=W(W.bind),Cn=function(t,e){return Vt(t),void 0===e?t:An?An(t,e):function(){return t.apply(e,arguments)}},kn=Tt("iterator"),Ln=Array.prototype,zn=Tt("iterator"),Mn=function(t){if(null!=t)return Bt(t,zn)||Bt(t,"@@iterator")||Ce[an(t)]},_n=_.TypeError,Dn=function(t,e,r){var n,o;At(t);try{if(!(n=Bt(t,"return"))){if("throw"===e)throw r;return r}n=Dt(n,t)}catch(t){o=!0,n=t}if("throw"===e)throw r;if(o)throw n;return At(n),r},In=_.TypeError,Fn=function(t,e){this.stopped=t,this.result=e},Nn=Fn.prototype,Wn=function(t,e,r){var n,o,i,a,u,c,f,s,l=r&&r.that,v=!(!r||!r.AS_ENTRIES),d=!(!r||!r.IS_ITERATOR),h=!(!r||!r.INTERRUPTED),p=Cn(e,l),y=function(t){return n&&Dn(n,"normal",t),new Fn(!0,t)},g=function(t){return v?(At(t),h?p(t[0],t[1],y):p(t[0],t[1])):h?p(t,y):p(t)};if(d)n=t;else{if(!(o=Mn(t)))throw In(Gt(t)+" is not iterable");if(void 0!==(s=o)&&(Ce.Array===s||Ln[kn]===s)){for(i=0,a=ae(t);a>i;i++)if((u=g(t[i]))&&It(Nn,u))return u;return new Fn(!1)}n=function(t,e){var r=arguments.length<2?Mn(t):e;if(Vt(r))return At(Dt(r,t));throw _n(Gt(t)+" is not iterable")}(t,o)}for(c=n.next;!(f=Dt(c,n)).done;){try{u=g(f.value)}catch(t){Dn(n,"throw",t)}if("object"==typeof u&&u&&It(Nn,u))return u}return new Fn(!1)},Gn=_.TypeError,Xn=function(t,e){if(It(e,t))return t;throw Gn("Incorrect invocation")},Vn=Tt("iterator"),Bn=!1;try{var qn=0,Yn={next:function(){return{done:!!qn++}},return:function(){Bn=!0}};Yn[Vn]=function(){return this},Array.from(Yn,(function(){throw 2}))}catch(t){}var Un=function(t,e,r){var n=-1!==t.indexOf("Map"),o=-1!==t.indexOf("Weak"),i=n?"set":"add",a=_[t],u=a&&a.prototype,c=a,f={},s=function(t){var e=W(u[t]);ur(u,t,"add"==t?function(t){return e(this,0===t?0:t),this}:"delete"==t?function(t){return!(o&&!jt(t))&&e(this,0===t?0:t)}:"get"==t?function(t){return o&&!jt(t)?void 0:e(this,0===t?0:t)}:"has"==t?function(t){return!(o&&!jt(t))&&e(this,0===t?0:t)}:function(t,r){return e(this,0===t?0:t,r),this})};if(wr(t,!st(a)||!(o||u.forEach&&!G((function(){(new a).entries().next()})))))c=r.getConstructor(e,t,n,i),Rn.enable();else if(wr(t,!0)){var l=new c,v=l[i](o?{}:-0,1)!=l,d=G((function(){l.has(1)})),h=function(t,e){if(!e&&!Bn)return!1;var r=!1;try{var n={};n[Vn]=function(){return{next:function(){return{done:r=!0}}}},t(n)}catch(t){}return r}((function(t){new a(t)})),p=!o&&G((function(){for(var t=new a,e=5;e--;)t[i](e,e);return!t.has(-0)}));h||((c=e((function(t,e){Xn(t,u);var r=function(t,e,r){var n,o;return Nr&&st(n=e.constructor)&&n!==r&&jt(o=n.prototype)&&o!==r.prototype&&Nr(t,o),t}(new a,t,c);return null!=e&&Wn(e,r[i],{that:r,AS_ENTRIES:n}),r}))).prototype=u,u.constructor=c),(d||p)&&(s("delete"),s("has"),n&&s("get")),(p||v)&&s(i),o&&u.clear&&delete u.clear}return f[t]=c,Or({global:!0,forced:c!=a},f),Mr(c,t),o||r.setStrong(c,t,n),c},Hn=function(t,e,r){for(var n in e)ur(t,n,e[n],r);return t},Kn=Tt("species"),Jn=Qt.f,$n=Rn.fastKey,Qn=$e.set,Zn=$e.getterFor,to={getConstructor:function(t,e,r,n){var o=t((function(t,o){Xn(t,i),Qn(t,{type:e,index:je(null),first:void 0,last:void 0,size:0}),Ct||(t.size=0),null!=o&&Wn(o,t[n],{that:t,AS_ENTRIES:r})})),i=o.prototype,a=Zn(e),u=function(t,e,r){var n,o,i=a(t),u=c(t,e);return u?u.value=r:(i.last=u={index:o=$n(e,!0),key:e,value:r,previous:n=i.last,next:void 0,removed:!1},i.first||(i.first=u),n&&(n.next=u),Ct?i.size++:t.size++,"F"!==o&&(i.index[o]=u)),t},c=function(t,e){var r,n=a(t),o=$n(e);if("F"!==o)return n.index[o];for(r=n.first;r;r=r.next)if(r.key==e)return r};return Hn(i,{clear:function(){for(var t=a(this),e=t.index,r=t.first;r;)r.removed=!0,r.previous&&(r.previous=r.previous.next=void 0),delete e[r.index],r=r.next;t.first=t.last=void 0,Ct?t.size=0:this.size=0},delete:function(t){var e=this,r=a(e),n=c(e,t);if(n){var o=n.next,i=n.previous;delete r.index[n.index],n.removed=!0,i&&(i.next=o),o&&(o.previous=i),r.first==n&&(r.first=o),r.last==n&&(r.last=i),Ct?r.size--:e.size--}return!!n},forEach:function(t){for(var e,r=a(this),n=Cn(t,arguments.length>1?arguments[1]:void 0);e=e?e.next:r.first;)for(n(e.value,e.key,this);e&&e.removed;)e=e.previous},has:function(t){return!!c(this,t)}}),Hn(i,r?{get:function(t){var e=c(this,t);return e&&e.value},set:function(t,e){return u(this,0===t?0:t,e)}}:{add:function(t){return u(this,t=0===t?0:t,t)}}),Ct&&Jn(i,"size",{get:function(){return a(this).size}}),o},setStrong:function(t,e,r){var n=e+" Iterator",o=Zn(e),i=Zn(n);Kr(t,e,(function(t,e){Qn(this,{type:n,target:t,state:o(t),kind:e,last:void 0})}),(function(){for(var t=i(this),e=t.kind,r=t.last;r&&r.removed;)r=r.previous;return t.target&&(t.last=r=r?r.next:t.state.first)?"keys"==e?{value:r.key,done:!1}:"values"==e?{value:r.value,done:!1}:{value:[r.key,r.value],done:!1}:(t.target=void 0,{value:void 0,done:!0})}),r?"entries":"values",!r,!0),function(t){var e=lt(t),r=Qt.f;Ct&&e&&!e[Kn]&&r(e,Kn,{configurable:!0,get:function(){return this}})}(e)}};Un("Set",(function(t){return function(){return t(this,arguments.length?arguments[0]:void 0)}}),to);var eo=W("".charAt),ro=W("".charCodeAt),no=W("".slice),oo=function(t){return function(e,r){var n,o,i=fn(K(e)),a=ee(r),u=i.length;return a<0||a>=u?t?"":void 0:(n=ro(i,a))<55296||n>56319||a+1===u||(o=ro(i,a+1))<56320||o>57343?t?eo(i,a):n:t?no(i,a,a+2):o-56320+(n-55296<<10)+65536}},io={codeAt:oo(!1),charAt:oo(!0)}.charAt,ao="String Iterator",uo=$e.set,co=$e.getterFor(ao);Kr(String,"String",(function(t){uo(this,{type:ao,string:fn(t),index:0})}),(function(){var t,e=co(this),r=e.string,n=e.index;return n>=r.length?{value:void 0,done:!0}:(t=io(r,n),e.index+=t.length,{value:t,done:!1})}));var fo=Array.isArray||function(t){return"Array"==B(t)},so=function(){},lo=[],vo=lt("Reflect","construct"),ho=/^\s*(?:class|function)\b/,po=W(ho.exec),yo=!ho.exec(so),go=function(t){if(!st(t))return!1;try{return vo(so,lo,t),!0}catch(t){return!1}},bo=!vo||G((function(){var t;return go(go.call)||!go(Object)||!go((function(){t=!0}))||t}))?function(t){if(!st(t))return!1;switch(an(t)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}return yo||!!po(ho,_e(t))}:go,mo=Tt("species"),wo=_.Array,xo=function(t,e){return new(function(t){var e;return fo(t)&&(e=t.constructor,(bo(e)&&(e===wo||fo(e.prototype))||jt(e)&&null===(e=e[mo]))&&(e=void 0)),void 0===e?wo:e}(t))(0===e?0:e)},Oo=W([].push),So=function(t){var e=1==t,r=2==t,n=3==t,o=4==t,i=6==t,a=7==t,u=5==t||i;return function(c,f,s,l){for(var v,d,h=nt(c),p=U(h),y=Cn(f,s),g=ae(p),b=0,m=l||xo,w=e?m(c,g):r||a?m(c,0):void 0;g>b;b++)if((u||b in p)&&(d=y(v=p[b],b,h),t))if(e)w[b]=d;else if(d)switch(t){case 3:return!0;case 5:return v;case 6:return b;case 2:Oo(w,v)}else switch(t){case 4:return!1;case 7:Oo(w,v)}return i?-1:n||o?o:w}},Eo={forEach:So(0),map:So(1),filter:So(2),some:So(3),every:So(4),find:So(5),findIndex:So(6),filterReject:So(7)},To=Rn.getWeakData,jo=$e.set,Po=$e.getterFor,Ro=Eo.find,Ao=Eo.findIndex,Co=W([].splice),ko=0,Lo=function(t){return t.frozen||(t.frozen=new zo)},zo=function(){this.entries=[]},Mo=function(t,e){return Ro(t.entries,(function(t){return t[0]===e}))};zo.prototype={get:function(t){var e=Mo(this,t);if(e)return e[1]},has:function(t){return!!Mo(this,t)},set:function(t,e){var r=Mo(this,t);r?r[1]=e:this.entries.push([t,e])},delete:function(t){var e=Ao(this.entries,(function(e){return e[0]===t}));return~e&&Co(this.entries,e,1),!!~e}};var _o,Do={getConstructor:function(t,e,r,n){var o=t((function(t,o){Xn(t,i),jo(t,{type:e,id:ko++,frozen:void 0}),null!=o&&Wn(o,t[n],{that:t,AS_ENTRIES:r})})),i=o.prototype,a=Po(e),u=function(t,e,r){var n=a(t),o=To(At(e),!0);return!0===o?Lo(n).set(e,r):o[n.id]=r,t};return Hn(i,{delete:function(t){var e=a(this);if(!jt(t))return!1;var r=To(t);return!0===r?Lo(e).delete(t):r&&it(r,e.id)&&delete r[e.id]},has:function(t){var e=a(this);if(!jt(t))return!1;var r=To(t);return!0===r?Lo(e).has(t):r&&it(r,e.id)}}),Hn(i,r?{get:function(t){var e=a(this);if(jt(t)){var r=To(t);return!0===r?Lo(e).get(t):r?r[e.id]:void 0}},set:function(t,e){return u(this,t,e)}}:{add:function(t){return u(this,t,!0)}}),o}},Io=$e.enforce,Fo=!_.ActiveXObject&&"ActiveXObject"in _,No=function(t){return function(){return t(this,arguments.length?arguments[0]:void 0)}},Wo=Un("WeakMap",No,Do);if(Ie&&Fo){_o=Do.getConstructor(No,"WeakMap",!0),Rn.enable();var Go=Wo.prototype,Xo=W(Go.delete),Vo=W(Go.has),Bo=W(Go.get),qo=W(Go.set);Hn(Go,{delete:function(t){if(jt(t)&&!jn(t)){var e=Io(this);return e.frozen||(e.frozen=new _o),Xo(this,t)||e.frozen.delete(t)}return Xo(this,t)},has:function(t){if(jt(t)&&!jn(t)){var e=Io(this);return e.frozen||(e.frozen=new _o),Vo(this,t)||e.frozen.has(t)}return Vo(this,t)},get:function(t){if(jt(t)&&!jn(t)){var e=Io(this);return e.frozen||(e.frozen=new _o),Vo(this,t)?Bo(this,t):e.frozen.get(t)}return Bo(this,t)},set:function(t,e){if(jt(t)&&!jn(t)){var r=Io(this);r.frozen||(r.frozen=new _o),Vo(this,t)?qo(this,t,e):r.frozen.set(t,e)}else qo(this,t,e);return this}})}var Yo,Uo,Ho={CSSRuleList:0,CSSStyleDeclaration:0,CSSValueList:0,ClientRectList:0,DOMRectList:0,DOMStringList:0,DOMTokenList:1,DataTransferItemList:0,FileList:0,HTMLAllCollection:0,HTMLCollection:0,HTMLFormElement:0,HTMLSelectElement:0,MediaList:0,MimeTypeArray:0,NamedNodeMap:0,NodeList:1,PaintRequestList:0,Plugin:0,PluginArray:0,SVGLengthList:0,SVGNumberList:0,SVGPathSegList:0,SVGPointList:0,SVGStringList:0,SVGTransformList:0,SourceBufferList:0,StyleSheetList:0,TextTrackCueList:0,TextTrackList:0,TouchList:0},Ko=zt("span").classList,Jo=Ko&&Ko.constructor&&Ko.constructor.prototype,$o=Jo===Object.prototype?void 0:Jo,Qo=Eo.forEach,Zo=!!(Uo=[]["forEach"])&&G((function(){Uo.call(null,Yo||function(){throw 1},1)}))?[].forEach:function(t){return Qo(this,t,arguments.length>1?arguments[1]:void 0)},ti=function(t){if(t&&t.forEach!==Zo)try{Ne(t,"forEach",Zo)}catch(e){t.forEach=Zo}};for(var ei in Ho)Ho[ei]&&ti(_[ei]&&_[ei].prototype);ti($o);var ri=Tt("iterator"),ni=Tt("toStringTag"),oi=Zr.values,ii=function(t,e){if(t){if(t[ri]!==oi)try{Ne(t,ri,oi)}catch(e){t[ri]=oi}if(t[ni]||Ne(t,ni,e),Ho[e])for(var r in Zr)if(t[r]!==Zr[r])try{Ne(t,r,Zr[r])}catch(e){t[r]=Zr[r]}}};for(var ai in Ho)ii(_[ai]&&_[ai].prototype,ai);ii($o,"DOMTokenList");var ui=function(){return ui=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var o in e=arguments[r])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},ui.apply(this,arguments)};function ci(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function fi(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,o,i=r.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(n=i.next()).done;)a.push(n.value)}catch(t){o={error:t}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return a}function si(t,e,r){if(r||2===arguments.length)for(var n,o=0,i=e.length;o<i;o++)!n&&o in e||(n||(n=Array.prototype.slice.call(e,0,o)),n[o]=e[o]);return t.concat(n||Array.prototype.slice.call(e))}function li(t){return"[object Object]"===Object.prototype.toString.call(t)}function vi(t){if(!li(t))return!1;var e=t.constructor;if(void 0===e)return!0;var r=e.prototype;return!1!==li(r)&&!Object.prototype.hasOwnProperty.call(r,"isPrototypeOfOf")}function di(t,e){for(var r in t){var n=t[r],o=e[r];if(vi(n)&&vi(o)){if(!di(n,o))return!1}else if(Array.isArray(n)&&Array.isArray(o)){if(n.length!==o.length)return!1;for(var i=0;i<n.length;i++)if(n[i]!==o[i])return!1}else if(n!==o)return!1}for(var r in e)if(void 0===t[r]&&void 0!==e[r])return!1;return!0}function hi(t){return function(t){var e,r,n,o,i=[];try{for(var a=ci(t),u=a.next();!u.done;u=a.next()){var c=u.value;if("string"!=typeof c.insert||0!==c.insert.length){var f=i[i.length-1];f&&"string"==typeof f.insert&&"string"==typeof c.insert&&(f.attributes===c.attributes||!f.attributes==!c.attributes&&di(null!==(n=f.attributes)&&void 0!==n?n:{},null!==(o=c.attributes)&&void 0!==o?o:{}))?f.insert+=c.insert:i.push(c)}}}catch(t){e={error:t}}finally{try{u&&!u.done&&(r=a.return)&&r.call(a)}finally{if(e)throw e.error}}return i}(t.toDelta())}function pi(t){var e=t.insert;return"string"==typeof e?e.length:1}function yi(t){return t.reduce((function(t,e){return t+pi(e)}),0)}function gi(t,e,r){if(r<1)return[];for(var n=0,o=[],i=e+r,a=0;a<t.length&&!(n>=i);a++){var u=t[a],c=pi(u);if(n+c<=e)n+=c;else if("string"==typeof u.insert){var f=Math.max(0,e-n),s=Math.min(c,c-(n+c-i));o.push(ui(ui({},u),{insert:u.insert.slice(f,s)})),n+=c}else n+=c,o.push(u)}return o}function bi(t){return function(t){for(var e=[],r=1;r<arguments.length;r++)e[r-1]=arguments[r];return Object.fromEntries(Object.entries(t).filter((function(t){var r=fi(t,1)[0];return!e.includes(r)})))}(t,r.Text.isText(t)?"text":"children")}function mi(t){var e=t.children,n=function(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(t);o<n.length;o++)e.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(t,n[o])&&(r[n[o]]=t[n[o]])}return r}(t,["children"]),o=new c.XmlText;return Object.entries(n).forEach((function(t){var e=fi(t,2),r=e[0],n=e[1];o.setAttribute(r,n)})),o.applyDelta(e.map((function(t){return r.Text.isText(t)?{insert:t.text,attributes:bi(t)}:{insert:mi(t)}})),{sanitize:!1}),o}function wi(t){return t?r.Text.isText(t)?t.text.length:1:0}function xi(t,e,n){var o;if(0===n.length)throw new Error("Path has to a have a length >= 1");if(r.Text.isText(e))throw new Error("Cannot descent into slate text");var i=fi(n),a=i[0],u=i.slice(1),f=function(t,e){return t.children.slice(0,e).reduce((function(t,e){return t+wi(e)}),0)}(e,a),s=e.children[a],l=hi(t),v=wi(s),d=gi(l,f,v);if(d.length>1)throw new Error("Path doesn't match yText, yTarget spans multiple nodes");var h=null===(o=d[0])||void 0===o?void 0:o.insert;if(u.length>0){if(!(h instanceof c.XmlText))throw new Error("Path doesn't match yText, cannot descent into non-yText");return xi(h,s,u)}return{yParent:t,textRange:{start:f,end:f+v},yTarget:h instanceof c.XmlText?h:void 0,slateParent:e,slateTarget:s,targetDelta:d}}function Oi(t,e,n){void 0===n&&(n={});for(var o=n.assoc,i=void 0===o?0:o,a=n.insert,u=void 0!==a&&a,c=0,f=0,s=0;s<t.children.length;s++){var l=t.children[s],v=r.Text.isText(l)?l.text.length:1;v>0&&(f=s);var d=c+v;if(v>0&&(i>=0?d>e:d>=e))return[s,e-c];c+=v}if(e>c+(u?1:0))throw new Error("yOffset out of bounds");if(u)return[t.children.length,0];var h=t.children[f];return[f,r.Text.isText(h)?h.text.length:1]}function Si(t){return t.map((function(t){return"string"==typeof t.insert?t:ui(ui({},t),{insert:Ei(t.insert)})}))}function Ei(t){var e=new c.XmlText,r=t.getAttributes();return Object.entries(r).forEach((function(t){var r=fi(t,2),n=r[0],o=r[1];e.setAttribute(n,o)})),e.applyDelta(Si(hi(t)),{sanitize:!1}),e}function Ti(t){if(!t.doc)throw new Error("shared type isn't attached to a document")}"function"==typeof SuppressedError&&SuppressedError;var ji="__slateYjsStoredPosition_";function Pi(t,e,n){var o=n.type,i=n.index,a=n.assoc;if(!(o instanceof c.XmlText))throw new Error("Absolute position points to a non-XMLText");var u=function(t,e,n){for(var o=[n];o[0]!==t;){var i=o[0].parent;if(!i)throw new Error("yText isn't a descendant of root element");if(!(i instanceof c.XmlText))throw new Error("Unexpected y parent type");o.unshift(i)}if(o.length<2)return[];var a=e;return o.reduce((function(t,e,n){var i,u,c=o[n+1];if(!c)return t;var f=0,s=hi(e);try{for(var l=ci(s),v=l.next();!v.done;v=l.next()){var d=v.value;if(d.insert===c)break;f+="string"==typeof d.insert?d.insert.length:1}}catch(t){i={error:t}}finally{try{v&&!v.done&&(u=l.return)&&u.call(l)}finally{if(i)throw i.error}}if(r.Text.isText(a))throw new Error("Cannot descent into slate text");var h=fi(Oi(a,f),1)[0];return a=a.children[h],t.concat(h)}),[])}(t,e,o),f=r.Node.get(e,u);if(r.Text.isText(f))throw new Error("Absolute position doesn't match slateRoot, cannot descent into text");var s=fi(Oi(f,i,{assoc:a}),2),l=s[0],v=s[1],d=f.children[l];return r.Text.isText(d)?{path:si(si([],fi(u)),[l]),offset:v}:null}function Ri(t,e,r){if(!t.doc)throw new Error("sharedRoot isn't attach to a yDoc");var n=c.createAbsolutePositionFromRelativePosition(r,t.doc);return n&&Pi(t,e,n)}function Ai(t,e,r){t.setAttribute(ji+e,c.encodeRelativePosition(r))}function Ci(t,e,r){return Object.fromEntries(Object.entries(t).filter((function(t){var n=fi(t,2)[1];return n.type===e&&(!r||(n.assoc>=0?n.index>=r.start&&n.index<r.end:n.index>r.start&&n.index>=r.end))})))}function ki(t,e,r){var n;void 0===r&&(r="");var o=((n={})[r]=Ci(t,e),n);return hi(e).forEach((function(e,n){var i=e.insert;i instanceof c.XmlText&&Object.assign(o,ki(t,i,r?r+"."+n:n.toString()))})),o}function Li(t,e,r,n){void 0===n&&(n=0);var o=function(t){return Ti(t),Object.fromEntries(Object.entries(t.getAttributes()).filter((function(t){return fi(t,1)[0].startsWith(ji)})).map((function(e){var r=fi(e,2),n=r[0],o=r[1];return[n.slice(ji.length),c.createAbsolutePositionFromRelativePosition(c.decodeRelativePosition(o),t.doc)]})).filter((function(t){return fi(t,2)[1]})))}(t),i={"":Ci(o,e,{start:n,end:n+yi(r)})};return r.forEach((function(t,e){var r=t.insert;r instanceof c.XmlText&&Object.assign(i,ki(o,r,e.toString()))})),i}function zi(t,e,r,n,o,i,a){void 0===o&&(o=0),void 0===i&&(i=0),void 0===a&&(a="");var u=r[a];u&&Object.entries(u).forEach((function(r){var n=fi(r,2),a=n[0],u=n[1];Ai(t,a,c.createRelativePositionFromTypeIndex(e,u.index-i+o,u.assoc))})),n.forEach((function(e,n){var o=e.insert;o instanceof c.XmlText&&zi(t,o,r,hi(o),0,0,a?a+"."+n:n.toString())}))}var Mi={insert_node:function(t,e,n){var o=xi(t,e,n.path),i=o.yParent,a=o.textRange;if(r.Text.isText(n.node))return i.insert(a.start,n.node.text,bi(n.node));i.insertEmbed(a.start,mi(n.node))},remove_node:function(t,e,r){var n=xi(t,e,r.path),o=n.yParent,i=n.textRange;o.delete(i.start,i.end-i.start)},set_node:function(t,e,r){var n=xi(t,e,r.path),o=n.yTarget,i=n.textRange,a=n.yParent;if(o)return Object.entries(r.newProperties).forEach((function(t){var e=fi(t,2),r=e[0],n=e[1];if(null===n)return o.removeAttribute(r);o.setAttribute(r,n)})),Object.entries(r.properties).forEach((function(t){var e=fi(t,1)[0];Object.prototype.hasOwnProperty.call(r.newProperties,e)||o.removeAttribute(e)}));var u=Object.fromEntries(Object.keys(r.properties).map((function(t){return[t,null]}))),c=ui(ui({},u),r.newProperties);a.format(i.start,i.end-i.start,c)},merge_node:function(t,e,n){var o=xi(t,e,n.path),i=xi(o.yParent,o.slateParent,r.Path.previous(n.path.slice(-1)));if(!o.yTarget!=!i.yTarget)throw new Error("Cannot merge y text with y element");if(!i.yTarget||!o.yTarget){var a=o.yParent,u=o.textRange,c=o.slateTarget;if(!c)throw new Error("Expected Slate target node for merge op.");var f=r.Node.get(e,r.Path.previous(n.path));if(!r.Text.isText(f))throw new Error("Path points to Y.Text but not a Slate text node.");var s=bi(c),l=bi(f),v=Object.keys(s).reduce((function(t,e){var r;return e in l?t:ui(ui({},t),((r={})[e]=null,r))}),{});return a.format(u.start,u.end-u.start,ui(ui({},v),l))}var d=i.yTarget.length,h=hi(o.yTarget),p=Si(h),y=Li(t,o.yTarget,h,d),g=si([{retain:d}],fi(p));i.yTarget.applyDelta(g,{sanitize:!1}),o.yParent.delete(o.textRange.start,o.textRange.end-o.textRange.start),zi(t,i.yTarget,y,p,d)},move_node:function(t,e,n){var o=r.Path.parent(n.newPath),i=n.newPath[n.newPath.length-1],a=r.Node.get(e,o);if(r.Text.isText(a))throw new Error("Cannot move slate node into text element");var u=si(si([],fi(o)),[Math.min(i,a.children.length)]),c=xi(t,e,n.path),f=xi(t,e,u),s=Si(c.targetDelta),l=Li(t,c.yParent,c.targetDelta);c.yParent.delete(c.textRange.start,c.textRange.end-c.textRange.start);var v=yi(hi(f.yParent)),d=Math.min(f.textRange.start,v),h=si([{retain:d}],fi(s));f.yParent.applyDelta(h,{sanitize:!1}),zi(t,f.yParent,l,s,d,c.textRange.start)},split_node:function(t,e,n){var o=xi(t,e,n.path);if(!o.slateTarget)throw new Error("Y target without corresponding slate node");if(!o.yTarget){if(!r.Text.isText(o.slateTarget))throw new Error("Mismatch node type between y target and slate node");var i={};return o.targetDelta.forEach((function(t){t.attributes&&Object.keys(t.attributes).forEach((function(t){i[t]=null}))})),o.yParent.format(o.textRange.start,o.textRange.end-o.textRange.start,ui(ui({},i),n.properties))}if(r.Text.isText(o.slateTarget))throw new Error("Mismatch node type between y target and slate node");var a=xi(o.yTarget,o.slateTarget,[n.position]),u=o.slateTarget.children.slice(0,n.position).reduce((function(t,e){return t+wi(e)}),0),f=o.slateTarget.children.reduce((function(t,e){return t+wi(e)}),0),s=gi(hi(o.yTarget),u,f-u),l=Si(s),v=Li(t,o.yTarget,s,u),d=new c.XmlText;d.applyDelta(l,{sanitize:!1}),Object.entries(n.properties).forEach((function(t){var e=fi(t,2),r=e[0],n=e[1];d.setAttribute(r,n)})),o.yTarget.delete(a.textRange.start,o.yTarget.length-a.textRange.start),o.yParent.insertEmbed(o.textRange.end,d),zi(t,d,v,l,0,u)}};ui(ui(ui({},{insert_text:function(t,e,n){var o=xi(t,e,n.path),i=o.yParent,a=o.textRange,u=r.Node.get(e,n.path);if(!r.Text.isText(u))throw new Error("Cannot insert text into non-text node");i.insert(a.start+n.offset,n.text,bi(u))},remove_text:function(t,e,r){var n=xi(t,e,r.path),o=n.yParent,i=n.textRange;o.delete(i.start+r.offset,r.text.length)}}),Mi),{set_selection:function(){}});var _i=new WeakMap,Di=new WeakMap,Ii=new WeakSet,Fi={isYjsEditor:function(t){return r.Editor.isEditor(t)&&t.sharedRoot instanceof c.XmlText&&"localOrigin"in t&&"positionStorageOrigin"in t&&"function"==typeof t.applyRemoteEvents&&"function"==typeof t.storeLocalChange&&"function"==typeof t.flushLocalChanges&&"function"==typeof t.isLocalOrigin&&"function"==typeof t.connect&&"function"==typeof t.disconnect},localChanges:function(t){var e;return null!==(e=Di.get(t))&&void 0!==e?e:[]},applyRemoteEvents:function(t,e,r){t.applyRemoteEvents(e,r)},storeLocalChange:function(t,e){t.storeLocalChange(e)},flushLocalChanges:function(t){t.flushLocalChanges()},connected:function(t){return Ii.has(t)},connect:function(t){t.connect()},disconnect:function(t){t.disconnect()},isLocal:function(t){return t.isLocalOrigin(Fi.origin(t))},origin:function(t){var e=_i.get(t);return void 0!==e?e:t.localOrigin},withOrigin:function(t,e,r){var n=Fi.origin(t);_i.set(t,e),r(),_i.set(t,n)},storePosition:function(t,e,r){var n=t.sharedRoot,o=t.positionStorageOrigin;Ti(n);var i=function(t,e,r){var n=xi(t,e,r.path),o=n.yTarget,i=n.yParent,a=n.textRange;if(o)throw new Error("Slate point points to a non-text element inside sharedRoot");var u=a.start+r.offset;return c.createRelativePositionFromTypeIndex(i,u,u===a.end?-1:0)}(n,t,r);n.doc.transact((function(){Ai(n,e,i)}),o)},removeStoredPosition:function(t,e){var r=t.sharedRoot,n=t.positionStorageOrigin;Ti(r),r.doc.transact((function(){!function(t,e){t.removeAttribute(ji+e)}(r,e)}),n)},position:function(t,e){var r=function(t,e){var r=t.getAttribute(ji+e);return r?c.decodeRelativePosition(r):null}(t.sharedRoot,e);if(r)return Ri(t.sharedRoot,t,r)},storedPositionsRelative:function(t){return e=t.sharedRoot,Object.fromEntries(Object.entries(e.getAttributes()).filter((function(t){return fi(t,1)[0].startsWith(ji)})).map((function(t){var e=fi(t,2),r=e[0],n=e[1];return[r.slice(ji.length),c.createRelativePositionFromJSON(n)]})));var e}},Ni=new WeakMap,Wi={isCursorEditor:function(t){return Fi.isYjsEditor(t)&&t.awareness&&"string"==typeof t.cursorDataField&&"string"==typeof t.selectionStateField&&"function"==typeof t.sendCursorPosition&&"function"==typeof t.sendCursorData},sendCursorPosition:function(t,e){void 0===e&&(e=t.selection),t.sendCursorPosition(e)},sendCursorData:function(t,e){t.sendCursorData(e)},on:function(t,e,r){var n;if("change"===e){var o=null!==(n=Ni.get(t))&&void 0!==n?n:new Set;o.add(r),Ni.set(t,o)}},off:function(t,e,r){if("change"===e){var n=Ni.get(t);n&&n.delete(r)}},cursorState:function(t,e){var r;if(e===t.awareness.clientID||!Fi.connected(t))return null;var n=t.awareness.getStates().get(e);return n?{relativeSelection:null!==(r=n[t.selectionStateField])&&void 0!==r?r:null,data:n[t.cursorDataField],clientId:e}:null},cursorStates:function(t){return Fi.connected(t)?Object.fromEntries(Array.from(t.awareness.getStates().entries(),(function(e){var r=fi(e,2),n=r[0],o=r[1];return n!==t.awareness.clientID&&o?[n,{relativeSelection:o[t.selectionStateField],data:o[t.cursorDataField]}]:null})).filter(Array.isArray)):{}}};function Gi(){var t=s();return Wi.isCursorEditor(t)||console.warn("Cannot use useSyncExternalStore outside the context of a RemoteCursorEditor"),t}var Xi=new WeakMap;function Vi(t){var e=Xi.get(t);if(e)return e;var r=function(t){var e={},r=new Set,n=r.add.bind(r),o=new Set,i=null;return[function(e){return o.add(e),i||(i=function(t){t.added.forEach(n),t.removed.forEach(n),t.updated.forEach(n),o.forEach((function(t){return t()}))},Wi.on(t,"change",i)),function(){o.delete(e),i&&0===o.size&&(Wi.off(t,"change",i),i=null)}},function(){return 0===r.size?e:(r.forEach((function(r){var n=Wi.cursorState(t,r);null!==n?e[r]=n:delete e[r.toString()]})),r.clear(),e=l({},e))}]}(t);return t&&Xi.set(t,r),r}function Bi(){return Vi(Gi())}function qi(){var t=v(Bi(),2),e=t[0],r=t[1];return S.useSyncExternalStore(e,r)}var Yi=new WeakMap;function Ui(t,e){if(!e.relativeSelection)return null;var r=Yi.get(t.children);r||(r=new WeakMap,Yi.set(t.children,r));var n=r.get(e);if(void 0===n)try{n=function(t,e,r){var n=Ri(t,e,r.anchor);if(!n)return null;var o=Ri(t,e,r.focus);return o?{anchor:n,focus:o}:null}(t.sharedRoot,t,e.relativeSelection),r.set(e,n)}catch(t){return null}return n}var Hi=Tt("species"),Ki=Eo.map,Ji=function(t){return bt>=51||!G((function(){var e=[];return(e.constructor={})[Hi]=function(){return{foo:1}},1!==e[t](Boolean).foo}))}("map");Or({target:"Array",proto:!0,forced:!Ji},{map:function(t){return Ki(this,t,arguments.length>1?arguments[1]:void 0)}});var $i=W(tr.f),Qi=W([].push),Zi=function(t){return function(e){for(var r,n=J(e),o=he(n),i=o.length,a=0,u=[];i>a;)r=o[a++],Ct&&!$i(n,r)||Qi(u,t?[r,n[r]]:n[r]);return u}},ta={entries:Zi(!0),values:Zi(!1)}.entries;Or({target:"Object",stat:!0},{entries:function(t){return ta(t)}});var ea=Rn.onFreeze,ra=Object.freeze,na=G((function(){ra(1)}));Or({target:"Object",stat:!0,forced:na,sham:!Pn},{freeze:function(t){return ra&&jt(t)?ra(ea(t)):t}}),Or({target:"Object",stat:!0},{fromEntries:function(t){var e={};return Wn(t,(function(t,r){gn(e,t,r)}),{AS_ENTRIES:!0}),e}});var oa=G((function(){he(1)}));function ia(t,e,n){var i,a,u=n.yOffset,c=n.xOffset,f=n.shouldGenerateOverlay,s=v(r.Range.edges(e),2),l=s[0],d=s[1],h=function(t,e){try{return o.DomEditor.toDOMRange(t,e)}catch(t){return null}}(t,e);if(!h)return{caretPosition:null,selectionRects:[]};var p=[],y=r.Editor.nodes(t,{at:e,match:function(t,e){return r.Text.isText(t)&&(!f||f(t,e))}}),g=null,b=r.Range.isBackward(e);try{for(var m=function(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}(y),w=m.next();!w.done;w=m.next()){var x=v(w.value,2),O=x[0],S=x[1],E=o.DomEditor.toDOMNode(t,O),T=r.Path.equals(S,l.path),j=r.Path.equals(S,d.path),P=null;if(T||j){var R=document.createRange();R.selectNode(E),T&&R.setStart(h.startContainer,h.startOffset),j&&R.setEnd(h.endContainer,h.endOffset),P=R.getClientRects()}else P=E.getClientRects();for(var A=b?T:j,C=0;C<P.length;C++){var k=P.item(C);if(k){var L=A&&(b?0===C:C===P.length-1),z=k.top-u,M=k.left-c;L&&(g={height:k.height,top:z,left:M+(b||r.Range.isCollapsed(e)?0:k.width)}),p.push({width:k.width,height:k.height,top:z,left:M})}}}}catch(t){i={error:t}}finally{try{w&&!w.done&&(a=m.return)&&a.call(m)}finally{if(i)throw i.error}}return{selectionRects:p,caretPosition:g}}Or({target:"Object",stat:!0,forced:oa},{keys:function(t){return he(nt(t))}});var aa=Object.freeze([]);t.EditorContext=f,t.getCursorRange=Ui,t.useEditorStatic=s,t.useRemoteCursorOverlayPositions=function(t){var r;void 0===t&&(t={});var n,o,i,a=t.containerRef,u=t.shouldGenerateOverlay,c=function(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(t);o<n.length;o++)e.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(t,n[o])&&(r[n[o]]=t[n[o]])}return r}(t,["containerRef","shouldGenerateOverlay"]),f=Gi(),s=qi(),d=(n=v(e.useReducer((function(t){return t+1}),0),2)[1],o=e.useRef(null),i=function(){o.current&&(cancelAnimationFrame(o.current),o.current=0)},e.useEffect(i),e.useEffect((function(){return i}),[]),e.useCallback((function(t){void 0===t&&(t=!1),t?n():o.current||(o.current=requestAnimationFrame(n))}),[])),h=e.useRef(new WeakMap),p=v(e.useState({}),2),y=p[0],g=p[1],b=!("refreshOnResize"in c)||(null===(r=c.refreshOnResize)||void 0===r||r);!function(t,r){var n=e.useRef(r);n.current=r;var o=v(e.useState((function(){return new ResizeObserver((function(){n.current()}))})),1)[0];e.useEffect((function(){if(null==t?void 0:t.current){var e=t.current;return o.observe(e),function(){return o.unobserve(e)}}}),[o,t])}(b?a:void 0,(function(){h.current=new WeakMap,d("debounced"!==b)})),e.useLayoutEffect((function(){var t,e,r;if(!a||a.current){var n=null===(t=null==a?void 0:a.current)||void 0===t?void 0:t.getBoundingClientRect(),o=null!==(e=null==n?void 0:n.x)&&void 0!==e?e:0,i=null!==(r=null==n?void 0:n.y)&&void 0!==r?r:0,c=Object.keys(y).length!==Object.keys(s).length,l=Object.fromEntries(Object.entries(s).map((function(t){var e=v(t,2),r=e[0],n=e[1],a=n.relativeSelection&&Ui(f,n);if(!a)return[r,aa];var s=h.current.get(a);if(s)return[r,s];var l=ia(f,a,{xOffset:o,yOffset:i,shouldGenerateOverlay:u});return c=!0,h.current.set(a,l),[r,l]})));c&&g(l)}}));var m=e.useMemo((function(){return Object.entries(s).map((function(t){var e,r,n=v(t,2),o=n[0],i=n[1],a=i.relativeSelection&&Ui(f,i),u=y[o];return l(l({},i),{range:a,caretPosition:null!==(e=null==u?void 0:u.caretPosition)&&void 0!==e?e:null,selectionRects:null!==(r=null==u?void 0:u.selectionRects)&&void 0!==r?r:aa})}))}),[s,f,y]);return[m,e.useCallback((function(){h.current=new WeakMap,d(!0)}),[d])]},t.useRemoteCursorStates=qi,t.useRemoteCursorStatesSelector=function(t,e){var r=v(Bi(),2),n=r[0],o=r[1];return z.useSyncExternalStoreWithSelector(n,o,null,t,e)},Object.defineProperty(t,"__esModule",{value:!0})}));
40
+ //# sourceMappingURL=index.js.map