@yoopta/exports 2.0.0 → 4.5.2-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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2023-present Akhmed Ibragimov
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -1,2 +1,11 @@
1
- import { YooptaBaseElement, YooptaPluginType } from '@yoopta/editor';
2
- export declare function deserializeHtml(htmlString: string, plugins: YooptaPluginType<unknown, YooptaBaseElement<string>>[]): any;
1
+ import { YooEditor, YooptaContentValue } from '@yoopta/editor';
2
+ type PluginDeserializeParser = any;
3
+ export declare function isYooptaBlock(block: any): boolean;
4
+ type PluginsMapByNodeNames = Record<string, {
5
+ type: string;
6
+ parse: PluginDeserializeParser['parse'];
7
+ }>;
8
+ export declare function deserialize(editor: YooEditor, pluginsMap: PluginsMapByNodeNames, el: HTMLElement | ChildNode): any;
9
+ export declare function deserializeHTML(editor: YooEditor, htmlString: string): YooptaContentValue;
10
+ export {};
11
+ //# sourceMappingURL=deserialize.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deserialize.d.ts","sourceRoot":"","sources":["../../src/html/deserialize.ts"],"names":[],"mappings":"AACA,OAAO,EAGL,SAAS,EAIT,kBAAkB,EACnB,MAAM,gBAAgB,CAAC;AAExB,KAAK,uBAAuB,GAAG,GAAG,CAAC;AAEnC,wBAAgB,aAAa,CAAC,KAAK,EAAE,GAAG,GAAG,OAAO,CAEjD;AAYD,KAAK,qBAAqB,GAAG,MAAM,CAAC,MAAM,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,uBAAuB,CAAC,OAAO,CAAC,CAAA;CAAE,CAAC,CAAC;AAiCvG,wBAAgB,WAAW,CAAC,MAAM,EAAE,SAAS,EAAE,UAAU,EAAE,qBAAqB,EAAE,EAAE,EAAE,WAAW,GAAG,SAAS,OA2E5G;AAiCD,wBAAgB,eAAe,CAAC,MAAM,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,GAAG,kBAAkB,CAgBzF"}
@@ -1,2 +1,5 @@
1
- import { Descendant } from 'slate';
2
- export declare function serializeHtml(data: Descendant[], plugins: any): string;
1
+ import { YooEditor, YooptaBlockData, YooptaContentValue } from '@yoopta/editor';
2
+ export declare function getPluginByInlineElement(plugins: YooEditor['plugins'], elementType: string): import("@yoopta/editor/dist/plugins/types").Plugin<string, unknown, Record<string, unknown>> | undefined;
3
+ export declare function serialize(editor: YooEditor, blocksData: YooptaBlockData[]): string;
4
+ export declare function serializeHTML(editor: YooEditor, content: YooptaContentValue): string;
5
+ //# sourceMappingURL=serialize.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"serialize.d.ts","sourceRoot":"","sources":["../../src/html/serialize.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,eAAe,EAAgB,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAE9F,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,SAAS,CAAC,SAAS,CAAC,EAAE,WAAW,EAAE,MAAM,4GAG1F;AAsCD,wBAAgB,SAAS,CAAC,MAAM,EAAE,SAAS,EAAE,UAAU,EAAE,eAAe,EAAE,UAezE;AAED,wBAAgB,aAAa,CAAC,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,kBAAkB,UAG3E"}
package/dist/index.d.ts CHANGED
@@ -1,14 +1,20 @@
1
- import { serializeHtml } from './html/serialize';
1
+ import { serializeHTML } from './html/serialize';
2
+ import { deserializeHTML } from './html/deserialize';
2
3
  import { deserializeMarkdown } from './markdown/deserialize';
3
4
  import { serializeMarkdown } from './markdown/serialize';
4
- import { deserializeHtml } from './html/deserialize';
5
+ import { deserializeText } from './text/deserialize';
6
+ import { serializeText } from './text/serialize';
5
7
  declare const markdown: {
6
8
  deserialize: typeof deserializeMarkdown;
7
9
  serialize: typeof serializeMarkdown;
8
10
  };
9
11
  declare const html: {
10
- deserialize: typeof deserializeHtml;
11
- serialize: typeof serializeHtml;
12
+ deserialize: typeof deserializeHTML;
13
+ serialize: typeof serializeHTML;
14
+ };
15
+ declare const text: {
16
+ deserialize: typeof deserializeText;
17
+ serialize: typeof serializeText;
12
18
  };
