@yoopta/lists 4.6.9-rc.1 → 4.6.10-rc.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.
package/dist/index.js CHANGED
@@ -5,4 +5,4 @@ import{useBlockData as e,findPluginBlockBySelectionPath as t,Elements as r,build
5
5
  * Copyright (c) 2014-2017, Jon Schlinkert.
6
6
  * Released under the MIT License.
7
7
  */
8
- function f(e){return"[object Object]"===Object.prototype.toString.call(e)}function d(e){var t,r;return!1!==f(e)&&(void 0===(t=e.constructor)||!1!==f(r=t.prototype)&&!1!==r.hasOwnProperty("isPrototypeOf"))}var u=Symbol.for("immer-nothing"),h=Symbol.for("immer-draftable"),y=Symbol.for("immer-state");function g(e,...t){throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var v=Object.getPrototypeOf;function m(e){return!!e&&!!e[y]}function b(e){return!!e&&(_(e)||Array.isArray(e)||!!e[h]||!!e.constructor?.[h]||j(e)||E(e))}var w=Object.prototype.constructor.toString();function _(e){if(!e||"object"!=typeof e)return!1;const t=v(e);if(null===t)return!0;const r=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;return r===Object||"function"==typeof r&&Function.toString.call(r)===w}function O(e,t){0===x(e)?Reflect.ownKeys(e).forEach((r=>{t(r,e[r],e)})):e.forEach(((r,n)=>t(n,r,e)))}function x(e){const t=e[y];return t?t.type_:Array.isArray(e)?1:j(e)?2:E(e)?3:0}function P(e,t){return 2===x(e)?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function k(e,t,r){const n=x(e);2===n?e.set(t,r):3===n?e.add(r):e[t]=r}function j(e){return e instanceof Map}function E(e){return e instanceof Set}function S(e){return e.copy_||e.base_}function N(e,t){if(j(e))return new Map(e);if(E(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);if(!t&&_(e)){if(!v(e)){const t=Object.create(null);return Object.assign(t,e)}return{...e}}const r=Object.getOwnPropertyDescriptors(e);delete r[y];let n=Reflect.ownKeys(r);for(let t=0;t<n.length;t++){const o=n[t],i=r[o];!1===i.writable&&(i.writable=!0,i.configurable=!0),(i.get||i.set)&&(r[o]={configurable:!0,writable:!0,enumerable:i.enumerable,value:e[o]})}return Object.create(v(e),r)}function A(e,t=!1){return C(e)||m(e)||!b(e)||(x(e)>1&&(e.set=e.add=e.clear=e.delete=T),Object.freeze(e),t&&Object.entries(e).forEach((([e,t])=>A(t,!0)))),e}function T(){g(2)}function C(e){return Object.isFrozen(e)}var z,L={};function B(e){const t=L[e];return t||g(0),t}function D(){return z}function R(e,t){t&&(B("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function q(e){$(e),e.drafts_.forEach(M),e.drafts_=null}function $(e){e===z&&(z=e.parent_)}function F(e){return z={drafts_:[],parent_:z,immer_:e,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function M(e){const t=e[y];0===t.type_||1===t.type_?t.revoke_():t.revoked_=!0}function I(e,t){t.unfinalizedDrafts_=t.drafts_.length;const r=t.drafts_[0];return void 0!==e&&e!==r?(r[y].modified_&&(q(t),g(4)),b(e)&&(e=V(t,e),t.parent_||K(t,e)),t.patches_&&B("Patches").generateReplacementPatches_(r[y].base_,e,t.patches_,t.inversePatches_)):e=V(t,r,[]),q(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==u?e:void 0}function V(e,t,r){if(C(t))return t;const n=t[y];if(!n)return O(t,((o,i)=>W(e,n,t,o,i,r))),t;if(n.scope_!==e)return t;if(!n.modified_)return K(e,n.base_,!0),n.base_;if(!n.finalized_){n.finalized_=!0,n.scope_.unfinalizedDrafts_--;const t=n.copy_;let o=t,i=!1;3===n.type_&&(o=new Set(t),t.clear(),i=!0),O(o,((o,s)=>W(e,n,t,o,s,r,i))),K(e,t,!1),r&&e.patches_&&B("Patches").generatePatches_(n,r,e.patches_,e.inversePatches_)}return n.copy_}function W(e,t,r,n,o,i,s){if(m(o)){const s=V(e,o,i&&t&&3!==t.type_&&!P(t.assigned_,n)?i.concat(n):void 0);if(k(r,n,s),!m(s))return;e.canAutoFreeze_=!1}else s&&r.add(o);if(b(o)&&!C(o)){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1)return;V(e,o),t&&t.scope_.parent_||"symbol"==typeof n||!Object.prototype.propertyIsEnumerable.call(r,n)||K(e,o)}}function K(e,t,r=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&A(t,r)}var U={get(e,t){if(t===y)return e;const r=S(e);if(!P(r,t))return function(e,t,r){const n=H(t,r);return n?"value"in n?n.value:n.get?.call(e.draft_):void 0}(e,r,t);const n=r[t];return e.finalized_||!b(n)?n:n===Z(e.base_,t)?(G(e),e.copy_[t]=Q(n,e)):n},has:(e,t)=>t in S(e),ownKeys:e=>Reflect.ownKeys(S(e)),set(e,t,r){const n=H(S(e),t);if(n?.set)return n.set.call(e.draft_,r),!0;if(!e.modified_){const n=Z(S(e),t),s=n?.[y];if(s&&s.base_===r)return e.copy_[t]=r,e.assigned_[t]=!1,!0;if(((o=r)===(i=n)?0!==o||1/o==1/i:o!=o&&i!=i)&&(void 0!==r||P(e.base_,t)))return!0;G(e),X(e)}var o,i;return e.copy_[t]===r&&(void 0!==r||t in e.copy_)||Number.isNaN(r)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=r,e.assigned_[t]=!0),!0},deleteProperty:(e,t)=>(void 0!==Z(e.base_,t)||t in e.base_?(e.assigned_[t]=!1,G(e),X(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0),getOwnPropertyDescriptor(e,t){const r=S(e),n=Reflect.getOwnPropertyDescriptor(r,t);return n?{writable:!0,configurable:1!==e.type_||"length"!==t,enumerable:n.enumerable,value:r[t]}:n},defineProperty(){g(11)},getPrototypeOf:e=>v(e.base_),setPrototypeOf(){g(12)}},J={};function Z(e,t){const r=e[y];return(r?S(r):e)[t]}function H(e,t){if(!(t in e))return;let r=v(e);for(;r;){const e=Object.getOwnPropertyDescriptor(r,t);if(e)return e;r=v(r)}}function X(e){e.modified_||(e.modified_=!0,e.parent_&&X(e.parent_))}function G(e){e.copy_||(e.copy_=N(e.base_,e.scope_.immer_.useStrictShallowCopy_))}O(U,((e,t)=>{J[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}})),J.deleteProperty=function(e,t){return J.set.call(this,e,t,void 0)},J.set=function(e,t,r){return U.set.call(this,e[0],t,r,e[0])};function Q(e,t){const r=j(e)?B("MapSet").proxyMap_(e,t):E(e)?B("MapSet").proxySet_(e,t):function(e,t){const r=Array.isArray(e),n={type_:r?1:0,scope_:t?t.scope_:D(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let o=n,i=U;r&&(o=[n],i=J);const{revoke:s,proxy:a}=Proxy.revocable(o,i);return n.draft_=a,n.revoke_=s,a}(e,t);return(t?t.scope_:D()).drafts_.push(r),r}function Y(e){if(!b(e)||C(e))return e;const t=e[y];let r;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,r=N(e,t.scope_.immer_.useStrictShallowCopy_)}else r=N(e,!0);return O(r,((e,t)=>{k(r,e,Y(t))})),t&&(t.finalized_=!1),r}var ee=new class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.produce=(e,t,r)=>{if("function"==typeof e&&"function"!=typeof t){const r=t;t=e;const n=this;return function(e=r,...o){return n.produce(e,(e=>t.call(this,e,...o)))}}let n;if("function"!=typeof t&&g(6),void 0!==r&&"function"!=typeof r&&g(7),b(e)){const o=F(this),i=Q(e,void 0);let s=!0;try{n=t(i),s=!1}finally{s?q(o):$(o)}return R(o,r),I(n,o)}if(!e||"object"!=typeof e){if(n=t(e),void 0===n&&(n=e),n===u&&(n=void 0),this.autoFreeze_&&A(n,!0),r){const t=[],o=[];B("Patches").generateReplacementPatches_(e,n,t,o),r(t,o)}return n}g(1)},this.produceWithPatches=(e,t)=>{if("function"==typeof e)return(t,...r)=>this.produceWithPatches(t,(t=>e(t,...r)));let r,n;return[this.produce(e,t,((e,t)=>{r=e,n=t})),r,n]},"boolean"==typeof e?.autoFreeze&&this.setAutoFreeze(e.autoFreeze),"boolean"==typeof e?.useStrictShallowCopy&&this.setUseStrictShallowCopy(e.useStrictShallowCopy)}createDraft(e){b(e)||g(8),m(e)&&(e=function(e){m(e)||g(10);return Y(e)}(e));const t=F(this),r=Q(e,void 0);return r[y].isManual_=!0,$(t),r}finishDraft(e,t){const r=e&&e[y];r&&r.isManual_||g(9);const{scope_:n}=r;return R(n,t),I(void 0,n)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}applyPatches(e,t){let r;for(r=t.length-1;r>=0;r--){const n=t[r];if(0===n.path.length&&"replace"===n.op){e=n.value;break}}r>-1&&(t=t.slice(r+1));const n=B("Patches").applyPatches_;return m(e)?n(e,t):this.produce(e,(e=>n(e,t)))}},te=ee.produce;ee.produceWithPatches.bind(ee),ee.setAutoFreeze.bind(ee),ee.setUseStrictShallowCopy.bind(ee),ee.applyPatches.bind(ee);var re=ee.createDraft.bind(ee),ne=ee.finishDraft.bind(ee),oe={ancestors(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{reverse:r=!1}=t,n=oe.levels(e,t);return n=r?n.slice(1):n.slice(0,-1)},common(e,t){for(var r=[],n=0;n<e.length&&n<t.length;n++){var o=e[n];if(o!==t[n])break;r.push(o)}return r},compare(e,t){for(var r=Math.min(e.length,t.length),n=0;n<r;n++){if(e[n]<t[n])return-1;if(e[n]>t[n])return 1}return 0},endsAfter(e,t){var r=e.length-1,n=e.slice(0,r),o=t.slice(0,r),i=e[r],s=t[r];return oe.equals(n,o)&&i>s},endsAt(e,t){var r=e.length,n=e.slice(0,r),o=t.slice(0,r);return oe.equals(n,o)},endsBefore(e,t){var r=e.length-1,n=e.slice(0,r),o=t.slice(0,r),i=e[r],s=t[r];return oe.equals(n,o)&&i<s},equals:(e,t)=>e.length===t.length&&e.every(((e,r)=>e===t[r])),hasPrevious:e=>e[e.length-1]>0,isAfter:(e,t)=>1===oe.compare(e,t),isAncestor:(e,t)=>e.length<t.length&&0===oe.compare(e,t),isBefore:(e,t)=>-1===oe.compare(e,t),isChild:(e,t)=>e.length===t.length+1&&0===oe.compare(e,t),isCommon:(e,t)=>e.length<=t.length&&0===oe.compare(e,t),isDescendant:(e,t)=>e.length>t.length&&0===oe.compare(e,t),isParent:(e,t)=>e.length+1===t.length&&0===oe.compare(e,t),isPath:e=>Array.isArray(e)&&(0===e.length||"number"==typeof e[0]),isSibling(e,t){if(e.length!==t.length)return!1;var r=e.slice(0,-1),n=t.slice(0,-1);return e[e.length-1]!==t[t.length-1]&&oe.equals(r,n)},levels(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{reverse:r=!1}=t,n=[],o=0;o<=e.length;o++)n.push(e.slice(0,o));return r&&n.reverse(),n},next(e){if(0===e.length)throw new Error("Cannot get the next path of a root path [".concat(e,"], because it has no next index."));var t=e[e.length-1];return e.slice(0,-1).concat(t+1)},operationCanTransformPath(e){switch(e.type){case"insert_node":case"remove_node":case"merge_node":case"split_node":case"move_node":return!0;default:return!1}},parent(e){if(0===e.length)throw new Error("Cannot get the parent path of the root path [".concat(e,"]."));return e.slice(0,-1)},previous(e){if(0===e.length)throw new Error("Cannot get the previous path of a root path [".concat(e,"], because it has no previous index."));var t=e[e.length-1];if(t<=0)throw new Error("Cannot get the previous path of a first child path [".concat(e,"] because it would result in a negative index."));return e.slice(0,-1).concat(t-1)},relative(e,t){if(!oe.isAncestor(t,e)&&!oe.equals(e,t))throw new Error("Cannot get the relative path of [".concat(e,"] inside ancestor [").concat(t,"], because it is not above or equal to the path."));return e.slice(t.length)},transform(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!e)return null;var n=[...e],{affinity:o="forward"}=r;if(0===e.length)return n;switch(t.type){case"insert_node":var{path:i}=t;(oe.equals(i,n)||oe.endsBefore(i,n)||oe.isAncestor(i,n))&&(n[i.length-1]+=1);break;case"remove_node":var{path:s}=t;if(oe.equals(s,n)||oe.isAncestor(s,n))return null;oe.endsBefore(s,n)&&(n[s.length-1]-=1);break;case"merge_node":var{path:a,position:l}=t;oe.equals(a,n)||oe.endsBefore(a,n)?n[a.length-1]-=1:oe.isAncestor(a,n)&&(n[a.length-1]-=1,n[a.length]+=l);break;case"split_node":var{path:c,position:p}=t;if(oe.equals(c,n)){if("forward"===o)n[n.length-1]+=1;else if("backward"!==o)return null}else oe.endsBefore(c,n)?n[c.length-1]+=1:oe.isAncestor(c,n)&&e[c.length]>=p&&(n[c.length-1]+=1,n[c.length]-=p);break;case"move_node":var{path:f,newPath:d}=t;if(oe.equals(f,d))return n;if(oe.isAncestor(f,n)||oe.equals(f,n)){var u=d.slice();return oe.endsBefore(f,d)&&f.length<d.length&&(u[f.length-1]-=1),u.concat(n.slice(f.length))}oe.isSibling(f,d)&&(oe.isAncestor(d,n)||oe.equals(d,n))?oe.endsBefore(f,n)?n[f.length-1]-=1:n[f.length-1]+=1:oe.endsBefore(d,n)||oe.equals(d,n)||oe.isAncestor(d,n)?(oe.endsBefore(f,n)&&(n[f.length-1]-=1),n[d.length-1]+=1):oe.endsBefore(f,n)&&(oe.equals(d,n)&&(n[d.length-1]+=1),n[f.length-1]-=1)}return n}};function ie(e){return ie="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ie(e)}function se(e){var t=function(e,t){if("object"!==ie(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!==ie(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===ie(t)?t:String(t)}function ae(e,t,r){return(t=se(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function le(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function ce(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?le(Object(r),!0).forEach((function(t){ae(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):le(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var pe={transform(e,t){e.children=re(e.children);var r=e.selection&&re(e.selection);try{r=((e,t,r)=>{switch(r.type){case"insert_node":var{path:n,node:o}=r,i=xe.parent(e,n),s=n[n.length-1];if(s>i.children.length)throw new Error('Cannot apply an "insert_node" operation at path ['.concat(n,"] because the destination is past the end of the node."));if(i.children.splice(s,0,o),t)for(var[a,l]of ve.points(t))t[l]=Te.transform(a,r);break;case"insert_text":var{path:c,offset:p,text:f}=r;if(0===f.length)break;var d=xe.leaf(e,c),u=d.text.slice(0,p),h=d.text.slice(p);if(d.text=u+f+h,t)for(var[y,g]of ve.points(t))t[g]=Te.transform(y,r);break;case"merge_node":var{path:v}=r,m=xe.get(e,v),b=oe.previous(v),w=xe.get(e,b),_=xe.parent(e,v),O=v[v.length-1];if($e.isText(m)&&$e.isText(w))w.text+=m.text;else{if($e.isText(m)||$e.isText(w))throw new Error('Cannot apply a "merge_node" operation at path ['.concat(v,"] to nodes of different interfaces: ").concat(ze.stringify(m)," ").concat(ze.stringify(w)));w.children.push(...m.children)}if(_.children.splice(O,1),t)for(var[x,P]of ve.points(t))t[P]=Te.transform(x,r);break;case"move_node":var{path:k,newPath:j}=r;if(oe.isAncestor(k,j))throw new Error("Cannot move a path [".concat(k,"] to new path [").concat(j,"] because the destination is inside itself."));var E=xe.get(e,k),S=xe.parent(e,k),N=k[k.length-1];S.children.splice(N,1);var A=oe.transform(k,r),T=xe.get(e,oe.parent(A)),C=A[A.length-1];if(T.children.splice(C,0,E),t)for(var[z,L]of ve.points(t))t[L]=Te.transform(z,r);break;case"remove_node":var{path:B}=r,D=B[B.length-1];if(xe.parent(e,B).children.splice(D,1),t)for(var[R,q]of ve.points(t)){var $=Te.transform(R,r);if(null!=t&&null!=$)t[q]=$;else{var F=void 0,M=void 0;for(var[I,V]of xe.texts(e)){if(-1!==oe.compare(V,B)){M=[I,V];break}F=[I,V]}var W=!1;F&&M&&(W=oe.equals(M[1],B)?!oe.hasPrevious(M[1]):oe.common(F[1],B).length<oe.common(M[1],B).length),F&&!W?(R.path=F[1],R.offset=F[0].text.length):M?(R.path=M[1],R.offset=0):t=null}}break;case"remove_text":var{path:K,offset:U,text:J}=r;if(0===J.length)break;var Z=xe.leaf(e,K),H=Z.text.slice(0,U),X=Z.text.slice(U+J.length);if(Z.text=H+X,t)for(var[G,Q]of ve.points(t))t[Q]=Te.transform(G,r);break;case"set_node":var{path:Y,properties:ee,newProperties:te}=r;if(0===Y.length)throw new Error("Cannot set properties on the root node!");var re=xe.get(e,Y);for(var ne in te){if("children"===ne||"text"===ne)throw new Error('Cannot set the "'.concat(ne,'" property of nodes!'));var ie=te[ne];null==ie?delete re[ne]:re[ne]=ie}for(var se in ee)te.hasOwnProperty(se)||delete re[se];break;case"set_selection":var{newProperties:ae}=r;if(null==ae)t=ae;else{if(null==t){if(!ve.isRange(ae))throw new Error('Cannot apply an incomplete "set_selection" operation properties '.concat(ze.stringify(ae)," when there is no current selection."));t=ce({},ae)}for(var le in ae){var pe=ae[le];if(null==pe){if("anchor"===le||"focus"===le)throw new Error('Cannot remove the "'.concat(le,'" selection property'));delete t[le]}else t[le]=pe}}break;case"split_node":var{path:fe,position:de,properties:ue}=r;if(0===fe.length)throw new Error('Cannot apply a "split_node" operation at path ['.concat(fe,"] because the root node cannot be split."));var he,ye=xe.get(e,fe),ge=xe.parent(e,fe),me=fe[fe.length-1];if($e.isText(ye)){var be=ye.text.slice(0,de),we=ye.text.slice(de);ye.text=be,he=ce(ce({},ue),{},{text:we})}else{var _e=ye.children.slice(0,de),Oe=ye.children.slice(de);ye.children=_e,he=ce(ce({},ue),{},{children:Oe})}if(ge.children.splice(me+1,0,he),t)for(var[Pe,ke]of ve.points(t))t[ke]=Te.transform(Pe,r)}return t})(e,r,t)}finally{e.children=ne(e.children),e.selection=r?m(r)?ne(r):r:null}}},fe={insertNodes(e,t,r){e.insertNodes(t,r)},liftNodes(e,t){e.liftNodes(t)},mergeNodes(e,t){e.mergeNodes(t)},moveNodes(e,t){e.moveNodes(t)},removeNodes(e,t){e.removeNodes(t)},setNodes(e,t,r){e.setNodes(t,r)},splitNodes(e,t){e.splitNodes(t)},unsetNodes(e,t,r){e.unsetNodes(t,r)},unwrapNodes(e,t){e.unwrapNodes(t)},wrapNodes(e,t,r){e.wrapNodes(t,r)}},de={collapse(e,t){e.collapse(t)},deselect(e){e.deselect()},move(e,t){e.move(t)},select(e,t){e.select(t)},setPoint(e,t,r){e.setPoint(t,r)},setSelection(e,t){e.setSelection(t)}},ue=(e,t)=>{for(var r in e){var n=e[r],o=t[r];if(d(n)&&d(o)){if(!ue(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 s in t)if(void 0===e[s]&&void 0!==t[s])return!1;return!0};function he(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r,n,o={},i=Object.keys(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var ye=["anchor","focus"];function ge(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}var ve={edges(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{reverse:r=!1}=t,{anchor:n,focus:o}=e;return ve.isBackward(e)===r?[n,o]:[o,n]},end(e){var[,t]=ve.edges(e);return t},equals:(e,t)=>Te.equals(e.anchor,t.anchor)&&Te.equals(e.focus,t.focus),includes(e,t){if(ve.isRange(t)){if(ve.includes(e,t.anchor)||ve.includes(e,t.focus))return!0;var[r,n]=ve.edges(e),[o,i]=ve.edges(t);return Te.isBefore(r,o)&&Te.isAfter(n,i)}var[s,a]=ve.edges(e),l=!1,c=!1;return Te.isPoint(t)?(l=Te.compare(t,s)>=0,c=Te.compare(t,a)<=0):(l=oe.compare(t,s.path)>=0,c=oe.compare(t,a.path)<=0),l&&c},intersection(e,t){var r=he(e,ye),[n,o]=ve.edges(e),[i,s]=ve.edges(t),a=Te.isBefore(n,i)?i:n,l=Te.isBefore(o,s)?o:s;return Te.isBefore(l,a)?null:function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ge(Object(r),!0).forEach((function(t){ae(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ge(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}({anchor:a,focus:l},r)},isBackward(e){var{anchor:t,focus:r}=e;return Te.isAfter(t,r)},isCollapsed(e){var{anchor:t,focus:r}=e;return Te.equals(t,r)},isExpanded:e=>!ve.isCollapsed(e),isForward:e=>!ve.isBackward(e),isRange:e=>d(e)&&Te.isPoint(e.anchor)&&Te.isPoint(e.focus),*points(e){yield[e.anchor,"anchor"],yield[e.focus,"focus"]},start(e){var[t]=ve.edges(e);return t},transform(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return te(e,(e=>{if(null===e)return null;var n,o,{affinity:i="inward"}=r;if("inward"===i){var s=ve.isCollapsed(e);ve.isForward(e)?(n="forward",o=s?n:"backward"):(n="backward",o=s?n:"forward")}else"outward"===i?ve.isForward(e)?(n="backward",o="forward"):(n="forward",o="backward"):(n=i,o=i);var a=Te.transform(e.anchor,t,{affinity:n}),l=Te.transform(e.focus,t,{affinity:o});if(!a||!l)return null;e.anchor=a,e.focus=l}))}},me=e=>d(e)&&xe.isNodeList(e.children)&&!Se.isEditor(e),be={isAncestor:e=>d(e)&&xe.isNodeList(e.children),isElement:me,isElementList:e=>Array.isArray(e)&&e.every((e=>be.isElement(e))),isElementProps:e=>void 0!==e.children,isElementType:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"type";return me(e)&&e[r]===t},matches(e,t){for(var r in t)if("children"!==r&&e[r]!==t[r])return!1;return!0}},we=["children"],_e=["text"],Oe=new WeakMap,xe={ancestor(e,t){var r=xe.get(e,t);if($e.isText(r))throw new Error("Cannot get the ancestor node at path [".concat(t,"] because it refers to a text node instead: ").concat(ze.stringify(r)));return r},ancestors(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return function*(){for(var n of oe.ancestors(t,r)){var o=[xe.ancestor(e,n),n];yield o}}()},child(e,t){if($e.isText(e))throw new Error("Cannot get the child of a text node: ".concat(ze.stringify(e)));var r=e.children[t];if(null==r)throw new Error("Cannot get child at index `".concat(t,"` in node: ").concat(ze.stringify(e)));return r},children(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return function*(){for(var{reverse:n=!1}=r,o=xe.ancestor(e,t),{children:i}=o,s=n?i.length-1:0;n?s>=0:s<i.length;){var a=xe.child(o,s),l=t.concat(s);yield[a,l],s=n?s-1:s+1}}()},common(e,t,r){var n=oe.common(t,r);return[xe.get(e,n),n]},descendant(e,t){var r=xe.get(e,t);if(Se.isEditor(r))throw new Error("Cannot get the descendant node at path [".concat(t,"] because it refers to the root editor node instead: ").concat(ze.stringify(r)));return r},descendants(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function*(){for(var[r,n]of xe.nodes(e,t))0!==n.length&&(yield[r,n])}()},elements(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function*(){for(var[r,n]of xe.nodes(e,t))be.isElement(r)&&(yield[r,n])}()},extractProps:e=>be.isAncestor(e)?he(e,we):he(e,_e),first(e,t){for(var r=t.slice(),n=xe.get(e,r);n&&!$e.isText(n)&&0!==n.children.length;)n=n.children[0],r.push(0);return[n,r]},fragment(e,t){if($e.isText(e))throw new Error("Cannot get a fragment starting from a root text node: ".concat(ze.stringify(e)));return te({children:e.children},(e=>{var[r,n]=ve.edges(t),o=xe.nodes(e,{reverse:!0,pass:e=>{var[,r]=e;return!ve.includes(t,r)}});for(var[,i]of o){if(!ve.includes(t,i)){var s=xe.parent(e,i),a=i[i.length-1];s.children.splice(a,1)}if(oe.equals(i,n.path)){var l=xe.leaf(e,i);l.text=l.text.slice(0,n.offset)}if(oe.equals(i,r.path)){var c=xe.leaf(e,i);c.text=c.text.slice(r.offset)}}Se.isEditor(e)&&(e.selection=null)})).children},get(e,t){for(var r=e,n=0;n<t.length;n++){var o=t[n];if($e.isText(r)||!r.children[o])throw new Error("Cannot find a descendant at path [".concat(t,"] in node: ").concat(ze.stringify(e)));r=r.children[o]}return r},has(e,t){for(var r=e,n=0;n<t.length;n++){var o=t[n];if($e.isText(r)||!r.children[o])return!1;r=r.children[o]}return!0},isNode:e=>$e.isText(e)||be.isElement(e)||Se.isEditor(e),isNodeList(e){if(!Array.isArray(e))return!1;var t=Oe.get(e);if(void 0!==t)return t;var r=e.every((e=>xe.isNode(e)));return Oe.set(e,r),r},last(e,t){for(var r=t.slice(),n=xe.get(e,r);n&&!$e.isText(n)&&0!==n.children.length;){var o=n.children.length-1;n=n.children[o],r.push(o)}return[n,r]},leaf(e,t){var r=xe.get(e,t);if(!$e.isText(r))throw new Error("Cannot get the leaf node at path [".concat(t,"] because it refers to a non-leaf node: ").concat(ze.stringify(r)));return r},levels(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return function*(){for(var n of oe.levels(t,r)){var o=xe.get(e,n);yield[o,n]}}()},matches:(e,t)=>be.isElement(e)&&be.isElementProps(t)&&be.matches(e,t)||$e.isText(e)&&$e.isTextProps(t)&&$e.matches(e,t),nodes(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function*(){for(var{pass:r,reverse:n=!1}=t,{from:o=[],to:i}=t,s=new Set,a=[],l=e;!i||!(n?oe.isBefore(a,i):oe.isAfter(a,i));)if(s.has(l)||(yield[l,a]),s.has(l)||$e.isText(l)||0===l.children.length||null!=r&&!1!==r([l,a])){if(0===a.length)break;if(!n){var c=oe.next(a);if(xe.has(e,c)){a=c,l=xe.get(e,a);continue}}if(n&&0!==a[a.length-1])a=oe.previous(a),l=xe.get(e,a);else a=oe.parent(a),l=xe.get(e,a),s.add(l)}else{s.add(l);var p=n?l.children.length-1:0;oe.isAncestor(a,o)&&(p=o[a.length]),a=a.concat(p),l=xe.get(e,a)}}()},parent(e,t){var r=oe.parent(t),n=xe.get(e,r);if($e.isText(n))throw new Error("Cannot get the parent of path [".concat(t,"] because it does not exist in the root."));return n},string:e=>$e.isText(e)?e.text:e.children.map(xe.string).join(""),texts(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function*(){for(var[r,n]of xe.nodes(e,t))$e.isText(r)&&(yield[r,n])}()}};function Pe(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function ke(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Pe(Object(r),!0).forEach((function(t){ae(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Pe(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var je={isNodeOperation:e=>je.isOperation(e)&&e.type.endsWith("_node"),isOperation(e){if(!d(e))return!1;switch(e.type){case"insert_node":case"remove_node":return oe.isPath(e.path)&&xe.isNode(e.node);case"insert_text":case"remove_text":return"number"==typeof e.offset&&"string"==typeof e.text&&oe.isPath(e.path);case"merge_node":return"number"==typeof e.position&&oe.isPath(e.path)&&d(e.properties);case"move_node":return oe.isPath(e.path)&&oe.isPath(e.newPath);case"set_node":return oe.isPath(e.path)&&d(e.properties)&&d(e.newProperties);case"set_selection":return null===e.properties&&ve.isRange(e.newProperties)||null===e.newProperties&&ve.isRange(e.properties)||d(e.properties)&&d(e.newProperties);case"split_node":return oe.isPath(e.path)&&"number"==typeof e.position&&d(e.properties);default:return!1}},isOperationList:e=>Array.isArray(e)&&e.every((e=>je.isOperation(e))),isSelectionOperation:e=>je.isOperation(e)&&e.type.endsWith("_selection"),isTextOperation:e=>je.isOperation(e)&&e.type.endsWith("_text"),inverse(e){switch(e.type){case"insert_node":return ke(ke({},e),{},{type:"remove_node"});case"insert_text":return ke(ke({},e),{},{type:"remove_text"});case"merge_node":return ke(ke({},e),{},{type:"split_node",path:oe.previous(e.path)});case"move_node":var{newPath:t,path:r}=e;if(oe.equals(t,r))return e;if(oe.isSibling(r,t))return ke(ke({},e),{},{path:t,newPath:r});var n=oe.transform(r,e),o=oe.transform(oe.next(r),e);return ke(ke({},e),{},{path:n,newPath:o});case"remove_node":return ke(ke({},e),{},{type:"insert_node"});case"remove_text":return ke(ke({},e),{},{type:"insert_text"});case"set_node":var{properties:i,newProperties:s}=e;return ke(ke({},e),{},{properties:s,newProperties:i});case"set_selection":var{properties:a,newProperties:l}=e;return ke(ke({},e),{},null==a?{properties:l,newProperties:null}:null==l?{properties:null,newProperties:a}:{properties:l,newProperties:a});case"split_node":return ke(ke({},e),{},{type:"merge_node",path:oe.next(e.path)})}}},Ee=new WeakMap,Se={above:(e,t)=>e.above(t),addMark(e,t,r){e.addMark(t,r)},after:(e,t,r)=>e.after(t,r),before:(e,t,r)=>e.before(t,r),deleteBackward(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{unit:r="character"}=t;e.deleteBackward(r)},deleteForward(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{unit:r="character"}=t;e.deleteForward(r)},deleteFragment(e,t){e.deleteFragment(t)},edges:(e,t)=>e.edges(t),elementReadOnly(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return e.elementReadOnly(t)},end:(e,t)=>e.end(t),first:(e,t)=>e.first(t),fragment:(e,t)=>e.fragment(t),hasBlocks:(e,t)=>e.hasBlocks(t),hasInlines:(e,t)=>e.hasInlines(t),hasPath:(e,t)=>e.hasPath(t),hasTexts:(e,t)=>e.hasTexts(t),insertBreak(e){e.insertBreak()},insertFragment(e,t,r){e.insertFragment(t,r)},insertNode(e,t){e.insertNode(t)},insertSoftBreak(e){e.insertSoftBreak()},insertText(e,t){e.insertText(t)},isBlock:(e,t)=>e.isBlock(t),isEdge:(e,t,r)=>e.isEdge(t,r),isEditor:e=>(e=>{var t=Ee.get(e);if(void 0!==t)return t;if(!d(e))return!1;var r="function"==typeof e.addMark&&"function"==typeof e.apply&&"function"==typeof e.deleteFragment&&"function"==typeof e.insertBreak&&"function"==typeof e.insertSoftBreak&&"function"==typeof e.insertFragment&&"function"==typeof e.insertNode&&"function"==typeof e.insertText&&"function"==typeof e.isElementReadOnly&&"function"==typeof e.isInline&&"function"==typeof e.isSelectable&&"function"==typeof e.isVoid&&"function"==typeof e.normalizeNode&&"function"==typeof e.onChange&&"function"==typeof e.removeMark&&"function"==typeof e.getDirtyPaths&&(null===e.marks||d(e.marks))&&(null===e.selection||ve.isRange(e.selection))&&xe.isNodeList(e.children)&&je.isOperationList(e.operations);return Ee.set(e,r),r})(e),isElementReadOnly:(e,t)=>e.isElementReadOnly(t),isEmpty:(e,t)=>e.isEmpty(t),isEnd:(e,t,r)=>e.isEnd(t,r),isInline:(e,t)=>e.isInline(t),isNormalizing:e=>e.isNormalizing(),isSelectable:(e,t)=>e.isSelectable(t),isStart:(e,t,r)=>e.isStart(t,r),isVoid:(e,t)=>e.isVoid(t),last:(e,t)=>e.last(t),leaf:(e,t,r)=>e.leaf(t,r),levels:(e,t)=>e.levels(t),marks:e=>e.getMarks(),next:(e,t)=>e.next(t),node:(e,t,r)=>e.node(t,r),nodes:(e,t)=>e.nodes(t),normalize(e,t){e.normalize(t)},parent:(e,t,r)=>e.parent(t,r),path:(e,t,r)=>e.path(t,r),pathRef:(e,t,r)=>e.pathRef(t,r),pathRefs:e=>e.pathRefs(),point:(e,t,r)=>e.point(t,r),pointRef:(e,t,r)=>e.pointRef(t,r),pointRefs:e=>e.pointRefs(),positions:(e,t)=>e.positions(t),previous:(e,t)=>e.previous(t),range:(e,t,r)=>e.range(t,r),rangeRef:(e,t,r)=>e.rangeRef(t,r),rangeRefs:e=>e.rangeRefs(),removeMark(e,t){e.removeMark(t)},setNormalizing(e,t){e.setNormalizing(t)},start:(e,t)=>e.start(t),string:(e,t,r)=>e.string(t,r),unhangRange:(e,t,r)=>e.unhangRange(t,r),void:(e,t)=>e.void(t),withoutNormalizing(e,t){e.withoutNormalizing(t)}};function Ne(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Ae(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Ne(Object(r),!0).forEach((function(t){ae(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Ne(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var Te={compare(e,t){var r=oe.compare(e.path,t.path);return 0===r?e.offset<t.offset?-1:e.offset>t.offset?1:0:r},isAfter:(e,t)=>1===Te.compare(e,t),isBefore:(e,t)=>-1===Te.compare(e,t),equals:(e,t)=>e.offset===t.offset&&oe.equals(e.path,t.path),isPoint:e=>d(e)&&"number"==typeof e.offset&&oe.isPath(e.path),transform(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return te(e,(e=>{if(null===e)return null;var{affinity:n="forward"}=r,{path:o,offset:i}=e;switch(t.type){case"insert_node":case"move_node":e.path=oe.transform(o,t,r);break;case"insert_text":oe.equals(t.path,o)&&(t.offset<i||t.offset===i&&"forward"===n)&&(e.offset+=t.text.length);break;case"merge_node":oe.equals(t.path,o)&&(e.offset+=t.position),e.path=oe.transform(o,t,r);break;case"remove_text":oe.equals(t.path,o)&&t.offset<=i&&(e.offset-=Math.min(i-t.offset,t.text.length));break;case"remove_node":if(oe.equals(t.path,o)||oe.isAncestor(t.path,o))return null;e.path=oe.transform(o,t,r);break;case"split_node":if(oe.equals(t.path,o)){if(t.position===i&&null==n)return null;(t.position<i||t.position===i&&"forward"===n)&&(e.offset-=t.position,e.path=oe.transform(o,t,Ae(Ae({},r),{},{affinity:"forward"})))}else e.path=oe.transform(o,t,r)}}))}},Ce=void 0,ze={setScrubber(e){Ce=e},stringify:e=>JSON.stringify(e,Ce)},Le=["text"],Be=["anchor","focus"];function De(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Re(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?De(Object(r),!0).forEach((function(t){ae(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):De(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var qe,$e={equals(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},{loose:n=!1}=r;function o(e){return he(e,Le)}return ue(n?o(e):e,n?o(t):t)},isText:e=>d(e)&&"string"==typeof e.text,isTextList:e=>Array.isArray(e)&&e.every((e=>$e.isText(e))),isTextProps:e=>void 0!==e.text,matches(e,t){for(var r in t)if("text"!==r&&(!e.hasOwnProperty(r)||e[r]!==t[r]))return!1;return!0},decorations(e,t){var r=[Re({},e)];for(var n of t){var o=he(n,Be),[i,s]=ve.edges(n),a=[],l=0,c=i.offset,p=s.offset;for(var f of r){var{length:d}=f.text,u=l;if(l+=d,c<=u&&l<=p)Object.assign(f,o),a.push(f);else if(c!==p&&(c===l||p===u)||c>l||p<u||p===u&&0!==u)a.push(f);else{var h=f,y=void 0,g=void 0;if(p<l){var v=p-u;g=Re(Re({},h),{},{text:h.text.slice(v)}),h=Re(Re({},h),{},{text:h.text.slice(0,v)})}if(c>u){var m=c-u;y=Re(Re({},h),{},{text:h.text.slice(0,m)}),h=Re(Re({},h),{},{text:h.text.slice(m)})}Object.assign(h,o),y&&a.push(y),a.push(h),g&&a.push(g)}}r=a}return r}},Fe=e=>e.selection?e.selection:e.children.length>0?Se.end(e,[]):[0];!function(e){e[e.None=0]="None",e[e.Extend=1]="Extend",e[e.ZWJ=2]="ZWJ",e[e.RI=4]="RI",e[e.Prepend=8]="Prepend",e[e.SpacingMark=16]="SpacingMark",e[e.L=32]="L",e[e.V=64]="V",e[e.T=128]="T",e[e.LV=256]="LV",e[e.LVT=512]="LVT",e[e.ExtPict=1024]="ExtPict",e[e.Any=2048]="Any"}(qe||(qe={})),qe.L,qe.L,qe.V,qe.LV,qe.LVT,qe.LV,qe.V,qe.V,qe.T,qe.LVT,qe.T,qe.T,qe.Any,qe.Extend,qe.ZWJ,qe.Any,qe.SpacingMark,qe.Prepend,qe.Any,qe.ZWJ,qe.ExtPict,qe.RI,qe.RI;var Me={delete(e,t){e.delete(t)},insertFragment(e,t,r){e.insertFragment(t,r)},insertText(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Se.withoutNormalizing(e,(()=>{var{voids:n=!1}=r,{at:o=Fe(e)}=r;if(oe.isPath(o)&&(o=Se.range(e,o)),ve.isRange(o))if(ve.isCollapsed(o))o=o.anchor;else{var i=ve.end(o);if(!n&&Se.void(e,{at:i}))return;var s=ve.start(o),a=Se.pointRef(e,s),l=Se.pointRef(e,i);We.delete(e,{at:o,voids:n});var c=a.unref(),p=l.unref();o=c||p,We.setSelection(e,{anchor:o,focus:o})}if(!(!n&&Se.void(e,{at:o})||Se.elementReadOnly(e,{at:o}))){var{path:f,offset:d}=o;t.length>0&&e.apply({type:"insert_text",path:f,offset:d,text:t})}}))}};function Ie(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Ve(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Ie(Object(r),!0).forEach((function(t){ae(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Ie(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var We=Ve(Ve(Ve(Ve({},pe),fe),de),Me);function Ke(e,i,{hotkeys:s,defaultBlock:a}){return l=>{Se.withoutNormalizing(i,(()=>{var c;const p=t(e);if(!i.selection||!p)return;const f=i.selection,{anchor:d}=f;if(s.isCmdEnter(l)){const t=Se.above(i,{at:d,match:e=>!Se.isEditor(e)&&be.isElement(e)&&"todo-list"===e.type,mode:"highest"});if(!t)return;const[n]=t,o=(null===(c=n.props)||void 0===c?void 0:c.checked)||!1;r.updateElement(e,p.id,{type:"todo-list",props:{checked:!o}})}else if(s.isEnter(l)){l.preventDefault();const t=Se.above(i,{at:d,match:e=>!Se.isEditor(e)&&be.isElement(e)&&("numbered-list"===e.type||"bulleted-list"===e.type||"todo-list"===e.type),mode:"highest"});if(!t)return;const[r,s]=t,c=Se.isEnd(i,d,s),f=Se.isStart(i,d,s),u=Se.string(i,s),h=0===p.meta.depth,y=u.trim().length>0;if(!y){if(h){const t=p.meta.order;return e.deleteBlock({blockId:p.id}),void e.insertBlock(a,{at:[t],focus:!0})}return void e.decreaseBlockDepth({blockId:p.id})}if(f){const t=n({type:p.type,meta:{order:p.meta.order,depth:p.meta.depth},value:[o({type:r.type,props:{nodeType:"block"}})]});return void e.insertBlock(t,{at:[p.meta.order],focus:!1})}if(y&&!f&&!c)return void e.splitBlock({slate:i,focus:!0});const g=n({type:p.type,meta:{order:p.meta.order+1,depth:p.meta.depth},value:[o({type:r.type,props:{nodeType:"block"}})]});e.insertBlock(g,{at:[p.meta.order+1],focus:!0})}else;}))}}const Ue={BulletedList:new i({type:"BulletedList",elements:{"bulleted-list":{render:t=>{var r,n=p(t,["extendRender"]);const{blockId:o,HTMLAttributes:i={},attributes:s,children:a}=n,{className:f=""}=i,d=p(i,["className"]),u=e(o),h=`yoopta-align-${(null===(r=null==u?void 0:u.meta)||void 0===r?void 0:r.align)||"left"}`;return l("div",Object.assign({className:`yoopta-bulleted-list ${h} ${f}`},d,s,{children:[c("span",Object.assign({className:"yoopta-bulleted-list-bullet",contentEditable:!1},{children:"•"})),c("span",Object.assign({className:"yoopta-bulleted-list-content"},{children:a}))]}))}}},options:{display:{title:"Bulleted List",description:"Create bullet list"},shortcuts:["-"]},events:{onKeyDown:Ke},parsers:{html:{deserialize:{nodeNames:["UL"],parse(e){if("UL"===e.nodeName){const t=e.querySelectorAll("li"),r=Array.from(t).filter((e=>{const t=e.textContent||"";return!/\[\s*\S?\s*\]/.test(t)})).map((e=>{const t=e.textContent||"";return n({id:s(),type:"BulletedList",value:[{id:s(),type:"bulleted-list",children:[{text:t}],props:{nodeType:"block"}}],meta:{order:0,depth:0}})}));if(r.length>0)return r}}},serialize:(e,t,r)=>{const{align:n="left",depth:o=0}=r||{};return`<ul data-meta-align="${n}" data-meta-depth="${o}" style="margin-left: ${o}px; text-align: ${n}"><li>${t}</li></ul>`}},markdown:{serialize:(e,t)=>`- ${t}`}}}),NumberedList:new i({type:"NumberedList",elements:{"numbered-list":{render:t=>{var r,{extendRender:n}=t,o=p(t,["extendRender"]);const{attributes:i,children:s,blockId:f,HTMLAttributes:d={}}=o,{className:u=""}=d,h=p(d,["className"]),y=e(f),g=function(e,t){const r=Object.keys(e.children).sort(((t,r)=>{const n=e.children[t],o=e.children[r];return n.meta.order-o.meta.order}));let n=0,o=!0;for(let i of r){const r=e.children[i];if("NumberedList"===r.type){if(o&&(n=0,o=!1),r.meta.depth===t.meta.depth&&"NumberedList"===r.type&&(n++,i===t.id))break}else o=!0}return n}(a(),y),v=`yoopta-align-${(null===(r=null==y?void 0:y.meta)||void 0===r?void 0:r.align)||"left"}`;return n?n(Object.assign(Object.assign({},o),{count:g})):l("div",Object.assign({className:`yoopta-numbered-list ${v} ${u}`},h,i,{children:[l("span",Object.assign({className:"yoopta-numbered-list-count",contentEditable:!1},{children:[g,"."]})),c("span",Object.assign({className:"yoopta-numbered-list-content"},{children:s}))]}))},props:{nodeType:"block"}}},options:{display:{title:"Numbered List",description:"Create list with numbering"},shortcuts:["1."]},events:{onKeyDown:Ke},parsers:{html:{deserialize:{nodeNames:["OL"],parse(e){if("OL"===e.nodeName){const t=e.querySelectorAll("li"),r=Array.from(t).filter((e=>{const t=e.textContent||"";return!/\[\s*\S?\s*\]/.test(t)})).map(((e,t)=>{const r=e.textContent||"";return n({id:s(),type:"NumberedList",value:[{id:s(),type:"numbered-list",children:[{text:r}],props:{nodeType:"block"}}],meta:{order:0,depth:0}})}));if(r.length>0)return r}}},serialize:(e,t,r)=>{const{align:n="left",depth:o=0}=r||{};return`<ol data-meta-align="${n}" data-meta-depth="${o}" style="margin-left: ${o}px; text-align: ${n}"><li>${t}</li></ol>`}},markdown:{serialize:(e,t)=>`- ${t}`}}}),TodoList:new i({type:"TodoList",elements:{"todo-list":{render:t=>{var n,{extendRender:o}=t,i=p(t,["extendRender"]);const{attributes:s,element:f,children:d,blockId:u,HTMLAttributes:h={}}=i,y=a(),g=e(u),{className:v=""}=h,m=p(h,["className"]),{checked:b=!1}=f.props||{},w={textDecoration:b?"line-through":"none"},_=`yoopta-align-${(null===(n=null==g?void 0:g.meta)||void 0===n?void 0:n.align)||"left"}`;return o?o(i):l("div",Object.assign({className:`yoopta-todo-list ${_} ${v}`,"data-checked":b},m,s,{children:[c("span",Object.assign({onClick:()=>r.updateElement(y,u,{type:"todo-list",props:{checked:!b}}),contentEditable:!1,className:"yoopta-todo-list-checkbox"},{children:c("input",{type:"checkbox",className:"yoopta-todo-list-checkbox-input",checked:b,disabled:y.readOnly})})),c("div",Object.assign({className:"yoopta-todo-list-content",style:w},{children:d}))]}))},props:{checked:!1}}},options:{display:{title:"Todo List",description:"Track tasks"},shortcuts:["[]"]},events:{onKeyDown:Ke},parsers:{html:{deserialize:{nodeNames:[],parse(e){if("OL"===e.nodeName||"UL"===e.nodeName){const t=e.querySelectorAll("li"),r=Array.from(t).filter((e=>{const t=e.textContent||"";return/\[\s*\S?\s*\]/.test(t)})).map((e=>{const t=e.textContent||"",r=/\[\s*x\s*\]/i.test(t),o=t.replace(/\[\s*\S?\s*\]/,"").trim();return n({id:s(),type:"TodoList",value:[{id:s(),type:"todo-list",children:[{text:o}],props:{nodeType:"block",checked:r}}],meta:{order:0,depth:0}})}));if(r.length>0)return r}}},serialize:(e,t,r)=>{const{align:n="left",depth:o=0}=r||{};return`<ul data-meta-align="${n}" data-meta-depth="${o}" style="margin-left: ${o}px; text-align: ${n}"><li>[${e.props.checked?"x":" "}] ${t}</li></ul>`}},markdown:{serialize:(e,t)=>`- ${e.props.checked?"[x]":"[ ]"} ${t}`}}})};!function(e,t){void 0===t&&(t={});var r=t.insertAt;if(e&&"undefined"!=typeof document){var n=document.head||document.getElementsByTagName("head")[0],o=document.createElement("style");o.type="text/css","top"===r&&n.firstChild?n.insertBefore(o,n.firstChild):n.appendChild(o),o.styleSheet?o.styleSheet.cssText=e:o.appendChild(document.createTextNode(e))}}(".yoopta-numbered-list{align-items:center;display:flex;margin-left:10px;position:relative}.yoopta-numbered-list>:not([hidden])~:not([hidden]){--tw-space-x-reverse:0;margin-left:calc(.25rem*(1 - var(--tw-space-x-reverse)));margin-right:calc(.25rem*var(--tw-space-x-reverse))}.yoopta-numbered-list{font-size:16px;line-height:28px;padding-bottom:2px;padding-left:1rem;padding-top:2px}.yoopta-numbered-list-count{left:0;min-width:10px;position:absolute;top:2px;-webkit-user-select:none;-moz-user-select:none;user-select:none;width:auto}.yoopta-bulleted-list{align-items:center;display:flex;margin-left:10px;position:relative}.yoopta-bulleted-list>:not([hidden])~:not([hidden]){--tw-space-x-reverse:0;margin-left:calc(.25rem*(1 - var(--tw-space-x-reverse)));margin-right:calc(.25rem*var(--tw-space-x-reverse))}.yoopta-bulleted-list{font-size:16px;line-height:1.75rem;padding-bottom:2px;padding-left:1rem;padding-top:2px}.yoopta-bulleted-list-bullet{font-weight:700;left:0;min-width:10px;position:absolute;top:0;-webkit-user-select:none;-moz-user-select:none;user-select:none;width:auto}.yoopta-bulleted-list-content{margin-left:0}.yoopta-todo-list{align-items:center;display:flex;margin-left:10px;position:relative}.yoopta-todo-list>:not([hidden])~:not([hidden]){--tw-space-x-reverse:0;margin-left:calc(.25rem*(1 - var(--tw-space-x-reverse)));margin-right:calc(.25rem*var(--tw-space-x-reverse))}.yoopta-todo-list{font-size:16px;line-height:28px;padding-bottom:2px;padding-left:1rem;padding-top:2px}.yoopta-todo-list-checkbox{cursor:pointer;left:0;position:absolute;top:4px;-webkit-user-select:none;-moz-user-select:none;user-select:none}.yoopta-todo-list-checkbox-input{min-width:10px;width:auto}");const Je=Ue.NumberedList,Ze=Ue.BulletedList,He=Ue.TodoList;export{Ze as BulletedList,Je as NumberedList,He as TodoList,Ue as default};
8
+ function f(e){return"[object Object]"===Object.prototype.toString.call(e)}function d(e){var t,r;return!1!==f(e)&&(void 0===(t=e.constructor)||!1!==f(r=t.prototype)&&!1!==r.hasOwnProperty("isPrototypeOf"))}var u=Symbol.for("immer-nothing"),h=Symbol.for("immer-draftable"),g=Symbol.for("immer-state");function y(e,...t){throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var v=Object.getPrototypeOf;function m(e){return!!e&&!!e[g]}function b(e){return!!e&&(O(e)||Array.isArray(e)||!!e[h]||!!e.constructor?.[h]||j(e)||E(e))}var w=Object.prototype.constructor.toString();function O(e){if(!e||"object"!=typeof e)return!1;const t=v(e);if(null===t)return!0;const r=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;return r===Object||"function"==typeof r&&Function.toString.call(r)===w}function _(e,t){0===x(e)?Reflect.ownKeys(e).forEach((r=>{t(r,e[r],e)})):e.forEach(((r,n)=>t(n,r,e)))}function x(e){const t=e[g];return t?t.type_:Array.isArray(e)?1:j(e)?2:E(e)?3:0}function P(e,t){return 2===x(e)?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function k(e,t,r){const n=x(e);2===n?e.set(t,r):3===n?e.add(r):e[t]=r}function j(e){return e instanceof Map}function E(e){return e instanceof Set}function S(e){return e.copy_||e.base_}function N(e,t){if(j(e))return new Map(e);if(E(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);if(!t&&O(e)){if(!v(e)){const t=Object.create(null);return Object.assign(t,e)}return{...e}}const r=Object.getOwnPropertyDescriptors(e);delete r[g];let n=Reflect.ownKeys(r);for(let t=0;t<n.length;t++){const o=n[t],i=r[o];!1===i.writable&&(i.writable=!0,i.configurable=!0),(i.get||i.set)&&(r[o]={configurable:!0,writable:!0,enumerable:i.enumerable,value:e[o]})}return Object.create(v(e),r)}function A(e,t=!1){return C(e)||m(e)||!b(e)||(x(e)>1&&(e.set=e.add=e.clear=e.delete=T),Object.freeze(e),t&&Object.entries(e).forEach((([e,t])=>A(t,!0)))),e}function T(){y(2)}function C(e){return Object.isFrozen(e)}var z,L={};function B(e){const t=L[e];return t||y(0),t}function D(){return z}function R(e,t){t&&(B("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function q(e){$(e),e.drafts_.forEach(M),e.drafts_=null}function $(e){e===z&&(z=e.parent_)}function F(e){return z={drafts_:[],parent_:z,immer_:e,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function M(e){const t=e[g];0===t.type_||1===t.type_?t.revoke_():t.revoked_=!0}function I(e,t){t.unfinalizedDrafts_=t.drafts_.length;const r=t.drafts_[0];return void 0!==e&&e!==r?(r[g].modified_&&(q(t),y(4)),b(e)&&(e=V(t,e),t.parent_||K(t,e)),t.patches_&&B("Patches").generateReplacementPatches_(r[g].base_,e,t.patches_,t.inversePatches_)):e=V(t,r,[]),q(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==u?e:void 0}function V(e,t,r){if(C(t))return t;const n=t[g];if(!n)return _(t,((o,i)=>W(e,n,t,o,i,r))),t;if(n.scope_!==e)return t;if(!n.modified_)return K(e,n.base_,!0),n.base_;if(!n.finalized_){n.finalized_=!0,n.scope_.unfinalizedDrafts_--;const t=n.copy_;let o=t,i=!1;3===n.type_&&(o=new Set(t),t.clear(),i=!0),_(o,((o,s)=>W(e,n,t,o,s,r,i))),K(e,t,!1),r&&e.patches_&&B("Patches").generatePatches_(n,r,e.patches_,e.inversePatches_)}return n.copy_}function W(e,t,r,n,o,i,s){if(m(o)){const s=V(e,o,i&&t&&3!==t.type_&&!P(t.assigned_,n)?i.concat(n):void 0);if(k(r,n,s),!m(s))return;e.canAutoFreeze_=!1}else s&&r.add(o);if(b(o)&&!C(o)){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1)return;V(e,o),t&&t.scope_.parent_||"symbol"==typeof n||!Object.prototype.propertyIsEnumerable.call(r,n)||K(e,o)}}function K(e,t,r=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&A(t,r)}var U={get(e,t){if(t===g)return e;const r=S(e);if(!P(r,t))return function(e,t,r){const n=H(t,r);return n?"value"in n?n.value:n.get?.call(e.draft_):void 0}(e,r,t);const n=r[t];return e.finalized_||!b(n)?n:n===Z(e.base_,t)?(G(e),e.copy_[t]=Q(n,e)):n},has:(e,t)=>t in S(e),ownKeys:e=>Reflect.ownKeys(S(e)),set(e,t,r){const n=H(S(e),t);if(n?.set)return n.set.call(e.draft_,r),!0;if(!e.modified_){const n=Z(S(e),t),s=n?.[g];if(s&&s.base_===r)return e.copy_[t]=r,e.assigned_[t]=!1,!0;if(((o=r)===(i=n)?0!==o||1/o==1/i:o!=o&&i!=i)&&(void 0!==r||P(e.base_,t)))return!0;G(e),X(e)}var o,i;return e.copy_[t]===r&&(void 0!==r||t in e.copy_)||Number.isNaN(r)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=r,e.assigned_[t]=!0),!0},deleteProperty:(e,t)=>(void 0!==Z(e.base_,t)||t in e.base_?(e.assigned_[t]=!1,G(e),X(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0),getOwnPropertyDescriptor(e,t){const r=S(e),n=Reflect.getOwnPropertyDescriptor(r,t);return n?{writable:!0,configurable:1!==e.type_||"length"!==t,enumerable:n.enumerable,value:r[t]}:n},defineProperty(){y(11)},getPrototypeOf:e=>v(e.base_),setPrototypeOf(){y(12)}},J={};function Z(e,t){const r=e[g];return(r?S(r):e)[t]}function H(e,t){if(!(t in e))return;let r=v(e);for(;r;){const e=Object.getOwnPropertyDescriptor(r,t);if(e)return e;r=v(r)}}function X(e){e.modified_||(e.modified_=!0,e.parent_&&X(e.parent_))}function G(e){e.copy_||(e.copy_=N(e.base_,e.scope_.immer_.useStrictShallowCopy_))}_(U,((e,t)=>{J[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}})),J.deleteProperty=function(e,t){return J.set.call(this,e,t,void 0)},J.set=function(e,t,r){return U.set.call(this,e[0],t,r,e[0])};function Q(e,t){const r=j(e)?B("MapSet").proxyMap_(e,t):E(e)?B("MapSet").proxySet_(e,t):function(e,t){const r=Array.isArray(e),n={type_:r?1:0,scope_:t?t.scope_:D(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let o=n,i=U;r&&(o=[n],i=J);const{revoke:s,proxy:a}=Proxy.revocable(o,i);return n.draft_=a,n.revoke_=s,a}(e,t);return(t?t.scope_:D()).drafts_.push(r),r}function Y(e){if(!b(e)||C(e))return e;const t=e[g];let r;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,r=N(e,t.scope_.immer_.useStrictShallowCopy_)}else r=N(e,!0);return _(r,((e,t)=>{k(r,e,Y(t))})),t&&(t.finalized_=!1),r}var ee=new class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.produce=(e,t,r)=>{if("function"==typeof e&&"function"!=typeof t){const r=t;t=e;const n=this;return function(e=r,...o){return n.produce(e,(e=>t.call(this,e,...o)))}}let n;if("function"!=typeof t&&y(6),void 0!==r&&"function"!=typeof r&&y(7),b(e)){const o=F(this),i=Q(e,void 0);let s=!0;try{n=t(i),s=!1}finally{s?q(o):$(o)}return R(o,r),I(n,o)}if(!e||"object"!=typeof e){if(n=t(e),void 0===n&&(n=e),n===u&&(n=void 0),this.autoFreeze_&&A(n,!0),r){const t=[],o=[];B("Patches").generateReplacementPatches_(e,n,t,o),r(t,o)}return n}y(1)},this.produceWithPatches=(e,t)=>{if("function"==typeof e)return(t,...r)=>this.produceWithPatches(t,(t=>e(t,...r)));let r,n;return[this.produce(e,t,((e,t)=>{r=e,n=t})),r,n]},"boolean"==typeof e?.autoFreeze&&this.setAutoFreeze(e.autoFreeze),"boolean"==typeof e?.useStrictShallowCopy&&this.setUseStrictShallowCopy(e.useStrictShallowCopy)}createDraft(e){b(e)||y(8),m(e)&&(e=function(e){m(e)||y(10);return Y(e)}(e));const t=F(this),r=Q(e,void 0);return r[g].isManual_=!0,$(t),r}finishDraft(e,t){const r=e&&e[g];r&&r.isManual_||y(9);const{scope_:n}=r;return R(n,t),I(void 0,n)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}applyPatches(e,t){let r;for(r=t.length-1;r>=0;r--){const n=t[r];if(0===n.path.length&&"replace"===n.op){e=n.value;break}}r>-1&&(t=t.slice(r+1));const n=B("Patches").applyPatches_;return m(e)?n(e,t):this.produce(e,(e=>n(e,t)))}},te=ee.produce;ee.produceWithPatches.bind(ee),ee.setAutoFreeze.bind(ee),ee.setUseStrictShallowCopy.bind(ee),ee.applyPatches.bind(ee);var re=ee.createDraft.bind(ee),ne=ee.finishDraft.bind(ee),oe={ancestors(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{reverse:r=!1}=t,n=oe.levels(e,t);return n=r?n.slice(1):n.slice(0,-1)},common(e,t){for(var r=[],n=0;n<e.length&&n<t.length;n++){var o=e[n];if(o!==t[n])break;r.push(o)}return r},compare(e,t){for(var r=Math.min(e.length,t.length),n=0;n<r;n++){if(e[n]<t[n])return-1;if(e[n]>t[n])return 1}return 0},endsAfter(e,t){var r=e.length-1,n=e.slice(0,r),o=t.slice(0,r),i=e[r],s=t[r];return oe.equals(n,o)&&i>s},endsAt(e,t){var r=e.length,n=e.slice(0,r),o=t.slice(0,r);return oe.equals(n,o)},endsBefore(e,t){var r=e.length-1,n=e.slice(0,r),o=t.slice(0,r),i=e[r],s=t[r];return oe.equals(n,o)&&i<s},equals:(e,t)=>e.length===t.length&&e.every(((e,r)=>e===t[r])),hasPrevious:e=>e[e.length-1]>0,isAfter:(e,t)=>1===oe.compare(e,t),isAncestor:(e,t)=>e.length<t.length&&0===oe.compare(e,t),isBefore:(e,t)=>-1===oe.compare(e,t),isChild:(e,t)=>e.length===t.length+1&&0===oe.compare(e,t),isCommon:(e,t)=>e.length<=t.length&&0===oe.compare(e,t),isDescendant:(e,t)=>e.length>t.length&&0===oe.compare(e,t),isParent:(e,t)=>e.length+1===t.length&&0===oe.compare(e,t),isPath:e=>Array.isArray(e)&&(0===e.length||"number"==typeof e[0]),isSibling(e,t){if(e.length!==t.length)return!1;var r=e.slice(0,-1),n=t.slice(0,-1);return e[e.length-1]!==t[t.length-1]&&oe.equals(r,n)},levels(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{reverse:r=!1}=t,n=[],o=0;o<=e.length;o++)n.push(e.slice(0,o));return r&&n.reverse(),n},next(e){if(0===e.length)throw new Error("Cannot get the next path of a root path [".concat(e,"], because it has no next index."));var t=e[e.length-1];return e.slice(0,-1).concat(t+1)},operationCanTransformPath(e){switch(e.type){case"insert_node":case"remove_node":case"merge_node":case"split_node":case"move_node":return!0;default:return!1}},parent(e){if(0===e.length)throw new Error("Cannot get the parent path of the root path [".concat(e,"]."));return e.slice(0,-1)},previous(e){if(0===e.length)throw new Error("Cannot get the previous path of a root path [".concat(e,"], because it has no previous index."));var t=e[e.length-1];if(t<=0)throw new Error("Cannot get the previous path of a first child path [".concat(e,"] because it would result in a negative index."));return e.slice(0,-1).concat(t-1)},relative(e,t){if(!oe.isAncestor(t,e)&&!oe.equals(e,t))throw new Error("Cannot get the relative path of [".concat(e,"] inside ancestor [").concat(t,"], because it is not above or equal to the path."));return e.slice(t.length)},transform(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!e)return null;var n=[...e],{affinity:o="forward"}=r;if(0===e.length)return n;switch(t.type){case"insert_node":var{path:i}=t;(oe.equals(i,n)||oe.endsBefore(i,n)||oe.isAncestor(i,n))&&(n[i.length-1]+=1);break;case"remove_node":var{path:s}=t;if(oe.equals(s,n)||oe.isAncestor(s,n))return null;oe.endsBefore(s,n)&&(n[s.length-1]-=1);break;case"merge_node":var{path:a,position:l}=t;oe.equals(a,n)||oe.endsBefore(a,n)?n[a.length-1]-=1:oe.isAncestor(a,n)&&(n[a.length-1]-=1,n[a.length]+=l);break;case"split_node":var{path:c,position:p}=t;if(oe.equals(c,n)){if("forward"===o)n[n.length-1]+=1;else if("backward"!==o)return null}else oe.endsBefore(c,n)?n[c.length-1]+=1:oe.isAncestor(c,n)&&e[c.length]>=p&&(n[c.length-1]+=1,n[c.length]-=p);break;case"move_node":var{path:f,newPath:d}=t;if(oe.equals(f,d))return n;if(oe.isAncestor(f,n)||oe.equals(f,n)){var u=d.slice();return oe.endsBefore(f,d)&&f.length<d.length&&(u[f.length-1]-=1),u.concat(n.slice(f.length))}oe.isSibling(f,d)&&(oe.isAncestor(d,n)||oe.equals(d,n))?oe.endsBefore(f,n)?n[f.length-1]-=1:n[f.length-1]+=1:oe.endsBefore(d,n)||oe.equals(d,n)||oe.isAncestor(d,n)?(oe.endsBefore(f,n)&&(n[f.length-1]-=1),n[d.length-1]+=1):oe.endsBefore(f,n)&&(oe.equals(d,n)&&(n[d.length-1]+=1),n[f.length-1]-=1)}return n}};function ie(e){return ie="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ie(e)}function se(e){var t=function(e,t){if("object"!==ie(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!==ie(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===ie(t)?t:String(t)}function ae(e,t,r){return(t=se(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function le(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function ce(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?le(Object(r),!0).forEach((function(t){ae(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):le(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var pe={transform(e,t){e.children=re(e.children);var r=e.selection&&re(e.selection);try{r=((e,t,r)=>{switch(r.type){case"insert_node":var{path:n,node:o}=r,i=xe.parent(e,n),s=n[n.length-1];if(s>i.children.length)throw new Error('Cannot apply an "insert_node" operation at path ['.concat(n,"] because the destination is past the end of the node."));if(i.children.splice(s,0,o),t)for(var[a,l]of ve.points(t))t[l]=Te.transform(a,r);break;case"insert_text":var{path:c,offset:p,text:f}=r;if(0===f.length)break;var d=xe.leaf(e,c),u=d.text.slice(0,p),h=d.text.slice(p);if(d.text=u+f+h,t)for(var[g,y]of ve.points(t))t[y]=Te.transform(g,r);break;case"merge_node":var{path:v}=r,m=xe.get(e,v),b=oe.previous(v),w=xe.get(e,b),O=xe.parent(e,v),_=v[v.length-1];if($e.isText(m)&&$e.isText(w))w.text+=m.text;else{if($e.isText(m)||$e.isText(w))throw new Error('Cannot apply a "merge_node" operation at path ['.concat(v,"] to nodes of different interfaces: ").concat(ze.stringify(m)," ").concat(ze.stringify(w)));w.children.push(...m.children)}if(O.children.splice(_,1),t)for(var[x,P]of ve.points(t))t[P]=Te.transform(x,r);break;case"move_node":var{path:k,newPath:j}=r;if(oe.isAncestor(k,j))throw new Error("Cannot move a path [".concat(k,"] to new path [").concat(j,"] because the destination is inside itself."));var E=xe.get(e,k),S=xe.parent(e,k),N=k[k.length-1];S.children.splice(N,1);var A=oe.transform(k,r),T=xe.get(e,oe.parent(A)),C=A[A.length-1];if(T.children.splice(C,0,E),t)for(var[z,L]of ve.points(t))t[L]=Te.transform(z,r);break;case"remove_node":var{path:B}=r,D=B[B.length-1];if(xe.parent(e,B).children.splice(D,1),t)for(var[R,q]of ve.points(t)){var $=Te.transform(R,r);if(null!=t&&null!=$)t[q]=$;else{var F=void 0,M=void 0;for(var[I,V]of xe.texts(e)){if(-1!==oe.compare(V,B)){M=[I,V];break}F=[I,V]}var W=!1;F&&M&&(W=oe.equals(M[1],B)?!oe.hasPrevious(M[1]):oe.common(F[1],B).length<oe.common(M[1],B).length),F&&!W?(R.path=F[1],R.offset=F[0].text.length):M?(R.path=M[1],R.offset=0):t=null}}break;case"remove_text":var{path:K,offset:U,text:J}=r;if(0===J.length)break;var Z=xe.leaf(e,K),H=Z.text.slice(0,U),X=Z.text.slice(U+J.length);if(Z.text=H+X,t)for(var[G,Q]of ve.points(t))t[Q]=Te.transform(G,r);break;case"set_node":var{path:Y,properties:ee,newProperties:te}=r;if(0===Y.length)throw new Error("Cannot set properties on the root node!");var re=xe.get(e,Y);for(var ne in te){if("children"===ne||"text"===ne)throw new Error('Cannot set the "'.concat(ne,'" property of nodes!'));var ie=te[ne];null==ie?delete re[ne]:re[ne]=ie}for(var se in ee)te.hasOwnProperty(se)||delete re[se];break;case"set_selection":var{newProperties:ae}=r;if(null==ae)t=ae;else{if(null==t){if(!ve.isRange(ae))throw new Error('Cannot apply an incomplete "set_selection" operation properties '.concat(ze.stringify(ae)," when there is no current selection."));t=ce({},ae)}for(var le in ae){var pe=ae[le];if(null==pe){if("anchor"===le||"focus"===le)throw new Error('Cannot remove the "'.concat(le,'" selection property'));delete t[le]}else t[le]=pe}}break;case"split_node":var{path:fe,position:de,properties:ue}=r;if(0===fe.length)throw new Error('Cannot apply a "split_node" operation at path ['.concat(fe,"] because the root node cannot be split."));var he,ge=xe.get(e,fe),ye=xe.parent(e,fe),me=fe[fe.length-1];if($e.isText(ge)){var be=ge.text.slice(0,de),we=ge.text.slice(de);ge.text=be,he=ce(ce({},ue),{},{text:we})}else{var Oe=ge.children.slice(0,de),_e=ge.children.slice(de);ge.children=Oe,he=ce(ce({},ue),{},{children:_e})}if(ye.children.splice(me+1,0,he),t)for(var[Pe,ke]of ve.points(t))t[ke]=Te.transform(Pe,r)}return t})(e,r,t)}finally{e.children=ne(e.children),e.selection=r?m(r)?ne(r):r:null}}},fe={insertNodes(e,t,r){e.insertNodes(t,r)},liftNodes(e,t){e.liftNodes(t)},mergeNodes(e,t){e.mergeNodes(t)},moveNodes(e,t){e.moveNodes(t)},removeNodes(e,t){e.removeNodes(t)},setNodes(e,t,r){e.setNodes(t,r)},splitNodes(e,t){e.splitNodes(t)},unsetNodes(e,t,r){e.unsetNodes(t,r)},unwrapNodes(e,t){e.unwrapNodes(t)},wrapNodes(e,t,r){e.wrapNodes(t,r)}},de={collapse(e,t){e.collapse(t)},deselect(e){e.deselect()},move(e,t){e.move(t)},select(e,t){e.select(t)},setPoint(e,t,r){e.setPoint(t,r)},setSelection(e,t){e.setSelection(t)}},ue=(e,t)=>{for(var r in e){var n=e[r],o=t[r];if(d(n)&&d(o)){if(!ue(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 s in t)if(void 0===e[s]&&void 0!==t[s])return!1;return!0};function he(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r,n,o={},i=Object.keys(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var ge=["anchor","focus"];function ye(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}var ve={edges(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{reverse:r=!1}=t,{anchor:n,focus:o}=e;return ve.isBackward(e)===r?[n,o]:[o,n]},end(e){var[,t]=ve.edges(e);return t},equals:(e,t)=>Te.equals(e.anchor,t.anchor)&&Te.equals(e.focus,t.focus),includes(e,t){if(ve.isRange(t)){if(ve.includes(e,t.anchor)||ve.includes(e,t.focus))return!0;var[r,n]=ve.edges(e),[o,i]=ve.edges(t);return Te.isBefore(r,o)&&Te.isAfter(n,i)}var[s,a]=ve.edges(e),l=!1,c=!1;return Te.isPoint(t)?(l=Te.compare(t,s)>=0,c=Te.compare(t,a)<=0):(l=oe.compare(t,s.path)>=0,c=oe.compare(t,a.path)<=0),l&&c},intersection(e,t){var r=he(e,ge),[n,o]=ve.edges(e),[i,s]=ve.edges(t),a=Te.isBefore(n,i)?i:n,l=Te.isBefore(o,s)?o:s;return Te.isBefore(l,a)?null:function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ye(Object(r),!0).forEach((function(t){ae(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ye(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}({anchor:a,focus:l},r)},isBackward(e){var{anchor:t,focus:r}=e;return Te.isAfter(t,r)},isCollapsed(e){var{anchor:t,focus:r}=e;return Te.equals(t,r)},isExpanded:e=>!ve.isCollapsed(e),isForward:e=>!ve.isBackward(e),isRange:e=>d(e)&&Te.isPoint(e.anchor)&&Te.isPoint(e.focus),*points(e){yield[e.anchor,"anchor"],yield[e.focus,"focus"]},start(e){var[t]=ve.edges(e);return t},transform(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return te(e,(e=>{if(null===e)return null;var n,o,{affinity:i="inward"}=r;if("inward"===i){var s=ve.isCollapsed(e);ve.isForward(e)?(n="forward",o=s?n:"backward"):(n="backward",o=s?n:"forward")}else"outward"===i?ve.isForward(e)?(n="backward",o="forward"):(n="forward",o="backward"):(n=i,o=i);var a=Te.transform(e.anchor,t,{affinity:n}),l=Te.transform(e.focus,t,{affinity:o});if(!a||!l)return null;e.anchor=a,e.focus=l}))}},me=e=>d(e)&&xe.isNodeList(e.children)&&!Se.isEditor(e),be={isAncestor:e=>d(e)&&xe.isNodeList(e.children),isElement:me,isElementList:e=>Array.isArray(e)&&e.every((e=>be.isElement(e))),isElementProps:e=>void 0!==e.children,isElementType:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"type";return me(e)&&e[r]===t},matches(e,t){for(var r in t)if("children"!==r&&e[r]!==t[r])return!1;return!0}},we=["children"],Oe=["text"],_e=new WeakMap,xe={ancestor(e,t){var r=xe.get(e,t);if($e.isText(r))throw new Error("Cannot get the ancestor node at path [".concat(t,"] because it refers to a text node instead: ").concat(ze.stringify(r)));return r},ancestors(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return function*(){for(var n of oe.ancestors(t,r)){var o=[xe.ancestor(e,n),n];yield o}}()},child(e,t){if($e.isText(e))throw new Error("Cannot get the child of a text node: ".concat(ze.stringify(e)));var r=e.children[t];if(null==r)throw new Error("Cannot get child at index `".concat(t,"` in node: ").concat(ze.stringify(e)));return r},children(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return function*(){for(var{reverse:n=!1}=r,o=xe.ancestor(e,t),{children:i}=o,s=n?i.length-1:0;n?s>=0:s<i.length;){var a=xe.child(o,s),l=t.concat(s);yield[a,l],s=n?s-1:s+1}}()},common(e,t,r){var n=oe.common(t,r);return[xe.get(e,n),n]},descendant(e,t){var r=xe.get(e,t);if(Se.isEditor(r))throw new Error("Cannot get the descendant node at path [".concat(t,"] because it refers to the root editor node instead: ").concat(ze.stringify(r)));return r},descendants(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function*(){for(var[r,n]of xe.nodes(e,t))0!==n.length&&(yield[r,n])}()},elements(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function*(){for(var[r,n]of xe.nodes(e,t))be.isElement(r)&&(yield[r,n])}()},extractProps:e=>be.isAncestor(e)?he(e,we):he(e,Oe),first(e,t){for(var r=t.slice(),n=xe.get(e,r);n&&!$e.isText(n)&&0!==n.children.length;)n=n.children[0],r.push(0);return[n,r]},fragment(e,t){if($e.isText(e))throw new Error("Cannot get a fragment starting from a root text node: ".concat(ze.stringify(e)));return te({children:e.children},(e=>{var[r,n]=ve.edges(t),o=xe.nodes(e,{reverse:!0,pass:e=>{var[,r]=e;return!ve.includes(t,r)}});for(var[,i]of o){if(!ve.includes(t,i)){var s=xe.parent(e,i),a=i[i.length-1];s.children.splice(a,1)}if(oe.equals(i,n.path)){var l=xe.leaf(e,i);l.text=l.text.slice(0,n.offset)}if(oe.equals(i,r.path)){var c=xe.leaf(e,i);c.text=c.text.slice(r.offset)}}Se.isEditor(e)&&(e.selection=null)})).children},get(e,t){for(var r=e,n=0;n<t.length;n++){var o=t[n];if($e.isText(r)||!r.children[o])throw new Error("Cannot find a descendant at path [".concat(t,"] in node: ").concat(ze.stringify(e)));r=r.children[o]}return r},has(e,t){for(var r=e,n=0;n<t.length;n++){var o=t[n];if($e.isText(r)||!r.children[o])return!1;r=r.children[o]}return!0},isNode:e=>$e.isText(e)||be.isElement(e)||Se.isEditor(e),isNodeList(e){if(!Array.isArray(e))return!1;var t=_e.get(e);if(void 0!==t)return t;var r=e.every((e=>xe.isNode(e)));return _e.set(e,r),r},last(e,t){for(var r=t.slice(),n=xe.get(e,r);n&&!$e.isText(n)&&0!==n.children.length;){var o=n.children.length-1;n=n.children[o],r.push(o)}return[n,r]},leaf(e,t){var r=xe.get(e,t);if(!$e.isText(r))throw new Error("Cannot get the leaf node at path [".concat(t,"] because it refers to a non-leaf node: ").concat(ze.stringify(r)));return r},levels(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return function*(){for(var n of oe.levels(t,r)){var o=xe.get(e,n);yield[o,n]}}()},matches:(e,t)=>be.isElement(e)&&be.isElementProps(t)&&be.matches(e,t)||$e.isText(e)&&$e.isTextProps(t)&&$e.matches(e,t),nodes(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function*(){for(var{pass:r,reverse:n=!1}=t,{from:o=[],to:i}=t,s=new Set,a=[],l=e;!i||!(n?oe.isBefore(a,i):oe.isAfter(a,i));)if(s.has(l)||(yield[l,a]),s.has(l)||$e.isText(l)||0===l.children.length||null!=r&&!1!==r([l,a])){if(0===a.length)break;if(!n){var c=oe.next(a);if(xe.has(e,c)){a=c,l=xe.get(e,a);continue}}if(n&&0!==a[a.length-1])a=oe.previous(a),l=xe.get(e,a);else a=oe.parent(a),l=xe.get(e,a),s.add(l)}else{s.add(l);var p=n?l.children.length-1:0;oe.isAncestor(a,o)&&(p=o[a.length]),a=a.concat(p),l=xe.get(e,a)}}()},parent(e,t){var r=oe.parent(t),n=xe.get(e,r);if($e.isText(n))throw new Error("Cannot get the parent of path [".concat(t,"] because it does not exist in the root."));return n},string:e=>$e.isText(e)?e.text:e.children.map(xe.string).join(""),texts(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function*(){for(var[r,n]of xe.nodes(e,t))$e.isText(r)&&(yield[r,n])}()}};function Pe(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function ke(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Pe(Object(r),!0).forEach((function(t){ae(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Pe(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var je={isNodeOperation:e=>je.isOperation(e)&&e.type.endsWith("_node"),isOperation(e){if(!d(e))return!1;switch(e.type){case"insert_node":case"remove_node":return oe.isPath(e.path)&&xe.isNode(e.node);case"insert_text":case"remove_text":return"number"==typeof e.offset&&"string"==typeof e.text&&oe.isPath(e.path);case"merge_node":return"number"==typeof e.position&&oe.isPath(e.path)&&d(e.properties);case"move_node":return oe.isPath(e.path)&&oe.isPath(e.newPath);case"set_node":return oe.isPath(e.path)&&d(e.properties)&&d(e.newProperties);case"set_selection":return null===e.properties&&ve.isRange(e.newProperties)||null===e.newProperties&&ve.isRange(e.properties)||d(e.properties)&&d(e.newProperties);case"split_node":return oe.isPath(e.path)&&"number"==typeof e.position&&d(e.properties);default:return!1}},isOperationList:e=>Array.isArray(e)&&e.every((e=>je.isOperation(e))),isSelectionOperation:e=>je.isOperation(e)&&e.type.endsWith("_selection"),isTextOperation:e=>je.isOperation(e)&&e.type.endsWith("_text"),inverse(e){switch(e.type){case"insert_node":return ke(ke({},e),{},{type:"remove_node"});case"insert_text":return ke(ke({},e),{},{type:"remove_text"});case"merge_node":return ke(ke({},e),{},{type:"split_node",path:oe.previous(e.path)});case"move_node":var{newPath:t,path:r}=e;if(oe.equals(t,r))return e;if(oe.isSibling(r,t))return ke(ke({},e),{},{path:t,newPath:r});var n=oe.transform(r,e),o=oe.transform(oe.next(r),e);return ke(ke({},e),{},{path:n,newPath:o});case"remove_node":return ke(ke({},e),{},{type:"insert_node"});case"remove_text":return ke(ke({},e),{},{type:"insert_text"});case"set_node":var{properties:i,newProperties:s}=e;return ke(ke({},e),{},{properties:s,newProperties:i});case"set_selection":var{properties:a,newProperties:l}=e;return ke(ke({},e),{},null==a?{properties:l,newProperties:null}:null==l?{properties:null,newProperties:a}:{properties:l,newProperties:a});case"split_node":return ke(ke({},e),{},{type:"merge_node",path:oe.next(e.path)})}}},Ee=new WeakMap,Se={above:(e,t)=>e.above(t),addMark(e,t,r){e.addMark(t,r)},after:(e,t,r)=>e.after(t,r),before:(e,t,r)=>e.before(t,r),deleteBackward(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{unit:r="character"}=t;e.deleteBackward(r)},deleteForward(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{unit:r="character"}=t;e.deleteForward(r)},deleteFragment(e,t){e.deleteFragment(t)},edges:(e,t)=>e.edges(t),elementReadOnly(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return e.elementReadOnly(t)},end:(e,t)=>e.end(t),first:(e,t)=>e.first(t),fragment:(e,t)=>e.fragment(t),hasBlocks:(e,t)=>e.hasBlocks(t),hasInlines:(e,t)=>e.hasInlines(t),hasPath:(e,t)=>e.hasPath(t),hasTexts:(e,t)=>e.hasTexts(t),insertBreak(e){e.insertBreak()},insertFragment(e,t,r){e.insertFragment(t,r)},insertNode(e,t){e.insertNode(t)},insertSoftBreak(e){e.insertSoftBreak()},insertText(e,t){e.insertText(t)},isBlock:(e,t)=>e.isBlock(t),isEdge:(e,t,r)=>e.isEdge(t,r),isEditor:e=>(e=>{var t=Ee.get(e);if(void 0!==t)return t;if(!d(e))return!1;var r="function"==typeof e.addMark&&"function"==typeof e.apply&&"function"==typeof e.deleteFragment&&"function"==typeof e.insertBreak&&"function"==typeof e.insertSoftBreak&&"function"==typeof e.insertFragment&&"function"==typeof e.insertNode&&"function"==typeof e.insertText&&"function"==typeof e.isElementReadOnly&&"function"==typeof e.isInline&&"function"==typeof e.isSelectable&&"function"==typeof e.isVoid&&"function"==typeof e.normalizeNode&&"function"==typeof e.onChange&&"function"==typeof e.removeMark&&"function"==typeof e.getDirtyPaths&&(null===e.marks||d(e.marks))&&(null===e.selection||ve.isRange(e.selection))&&xe.isNodeList(e.children)&&je.isOperationList(e.operations);return Ee.set(e,r),r})(e),isElementReadOnly:(e,t)=>e.isElementReadOnly(t),isEmpty:(e,t)=>e.isEmpty(t),isEnd:(e,t,r)=>e.isEnd(t,r),isInline:(e,t)=>e.isInline(t),isNormalizing:e=>e.isNormalizing(),isSelectable:(e,t)=>e.isSelectable(t),isStart:(e,t,r)=>e.isStart(t,r),isVoid:(e,t)=>e.isVoid(t),last:(e,t)=>e.last(t),leaf:(e,t,r)=>e.leaf(t,r),levels:(e,t)=>e.levels(t),marks:e=>e.getMarks(),next:(e,t)=>e.next(t),node:(e,t,r)=>e.node(t,r),nodes:(e,t)=>e.nodes(t),normalize(e,t){e.normalize(t)},parent:(e,t,r)=>e.parent(t,r),path:(e,t,r)=>e.path(t,r),pathRef:(e,t,r)=>e.pathRef(t,r),pathRefs:e=>e.pathRefs(),point:(e,t,r)=>e.point(t,r),pointRef:(e,t,r)=>e.pointRef(t,r),pointRefs:e=>e.pointRefs(),positions:(e,t)=>e.positions(t),previous:(e,t)=>e.previous(t),range:(e,t,r)=>e.range(t,r),rangeRef:(e,t,r)=>e.rangeRef(t,r),rangeRefs:e=>e.rangeRefs(),removeMark(e,t){e.removeMark(t)},setNormalizing(e,t){e.setNormalizing(t)},start:(e,t)=>e.start(t),string:(e,t,r)=>e.string(t,r),unhangRange:(e,t,r)=>e.unhangRange(t,r),void:(e,t)=>e.void(t),withoutNormalizing(e,t){e.withoutNormalizing(t)}};function Ne(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Ae(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Ne(Object(r),!0).forEach((function(t){ae(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Ne(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var Te={compare(e,t){var r=oe.compare(e.path,t.path);return 0===r?e.offset<t.offset?-1:e.offset>t.offset?1:0:r},isAfter:(e,t)=>1===Te.compare(e,t),isBefore:(e,t)=>-1===Te.compare(e,t),equals:(e,t)=>e.offset===t.offset&&oe.equals(e.path,t.path),isPoint:e=>d(e)&&"number"==typeof e.offset&&oe.isPath(e.path),transform(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return te(e,(e=>{if(null===e)return null;var{affinity:n="forward"}=r,{path:o,offset:i}=e;switch(t.type){case"insert_node":case"move_node":e.path=oe.transform(o,t,r);break;case"insert_text":oe.equals(t.path,o)&&(t.offset<i||t.offset===i&&"forward"===n)&&(e.offset+=t.text.length);break;case"merge_node":oe.equals(t.path,o)&&(e.offset+=t.position),e.path=oe.transform(o,t,r);break;case"remove_text":oe.equals(t.path,o)&&t.offset<=i&&(e.offset-=Math.min(i-t.offset,t.text.length));break;case"remove_node":if(oe.equals(t.path,o)||oe.isAncestor(t.path,o))return null;e.path=oe.transform(o,t,r);break;case"split_node":if(oe.equals(t.path,o)){if(t.position===i&&null==n)return null;(t.position<i||t.position===i&&"forward"===n)&&(e.offset-=t.position,e.path=oe.transform(o,t,Ae(Ae({},r),{},{affinity:"forward"})))}else e.path=oe.transform(o,t,r)}}))}},Ce=void 0,ze={setScrubber(e){Ce=e},stringify:e=>JSON.stringify(e,Ce)},Le=["text"],Be=["anchor","focus"];function De(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Re(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?De(Object(r),!0).forEach((function(t){ae(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):De(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var qe,$e={equals(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},{loose:n=!1}=r;function o(e){return he(e,Le)}return ue(n?o(e):e,n?o(t):t)},isText:e=>d(e)&&"string"==typeof e.text,isTextList:e=>Array.isArray(e)&&e.every((e=>$e.isText(e))),isTextProps:e=>void 0!==e.text,matches(e,t){for(var r in t)if("text"!==r&&(!e.hasOwnProperty(r)||e[r]!==t[r]))return!1;return!0},decorations(e,t){var r=[Re({},e)];for(var n of t){var o=he(n,Be),[i,s]=ve.edges(n),a=[],l=0,c=i.offset,p=s.offset;for(var f of r){var{length:d}=f.text,u=l;if(l+=d,c<=u&&l<=p)Object.assign(f,o),a.push(f);else if(c!==p&&(c===l||p===u)||c>l||p<u||p===u&&0!==u)a.push(f);else{var h=f,g=void 0,y=void 0;if(p<l){var v=p-u;y=Re(Re({},h),{},{text:h.text.slice(v)}),h=Re(Re({},h),{},{text:h.text.slice(0,v)})}if(c>u){var m=c-u;g=Re(Re({},h),{},{text:h.text.slice(0,m)}),h=Re(Re({},h),{},{text:h.text.slice(m)})}Object.assign(h,o),g&&a.push(g),a.push(h),y&&a.push(y)}}r=a}return r}},Fe=e=>e.selection?e.selection:e.children.length>0?Se.end(e,[]):[0];!function(e){e[e.None=0]="None",e[e.Extend=1]="Extend",e[e.ZWJ=2]="ZWJ",e[e.RI=4]="RI",e[e.Prepend=8]="Prepend",e[e.SpacingMark=16]="SpacingMark",e[e.L=32]="L",e[e.V=64]="V",e[e.T=128]="T",e[e.LV=256]="LV",e[e.LVT=512]="LVT",e[e.ExtPict=1024]="ExtPict",e[e.Any=2048]="Any"}(qe||(qe={})),qe.L,qe.L,qe.V,qe.LV,qe.LVT,qe.LV,qe.V,qe.V,qe.T,qe.LVT,qe.T,qe.T,qe.Any,qe.Extend,qe.ZWJ,qe.Any,qe.SpacingMark,qe.Prepend,qe.Any,qe.ZWJ,qe.ExtPict,qe.RI,qe.RI;var Me={delete(e,t){e.delete(t)},insertFragment(e,t,r){e.insertFragment(t,r)},insertText(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Se.withoutNormalizing(e,(()=>{var{voids:n=!1}=r,{at:o=Fe(e)}=r;if(oe.isPath(o)&&(o=Se.range(e,o)),ve.isRange(o))if(ve.isCollapsed(o))o=o.anchor;else{var i=ve.end(o);if(!n&&Se.void(e,{at:i}))return;var s=ve.start(o),a=Se.pointRef(e,s),l=Se.pointRef(e,i);We.delete(e,{at:o,voids:n});var c=a.unref(),p=l.unref();o=c||p,We.setSelection(e,{anchor:o,focus:o})}if(!(!n&&Se.void(e,{at:o})||Se.elementReadOnly(e,{at:o}))){var{path:f,offset:d}=o;t.length>0&&e.apply({type:"insert_text",path:f,offset:d,text:t})}}))}};function Ie(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Ve(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Ie(Object(r),!0).forEach((function(t){ae(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Ie(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var We=Ve(Ve(Ve(Ve({},pe),fe),de),Me);function Ke(e,i,{hotkeys:s,defaultBlock:a}){return l=>{Se.withoutNormalizing(i,(()=>{var c;const p=t(e);if(!i.selection||!p)return;const f=i.selection,{anchor:d}=f;if(s.isCmdEnter(l)){const t=Se.above(i,{at:d,match:e=>!Se.isEditor(e)&&be.isElement(e)&&"todo-list"===e.type,mode:"highest"});if(!t)return;const[n]=t,o=(null===(c=n.props)||void 0===c?void 0:c.checked)||!1;r.updateElement(e,p.id,{type:"todo-list",props:{checked:!o}})}else if(s.isEnter(l)){l.preventDefault();const t=Se.above(i,{at:d,match:e=>!Se.isEditor(e)&&be.isElement(e)&&("numbered-list"===e.type||"bulleted-list"===e.type||"todo-list"===e.type),mode:"highest"});if(!t)return;const[r,s]=t,c=Se.isEnd(i,d,s),f=Se.isStart(i,d,s),u=Se.string(i,s),h=0===p.meta.depth,g=u.trim().length>0;if(!g){if(h){const t=p.meta.order;return e.deleteBlock({blockId:p.id}),void e.insertBlock(a,{at:[t],focus:!0})}return void e.decreaseBlockDepth({blockId:p.id})}if(f){const t=n({type:p.type,meta:{order:p.meta.order,depth:p.meta.depth},value:[o({type:r.type,props:{nodeType:"block"}})]});return void e.insertBlock(t,{at:[p.meta.order],focus:!1})}if(g&&!f&&!c)return void e.splitBlock({slate:i,focus:!0});const y=n({type:p.type,meta:{order:p.meta.order+1,depth:p.meta.depth},value:[o({type:r.type,props:{nodeType:"block"}})]});e.insertBlock(y,{at:[p.meta.order+1],focus:!0})}else;}))}}const Ue={BulletedList:new i({type:"BulletedList",elements:{"bulleted-list":{render:t=>{var r,n=p(t,["extendRender"]);const{blockId:o,HTMLAttributes:i={},attributes:s,children:a}=n,{className:f=""}=i,d=p(i,["className"]),u=e(o),h=`yoopta-align-${(null===(r=null==u?void 0:u.meta)||void 0===r?void 0:r.align)||"left"}`;return l("div",Object.assign({className:`yoopta-bulleted-list ${h} ${f}`},d,s,{children:[c("span",Object.assign({className:"yoopta-bulleted-list-bullet",contentEditable:!1},{children:"•"})),c("span",Object.assign({className:"yoopta-bulleted-list-content"},{children:a}))]}))}}},options:{display:{title:"Bulleted List",description:"Create bullet list"},shortcuts:["-"]},events:{onKeyDown:Ke},parsers:{html:{deserialize:{nodeNames:["UL"],parse(e){if("UL"===e.nodeName){const t=e.querySelectorAll("li"),r=e.getAttribute("data-meta-align")||"left",o=parseInt(e.getAttribute("data-meta-depth")||"0",10),i=Array.from(t).filter((e=>{const t=e.textContent||"";return!/\[\s*\S?\s*\]/.test(t)})).map((e=>{const t=e.textContent||"";return n({id:s(),type:"BulletedList",value:[{id:s(),type:"bulleted-list",children:[{text:t}],props:{nodeType:"block"}}],meta:{order:0,depth:o,align:r}})}));if(i.length>0)return i}}},serialize:(e,t,r)=>{const{align:n="left",depth:o=0}=r||{};return`<ul data-meta-align="${n}" data-meta-depth="${o}" style="margin-left: ${o}px; text-align: ${n}"><li>${t}</li></ul>`}},markdown:{serialize:(e,t)=>`- ${t}`}}}),NumberedList:new i({type:"NumberedList",elements:{"numbered-list":{render:t=>{var r,{extendRender:n}=t,o=p(t,["extendRender"]);const{attributes:i,children:s,blockId:f,HTMLAttributes:d={}}=o,{className:u=""}=d,h=p(d,["className"]),g=e(f),y=function(e,t){const r=Object.keys(e.children).sort(((t,r)=>{const n=e.children[t],o=e.children[r];return n.meta.order-o.meta.order}));let n=0,o=!0;for(let i of r){const r=e.children[i];if("NumberedList"===r.type){if(o&&(n=0,o=!1),r.meta.depth===t.meta.depth&&"NumberedList"===r.type&&(n++,i===t.id))break}else o=!0}return n}(a(),g),v=`yoopta-align-${(null===(r=null==g?void 0:g.meta)||void 0===r?void 0:r.align)||"left"}`;return n?n(Object.assign(Object.assign({},o),{count:y})):l("div",Object.assign({className:`yoopta-numbered-list ${v} ${u}`},h,i,{children:[l("span",Object.assign({className:"yoopta-numbered-list-count",contentEditable:!1},{children:[y,"."]})),c("span",Object.assign({className:"yoopta-numbered-list-content"},{children:s}))]}))},props:{nodeType:"block"}}},options:{display:{title:"Numbered List",description:"Create list with numbering"},shortcuts:["1."]},events:{onKeyDown:Ke},parsers:{html:{deserialize:{nodeNames:["OL"],parse(e){if("OL"===e.nodeName){const t=e.querySelectorAll("li"),r=e.getAttribute("data-meta-align")||"left",o=parseInt(e.getAttribute("data-meta-depth")||"0",10),i=Array.from(t).filter((e=>{const t=e.textContent||"";return!/\[\s*\S?\s*\]/.test(t)})).map(((e,t)=>{const i=e.textContent||"";return n({id:s(),type:"NumberedList",value:[{id:s(),type:"numbered-list",children:[{text:i}],props:{nodeType:"block"}}],meta:{order:0,depth:o,align:r}})}));if(i.length>0)return i}}},serialize:(e,t,r)=>{const{align:n="left",depth:o=0}=r||{};return`<ol data-meta-align="${n}" data-meta-depth="${o}" style="margin-left: ${o}px; text-align: ${n}"><li>${t}</li></ol>`}},markdown:{serialize:(e,t)=>`- ${t}`}}}),TodoList:new i({type:"TodoList",elements:{"todo-list":{render:t=>{var n,{extendRender:o}=t,i=p(t,["extendRender"]);const{attributes:s,element:f,children:d,blockId:u,HTMLAttributes:h={}}=i,g=a(),y=e(u),{className:v=""}=h,m=p(h,["className"]),{checked:b=!1}=f.props||{},w={textDecoration:b?"line-through":"none"},O=`yoopta-align-${(null===(n=null==y?void 0:y.meta)||void 0===n?void 0:n.align)||"left"}`;return o?o(i):l("div",Object.assign({className:`yoopta-todo-list ${O} ${v}`,"data-checked":b},m,s,{children:[c("span",Object.assign({onClick:()=>r.updateElement(g,u,{type:"todo-list",props:{checked:!b}}),contentEditable:!1,className:"yoopta-todo-list-checkbox"},{children:c("input",{type:"checkbox",className:"yoopta-todo-list-checkbox-input",checked:b,disabled:g.readOnly})})),c("div",Object.assign({className:"yoopta-todo-list-content",style:w},{children:d}))]}))},props:{checked:!1}}},options:{display:{title:"Todo List",description:"Track tasks"},shortcuts:["[]"]},events:{onKeyDown:Ke},parsers:{html:{deserialize:{nodeNames:["OL","UL"],parse(e){if("OL"===e.nodeName||"UL"===e.nodeName){const t=e.querySelectorAll("li"),r=e.getAttribute("data-meta-align")||"left",o=parseInt(e.getAttribute("data-meta-depth")||"0",10),i=Array.from(t).filter((e=>{const t=e.textContent||"";return/\[\s*\S?\s*\]/.test(t)})).map((e=>{const t=e.textContent||"",i=/\[\s*x\s*\]/i.test(t),a=t.replace(/\[\s*\S?\s*\]/,"").trim();return n({id:s(),type:"TodoList",value:[{id:s(),type:"todo-list",children:[{text:a}],props:{nodeType:"block",checked:i}}],meta:{order:0,depth:o,align:r}})}));if(i.length>0)return i}}},serialize:(e,t,r)=>{const{align:n="left",depth:o=0}=r||{};return`<ul data-meta-align="${n}" data-meta-depth="${o}" style="margin-left: ${o}px; text-align: ${n}"><li>[${e.props.checked?"x":" "}] ${t}</li></ul>`}},markdown:{serialize:(e,t)=>`- ${e.props.checked?"[x]":"[ ]"} ${t}`}}})};!function(e,t){void 0===t&&(t={});var r=t.insertAt;if(e&&"undefined"!=typeof document){var n=document.head||document.getElementsByTagName("head")[0],o=document.createElement("style");o.type="text/css","top"===r&&n.firstChild?n.insertBefore(o,n.firstChild):n.appendChild(o),o.styleSheet?o.styleSheet.cssText=e:o.appendChild(document.createTextNode(e))}}(".yoopta-numbered-list{align-items:center;margin-left:10px;position:relative}.yoopta-numbered-list>:not([hidden])~:not([hidden]){--tw-space-x-reverse:0;margin-left:calc(.25rem*(1 - var(--tw-space-x-reverse)));margin-right:calc(.25rem*var(--tw-space-x-reverse))}.yoopta-numbered-list{font-size:16px;line-height:28px;padding-bottom:2px;padding-left:1rem;padding-top:2px}.yoopta-numbered-list-count{left:0;min-width:10px;position:absolute;top:2px;-webkit-user-select:none;-moz-user-select:none;user-select:none;width:auto}.yoopta-bulleted-list{align-items:center;margin-left:10px;position:relative}.yoopta-bulleted-list>:not([hidden])~:not([hidden]){--tw-space-x-reverse:0;margin-left:calc(.25rem*(1 - var(--tw-space-x-reverse)));margin-right:calc(.25rem*var(--tw-space-x-reverse))}.yoopta-bulleted-list{font-size:16px;line-height:1.75rem;padding-bottom:2px;padding-left:1rem;padding-top:2px}.yoopta-bulleted-list-bullet{font-weight:700;left:0;min-width:10px;position:absolute;top:0;-webkit-user-select:none;-moz-user-select:none;user-select:none;width:auto}.yoopta-bulleted-list-content{margin-left:0}.yoopta-todo-list{align-items:center;margin-left:10px;position:relative}.yoopta-todo-list>:not([hidden])~:not([hidden]){--tw-space-x-reverse:0;margin-left:calc(.25rem*(1 - var(--tw-space-x-reverse)));margin-right:calc(.25rem*var(--tw-space-x-reverse))}.yoopta-todo-list{font-size:16px;line-height:28px;padding-bottom:2px;padding-left:1rem;padding-top:2px}.yoopta-todo-list-checkbox{cursor:pointer;left:0;position:absolute;top:4px;-webkit-user-select:none;-moz-user-select:none;user-select:none}.yoopta-todo-list-checkbox-input{min-width:10px;width:auto}");const Je=Ue.NumberedList,Ze=Ue.BulletedList,He=Ue.TodoList;export{Ze as BulletedList,Je as NumberedList,He as TodoList,Ue as default};
@@ -1 +1 @@
1
- {"version":3,"file":"BulletedList.d.ts","sourceRoot":"","sources":["../../src/plugin/BulletedList.tsx"],"names":[],"mappings":"AAAA,OAAO,EAA+C,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAI3F,OAAO,EAAE,mBAAmB,EAA0B,MAAM,UAAU,CAAC;AAEvE,QAAA,MAAM,YAAY,6EAkEhB,CAAC;AAEH,OAAO,EAAE,YAAY,EAAE,CAAC"}
1
+ {"version":3,"file":"BulletedList.d.ts","sourceRoot":"","sources":["../../src/plugin/BulletedList.tsx"],"names":[],"mappings":"AAAA,OAAO,EAA+C,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAI3F,OAAO,EAAE,mBAAmB,EAA0B,MAAM,UAAU,CAAC;AAEvE,QAAA,MAAM,YAAY,6EAqEhB,CAAC;AAEH,OAAO,EAAE,YAAY,EAAE,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"NumberedList.d.ts","sourceRoot":"","sources":["../../src/plugin/NumberedList.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAA+C,MAAM,gBAAgB,CAAC;AAG3F,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAE5C,QAAA,MAAM,YAAY,0EAoEhB,CAAC;AAEH,OAAO,EAAE,YAAY,EAAE,CAAC"}
1
+ {"version":3,"file":"NumberedList.d.ts","sourceRoot":"","sources":["../../src/plugin/NumberedList.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAA+C,MAAM,gBAAgB,CAAC;AAG3F,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAE5C,QAAA,MAAM,YAAY,0EAuEhB,CAAC;AAEH,OAAO,EAAE,YAAY,EAAE,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"TodoList.d.ts","sourceRoot":"","sources":["../../src/plugin/TodoList.tsx"],"names":[],"mappings":"AAAA,OAAO,EAA+C,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAG3F,OAAO,EAAE,oBAAoB,EAAsB,MAAM,UAAU,CAAC;AAEpE,QAAA,MAAM,QAAQ,0EA2EZ,CAAC;AAEH,OAAO,EAAE,QAAQ,EAAE,CAAC"}
1
+ {"version":3,"file":"TodoList.d.ts","sourceRoot":"","sources":["../../src/plugin/TodoList.tsx"],"names":[],"mappings":"AAAA,OAAO,EAA+C,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAG3F,OAAO,EAAE,oBAAoB,EAAsB,MAAM,UAAU,CAAC;AAEpE,QAAA,MAAM,QAAQ,0EA8EZ,CAAC;AAEH,OAAO,EAAE,QAAQ,EAAE,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yoopta/lists",
3
- "version": "4.6.9-rc.1",
3
+ "version": "4.6.10-rc.0",
4
4
  "description": "Lists plugin for Yoopta Editor",
5
5
  "author": "Darginec05 <devopsbanda@gmail.com>",
6
6
  "homepage": "https://github.com/Darginec05/Editor-Yoopta#readme",
@@ -34,5 +34,5 @@
34
34
  "bugs": {
35
35
  "url": "https://github.com/Darginec05/Editor-Yoopta/issues"
36
36
  },
37
- "gitHead": "cbdd6ffa161430772548600ff0638e40fbdff888"
37
+ "gitHead": "09c689ab59779c6b1a51942d5e65e6bd2d3decfe"
38
38
  }