@yoopta/link 4.6.8-rc.2 → 4.6.9-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.d.ts CHANGED
@@ -1,10 +1,11 @@
1
1
  import { Link } from './plugin';
2
2
  import './styles.css';
3
- import { LinkElement } from './types';
3
+ import { LinkElement, LinkElementProps } from './types';
4
4
  declare module 'slate' {
5
5
  interface CustomTypes {
6
6
  Element: LinkElement;
7
7
  }
8
8
  }
9
+ export { LinkElement, LinkElementProps };
9
10
  export default Link;
10
11
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAChC,OAAO,cAAc,CAAC;AACtB,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAEtC,OAAO,QAAQ,OAAO,CAAC;IACrB,UAAU,WAAW;QACnB,OAAO,EAAE,WAAW,CAAC;KACtB;CACF;AAED,eAAe,IAAI,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAChC,OAAO,cAAc,CAAC;AACtB,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAExD,OAAO,QAAQ,OAAO,CAAC;IACrB,UAAU,WAAW;QACnB,OAAO,EAAE,WAAW,CAAC;KACtB;CACF;AAED,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAE,CAAC;AAEzC,eAAe,IAAI,CAAC"}
package/dist/index.js CHANGED
@@ -29,4 +29,4 @@ const b=(...e)=>e.filter(((e,t,n)=>Boolean(e)&&n.indexOf(e)===t)).join(" ")
29
29
  *
30
30
  * Copyright (c) 2014-2017, Jon Schlinkert.
31
31
  * Released under the MIT License.