13
19
  declare const yooptaExports: {
14
20
  markdown: {
@@ -16,9 +22,14 @@ declare const yooptaExports: {
16
22
  serialize: typeof serializeMarkdown;
17
23
  };
18
24
  html: {
19
- deserialize: typeof deserializeHtml;
20
- serialize: typeof serializeHtml;
25
+ deserialize: typeof deserializeHTML;
26
+ serialize: typeof serializeHTML;
27
+ };
28
+ text: {
29
+ deserialize: typeof deserializeText;
30
+ serialize: typeof serializeText;
21
31
  };
22
32
  };
23
- export { markdown, html };
33
+ export { markdown, html, text };
24
34
  export default yooptaExports;
35
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAC7D,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEjD,QAAA,MAAM,QAAQ;;;CAAqE,CAAC;AACpF,QAAA,MAAM,IAAI;;;CAA6D,CAAC;AACxE,QAAA,MAAM,IAAI;;;CAA6D,CAAC;AAExE,QAAA,MAAM,aAAa;;;;;;;;;;;;;CAIlB,CAAC;AAEF,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;AAEhC,eAAe,aAAa,CAAC"}
package/dist/index.js CHANGED
@@ -1,8 +1,8 @@
1
- import{Text as t,Range as e,Node as r,createEditor as n,Element as o}from"slate";"function"==typeof SuppressedError&&SuppressedError;var i="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},a=200,s="__lodash_hash_undefined__",c="[object Function]",u="[object GeneratorFunction]",l=/^\[object .+?Constructor\]$/,f="object"==typeof i&&i&&i.Object===Object&&i,p="object"==typeof self&&self&&self.Object===Object&&self,h=f||p||Function("return this")();function d(t,e){return!!(t?t.length:0)&&function(t,e,r){if(e!=e)return function(t,e,r,n){var o=t.length,i=r+(n?1:-1);for(;n?i--:++i<o;)if(e(t[i],i,t))return i;return-1}(t,y,r);var n=r-1,o=t.length;for(;++n<o;)if(t[n]===e)return n;return-1}(t,e,0)>-1}function v(t,e,r){for(var n=-1,o=t?t.length:0;++n<o;)if(r(e,t[n]))return!0;return!1}function y(t){return t!=t}function g(t,e){return t.has(e)}function b(t){var e=-1,r=Array(t.size);return t.forEach((function(t){r[++e]=t})),r}var m,_=Array.prototype,O=Function.prototype,w=Object.prototype,j=h["__core-js_shared__"],x=(m=/[^.]+$/.exec(j&&j.keys&&j.keys.IE_PROTO||""))?"Symbol(src)_1."+m:"",P=O.toString,E=w.hasOwnProperty,S=w.toString,T=RegExp("^"+P.call(E).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),z=_.splice,N=C(h,"Map"),D=C(h,"Set"),k=C(Object,"create");function F(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function R(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function $(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function A(t){var e=-1,r=t?t.length:0;for(this.__data__=new $;++e<r;)this.add(t[e])}function M(t,e){for(var r,n,o=t.length;o--;)if((r=t[o][0])===(n=e)||r!=r&&n!=n)return o;return-1}function B(t){if(!G(t)||(e=t,x&&x in e))return!1;var e,r=function(t){var e=G(t)?S.call(t):"";return e==c||e==u}(t)||function(t){var e=!1;if(null!=t&&"function"!=typeof t.toString)try{e=!!(t+"")}catch(t){}return e}(t)?T:l;return r.test(function(t){if(null!=t){try{return P.call(t)}catch(t){}try{return t+""}catch(t){}}return""}(t))}F.prototype.clear=function(){this.__data__=k?k(null):{}},F.prototype.delete=function(t){return this.has(t)&&delete this.__data__[t]},F.prototype.get=function(t){var e=this.__data__;if(k){var r=e[t];return r===s?void 0:r}return E.call(e,t)?e[t]:void 0},F.prototype.has=function(t){var e=this.__data__;return k?void 0!==e[t]:E.call(e,t)},F.prototype.set=function(t,e){return this.__data__[t]=k&&void 0===e?s:e,this},R.prototype.clear=function(){this.__data__=[]},R.prototype.delete=function(t){var e=this.__data__,r=M(e,t);return!(r<0)&&(r==e.length-1?e.pop():z.call(e,r,1),!0)},R.prototype.get=function(t){var e=this.__data__,r=M(e,t);return r<0?void 0:e[r][1]},R.prototype.has=function(t){return M(this.__data__,t)>-1},R.prototype.set=function(t,e){var r=this.__data__,n=M(r,t);return n<0?r.push([t,e]):r[n][1]=e,this},$.prototype.clear=function(){this.__data__={hash:new F,map:new(N||R),string:new F}},$.prototype.delete=function(t){return L(this,t).delete(t)},$.prototype.get=function(t){return L(this,t).get(t)},$.prototype.has=function(t){return L(this,t).has(t)},$.prototype.set=function(t,e){return L(this,t).set(t,e),this},A.prototype.add=A.prototype.push=function(t){return this.__data__.set(t,s),this},A.prototype.has=function(t){return this.__data__.has(t)};var I=D&&1/b(new D([,-0]))[1]==1/0?function(t){return new D(t)}:function(){};function L(t,e){var r,n,o=t.__data__;return("string"==(n=typeof(r=e))||"number"==n||"symbol"==n||"boolean"==n?"__proto__"!==r:null===r)?o["string"==typeof e?"string":"hash"]:o.map}function C(t,e){var r=function(t,e){return null==t?void 0:t[e]}(t,e);return B(r)?r:void 0}function G(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}var U=function(t,e){return t&&t.length?function(t,e,r){var n=-1,o=d,i=t.length,s=!0,c=[],u=c;if(r)s=!1,o=v;else if(i>=a){var l=e?null:I(t);if(l)return b(l);s=!1,o=g,u=new A}else u=e?[]:c;t:for(;++n<i;){var f=t[n],p=e?e(f):f;if(f=r||0!==f?f:0,s&&p==p){for(var h=u.length;h--;)if(u[h]===p)continue t;e&&u.push(p),c.push(f)}else o(u,p,r)||(u!==c&&u.push(p),c.push(f))}return c}(t,void 0,e):[]};function W(t){const e=t.map((t=>{const e=t.getPlugin,{childPlugin:r}=e,n=function(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(t);o<n.length;o++)e.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(t,n[o])&&(r[n[o]]=t[n[o]])}return r}(e,["childPlugin"]);return r?[n,Object.assign(Object.assign({},r.getPlugin),{hasParent:!0})]:n})).flat();return U(e,((t,e)=>t.type===e.type))}function q(t){const e=W(t),r={};return e.forEach((t=>r[t.type]=t)),r}function Y(t){const e=W(t),r={};return e.forEach((t=>{var e,n,o,i,a,s,c,u;if(null===(n=null===(e=t.exports)||void 0===e?void 0:e.html.deserialize)||void 0===n?void 0:n.nodeName){if(Array.isArray(null===(i=null===(o=t.exports)||void 0===o?void 0:o.html.deserialize)||void 0===i?void 0:i.nodeName))return void(null===(s=null===(a=t.exports)||void 0===a?void 0:a.html.deserialize)||void 0===s||s.nodeName.forEach((e=>{r[e]=t})));r[null===(u=null===(c=t.exports)||void 0===c?void 0:c.html.deserialize)||void 0===u?void 0:u.nodeName]=t}})),r}function H(e,r){var n,o;if(t.isText(e))return function(t){const e={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#039;"};return t.replace(/[&<>"']/g,(t=>e[t]))}(e.text);const i=e.children.map((t=>H(t,r))).join(""),a=r[e.type];return"function"==typeof(null===(o=null===(n=a.exports)||void 0===n?void 0:n.html)||void 0===o?void 0:o.serialize)?a.exports.html.serialize(e,i):i}
1
+ import{getRootBlockElementType as e,generateId as t,buildBlockData as n}from"@yoopta/editor";const r={underline:{type:"underline",tag:"U"},strike:{type:"strike",tag:"S"},code:{type:"code",tag:"CODE"},italic:{type:"italic",tag:"I"},bold:{type:"bold",tag:"B"}};function s(e,t){return e.map((e=>{var n,i;let o="";if(e.text)return o=Object.keys(r).reduce(((t,n)=>e[n]?`<${r[n].tag}>${t}</${r[n].tag}>`:t),e.text),o;if(e.type){const r=function(e,t){return Object.values(e).find((e=>{var n;return e.type===(null===(n=e.elements)||void 0===n?void 0:n[t].original)}))}(t,e.type);if(r&&(null===(i=null===(n=r.parsers)||void 0===n?void 0:n.html)||void 0===i?void 0:i.serialize))return o=r.parsers.html.serialize(e,s(e.children,t)),o}return o})).join("")}
2
2
  /*!
3
3
  * is-plain-object <https://github.com/jonschlinkert/is-plain-object>
4
4
  *
5
5
  * Copyright (c) 2014-2017, Jon Schlinkert.
6
6
  * Released under the MIT License.
7
7
  */
8
- function J(t){return"[object Object]"===Object.prototype.toString.call(t)}function K(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var Q=new WeakMap,V=new WeakMap;class X{}class Z extends X{constructor(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};super();var{offset:e,path:r}=t;this.offset=e,this.path=r}}class tt extends X{constructor(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};super();var{offset:e,path:r}=t;this.offset=e,this.path=r}}var et=t=>V.get(t);function rt(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function nt(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?rt(Object(r),!0).forEach((function(e){K(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):rt(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}var ot=new WeakSet,it=e=>{var r=[],n=e=>{if(null!=e){var i=r[r.length-1];if("string"==typeof e){var a={text:e};ot.add(a),e=a}if(t.isText(e)){var s=e;t.isText(i)&&ot.has(i)&&ot.has(s)&&t.equals(i,s,{loose:!0})?i.text+=s.text:r.push(s)}else if(o.isElement(e))r.push(e);else{if(!(e instanceof X))throw new Error("Unexpected hyperscript child object: ".concat(e));var c=r[r.length-1];t.isText(c)||(n(""),c=r[r.length-1]),e instanceof Z?((t,e)=>{var r=t.text.length;Q.set(t,[r,e])})(c,e):e instanceof tt&&((t,e)=>{var r=t.text.length;V.set(t,[r,e])})(c,e)}}};for(var i of e.flat(1/0))n(i);return r};function at(t,e,r){return nt(nt({},e),{},{children:it(r)})}function st(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function ct(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?st(Object(r),!0).forEach((function(e){K(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):st(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}var ut,lt={anchor:function(t,e,r){return new Z(e)},cursor:function(t,e,r){return[new Z(e),new tt(e)]},editor:(ut=n,(t,n,o)=>{var i,a=[];for(var s of o)e.isRange(s)?i=s:a.push(s);var c,u=it(a),l={},f=ut();for(var[p,h]of(Object.assign(f,n),f.children=u,r.texts(f))){var d=(c=p,Q.get(c)),v=et(p);if(null!=d){var[y]=d;l.anchor={path:h,offset:y}}if(null!=v){var[g]=v;l.focus={path:h,offset:g}}}if(l.anchor&&!l.focus)throw new Error("Slate hyperscript ranges must have both `<anchor />` and `<focus />` defined if one is defined, but you only defined `<anchor />`. For collapsed selections, use `<cursor />` instead.");if(!l.anchor&&l.focus)throw new Error("Slate hyperscript ranges must have both `<anchor />` and `<focus />` defined if one is defined, but you only defined `<focus />`. For collapsed selections, use `<cursor />` instead.");return null!=i?f.selection=i:e.isRange(l)&&(f.selection=l),f}),element:at,focus:function(t,e,r){return new tt(e)},fragment:function(t,e,r){return it(r)},selection:function(t,e,r){var n=r.find((t=>t instanceof Z)),o=r.find((t=>t instanceof tt));if(!n||null==n.offset||null==n.path)throw new Error("The <selection> hyperscript tag must have an <anchor> tag as a child with `path` and `offset` attributes defined.");if(!o||null==o.offset||null==o.path)throw new Error("The <selection> hyperscript tag must have a <focus> tag as a child with `path` and `offset` attributes defined.");return nt({anchor:{offset:n.offset,path:n.path},focus:{offset:o.offset,path:o.path}},e)},text:function(e,r,n){var o=it(n);if(o.length>1)throw new Error("The <text> hyperscript tag must only contain a single node's worth of children.");var[i]=o;if(null==i&&(i={text:""}),!t.isText(i))throw new Error("\n The <text> hyperscript tag can only contain text content as children.");return ot.delete(i),Object.assign(i,r),i}},ft=t=>function(e,r){for(var n=arguments.length,o=new Array(n>2?n-2:0),i=2;i<n;i++)o[i-2]=arguments[i];var a,s,c,u=t[e];if(!u)throw new Error("No hyperscript creator found for tag: <".concat(e,">"));return null==r&&(r={}),(!1===J(a=r)||void 0!==(s=a.constructor)&&(!1===J(c=s.prototype)||!1===c.hasOwnProperty("isPrototypeOf")))&&(o=[r].concat(o),r={}),u(e,r,o=o.filter((t=>Boolean(t))).flat())},pt=t=>{var e={},r=function(r){var n=t[r];if("object"!=typeof n)throw new Error("Properties specified for a hyperscript shorthand should be an object, but for the custom element <".concat(r,"> tag you passed: ").concat(n));e[r]=(t,e,r)=>at(0,ct(ct({},n),e),r)};for(var n in t)r(n);return e},ht=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{elements:e={}}=t,r=pt(e),n=ct(ct(ct({},lt),r),t.creators);return ft(n)}();const dt={DEL:()=>({strikethrough:!0}),EM:()=>({italic:!0}),I:()=>({italic:!0}),S:()=>({strikethrough:!0}),STRONG:()=>({bold:!0}),U:()=>({underline:!0})},vt=(e,r)=>{var n,o,i,a;if(3===e.nodeType)return e.textContent;if(1!==e.nodeType)return null;if("BR"===e.nodeName)return"\n";const{nodeName:s}=e;let c=e,u=Array.from(c.childNodes).map((t=>vt(t,r))).flat();if(0===u.length&&(u=[{text:""}]),"BODY"===e.nodeName)return ht("fragment",{},u);if(r[s]){const t=r[s];if(t){let r=t.defineElement();if("function"==typeof(null===(o=null===(n=t.exports)||void 0===n?void 0:n.html.deserialize)||void 0===o?void 0:o.parse)){const n=null===(a=null===(i=t.exports)||void 0===i?void 0:i.html.deserialize)||void 0===a?void 0:a.parse(e);r=Object.assign(Object.assign({},r),{data:n})}return ht("element",r,u)}}if(t.isTextList(u))return ht("element",r.P.defineElement(),u);if(dt[s]){const r=dt[s](e);return u.map((e=>t.isText(e)?ht("text",r,e):e))}return u};const yt=(e,r)=>{var n,o;if(t.isText(e))return e.text;const i=e.children.map((t=>yt(t,r))).join(""),a=null===(o=null===(n=r[e.type].exports)||void 0===n?void 0:n.markdown)||void 0===o?void 0:o.serialize;return"function"==typeof a?`${a(e,i)}\n`:`\n${i}\n`};const gt={DEL:()=>({strikethrough:!0}),EM:()=>({italic:!0}),I:()=>({italic:!0}),S:()=>({strikethrough:!0}),STRONG:()=>({bold:!0}),U:()=>({underline:!0})},bt=(e,r)=>{var n,o,i,a;if(3===e.nodeType)return e.textContent;if(1!==e.nodeType)return null;if("BR"===e.nodeName)return"\n";const{nodeName:s}=e;let c=e,u=Array.from(c.childNodes).map((t=>bt(t,r))).flat();if(0===u.length&&(u=[{text:""}]),"BODY"===e.nodeName)return ht("fragment",{},u);if(r[s]){const t=r[s];if(t){let r=t.defineElement();if("function"==typeof(null===(o=null===(n=t.exports)||void 0===n?void 0:n.html.deserialize)||void 0===o?void 0:o.parse)){const n=null===(a=null===(i=t.exports)||void 0===i?void 0:i.html.deserialize)||void 0===a?void 0:a.parse(e);r=Object.assign(Object.assign({},r),{data:n})}return ht("element",r,u)}}if(t.isTextList(u))return ht("element",r.P.defineElement(),u);if(gt[s]){const r=gt[s](e);return u.map((e=>t.isText(e)?ht("text",r,e):e))}return u};const mt={deserialize:function(t,e){const r=Y(e),n=(new DOMParser).parseFromString(t,"text/html");return vt(n.body,r)},serialize:function(t,e){const r=q(e);return t.map((t=>yt(t,r))).join("")}},_t={deserialize:function(t,e){const r=Y(e),n=(new DOMParser).parseFromString(t,"text/html");return bt(n.body,r)},serialize:function(t,e){const r=q(e);return t.map((t=>H(t,r))).join("")}},Ot={markdown:mt,html:_t};export{Ot as default,_t as html,mt as markdown};
8
+ function i(e){return"[object Object]"===Object.prototype.toString.call(e)}function o(e){var t,n;return!1!==i(e)&&(void 0===(t=e.constructor)||!1!==i(n=t.prototype)&&!1!==n.hasOwnProperty("isPrototypeOf"))}var a=Symbol.for("immer-nothing"),l=Symbol.for("immer-draftable"),c=Symbol.for("immer-state");function p(e,...t){throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var h=Object.getPrototypeOf;function u(e){return!!e&&!!e[c]}function f(e){return!!e&&(g(e)||Array.isArray(e)||!!e[l]||!!e.constructor?.[l]||x(e)||w(e))}var d=Object.prototype.constructor.toString();function g(e){if(!e||"object"!=typeof e)return!1;const t=h(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)===d}function k(e,t){0===y(e)?Reflect.ownKeys(e).forEach((n=>{t(n,e[n],e)})):e.forEach(((n,r)=>t(r,n,e)))}function y(e){const t=e[c];return t?t.type_:Array.isArray(e)?1:x(e)?2:w(e)?3:0}function b(e,t){return 2===y(e)?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function m(e,t,n){const r=y(e);2===r?e.set(t,n):3===r?e.add(n):e[t]=n}function x(e){return e instanceof Map}function w(e){return e instanceof Set}function v(e){return e.copy_||e.base_}function _(e,t){if(x(e))return new Map(e);if(w(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);if(!t&&g(e)){if(!h(e)){const t=Object.create(null);return Object.assign(t,e)}return{...e}}const n=Object.getOwnPropertyDescriptors(e);delete n[c];let r=Reflect.ownKeys(n);for(let t=0;t<r.length;t++){const s=r[t],i=n[s];!1===i.writable&&(i.writable=!0,i.configurable=!0),(i.get||i.set)&&(n[s]={configurable:!0,writable:!0,enumerable:i.enumerable,value:e[s]})}return Object.create(h(e),n)}function O(e,t=!1){return z(e)||u(e)||!f(e)||(y(e)>1&&(e.set=e.add=e.clear=e.delete=P),Object.freeze(e),t&&Object.entries(e).forEach((([e,t])=>O(t,!0)))),e}function P(){p(2)}function z(e){return Object.isFrozen(e)}var $,S={};function j(e){const t=S[e];return t||p(0),t}function E(){return $}function T(e,t){t&&(j("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function A(e){R(e),e.drafts_.forEach(N),e.drafts_=null}function R(e){e===$&&($=e.parent_)}function q(e){return $={drafts_:[],parent_:$,immer_:e,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function N(e){const t=e[c];0===t.type_||1===t.type_?t.revoke_():t.revoked_=!0}function C(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];return void 0!==e&&e!==n?(n[c].modified_&&(A(t),p(4)),f(e)&&(e=D(t,e),t.parent_||B(t,e)),t.patches_&&j("Patches").generateReplacementPatches_(n[c].base_,e,t.patches_,t.inversePatches_)):e=D(t,n,[]),A(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==a?e:void 0}function D(e,t,n){if(z(t))return t;const r=t[c];if(!r)return k(t,((s,i)=>I(e,r,t,s,i,n))),t;if(r.scope_!==e)return t;if(!r.modified_)return B(e,r.base_,!0),r.base_;if(!r.finalized_){r.finalized_=!0,r.scope_.unfinalizedDrafts_--;const t=r.copy_;let s=t,i=!1;3===r.type_&&(s=new Set(t),t.clear(),i=!0),k(s,((s,o)=>I(e,r,t,s,o,n,i))),B(e,t,!1),n&&e.patches_&&j("Patches").generatePatches_(r,n,e.patches_,e.inversePatches_)}return r.copy_}function I(e,t,n,r,s,i,o){if(u(s)){const o=D(e,s,i&&t&&3!==t.type_&&!b(t.assigned_,r)?i.concat(r):void 0);if(m(n,r,o),!u(o))return;e.canAutoFreeze_=!1}else o&&n.add(s);if(f(s)&&!z(s)){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1)return;D(e,s),t&&t.scope_.parent_||"symbol"==typeof r||!Object.prototype.propertyIsEnumerable.call(n,r)||B(e,s)}}function B(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&O(t,n)}var L={get(e,t){if(t===c)return e;const n=v(e);if(!b(n,t))return function(e,t,n){const r=Z(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_||!f(r)?r:r===F(e.base_,t)?(V(e),e.copy_[t]=W(r,e)):r},has:(e,t)=>t in v(e),ownKeys:e=>Reflect.ownKeys(v(e)),set(e,t,n){const r=Z(v(e),t);if(r?.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){const r=F(v(e),t),o=r?.[c];if(o&&o.base_===n)return e.copy_[t]=n,e.assigned_[t]=!1,!0;if(((s=n)===(i=r)?0!==s||1/s==1/i:s!=s&&i!=i)&&(void 0!==n||b(e.base_,t)))return!0;V(e),Q(e)}var s,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!==F(e.base_,t)||t in e.base_?(e.assigned_[t]=!1,V(e),Q(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0),getOwnPropertyDescriptor(e,t){const n=v(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r?{writable:!0,configurable:1!==e.type_||"length"!==t,enumerable:r.enumerable,value:n[t]}:r},defineProperty(){p(11)},getPrototypeOf:e=>h(e.base_),setPrototypeOf(){p(12)}},M={};function F(e,t){const n=e[c];return(n?v(n):e)[t]}function Z(e,t){if(!(t in e))return;let n=h(e);for(;n;){const e=Object.getOwnPropertyDescriptor(n,t);if(e)return e;n=h(n)}}function Q(e){e.modified_||(e.modified_=!0,e.parent_&&Q(e.parent_))}function V(e){e.copy_||(e.copy_=_(e.base_,e.scope_.immer_.useStrictShallowCopy_))}k(L,((e,t)=>{M[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}})),M.deleteProperty=function(e,t){return M.set.call(this,e,t,void 0)},M.set=function(e,t,n){return L.set.call(this,e[0],t,n,e[0])};function W(e,t){const n=x(e)?j("MapSet").proxyMap_(e,t):w(e)?j("MapSet").proxySet_(e,t):function(e,t){const n=Array.isArray(e),r={type_:n?1:0,scope_:t?t.scope_:E(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let s=r,i=L;n&&(s=[r],i=M);const{revoke:o,proxy:a}=Proxy.revocable(s,i);return r.draft_=a,r.revoke_=o,a}(e,t);return(t?t.scope_:E()).drafts_.push(n),n}function U(e){if(!f(e)||z(e))return e;const t=e[c];let n;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=_(e,t.scope_.immer_.useStrictShallowCopy_)}else n=_(e,!0);return k(n,((e,t)=>{m(n,e,U(t))})),t&&(t.finalized_=!1),n}var J=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,...s){return r.produce(e,(e=>t.call(this,e,...s)))}}let r;if("function"!=typeof t&&p(6),void 0!==n&&"function"!=typeof n&&p(7),f(e)){const s=q(this),i=W(e,void 0);let o=!0;try{r=t(i),o=!1}finally{o?A(s):R(s)}return T(s,n),C(r,s)}if(!e||"object"!=typeof e){if(r=t(e),void 0===r&&(r=e),r===a&&(r=void 0),this.autoFreeze_&&O(r,!0),n){const t=[],s=[];j("Patches").generateReplacementPatches_(e,r,t,s),n(t,s)}return r}p(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){f(e)||p(8),u(e)&&(e=function(e){u(e)||p(10);return U(e)}(e));const t=q(this),n=W(e,void 0);return n[c].isManual_=!0,R(t),n}finishDraft(e,t){const n=e&&e[c];n&&n.isManual_||p(9);const{scope_:r}=n;return T(r,t),C(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=j("Patches").applyPatches_;return u(e)?r(e,t):this.produce(e,(e=>r(e,t)))}},K=J.produce;J.produceWithPatches.bind(J),J.setAutoFreeze.bind(J),J.setUseStrictShallowCopy.bind(J),J.applyPatches.bind(J);var H=J.createDraft.bind(J),X=J.finishDraft.bind(J),G={ancestors(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{reverse:n=!1}=t,r=G.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 s=e[r];if(s!==t[r])break;n.push(s)}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),s=t.slice(0,n),i=e[n],o=t[n];return G.equals(r,s)&&i>o},endsAt(e,t){var n=e.length,r=e.slice(0,n),s=t.slice(0,n);return G.equals(r,s)},endsBefore(e,t){var n=e.length-1,r=e.slice(0,n),s=t.slice(0,n),i=e[n],o=t[n];return G.equals(r,s)&&i<o},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===G.compare(e,t),isAncestor:(e,t)=>e.length<t.length&&0===G.compare(e,t),isBefore:(e,t)=>-1===G.compare(e,t),isChild:(e,t)=>e.length===t.length+1&&0===G.compare(e,t),isCommon:(e,t)=>e.length<=t.length&&0===G.compare(e,t),isDescendant:(e,t)=>e.length>t.length&&0===G.compare(e,t),isParent:(e,t)=>e.length+1===t.length&&0===G.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]&&G.equals(n,r)},levels(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{reverse:n=!1}=t,r=[],s=0;s<=e.length;s++)r.push(e.slice(0,s));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(!G.isAncestor(t,e)&&!G.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:s="forward"}=n;if(0===e.length)return r;switch(t.type){case"insert_node":var{path:i}=t;(G.equals(i,r)||G.endsBefore(i,r)||G.isAncestor(i,r))&&(r[i.length-1]+=1);break;case"remove_node":var{path:o}=t;if(G.equals(o,r)||G.isAncestor(o,r))return null;G.endsBefore(o,r)&&(r[o.length-1]-=1);break;case"merge_node":var{path:a,position:l}=t;G.equals(a,r)||G.endsBefore(a,r)?r[a.length-1]-=1:G.isAncestor(a,r)&&(r[a.length-1]-=1,r[a.length]+=l);break;case"split_node":var{path:c,position:p}=t;if(G.equals(c,r)){if("forward"===s)r[r.length-1]+=1;else if("backward"!==s)return null}else G.endsBefore(c,r)?r[c.length-1]+=1:G.isAncestor(c,r)&&e[c.length]>=p&&(r[c.length-1]+=1,r[c.length]-=p);break;case"move_node":var{path:h,newPath:u}=t;if(G.equals(h,u))return r;if(G.isAncestor(h,r)||G.equals(h,r)){var f=u.slice();return G.endsBefore(h,u)&&h.length<u.length&&(f[h.length-1]-=1),f.concat(r.slice(h.length))}G.isSibling(h,u)&&(G.isAncestor(u,r)||G.equals(u,r))?G.endsBefore(h,r)?r[h.length-1]-=1:r[h.length-1]+=1:G.endsBefore(u,r)||G.equals(u,r)||G.isAncestor(u,r)?(G.endsBefore(h,r)&&(r[h.length-1]-=1),r[u.length-1]+=1):G.endsBefore(h,r)&&(G.equals(u,r)&&(r[u.length-1]+=1),r[h.length-1]-=1)}return r}};function Y(e){return Y="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},Y(e)}function ee(e){var t=function(e,t){if("object"!==Y(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!==Y(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===Y(t)?t:String(t)}function te(e,t,n){return(t=ee(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ne(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 re(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ne(Object(n),!0).forEach((function(t){te(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ne(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var se={transform(e,t){e.children=H(e.children);var n=e.selection&&H(e.selection);try{n=((e,t,n)=>{switch(n.type){case"insert_node":var{path:r,node:s}=n,i=ye.parent(e,r),o=r[r.length-1];if(o>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(o,0,s),t)for(var[a,l]of he.points(t))t[l]=Pe.transform(a,n);break;case"insert_text":var{path:c,offset:p,text:h}=n;if(0===h.length)break;var u=ye.leaf(e,c),f=u.text.slice(0,p),d=u.text.slice(p);if(u.text=f+h+d,t)for(var[g,k]of he.points(t))t[k]=Pe.transform(g,n);break;case"merge_node":var{path:y}=n,b=ye.get(e,y),m=G.previous(y),x=ye.get(e,m),w=ye.parent(e,y),v=y[y.length-1];if(Re.isText(b)&&Re.isText(x))x.text+=b.text;else{if(Re.isText(b)||Re.isText(x))throw new Error('Cannot apply a "merge_node" operation at path ['.concat(y,"] to nodes of different interfaces: ").concat($e.stringify(b)," ").concat($e.stringify(x)));x.children.push(...b.children)}if(w.children.splice(v,1),t)for(var[_,O]of he.points(t))t[O]=Pe.transform(_,n);break;case"move_node":var{path:P,newPath:z}=n;if(G.isAncestor(P,z))throw new Error("Cannot move a path [".concat(P,"] to new path [").concat(z,"] because the destination is inside itself."));var $=ye.get(e,P),S=ye.parent(e,P),j=P[P.length-1];S.children.splice(j,1);var E=G.transform(P,n),T=ye.get(e,G.parent(E)),A=E[E.length-1];if(T.children.splice(A,0,$),t)for(var[R,q]of he.points(t))t[q]=Pe.transform(R,n);break;case"remove_node":var{path:N}=n,C=N[N.length-1];if(ye.parent(e,N).children.splice(C,1),t)for(var[D,I]of he.points(t)){var B=Pe.transform(D,n);if(null!=t&&null!=B)t[I]=B;else{var L=void 0,M=void 0;for(var[F,Z]of ye.texts(e)){if(-1!==G.compare(Z,N)){M=[F,Z];break}L=[F,Z]}var Q=!1;L&&M&&(Q=G.equals(M[1],N)?!G.hasPrevious(M[1]):G.common(L[1],N).length<G.common(M[1],N).length),L&&!Q?(D.path=L[1],D.offset=L[0].text.length):M?(D.path=M[1],D.offset=0):t=null}}break;case"remove_text":var{path:V,offset:W,text:U}=n;if(0===U.length)break;var J=ye.leaf(e,V),K=J.text.slice(0,W),H=J.text.slice(W+U.length);if(J.text=K+H,t)for(var[X,Y]of he.points(t))t[Y]=Pe.transform(X,n);break;case"set_node":var{path:ee,properties:te,newProperties:ne}=n;if(0===ee.length)throw new Error("Cannot set properties on the root node!");var se=ye.get(e,ee);for(var ie in ne){if("children"===ie||"text"===ie)throw new Error('Cannot set the "'.concat(ie,'" property of nodes!'));var oe=ne[ie];null==oe?delete se[ie]:se[ie]=oe}for(var ae in te)ne.hasOwnProperty(ae)||delete se[ae];break;case"set_selection":var{newProperties:le}=n;if(null==le)t=le;else{if(null==t){if(!he.isRange(le))throw new Error('Cannot apply an incomplete "set_selection" operation properties '.concat($e.stringify(le)," when there is no current selection."));t=re({},le)}for(var ce in le){var pe=le[ce];if(null==pe){if("anchor"===ce||"focus"===ce)throw new Error('Cannot remove the "'.concat(ce,'" selection property'));delete t[ce]}else t[ce]=pe}}break;case"split_node":var{path:ue,position:fe,properties:de}=n;if(0===ue.length)throw new Error('Cannot apply a "split_node" operation at path ['.concat(ue,"] because the root node cannot be split."));var ge,ke=ye.get(e,ue),be=ye.parent(e,ue),me=ue[ue.length-1];if(Re.isText(ke)){var xe=ke.text.slice(0,fe),we=ke.text.slice(fe);ke.text=xe,ge=re(re({},de),{},{text:we})}else{var ve=ke.children.slice(0,fe),_e=ke.children.slice(fe);ke.children=ve,ge=re(re({},de),{},{children:_e})}if(be.children.splice(me+1,0,ge),t)for(var[Oe,ze]of he.points(t))t[ze]=Pe.transform(Oe,n)}return t})(e,n,t)}finally{e.children=X(e.children),e.selection=n?u(n)?X(n):n:null}}},ie={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)}},oe={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)}},ae=(e,t)=>{for(var n in e){var r=e[n],s=t[n];if(o(r)&&o(s)){if(!ae(r,s))return!1}else if(Array.isArray(r)&&Array.isArray(s)){if(r.length!==s.length)return!1;for(var i=0;i<r.length;i++)if(r[i]!==s[i])return!1}else if(r!==s)return!1}for(var a in t)if(void 0===e[a]&&void 0!==t[a])return!1;return!0};function le(e,t){if(null==e)return{};var n,r,s=function(e,t){if(null==e)return{};var n,r,s={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(s[n]=e[n]);return s}(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)&&(s[n]=e[n])}return s}var ce=["anchor","focus"];function pe(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 he={edges(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{reverse:n=!1}=t,{anchor:r,focus:s}=e;return he.isBackward(e)===n?[r,s]:[s,r]},end(e){var[,t]=he.edges(e);return t},equals:(e,t)=>Pe.equals(e.anchor,t.anchor)&&Pe.equals(e.focus,t.focus),includes(e,t){if(he.isRange(t)){if(he.includes(e,t.anchor)||he.includes(e,t.focus))return!0;var[n,r]=he.edges(e),[s,i]=he.edges(t);return Pe.isBefore(n,s)&&Pe.isAfter(r,i)}var[o,a]=he.edges(e),l=!1,c=!1;return Pe.isPoint(t)?(l=Pe.compare(t,o)>=0,c=Pe.compare(t,a)<=0):(l=G.compare(t,o.path)>=0,c=G.compare(t,a.path)<=0),l&&c},intersection(e,t){var n=le(e,ce),[r,s]=he.edges(e),[i,o]=he.edges(t),a=Pe.isBefore(r,i)?i:r,l=Pe.isBefore(s,o)?s:o;return Pe.isBefore(l,a)?null:function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?pe(Object(n),!0).forEach((function(t){te(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):pe(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 Pe.isAfter(t,n)},isCollapsed(e){var{anchor:t,focus:n}=e;return Pe.equals(t,n)},isExpanded:e=>!he.isCollapsed(e),isForward:e=>!he.isBackward(e),isRange:e=>o(e)&&Pe.isPoint(e.anchor)&&Pe.isPoint(e.focus),*points(e){yield[e.anchor,"anchor"],yield[e.focus,"focus"]},start(e){var[t]=he.edges(e);return t},transform(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return K(e,(e=>{if(null===e)return null;var r,s,{affinity:i="inward"}=n;if("inward"===i){var o=he.isCollapsed(e);he.isForward(e)?(r="forward",s=o?r:"backward"):(r="backward",s=o?r:"forward")}else"outward"===i?he.isForward(e)?(r="backward",s="forward"):(r="forward",s="backward"):(r=i,s=i);var a=Pe.transform(e.anchor,t,{affinity:r}),l=Pe.transform(e.focus,t,{affinity:s});if(!a||!l)return null;e.anchor=a,e.focus=l}))}},ue=e=>o(e)&&ye.isNodeList(e.children)&&!ve.isEditor(e),fe={isAncestor:e=>o(e)&&ye.isNodeList(e.children),isElement:ue,isElementList:e=>Array.isArray(e)&&e.every((e=>fe.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 ue(e)&&e[n]===t},matches(e,t){for(var n in t)if("children"!==n&&e[n]!==t[n])return!1;return!0}},de=["children"],ge=["text"],ke=new WeakMap,ye={ancestor(e,t){var n=ye.get(e,t);if(Re.isText(n))throw new Error("Cannot get the ancestor node at path [".concat(t,"] because it refers to a text node instead: ").concat($e.stringify(n)));return n},ancestors(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return function*(){for(var r of G.ancestors(t,n)){var s=[ye.ancestor(e,r),r];yield s}}()},child(e,t){if(Re.isText(e))throw new Error("Cannot get the child of a text node: ".concat($e.stringify(e)));var n=e.children[t];if(null==n)throw new Error("Cannot get child at index `".concat(t,"` in node: ").concat($e.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,s=ye.ancestor(e,t),{children:i}=s,o=r?i.length-1:0;r?o>=0:o<i.length;){var a=ye.child(s,o),l=t.concat(o);yield[a,l],o=r?o-1:o+1}}()},common(e,t,n){var r=G.common(t,n);return[ye.get(e,r),r]},descendant(e,t){var n=ye.get(e,t);if(ve.isEditor(n))throw new Error("Cannot get the descendant node at path [".concat(t,"] because it refers to the root editor node instead: ").concat($e.stringify(n)));return n},descendants(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function*(){for(var[n,r]of ye.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 ye.nodes(e,t))fe.isElement(n)&&(yield[n,r])}()},extractProps:e=>fe.isAncestor(e)?le(e,de):le(e,ge),first(e,t){for(var n=t.slice(),r=ye.get(e,n);r&&!Re.isText(r)&&0!==r.children.length;)r=r.children[0],n.push(0);return[r,n]},fragment(e,t){if(Re.isText(e))throw new Error("Cannot get a fragment starting from a root text node: ".concat($e.stringify(e)));return K({children:e.children},(e=>{var[n,r]=he.edges(t),s=ye.nodes(e,{reverse:!0,pass:e=>{var[,n]=e;return!he.includes(t,n)}});for(var[,i]of s){if(!he.includes(t,i)){var o=ye.parent(e,i),a=i[i.length-1];o.children.splice(a,1)}if(G.equals(i,r.path)){var l=ye.leaf(e,i);l.text=l.text.slice(0,r.offset)}if(G.equals(i,n.path)){var c=ye.leaf(e,i);c.text=c.text.slice(n.offset)}}ve.isEditor(e)&&(e.selection=null)})).children},get(e,t){for(var n=e,r=0;r<t.length;r++){var s=t[r];if(Re.isText(n)||!n.children[s])throw new Error("Cannot find a descendant at path [".concat(t,"] in node: ").concat($e.stringify(e)));n=n.children[s]}return n},has(e,t){for(var n=e,r=0;r<t.length;r++){var s=t[r];if(Re.isText(n)||!n.children[s])return!1;n=n.children[s]}return!0},isNode:e=>Re.isText(e)||fe.isElement(e)||ve.isEditor(e),isNodeList(e){if(!Array.isArray(e))return!1;var t=ke.get(e);if(void 0!==t)return t;var n=e.every((e=>ye.isNode(e)));return ke.set(e,n),n},last(e,t){for(var n=t.slice(),r=ye.get(e,n);r&&!Re.isText(r)&&0!==r.children.length;){var s=r.children.length-1;r=r.children[s],n.push(s)}return[r,n]},leaf(e,t){var n=ye.get(e,t);if(!Re.isText(n))throw new Error("Cannot get the leaf node at path [".concat(t,"] because it refers to a non-leaf node: ").concat($e.stringify(n)));return n},levels(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return function*(){for(var r of G.levels(t,n)){var s=ye.get(e,r);yield[s,r]}}()},matches:(e,t)=>fe.isElement(e)&&fe.isElementProps(t)&&fe.matches(e,t)||Re.isText(e)&&Re.isTextProps(t)&&Re.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:s=[],to:i}=t,o=new Set,a=[],l=e;!i||!(r?G.isBefore(a,i):G.isAfter(a,i));)if(o.has(l)||(yield[l,a]),o.has(l)||Re.isText(l)||0===l.children.length||null!=n&&!1!==n([l,a])){if(0===a.length)break;if(!r){var c=G.next(a);if(ye.has(e,c)){a=c,l=ye.get(e,a);continue}}if(r&&0!==a[a.length-1])a=G.previous(a),l=ye.get(e,a);else a=G.parent(a),l=ye.get(e,a),o.add(l)}else{o.add(l);var p=r?l.children.length-1:0;G.isAncestor(a,s)&&(p=s[a.length]),a=a.concat(p),l=ye.get(e,a)}}()},parent(e,t){var n=G.parent(t),r=ye.get(e,n);if(Re.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=>Re.isText(e)?e.text:e.children.map(ye.string).join(""),texts(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function*(){for(var[n,r]of ye.nodes(e,t))Re.isText(n)&&(yield[n,r])}()}};function be(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 me(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?be(Object(n),!0).forEach((function(t){te(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):be(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var xe={isNodeOperation:e=>xe.isOperation(e)&&e.type.endsWith("_node"),isOperation(e){if(!o(e))return!1;switch(e.type){case"insert_node":case"remove_node":return G.isPath(e.path)&&ye.isNode(e.node);case"insert_text":case"remove_text":return"number"==typeof e.offset&&"string"==typeof e.text&&G.isPath(e.path);case"merge_node":return"number"==typeof e.position&&G.isPath(e.path)&&o(e.properties);case"move_node":return G.isPath(e.path)&&G.isPath(e.newPath);case"set_node":return G.isPath(e.path)&&o(e.properties)&&o(e.newProperties);case"set_selection":return null===e.properties&&he.isRange(e.newProperties)||null===e.newProperties&&he.isRange(e.properties)||o(e.properties)&&o(e.newProperties);case"split_node":return G.isPath(e.path)&&"number"==typeof e.position&&o(e.properties);default:return!1}},isOperationList:e=>Array.isArray(e)&&e.every((e=>xe.isOperation(e))),isSelectionOperation:e=>xe.isOperation(e)&&e.type.endsWith("_selection"),isTextOperation:e=>xe.isOperation(e)&&e.type.endsWith("_text"),inverse(e){switch(e.type){case"insert_node":return me(me({},e),{},{type:"remove_node"});case"insert_text":return me(me({},e),{},{type:"remove_text"});case"merge_node":return me(me({},e),{},{type:"split_node",path:G.previous(e.path)});case"move_node":var{newPath:t,path:n}=e;if(G.equals(t,n))return e;if(G.isSibling(n,t))return me(me({},e),{},{path:t,newPath:n});var r=G.transform(n,e),s=G.transform(G.next(n),e);return me(me({},e),{},{path:r,newPath:s});case"remove_node":return me(me({},e),{},{type:"insert_node"});case"remove_text":return me(me({},e),{},{type:"insert_text"});case"set_node":var{properties:i,newProperties:o}=e;return me(me({},e),{},{properties:o,newProperties:i});case"set_selection":var{properties:a,newProperties:l}=e;return me(me({},e),{},null==a?{properties:l,newProperties:null}:null==l?{properties:null,newProperties:a}:{properties:l,newProperties:a});case"split_node":return me(me({},e),{},{type:"merge_node",path:G.next(e.path)})}}},we=new WeakMap,ve={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=we.get(e);if(void 0!==t)return t;if(!o(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||o(e.marks))&&(null===e.selection||he.isRange(e.selection))&&ye.isNodeList(e.children)&&xe.isOperationList(e.operations);return we.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 _e(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 Oe(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?_e(Object(n),!0).forEach((function(t){te(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):_e(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var Pe={compare(e,t){var n=G.compare(e.path,t.path);return 0===n?e.offset<t.offset?-1:e.offset>t.offset?1:0:n},isAfter:(e,t)=>1===Pe.compare(e,t),isBefore:(e,t)=>-1===Pe.compare(e,t),equals:(e,t)=>e.offset===t.offset&&G.equals(e.path,t.path),isPoint:e=>o(e)&&"number"==typeof e.offset&&G.isPath(e.path),transform(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return K(e,(e=>{if(null===e)return null;var{affinity:r="forward"}=n,{path:s,offset:i}=e;switch(t.type){case"insert_node":case"move_node":e.path=G.transform(s,t,n);break;case"insert_text":G.equals(t.path,s)&&(t.offset<i||t.offset===i&&"forward"===r)&&(e.offset+=t.text.length);break;case"merge_node":G.equals(t.path,s)&&(e.offset+=t.position),e.path=G.transform(s,t,n);break;case"remove_text":G.equals(t.path,s)&&t.offset<=i&&(e.offset-=Math.min(i-t.offset,t.text.length));break;case"remove_node":if(G.equals(t.path,s)||G.isAncestor(t.path,s))return null;e.path=G.transform(s,t,n);break;case"split_node":if(G.equals(t.path,s)){if(t.position===i&&null==r)return null;(t.position<i||t.position===i&&"forward"===r)&&(e.offset-=t.position,e.path=G.transform(s,t,Oe(Oe({},n),{},{affinity:"forward"})))}else e.path=G.transform(s,t,n)}}))}},ze=void 0,$e={setScrubber(e){ze=e},stringify:e=>JSON.stringify(e,ze)},Se=["text"],je=["anchor","focus"];function Ee(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 Te(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Ee(Object(n),!0).forEach((function(t){te(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ee(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var Ae,Re={equals(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},{loose:r=!1}=n;function s(e){return le(e,Se)}return ae(r?s(e):e,r?s(t):t)},isText:e=>o(e)&&"string"==typeof e.text,isTextList:e=>Array.isArray(e)&&e.every((e=>Re.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=[Te({},e)];for(var r of t){var s=le(r,je),[i,o]=he.edges(r),a=[],l=0,c=i.offset,p=o.offset;for(var h of n){var{length:u}=h.text,f=l;if(l+=u,c<=f&&l<=p)Object.assign(h,s),a.push(h);else if(c!==p&&(c===l||p===f)||c>l||p<f||p===f&&0!==f)a.push(h);else{var d=h,g=void 0,k=void 0;if(p<l){var y=p-f;k=Te(Te({},d),{},{text:d.text.slice(y)}),d=Te(Te({},d),{},{text:d.text.slice(0,y)})}if(c>f){var b=c-f;g=Te(Te({},d),{},{text:d.text.slice(0,b)}),d=Te(Te({},d),{},{text:d.text.slice(b)})}Object.assign(d,s),g&&a.push(g),a.push(d),k&&a.push(k)}}n=a}return n}},qe=e=>e.selection?e.selection:e.children.length>0?ve.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"}(Ae||(Ae={})),Ae.L,Ae.L,Ae.V,Ae.LV,Ae.LVT,Ae.LV,Ae.V,Ae.V,Ae.T,Ae.LVT,Ae.T,Ae.T,Ae.Any,Ae.Extend,Ae.ZWJ,Ae.Any,Ae.SpacingMark,Ae.Prepend,Ae.Any,Ae.ZWJ,Ae.ExtPict,Ae.RI,Ae.RI;var Ne={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]:{};ve.withoutNormalizing(e,(()=>{var{voids:r=!1}=n,{at:s=qe(e)}=n;if(G.isPath(s)&&(s=ve.range(e,s)),he.isRange(s))if(he.isCollapsed(s))s=s.anchor;else{var i=he.end(s);if(!r&&ve.void(e,{at:i}))return;var o=he.start(s),a=ve.pointRef(e,o),l=ve.pointRef(e,i);Ie.delete(e,{at:s,voids:r});var c=a.unref(),p=l.unref();s=c||p,Ie.setSelection(e,{anchor:s,focus:s})}if(!(!r&&ve.void(e,{at:s})||ve.elementReadOnly(e,{at:s}))){var{path:h,offset:u}=s;t.length>0&&e.apply({type:"insert_text",path:h,offset:u,text:t})}}))}};function Ce(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 De(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Ce(Object(n),!0).forEach((function(t){te(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ce(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var Ie=De(De(De(De({},se),ie),oe),Ne);function Be(e){return!!(e&&e.id&&e.type&&e.value&&e.meta)}const Le={B:{type:"bold"},STRONG:{type:"bold"},I:{type:"italic"},U:{type:"underline"},S:{type:"strike"},CODE:{type:"code"},EM:{type:"italic"}};function Me(r,s,i){var o,a,l,c;if(3===i.nodeType){return null===(o=i.textContent)||void 0===o?void 0:o.replace(/[\t\n\r\f\v]+/g," ")}if(1!==i.nodeType)return null;if("BR"===i.nodeName)return"\n";const p=i;let h=Array.from(p.childNodes).map((e=>Me(r,s,e))).flat();if(Le[i.nodeName]){return{[Le[i.nodeName].type]:!0,text:null===(a=i.textContent)||void 0===a?void 0:a.replace(/[\t\n\r\f\v]+/g," ")}}const u=s[i.nodeName];if(u){let s;if(u.parse){s=u.parse(i);if(fe.isElement(s)&&"inline"===(null===(l=null==s?void 0:s.props)||void 0===l?void 0:l.nodeType))return s}const o=r.blocks[u.type],a=e(o.elements)||"",p=o.elements[a],f="void"===(null===(c=p.props)||void 0===c?void 0:c.nodeType);let d={id:t(),type:a,children:f&&!o.hasCustomEditor?[{text:""}]:h.map(Fe),props:Object.assign({nodeType:"block"},p.props)};if(s)if(fe.isElement(s))d=s;else if(Array.isArray(s)){return s}0===d.children.length&&(d.children=[{text:""}]);return n({id:t(),type:u.type,value:[d],meta:{order:0,depth:0}})}return h}function Fe(e){if("string"==typeof e)return{text:e};if(fe.isElement(e))return e;if(Array.isArray(e))return{text:e[0]};if(e.text)return e;if(Be(e)){let t="";return e.value[0].children.forEach((e=>{t+=`${e.text}`})),{text:t}}return{text:""}}function Ze(e,t){const n=(new DOMParser).parseFromString(t,"text/html"),r={},s=function(e){const t={};return Object.keys(e.plugins).forEach((n=>{const r=e.plugins[n],{parsers:s}=r;if(s){const{html:e}=s;if(e){const{deserialize:r}=e;if(r){const{nodeNames:e}=r;e&&e.forEach((e=>{t[e]={type:n,parse:r.parse}}))}}}})),t}(e);return Me(e,s,n.body).filter(Be).forEach(((e,t)=>{const n=e;n.meta.order=t,r[e.id]=n})),r}function Qe(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}let Ve={async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null};function We(e){Ve=e}const Ue=/[&<>"']/,Je=new RegExp(Ue.source,"g"),Ke=/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,He=new RegExp(Ke.source,"g"),Xe={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},Ge=e=>Xe[e];function Ye(e,t){if(t){if(Ue.test(e))return e.replace(Je,Ge)}else if(Ke.test(e))return e.replace(He,Ge);return e}const et=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/gi;const tt=/(^|[^\[])\^/g;function nt(e,t){let n="string"==typeof e?e:e.source;t=t||"";const r={replace:(e,t)=>{let s="string"==typeof t?t:t.source;return s=s.replace(tt,"$1"),n=n.replace(e,s),r},getRegex:()=>new RegExp(n,t)};return r}function rt(e){try{e=encodeURI(e).replace(/%25/g,"%")}catch(e){return null}return e}const st={exec:()=>null};function it(e,t){const n=e.replace(/\|/g,((e,t,n)=>{let r=!1,s=t;for(;--s>=0&&"\\"===n[s];)r=!r;return r?"|":" |"})).split(/ \|/);let r=0;if(n[0].trim()||n.shift(),n.length>0&&!n[n.length-1].trim()&&n.pop(),t)if(n.length>t)n.splice(t);else for(;n.length<t;)n.push("");for(;r<n.length;r++)n[r]=n[r].trim().replace(/\\\|/g,"|");return n}function ot(e,t,n){const r=e.length;if(0===r)return"";let s=0;for(;s<r;){const i=e.charAt(r-s-1);if(i!==t||n){if(i===t||!n)break;s++}else s++}return e.slice(0,r-s)}function at(e,t,n,r){const s=t.href,i=t.title?Ye(t.title):null,o=e[1].replace(/\\([\[\]])/g,"$1");if("!"!==e[0].charAt(0)){r.state.inLink=!0;const e={type:"link",raw:n,href:s,title:i,text:o,tokens:r.inlineTokens(o)};return r.state.inLink=!1,e}return{type:"image",raw:n,href:s,title:i,text:Ye(o)}}class lt{options;rules;lexer;constructor(e){this.options=e||Ve}space(e){const t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return{type:"space",raw:t[0]}}code(e){const t=this.rules.block.code.exec(e);if(t){const e=t[0].replace(/^ {1,4}/gm,"");return{type:"code",raw:t[0],codeBlockStyle:"indented",text:this.options.pedantic?e:ot(e,"\n")}}}fences(e){const t=this.rules.block.fences.exec(e);if(t){const e=t[0],n=function(e,t){const n=e.match(/^(\s+)(?:```)/);if(null===n)return t;const r=n[1];return t.split("\n").map((e=>{const t=e.match(/^\s+/);if(null===t)return e;const[n]=t;return n.length>=r.length?e.slice(r.length):e})).join("\n")}(e,t[3]||"");return{type:"code",raw:e,lang:t[2]?t[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):t[2],text:n}}}heading(e){const t=this.rules.block.heading.exec(e);if(t){let e=t[2].trim();if(/#$/.test(e)){const t=ot(e,"#");this.options.pedantic?e=t.trim():t&&!/ $/.test(t)||(e=t.trim())}return{type:"heading",raw:t[0],depth:t[1].length,text:e,tokens:this.lexer.inline(e)}}}hr(e){const t=this.rules.block.hr.exec(e);if(t)return{type:"hr",raw:ot(t[0],"\n")}}blockquote(e){const t=this.rules.block.blockquote.exec(e);if(t){let e=ot(t[0],"\n").split("\n"),n="",r="";const s=[];for(;e.length>0;){let t=!1;const i=[];let o;for(o=0;o<e.length;o++)if(/^ {0,3}>/.test(e[o]))i.push(e[o]),t=!0;else{if(t)break;i.push(e[o])}e=e.slice(o);const a=i.join("\n"),l=a.replace(/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,"\n $1").replace(/^ {0,3}>[ \t]?/gm,"");n=n?`${n}\n${a}`:a,r=r?`${r}\n${l}`:l;const c=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(l,s,!0),this.lexer.state.top=c,0===e.length)break;const p=s[s.length-1];if("code"===p?.type)break;if("blockquote"===p?.type){const t=p,i=t.raw+"\n"+e.join("\n"),o=this.blockquote(i);s[s.length-1]=o,n=n.substring(0,n.length-t.raw.length)+o.raw,r=r.substring(0,r.length-t.text.length)+o.text;break}if("list"!==p?.type);else{const t=p,i=t.raw+"\n"+e.join("\n"),o=this.list(i);s[s.length-1]=o,n=n.substring(0,n.length-p.raw.length)+o.raw,r=r.substring(0,r.length-t.raw.length)+o.raw,e=i.substring(s[s.length-1].raw.length).split("\n")}}return{type:"blockquote",raw:n,tokens:s,text:r}}}list(e){let t=this.rules.block.list.exec(e);if(t){let n=t[1].trim();const r=n.length>1,s={type:"list",raw:"",ordered:r,start:r?+n.slice(0,-1):"",loose:!1,items:[]};n=r?`\\d{1,9}\\${n.slice(-1)}`:`\\${n}`,this.options.pedantic&&(n=r?n:"[*+-]");const i=new RegExp(`^( {0,3}${n})((?:[\t ][^\\n]*)?(?:\\n|$))`);let o="",a="",l=!1;for(;e;){let n=!1;if(!(t=i.exec(e)))break;if(this.rules.block.hr.test(e))break;o=t[0],e=e.substring(o.length);let r=t[2].split("\n",1)[0].replace(/^\t+/,(e=>" ".repeat(3*e.length))),c=e.split("\n",1)[0],p=0;this.options.pedantic?(p=2,a=r.trimStart()):(p=t[2].search(/[^ ]/),p=p>4?1:p,a=r.slice(p),p+=t[1].length);let h=!1;if(!r&&/^ *$/.test(c)&&(o+=c+"\n",e=e.substring(c.length+1),n=!0),!n){const t=new RegExp(`^ {0,${Math.min(3,p-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ \t][^\\n]*)?(?:\\n|$))`),n=new RegExp(`^ {0,${Math.min(3,p-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),s=new RegExp(`^ {0,${Math.min(3,p-1)}}(?:\`\`\`|~~~)`),i=new RegExp(`^ {0,${Math.min(3,p-1)}}#`);for(;e;){const l=e.split("\n",1)[0];if(c=l,this.options.pedantic&&(c=c.replace(/^ {1,4}(?=( {4})*[^ ])/g," ")),s.test(c))break;if(i.test(c))break;if(t.test(c))break;if(n.test(e))break;if(c.search(/[^ ]/)>=p||!c.trim())a+="\n"+c.slice(p);else{if(h)break;if(r.search(/[^ ]/)>=4)break;if(s.test(r))break;if(i.test(r))break;if(n.test(r))break;a+="\n"+c}h||c.trim()||(h=!0),o+=l+"\n",e=e.substring(l.length+1),r=c.slice(p)}}s.loose||(l?s.loose=!0:/\n *\n *$/.test(o)&&(l=!0));let u,f=null;this.options.gfm&&(f=/^\[[ xX]\] /.exec(a),f&&(u="[ ] "!==f[0],a=a.replace(/^\[[ xX]\] +/,""))),s.items.push({type:"list_item",raw:o,task:!!f,checked:u,loose:!1,text:a,tokens:[]}),s.raw+=o}s.items[s.items.length-1].raw=o.trimEnd(),s.items[s.items.length-1].text=a.trimEnd(),s.raw=s.raw.trimEnd();for(let e=0;e<s.items.length;e++)if(this.lexer.state.top=!1,s.items[e].tokens=this.lexer.blockTokens(s.items[e].text,[]),!s.loose){const t=s.items[e].tokens.filter((e=>"space"===e.type)),n=t.length>0&&t.some((e=>/\n.*\n/.test(e.raw)));s.loose=n}if(s.loose)for(let e=0;e<s.items.length;e++)s.items[e].loose=!0;return s}}html(e){const t=this.rules.block.html.exec(e);if(t){return{type:"html",block:!0,raw:t[0],pre:"pre"===t[1]||"script"===t[1]||"style"===t[1],text:t[0]}}}def(e){const t=this.rules.block.def.exec(e);if(t){const e=t[1].toLowerCase().replace(/\s+/g," "),n=t[2]?t[2].replace(/^<(.*)>$/,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",r=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):t[3];return{type:"def",tag:e,raw:t[0],href:n,title:r}}}table(e){const t=this.rules.block.table.exec(e);if(!t)return;if(!/[:|]/.test(t[2]))return;const n=it(t[1]),r=t[2].replace(/^\||\| *$/g,"").split("|"),s=t[3]&&t[3].trim()?t[3].replace(/\n[ \t]*$/,"").split("\n"):[],i={type:"table",raw:t[0],header:[],align:[],rows:[]};if(n.length===r.length){for(const e of r)/^ *-+: *$/.test(e)?i.align.push("right"):/^ *:-+: *$/.test(e)?i.align.push("center"):/^ *:-+ *$/.test(e)?i.align.push("left"):i.align.push(null);for(let e=0;e<n.length;e++)i.header.push({text:n[e],tokens:this.lexer.inline(n[e]),header:!0,align:i.align[e]});for(const e of s)i.rows.push(it(e,i.header.length).map(((e,t)=>({text:e,tokens:this.lexer.inline(e),header:!1,align:i.align[t]}))));return i}}lheading(e){const t=this.rules.block.lheading.exec(e);if(t)return{type:"heading",raw:t[0],depth:"="===t[2].charAt(0)?1:2,text:t[1],tokens:this.lexer.inline(t[1])}}paragraph(e){const t=this.rules.block.paragraph.exec(e);if(t){const e="\n"===t[1].charAt(t[1].length-1)?t[1].slice(0,-1):t[1];return{type:"paragraph",raw:t[0],text:e,tokens:this.lexer.inline(e)}}}text(e){const t=this.rules.block.text.exec(e);if(t)return{type:"text",raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){const t=this.rules.inline.escape.exec(e);if(t)return{type:"escape",raw:t[0],text:Ye(t[1])}}tag(e){const t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&/^<a /i.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&/^<\/a>/i.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&/^<(pre|code|kbd|script)(\s|>)/i.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){const t=this.rules.inline.link.exec(e);if(t){const e=t[2].trim();if(!this.options.pedantic&&/^</.test(e)){if(!/>$/.test(e))return;const t=ot(e.slice(0,-1),"\\");if((e.length-t.length)%2==0)return}else{const e=function(e,t){if(-1===e.indexOf(t[1]))return-1;let n=0;for(let r=0;r<e.length;r++)if("\\"===e[r])r++;else if(e[r]===t[0])n++;else if(e[r]===t[1]&&(n--,n<0))return r;return-1}(t[2],"()");if(e>-1){const n=(0===t[0].indexOf("!")?5:4)+t[1].length+e;t[2]=t[2].substring(0,e),t[0]=t[0].substring(0,n).trim(),t[3]=""}}let n=t[2],r="";if(this.options.pedantic){const e=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(n);e&&(n=e[1],r=e[3])}else r=t[3]?t[3].slice(1,-1):"";return n=n.trim(),/^</.test(n)&&(n=this.options.pedantic&&!/>$/.test(e)?n.slice(1):n.slice(1,-1)),at(t,{href:n?n.replace(this.rules.inline.anyPunctuation,"$1"):n,title:r?r.replace(this.rules.inline.anyPunctuation,"$1"):r},t[0],this.lexer)}}reflink(e,t){let n;if((n=this.rules.inline.reflink.exec(e))||(n=this.rules.inline.nolink.exec(e))){const e=t[(n[2]||n[1]).replace(/\s+/g," ").toLowerCase()];if(!e){const e=n[0].charAt(0);return{type:"text",raw:e,text:e}}return at(n,e,n[0],this.lexer)}}emStrong(e,t,n=""){let r=this.rules.inline.emStrongLDelim.exec(e);if(!r)return;if(r[3]&&n.match(/[\p{L}\p{N}]/u))return;if(!(r[1]||r[2]||"")||!n||this.rules.inline.punctuation.exec(n)){const n=[...r[0]].length-1;let s,i,o=n,a=0;const l="*"===r[0][0]?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(l.lastIndex=0,t=t.slice(-1*e.length+n);null!=(r=l.exec(t));){if(s=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!s)continue;if(i=[...s].length,r[3]||r[4]){o+=i;continue}if((r[5]||r[6])&&n%3&&!((n+i)%3)){a+=i;continue}if(o-=i,o>0)continue;i=Math.min(i,i+o+a);const t=[...r[0]][0].length,l=e.slice(0,n+r.index+t+i);if(Math.min(n,i)%2){const e=l.slice(1,-1);return{type:"em",raw:l,text:e,tokens:this.lexer.inlineTokens(e)}}const c=l.slice(2,-2);return{type:"strong",raw:l,text:c,tokens:this.lexer.inlineTokens(c)}}}}codespan(e){const t=this.rules.inline.code.exec(e);if(t){let e=t[2].replace(/\n/g," ");const n=/[^ ]/.test(e),r=/^ /.test(e)&&/ $/.test(e);return n&&r&&(e=e.substring(1,e.length-1)),e=Ye(e,!0),{type:"codespan",raw:t[0],text:e}}}br(e){const t=this.rules.inline.br.exec(e);if(t)return{type:"br",raw:t[0]}}del(e){const t=this.rules.inline.del.exec(e);if(t)return{type:"del",raw:t[0],text:t[2],tokens:this.lexer.inlineTokens(t[2])}}autolink(e){const t=this.rules.inline.autolink.exec(e);if(t){let e,n;return"@"===t[2]?(e=Ye(t[1]),n="mailto:"+e):(e=Ye(t[1]),n=e),{type:"link",raw:t[0],text:e,href:n,tokens:[{type:"text",raw:e,text:e}]}}}url(e){let t;if(t=this.rules.inline.url.exec(e)){let e,n;if("@"===t[2])e=Ye(t[0]),n="mailto:"+e;else{let r;do{r=t[0],t[0]=this.rules.inline._backpedal.exec(t[0])?.[0]??""}while(r!==t[0]);e=Ye(t[0]),n="www."===t[1]?"http://"+t[0]:t[0]}return{type:"link",raw:t[0],text:e,href:n,tokens:[{type:"text",raw:e,text:e}]}}}inlineText(e){const t=this.rules.inline.text.exec(e);if(t){let e;return e=this.lexer.state.inRawBlock?t[0]:Ye(t[0]),{type:"text",raw:t[0],text:e}}}}const ct=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,pt=/(?:[*+-]|\d{1,9}[.)])/,ht=nt(/^(?!bull |blockCode|fences|blockquote|heading|html)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html))+?)\n {0,3}(=+|-+) *(?:\n+|$)/).replace(/bull/g,pt).replace(/blockCode/g,/ {4}/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).getRegex(),ut=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,ft=/(?!\s*\])(?:\\.|[^\[\]\\])+/,dt=nt(/^ {0,3}\[(label)\]: *(?:\n *)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n *)?| *\n *)(title))? *(?:\n+|$)/).replace("label",ft).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),gt=nt(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,pt).getRegex(),kt="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",yt=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,bt=nt("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n *)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$))","i").replace("comment",yt).replace("tag",kt).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),mt=nt(ut).replace("hr",ct).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",kt).getRegex(),xt={blockquote:nt(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",mt).getRegex(),code:/^( {4}[^\n]+(?:\n(?: *(?:\n|$))*)?)+/,def:dt,fences:/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,heading:/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,hr:ct,html:bt,lheading:ht,list:gt,newline:/^(?: *(?:\n|$))+/,paragraph:mt,table:st,text:/^[^\n]+/},wt=nt("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",ct).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code"," {4}[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",kt).getRegex(),vt={...xt,table:wt,paragraph:nt(ut).replace("hr",ct).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",wt).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",kt).getRegex()},_t={...xt,html:nt("^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:\"[^\"]*\"|'[^']*'|\\s[^'\"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))").replace("comment",yt).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:st,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:nt(ut).replace("hr",ct).replace("heading"," *#{1,6} *[^\n]").replace("lheading",ht).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},Ot=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,Pt=/^( {2,}|\\)\n(?!\s*$)/,zt="\\p{P}\\p{S}",$t=nt(/^((?![*_])[\spunctuation])/,"u").replace(/punctuation/g,zt).getRegex(),St=nt(/^(?:\*+(?:((?!\*)[punct])|[^\s*]))|^_+(?:((?!_)[punct])|([^\s_]))/,"u").replace(/punct/g,zt).getRegex(),jt=nt("^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)[punct](\\*+)(?=[\\s]|$)|[^punct\\s](\\*+)(?!\\*)(?=[punct\\s]|$)|(?!\\*)[punct\\s](\\*+)(?=[^punct\\s])|[\\s](\\*+)(?!\\*)(?=[punct])|(?!\\*)[punct](\\*+)(?!\\*)(?=[punct])|[^punct\\s](\\*+)(?=[^punct\\s])","gu").replace(/punct/g,zt).getRegex(),Et=nt("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)[punct](_+)(?=[\\s]|$)|[^punct\\s](_+)(?!_)(?=[punct\\s]|$)|(?!_)[punct\\s](_+)(?=[^punct\\s])|[\\s](_+)(?!_)(?=[punct])|(?!_)[punct](_+)(?!_)(?=[punct])","gu").replace(/punct/g,zt).getRegex(),Tt=nt(/\\([punct])/,"gu").replace(/punct/g,zt).getRegex(),At=nt(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),Rt=nt(yt).replace("(?:--\x3e|$)","--\x3e").getRegex(),qt=nt("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",Rt).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Nt=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,Ct=nt(/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/).replace("label",Nt).replace("href",/<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),Dt=nt(/^!?\[(label)\]\[(ref)\]/).replace("label",Nt).replace("ref",ft).getRegex(),It=nt(/^!?\[(ref)\](?:\[\])?/).replace("ref",ft).getRegex(),Bt={_backpedal:st,anyPunctuation:Tt,autolink:At,blockSkip:/\[[^[\]]*?\]\([^\(\)]*?\)|`[^`]*?`|<[^<>]*?>/g,br:Pt,code:/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,del:st,emStrongLDelim:St,emStrongRDelimAst:jt,emStrongRDelimUnd:Et,escape:Ot,link:Ct,nolink:It,punctuation:$t,reflink:Dt,reflinkSearch:nt("reflink|nolink(?!\\()","g").replace("reflink",Dt).replace("nolink",It).getRegex(),tag:qt,text:/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,url:st},Lt={...Bt,link:nt(/^!?\[(label)\]\((.*?)\)/).replace("label",Nt).getRegex(),reflink:nt(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",Nt).getRegex()},Mt={...Bt,escape:nt(Ot).replace("])","~|])").getRegex(),url:nt(/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,"i").replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])([\s\S]*?[^\s~])\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/},Ft={...Mt,br:nt(Pt).replace("{2,}","*").getRegex(),text:nt(Mt.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},Zt={normal:xt,gfm:vt,pedantic:_t},Qt={normal:Bt,gfm:Mt,breaks:Ft,pedantic:Lt};class Vt{tokens;options;state;tokenizer;inlineQueue;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||Ve,this.options.tokenizer=this.options.tokenizer||new lt,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};const t={block:Zt.normal,inline:Qt.normal};this.options.pedantic?(t.block=Zt.pedantic,t.inline=Qt.pedantic):this.options.gfm&&(t.block=Zt.gfm,this.options.breaks?t.inline=Qt.breaks:t.inline=Qt.gfm),this.tokenizer.rules=t}static get rules(){return{block:Zt,inline:Qt}}static lex(e,t){return new Vt(t).lex(e)}static lexInline(e,t){return new Vt(t).inlineTokens(e)}lex(e){e=e.replace(/\r\n|\r/g,"\n"),this.blockTokens(e,this.tokens);for(let e=0;e<this.inlineQueue.length;e++){const t=this.inlineQueue[e];this.inlineTokens(t.src,t.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,t=[],n=!1){let r,s,i;for(e=this.options.pedantic?e.replace(/\t/g," ").replace(/^ +$/gm,""):e.replace(/^( *)(\t+)/gm,((e,t,n)=>t+" ".repeat(n.length)));e;)if(!(this.options.extensions&&this.options.extensions.block&&this.options.extensions.block.some((n=>!!(r=n.call({lexer:this},e,t))&&(e=e.substring(r.raw.length),t.push(r),!0)))))if(r=this.tokenizer.space(e))e=e.substring(r.raw.length),1===r.raw.length&&t.length>0?t[t.length-1].raw+="\n":t.push(r);else if(r=this.tokenizer.code(e))e=e.substring(r.raw.length),s=t[t.length-1],!s||"paragraph"!==s.type&&"text"!==s.type?t.push(r):(s.raw+="\n"+r.raw,s.text+="\n"+r.text,this.inlineQueue[this.inlineQueue.length-1].src=s.text);else if(r=this.tokenizer.fences(e))e=e.substring(r.raw.length),t.push(r);else if(r=this.tokenizer.heading(e))e=e.substring(r.raw.length),t.push(r);else if(r=this.tokenizer.hr(e))e=e.substring(r.raw.length),t.push(r);else if(r=this.tokenizer.blockquote(e))e=e.substring(r.raw.length),t.push(r);else if(r=this.tokenizer.list(e))e=e.substring(r.raw.length),t.push(r);else if(r=this.tokenizer.html(e))e=e.substring(r.raw.length),t.push(r);else if(r=this.tokenizer.def(e))e=e.substring(r.raw.length),s=t[t.length-1],!s||"paragraph"!==s.type&&"text"!==s.type?this.tokens.links[r.tag]||(this.tokens.links[r.tag]={href:r.href,title:r.title}):(s.raw+="\n"+r.raw,s.text+="\n"+r.raw,this.inlineQueue[this.inlineQueue.length-1].src=s.text);else if(r=this.tokenizer.table(e))e=e.substring(r.raw.length),t.push(r);else if(r=this.tokenizer.lheading(e))e=e.substring(r.raw.length),t.push(r);else{if(i=e,this.options.extensions&&this.options.extensions.startBlock){let t=1/0;const n=e.slice(1);let r;this.options.extensions.startBlock.forEach((e=>{r=e.call({lexer:this},n),"number"==typeof r&&r>=0&&(t=Math.min(t,r))})),t<1/0&&t>=0&&(i=e.substring(0,t+1))}if(this.state.top&&(r=this.tokenizer.paragraph(i)))s=t[t.length-1],n&&"paragraph"===s?.type?(s.raw+="\n"+r.raw,s.text+="\n"+r.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=s.text):t.push(r),n=i.length!==e.length,e=e.substring(r.raw.length);else if(r=this.tokenizer.text(e))e=e.substring(r.raw.length),s=t[t.length-1],s&&"text"===s.type?(s.raw+="\n"+r.raw,s.text+="\n"+r.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=s.text):t.push(r);else if(e){const t="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(t);break}throw new Error(t)}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}inlineTokens(e,t=[]){let n,r,s,i,o,a,l=e;if(this.tokens.links){const e=Object.keys(this.tokens.links);if(e.length>0)for(;null!=(i=this.tokenizer.rules.inline.reflinkSearch.exec(l));)e.includes(i[0].slice(i[0].lastIndexOf("[")+1,-1))&&(l=l.slice(0,i.index)+"["+"a".repeat(i[0].length-2)+"]"+l.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;null!=(i=this.tokenizer.rules.inline.blockSkip.exec(l));)l=l.slice(0,i.index)+"["+"a".repeat(i[0].length-2)+"]"+l.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;null!=(i=this.tokenizer.rules.inline.anyPunctuation.exec(l));)l=l.slice(0,i.index)+"++"+l.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);for(;e;)if(o||(a=""),o=!1,!(this.options.extensions&&this.options.extensions.inline&&this.options.extensions.inline.some((r=>!!(n=r.call({lexer:this},e,t))&&(e=e.substring(n.raw.length),t.push(n),!0)))))if(n=this.tokenizer.escape(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.tag(e))e=e.substring(n.raw.length),r=t[t.length-1],r&&"text"===n.type&&"text"===r.type?(r.raw+=n.raw,r.text+=n.text):t.push(n);else if(n=this.tokenizer.link(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.reflink(e,this.tokens.links))e=e.substring(n.raw.length),r=t[t.length-1],r&&"text"===n.type&&"text"===r.type?(r.raw+=n.raw,r.text+=n.text):t.push(n);else if(n=this.tokenizer.emStrong(e,l,a))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.codespan(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.br(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.del(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.autolink(e))e=e.substring(n.raw.length),t.push(n);else if(this.state.inLink||!(n=this.tokenizer.url(e))){if(s=e,this.options.extensions&&this.options.extensions.startInline){let t=1/0;const n=e.slice(1);let r;this.options.extensions.startInline.forEach((e=>{r=e.call({lexer:this},n),"number"==typeof r&&r>=0&&(t=Math.min(t,r))})),t<1/0&&t>=0&&(s=e.substring(0,t+1))}if(n=this.tokenizer.inlineText(s))e=e.substring(n.raw.length),"_"!==n.raw.slice(-1)&&(a=n.raw.slice(-1)),o=!0,r=t[t.length-1],r&&"text"===r.type?(r.raw+=n.raw,r.text+=n.text):t.push(n);else if(e){const t="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(t);break}throw new Error(t)}}else e=e.substring(n.raw.length),t.push(n);return t}}class Wt{options;parser;constructor(e){this.options=e||Ve}space(e){return""}code({text:e,lang:t,escaped:n}){const r=(t||"").match(/^\S*/)?.[0],s=e.replace(/\n$/,"")+"\n";return r?'<pre><code class="language-'+Ye(r)+'">'+(n?s:Ye(s,!0))+"</code></pre>\n":"<pre><code>"+(n?s:Ye(s,!0))+"</code></pre>\n"}blockquote({tokens:e}){return`<blockquote>\n${this.parser.parse(e)}</blockquote>\n`}html({text:e}){return e}heading({tokens:e,depth:t}){return`<h${t}>${this.parser.parseInline(e)}</h${t}>\n`}hr(e){return"<hr>\n"}list(e){const t=e.ordered,n=e.start;let r="";for(let t=0;t<e.items.length;t++){const n=e.items[t];r+=this.listitem(n)}const s=t?"ol":"ul";return"<"+s+(t&&1!==n?' start="'+n+'"':"")+">\n"+r+"</"+s+">\n"}listitem(e){let t="";if(e.task){const n=this.checkbox({checked:!!e.checked});e.loose?e.tokens.length>0&&"paragraph"===e.tokens[0].type?(e.tokens[0].text=n+" "+e.tokens[0].text,e.tokens[0].tokens&&e.tokens[0].tokens.length>0&&"text"===e.tokens[0].tokens[0].type&&(e.tokens[0].tokens[0].text=n+" "+e.tokens[0].tokens[0].text)):e.tokens.unshift({type:"text",raw:n+" ",text:n+" "}):t+=n+" "}return t+=this.parser.parse(e.tokens,!!e.loose),`<li>${t}</li>\n`}checkbox({checked:e}){return"<input "+(e?'checked="" ':"")+'disabled="" type="checkbox">'}paragraph({tokens:e}){return`<p>${this.parser.parseInline(e)}</p>\n`}table(e){let t="",n="";for(let t=0;t<e.header.length;t++)n+=this.tablecell(e.header[t]);t+=this.tablerow({text:n});let r="";for(let t=0;t<e.rows.length;t++){const s=e.rows[t];n="";for(let e=0;e<s.length;e++)n+=this.tablecell(s[e]);r+=this.tablerow({text:n})}return r&&(r=`<tbody>${r}</tbody>`),"<table>\n<thead>\n"+t+"</thead>\n"+r+"</table>\n"}tablerow({text:e}){return`<tr>\n${e}</tr>\n`}tablecell(e){const t=this.parser.parseInline(e.tokens),n=e.header?"th":"td";return(e.align?`<${n} align="${e.align}">`:`<${n}>`)+t+`</${n}>\n`}strong({tokens:e}){return`<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return`<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return`<code>${e}</code>`}br(e){return"<br>"}del({tokens:e}){return`<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:t,tokens:n}){const r=this.parser.parseInline(n),s=rt(e);if(null===s)return r;let i='<a href="'+(e=s)+'"';return t&&(i+=' title="'+t+'"'),i+=">"+r+"</a>",i}image({href:e,title:t,text:n}){const r=rt(e);if(null===r)return n;let s=`<img src="${e=r}" alt="${n}"`;return t&&(s+=` title="${t}"`),s+=">",s}text(e){return"tokens"in e&&e.tokens?this.parser.parseInline(e.tokens):e.text}}class Ut{strong({text:e}){return e}em({text:e}){return e}codespan({text:e}){return e}del({text:e}){return e}html({text:e}){return e}text({text:e}){return e}link({text:e}){return""+e}image({text:e}){return""+e}br(){return""}}class Jt{options;renderer;textRenderer;constructor(e){this.options=e||Ve,this.options.renderer=this.options.renderer||new Wt,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new Ut}static parse(e,t){return new Jt(t).parse(e)}static parseInline(e,t){return new Jt(t).parseInline(e)}parse(e,t=!0){let n="";for(let r=0;r<e.length;r++){const s=e[r];if(this.options.extensions&&this.options.extensions.renderers&&this.options.extensions.renderers[s.type]){const e=s,t=this.options.extensions.renderers[e.type].call({parser:this},e);if(!1!==t||!["space","hr","heading","code","table","blockquote","list","html","paragraph","text"].includes(e.type)){n+=t||"";continue}}const i=s;switch(i.type){case"space":n+=this.renderer.space(i);continue;case"hr":n+=this.renderer.hr(i);continue;case"heading":n+=this.renderer.heading(i);continue;case"code":n+=this.renderer.code(i);continue;case"table":n+=this.renderer.table(i);continue;case"blockquote":n+=this.renderer.blockquote(i);continue;case"list":n+=this.renderer.list(i);continue;case"html":n+=this.renderer.html(i);continue;case"paragraph":n+=this.renderer.paragraph(i);continue;case"text":{let s=i,o=this.renderer.text(s);for(;r+1<e.length&&"text"===e[r+1].type;)s=e[++r],o+="\n"+this.renderer.text(s);n+=t?this.renderer.paragraph({type:"paragraph",raw:o,text:o,tokens:[{type:"text",raw:o,text:o}]}):o;continue}default:{const e='Token with "'+i.type+'" type was not found.';if(this.options.silent)return console.error(e),"";throw new Error(e)}}}return n}parseInline(e,t){t=t||this.renderer;let n="";for(let r=0;r<e.length;r++){const s=e[r];if(this.options.extensions&&this.options.extensions.renderers&&this.options.extensions.renderers[s.type]){const e=this.options.extensions.renderers[s.type].call({parser:this},s);if(!1!==e||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(s.type)){n+=e||"";continue}}const i=s;switch(i.type){case"escape":case"text":n+=t.text(i);break;case"html":n+=t.html(i);break;case"link":n+=t.link(i);break;case"image":n+=t.image(i);break;case"strong":n+=t.strong(i);break;case"em":n+=t.em(i);break;case"codespan":n+=t.codespan(i);break;case"br":n+=t.br(i);break;case"del":n+=t.del(i);break;default:{const e='Token with "'+i.type+'" type was not found.';if(this.options.silent)return console.error(e),"";throw new Error(e)}}}return n}}class Kt{options;constructor(e){this.options=e||Ve}static passThroughHooks=new Set(["preprocess","postprocess","processAllTokens"]);preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}}const Ht=new class{defaults={async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null};options=this.setOptions;parse=this.#e(Vt.lex,Jt.parse);parseInline=this.#e(Vt.lexInline,Jt.parseInline);Parser=Jt;Renderer=Wt;TextRenderer=Ut;Lexer=Vt;Tokenizer=lt;Hooks=Kt;constructor(...e){this.use(...e)}walkTokens(e,t){let n=[];for(const r of e)switch(n=n.concat(t.call(this,r)),r.type){case"table":{const e=r;for(const r of e.header)n=n.concat(this.walkTokens(r.tokens,t));for(const r of e.rows)for(const e of r)n=n.concat(this.walkTokens(e.tokens,t));break}case"list":{const e=r;n=n.concat(this.walkTokens(e.items,t));break}default:{const e=r;this.defaults.extensions?.childTokens?.[e.type]?this.defaults.extensions.childTokens[e.type].forEach((r=>{const s=e[r].flat(1/0);n=n.concat(this.walkTokens(s,t))})):e.tokens&&(n=n.concat(this.walkTokens(e.tokens,t)))}}return n}use(...e){const t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach((e=>{const n={...e};if(n.async=this.defaults.async||n.async||!1,e.extensions&&(e.extensions.forEach((e=>{if(!e.name)throw new Error("extension name required");if("renderer"in e){const n=t.renderers[e.name];t.renderers[e.name]=n?function(...t){let r=e.renderer.apply(this,t);return!1===r&&(r=n.apply(this,t)),r}:e.renderer}if("tokenizer"in e){if(!e.level||"block"!==e.level&&"inline"!==e.level)throw new Error("extension level must be 'block' or 'inline'");const n=t[e.level];n?n.unshift(e.tokenizer):t[e.level]=[e.tokenizer],e.start&&("block"===e.level?t.startBlock?t.startBlock.push(e.start):t.startBlock=[e.start]:"inline"===e.level&&(t.startInline?t.startInline.push(e.start):t.startInline=[e.start]))}"childTokens"in e&&e.childTokens&&(t.childTokens[e.name]=e.childTokens)})),n.extensions=t),e.renderer){const t=this.defaults.renderer||new Wt(this.defaults);for(const n in e.renderer){if(!(n in t))throw new Error(`renderer '${n}' does not exist`);if(["options","parser"].includes(n))continue;const r=n;let s=e.renderer[r];const i=t[r];t[r]=(...n)=>{e.useNewRenderer||(s=this.#t(s,r,t));let o=s.apply(t,n);return!1===o&&(o=i.apply(t,n)),o||""}}n.renderer=t}if(e.tokenizer){const t=this.defaults.tokenizer||new lt(this.defaults);for(const n in e.tokenizer){if(!(n in t))throw new Error(`tokenizer '${n}' does not exist`);if(["options","rules","lexer"].includes(n))continue;const r=n,s=e.tokenizer[r],i=t[r];t[r]=(...e)=>{let n=s.apply(t,e);return!1===n&&(n=i.apply(t,e)),n}}n.tokenizer=t}if(e.hooks){const t=this.defaults.hooks||new Kt;for(const n in e.hooks){if(!(n in t))throw new Error(`hook '${n}' does not exist`);if("options"===n)continue;const r=n,s=e.hooks[r],i=t[r];Kt.passThroughHooks.has(n)?t[r]=e=>{if(this.defaults.async)return Promise.resolve(s.call(t,e)).then((e=>i.call(t,e)));const n=s.call(t,e);return i.call(t,n)}:t[r]=(...e)=>{let n=s.apply(t,e);return!1===n&&(n=i.apply(t,e)),n}}n.hooks=t}if(e.walkTokens){const t=this.defaults.walkTokens,r=e.walkTokens;n.walkTokens=function(e){let n=[];return n.push(r.call(this,e)),t&&(n=n.concat(t.call(this,e))),n}}this.defaults={...this.defaults,...n}})),this}#t(e,t,n){switch(t){case"heading":return function(r){return r.type&&r.type===t?e(n.parser.parseInline(r.tokens),r.depth,function(e){return e.replace(et,((e,t)=>"colon"===(t=t.toLowerCase())?":":"#"===t.charAt(0)?"x"===t.charAt(1)?String.fromCharCode(parseInt(t.substring(2),16)):String.fromCharCode(+t.substring(1)):""))}(n.parser.parseInline(r.tokens,n.parser.textRenderer))):e.apply(this,arguments)};case"code":return function(n){return n.type&&n.type===t?e(n.text,n.lang,!!n.escaped):e.apply(this,arguments)};case"table":return function(n){if(!n.type||n.type!==t)return e.apply(this,arguments);let r="",s="";for(let e=0;e<n.header.length;e++)s+=this.tablecell({text:n.header[e].text,tokens:n.header[e].tokens,header:!0,align:n.align[e]});r+=this.tablerow({text:s});let i="";for(let e=0;e<n.rows.length;e++){const t=n.rows[e];s="";for(let e=0;e<t.length;e++)s+=this.tablecell({text:t[e].text,tokens:t[e].tokens,header:!1,align:n.align[e]});i+=this.tablerow({text:s})}return e(r,i)};case"blockquote":return function(n){if(!n.type||n.type!==t)return e.apply(this,arguments);const r=this.parser.parse(n.tokens);return e(r)};case"list":return function(n){if(!n.type||n.type!==t)return e.apply(this,arguments);const r=n.ordered,s=n.start,i=n.loose;let o="";for(let e=0;e<n.items.length;e++){const t=n.items[e],r=t.checked,s=t.task;let a="";if(t.task){const e=this.checkbox({checked:!!r});i?t.tokens.length>0&&"paragraph"===t.tokens[0].type?(t.tokens[0].text=e+" "+t.tokens[0].text,t.tokens[0].tokens&&t.tokens[0].tokens.length>0&&"text"===t.tokens[0].tokens[0].type&&(t.tokens[0].tokens[0].text=e+" "+t.tokens[0].tokens[0].text)):t.tokens.unshift({type:"text",text:e+" "}):a+=e+" "}a+=this.parser.parse(t.tokens,i),o+=this.listitem({type:"list_item",raw:a,text:a,task:s,checked:!!r,loose:i,tokens:t.tokens})}return e(o,r,s)};case"html":return function(n){return n.type&&n.type===t?e(n.text,n.block):e.apply(this,arguments)};case"paragraph":case"strong":case"em":case"del":return function(n){return n.type&&n.type===t?e(this.parser.parseInline(n.tokens)):e.apply(this,arguments)};case"escape":case"codespan":case"text":return function(n){return n.type&&n.type===t?e(n.text):e.apply(this,arguments)};case"link":return function(n){return n.type&&n.type===t?e(n.href,n.title,this.parser.parseInline(n.tokens)):e.apply(this,arguments)};case"image":return function(n){return n.type&&n.type===t?e(n.href,n.title,n.text):e.apply(this,arguments)}}return e}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return Vt.lex(e,t??this.defaults)}parser(e,t){return Jt.parse(e,t??this.defaults)}#e(e,t){return(n,r)=>{const s={...r},i={...this.defaults,...s};!0===this.defaults.async&&!1===s.async&&(i.silent||console.warn("marked(): The async option was set to true by an extension. The async: false option sent to parse will be ignored."),i.async=!0);const o=this.#n(!!i.silent,!!i.async);if(null==n)return o(new Error("marked(): input parameter is undefined or null"));if("string"!=typeof n)return o(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(n)+", string expected"));if(i.hooks&&(i.hooks.options=i),i.async)return Promise.resolve(i.hooks?i.hooks.preprocess(n):n).then((t=>e(t,i))).then((e=>i.hooks?i.hooks.processAllTokens(e):e)).then((e=>i.walkTokens?Promise.all(this.walkTokens(e,i.walkTokens)).then((()=>e)):e)).then((e=>t(e,i))).then((e=>i.hooks?i.hooks.postprocess(e):e)).catch(o);try{i.hooks&&(n=i.hooks.preprocess(n));let r=e(n,i);i.hooks&&(r=i.hooks.processAllTokens(r)),i.walkTokens&&this.walkTokens(r,i.walkTokens);let s=t(r,i);return i.hooks&&(s=i.hooks.postprocess(s)),s}catch(e){return o(e)}}}#n(e,t){return n=>{if(n.message+="\nPlease report this to https://github.com/markedjs/marked.",e){const e="<p>An error occurred:</p><pre>"+Ye(n.message+"",!0)+"</pre>";return t?Promise.resolve(e):e}if(t)return Promise.reject(n);throw n}}};function Xt(e,t){return Ht.parse(e,t)}Xt.options=Xt.setOptions=function(e){return Ht.setOptions(e),Xt.defaults=Ht.defaults,We(Xt.defaults),Xt},Xt.getDefaults=Qe,Xt.defaults=Ve,Xt.use=function(...e){return Ht.use(...e),Xt.defaults=Ht.defaults,We(Xt.defaults),Xt},Xt.walkTokens=function(e,t){return Ht.walkTokens(e,t)},Xt.parseInline=Ht.parseInline,Xt.Parser=Jt,Xt.parser=Jt.parse,Xt.Renderer=Wt,Xt.TextRenderer=Ut,Xt.Lexer=Vt,Xt.lexer=Vt.lex,Xt.Tokenizer=lt,Xt.Hooks=Kt,Xt.parse=Xt,Xt.options,Xt.setOptions,Xt.use,Xt.walkTokens,Xt.parseInline,Jt.parse,Vt.lex;const Gt={deserialize:function(e,t){const n=Xt.parse(t,{gfm:!0,breaks:!0,pedantic:!1});return console.log("html from marked",n),Ze(e,n)},serialize:function(e,t){return function(e,t){return t.sort(((e,t)=>e.meta.order>t.meta.order?1:-1)).map((t=>{var n,r;const s=e.plugins[t.type];if(s){const e=t.value[0];if(null===(r=null===(n=s.parsers)||void 0===n?void 0:n.markdown)||void 0===r?void 0:r.serialize){const t=s.parsers.markdown.serialize(e,e.children.map((e=>e.text)).join(""));if(t)return t}}return""})).join("\n")}(e,Object.values(t))}},Yt={deserialize:Ze,serialize:function(e,t){return function(e,t){const n=t.sort(((e,t)=>e.meta.order-t.meta.order)).map((t=>{var n,r;const i=e.plugins[t.type];if(i&&(null===(r=null===(n=i.parsers)||void 0===n?void 0:n.html)||void 0===r?void 0:r.serialize)){const n=s(t.value[0].children,e.plugins);return i.parsers.html.serialize(t.value[0],n)}return""}));return`<body id="yoopta-clipboard" data-editor-id="${e.id}">${n.join("")}</body>`}(e,Object.values(t))}},en={deserialize:function(){},serialize:function(){}},tn={markdown:Gt,html:Yt,text:en};export{tn as default,Yt as html,Gt as markdown,en as text};
@@ -1,2 +1,3 @@
1
- import { YooptaBaseElement, YooptaPluginType } from '@yoopta/editor';
2
- export declare function deserializeMarkdown(htmlString: string, plugins: YooptaPluginType<unknown, YooptaBaseElement<string>>[]): any;
1
+ import { YooEditor, YooptaContentValue } from '@yoopta/editor';
2
+ export declare function deserializeMarkdown(editor: YooEditor, markdown: string): YooptaContentValue;
3
+ //# sourceMappingURL=deserialize.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deserialize.d.ts","sourceRoot":"","sources":["../../src/markdown/deserialize.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAI/D,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,GAAG,kBAAkB,CAK3F"}
@@ -1,2 +1,4 @@
1
- import { Descendant } from 'slate';
2
- export declare function serializeMarkdown(data: Descendant[], plugins: any): string;
1
+ import { YooEditor, YooptaBlockData, YooptaContentValue } from '@yoopta/editor';
2
+ export declare function serialize(editor: YooEditor, blocksData: YooptaBlockData[]): string;
3
+ export declare function serializeMarkdown(editor: YooEditor, content: YooptaContentValue): string;
4
+ //# sourceMappingURL=serialize.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"serialize.d.ts","sourceRoot":"","sources":["../../src/markdown/serialize.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,SAAS,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAE9F,wBAAgB,SAAS,CAAC,MAAM,EAAE,SAAS,EAAE,UAAU,EAAE,eAAe,EAAE,UAsBzE;AAED,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,kBAAkB,UAG/E"}
@@ -0,0 +1,2 @@
1
+ export declare function deserializeText(): void;
2
+ //# sourceMappingURL=deserialize.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deserialize.d.ts","sourceRoot":"","sources":["../../src/text/deserialize.ts"],"names":[],"mappings":"AAAA,wBAAgB,eAAe,SAAK"}
@@ -0,0 +1,2 @@
1
+ export declare function serializeText(): void;
2
+ //# sourceMappingURL=serialize.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"serialize.d.ts","sourceRoot":"","sources":["../../src/text/serialize.ts"],"names":[],"mappings":"AAAA,wBAAgB,aAAa,SAAK"}
package/package.json CHANGED
@@ -1,24 +1,22 @@
1
1
  {
2
2
  "name": "@yoopta/exports",
3
- "version": "2.0.0",
4
- "description": "> TODO: description",
3
+ "version": "4.5.2-rc.0",
4
+ "description": "Serialize/deserialize exports in different formats for Yoopta-Editor",
5
5
  "author": "Darginec05 <devopsbanda@gmail.com>",
6
6
  "homepage": "https://github.com/Darginec05/Editor-Yoopta#readme",
7
7
  "license": "MIT",
8
8
  "private": false,
9
- "type": "module",
10
9
  "main": "dist/index.js",
10
+ "type": "module",
11
11
  "module": "dist/index.js",
12
12
  "types": "./dist/index.d.ts",
13
13
  "files": [
14
14
  "dist/"
15
15
  ],
16
16
  "peerDependencies": {
17
- "@yoopta/editor": ">=1.9.18-rc",
17
+ "@yoopta/editor": ">=4.0.0",
18
18
  "react": ">=17.0.2",
19
- "react-dom": ">=17.0.2",
20
- "slate": ">=0.72.3",
21
- "slate-react": ">=0.95.0"
19
+ "react-dom": ">=17.0.2"
22
20
  },
23
21
  "publishConfig": {
24
22
  "registry": "https://registry.yarnpkg.com"
@@ -28,12 +26,15 @@
28
26
  "url": "git+https://github.com/Darginec05/Editor-Yoopta.git"
29
27
  },
30
28
  "scripts": {
31
- "test": "node ./__tests__/@yoopta/paragraph.test.js"
29
+ "start": "rollup --config rollup.config.js --watch --bundleConfigAsCjs --environment NODE_ENV:development",
30
+ "prepublishOnly": "yarn build",
31
+ "build": "rollup --config rollup.config.js --bundleConfigAsCjs --environment NODE_ENV:production"
32
32
  },
33
33
  "bugs": {
34
34
  "url": "https://github.com/Darginec05/Editor-Yoopta/issues"
35
35
  },
36
36
  "dependencies": {
37
- "lodash.uniqwith": "^4.5.0"
38
- }
39
- }
37
+ "marked": "^13.0.0"
38
+ },
39
+ "gitHead": "12417417ff2df9572334d45f7bbea49f867d1d4f"
40
+ }
@@ -1,4 +0,0 @@
1
- import { YooptaBaseElement, YooptaPluginType } from '@yoopta/editor';
2
- export declare function mergePlugins(plugins: any): YooptaPluginType[];
3
- export declare function mergePluginTypesToMap(plugins: YooptaPluginType<unknown, YooptaBaseElement<string>>[]): Record<YooptaBaseElement<string>['type'], YooptaPluginType<any, YooptaBaseElement<string>>>;
4
- export declare function mergePluginTypesToMapHMTLNodeName(plugins: YooptaPluginType<unknown, YooptaBaseElement<string>>[]): Record<YooptaBaseElement<string>['type'], YooptaPluginType<any, YooptaBaseElement<string>>>;