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