@payloadcms/richtext-lexical 3.73.0 → 3.74.0-internal.097fb57
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/exports/client/Field-OX545XLB.js +2 -0
- package/dist/exports/client/Field-OX545XLB.js.map +7 -0
- package/dist/exports/client/bundled.css +1 -1
- package/dist/exports/client/chunk-3KBZSLPR.js +12 -0
- package/dist/exports/client/chunk-3KBZSLPR.js.map +7 -0
- package/dist/exports/client/index.d.ts +1 -0
- package/dist/exports/client/index.d.ts.map +1 -1
- package/dist/exports/client/index.js +20 -20
- package/dist/exports/client/index.js.map +3 -3
- package/dist/exports/client/internal-client.d.ts +3 -0
- package/dist/exports/client/internal-client.d.ts.map +1 -0
- package/dist/exports/react/index.d.ts +1 -1
- package/dist/exports/react/index.d.ts.map +1 -1
- package/dist/exports/react/index.js.map +1 -1
- package/dist/features/converters/lexicalToJSX/Component/index.d.ts +2 -14
- package/dist/features/converters/lexicalToJSX/Component/index.d.ts.map +1 -1
- package/dist/features/converters/lexicalToJSX/Component/index.js +4 -2
- package/dist/features/converters/lexicalToJSX/Component/index.js.map +1 -1
- package/dist/features/converters/lexicalToJSX/converter/index.d.ts +16 -1
- package/dist/features/converters/lexicalToJSX/converter/index.d.ts.map +1 -1
- package/dist/features/converters/lexicalToJSX/converter/index.js +76 -4
- package/dist/features/converters/lexicalToJSX/converter/index.js.map +1 -1
- package/dist/features/converters/lexicalToJSX/converter/types.d.ts +14 -10
- package/dist/features/converters/lexicalToJSX/converter/types.d.ts.map +1 -1
- package/dist/features/converters/lexicalToJSX/converter/types.js.map +1 -1
- package/dist/features/debug/jsxConverter/client/plugin/index.js +1 -1
- package/dist/features/debug/jsxConverter/client/plugin/index.js.map +1 -1
- package/dist/field/Field.d.ts.map +1 -1
- package/dist/field/Field.js +11 -6
- package/dist/field/Field.js.map +1 -1
- package/dist/field/RichTextViewProvider.d.ts +83 -0
- package/dist/field/RichTextViewProvider.d.ts.map +1 -0
- package/dist/field/RichTextViewProvider.js +87 -0
- package/dist/field/RichTextViewProvider.js.map +1 -0
- package/dist/field/ViewSelector.d.ts +4 -0
- package/dist/field/ViewSelector.d.ts.map +1 -0
- package/dist/field/ViewSelector.js +89 -0
- package/dist/field/ViewSelector.js.map +1 -0
- package/dist/field/bundled.css +1 -1
- package/dist/field/index.d.ts +1 -0
- package/dist/field/index.d.ts.map +1 -1
- package/dist/field/index.js +47 -29
- package/dist/field/index.js.map +1 -1
- package/dist/field/rscEntry.d.ts +1 -1
- package/dist/field/rscEntry.d.ts.map +1 -1
- package/dist/field/rscEntry.js +12 -0
- package/dist/field/rscEntry.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/lexical/LexicalEditor.d.ts.map +1 -1
- package/dist/lexical/LexicalEditor.js +2 -1
- package/dist/lexical/LexicalEditor.js.map +1 -1
- package/dist/lexical/LexicalProvider.d.ts.map +1 -1
- package/dist/lexical/LexicalProvider.js +12 -3
- package/dist/lexical/LexicalProvider.js.map +1 -1
- package/dist/lexical/config/client/sanitize.d.ts +1 -1
- package/dist/lexical/config/client/sanitize.d.ts.map +1 -1
- package/dist/lexical/config/client/sanitize.js +3 -2
- package/dist/lexical/config/client/sanitize.js.map +1 -1
- package/dist/lexical/config/types.d.ts +4 -0
- package/dist/lexical/config/types.d.ts.map +1 -1
- package/dist/lexical/config/types.js.map +1 -1
- package/dist/lexical/nodes/index.d.ts +12 -2
- package/dist/lexical/nodes/index.d.ts.map +1 -1
- package/dist/lexical/nodes/index.js +195 -2
- package/dist/lexical/nodes/index.js.map +1 -1
- package/dist/lexical/plugins/NodeViewOverridePlugin/index.d.ts +2 -0
- package/dist/lexical/plugins/NodeViewOverridePlugin/index.d.ts.map +1 -0
- package/dist/lexical/plugins/NodeViewOverridePlugin/index.js +48 -0
- package/dist/lexical/plugins/NodeViewOverridePlugin/index.js.map +1 -0
- package/dist/types.d.ts +152 -2
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/dist/utilities/generateImportMap.d.ts.map +1 -1
- package/dist/utilities/generateImportMap.js +1 -0
- package/dist/utilities/generateImportMap.js.map +1 -1
- package/dist/validate/hasText.d.ts +6 -1
- package/dist/validate/hasText.d.ts.map +1 -1
- package/dist/validate/hasText.js +10 -4
- package/dist/validate/hasText.js.map +1 -1
- package/package.json +11 -6
- package/dist/exports/client/Field-HJGV32KA.js +0 -2
- package/dist/exports/client/Field-HJGV32KA.js.map +0 -7
- package/dist/exports/client/chunk-EZX4YW7S.js +0 -12
- package/dist/exports/client/chunk-EZX4YW7S.js.map +0 -7
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
var st=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";import{c as he}from"react/compiler-runtime";import{useRef as xe}from"react";function ro(r){let t=he(2),e=r===void 0?500:r,o=xe(void 0),n;return t[0]!==e?(n=c=>new Promise(i=>{let l=()=>{c(),i()};"requestIdleCallback"in window?("cancelIdleCallback"in window&&o.current!==void 0&&cancelIdleCallback(o.current),o.current=requestIdleCallback(l,{timeout:e})):Ee().then(l)}),t[0]=e,t[1]=n):n=t[1],n}function Ee(){return new Promise(r=>{setTimeout(r,100),requestAnimationFrame(()=>{setTimeout(r,0)})})}import{jsx as _e}from"react/jsx-runtime";import{useControllableState as Te}from"@payloadcms/ui";import{createContext as we,use as Se,useMemo as Ce}from"react";var ct=we({currentView:"default",inheritable:!1,setCurrentView:()=>{}}),fo=r=>{let t=Re(),{children:e,currentView:o,inheritable:n,views:s}=t.inheritable?{...t,...r}:r,[c,i]=Te(o,"default"),l=Ce(()=>{let a=s?s[c]||s.default:void 0;return{currentView:c,currentViewMap:a,inheritable:n,setCurrentView:i,views:s}},[c,n,i,s]);return _e(ct,{value:l,children:e})};function Re(){return Se(ct)}var z=class{_x;_y;constructor(t,e){this._x=t,this._y=e}calcDeltaXTo({x:t}){return this.x-t}calcDeltaYTo({y:t}){return this.y-t}calcDistanceTo(t){return Math.sqrt(Math.pow(this.calcDeltaXTo(t),2)+Math.pow(this.calcDeltaYTo(t),2))}calcHorizontalDistanceTo(t){return Math.abs(this.calcDeltaXTo(t))}calcVerticalDistance(t){return Math.abs(this.calcDeltaYTo(t))}equals({x:t,y:e}){return this.x===t&&this.y===e}get x(){return this._x}get y(){return this._y}};function lt(r){return r instanceof z}import{jsx as Xe}from"react/jsx-runtime";import{useLexicalComposerContext as Ge}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as ze}from"@lexical/utils";import{$getSelection as j,$isRangeSelection as W,$isTextNode as Ve,COMMAND_PRIORITY_LOW as Ye,createCommand as je,getDOMSelection as We}from"lexical";import{useCallback as _t,useEffect as Tt,useState as qe}from"react";import*as Y from"react";import{c as pt}from"react/compiler-runtime";import{useLexicalComposerContext as gt}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as at}from"@lexical/utils";import{$getSelection as ht,$isRangeSelection as ye,$setSelection as be,COMMAND_PRIORITY_LOW as ft,COMMAND_PRIORITY_NORMAL as $,createCommand as Oe,KEY_ARROW_DOWN_COMMAND as ke,KEY_ARROW_UP_COMMAND as Ne,KEY_ENTER_COMMAND as Fe,KEY_ESCAPE_COMMAND as Ie,KEY_TAB_COMMAND as Me}from"lexical";import{useCallback as V,useEffect as O,useLayoutEffect as Ae,useMemo as De,useRef as Le,useState as $e}from"react";var Be="slash-menu-popup",ut=r=>{let t=document.getElementById("slash-menu");if(!t)return;let e=t.getBoundingClientRect();e.top+e.height>window.innerHeight&&t.scrollIntoView({block:"center"}),e.top<0&&t.scrollIntoView({block:"center"}),r.scrollIntoView({block:"nearest"})};function ve(r,t,e){let o=e;for(let n=o;n<=t.length;n++)r.substring(r.length-n)===t.substring(0,n)&&(o=n);return o}function Pe(r){let t=ht();if(!ye(t)||!t.isCollapsed())return;let e=t.anchor;if(e.type!=="text")return;let o=e.getNode();if(!o.isSimpleText())return;let n=e.offset,s=o.getTextContent().slice(0,n),c=r.replaceableString.length,i=ve(s,r.matchingString,c),l=n-i;if(l<0)return;let a;return l===0?[a]=o.splitText(n):[,a]=o.splitText(l,n),a}function He(r,t){let e=getComputedStyle(r),o=e.position==="absolute",n=t?/(auto|scroll|hidden)/:/(auto|scroll)/;if(e.position==="fixed")return document.body;for(let s=r;s=s.parentElement;)if(e=getComputedStyle(s),!(o&&e.position==="static")&&n.test(e.overflow+e.overflowY+e.overflowX))return s;return document.body}function dt(r,t){let e=r.getBoundingClientRect(),o=t.getBoundingClientRect();return e.top>o.top&&e.top<o.bottom}function Ke(r,t,e,o){let n=pt(7),[s]=gt(),c,i;n[0]!==s||n[1]!==e||n[2]!==o||n[3]!==r||n[4]!==t?(c=()=>{let l=t.current;if(l!=null&&r!=null){let a=s.getRootElement(),u=a!=null?He(a,!1):document.body,p=!1,m=dt(l,u),g=function(){p||(window.requestAnimationFrame(function(){e(),p=!1}),p=!0);let d=dt(l,u);d!==m&&(m=d,o?.(d))},f=new ResizeObserver(e);return window.addEventListener("resize",e),document.addEventListener("scroll",g,{capture:!0,passive:!0}),f.observe(l),()=>{f.disconnect(),window.removeEventListener("resize",e),document.removeEventListener("scroll",g,!0)}}},i=[s,o,e,r,t],n[0]=s,n[1]=e,n[2]=o,n[3]=r,n[4]=t,n[5]=c,n[6]=i):(c=n[5],i=n[6]),O(c,i)}var mt=Oe("SCROLL_TYPEAHEAD_OPTION_INTO_VIEW_COMMAND");function xt({anchorElementRef:r,close:t,editor:e,groups:o,menuRenderFn:n,resolution:s,shouldSplitNodeWithQuery:c=!1}){let[i,l]=$e(null),a=s.match&&s.match.matchingString||"",u=V(f=>{let d=e.getRootElement();d!==null&&(d.setAttribute("aria-activedescendant",`${Be}__item-${f.key}`),l(f.key))},[e]),p=V(()=>{if(o!==null&&a!=null){let f=o.flatMap(d=>d.items);if(f.length){let d=f[0];u(d)}}},[o,u,a]);O(()=>{p()},[a,p]);let m=V(f=>{t(),e.update(()=>{let d=s.match!=null&&c?Pe(s.match):null;d&&d.remove()}),setTimeout(()=>{let d;e.read(()=>{d=ht()?.clone()}),e.update(()=>{d&&be(d)}),f.onSelect({editor:e,queryString:s.match?s.match.matchingString:""})},0)},[e,c,s.match,t]);O(()=>()=>{let f=e.getRootElement();f!==null&&f.removeAttribute("aria-activedescendant")},[e]),Ae(()=>{o===null?l(null):i===null&&p()},[o,i,u,p]),O(()=>at(e.registerCommand(mt,({item:f})=>f.ref&&f.ref.current!=null?(ut(f.ref.current),!0):!1,ft)),[e,u]),O(()=>at(e.registerCommand(ke,f=>{let d=f;if(o!==null&&o.length&&i!==null){let h=o.flatMap(T=>T.items),x=h.findIndex(T=>T.key===i),E=x!==h.length-1?x+1:0,_=h[E];if(!_)return!1;u(_),_.ref!=null&&_.ref.current&&e.dispatchCommand(mt,{index:E,item:_}),d.preventDefault(),d.stopImmediatePropagation()}return!0},$),e.registerCommand(Ne,f=>{let d=f;if(o!==null&&o.length&&i!==null){let h=o.flatMap(T=>T.items),x=h.findIndex(T=>T.key===i),E=x!==0?x-1:h.length-1,_=h[E];if(!_)return!1;u(_),_.ref!=null&&_.ref.current&&ut(_.ref.current),d.preventDefault(),d.stopImmediatePropagation()}return!0},$),e.registerCommand(Ie,f=>{let d=f;return d.preventDefault(),d.stopImmediatePropagation(),t(),!0},ft),e.registerCommand(Me,f=>{let d=f;if(o===null||i===null)return!1;let x=o.flatMap(E=>E.items).find(E=>E.key===i);return x?(d.preventDefault(),d.stopImmediatePropagation(),m(x),!0):!1},$),e.registerCommand(Fe,f=>{if(o===null||i===null)return!1;let h=o.flatMap(x=>x.items).find(x=>x.key===i);return h?(f!==null&&(f.preventDefault(),f.stopImmediatePropagation()),m(h),!0):!1},$)),[m,t,e,o,i,u]);let g=De(()=>({groups:o,selectedItemKey:i,selectItemAndCleanUp:m,setSelectedItemKey:l}),[m,i,o]);return n(r,g,s.match?s.match.matchingString:"")}function Ue(r,t){t!=null&&(r.className=t),r.setAttribute("aria-label","Slash menu"),r.setAttribute("role","listbox"),r.style.display="block",r.style.position="absolute"}function Et(r,t,e,o){let n=pt(14),[s]=gt(),c;n[0]===Symbol.for("react.memo_cache_sentinel")?(c=st?document.createElement("div"):null,n[0]=c):c=n[0];let i=Le(c),l;n[1]!==r||n[2]!==o||n[3]!==s||n[4]!==t?(l=()=>{if(i.current===null||parent===void 0)return;let f=s.getRootElement(),d=i.current,h=d.firstChild;if(f!==null&&t!==null){let{height:x,width:E}=t.getRect(),{left:_,top:T}=t.getRect(),b=T;if(T=T-(r.getBoundingClientRect().top+window.scrollY),_=_-(r.getBoundingClientRect().left+window.scrollX),d.style.left=`${_+window.scrollX}px`,d.style.height=`${x}px`,d.style.width=`${E}px`,h!==null){let w=h.getBoundingClientRect(),L=w.height,C=w.width,G=f.getBoundingClientRect(),rt=document.dir==="rtl"||document.documentElement.dir==="rtl",de=r.getBoundingClientRect(),it=Math.max(0,G.left);if(!rt&&_+C>G.right)d.style.left=`${G.right-C+window.scrollX}px`;else if(rt&&w.left<it){let ge=it+C-de.left;d.style.left=`${ge+window.scrollX}px`}let me=b+L+32>window.innerHeight,pe=b<0;me&&!pe?d.style.top=`${T+32-L+window.scrollY-(x+24)}px`:d.style.top=`${T+window.scrollY+32}px`}d.isConnected||(Ue(d,o),r.append(d)),d.setAttribute("id","slash-menu"),i.current=d,f.setAttribute("aria-controls","slash-menu")}},n[1]=r,n[2]=o,n[3]=s,n[4]=t,n[5]=l):l=n[5];let a=l,u,p;n[6]!==s||n[7]!==a||n[8]!==t?(u=()=>{let f=s.getRootElement();if(t!==null)return a(),()=>{f!==null&&f.removeAttribute("aria-controls");let d=i.current;d!==null&&d.isConnected&&(d.remove(),d.removeAttribute("id"))}},p=[s,a,t],n[6]=s,n[7]=a,n[8]=t,n[9]=u,n[10]=p):(u=n[9],p=n[10]),O(u,p);let m;return n[11]!==t||n[12]!==e?(m=f=>{t!==null&&(f||e(null))},n[11]=t,n[12]=e,n[13]=m):m=n[13],Ke(t,i,a,m),i}var Oo=`\\.,\\+\\*\\?\\$\\@\\|#{}\\(\\)\\^\\-\\[\\]\\\\/!%'"~=<>_:;`;function Qe(r){let t=r.anchor;if(t.type!=="text")return null;let e=t.getNode();if(!e.isSimpleText())return null;let o=t.offset;return e.getTextContent().slice(0,o)}function wt(r,t,e){let o=We(e);if(o===null||!o.isCollapsed)return!1;let n=o.anchorNode,s=r,c=o.anchorOffset;if(n==null||c==null)return!1;try{t.setStart(n,s),t.setEnd(n,c>1?c:1)}catch{return!1}return!0}function Je(r){let t;return r.getEditorState().read(()=>{let e=j();W(e)&&(t=Qe(e))}),t}function St(r,t){return t!==0?!1:r.getEditorState().read(()=>{let e=j();if(W(e)){let s=e.anchor.getNode().getPreviousSibling();return Ve(s)&&s.isTextEntity()}return!1})}function Ct(r){Y.startTransition?Y.startTransition(r):r()}var Ze=je("ENABLE_SLASH_MENU_COMMAND");function ko({anchorClassName:r,anchorElem:t,groups:e,menuRenderFn:o,onClose:n,onOpen:s,onQueryChange:c,triggerFn:i}){let[l]=Ge(),[a,u]=qe(null),p=Et(t,a,u,r),m=_t(()=>{u(null),n!=null&&a!==null&&n()},[n,a]),g=_t(f=>{u(f),s!=null&&a===null&&s(f)},[s,a]);return Tt(()=>ze(l.registerCommand(Ze,({node:f})=>(l.getEditorState().read(()=>{let d={leadOffset:0,matchingString:"",replaceableString:""};if(!St(l,d.leadOffset)&&f!==null){let h=l._window??window,x=h.document.createRange();wt(d.leadOffset,x,h)!==null&&Ct(()=>g({getRect:()=>x.getBoundingClientRect(),match:d}));return}}),!0),Ye)),[l,g]),Tt(()=>{let f=()=>{l.getEditorState().read(()=>{let h=l._window??window,x=h.document.createRange(),E=j(),_=Je(l);if(!W(E)||!E.isCollapsed()||_===void 0||x===null){m();return}let T=i({editor:l,query:_});if(c(T?T.matchingString:null),T!==null&&!St(l,T.leadOffset)&&wt(T.leadOffset,x,h)!==null){Ct(()=>g({getRect:()=>x.getBoundingClientRect(),match:T}));return}m()})},d=l.registerUpdateListener(f);return()=>{d()}},[l,i,c,a,m,g]),p.current===null||a===null||l===null?null:Xe(xt,{anchorElementRef:p,close:m,editor:l,groups:e,menuRenderFn:o,resolution:a,shouldSplitNodeWithQuery:!0})}var Rt=class r{_bottom;_left;_right;_top;constructor(t,e,o,n){let[s,c]=e<=n?[e,n]:[n,e],[i,l]=t<=o?[t,o]:[o,t];this._top=s,this._right=l,this._left=i,this._bottom=c}static fromDOM(t){let{height:e,left:o,top:n,width:s}=t.getBoundingClientRect();return r.fromLWTH(o,s,n,e)}static fromDOMRect(t){let{height:e,left:o,top:n,width:s}=t;return r.fromLWTH(o,s,n,e)}static fromLTRB(t,e,o,n){return new r(t,e,o,n)}static fromLWTH(t,e,o,n){return new r(t,o,t+e,o+n)}static fromPoints(t,e){let{x:o,y:n}=t,{x:s,y:c}=e;return r.fromLTRB(o,n,s,c)}contains(t){if(lt(t)){let{x:c,y:i}=t,l=i<this._top,a=i>this._bottom,u=c<this._left,p=c>this._right;return{reason:{isOnBottomSide:a,isOnLeftSide:u,isOnRightSide:p,isOnTopSide:l},result:!l&&!a&&!u&&!p}}let{bottom:e,left:o,right:n,top:s}=t;return s>=this._top&&s<=this._bottom&&e>=this._top&&e<=this._bottom&&o>=this._left&&o<=this._right&&n>=this._left&&n<=this._right}distanceFromPoint(t){let e=this.contains(t);if(e.result)return{distance:0,isOnBottomSide:e.reason.isOnBottomSide,isOnLeftSide:e.reason.isOnLeftSide,isOnRightSide:e.reason.isOnRightSide,isOnTopSide:e.reason.isOnTopSide};let o=0,n=0;return t.x<this._left?o=this._left-t.x:t.x>this._right&&(o=t.x-this._right),t.y<this._top?n=this._top-t.y:t.y>this._bottom&&(n=t.y-this._bottom),{distance:Math.sqrt(o*o+n*n),isOnBottomSide:t.y>this._bottom,isOnLeftSide:t.x<this._left,isOnRightSide:t.x>this._right,isOnTopSide:t.y<this._top}}equals({bottom:t,left:e,right:o,top:n}){return n===this._top&&t===this._bottom&&e===this._left&&o===this._right}generateNewRect({bottom:t=this.bottom,left:e=this.left,right:o=this.right,top:n=this.top}){return new r(e,n,o,t)}intersectsWith(t){let{height:e,left:o,top:n,width:s}=t,{height:c,left:i,top:l,width:a}=this,u=o+s>=i+a?o+s:i+a,p=n+e>=l+c?n+e:l+c,m=o<=i?o:i,g=n<=l?n:l;return u-m<=s+a&&p-g<=e+c}get bottom(){return this._bottom}get height(){return Math.abs(this._bottom-this._top)}get left(){return this._left}get right(){return this._right}get top(){return this._top}get width(){return Math.abs(this._left-this._right)}};import q from"react";var A=new WeakMap;function Ao(r,t){A.has(r)||A.set(r,new Map);let e=A.get(r);for(let[o,n]of Object.entries(t))if(!(!n||typeof n!="object")){if(o==="blocks"){for(let[s,c]of Object.entries(n))e.set(`block:${s}`,c);continue}if(o==="inlineBlocks"){for(let[s,c]of Object.entries(n))e.set(`inlineBlock:${s}`,c);continue}e.set(o,n)}}function Do(r){A.delete(r)}function yt(r,t,e){let o=A.get(r);if(t==="block"&&e?.__fields?.blockType){let n=e.__fields.blockType;return o?.get(`block:${n}`)}if(t==="inlineBlock"&&e?.__fields?.blockType){let n=e.__fields.blockType;return o?.get(`inlineBlock:${n}`)}return o?.get(t)}function tn({node:r,nodeType:t}){if(!("getType"in r)||r.getType()!==t)return;let e=r;if(e.prototype._originalDecorate||(e.prototype._originalDecorate=e.prototype.decorate),e.prototype._originalCreateDOM||(e.prototype._originalCreateDOM=e.prototype.createDOM),e.prototype.decorate&&!e.prototype._decorateOverridden){e.prototype._decorateOverridden=!0;let o=!!e.prototype.createDOM;e.prototype.decorate=function(n,s){let c=yt(n,t,this);if(c){if(c.Component)return c.Component({config:s,editor:n,isEditor:!0,isJSXConverter:!1,node:this});if(c.createDOM&&c.html){let i=typeof c.html=="function"?c.html({config:s,editor:n,isEditor:!0,isJSXConverter:!1,node:this}):c.html;return q.createElement("span",{dangerouslySetInnerHTML:{__html:i}})}if(c.html&&o&&!c.createDOM)return q.createElement(q.Fragment)}return e.prototype._originalDecorate.call(this,n,s)}}e.prototype.createDOM&&!e.prototype._createDOMOverridden&&(e.prototype._createDOMOverridden=!0,e.prototype.createDOM=function(o,n){let s=yt(n,t,this);if(s){if(s.createDOM)return s.createDOM({config:o,editor:n,node:this});if(s.html){let c=typeof s.html=="function"?s.html({config:o,editor:n,isEditor:!0,isJSXConverter:!1,node:this}):s.html,i=document.createElement("div");return i.innerHTML=c,i.firstElementChild||i}}return e.prototype._originalCreateDOM.call(this,o,n)})}function Lo({editorConfig:r,nodeViews:t}){let e=en({nodes:r.features.nodes});if(t){let o=new Set;for(let[n,s]of Object.entries(t))!s||typeof s!="object"||(n==="blocks"&&Object.keys(s).length>0?o.add("block"):n==="inlineBlocks"&&Object.keys(s).length>0?o.add("inlineBlock"):o.add(n));for(let n of e)if("getType"in n){let s=n.getType();o.has(s)&&tn({node:n,nodeType:s})}}return e}function en({nodes:r}){return r.map(t=>"node"in t?t.node:t)}import{$getRoot as un,$isDecoratorNode as Ft,$isElementNode as P,$isLineBreakNode as dn,$isTextNode as H}from"lexical";import{$isListItemNode as nn,$isListNode as bt}from"@lexical/list";import{$isHeadingNode as on,$isQuoteNode as rn}from"@lexical/rich-text";import{$isParagraphNode as sn,$isTextNode as cn}from"lexical";var S={markdownFormatKind:null,regEx:/(?:)/,regExForAutoFormatting:/(?:)/,requiresParagraphStart:!1},R={...S,requiresParagraphStart:!0},Ho={...R,export:k(1),markdownFormatKind:"paragraphH1",regEx:/^# /,regExForAutoFormatting:/^# /},Ko={...R,export:k(2),markdownFormatKind:"paragraphH2",regEx:/^## /,regExForAutoFormatting:/^## /},Uo={...R,export:k(3),markdownFormatKind:"paragraphH3",regEx:/^### /,regExForAutoFormatting:/^### /},Xo={...R,export:k(4),markdownFormatKind:"paragraphH4",regEx:/^#### /,regExForAutoFormatting:/^#### /},Go={...R,export:k(5),markdownFormatKind:"paragraphH5",regEx:/^##### /,regExForAutoFormatting:/^##### /},zo={...R,export:k(6),markdownFormatKind:"paragraphH6",regEx:/^###### /,regExForAutoFormatting:/^###### /},Vo={...R,export:an,markdownFormatKind:"paragraphBlockQuote",regEx:/^> /,regExForAutoFormatting:/^> /},Yo={...R,export:Q,markdownFormatKind:"paragraphUnorderedList",regEx:/^(\s{0,10})- /,regExForAutoFormatting:/^(\s{0,10})- /},jo={...R,export:Q,markdownFormatKind:"paragraphUnorderedList",regEx:/^(\s{0,10})\* /,regExForAutoFormatting:/^(\s{0,10})\* /},Wo={...R,export:Q,markdownFormatKind:"paragraphOrderedList",regEx:/^(\s{0,10})(\d+)\.\s/,regExForAutoFormatting:/^(\s{0,10})(\d+)\.\s/},qo={...R,markdownFormatKind:"horizontalRule",regEx:/^\*\*\*$/,regExForAutoFormatting:/^\*\*\* /},Qo={...R,markdownFormatKind:"horizontalRule",regEx:/^---$/,regExForAutoFormatting:/^--- /},Jo={...S,exportFormat:"code",exportTag:"`",markdownFormatKind:"code",regEx:/(`)(\s*)([^`]*)(\s*)(`)()/,regExForAutoFormatting:/(`)(\s*\b)([^`]*)(\b\s*)(`)(\s)$/},Zo={...S,exportFormat:"bold",exportTag:"**",markdownFormatKind:"bold",regEx:/(\*\*)(\s*)([^*]*)(\s*)(\*\*)()/,regExForAutoFormatting:/(\*\*)(\s*\b)([^*]*)(\b\s*)(\*\*)(\s)$/},tr={...S,exportFormat:"italic",exportTag:"*",markdownFormatKind:"italic",regEx:/(\*)(\s*)([^*]*)(\s*)(\*)()/,regExForAutoFormatting:/(\*)(\s*\b)([^*]*)(\b\s*)(\*)(\s)$/},er={...S,exportFormat:"bold",exportTag:"_",markdownFormatKind:"bold",regEx:/(__)(\s*)([^_]*)(\s*)(__)()/,regExForAutoFormatting:/(__)(\s*)([^_]*)(\s*)(__)(\s)$/},nr={...S,exportFormat:"italic",exportTag:"_",markdownFormatKind:"italic",regEx:/(_)()([^_]*)()(_)()/,regExForAutoFormatting:/(_)()([^_]*)()(_)(\s)$/},or={...S,exportFormat:"underline",exportTag:"<u>",exportTagClose:"</u>",markdownFormatKind:"underline",regEx:/(<u>)(\s*)([^<]*)(\s*)(<\/u>)()/,regExForAutoFormatting:/(<u>)(\s*\b)([^<]*)(\b\s*)(<\/u>)(\s)$/},rr={...S,exportFormat:"strikethrough",exportTag:"~~",markdownFormatKind:"strikethrough",regEx:/(~~)(\s*)([^~]*)(\s*)(~~)()/,regExForAutoFormatting:/(~~)(\s*\b)([^~]*)(\b\s*)(~~)(\s)$/},ir={...S,markdownFormatKind:"strikethrough_italic_bold",regEx:/(~~_\*\*)(\s*\b)([^*_~]+)(\b\s*)(\*\*_~~)()/,regExForAutoFormatting:/(~~_\*\*)(\s*\b)([^*_~]+)(\b\s*)(\*\*_~~)(\s)$/},sr={...S,markdownFormatKind:"italic_bold",regEx:/(_\*\*)(\s*\b)([^*_]+)(\b\s*)(\*\*_)/,regExForAutoFormatting:/(_\*\*)(\s*\b)([^*_]+)(\b\s*)(\*\*_)(\s)$/},cr={...S,markdownFormatKind:"strikethrough_italic",regEx:/(~~_)(\s*)([^_~]+)(\s*)(_~~)/,regExForAutoFormatting:/(~~_)(\s*)([^_~]+)(\s*)(_~~)(\s)$/},lr={...S,markdownFormatKind:"strikethrough_bold",regEx:/(~~\*\*)(\s*\b)([^*~]+)(\b\s*)(\*\*~~)/,regExForAutoFormatting:/(~~\*\*)(\s*\b)([^*~]+)(\b\s*)(\*\*~~)(\s)$/},ar={...S,markdownFormatKind:"link",regEx:/(\[)([^\]]*)(\]\()([^)]*)(\)*)()/,regExForAutoFormatting:/(\[)([^\]]*)(\]\()([^)]*)(\)*)(\s)$/};function k(r){return(t,e)=>on(t)&&t.getTag()==="h"+r?"#".repeat(r)+" "+e(t):null}function Q(r,t){return bt(r)?Ot(r,t,0):null}var ln=4;function Ot(r,t,e){let o=[],n=r.getChildren(),s=0;for(let c of n)if(nn(c)){if(c.getChildrenSize()===1){let a=c.getFirstChild();if(bt(a)){o.push(Ot(a,t,e+1));continue}}let i=" ".repeat(e*ln),l=r.getListType()==="bullet"?"- ":`${r.getStart()+s}. `;o.push(i+l+t(c)),s++}return o.join(`
|
|
2
|
+
`)}function an(r,t){return rn(r)?"> "+t(r):null}function B(r,t){let e={};for(let o of r){let n=t(o);n&&(e[n]?e[n].push(o):e[n]=[o])}return e}function N(r){let t=B(r,e=>e.type);return{element:t.element||[],multilineElement:t["multiline-element"]||[],textFormat:t["text-format"]||[],textMatch:t["text-match"]||[]}}var F=/[!-/:-@[-`{-~\s]/,fn=/^\s{0,3}$/;function D(r){if(!sn(r))return!1;let t=r.getFirstChild();return t==null||r.getChildrenSize()===1&&cn(t)&&fn.test(t.getTextContent())}function It(r,t=!1){let e=N(r),o=[...e.multilineElement,...e.element],n=!t,s=e.textFormat.filter(c=>c.format.length===1).sort((c,i)=>c.format.includes("code")&&!i.format.includes("code")?1:!c.format.includes("code")&&i.format.includes("code")?-1:0);return c=>{let i=[],l=(c||un()).getChildren();return l.forEach((a,u)=>{let p=mn(a,o,s,e.textMatch);p!=null&&i.push(n&&u>0&&!D(a)&&!D(l[u-1])?`
|
|
3
|
+
`.concat(p):p)}),i.join(`
|
|
4
|
+
`)}}function mn(r,t,e,o){for(let n of t){if(!n.export)continue;let s=n.export(r,c=>K(c,e,o));if(s!=null)return s}return P(r)?K(r,e,o):Ft(r)?r.getTextContent():null}function K(r,t,e,o,n){let s=[],c=r.getChildren();o||(o=[]),n||(n=[]);t:for(let i of c){for(let l of e){if(!l.export)continue;let a=l.export(i,u=>K(u,t,e,o,[...n,...o]),(u,p)=>kt(u,p,t,o,n));if(a!=null){s.push(a);continue t}}dn(i)?s.push(`
|
|
5
|
+
`):H(i)?s.push(kt(i,i.getTextContent(),t,o,n)):P(i)?s.push(K(i,t,e,o,n)):Ft(i)&&s.push(i.getTextContent())}return s.join("")}function kt(r,t,e,o,n){let s=t.trim(),c=s;r.hasFormat("code")||(c=c.replace(/([*_`~\\])/g,"\\$1"));let i="",l="",a="",u=Nt(r,!0),p=Nt(r,!1),m=new Set;for(let g of e){let f=g.format[0],d=g.tag;v(r,f)&&!m.has(f)&&(m.add(f),(!v(u,f)||!o.find(h=>h.tag===d))&&(o.push({format:f,tag:d}),i+=d))}for(let g=0;g<o.length;g++){let f=o[g],d=v(r,f.format),h=v(p,f.format);if(d&&h)continue;let x=[...o];for(;x.length>g;){let E=x.pop();n&&E&&n.find(_=>_.tag===E.tag)||(E&&typeof E.tag=="string"&&(d?h||(a+=E.tag):l+=E.tag),o.pop())}break}return c=i+c+a,l+t.replace(s,()=>c)}function Nt(r,t){let e=t?r.getPreviousSibling():r.getNextSibling();if(!e){let o=r.getParentOrThrow();o.isInline()&&(e=t?o.getPreviousSibling():o.getNextSibling())}for(;e;){if(P(e)){if(!e.isInline())break;let o=t?e.getLastDescendant():e.getFirstDescendant();if(H(o))return o;e=t?e.getPreviousSibling():e.getNextSibling()}if(H(e))return e;if(!P(e))return null}return null}function v(r,t){return H(r)&&r.hasFormat(t)}import{$isListItemNode as gn,$isListNode as $t}from"@lexical/list";import{$isQuoteNode as hn}from"@lexical/rich-text";import{$findMatchingParent as xn}from"@lexical/utils";import{$createLineBreakNode as En,$createParagraphNode as _n,$createTextNode as Tn,$getRoot as wn,$getSelection as Sn,$isParagraphNode as Cn}from"lexical";import{$isTextNode as I}from"lexical";function Mt(r,t){let e=r.getTextContent(),o=pn(e,t);if(!o)return null;let n=o.index||0,s=n+o[0].length,c=t.transformersByTag[o[1]];return{endIndex:s,match:o,startIndex:n,transformer:c}}function pn(r,t){let e=r.match(t.openTagsRegExp);if(e==null)return null;for(let o of e){let n=o.replace(/^\s/,""),s=t.fullMatchRegExpByTag[n];if(s==null)continue;let c=r.match(s),i=t.transformersByTag[n];if(c!=null&&i!=null){if(i.intraword!==!1)return c;let{index:l=0}=c,a=r[l-1],u=r[l+c[0].length];if((!a||F.test(a))&&(!u||F.test(u)))return c}}return null}function At(r,t,e,o,n){let s=r.getTextContent(),c,i,l;if(n[0]===s?l=r:t===0?[l,c]=r.splitText(e):[i,l,c]=r.splitText(t,e),l.setTextContent(n[2]),o)for(let a of o.format)l.hasFormat(a)||l.toggleFormat(a);return{nodeAfter:c,nodeBefore:i,transformedNode:l}}function Dt(r,t){let e=r,o,n,s,c;for(let i of t){if(!i.replace||!i.importRegExp)continue;let l=e.getTextContent().match(i.importRegExp);if(!l)continue;let a=l.index||0,u=i.getEndIndex?i.getEndIndex(e,l):a+l[0].length;u!==!1&&(o===void 0||n===void 0||a<o&&u>n)&&(o=a,n=u,s=i,c=l)}return o===void 0||n===void 0||s===void 0||c===void 0?null:{endIndex:n,match:c,startIndex:o,transformer:s}}function Lt(r,t,e,o,n){let s,c,i;if(t===0?[i,s]=r.splitText(e):[c,i,s]=r.splitText(t,e),!o.replace)return null;let l=i?o.replace(i,n):void 0;return{nodeAfter:s,nodeBefore:c,transformedNode:l||void 0}}function y(r,t,e){let o=Mt(r,t),n=Dt(r,e);if(o&&n&&(o.startIndex<=n.startIndex&&o.endIndex>=n.endIndex?n=null:o=null),o){let i=At(r,o.startIndex,o.endIndex,o.transformer,o.match);i.nodeAfter&&I(i.nodeAfter)&&!i.nodeAfter.hasFormat("code")&&y(i.nodeAfter,t,e),i.nodeBefore&&I(i.nodeBefore)&&!i.nodeBefore.hasFormat("code")&&y(i.nodeBefore,t,e),i.transformedNode&&I(i.transformedNode)&&!i.transformedNode.hasFormat("code")&&y(i.transformedNode,t,e)}else if(n){let i=Lt(r,n.startIndex,n.endIndex,n.transformer,n.match);if(!i)return;i.nodeAfter&&I(i.nodeAfter)&&!i.nodeAfter.hasFormat("code")&&y(i.nodeAfter,t,e),i.nodeBefore&&I(i.nodeBefore)&&!i.nodeBefore.hasFormat("code")&&y(i.nodeBefore,t,e),i.transformedNode&&I(i.transformedNode)&&!i.transformedNode.hasFormat("code")&&y(i.transformedNode,t,e)}let c=r.getTextContent().replace(/\\([*_`~])/g,"$1");r.setTextContent(c)}function Bt(r,t=!1){let e=N(r),o=bn(e.textFormat);return(n,s)=>{let c=n.split(`
|
|
6
|
+
`),i=c.length,l=s||wn();l.clear();for(let u=0;u<i;u++){let p=c[u],[m,g]=Rn(c,u,e.multilineElement,l);if(m){u=g;continue}yn(p,l,e.element,o,e.textMatch)}let a=l.getChildren();for(let u of a)!t&&D(u)&&l.getChildrenSize()>1&&u.remove();Sn()!==null&&l.selectStart()}}function Rn(r,t,e,o){for(let n of e){let{handleImportAfterStartMatch:s,regExpEnd:c,regExpStart:i,replace:l}=n,a=r[t]?.match(i);if(!a)continue;if(s){let f=s({lines:r,rootNode:o,startLineIndex:t,startMatch:a,transformer:n});if(f===null)continue;if(f)return f}let u=typeof c=="object"&&"regExp"in c?c.regExp:c,p=c&&typeof c=="object"&&"optional"in c?c.optional:!c,m=t,g=r.length;for(;m<g;){let f=u?r[m]?.match(u):null;if(!f&&(!p||p&&m<g-1)){m++;continue}if(f&&t===m&&f.index===a.index){m++;continue}let d=[];if(f&&t===m)d.push(r[t].slice(a[0].length,-f[0].length));else for(let h=t;h<=m;h++){let x=r[h];if(h===t){let E=x.slice(a[0].length);d.push(E)}else if(h===m&&f){let E=x.slice(0,-f[0].length);d.push(E)}else d.push(x)}if(l(o,null,a,f,d,!0)!==!1)return[!0,m];break}}return[!1,t]}function yn(r,t,e,o,n){let s=Tn(r),c=_n();c.append(s),t.append(c);for(let{regExp:i,replace:l}of e){let a=r.match(i);if(a&&(s.setTextContent(r.slice(a[0].length)),l(c,[s],a,!0)!==!1))break}if(y(s,o,n),c.isAttached()&&r.length>0){let i=c.getPreviousSibling();if(Cn(i)||hn(i)||$t(i)){let l=i;if($t(i)){let a=i.getLastDescendant();a==null?l=null:l=xn(a,gn)}l!=null&&l.getTextContentSize()>0&&(l.splice(l.getChildrenSize(),0,[En(),...c.getChildren()]),c.remove())}}}function bn(r){let t={},e={},o=[],n="(?<![\\\\])";for(let s of r){let{tag:c}=s;t[c]=s;let i=c.replace(/([*^+])/g,"\\$1");o.push(i),c.length===1?e[c]=new RegExp(`(?<![\\\\${i}])(${i})((\\\\${i})?.*?[^${i}\\s](\\\\${i})?)((?<!\\\\)|(?<=\\\\\\\\))(${i})(?![\\\\${i}])`):e[c]=new RegExp(`(?<!\\\\)(${i})((\\\\${i})?.*?[^\\s](\\\\${i})?)((?<!\\\\)|(?<=\\\\\\\\))(${i})(?!\\\\)`)}return{fullMatchRegExpByTag:e,openTagsRegExp:new RegExp(`${n}(${o.join("|")})`,"g"),transformersByTag:t}}import{$createRangeSelection as On,$getSelection as J,$isLineBreakNode as kn,$isRangeSelection as Z,$isRootOrShadowRoot as Pt,$isTextNode as Ht,$setSelection as Nn}from"lexical";function Fn(r,t,e,o){let n=r.getParent();if(!Pt(n)||r.getFirstChild()!==t)return!1;let s=t.getTextContent();if(s[e-1]!==" ")return!1;for(let{regExp:c,replace:i}of o){let l=s.match(c);if(l&&l[0].length===(l[0].endsWith(" ")?e:e-1)){let a=t.getNextSiblings(),[u,p]=t.splitText(e);u?.remove();let m=p?[p,...a]:a;if(i(r,m,l,!1)!==!1)return!0}}return!1}function In(r,t,e,o){let n=r.getParent();if(!Pt(n)||r.getFirstChild()!==t)return!1;let s=t.getTextContent();if(s[e-1]!==" ")return!1;for(let{regExpEnd:c,regExpStart:i,replace:l}of o){if(c&&!("optional"in c)||c&&"optional"in c&&!c.optional)continue;let a=s.match(i);if(a&&a[0].length===(a[0].endsWith(" ")?e:e-1)){let u=t.getNextSiblings(),[p,m]=t.splitText(e);p?.remove();let g=m?[m,...u]:u;if(l(r,g,a,null,null,!1)!==!1)return!0}}return!1}function Mn(r,t,e){let o=r.getTextContent(),n=o[t-1],s=e[n];if(s==null)return!1;t<o.length&&(o=o.slice(0,t));for(let c of s){if(!c.replace||!c.regExp)continue;let i=o.match(c.regExp);if(i===null)continue;let l=i.index||0,a=l+i[0].length,u;return l===0?[u]=r.splitText(a):[,u]=r.splitText(l,a),u&&(u.selectNext(0,0),c.replace(u,i)),!0}return!1}function An(r,t,e){let o=r.getTextContent(),n=t-1,s=o[n],c=e[s];if(!c)return!1;for(let i of c){let{tag:l}=i,a=l.length,u=n-a+1;if(a>1&&!Kt(o,u,l,0,a)||o[u-1]===" ")continue;let p=o[n+1];if(i.intraword===!1&&p&&!F.test(p))continue;let m=r,g=m,f=vt(o,u,l),d=g;for(;f<0&&(d=d.getPreviousSibling())&&!kn(d);)if(Ht(d)){let C=d.getTextContent();g=d,f=vt(C,C.length,l)}if(f<0||g===m&&f+a===u)continue;let h=g.getTextContent();if(f>0&&h[f-1]===s)continue;let x=h[f-1];if(i.intraword===!1&&x&&!F.test(x))continue;let E=m.getTextContent(),_=E.slice(0,u)+E.slice(n+1);m.setTextContent(_);let T=g===m?_:h;g.setTextContent(T.slice(0,f)+T.slice(f+a));let b=J(),w=On();Nn(w);let L=n-a*(g===m?2:1)+1;w.anchor.set(g.__key,f,"text"),w.focus.set(m.__key,L,"text");for(let C of i.format)w.hasFormat(C)||w.formatText(C);w.anchor.set(w.focus.key,w.focus.offset,w.focus.type);for(let C of i.format)w.hasFormat(C)&&w.toggleFormat(C);return Z(b)&&(w.format=b.format),!0}return!1}function vt(r,t,e){let o=e.length;for(let n=t;n>=o;n--){let s=n-o;if(Kt(r,s,e,0,o)&&r[s+o]!==" ")return s}return-1}function Kt(r,t,e,o,n){for(let s=0;s<n;s++)if(r[t+s]!==e[o+s])return!1;return!0}function Ir(r,t=U){let e=N(t),o=B(e.textFormat,({tag:c})=>c[c.length-1]),n=B(e.textMatch,({trigger:c})=>c);for(let c of t){let i=c.type;if(i==="element"||i==="text-match"||i==="multiline-element"){let l=c.dependencies;for(let a of l)if(!r.hasNode(a))throw new Error("MarkdownShortcuts: missing dependency %s for transformer. Ensure node dependency is included in editor initial config."+a.getType())}}let s=(c,i,l)=>{Fn(c,i,l,e.element)||In(c,i,l,e.multilineElement)||Mn(i,l,n)||An(i,l,o)};return r.registerUpdateListener(({dirtyLeaves:c,editorState:i,prevEditorState:l,tags:a})=>{if(a.has("collaboration")||a.has("historic")||r.isComposing())return;let u=i.read(J),p=l.read(J);if(!Z(p)||!Z(u)||!u.isCollapsed()||u.is(p))return;let m=u.anchor.key,g=u.anchor.offset,f=i._nodeMap.get(m);!Ht(f)||!c.has(m)||g!==1&&g>p.anchor.offset+1||r.update(()=>{if(f.hasFormat("code"))return;let d=f.getParent();d!==null&&s(d,f,u.anchor.offset)})})}import{$createListItemNode as Dn,$createListNode as Ln,$isListItemNode as $n,$isListNode as M,ListItemNode as et,ListNode as nt}from"@lexical/list";import{$createHeadingNode as Bn,$createQuoteNode as vn,$isHeadingNode as Pn,$isQuoteNode as Ut,HeadingNode as Hn,QuoteNode as Kn}from"@lexical/rich-text";import{$createLineBreakNode as Un}from"lexical";var Xt=/^[\t ]*$/,Yt=/^(\s*)(\d+)\.\s/,jt=/^(\s*)[-*+]\s/,Wt=/^(\s*)(?:-\s)?\s?(\[(\s|x)?\])\s/i,tt=/^(#{1,6})\s/,qt=/^>\s/,Xn=/^[ \t]*(\\`\\`\\`|```)(\w+)?/,Gt=/[ \t]*(\\`\\`\\`|```)$/,Gn=/^[ \t]*```[^`]+(?:(?:`{1,2}|`{4,})[^`]+)*```(?:[^`]|$)/,zn=/^\|(.+)\|\s?$/,Vn=/^(\| ?:?-*:? ?)+\|\s?$/,zt=/^[ \t]*<[a-z_][\w-]*(?:\s[^<>]*)?\/?>/i,Vt=/^[ \t]*<\/[a-z_][\w-]*\s*>/i,Yn=r=>(t,e,o)=>{let n=r(o);n.append(...e),t.replace(n),n.select(0,0)},Qt=4;function jn(r){let t=r.match(/\t/g),e=r.match(/ /g),o=0;return t&&(o+=t.length),e&&(o+=Math.floor(e.length/Qt)),o}var ot=r=>(t,e,o)=>{let n=t.getPreviousSibling(),s=t.getNextSibling(),c=Dn(r==="check"?o[3]==="x":void 0);if(M(s)&&s.getListType()===r){let l=s.getFirstChild();l!==null?l.insertBefore(c):s.append(c),t.remove()}else if(M(n)&&n.getListType()===r)n.append(c),t.remove();else{let l=Ln(r,r==="number"?Number(o[2]):void 0);l.append(c),t.replace(l)}c.append(...e),c.select(0,0);let i=jn(o[1]);i&&c.setIndent(i)},X=(r,t,e)=>{let o=[],n=r.getChildren(),s=0;for(let c of n)if($n(c)){if(c.getChildrenSize()===1){let u=c.getFirstChild();if(M(u)){o.push(X(u,t,e+1));continue}}let i=" ".repeat(e*Qt),l=r.getListType(),a=l==="number"?`${r.getStart()+s}. `:l==="check"?`- [${c.getChecked()?"x":" "}] `:"- ";o.push(i+a+t(c)),s++}return o.join(`
|
|
7
|
+
`)},Jt={type:"element",dependencies:[Hn],export:(r,t)=>{if(!Pn(r))return null;let e=Number(r.getTag().slice(1));return"#".repeat(e)+" "+t(r)},regExp:tt,replace:Yn(r=>{let t="h"+r[1].length;return Bn(t)})},Zt={type:"element",dependencies:[Kn],export:(r,t)=>{if(!Ut(r))return null;let e=t(r).split(`
|
|
8
|
+
`),o=[];for(let n of e)o.push("> "+n);return o.join(`
|
|
9
|
+
`)},regExp:qt,replace:(r,t,e,o)=>{if(o){let s=r.getPreviousSibling();if(Ut(s)){s.splice(s.getChildrenSize(),0,[Un(),...t]),s.select(0,0),r.remove();return}}let n=vn();n.append(...t),r.replace(n),n.select(0,0)}},te={type:"element",dependencies:[nt,et],export:(r,t)=>M(r)?X(r,t,0):null,regExp:jt,replace:ot("bullet")},Wn={type:"element",dependencies:[nt,et],export:(r,t)=>M(r)?X(r,t,0):null,regExp:Wt,replace:ot("check")},ee={type:"element",dependencies:[nt,et],export:(r,t)=>M(r)?X(r,t,0):null,regExp:Yt,replace:ot("number")},ne={type:"text-format",format:["code"],tag:"`"},oe={type:"text-format",format:["highlight"],tag:"=="},re={type:"text-format",format:["bold","italic"],tag:"***"},ie={type:"text-format",format:["bold","italic"],intraword:!1,tag:"___"},se={type:"text-format",format:["bold"],tag:"**"},ce={type:"text-format",format:["bold"],intraword:!1,tag:"__"},le={type:"text-format",format:["strikethrough"],tag:"~~"},ae={type:"text-format",format:["italic"],tag:"*"},fe={type:"text-format",format:["italic"],intraword:!1,tag:"_"};function ue(r,t){let e=r.split(`
|
|
10
|
+
`),o=!1,n=[],s=0;for(let c=0;c<e.length;c++){let i=e[c],l=n[n.length-1];if(Gn.test(i)){n.push(i);continue}if(Gt.test(i)){s===0&&(o=!0),s===1&&(o=!1),s>0&&s--,n.push(i);continue}if(Xn.test(i)){o=!0,s++,n.push(i);continue}if(o){n.push(i);continue}Xt.test(i)||Xt.test(l)||!l||tt.test(l)||tt.test(i)||qt.test(i)||Yt.test(i)||jt.test(i)||Wt.test(i)||zn.test(i)||Vn.test(i)||!t||zt.test(i)||Vt.test(i)||zt.test(l)||Vt.test(l)||Gt.test(l)?n.push(i):n[n.length-1]=l+" "+i.trim()}return n.join(`
|
|
11
|
+
`)}var qn=[Jt,Zt,te,ee],Qn=[],Jn=[ne,re,ie,se,ce,oe,ae,fe,le],Zn=[],U=[...qn,...Qn,...Jn,...Zn];function Hr(r,t=U,e,o=!1,n=!0){let s=o?r:ue(r,n);return Bt(t,o)(s,e)}function Kr(r=U,t,e=!1){return It(r,e)(t)}export{Ir as a,Hr as b,Kr as c,st as d,ro as e,fo as f,Re as g,z as h,lt as i,Oo as j,Ze as k,ko as l,Rt as m,Ao as n,Do as o,Lo as p};
|
|
12
|
+
//# sourceMappingURL=chunk-3KBZSLPR.js.map
|