32
- */function Xe(e){return"[object Object]"===Object.prototype.toString.call(e)}function Ye(e){var t,n;return!1!==Xe(e)&&(void 0===(t=e.constructor)||!1!==Xe(n=t.prototype)&&!1!==n.hasOwnProperty("isPrototypeOf"))}var Ge=Symbol.for("immer-nothing"),Qe=Symbol.for("immer-draftable"),et=Symbol.for("immer-state");function tt(e,...t){throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var nt=Object.getPrototypeOf;function rt(e){return!!e&&!!e[et]}function ot(e){return!!e&&(st(e)||Array.isArray(e)||!!e[Qe]||!!e.constructor?.[Qe]||ut(e)||pt(e))}var it=Object.prototype.constructor.toString();function st(e){if(!e||"object"!=typeof e)return!1;const t=nt(e);if(null===t)return!0;const n=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;return n===Object||"function"==typeof n&&Function.toString.call(n)===it}function at(e,t){0===lt(e)?Reflect.ownKeys(e).forEach((n=>{t(n,e[n],e)})):e.forEach(((n,r)=>t(r,n,e)))}function lt(e){const t=e[et];return t?t.type_:Array.isArray(e)?1:ut(e)?2:pt(e)?3:0}function ct(e,t){return 2===lt(e)?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function ft(e,t,n){const r=lt(e);2===r?e.set(t,n):3===r?e.add(n):e[t]=n}function ut(e){return e instanceof Map}function pt(e){return e instanceof Set}function dt(e){return e.copy_||e.base_}function ht(e,t){if(ut(e))return new Map(e);if(pt(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);if(!t&&st(e)){if(!nt(e)){const t=Object.create(null);return Object.assign(t,e)}return{...e}}const n=Object.getOwnPropertyDescriptors(e);delete n[et];let r=Reflect.ownKeys(n);for(let t=0;t<r.length;t++){const o=r[t],i=n[o];!1===i.writable&&(i.writable=!0,i.configurable=!0),(i.get||i.set)&&(n[o]={configurable:!0,writable:!0,enumerable:i.enumerable,value:e[o]})}return Object.create(nt(e),n)}function gt(e,t=!1){return mt(e)||rt(e)||!ot(e)||(lt(e)>1&&(e.set=e.add=e.clear=e.delete=yt),Object.freeze(e),t&&Object.entries(e).forEach((([e,t])=>gt(t,!0)))),e}function yt(){tt(2)}function mt(e){return Object.isFrozen(e)}var vt,bt={};function wt(e){const t=bt[e];return t||tt(0),t}function xt(){return vt}function Ot(e,t){t&&(wt("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function _t(e){Pt(e),e.drafts_.forEach(jt),e.drafts_=null}function Pt(e){e===vt&&(vt=e.parent_)}function kt(e){return vt={drafts_:[],parent_:vt,immer_:e,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function jt(e){const t=e[et];0===t.type_||1===t.type_?t.revoke_():t.revoked_=!0}function Et(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];return void 0!==e&&e!==n?(n[et].modified_&&(_t(t),tt(4)),ot(e)&&(e=St(t,e),t.parent_||At(t,e)),t.patches_&&wt("Patches").generateReplacementPatches_(n[et].base_,e,t.patches_,t.inversePatches_)):e=St(t,n,[]),_t(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==Ge?e:void 0}function St(e,t,n){if(mt(t))return t;const r=t[et];if(!r)return at(t,((o,i)=>Rt(e,r,t,o,i,n))),t;if(r.scope_!==e)return t;if(!r.modified_)return At(e,r.base_,!0),r.base_;if(!r.finalized_){r.finalized_=!0,r.scope_.unfinalizedDrafts_--;const t=r.copy_;let o=t,i=!1;3===r.type_&&(o=new Set(t),t.clear(),i=!0),at(o,((o,s)=>Rt(e,r,t,o,s,n,i))),At(e,t,!1),n&&e.patches_&&wt("Patches").generatePatches_(r,n,e.patches_,e.inversePatches_)}return r.copy_}function Rt(e,t,n,r,o,i,s){if(rt(o)){const s=St(e,o,i&&t&&3!==t.type_&&!ct(t.assigned_,r)?i.concat(r):void 0);if(ft(n,r,s),!rt(s))return;e.canAutoFreeze_=!1}else s&&n.add(o);if(ot(o)&&!mt(o)){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1)return;St(e,o),t&&t.scope_.parent_||"symbol"==typeof r||!Object.prototype.propertyIsEnumerable.call(n,r)||At(e,o)}}function At(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&gt(t,n)}var Ct={get(e,t){if(t===et)return e;const n=dt(e);if(!ct(n,t))return function(e,t,n){const r=Lt(t,n);return r?"value"in r?r.value:r.get?.call(e.draft_):void 0}(e,n,t);const r=n[t];return e.finalized_||!ot(r)?r:r===Nt(e.base_,t)?(zt(e),e.copy_[t]=Mt(r,e)):r},has:(e,t)=>t in dt(e),ownKeys:e=>Reflect.ownKeys(dt(e)),set(e,t,n){const r=Lt(dt(e),t);if(r?.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){const r=Nt(dt(e),t),s=r?.[et];if(s&&s.base_===n)return e.copy_[t]=n,e.assigned_[t]=!1,!0;if(((o=n)===(i=r)?0!==o||1/o==1/i:o!=o&&i!=i)&&(void 0!==n||ct(e.base_,t)))return!0;zt(e),Dt(e)}var o,i;return e.copy_[t]===n&&(void 0!==n||t in e.copy_)||Number.isNaN(n)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=n,e.assigned_[t]=!0),!0},deleteProperty:(e,t)=>(void 0!==Nt(e.base_,t)||t in e.base_?(e.assigned_[t]=!1,zt(e),Dt(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0),getOwnPropertyDescriptor(e,t){const n=dt(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r?{writable:!0,configurable:1!==e.type_||"length"!==t,enumerable:r.enumerable,value:n[t]}:r},defineProperty(){tt(11)},getPrototypeOf:e=>nt(e.base_),setPrototypeOf(){tt(12)}},Tt={};function Nt(e,t){const n=e[et];return(n?dt(n):e)[t]}function Lt(e,t){if(!(t in e))return;let n=nt(e);for(;n;){const e=Object.getOwnPropertyDescriptor(n,t);if(e)return e;n=nt(n)}}function Dt(e){e.modified_||(e.modified_=!0,e.parent_&&Dt(e.parent_))}function zt(e){e.copy_||(e.copy_=ht(e.base_,e.scope_.immer_.useStrictShallowCopy_))}at(Ct,((e,t)=>{Tt[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}})),Tt.deleteProperty=function(e,t){return Tt.set.call(this,e,t,void 0)},Tt.set=function(e,t,n){return Ct.set.call(this,e[0],t,n,e[0])};function Mt(e,t){const n=ut(e)?wt("MapSet").proxyMap_(e,t):pt(e)?wt("MapSet").proxySet_(e,t):function(e,t){const n=Array.isArray(e),r={type_:n?1:0,scope_:t?t.scope_:xt(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let o=r,i=Ct;n&&(o=[r],i=Tt);const{revoke:s,proxy:a}=Proxy.revocable(o,i);return r.draft_=a,r.revoke_=s,a}(e,t);return(t?t.scope_:xt()).drafts_.push(n),n}function Ft(e){if(!ot(e)||mt(e))return e;const t=e[et];let n;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=ht(e,t.scope_.immer_.useStrictShallowCopy_)}else n=ht(e,!0);return at(n,((e,t)=>{ft(n,e,Ft(t))})),t&&(t.finalized_=!1),n}var Bt=new class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.produce=(e,t,n)=>{if("function"==typeof e&&"function"!=typeof t){const n=t;t=e;const r=this;return function(e=n,...o){return r.produce(e,(e=>t.call(this,e,...o)))}}let r;if("function"!=typeof t&&tt(6),void 0!==n&&"function"!=typeof n&&tt(7),ot(e)){const o=kt(this),i=Mt(e,void 0);let s=!0;try{r=t(i),s=!1}finally{s?_t(o):Pt(o)}return Ot(o,n),Et(r,o)}if(!e||"object"!=typeof e){if(r=t(e),void 0===r&&(r=e),r===Ge&&(r=void 0),this.autoFreeze_&&gt(r,!0),n){const t=[],o=[];wt("Patches").generateReplacementPatches_(e,r,t,o),n(t,o)}return r}tt(1)},this.produceWithPatches=(e,t)=>{if("function"==typeof e)return(t,...n)=>this.produceWithPatches(t,(t=>e(t,...n)));let n,r;return[this.produce(e,t,((e,t)=>{n=e,r=t})),n,r]},"boolean"==typeof e?.autoFreeze&&this.setAutoFreeze(e.autoFreeze),"boolean"==typeof e?.useStrictShallowCopy&&this.setUseStrictShallowCopy(e.useStrictShallowCopy)}createDraft(e){ot(e)||tt(8),rt(e)&&(e=function(e){rt(e)||tt(10);return Ft(e)}(e));const t=kt(this),n=Mt(e,void 0);return n[et].isManual_=!0,Pt(t),n}finishDraft(e,t){const n=e&&e[et];n&&n.isManual_||tt(9);const{scope_:r}=n;return Ot(r,t),Et(void 0,r)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}applyPatches(e,t){let n;for(n=t.length-1;n>=0;n--){const r=t[n];if(0===r.path.length&&"replace"===r.op){e=r.value;break}}n>-1&&(t=t.slice(n+1));const r=wt("Patches").applyPatches_;return rt(e)?r(e,t):this.produce(e,(e=>r(e,t)))}},qt=Bt.produce;Bt.produceWithPatches.bind(Bt),Bt.setAutoFreeze.bind(Bt),Bt.setUseStrictShallowCopy.bind(Bt),Bt.applyPatches.bind(Bt);var Wt=Bt.createDraft.bind(Bt),Vt=Bt.finishDraft.bind(Bt),It={ancestors(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{reverse:n=!1}=t,r=It.levels(e,t);return r=n?r.slice(1):r.slice(0,-1)},common(e,t){for(var n=[],r=0;r<e.length&&r<t.length;r++){var o=e[r];if(o!==t[r])break;n.push(o)}return n},compare(e,t){for(var n=Math.min(e.length,t.length),r=0;r<n;r++){if(e[r]<t[r])return-1;if(e[r]>t[r])return 1}return 0},endsAfter(e,t){var n=e.length-1,r=e.slice(0,n),o=t.slice(0,n),i=e[n],s=t[n];return It.equals(r,o)&&i>s},endsAt(e,t){var n=e.length,r=e.slice(0,n),o=t.slice(0,n);return It.equals(r,o)},endsBefore(e,t){var n=e.length-1,r=e.slice(0,n),o=t.slice(0,n),i=e[n],s=t[n];return It.equals(r,o)&&i<s},equals:(e,t)=>e.length===t.length&&e.every(((e,n)=>e===t[n])),hasPrevious:e=>e[e.length-1]>0,isAfter:(e,t)=>1===It.compare(e,t),isAncestor:(e,t)=>e.length<t.length&&0===It.compare(e,t),isBefore:(e,t)=>-1===It.compare(e,t),isChild:(e,t)=>e.length===t.length+1&&0===It.compare(e,t),isCommon:(e,t)=>e.length<=t.length&&0===It.compare(e,t),isDescendant:(e,t)=>e.length>t.length&&0===It.compare(e,t),isParent:(e,t)=>e.length+1===t.length&&0===It.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 n=e.slice(0,-1),r=t.slice(0,-1);return e[e.length-1]!==t[t.length-1]&&It.equals(n,r)},levels(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{reverse:n=!1}=t,r=[],o=0;o<=e.length;o++)r.push(e.slice(0,o));return n&&r.reverse(),r},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(!It.isAncestor(t,e)&&!It.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 n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!e)return null;var r=[...e],{affinity:o="forward"}=n;if(0===e.length)return r;switch(t.type){case"insert_node":var{path:i}=t;(It.equals(i,r)||It.endsBefore(i,r)||It.isAncestor(i,r))&&(r[i.length-1]+=1);break;case"remove_node":var{path:s}=t;if(It.equals(s,r)||It.isAncestor(s,r))return null;It.endsBefore(s,r)&&(r[s.length-1]-=1);break;case"merge_node":var{path:a,position:l}=t;It.equals(a,r)||It.endsBefore(a,r)?r[a.length-1]-=1:It.isAncestor(a,r)&&(r[a.length-1]-=1,r[a.length]+=l);break;case"split_node":var{path:c,position:f}=t;if(It.equals(c,r)){if("forward"===o)r[r.length-1]+=1;else if("backward"!==o)return null}else It.endsBefore(c,r)?r[c.length-1]+=1:It.isAncestor(c,r)&&e[c.length]>=f&&(r[c.length-1]+=1,r[c.length]-=f);break;case"move_node":var{path:u,newPath:p}=t;if(It.equals(u,p))return r;if(It.isAncestor(u,r)||It.equals(u,r)){var d=p.slice();return It.endsBefore(u,p)&&u.length<p.length&&(d[u.length-1]-=1),d.concat(r.slice(u.length))}It.isSibling(u,p)&&(It.isAncestor(p,r)||It.equals(p,r))?It.endsBefore(u,r)?r[u.length-1]-=1:r[u.length-1]+=1:It.endsBefore(p,r)||It.equals(p,r)||It.isAncestor(p,r)?(It.endsBefore(u,r)&&(r[u.length-1]-=1),r[p.length-1]+=1):It.endsBefore(u,r)&&(It.equals(p,r)&&(r[p.length-1]+=1),r[u.length-1]-=1)}return r}};function Ht(e){return Ht="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},Ht(e)}function $t(e){var t=function(e,t){if("object"!==Ht(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!==Ht(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===Ht(t)?t:String(t)}function Zt(e,t,n){return(t=$t(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Jt(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Kt(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Jt(Object(n),!0).forEach((function(t){Zt(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Jt(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var Ut={transform(e,t){e.children=Wt(e.children);var n=e.selection&&Wt(e.selection);try{n=((e,t,n)=>{switch(n.type){case"insert_node":var{path:r,node:o}=n,i=cn.parent(e,r),s=r[r.length-1];if(s>i.children.length)throw new Error('Cannot apply an "insert_node" operation at path ['.concat(r,"] because the destination is past the end of the node."));if(i.children.splice(s,0,o),t)for(var[a,l]of nn.points(t))t[l]=mn.transform(a,n);break;case"insert_text":var{path:c,offset:f,text:u}=n;if(0===u.length)break;var p=cn.leaf(e,c),d=p.text.slice(0,f),h=p.text.slice(f);if(p.text=d+u+h,t)for(var[g,y]of nn.points(t))t[y]=mn.transform(g,n);break;case"merge_node":var{path:m}=n,v=cn.get(e,m),b=It.previous(m),w=cn.get(e,b),x=cn.parent(e,m),O=m[m.length-1];if(kn.isText(v)&&kn.isText(w))w.text+=v.text;else{if(kn.isText(v)||kn.isText(w))throw new Error('Cannot apply a "merge_node" operation at path ['.concat(m,"] to nodes of different interfaces: ").concat(bn.stringify(v)," ").concat(bn.stringify(w)));w.children.push(...v.children)}if(x.children.splice(O,1),t)for(var[_,P]of nn.points(t))t[P]=mn.transform(_,n);break;case"move_node":var{path:k,newPath:j}=n;if(It.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=cn.get(e,k),S=cn.parent(e,k),R=k[k.length-1];S.children.splice(R,1);var A=It.transform(k,n),C=cn.get(e,It.parent(A)),T=A[A.length-1];if(C.children.splice(T,0,E),t)for(var[N,L]of nn.points(t))t[L]=mn.transform(N,n);break;case"remove_node":var{path:D}=n,z=D[D.length-1];if(cn.parent(e,D).children.splice(z,1),t)for(var[M,F]of nn.points(t)){var B=mn.transform(M,n);if(null!=t&&null!=B)t[F]=B;else{var q=void 0,W=void 0;for(var[V,I]of cn.texts(e)){if(-1!==It.compare(I,D)){W=[V,I];break}q=[V,I]}var H=!1;q&&W&&(H=It.equals(W[1],D)?!It.hasPrevious(W[1]):It.common(q[1],D).length<It.common(W[1],D).length),q&&!H?(M.path=q[1],M.offset=q[0].text.length):W?(M.path=W[1],M.offset=0):t=null}}break;case"remove_text":var{path:$,offset:Z,text:J}=n;if(0===J.length)break;var K=cn.leaf(e,$),U=K.text.slice(0,Z),X=K.text.slice(Z+J.length);if(K.text=U+X,t)for(var[Y,G]of nn.points(t))t[G]=mn.transform(Y,n);break;case"set_node":var{path:Q,properties:ee,newProperties:te}=n;if(0===Q.length)throw new Error("Cannot set properties on the root node!");var ne=cn.get(e,Q);for(var re in te){if("children"===re||"text"===re)throw new Error('Cannot set the "'.concat(re,'" property of nodes!'));var oe=te[re];null==oe?delete ne[re]:ne[re]=oe}for(var ie in ee)te.hasOwnProperty(ie)||delete ne[ie];break;case"set_selection":var{newProperties:se}=n;if(null==se)t=se;else{if(null==t){if(!nn.isRange(se))throw new Error('Cannot apply an incomplete "set_selection" operation properties '.concat(bn.stringify(se)," when there is no current selection."));t=Kt({},se)}for(var ae in se){var le=se[ae];if(null==le){if("anchor"===ae||"focus"===ae)throw new Error('Cannot remove the "'.concat(ae,'" selection property'));delete t[ae]}else t[ae]=le}}break;case"split_node":var{path:ce,position:fe,properties:ue}=n;if(0===ce.length)throw new Error('Cannot apply a "split_node" operation at path ['.concat(ce,"] because the root node cannot be split."));var pe,de=cn.get(e,ce),he=cn.parent(e,ce),ge=ce[ce.length-1];if(kn.isText(de)){var ye=de.text.slice(0,fe),me=de.text.slice(fe);de.text=ye,pe=Kt(Kt({},ue),{},{text:me})}else{var ve=de.children.slice(0,fe),be=de.children.slice(fe);de.children=ve,pe=Kt(Kt({},ue),{},{children:be})}if(he.children.splice(ge+1,0,pe),t)for(var[we,xe]of nn.points(t))t[xe]=mn.transform(we,n)}return t})(e,n,t)}finally{e.children=Vt(e.children),e.selection=n?rt(n)?Vt(n):n:null}}},Xt={insertNodes(e,t,n){e.insertNodes(t,n)},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,n){e.setNodes(t,n)},splitNodes(e,t){e.splitNodes(t)},unsetNodes(e,t,n){e.unsetNodes(t,n)},unwrapNodes(e,t){e.unwrapNodes(t)},wrapNodes(e,t,n){e.wrapNodes(t,n)}},Yt={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,n){e.setPoint(t,n)},setSelection(e,t){e.setSelection(t)}},Gt=(e,t)=>{for(var n in e){var r=e[n],o=t[n];if(Ye(r)&&Ye(o)){if(!Gt(r,o))return!1}else if(Array.isArray(r)&&Array.isArray(o)){if(r.length!==o.length)return!1;for(var i=0;i<r.length;i++)if(r[i]!==o[i])return!1}else if(r!==o)return!1}for(var s in t)if(void 0===e[s]&&void 0!==t[s])return!1;return!0};function Qt(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var en=["anchor","focus"];function tn(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}var nn={edges(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{reverse:n=!1}=t,{anchor:r,focus:o}=e;return nn.isBackward(e)===n?[r,o]:[o,r]},end(e){var[,t]=nn.edges(e);return t},equals:(e,t)=>mn.equals(e.anchor,t.anchor)&&mn.equals(e.focus,t.focus),includes(e,t){if(nn.isRange(t)){if(nn.includes(e,t.anchor)||nn.includes(e,t.focus))return!0;var[n,r]=nn.edges(e),[o,i]=nn.edges(t);return mn.isBefore(n,o)&&mn.isAfter(r,i)}var[s,a]=nn.edges(e),l=!1,c=!1;return mn.isPoint(t)?(l=mn.compare(t,s)>=0,c=mn.compare(t,a)<=0):(l=It.compare(t,s.path)>=0,c=It.compare(t,a.path)<=0),l&&c},intersection(e,t){var n=Qt(e,en),[r,o]=nn.edges(e),[i,s]=nn.edges(t),a=mn.isBefore(r,i)?i:r,l=mn.isBefore(o,s)?o:s;return mn.isBefore(l,a)?null:function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?tn(Object(n),!0).forEach((function(t){Zt(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):tn(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}({anchor:a,focus:l},n)},isBackward(e){var{anchor:t,focus:n}=e;return mn.isAfter(t,n)},isCollapsed(e){var{anchor:t,focus:n}=e;return mn.equals(t,n)},isExpanded:e=>!nn.isCollapsed(e),isForward:e=>!nn.isBackward(e),isRange:e=>Ye(e)&&mn.isPoint(e.anchor)&&mn.isPoint(e.focus),*points(e){yield[e.anchor,"anchor"],yield[e.focus,"focus"]},start(e){var[t]=nn.edges(e);return t},transform(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return qt(e,(e=>{if(null===e)return null;var r,o,{affinity:i="inward"}=n;if("inward"===i){var s=nn.isCollapsed(e);nn.isForward(e)?(r="forward",o=s?r:"backward"):(r="backward",o=s?r:"forward")}else"outward"===i?nn.isForward(e)?(r="backward",o="forward"):(r="forward",o="backward"):(r=i,o=i);var a=mn.transform(e.anchor,t,{affinity:r}),l=mn.transform(e.focus,t,{affinity:o});if(!a||!l)return null;e.anchor=a,e.focus=l}))}},rn=e=>Ye(e)&&cn.isNodeList(e.children)&&!hn.isEditor(e),on={isAncestor:e=>Ye(e)&&cn.isNodeList(e.children),isElement:rn,isElementList:e=>Array.isArray(e)&&e.every((e=>on.isElement(e))),isElementProps:e=>void 0!==e.children,isElementType:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"type";return rn(e)&&e[n]===t},matches(e,t){for(var n in t)if("children"!==n&&e[n]!==t[n])return!1;return!0}},sn=["children"],an=["text"],ln=new WeakMap,cn={ancestor(e,t){var n=cn.get(e,t);if(kn.isText(n))throw new Error("Cannot get the ancestor node at path [".concat(t,"] because it refers to a text node instead: ").concat(bn.stringify(n)));return n},ancestors(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return function*(){for(var r of It.ancestors(t,n)){var o=[cn.ancestor(e,r),r];yield o}}()},child(e,t){if(kn.isText(e))throw new Error("Cannot get the child of a text node: ".concat(bn.stringify(e)));var n=e.children[t];if(null==n)throw new Error("Cannot get child at index `".concat(t,"` in node: ").concat(bn.stringify(e)));return n},children(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return function*(){for(var{reverse:r=!1}=n,o=cn.ancestor(e,t),{children:i}=o,s=r?i.length-1:0;r?s>=0:s<i.length;){var a=cn.child(o,s),l=t.concat(s);yield[a,l],s=r?s-1:s+1}}()},common(e,t,n){var r=It.common(t,n);return[cn.get(e,r),r]},descendant(e,t){var n=cn.get(e,t);if(hn.isEditor(n))throw new Error("Cannot get the descendant node at path [".concat(t,"] because it refers to the root editor node instead: ").concat(bn.stringify(n)));return n},descendants(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function*(){for(var[n,r]of cn.nodes(e,t))0!==r.length&&(yield[n,r])}()},elements(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function*(){for(var[n,r]of cn.nodes(e,t))on.isElement(n)&&(yield[n,r])}()},extractProps:e=>on.isAncestor(e)?Qt(e,sn):Qt(e,an),first(e,t){for(var n=t.slice(),r=cn.get(e,n);r&&!kn.isText(r)&&0!==r.children.length;)r=r.children[0],n.push(0);return[r,n]},fragment(e,t){if(kn.isText(e))throw new Error("Cannot get a fragment starting from a root text node: ".concat(bn.stringify(e)));var n=qt({children:e.children},(e=>{var[n,r]=nn.edges(t),o=cn.nodes(e,{reverse:!0,pass:e=>{var[,n]=e;return!nn.includes(t,n)}});for(var[,i]of o){if(!nn.includes(t,i)){var s=cn.parent(e,i),a=i[i.length-1];s.children.splice(a,1)}if(It.equals(i,r.path)){var l=cn.leaf(e,i);l.text=l.text.slice(0,r.offset)}if(It.equals(i,n.path)){var c=cn.leaf(e,i);c.text=c.text.slice(n.offset)}}hn.isEditor(e)&&(e.selection=null)}));return n.children},get(e,t){for(var n=e,r=0;r<t.length;r++){var o=t[r];if(kn.isText(n)||!n.children[o])throw new Error("Cannot find a descendant at path [".concat(t,"] in node: ").concat(bn.stringify(e)));n=n.children[o]}return n},has(e,t){for(var n=e,r=0;r<t.length;r++){var o=t[r];if(kn.isText(n)||!n.children[o])return!1;n=n.children[o]}return!0},isNode:e=>kn.isText(e)||on.isElement(e)||hn.isEditor(e),isNodeList(e){if(!Array.isArray(e))return!1;var t=ln.get(e);if(void 0!==t)return t;var n=e.every((e=>cn.isNode(e)));return ln.set(e,n),n},last(e,t){for(var n=t.slice(),r=cn.get(e,n);r&&!kn.isText(r)&&0!==r.children.length;){var o=r.children.length-1;r=r.children[o],n.push(o)}return[r,n]},leaf(e,t){var n=cn.get(e,t);if(!kn.isText(n))throw new Error("Cannot get the leaf node at path [".concat(t,"] because it refers to a non-leaf node: ").concat(bn.stringify(n)));return n},levels(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return function*(){for(var r of It.levels(t,n)){var o=cn.get(e,r);yield[o,r]}}()},matches:(e,t)=>on.isElement(e)&&on.isElementProps(t)&&on.matches(e,t)||kn.isText(e)&&kn.isTextProps(t)&&kn.matches(e,t),nodes(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function*(){for(var{pass:n,reverse:r=!1}=t,{from:o=[],to:i}=t,s=new Set,a=[],l=e;!i||!(r?It.isBefore(a,i):It.isAfter(a,i));)if(s.has(l)||(yield[l,a]),s.has(l)||kn.isText(l)||0===l.children.length||null!=n&&!1!==n([l,a])){if(0===a.length)break;if(!r){var c=It.next(a);if(cn.has(e,c)){a=c,l=cn.get(e,a);continue}}if(r&&0!==a[a.length-1])a=It.previous(a),l=cn.get(e,a);else a=It.parent(a),l=cn.get(e,a),s.add(l)}else{s.add(l);var f=r?l.children.length-1:0;It.isAncestor(a,o)&&(f=o[a.length]),a=a.concat(f),l=cn.get(e,a)}}()},parent(e,t){var n=It.parent(t),r=cn.get(e,n);if(kn.isText(r))throw new Error("Cannot get the parent of path [".concat(t,"] because it does not exist in the root."));return r},string:e=>kn.isText(e)?e.text:e.children.map(cn.string).join(""),texts(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function*(){for(var[n,r]of cn.nodes(e,t))kn.isText(n)&&(yield[n,r])}()}};function fn(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function un(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?fn(Object(n),!0).forEach((function(t){Zt(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):fn(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var pn={isNodeOperation:e=>pn.isOperation(e)&&e.type.endsWith("_node"),isOperation(e){if(!Ye(e))return!1;switch(e.type){case"insert_node":case"remove_node":return It.isPath(e.path)&&cn.isNode(e.node);case"insert_text":case"remove_text":return"number"==typeof e.offset&&"string"==typeof e.text&&It.isPath(e.path);case"merge_node":return"number"==typeof e.position&&It.isPath(e.path)&&Ye(e.properties);case"move_node":return It.isPath(e.path)&&It.isPath(e.newPath);case"set_node":return It.isPath(e.path)&&Ye(e.properties)&&Ye(e.newProperties);case"set_selection":return null===e.properties&&nn.isRange(e.newProperties)||null===e.newProperties&&nn.isRange(e.properties)||Ye(e.properties)&&Ye(e.newProperties);case"split_node":return It.isPath(e.path)&&"number"==typeof e.position&&Ye(e.properties);default:return!1}},isOperationList:e=>Array.isArray(e)&&e.every((e=>pn.isOperation(e))),isSelectionOperation:e=>pn.isOperation(e)&&e.type.endsWith("_selection"),isTextOperation:e=>pn.isOperation(e)&&e.type.endsWith("_text"),inverse(e){switch(e.type){case"insert_node":return un(un({},e),{},{type:"remove_node"});case"insert_text":return un(un({},e),{},{type:"remove_text"});case"merge_node":return un(un({},e),{},{type:"split_node",path:It.previous(e.path)});case"move_node":var{newPath:t,path:n}=e;if(It.equals(t,n))return e;if(It.isSibling(n,t))return un(un({},e),{},{path:t,newPath:n});var r=It.transform(n,e),o=It.transform(It.next(n),e);return un(un({},e),{},{path:r,newPath:o});case"remove_node":return un(un({},e),{},{type:"insert_node"});case"remove_text":return un(un({},e),{},{type:"insert_text"});case"set_node":var{properties:i,newProperties:s}=e;return un(un({},e),{},{properties:s,newProperties:i});case"set_selection":var{properties:a,newProperties:l}=e;return un(un({},e),{},null==a?{properties:l,newProperties:null}:null==l?{properties:null,newProperties:a}:{properties:l,newProperties:a});case"split_node":return un(un({},e),{},{type:"merge_node",path:It.next(e.path)})}}},dn=new WeakMap,hn={above:(e,t)=>e.above(t),addMark(e,t,n){e.addMark(t,n)},after:(e,t,n)=>e.after(t,n),before:(e,t,n)=>e.before(t,n),deleteBackward(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{unit:n="character"}=t;e.deleteBackward(n)},deleteForward(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{unit:n="character"}=t;e.deleteForward(n)},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,n){e.insertFragment(t,n)},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,n)=>e.isEdge(t,n),isEditor:e=>(e=>{var t=dn.get(e);if(void 0!==t)return t;if(!Ye(e))return!1;var n="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||Ye(e.marks))&&(null===e.selection||nn.isRange(e.selection))&&cn.isNodeList(e.children)&&pn.isOperationList(e.operations);return dn.set(e,n),n})(e),isElementReadOnly:(e,t)=>e.isElementReadOnly(t),isEmpty:(e,t)=>e.isEmpty(t),isEnd:(e,t,n)=>e.isEnd(t,n),isInline:(e,t)=>e.isInline(t),isNormalizing:e=>e.isNormalizing(),isSelectable:(e,t)=>e.isSelectable(t),isStart:(e,t,n)=>e.isStart(t,n),isVoid:(e,t)=>e.isVoid(t),last:(e,t)=>e.last(t),leaf:(e,t,n)=>e.leaf(t,n),levels:(e,t)=>e.levels(t),marks:e=>e.getMarks(),next:(e,t)=>e.next(t),node:(e,t,n)=>e.node(t,n),nodes:(e,t)=>e.nodes(t),normalize(e,t){e.normalize(t)},parent:(e,t,n)=>e.parent(t,n),path:(e,t,n)=>e.path(t,n),pathRef:(e,t,n)=>e.pathRef(t,n),pathRefs:e=>e.pathRefs(),point:(e,t,n)=>e.point(t,n),pointRef:(e,t,n)=>e.pointRef(t,n),pointRefs:e=>e.pointRefs(),positions:(e,t)=>e.positions(t),previous:(e,t)=>e.previous(t),range:(e,t,n)=>e.range(t,n),rangeRef:(e,t,n)=>e.rangeRef(t,n),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,n)=>e.string(t,n),unhangRange:(e,t,n)=>e.unhangRange(t,n),void:(e,t)=>e.void(t),withoutNormalizing(e,t){e.withoutNormalizing(t)}};function gn(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function yn(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?gn(Object(n),!0).forEach((function(t){Zt(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):gn(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var mn={compare(e,t){var n=It.compare(e.path,t.path);return 0===n?e.offset<t.offset?-1:e.offset>t.offset?1:0:n},isAfter:(e,t)=>1===mn.compare(e,t),isBefore:(e,t)=>-1===mn.compare(e,t),equals:(e,t)=>e.offset===t.offset&&It.equals(e.path,t.path),isPoint:e=>Ye(e)&&"number"==typeof e.offset&&It.isPath(e.path),transform(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return qt(e,(e=>{if(null===e)return null;var{affinity:r="forward"}=n,{path:o,offset:i}=e;switch(t.type){case"insert_node":case"move_node":e.path=It.transform(o,t,n);break;case"insert_text":It.equals(t.path,o)&&(t.offset<i||t.offset===i&&"forward"===r)&&(e.offset+=t.text.length);break;case"merge_node":It.equals(t.path,o)&&(e.offset+=t.position),e.path=It.transform(o,t,n);break;case"remove_text":It.equals(t.path,o)&&t.offset<=i&&(e.offset-=Math.min(i-t.offset,t.text.length));break;case"remove_node":if(It.equals(t.path,o)||It.isAncestor(t.path,o))return null;e.path=It.transform(o,t,n);break;case"split_node":if(It.equals(t.path,o)){if(t.position===i&&null==r)return null;(t.position<i||t.position===i&&"forward"===r)&&(e.offset-=t.position,e.path=It.transform(o,t,yn(yn({},n),{},{affinity:"forward"})))}else e.path=It.transform(o,t,n)}}))}},vn=void 0,bn={setScrubber(e){vn=e},stringify:e=>JSON.stringify(e,vn)},wn=["text"],xn=["anchor","focus"];function On(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function _n(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?On(Object(n),!0).forEach((function(t){Zt(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):On(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var Pn,kn={equals(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},{loose:r=!1}=n;function o(e){return Qt(e,wn)}return Gt(r?o(e):e,r?o(t):t)},isText:e=>Ye(e)&&"string"==typeof e.text,isTextList:e=>Array.isArray(e)&&e.every((e=>kn.isText(e))),isTextProps:e=>void 0!==e.text,matches(e,t){for(var n in t)if("text"!==n&&(!e.hasOwnProperty(n)||e[n]!==t[n]))return!1;return!0},decorations(e,t){var n=[_n({},e)];for(var r of t){var o=Qt(r,xn),[i,s]=nn.edges(r),a=[],l=0,c=i.offset,f=s.offset;for(var u of n){var{length:p}=u.text,d=l;if(l+=p,c<=d&&l<=f)Object.assign(u,o),a.push(u);else if(c!==f&&(c===l||f===d)||c>l||f<d||f===d&&0!==d)a.push(u);else{var h=u,g=void 0,y=void 0;if(f<l){var m=f-d;y=_n(_n({},h),{},{text:h.text.slice(m)}),h=_n(_n({},h),{},{text:h.text.slice(0,m)})}if(c>d){var v=c-d;g=_n(_n({},h),{},{text:h.text.slice(0,v)}),h=_n(_n({},h),{},{text:h.text.slice(v)})}Object.assign(h,o),g&&a.push(g),a.push(h),y&&a.push(y)}}n=a}return n}},jn=e=>e.selection?e.selection:e.children.length>0?hn.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"}(Pn||(Pn={})),Pn.L,Pn.L,Pn.V,Pn.LV,Pn.LVT,Pn.LV,Pn.V,Pn.V,Pn.T,Pn.LVT,Pn.T,Pn.T,Pn.Any,Pn.Extend,Pn.ZWJ,Pn.Any,Pn.SpacingMark,Pn.Prepend,Pn.Any,Pn.ZWJ,Pn.ExtPict,Pn.RI,Pn.RI;var En={delete(e,t){e.delete(t)},insertFragment(e,t,n){e.insertFragment(t,n)},insertText(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};hn.withoutNormalizing(e,(()=>{var{voids:r=!1}=n,{at:o=jn(e)}=n;if(It.isPath(o)&&(o=hn.range(e,o)),nn.isRange(o))if(nn.isCollapsed(o))o=o.anchor;else{var i=nn.end(o);if(!r&&hn.void(e,{at:i}))return;var s=nn.start(o),a=hn.pointRef(e,s),l=hn.pointRef(e,i);An.delete(e,{at:o,voids:r});var c=a.unref(),f=l.unref();o=c||f,An.setSelection(e,{anchor:o,focus:o})}if(!(!r&&hn.void(e,{at:o})||hn.elementReadOnly(e,{at:o}))){var{path:u,offset:p}=o;t.length>0&&e.apply({type:"insert_text",path:u,offset:p,text:t})}}))}};function Sn(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Rn(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Sn(Object(n),!0).forEach((function(t){Zt(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Sn(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var An=Rn(Rn(Rn(Rn({},Ut),Xt),Yt),En);const{Overlay:Cn,Portal:Tn}=n,Nn=({style:n,setFloating:i,element:s,setHoldLinkTool:a,blockId:f,onClose:u})=>{const p=e(),d=t(),[h,g]=y(!1),{refs:m,floatingStyles:v,context:b}=$e({placement:"bottom",open:h,onOpenChange:e=>{g(e)},middleware:[Re(),Se(),Ee(),fe(10)],whileElementsMounted:je}),{isMounted:w,styles:x}=Ue(b,{duration:{open:100,close:100}}),O=Object.assign(Object.assign(Object.assign({},v),x),{maxWidth:400}),k=null==d?void 0:d.LinkTool,j=!!k;return l(Tn,Object.assign({id:"yoopta-link-preview"},{children:[w&&j&&c(Tn,Object.assign({id:"yoopta-link-tool"},{children:c(Cn,Object.assign({lockScroll:!0,className:"yoo-link-z-[100]",onClick:u},{children:c("div",Object.assign({ref:m.setFloating,style:O,onClick:e=>e.stopPropagation()},{children:c(k,{editor:p,link:s.props,onSave:e=>{r.updateElement(p,f,{type:s.type,props:Object.assign(Object.assign({},s.props),e)}),g(!1),u()},onDelete:()=>{const e=o(p),t=r.getElementPath(p,f,s);if(!e)return;const n=r.getElementEntry(p,f,{path:t,type:s.type});n&&An.unwrapNodes(e,{match:e=>!hn.isEditor(e)&&on.isElement(e)&&e.type===s.type,at:t||(null==n?void 0:n[1])})},withTitle:!1})}))}))})),l("div",Object.assign({className:"yoopta-link-preview",style:n,ref:i},{children:[c("span",Object.assign({className:"yoopta-link-preview-text"},{children:s.props.url})),c("span",{className:"yoopta-link-preview-separator"}),c("button",Object.assign({type:"button",onClick:()=>{navigator.clipboard.writeText(s.props.url)}},{children:c(_,{size:14,strokeWidth:1})})),c("span",{className:"yoopta-link-preview-separator"}),c("button",Object.assign({type:"button",onClick:()=>{window.open(s.props.url,s.props.target||"_self")}},{children:c(P,{size:14,strokeWidth:1})})),c("span",{className:"yoopta-link-preview-separator"}),c("button",Object.assign({ref:m.setReference,type:"button",className:"yoopta-link-edit-button",onClick:()=>{a((e=>!e)),g((e=>!e))}},{children:"Edit"}))]}))]}))},Ln=["_blank","_self","_parent","_top","framename"],Dn=new s({type:"LinkPlugin",elements:{link:{render:e=>{var{extendRender:t}=e,n=v(e,["extendRender"]);const[r,o]=y(!1),[s,a]=y(!1),f=n.HTMLAttributes||{},{className:u=""}=f,p=v(f,["className"]),{refs:d,floatingStyles:h,context:g}=$e({placement:"bottom",open:r,onOpenChange:o,middleware:[Re(),Se(),Ee(),fe(0)],whileElementsMounted:je}),{isMounted:m,styles:b}=Ue(g,{duration:{open:200,close:100}}),w=Object.assign(Object.assign({},h),b),{url:x,target:O="",rel:_}=n.element.props||{},P=i(),k={rel:_,target:O};Ln.includes(O)||delete k.target,"string"==typeof _&&0!==(null==_?void 0:_.length)||delete k.rel;const j=()=>{a(!1),o(!1)};return l("span",Object.assign({ref:d.setReference,onMouseOver:()=>{o(!0)},onMouseOut:()=>{s||j()}},{children:[t?t(n):c("a",Object.assign({},k,p,n.attributes,{draggable:!1,href:x||"",className:`yoopta-link ${u}`},{children:n.children})),m&&!P&&c(Nn,{style:w,setFloating:d.setFloating,element:n.element,setHoldLinkTool:a,onClose:j,blockId:n.blockId})]}))},props:{url:null,target:"_self",rel:"noopener noreferrer",nodeType:"inline",title:null}}},options:{display:{title:"Link",description:"Create link"}},parsers:{html:{serialize:(e,t)=>{const{url:n,target:r,rel:o,title:i}=e.props;return`<a href="${n}" target="${r}" rel="${o}">${i||t}</a>`},deserialize:{nodeNames:["A"],parse:e=>{if("A"===e.nodeName){const t=e.getAttribute("href")||"",n=e.getAttribute("target")||"",r=e.getAttribute("rel")||"",o=e.textContent||"",i={url:t,target:n,rel:r,title:o,nodeType:"inline"};return{id:a(),type:"link",props:i,children:[{text:o}]}}}}}}});!function(e,t){void 0===t&&(t={});var n=t.insertAt;if(e&&"undefined"!=typeof document){var r=document.head||document.getElementsByTagName("head")[0],o=document.createElement("style");o.type="text/css","top"===n&&r.firstChild?r.insertBefore(o,r.firstChild):r.appendChild(o),o.styleSheet?o.styleSheet.cssText=e:o.appendChild(document.createTextNode(e))}}(".yoo-link-z-\\[100\\]{z-index:100}.yoopta-link{--tw-text-opacity:1;color:rgb(0 122 255/var(--tw-text-opacity));cursor:pointer;position:relative;text-decoration-line:underline;text-underline-offset:4px}.yoopta-link:hover{--tw-text-opacity:1;color:rgb(59 130 246/var(--tw-text-opacity))}.yoopta-link-preview{--tw-border-opacity:1;--tw-bg-opacity:1;--tw-shadow:0 4px 6px -1px rgba(0,0,0,.1),0 2px 4px -2px rgba(0,0,0,.1);--tw-shadow-colored:0 4px 6px -1px var(--tw-shadow-color),0 2px 4px -2px var(--tw-shadow-color);align-items:center;background-color:rgb(255 255 255/var(--tw-bg-opacity));border-color:rgb(227 227 227/var(--tw-border-opacity));border-radius:.375rem;border-style:solid;border-width:1px;box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow);display:flex;padding:6px;z-index:50}.yoopta-link-preview-text{font-size:.875rem;line-height:1.25rem;max-width:200px;overflow:hidden;text-overflow:ellipsis;-webkit-user-select:none;-moz-user-select:none;user-select:none;white-space:nowrap}.yoopta-link-preview-separator{--tw-bg-opacity:1;background-color:rgb(227 227 227/var(--tw-bg-opacity));height:20px;margin-left:5px;margin-right:5px;width:1px}.yoopta-link-edit-button{cursor:pointer;font-size:.875rem;line-height:1.25rem}");export{Dn as default};
32
+ */function Xe(e){return"[object Object]"===Object.prototype.toString.call(e)}function Ye(e){var t,n;return!1!==Xe(e)&&(void 0===(t=e.constructor)||!1!==Xe(n=t.prototype)&&!1!==n.hasOwnProperty("isPrototypeOf"))}var Ge=Symbol.for("immer-nothing"),Qe=Symbol.for("immer-draftable"),et=Symbol.for("immer-state");function tt(e,...t){throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var nt=Object.getPrototypeOf;function rt(e){return!!e&&!!e[et]}function ot(e){return!!e&&(st(e)||Array.isArray(e)||!!e[Qe]||!!e.constructor?.[Qe]||ut(e)||pt(e))}var it=Object.prototype.constructor.toString();function st(e){if(!e||"object"!=typeof e)return!1;const t=nt(e);if(null===t)return!0;const n=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;return n===Object||"function"==typeof n&&Function.toString.call(n)===it}function at(e,t){0===lt(e)?Reflect.ownKeys(e).forEach((n=>{t(n,e[n],e)})):e.forEach(((n,r)=>t(r,n,e)))}function lt(e){const t=e[et];return t?t.type_:Array.isArray(e)?1:ut(e)?2:pt(e)?3:0}function ct(e,t){return 2===lt(e)?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function ft(e,t,n){const r=lt(e);2===r?e.set(t,n):3===r?e.add(n):e[t]=n}function ut(e){return e instanceof Map}function pt(e){return e instanceof Set}function dt(e){return e.copy_||e.base_}function ht(e,t){if(ut(e))return new Map(e);if(pt(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);if(!t&&st(e)){if(!nt(e)){const t=Object.create(null);return Object.assign(t,e)}return{...e}}const n=Object.getOwnPropertyDescriptors(e);delete n[et];let r=Reflect.ownKeys(n);for(let t=0;t<r.length;t++){const o=r[t],i=n[o];!1===i.writable&&(i.writable=!0,i.configurable=!0),(i.get||i.set)&&(n[o]={configurable:!0,writable:!0,enumerable:i.enumerable,value:e[o]})}return Object.create(nt(e),n)}function gt(e,t=!1){return mt(e)||rt(e)||!ot(e)||(lt(e)>1&&(e.set=e.add=e.clear=e.delete=yt),Object.freeze(e),t&&Object.entries(e).forEach((([e,t])=>gt(t,!0)))),e}function yt(){tt(2)}function mt(e){return Object.isFrozen(e)}var vt,bt={};function wt(e){const t=bt[e];return t||tt(0),t}function xt(){return vt}function Ot(e,t){t&&(wt("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function _t(e){Pt(e),e.drafts_.forEach(jt),e.drafts_=null}function Pt(e){e===vt&&(vt=e.parent_)}function kt(e){return vt={drafts_:[],parent_:vt,immer_:e,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function jt(e){const t=e[et];0===t.type_||1===t.type_?t.revoke_():t.revoked_=!0}function Et(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];return void 0!==e&&e!==n?(n[et].modified_&&(_t(t),tt(4)),ot(e)&&(e=St(t,e),t.parent_||At(t,e)),t.patches_&&wt("Patches").generateReplacementPatches_(n[et].base_,e,t.patches_,t.inversePatches_)):e=St(t,n,[]),_t(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==Ge?e:void 0}function St(e,t,n){if(mt(t))return t;const r=t[et];if(!r)return at(t,((o,i)=>Rt(e,r,t,o,i,n))),t;if(r.scope_!==e)return t;if(!r.modified_)return At(e,r.base_,!0),r.base_;if(!r.finalized_){r.finalized_=!0,r.scope_.unfinalizedDrafts_--;const t=r.copy_;let o=t,i=!1;3===r.type_&&(o=new Set(t),t.clear(),i=!0),at(o,((o,s)=>Rt(e,r,t,o,s,n,i))),At(e,t,!1),n&&e.patches_&&wt("Patches").generatePatches_(r,n,e.patches_,e.inversePatches_)}return r.copy_}function Rt(e,t,n,r,o,i,s){if(rt(o)){const s=St(e,o,i&&t&&3!==t.type_&&!ct(t.assigned_,r)?i.concat(r):void 0);if(ft(n,r,s),!rt(s))return;e.canAutoFreeze_=!1}else s&&n.add(o);if(ot(o)&&!mt(o)){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1)return;St(e,o),t&&t.scope_.parent_||"symbol"==typeof r||!Object.prototype.propertyIsEnumerable.call(n,r)||At(e,o)}}function At(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&gt(t,n)}var Ct={get(e,t){if(t===et)return e;const n=dt(e);if(!ct(n,t))return function(e,t,n){const r=Lt(t,n);return r?"value"in r?r.value:r.get?.call(e.draft_):void 0}(e,n,t);const r=n[t];return e.finalized_||!ot(r)?r:r===Nt(e.base_,t)?(zt(e),e.copy_[t]=Mt(r,e)):r},has:(e,t)=>t in dt(e),ownKeys:e=>Reflect.ownKeys(dt(e)),set(e,t,n){const r=Lt(dt(e),t);if(r?.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){const r=Nt(dt(e),t),s=r?.[et];if(s&&s.base_===n)return e.copy_[t]=n,e.assigned_[t]=!1,!0;if(((o=n)===(i=r)?0!==o||1/o==1/i:o!=o&&i!=i)&&(void 0!==n||ct(e.base_,t)))return!0;zt(e),Dt(e)}var o,i;return e.copy_[t]===n&&(void 0!==n||t in e.copy_)||Number.isNaN(n)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=n,e.assigned_[t]=!0),!0},deleteProperty:(e,t)=>(void 0!==Nt(e.base_,t)||t in e.base_?(e.assigned_[t]=!1,zt(e),Dt(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0),getOwnPropertyDescriptor(e,t){const n=dt(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r?{writable:!0,configurable:1!==e.type_||"length"!==t,enumerable:r.enumerable,value:n[t]}:r},defineProperty(){tt(11)},getPrototypeOf:e=>nt(e.base_),setPrototypeOf(){tt(12)}},Tt={};function Nt(e,t){const n=e[et];return(n?dt(n):e)[t]}function Lt(e,t){if(!(t in e))return;let n=nt(e);for(;n;){const e=Object.getOwnPropertyDescriptor(n,t);if(e)return e;n=nt(n)}}function Dt(e){e.modified_||(e.modified_=!0,e.parent_&&Dt(e.parent_))}function zt(e){e.copy_||(e.copy_=ht(e.base_,e.scope_.immer_.useStrictShallowCopy_))}at(Ct,((e,t)=>{Tt[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}})),Tt.deleteProperty=function(e,t){return Tt.set.call(this,e,t,void 0)},Tt.set=function(e,t,n){return Ct.set.call(this,e[0],t,n,e[0])};function Mt(e,t){const n=ut(e)?wt("MapSet").proxyMap_(e,t):pt(e)?wt("MapSet").proxySet_(e,t):function(e,t){const n=Array.isArray(e),r={type_:n?1:0,scope_:t?t.scope_:xt(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let o=r,i=Ct;n&&(o=[r],i=Tt);const{revoke:s,proxy:a}=Proxy.revocable(o,i);return r.draft_=a,r.revoke_=s,a}(e,t);return(t?t.scope_:xt()).drafts_.push(n),n}function Ft(e){if(!ot(e)||mt(e))return e;const t=e[et];let n;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=ht(e,t.scope_.immer_.useStrictShallowCopy_)}else n=ht(e,!0);return at(n,((e,t)=>{ft(n,e,Ft(t))})),t&&(t.finalized_=!1),n}var Bt=new class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.produce=(e,t,n)=>{if("function"==typeof e&&"function"!=typeof t){const n=t;t=e;const r=this;return function(e=n,...o){return r.produce(e,(e=>t.call(this,e,...o)))}}let r;if("function"!=typeof t&&tt(6),void 0!==n&&"function"!=typeof n&&tt(7),ot(e)){const o=kt(this),i=Mt(e,void 0);let s=!0;try{r=t(i),s=!1}finally{s?_t(o):Pt(o)}return Ot(o,n),Et(r,o)}if(!e||"object"!=typeof e){if(r=t(e),void 0===r&&(r=e),r===Ge&&(r=void 0),this.autoFreeze_&&gt(r,!0),n){const t=[],o=[];wt("Patches").generateReplacementPatches_(e,r,t,o),n(t,o)}return r}tt(1)},this.produceWithPatches=(e,t)=>{if("function"==typeof e)return(t,...n)=>this.produceWithPatches(t,(t=>e(t,...n)));let n,r;return[this.produce(e,t,((e,t)=>{n=e,r=t})),n,r]},"boolean"==typeof e?.autoFreeze&&this.setAutoFreeze(e.autoFreeze),"boolean"==typeof e?.useStrictShallowCopy&&this.setUseStrictShallowCopy(e.useStrictShallowCopy)}createDraft(e){ot(e)||tt(8),rt(e)&&(e=function(e){rt(e)||tt(10);return Ft(e)}(e));const t=kt(this),n=Mt(e,void 0);return n[et].isManual_=!0,Pt(t),n}finishDraft(e,t){const n=e&&e[et];n&&n.isManual_||tt(9);const{scope_:r}=n;return Ot(r,t),Et(void 0,r)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}applyPatches(e,t){let n;for(n=t.length-1;n>=0;n--){const r=t[n];if(0===r.path.length&&"replace"===r.op){e=r.value;break}}n>-1&&(t=t.slice(n+1));const r=wt("Patches").applyPatches_;return rt(e)?r(e,t):this.produce(e,(e=>r(e,t)))}},qt=Bt.produce;Bt.produceWithPatches.bind(Bt),Bt.setAutoFreeze.bind(Bt),Bt.setUseStrictShallowCopy.bind(Bt),Bt.applyPatches.bind(Bt);var Wt=Bt.createDraft.bind(Bt),Vt=Bt.finishDraft.bind(Bt),It={ancestors(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{reverse:n=!1}=t,r=It.levels(e,t);return r=n?r.slice(1):r.slice(0,-1)},common(e,t){for(var n=[],r=0;r<e.length&&r<t.length;r++){var o=e[r];if(o!==t[r])break;n.push(o)}return n},compare(e,t){for(var n=Math.min(e.length,t.length),r=0;r<n;r++){if(e[r]<t[r])return-1;if(e[r]>t[r])return 1}return 0},endsAfter(e,t){var n=e.length-1,r=e.slice(0,n),o=t.slice(0,n),i=e[n],s=t[n];return It.equals(r,o)&&i>s},endsAt(e,t){var n=e.length,r=e.slice(0,n),o=t.slice(0,n);return It.equals(r,o)},endsBefore(e,t){var n=e.length-1,r=e.slice(0,n),o=t.slice(0,n),i=e[n],s=t[n];return It.equals(r,o)&&i<s},equals:(e,t)=>e.length===t.length&&e.every(((e,n)=>e===t[n])),hasPrevious:e=>e[e.length-1]>0,isAfter:(e,t)=>1===It.compare(e,t),isAncestor:(e,t)=>e.length<t.length&&0===It.compare(e,t),isBefore:(e,t)=>-1===It.compare(e,t),isChild:(e,t)=>e.length===t.length+1&&0===It.compare(e,t),isCommon:(e,t)=>e.length<=t.length&&0===It.compare(e,t),isDescendant:(e,t)=>e.length>t.length&&0===It.compare(e,t),isParent:(e,t)=>e.length+1===t.length&&0===It.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 n=e.slice(0,-1),r=t.slice(0,-1);return e[e.length-1]!==t[t.length-1]&&It.equals(n,r)},levels(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{reverse:n=!1}=t,r=[],o=0;o<=e.length;o++)r.push(e.slice(0,o));return n&&r.reverse(),r},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(!It.isAncestor(t,e)&&!It.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 n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!e)return null;var r=[...e],{affinity:o="forward"}=n;if(0===e.length)return r;switch(t.type){case"insert_node":var{path:i}=t;(It.equals(i,r)||It.endsBefore(i,r)||It.isAncestor(i,r))&&(r[i.length-1]+=1);break;case"remove_node":var{path:s}=t;if(It.equals(s,r)||It.isAncestor(s,r))return null;It.endsBefore(s,r)&&(r[s.length-1]-=1);break;case"merge_node":var{path:a,position:l}=t;It.equals(a,r)||It.endsBefore(a,r)?r[a.length-1]-=1:It.isAncestor(a,r)&&(r[a.length-1]-=1,r[a.length]+=l);break;case"split_node":var{path:c,position:f}=t;if(It.equals(c,r)){if("forward"===o)r[r.length-1]+=1;else if("backward"!==o)return null}else It.endsBefore(c,r)?r[c.length-1]+=1:It.isAncestor(c,r)&&e[c.length]>=f&&(r[c.length-1]+=1,r[c.length]-=f);break;case"move_node":var{path:u,newPath:p}=t;if(It.equals(u,p))return r;if(It.isAncestor(u,r)||It.equals(u,r)){var d=p.slice();return It.endsBefore(u,p)&&u.length<p.length&&(d[u.length-1]-=1),d.concat(r.slice(u.length))}It.isSibling(u,p)&&(It.isAncestor(p,r)||It.equals(p,r))?It.endsBefore(u,r)?r[u.length-1]-=1:r[u.length-1]+=1:It.endsBefore(p,r)||It.equals(p,r)||It.isAncestor(p,r)?(It.endsBefore(u,r)&&(r[u.length-1]-=1),r[p.length-1]+=1):It.endsBefore(u,r)&&(It.equals(p,r)&&(r[p.length-1]+=1),r[u.length-1]-=1)}return r}};function Ht(e){return Ht="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},Ht(e)}function $t(e){var t=function(e,t){if("object"!==Ht(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!==Ht(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===Ht(t)?t:String(t)}function Zt(e,t,n){return(t=$t(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Jt(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Kt(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Jt(Object(n),!0).forEach((function(t){Zt(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Jt(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var Ut={transform(e,t){e.children=Wt(e.children);var n=e.selection&&Wt(e.selection);try{n=((e,t,n)=>{switch(n.type){case"insert_node":var{path:r,node:o}=n,i=cn.parent(e,r),s=r[r.length-1];if(s>i.children.length)throw new Error('Cannot apply an "insert_node" operation at path ['.concat(r,"] because the destination is past the end of the node."));if(i.children.splice(s,0,o),t)for(var[a,l]of nn.points(t))t[l]=mn.transform(a,n);break;case"insert_text":var{path:c,offset:f,text:u}=n;if(0===u.length)break;var p=cn.leaf(e,c),d=p.text.slice(0,f),h=p.text.slice(f);if(p.text=d+u+h,t)for(var[g,y]of nn.points(t))t[y]=mn.transform(g,n);break;case"merge_node":var{path:m}=n,v=cn.get(e,m),b=It.previous(m),w=cn.get(e,b),x=cn.parent(e,m),O=m[m.length-1];if(kn.isText(v)&&kn.isText(w))w.text+=v.text;else{if(kn.isText(v)||kn.isText(w))throw new Error('Cannot apply a "merge_node" operation at path ['.concat(m,"] to nodes of different interfaces: ").concat(bn.stringify(v)," ").concat(bn.stringify(w)));w.children.push(...v.children)}if(x.children.splice(O,1),t)for(var[_,P]of nn.points(t))t[P]=mn.transform(_,n);break;case"move_node":var{path:k,newPath:j}=n;if(It.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=cn.get(e,k),S=cn.parent(e,k),R=k[k.length-1];S.children.splice(R,1);var A=It.transform(k,n),C=cn.get(e,It.parent(A)),T=A[A.length-1];if(C.children.splice(T,0,E),t)for(var[N,L]of nn.points(t))t[L]=mn.transform(N,n);break;case"remove_node":var{path:D}=n,z=D[D.length-1];if(cn.parent(e,D).children.splice(z,1),t)for(var[M,F]of nn.points(t)){var B=mn.transform(M,n);if(null!=t&&null!=B)t[F]=B;else{var q=void 0,W=void 0;for(var[V,I]of cn.texts(e)){if(-1!==It.compare(I,D)){W=[V,I];break}q=[V,I]}var H=!1;q&&W&&(H=It.equals(W[1],D)?!It.hasPrevious(W[1]):It.common(q[1],D).length<It.common(W[1],D).length),q&&!H?(M.path=q[1],M.offset=q[0].text.length):W?(M.path=W[1],M.offset=0):t=null}}break;case"remove_text":var{path:$,offset:Z,text:J}=n;if(0===J.length)break;var K=cn.leaf(e,$),U=K.text.slice(0,Z),X=K.text.slice(Z+J.length);if(K.text=U+X,t)for(var[Y,G]of nn.points(t))t[G]=mn.transform(Y,n);break;case"set_node":var{path:Q,properties:ee,newProperties:te}=n;if(0===Q.length)throw new Error("Cannot set properties on the root node!");var ne=cn.get(e,Q);for(var re in te){if("children"===re||"text"===re)throw new Error('Cannot set the "'.concat(re,'" property of nodes!'));var oe=te[re];null==oe?delete ne[re]:ne[re]=oe}for(var ie in ee)te.hasOwnProperty(ie)||delete ne[ie];break;case"set_selection":var{newProperties:se}=n;if(null==se)t=se;else{if(null==t){if(!nn.isRange(se))throw new Error('Cannot apply an incomplete "set_selection" operation properties '.concat(bn.stringify(se)," when there is no current selection."));t=Kt({},se)}for(var ae in se){var le=se[ae];if(null==le){if("anchor"===ae||"focus"===ae)throw new Error('Cannot remove the "'.concat(ae,'" selection property'));delete t[ae]}else t[ae]=le}}break;case"split_node":var{path:ce,position:fe,properties:ue}=n;if(0===ce.length)throw new Error('Cannot apply a "split_node" operation at path ['.concat(ce,"] because the root node cannot be split."));var pe,de=cn.get(e,ce),he=cn.parent(e,ce),ge=ce[ce.length-1];if(kn.isText(de)){var ye=de.text.slice(0,fe),me=de.text.slice(fe);de.text=ye,pe=Kt(Kt({},ue),{},{text:me})}else{var ve=de.children.slice(0,fe),be=de.children.slice(fe);de.children=ve,pe=Kt(Kt({},ue),{},{children:be})}if(he.children.splice(ge+1,0,pe),t)for(var[we,xe]of nn.points(t))t[xe]=mn.transform(we,n)}return t})(e,n,t)}finally{e.children=Vt(e.children),e.selection=n?rt(n)?Vt(n):n:null}}},Xt={insertNodes(e,t,n){e.insertNodes(t,n)},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,n){e.setNodes(t,n)},splitNodes(e,t){e.splitNodes(t)},unsetNodes(e,t,n){e.unsetNodes(t,n)},unwrapNodes(e,t){e.unwrapNodes(t)},wrapNodes(e,t,n){e.wrapNodes(t,n)}},Yt={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,n){e.setPoint(t,n)},setSelection(e,t){e.setSelection(t)}},Gt=(e,t)=>{for(var n in e){var r=e[n],o=t[n];if(Ye(r)&&Ye(o)){if(!Gt(r,o))return!1}else if(Array.isArray(r)&&Array.isArray(o)){if(r.length!==o.length)return!1;for(var i=0;i<r.length;i++)if(r[i]!==o[i])return!1}else if(r!==o)return!1}for(var s in t)if(void 0===e[s]&&void 0!==t[s])return!1;return!0};function Qt(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var en=["anchor","focus"];function tn(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}var nn={edges(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{reverse:n=!1}=t,{anchor:r,focus:o}=e;return nn.isBackward(e)===n?[r,o]:[o,r]},end(e){var[,t]=nn.edges(e);return t},equals:(e,t)=>mn.equals(e.anchor,t.anchor)&&mn.equals(e.focus,t.focus),includes(e,t){if(nn.isRange(t)){if(nn.includes(e,t.anchor)||nn.includes(e,t.focus))return!0;var[n,r]=nn.edges(e),[o,i]=nn.edges(t);return mn.isBefore(n,o)&&mn.isAfter(r,i)}var[s,a]=nn.edges(e),l=!1,c=!1;return mn.isPoint(t)?(l=mn.compare(t,s)>=0,c=mn.compare(t,a)<=0):(l=It.compare(t,s.path)>=0,c=It.compare(t,a.path)<=0),l&&c},intersection(e,t){var n=Qt(e,en),[r,o]=nn.edges(e),[i,s]=nn.edges(t),a=mn.isBefore(r,i)?i:r,l=mn.isBefore(o,s)?o:s;return mn.isBefore(l,a)?null:function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?tn(Object(n),!0).forEach((function(t){Zt(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):tn(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}({anchor:a,focus:l},n)},isBackward(e){var{anchor:t,focus:n}=e;return mn.isAfter(t,n)},isCollapsed(e){var{anchor:t,focus:n}=e;return mn.equals(t,n)},isExpanded:e=>!nn.isCollapsed(e),isForward:e=>!nn.isBackward(e),isRange:e=>Ye(e)&&mn.isPoint(e.anchor)&&mn.isPoint(e.focus),*points(e){yield[e.anchor,"anchor"],yield[e.focus,"focus"]},start(e){var[t]=nn.edges(e);return t},transform(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return qt(e,(e=>{if(null===e)return null;var r,o,{affinity:i="inward"}=n;if("inward"===i){var s=nn.isCollapsed(e);nn.isForward(e)?(r="forward",o=s?r:"backward"):(r="backward",o=s?r:"forward")}else"outward"===i?nn.isForward(e)?(r="backward",o="forward"):(r="forward",o="backward"):(r=i,o=i);var a=mn.transform(e.anchor,t,{affinity:r}),l=mn.transform(e.focus,t,{affinity:o});if(!a||!l)return null;e.anchor=a,e.focus=l}))}},rn=e=>Ye(e)&&cn.isNodeList(e.children)&&!hn.isEditor(e),on={isAncestor:e=>Ye(e)&&cn.isNodeList(e.children),isElement:rn,isElementList:e=>Array.isArray(e)&&e.every((e=>on.isElement(e))),isElementProps:e=>void 0!==e.children,isElementType:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"type";return rn(e)&&e[n]===t},matches(e,t){for(var n in t)if("children"!==n&&e[n]!==t[n])return!1;return!0}},sn=["children"],an=["text"],ln=new WeakMap,cn={ancestor(e,t){var n=cn.get(e,t);if(kn.isText(n))throw new Error("Cannot get the ancestor node at path [".concat(t,"] because it refers to a text node instead: ").concat(bn.stringify(n)));return n},ancestors(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return function*(){for(var r of It.ancestors(t,n)){var o=[cn.ancestor(e,r),r];yield o}}()},child(e,t){if(kn.isText(e))throw new Error("Cannot get the child of a text node: ".concat(bn.stringify(e)));var n=e.children[t];if(null==n)throw new Error("Cannot get child at index `".concat(t,"` in node: ").concat(bn.stringify(e)));return n},children(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return function*(){for(var{reverse:r=!1}=n,o=cn.ancestor(e,t),{children:i}=o,s=r?i.length-1:0;r?s>=0:s<i.length;){var a=cn.child(o,s),l=t.concat(s);yield[a,l],s=r?s-1:s+1}}()},common(e,t,n){var r=It.common(t,n);return[cn.get(e,r),r]},descendant(e,t){var n=cn.get(e,t);if(hn.isEditor(n))throw new Error("Cannot get the descendant node at path [".concat(t,"] because it refers to the root editor node instead: ").concat(bn.stringify(n)));return n},descendants(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function*(){for(var[n,r]of cn.nodes(e,t))0!==r.length&&(yield[n,r])}()},elements(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function*(){for(var[n,r]of cn.nodes(e,t))on.isElement(n)&&(yield[n,r])}()},extractProps:e=>on.isAncestor(e)?Qt(e,sn):Qt(e,an),first(e,t){for(var n=t.slice(),r=cn.get(e,n);r&&!kn.isText(r)&&0!==r.children.length;)r=r.children[0],n.push(0);return[r,n]},fragment(e,t){if(kn.isText(e))throw new Error("Cannot get a fragment starting from a root text node: ".concat(bn.stringify(e)));var n=qt({children:e.children},(e=>{var[n,r]=nn.edges(t),o=cn.nodes(e,{reverse:!0,pass:e=>{var[,n]=e;return!nn.includes(t,n)}});for(var[,i]of o){if(!nn.includes(t,i)){var s=cn.parent(e,i),a=i[i.length-1];s.children.splice(a,1)}if(It.equals(i,r.path)){var l=cn.leaf(e,i);l.text=l.text.slice(0,r.offset)}if(It.equals(i,n.path)){var c=cn.leaf(e,i);c.text=c.text.slice(n.offset)}}hn.isEditor(e)&&(e.selection=null)}));return n.children},get(e,t){for(var n=e,r=0;r<t.length;r++){var o=t[r];if(kn.isText(n)||!n.children[o])throw new Error("Cannot find a descendant at path [".concat(t,"] in node: ").concat(bn.stringify(e)));n=n.children[o]}return n},has(e,t){for(var n=e,r=0;r<t.length;r++){var o=t[r];if(kn.isText(n)||!n.children[o])return!1;n=n.children[o]}return!0},isNode:e=>kn.isText(e)||on.isElement(e)||hn.isEditor(e),isNodeList(e){if(!Array.isArray(e))return!1;var t=ln.get(e);if(void 0!==t)return t;var n=e.every((e=>cn.isNode(e)));return ln.set(e,n),n},last(e,t){for(var n=t.slice(),r=cn.get(e,n);r&&!kn.isText(r)&&0!==r.children.length;){var o=r.children.length-1;r=r.children[o],n.push(o)}return[r,n]},leaf(e,t){var n=cn.get(e,t);if(!kn.isText(n))throw new Error("Cannot get the leaf node at path [".concat(t,"] because it refers to a non-leaf node: ").concat(bn.stringify(n)));return n},levels(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return function*(){for(var r of It.levels(t,n)){var o=cn.get(e,r);yield[o,r]}}()},matches:(e,t)=>on.isElement(e)&&on.isElementProps(t)&&on.matches(e,t)||kn.isText(e)&&kn.isTextProps(t)&&kn.matches(e,t),nodes(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function*(){for(var{pass:n,reverse:r=!1}=t,{from:o=[],to:i}=t,s=new Set,a=[],l=e;!i||!(r?It.isBefore(a,i):It.isAfter(a,i));)if(s.has(l)||(yield[l,a]),s.has(l)||kn.isText(l)||0===l.children.length||null!=n&&!1!==n([l,a])){if(0===a.length)break;if(!r){var c=It.next(a);if(cn.has(e,c)){a=c,l=cn.get(e,a);continue}}if(r&&0!==a[a.length-1])a=It.previous(a),l=cn.get(e,a);else a=It.parent(a),l=cn.get(e,a),s.add(l)}else{s.add(l);var f=r?l.children.length-1:0;It.isAncestor(a,o)&&(f=o[a.length]),a=a.concat(f),l=cn.get(e,a)}}()},parent(e,t){var n=It.parent(t),r=cn.get(e,n);if(kn.isText(r))throw new Error("Cannot get the parent of path [".concat(t,"] because it does not exist in the root."));return r},string:e=>kn.isText(e)?e.text:e.children.map(cn.string).join(""),texts(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function*(){for(var[n,r]of cn.nodes(e,t))kn.isText(n)&&(yield[n,r])}()}};function fn(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function un(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?fn(Object(n),!0).forEach((function(t){Zt(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):fn(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var pn={isNodeOperation:e=>pn.isOperation(e)&&e.type.endsWith("_node"),isOperation(e){if(!Ye(e))return!1;switch(e.type){case"insert_node":case"remove_node":return It.isPath(e.path)&&cn.isNode(e.node);case"insert_text":case"remove_text":return"number"==typeof e.offset&&"string"==typeof e.text&&It.isPath(e.path);case"merge_node":return"number"==typeof e.position&&It.isPath(e.path)&&Ye(e.properties);case"move_node":return It.isPath(e.path)&&It.isPath(e.newPath);case"set_node":return It.isPath(e.path)&&Ye(e.properties)&&Ye(e.newProperties);case"set_selection":return null===e.properties&&nn.isRange(e.newProperties)||null===e.newProperties&&nn.isRange(e.properties)||Ye(e.properties)&&Ye(e.newProperties);case"split_node":return It.isPath(e.path)&&"number"==typeof e.position&&Ye(e.properties);default:return!1}},isOperationList:e=>Array.isArray(e)&&e.every((e=>pn.isOperation(e))),isSelectionOperation:e=>pn.isOperation(e)&&e.type.endsWith("_selection"),isTextOperation:e=>pn.isOperation(e)&&e.type.endsWith("_text"),inverse(e){switch(e.type){case"insert_node":return un(un({},e),{},{type:"remove_node"});case"insert_text":return un(un({},e),{},{type:"remove_text"});case"merge_node":return un(un({},e),{},{type:"split_node",path:It.previous(e.path)});case"move_node":var{newPath:t,path:n}=e;if(It.equals(t,n))return e;if(It.isSibling(n,t))return un(un({},e),{},{path:t,newPath:n});var r=It.transform(n,e),o=It.transform(It.next(n),e);return un(un({},e),{},{path:r,newPath:o});case"remove_node":return un(un({},e),{},{type:"insert_node"});case"remove_text":return un(un({},e),{},{type:"insert_text"});case"set_node":var{properties:i,newProperties:s}=e;return un(un({},e),{},{properties:s,newProperties:i});case"set_selection":var{properties:a,newProperties:l}=e;return un(un({},e),{},null==a?{properties:l,newProperties:null}:null==l?{properties:null,newProperties:a}:{properties:l,newProperties:a});case"split_node":return un(un({},e),{},{type:"merge_node",path:It.next(e.path)})}}},dn=new WeakMap,hn={above:(e,t)=>e.above(t),addMark(e,t,n){e.addMark(t,n)},after:(e,t,n)=>e.after(t,n),before:(e,t,n)=>e.before(t,n),deleteBackward(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{unit:n="character"}=t;e.deleteBackward(n)},deleteForward(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{unit:n="character"}=t;e.deleteForward(n)},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,n){e.insertFragment(t,n)},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,n)=>e.isEdge(t,n),isEditor:e=>(e=>{var t=dn.get(e);if(void 0!==t)return t;if(!Ye(e))return!1;var n="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||Ye(e.marks))&&(null===e.selection||nn.isRange(e.selection))&&cn.isNodeList(e.children)&&pn.isOperationList(e.operations);return dn.set(e,n),n})(e),isElementReadOnly:(e,t)=>e.isElementReadOnly(t),isEmpty:(e,t)=>e.isEmpty(t),isEnd:(e,t,n)=>e.isEnd(t,n),isInline:(e,t)=>e.isInline(t),isNormalizing:e=>e.isNormalizing(),isSelectable:(e,t)=>e.isSelectable(t),isStart:(e,t,n)=>e.isStart(t,n),isVoid:(e,t)=>e.isVoid(t),last:(e,t)=>e.last(t),leaf:(e,t,n)=>e.leaf(t,n),levels:(e,t)=>e.levels(t),marks:e=>e.getMarks(),next:(e,t)=>e.next(t),node:(e,t,n)=>e.node(t,n),nodes:(e,t)=>e.nodes(t),normalize(e,t){e.normalize(t)},parent:(e,t,n)=>e.parent(t,n),path:(e,t,n)=>e.path(t,n),pathRef:(e,t,n)=>e.pathRef(t,n),pathRefs:e=>e.pathRefs(),point:(e,t,n)=>e.point(t,n),pointRef:(e,t,n)=>e.pointRef(t,n),pointRefs:e=>e.pointRefs(),positions:(e,t)=>e.positions(t),previous:(e,t)=>e.previous(t),range:(e,t,n)=>e.range(t,n),rangeRef:(e,t,n)=>e.rangeRef(t,n),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,n)=>e.string(t,n),unhangRange:(e,t,n)=>e.unhangRange(t,n),void:(e,t)=>e.void(t),withoutNormalizing(e,t){e.withoutNormalizing(t)}};function gn(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function yn(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?gn(Object(n),!0).forEach((function(t){Zt(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):gn(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var mn={compare(e,t){var n=It.compare(e.path,t.path);return 0===n?e.offset<t.offset?-1:e.offset>t.offset?1:0:n},isAfter:(e,t)=>1===mn.compare(e,t),isBefore:(e,t)=>-1===mn.compare(e,t),equals:(e,t)=>e.offset===t.offset&&It.equals(e.path,t.path),isPoint:e=>Ye(e)&&"number"==typeof e.offset&&It.isPath(e.path),transform(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return qt(e,(e=>{if(null===e)return null;var{affinity:r="forward"}=n,{path:o,offset:i}=e;switch(t.type){case"insert_node":case"move_node":e.path=It.transform(o,t,n);break;case"insert_text":It.equals(t.path,o)&&(t.offset<i||t.offset===i&&"forward"===r)&&(e.offset+=t.text.length);break;case"merge_node":It.equals(t.path,o)&&(e.offset+=t.position),e.path=It.transform(o,t,n);break;case"remove_text":It.equals(t.path,o)&&t.offset<=i&&(e.offset-=Math.min(i-t.offset,t.text.length));break;case"remove_node":if(It.equals(t.path,o)||It.isAncestor(t.path,o))return null;e.path=It.transform(o,t,n);break;case"split_node":if(It.equals(t.path,o)){if(t.position===i&&null==r)return null;(t.position<i||t.position===i&&"forward"===r)&&(e.offset-=t.position,e.path=It.transform(o,t,yn(yn({},n),{},{affinity:"forward"})))}else e.path=It.transform(o,t,n)}}))}},vn=void 0,bn={setScrubber(e){vn=e},stringify:e=>JSON.stringify(e,vn)},wn=["text"],xn=["anchor","focus"];function On(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function _n(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?On(Object(n),!0).forEach((function(t){Zt(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):On(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var Pn,kn={equals(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},{loose:r=!1}=n;function o(e){return Qt(e,wn)}return Gt(r?o(e):e,r?o(t):t)},isText:e=>Ye(e)&&"string"==typeof e.text,isTextList:e=>Array.isArray(e)&&e.every((e=>kn.isText(e))),isTextProps:e=>void 0!==e.text,matches(e,t){for(var n in t)if("text"!==n&&(!e.hasOwnProperty(n)||e[n]!==t[n]))return!1;return!0},decorations(e,t){var n=[_n({},e)];for(var r of t){var o=Qt(r,xn),[i,s]=nn.edges(r),a=[],l=0,c=i.offset,f=s.offset;for(var u of n){var{length:p}=u.text,d=l;if(l+=p,c<=d&&l<=f)Object.assign(u,o),a.push(u);else if(c!==f&&(c===l||f===d)||c>l||f<d||f===d&&0!==d)a.push(u);else{var h=u,g=void 0,y=void 0;if(f<l){var m=f-d;y=_n(_n({},h),{},{text:h.text.slice(m)}),h=_n(_n({},h),{},{text:h.text.slice(0,m)})}if(c>d){var v=c-d;g=_n(_n({},h),{},{text:h.text.slice(0,v)}),h=_n(_n({},h),{},{text:h.text.slice(v)})}Object.assign(h,o),g&&a.push(g),a.push(h),y&&a.push(y)}}n=a}return n}},jn=e=>e.selection?e.selection:e.children.length>0?hn.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"}(Pn||(Pn={})),Pn.L,Pn.L,Pn.V,Pn.LV,Pn.LVT,Pn.LV,Pn.V,Pn.V,Pn.T,Pn.LVT,Pn.T,Pn.T,Pn.Any,Pn.Extend,Pn.ZWJ,Pn.Any,Pn.SpacingMark,Pn.Prepend,Pn.Any,Pn.ZWJ,Pn.ExtPict,Pn.RI,Pn.RI;var En={delete(e,t){e.delete(t)},insertFragment(e,t,n){e.insertFragment(t,n)},insertText(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};hn.withoutNormalizing(e,(()=>{var{voids:r=!1}=n,{at:o=jn(e)}=n;if(It.isPath(o)&&(o=hn.range(e,o)),nn.isRange(o))if(nn.isCollapsed(o))o=o.anchor;else{var i=nn.end(o);if(!r&&hn.void(e,{at:i}))return;var s=nn.start(o),a=hn.pointRef(e,s),l=hn.pointRef(e,i);An.delete(e,{at:o,voids:r});var c=a.unref(),f=l.unref();o=c||f,An.setSelection(e,{anchor:o,focus:o})}if(!(!r&&hn.void(e,{at:o})||hn.elementReadOnly(e,{at:o}))){var{path:u,offset:p}=o;t.length>0&&e.apply({type:"insert_text",path:u,offset:p,text:t})}}))}};function Sn(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Rn(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Sn(Object(n),!0).forEach((function(t){Zt(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Sn(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var An=Rn(Rn(Rn(Rn({},Ut),Xt),Yt),En);const{Overlay:Cn,Portal:Tn}=n,Nn=({style:n,setFloating:i,element:s,setHoldLinkTool:a,blockId:f,onClose:u})=>{const p=e(),d=t(),[h,g]=y(!1),{refs:m,floatingStyles:v,context:b}=$e({placement:"bottom",open:h,onOpenChange:e=>{g(e)},middleware:[Re(),Se(),Ee(),fe(10)],whileElementsMounted:je}),{isMounted:w,styles:x}=Ue(b,{duration:{open:100,close:100}}),O=Object.assign(Object.assign(Object.assign({},v),x),{maxWidth:400}),k=null==d?void 0:d.LinkTool,j=!!k;return l(Tn,Object.assign({id:"yoopta-link-preview"},{children:[w&&j&&c(Tn,Object.assign({id:"yoopta-link-tool"},{children:c(Cn,Object.assign({lockScroll:!0,className:"yoo-link-z-[100]",onClick:u},{children:c("div",Object.assign({ref:m.setFloating,style:O,onClick:e=>e.stopPropagation()},{children:c(k,{editor:p,link:s.props,onSave:e=>{r.updateElement(p,f,{type:s.type,props:Object.assign(Object.assign({},s.props),e)}),g(!1),u()},onDelete:()=>{const e=o(p),t=r.getElementPath(p,f,s);if(!e)return;const n=r.getElementEntry(p,f,{path:t,type:s.type});n&&An.unwrapNodes(e,{match:e=>!hn.isEditor(e)&&on.isElement(e)&&e.type===s.type,at:t||(null==n?void 0:n[1])})},withTitle:!1})}))}))})),l("div",Object.assign({className:"yoopta-link-preview",style:n,ref:i},{children:[c("span",Object.assign({className:"yoopta-link-preview-text"},{children:s.props.url})),c("span",{className:"yoopta-link-preview-separator"}),c("button",Object.assign({type:"button",onClick:()=>{navigator.clipboard.writeText(s.props.url)}},{children:c(_,{size:14,strokeWidth:1})})),c("span",{className:"yoopta-link-preview-separator"}),c("button",Object.assign({type:"button",onClick:()=>{window.open(s.props.url,s.props.target||"_self")}},{children:c(P,{size:14,strokeWidth:1})})),c("span",{className:"yoopta-link-preview-separator"}),c("button",Object.assign({ref:m.setReference,type:"button",className:"yoopta-link-edit-button",onClick:()=>{a((e=>!e)),g((e=>!e))}},{children:"Edit"}))]}))]}))},Ln=["_blank","_self","_parent","_top","framename"],Dn=new s({type:"LinkPlugin",elements:{link:{render:e=>{var{extendRender:t}=e,n=v(e,["extendRender"]);const[r,o]=y(!1),[s,a]=y(!1),f=n.HTMLAttributes||{},{className:u=""}=f,p=v(f,["className"]),{refs:d,floatingStyles:h,context:g}=$e({placement:"bottom",open:r,onOpenChange:o,middleware:[Re(),Se(),Ee(),fe(0)],whileElementsMounted:je}),{isMounted:m,styles:b}=Ue(g,{duration:{open:200,close:100}}),w=Object.assign(Object.assign({},h),b),{url:x,target:O="",rel:_}=n.element.props||{},P=i(),k={rel:_,target:O};Ln.includes(O)||delete k.target,"string"==typeof _&&0!==(null==_?void 0:_.length)||delete k.rel;const j=()=>{a(!1),o(!1)};return l("span",Object.assign({ref:d.setReference,onMouseOver:()=>{o(!0)},onMouseOut:()=>{s||j()}},{children:[t?t(n):c("a",Object.assign({},k,p,n.attributes,{draggable:!1,href:x||"",className:`yoopta-link ${u}`},{children:n.children})),m&&!P&&c(Nn,{style:w,setFloating:d.setFloating,element:n.element,setHoldLinkTool:a,onClose:j,blockId:n.blockId})]}))},props:{url:null,target:"_self",rel:"noopener noreferrer",nodeType:"inline",title:null}}},options:{display:{title:"Link",description:"Create link"}},parsers:{html:{serialize:(e,t)=>{const{url:n,target:r,rel:o,title:i}=e.props;return`<a href="${n}" target="${r}" rel="${o}">${i||t}</a>`},deserialize:{nodeNames:["A"],parse:(e,t)=>{if("A"===e.nodeName){const n=e.getAttribute("href")||"",r=t.plugins.LinkPlugin.elements.link.props,o=e.getAttribute("target")||r.target,i=e.getAttribute("rel")||r.rel,s=e.textContent||"",l={url:n,target:o,rel:i,title:s,nodeType:"inline"};return{id:a(),type:"link",props:l,children:[{text:s}]}}}}}}});!function(e,t){void 0===t&&(t={});var n=t.insertAt;if(e&&"undefined"!=typeof document){var r=document.head||document.getElementsByTagName("head")[0],o=document.createElement("style");o.type="text/css","top"===n&&r.firstChild?r.insertBefore(o,r.firstChild):r.appendChild(o),o.styleSheet?o.styleSheet.cssText=e:o.appendChild(document.createTextNode(e))}}(".yoo-link-z-\\[100\\]{z-index:100}.yoopta-link{--tw-text-opacity:1;color:rgb(0 122 255/var(--tw-text-opacity));cursor:pointer;position:relative;text-decoration-line:underline;text-underline-offset:4px}.yoopta-link:hover{--tw-text-opacity:1;color:rgb(59 130 246/var(--tw-text-opacity))}.yoopta-link-preview{--tw-border-opacity:1;--tw-bg-opacity:1;--tw-shadow:0 4px 6px -1px rgba(0,0,0,.1),0 2px 4px -2px rgba(0,0,0,.1);--tw-shadow-colored:0 4px 6px -1px var(--tw-shadow-color),0 2px 4px -2px var(--tw-shadow-color);align-items:center;background-color:rgb(255 255 255/var(--tw-bg-opacity));border-color:rgb(227 227 227/var(--tw-border-opacity));border-radius:.375rem;border-style:solid;border-width:1px;box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow);display:flex;padding:6px;z-index:50}.yoopta-link-preview-text{font-size:.875rem;line-height:1.25rem;max-width:200px;overflow:hidden;text-overflow:ellipsis;-webkit-user-select:none;-moz-user-select:none;user-select:none;white-space:nowrap}.yoopta-link-preview-separator{--tw-bg-opacity:1;background-color:rgb(227 227 227/var(--tw-bg-opacity));height:20px;margin-left:5px;margin-right:5px;width:1px}.yoopta-link-edit-button{cursor:pointer;font-size:.875rem;line-height:1.25rem}");export{Dn as default};
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/plugin/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAc,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC1D,OAAO,EAAE,gBAAgB,EAAyB,MAAM,UAAU,CAAC;AAGnE,QAAA,MAAM,IAAI,iEAqDR,CAAC;AAEH,OAAO,EAAE,IAAI,EAAE,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/plugin/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAc,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC1D,OAAO,EAAE,gBAAgB,EAAyB,MAAM,UAAU,CAAC;AAGnE,QAAA,MAAM,IAAI,iEAyDR,CAAC;AAEH,OAAO,EAAE,IAAI,EAAE,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yoopta/link",
3
- "version": "4.6.8-rc.2",
3
+ "version": "4.6.9-rc.0",
4
4
  "description": "Link plugin for Yoopta Editor",
5
5
  "author": "Darginec05 <devopsbanda@gmail.com>",
6
6
  "homepage": "https://github.com/Darginec05/Editor-Yoopta#readme",
@@ -37,5 +37,5 @@
37
37
  "dependencies": {
38
38
  "lucide-react": "^0.379.0"
39
39
  },
40
- "gitHead": "da6fe4a17d3d3e620ddbaa86f236cd415b450b62"
40
+ "gitHead": "06ca135d5877d96ceee2c72347a05d237ce8e802"
41
41
  }