@payloadcms/richtext-lexical 3.41.0-canary.1 → 3.41.0-canary.2

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.
@@ -1,4 +1,4 @@
1
- var st=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";var Q=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 ct(r){return r instanceof Q}import{c as Ne}from"react/compiler-runtime";import{jsx as Ie}from"react/jsx-runtime";import{useLexicalComposerContext as ye}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as Oe}from"@lexical/utils";import{$getSelection as V,$isRangeSelection as Z,$isTextNode as Ae,COMMAND_PRIORITY_LOW as be,createCommand as ke,getDOMSelection as Me}from"lexical";import{useEffect as xt,useState as Le}from"react";import*as q from"react";import{c as dt}from"react/compiler-runtime";import{useLexicalComposerContext as mt}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as at}from"@lexical/utils";import{$getSelection as gt,$isRangeSelection as ae,$setSelection as le,COMMAND_PRIORITY_LOW as k,createCommand as fe,KEY_ARROW_DOWN_COMMAND as ue,KEY_ARROW_UP_COMMAND as de,KEY_ENTER_COMMAND as me,KEY_ESCAPE_COMMAND as ge,KEY_TAB_COMMAND as pe}from"lexical";import{useCallback as j,useEffect as M,useLayoutEffect as he,useMemo as xe,useRef as Ee,useState as _e}from"react";var Te="slash-menu-popup",lt=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 Se(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 we(r){let t=gt();if(!ae(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,c=o.getTextContent().slice(0,n),s=r.replaceableString.length,i=Se(c,r.matchingString,s),a=n-i;if(a<0)return;let f;return a===0?[f]=o.splitText(n):[,f]=o.splitText(a,n),f}function Ce(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 c=r;c=c.parentElement;)if(e=getComputedStyle(c),!(o&&e.position==="static")&&n.test(e.overflow+e.overflowY+e.overflowX))return c;return document.body}function ft(r,t){let e=r.getBoundingClientRect(),o=t.getBoundingClientRect();return e.top>o.top&&e.top<o.bottom}function Re(r,t,e,o){let n=dt(12),[c]=mt(),s;n[0]!==c||n[1]!==e||n[2]!==o||n[3]!==r||n[4]!==t.current?(s=()=>{let a=t.current;if(a!=null&&r!=null){let f=c.getRootElement(),l=f!=null?Ce(f,!1):document.body,m;m=!1;let g;g=ft(a,l);let p=function(){m||(window.requestAnimationFrame(function(){e(),m=!1}),m=!0);let u=ft(a,l);u!==g&&(g=u,o?.(u))},d=new ResizeObserver(e);return window.addEventListener("resize",e),document.addEventListener("scroll",p,{capture:!0,passive:!0}),d.observe(a),()=>{d.disconnect(),window.removeEventListener("resize",e),document.removeEventListener("scroll",p,!0)}}},n[0]=c,n[1]=e,n[2]=o,n[3]=r,n[4]=t.current,n[5]=s):s=n[5];let i;n[6]!==c||n[7]!==e||n[8]!==o||n[9]!==r||n[10]!==t?(i=[c,o,e,r,t],n[6]=c,n[7]=e,n[8]=o,n[9]=r,n[10]=t,n[11]=i):i=n[11],M(s,i)}var ut=fe("SCROLL_TYPEAHEAD_OPTION_INTO_VIEW_COMMAND");function pt({anchorElementRef:r,close:t,editor:e,groups:o,menuRenderFn:n,resolution:c,shouldSplitNodeWithQuery:s=!1}){let[i,a]=_e(null),f=c.match&&c.match.matchingString||"",l=j(d=>{let u=e.getRootElement();u!==null&&(u.setAttribute("aria-activedescendant",`${Te}__item-${d.key}`),a(d.key))},[e]),m=j(()=>{if(o!==null&&f!=null){let d=o.flatMap(u=>u.items);if(d.length){let u=d[0];l(u)}}},[o,l,f]);M(()=>{m()},[f,m]);let g=j(d=>{t(),e.update(()=>{let u=c.match!=null&&s?we(c.match):null;u&&u.remove()}),setTimeout(()=>{let u;e.read(()=>{u=gt()?.clone()}),e.update(()=>{u&&le(u)}),d.onSelect({editor:e,queryString:c.match?c.match.matchingString:""})},0)},[e,s,c.match,t]);M(()=>()=>{let d=e.getRootElement();d!==null&&d.removeAttribute("aria-activedescendant")},[e]),he(()=>{o===null?a(null):i===null&&m()},[o,i,l,m]),M(()=>at(e.registerCommand(ut,({item:d})=>d.ref&&d.ref.current!=null?(lt(d.ref.current),!0):!1,k)),[e,l]),M(()=>at(e.registerCommand(ue,d=>{let u=d;if(o!==null&&o.length&&i!==null){let x=o.flatMap(T=>T.items),h=x.findIndex(T=>T.key===i),E=h!==x.length-1?h+1:0,_=x[E];if(!_)return!1;l(_),_.ref!=null&&_.ref.current&&e.dispatchCommand(ut,{index:E,item:_}),u.preventDefault(),u.stopImmediatePropagation()}return!0},k),e.registerCommand(de,d=>{let u=d;if(o!==null&&o.length&&i!==null){let x=o.flatMap(T=>T.items),h=x.findIndex(T=>T.key===i),E=h!==0?h-1:x.length-1,_=x[E];if(!_)return!1;l(_),_.ref!=null&&_.ref.current&&lt(_.ref.current),u.preventDefault(),u.stopImmediatePropagation()}return!0},k),e.registerCommand(ge,d=>{let u=d;return u.preventDefault(),u.stopImmediatePropagation(),t(),!0},k),e.registerCommand(pe,d=>{let u=d;if(o===null||i===null)return!1;let h=o.flatMap(E=>E.items).find(E=>E.key===i);return h?(u.preventDefault(),u.stopImmediatePropagation(),g(h),!0):!1},k),e.registerCommand(me,d=>{if(o===null||i===null)return!1;let x=o.flatMap(h=>h.items).find(h=>h.key===i);return x?(d!==null&&(d.preventDefault(),d.stopImmediatePropagation()),g(x),!0):!1},k)),[g,t,e,o,i,l]);let p=xe(()=>({groups:o,selectedItemKey:i,selectItemAndCleanUp:g,setSelectedItemKey:a}),[g,i,o]);return n(r,p,c.match?c.match.matchingString:"")}function Fe(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 ht(r,t,e,o){let n=dt(14),[c]=mt(),s;n[0]===Symbol.for("react.memo_cache_sentinel")?(s=st?document.createElement("div"):null,n[0]=s):s=n[0];let i=Ee(s),a;n[1]!==r||n[2]!==o||n[3]!==c||n[4]!==t?(a=()=>{if(i.current===null||parent===void 0)return;let d=c.getRootElement(),u=i.current,x=u.firstChild;if(d!==null&&t!==null){let{height:h,width:E}=t.getRect(),{left:_,top:T}=t.getRect(),N=T;if(T=T-(r.getBoundingClientRect().top+window.scrollY),_=_-(r.getBoundingClientRect().left+window.scrollX),u.style.left=`${_+window.scrollX}px`,u.style.height=`${h}px`,u.style.width=`${E}px`,x!==null){let S=x.getBoundingClientRect(),F=S.height,w=S.width,I=d.getBoundingClientRect();_+w>I.right&&(u.style.left=`${I.right-w+window.scrollX}px`);let y=N+F+32>window.innerHeight,A=N<0;y&&!A?u.style.top=`${T+32-F+window.scrollY-(h+24)}px`:u.style.top=`${T+window.scrollY+32}px`}u.isConnected||(Fe(u,o),r.append(u)),u.setAttribute("id","slash-menu"),i.current=u,d.setAttribute("aria-controls","slash-menu")}},n[1]=r,n[2]=o,n[3]=c,n[4]=t,n[5]=a):a=n[5];let f=a,l,m;n[6]!==c||n[7]!==f||n[8]!==t?(l=()=>{let d=c.getRootElement();if(t!==null)return f(),()=>{d!==null&&d.removeAttribute("aria-controls");let u=i.current;u!==null&&u.isConnected&&(u.remove(),u.removeAttribute("id"))}},m=[c,f,t],n[6]=c,n[7]=f,n[8]=t,n[9]=l,n[10]=m):(l=n[9],m=n[10]),M(l,m);let g;return n[11]!==t||n[12]!==e?(g=d=>{t!==null&&(d||e(null))},n[11]=t,n[12]=e,n[13]=g):g=n[13],Re(t,i,f,g),i}var eo=`\\.,\\+\\*\\?\\$\\@\\|#{}\\(\\)\\^\\-\\[\\]\\\\/!%'"~=<>_:;`;function $e(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 Et(r,t,e){let o=Me(e);if(o===null||!o.isCollapsed)return!1;let n=o.anchorNode,c=r,s=o.anchorOffset;if(n==null||s==null)return!1;try{t.setStart(n,c),t.setEnd(n,s>1?s:1)}catch{return!1}return!0}function De(r){let t;return r.getEditorState().read(()=>{let e=V();Z(e)&&(t=$e(e))}),t}function _t(r,t){return t!==0?!1:r.getEditorState().read(()=>{let e=V();if(Z(e)){let c=e.anchor.getNode().getPreviousSibling();return Ae(c)&&c.isTextEntity()}return!1})}function Tt(r){q.startTransition?q.startTransition(r):r()}var Be=ke("ENABLE_SLASH_MENU_COMMAND");function no(r){let t=Ne(30),{anchorClassName:e,anchorElem:o,groups:n,menuRenderFn:c,onClose:s,onOpen:i,onQueryChange:a,triggerFn:f}=r,[l]=ye(),[m,g]=Le(null),p=ht(o,m,g,e),d;t[0]!==s||t[1]!==m?(d=()=>{g(null),s!=null&&m!==null&&s()},t[0]=s,t[1]=m,t[2]=d):d=t[2];let u=d,x;t[3]!==i||t[4]!==m?(x=F=>{g(F),i!=null&&m===null&&i(F)},t[3]=i,t[4]=m,t[5]=x):x=t[5];let h=x,E,_;t[6]!==l||t[7]!==h?(E=()=>Oe(l.registerCommand(Be,F=>{let{node:w}=F;return l.getEditorState().read(()=>{let I={leadOffset:0,matchingString:"",replaceableString:""};if(!_t(l,I.leadOffset)&&w!==null){let y=l._window??window,A=y.document.createRange();Et(I.leadOffset,A,y)!==null&&Tt(()=>h({getRect:()=>A.getBoundingClientRect(),match:I}));return}}),!0},be)),_=[l,h],t[6]=l,t[7]=h,t[8]=E,t[9]=_):(E=t[8],_=t[9]),xt(E,_);let T;t[10]!==u||t[11]!==l||t[12]!==a||t[13]!==h||t[14]!==f?(T=()=>{let F=()=>{l.getEditorState().read(()=>{let I=l._window??window,y=I.document.createRange(),A=V(),W=De(l);if(!Z(A)||!A.isCollapsed()||W===void 0||y===null){u();return}let b=f({editor:l,query:W});if(a(b?b.matchingString:null),b!==null&&!_t(l,b.leadOffset)&&Et(b.leadOffset,y,I)!==null){Tt(()=>h({getRect:()=>y.getBoundingClientRect(),match:b}));return}u()})},w=l.registerUpdateListener(F);return()=>{w()}},t[10]=u,t[11]=l,t[12]=a,t[13]=h,t[14]=f,t[15]=T):T=t[15];let N;t[16]!==u||t[17]!==l||t[18]!==a||t[19]!==h||t[20]!==m||t[21]!==f?(N=[l,f,a,m,u,h],t[16]=u,t[17]=l,t[18]=a,t[19]=h,t[20]=m,t[21]=f,t[22]=N):N=t[22],xt(T,N);let S;return t[23]!==p||t[24]!==u||t[25]!==l||t[26]!==n||t[27]!==c||t[28]!==m?(S=p.current===null||m===null||l===null?null:Ie(pt,{anchorElementRef:p,close:u,editor:l,groups:n,menuRenderFn:c,resolution:m,shouldSplitNodeWithQuery:!0}),t[23]=p,t[24]=u,t[25]=l,t[26]=n,t[27]=c,t[28]=m,t[29]=S):S=t[29],S}var St=class r{_bottom;_left;_right;_top;constructor(t,e,o,n){let[c,s]=e<=n?[e,n]:[n,e],[i,a]=t<=o?[t,o]:[o,t];this._top=c,this._right=a,this._left=i,this._bottom=s}static fromDOM(t){let{height:e,left:o,top:n,width:c}=t.getBoundingClientRect();return r.fromLWTH(o,c,n,e)}static fromDOMRect(t){let{height:e,left:o,top:n,width:c}=t;return r.fromLWTH(o,c,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:c,y:s}=e;return r.fromLTRB(o,n,c,s)}contains(t){if(ct(t)){let{x:s,y:i}=t,a=i<this._top,f=i>this._bottom,l=s<this._left,m=s>this._right;return{reason:{isOnBottomSide:f,isOnLeftSide:l,isOnRightSide:m,isOnTopSide:a},result:!a&&!f&&!l&&!m}}let{bottom:e,left:o,right:n,top:c}=t;return c>=this._top&&c<=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:c}=t,{height:s,left:i,top:a,width:f}=this,l=o+c>=i+f?o+c:i+f,m=n+e>=a+s?n+e:a+s,g=o<=i?o:i,p=n<=a?n:a;return l-g<=c+f&&m-p<=e+s}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)}};function so({editorConfig:r}){return Pe({nodes:r.features.nodes})}function Pe({nodes:r}){return r.map(t=>"node"in t?t.node:t)}import{$getRoot as We,$isDecoratorNode as Nt,$isElementNode as U,$isLineBreakNode as Qe,$isTextNode as G}from"lexical";import{$isListItemNode as ve,$isListNode as wt}from"@lexical/list";import{$isHeadingNode as He,$isQuoteNode as Ke}from"@lexical/rich-text";import{$isParagraphNode as Ue,$isTextNode as Ge}from"lexical";var C={markdownFormatKind:null,regEx:/(?:)/,regExForAutoFormatting:/(?:)/,requiresParagraphStart:!1},R={...C,requiresParagraphStart:!0},uo={...R,export:L(1),markdownFormatKind:"paragraphH1",regEx:/^# /,regExForAutoFormatting:/^# /},mo={...R,export:L(2),markdownFormatKind:"paragraphH2",regEx:/^## /,regExForAutoFormatting:/^## /},go={...R,export:L(3),markdownFormatKind:"paragraphH3",regEx:/^### /,regExForAutoFormatting:/^### /},po={...R,export:L(4),markdownFormatKind:"paragraphH4",regEx:/^#### /,regExForAutoFormatting:/^#### /},ho={...R,export:L(5),markdownFormatKind:"paragraphH5",regEx:/^##### /,regExForAutoFormatting:/^##### /},xo={...R,export:L(6),markdownFormatKind:"paragraphH6",regEx:/^###### /,regExForAutoFormatting:/^###### /},Eo={...R,export:ze,markdownFormatKind:"paragraphBlockQuote",regEx:/^> /,regExForAutoFormatting:/^> /},_o={...R,export:J,markdownFormatKind:"paragraphUnorderedList",regEx:/^(\s{0,10})- /,regExForAutoFormatting:/^(\s{0,10})- /},To={...R,export:J,markdownFormatKind:"paragraphUnorderedList",regEx:/^(\s{0,10})\* /,regExForAutoFormatting:/^(\s{0,10})\* /},So={...R,export:J,markdownFormatKind:"paragraphOrderedList",regEx:/^(\s{0,10})(\d+)\.\s/,regExForAutoFormatting:/^(\s{0,10})(\d+)\.\s/},wo={...R,markdownFormatKind:"horizontalRule",regEx:/^\*\*\*$/,regExForAutoFormatting:/^\*\*\* /},Co={...R,markdownFormatKind:"horizontalRule",regEx:/^---$/,regExForAutoFormatting:/^--- /},Ro={...C,exportFormat:"code",exportTag:"`",markdownFormatKind:"code",regEx:/(`)(\s*)([^`]*)(\s*)(`)()/,regExForAutoFormatting:/(`)(\s*\b)([^`]*)(\b\s*)(`)(\s)$/},Fo={...C,exportFormat:"bold",exportTag:"**",markdownFormatKind:"bold",regEx:/(\*\*)(\s*)([^*]*)(\s*)(\*\*)()/,regExForAutoFormatting:/(\*\*)(\s*\b)([^*]*)(\b\s*)(\*\*)(\s)$/},No={...C,exportFormat:"italic",exportTag:"*",markdownFormatKind:"italic",regEx:/(\*)(\s*)([^*]*)(\s*)(\*)()/,regExForAutoFormatting:/(\*)(\s*\b)([^*]*)(\b\s*)(\*)(\s)$/},Io={...C,exportFormat:"bold",exportTag:"_",markdownFormatKind:"bold",regEx:/(__)(\s*)([^_]*)(\s*)(__)()/,regExForAutoFormatting:/(__)(\s*)([^_]*)(\s*)(__)(\s)$/},yo={...C,exportFormat:"italic",exportTag:"_",markdownFormatKind:"italic",regEx:/(_)()([^_]*)()(_)()/,regExForAutoFormatting:/(_)()([^_]*)()(_)(\s)$/},Oo={...C,exportFormat:"underline",exportTag:"<u>",exportTagClose:"</u>",markdownFormatKind:"underline",regEx:/(<u>)(\s*)([^<]*)(\s*)(<\/u>)()/,regExForAutoFormatting:/(<u>)(\s*\b)([^<]*)(\b\s*)(<\/u>)(\s)$/},Ao={...C,exportFormat:"strikethrough",exportTag:"~~",markdownFormatKind:"strikethrough",regEx:/(~~)(\s*)([^~]*)(\s*)(~~)()/,regExForAutoFormatting:/(~~)(\s*\b)([^~]*)(\b\s*)(~~)(\s)$/},bo={...C,markdownFormatKind:"strikethrough_italic_bold",regEx:/(~~_\*\*)(\s*\b)([^*_~]+)(\b\s*)(\*\*_~~)()/,regExForAutoFormatting:/(~~_\*\*)(\s*\b)([^*_~]+)(\b\s*)(\*\*_~~)(\s)$/},ko={...C,markdownFormatKind:"italic_bold",regEx:/(_\*\*)(\s*\b)([^*_]+)(\b\s*)(\*\*_)/,regExForAutoFormatting:/(_\*\*)(\s*\b)([^*_]+)(\b\s*)(\*\*_)(\s)$/},Mo={...C,markdownFormatKind:"strikethrough_italic",regEx:/(~~_)(\s*)([^_~]+)(\s*)(_~~)/,regExForAutoFormatting:/(~~_)(\s*)([^_~]+)(\s*)(_~~)(\s)$/},Lo={...C,markdownFormatKind:"strikethrough_bold",regEx:/(~~\*\*)(\s*\b)([^*~]+)(\b\s*)(\*\*~~)/,regExForAutoFormatting:/(~~\*\*)(\s*\b)([^*~]+)(\b\s*)(\*\*~~)(\s)$/},$o={...C,markdownFormatKind:"link",regEx:/(\[)([^\]]*)(\]\()([^)]*)(\)*)()/,regExForAutoFormatting:/(\[)([^\]]*)(\]\()([^)]*)(\)*)(\s)$/};function L(r){return(t,e)=>He(t)&&t.getTag()==="h"+r?"#".repeat(r)+" "+e(t):null}function J(r,t){return wt(r)?Ct(r,t,0):null}var Xe=4;function Ct(r,t,e){let o=[],n=r.getChildren(),c=0;for(let s of n)if(ve(s)){if(s.getChildrenSize()===1){let f=s.getFirstChild();if(wt(f)){o.push(Ct(f,t,e+1));continue}}let i=" ".repeat(e*Xe),a=r.getListType()==="bullet"?"- ":`${r.getStart()+c}. `;o.push(i+a+t(s)),c++}return o.join(`
1
+ var st=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";var Q=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 ct(r){return r instanceof Q}import{c as Ne}from"react/compiler-runtime";import{jsx as Ie}from"react/jsx-runtime";import{useLexicalComposerContext as ye}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as Oe}from"@lexical/utils";import{$getSelection as V,$isRangeSelection as Z,$isTextNode as Ae,COMMAND_PRIORITY_LOW as be,createCommand as ke,getDOMSelection as Me}from"lexical";import{useEffect as xt,useState as Le}from"react";import*as q from"react";import{c as dt}from"react/compiler-runtime";import{useLexicalComposerContext as mt}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as at}from"@lexical/utils";import{$getSelection as gt,$isRangeSelection as ae,$setSelection as le,COMMAND_PRIORITY_LOW as k,createCommand as fe,KEY_ARROW_DOWN_COMMAND as ue,KEY_ARROW_UP_COMMAND as de,KEY_ENTER_COMMAND as me,KEY_ESCAPE_COMMAND as ge,KEY_TAB_COMMAND as pe}from"lexical";import{useCallback as j,useEffect as M,useLayoutEffect as he,useMemo as xe,useRef as Ee,useState as _e}from"react";var Te="slash-menu-popup",lt=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 Se(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 we(r){let t=gt();if(!ae(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,c=o.getTextContent().slice(0,n),s=r.replaceableString.length,i=Se(c,r.matchingString,s),a=n-i;if(a<0)return;let f;return a===0?[f]=o.splitText(n):[,f]=o.splitText(a,n),f}function Ce(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 c=r;c=c.parentElement;)if(e=getComputedStyle(c),!(o&&e.position==="static")&&n.test(e.overflow+e.overflowY+e.overflowX))return c;return document.body}function ft(r,t){let e=r.getBoundingClientRect(),o=t.getBoundingClientRect();return e.top>o.top&&e.top<o.bottom}function Re(r,t,e,o){let n=dt(12),[c]=mt(),s;n[0]!==c||n[1]!==e||n[2]!==o||n[3]!==r||n[4]!==t.current?(s=()=>{let a=t.current;if(a!=null&&r!=null){let f=c.getRootElement(),l=f!=null?Ce(f,!1):document.body,m=!1,g=ft(a,l),p=function(){m||(window.requestAnimationFrame(function(){e(),m=!1}),m=!0);let u=ft(a,l);u!==g&&(g=u,o?.(u))},d=new ResizeObserver(e);return window.addEventListener("resize",e),document.addEventListener("scroll",p,{capture:!0,passive:!0}),d.observe(a),()=>{d.disconnect(),window.removeEventListener("resize",e),document.removeEventListener("scroll",p,!0)}}},n[0]=c,n[1]=e,n[2]=o,n[3]=r,n[4]=t.current,n[5]=s):s=n[5];let i;n[6]!==c||n[7]!==e||n[8]!==o||n[9]!==r||n[10]!==t?(i=[c,o,e,r,t],n[6]=c,n[7]=e,n[8]=o,n[9]=r,n[10]=t,n[11]=i):i=n[11],M(s,i)}var ut=fe("SCROLL_TYPEAHEAD_OPTION_INTO_VIEW_COMMAND");function pt({anchorElementRef:r,close:t,editor:e,groups:o,menuRenderFn:n,resolution:c,shouldSplitNodeWithQuery:s=!1}){let[i,a]=_e(null),f=c.match&&c.match.matchingString||"",l=j(d=>{let u=e.getRootElement();u!==null&&(u.setAttribute("aria-activedescendant",`${Te}__item-${d.key}`),a(d.key))},[e]),m=j(()=>{if(o!==null&&f!=null){let d=o.flatMap(u=>u.items);if(d.length){let u=d[0];l(u)}}},[o,l,f]);M(()=>{m()},[f,m]);let g=j(d=>{t(),e.update(()=>{let u=c.match!=null&&s?we(c.match):null;u&&u.remove()}),setTimeout(()=>{let u;e.read(()=>{u=gt()?.clone()}),e.update(()=>{u&&le(u)}),d.onSelect({editor:e,queryString:c.match?c.match.matchingString:""})},0)},[e,s,c.match,t]);M(()=>()=>{let d=e.getRootElement();d!==null&&d.removeAttribute("aria-activedescendant")},[e]),he(()=>{o===null?a(null):i===null&&m()},[o,i,l,m]),M(()=>at(e.registerCommand(ut,({item:d})=>d.ref&&d.ref.current!=null?(lt(d.ref.current),!0):!1,k)),[e,l]),M(()=>at(e.registerCommand(ue,d=>{let u=d;if(o!==null&&o.length&&i!==null){let x=o.flatMap(T=>T.items),h=x.findIndex(T=>T.key===i),E=h!==x.length-1?h+1:0,_=x[E];if(!_)return!1;l(_),_.ref!=null&&_.ref.current&&e.dispatchCommand(ut,{index:E,item:_}),u.preventDefault(),u.stopImmediatePropagation()}return!0},k),e.registerCommand(de,d=>{let u=d;if(o!==null&&o.length&&i!==null){let x=o.flatMap(T=>T.items),h=x.findIndex(T=>T.key===i),E=h!==0?h-1:x.length-1,_=x[E];if(!_)return!1;l(_),_.ref!=null&&_.ref.current&&lt(_.ref.current),u.preventDefault(),u.stopImmediatePropagation()}return!0},k),e.registerCommand(ge,d=>{let u=d;return u.preventDefault(),u.stopImmediatePropagation(),t(),!0},k),e.registerCommand(pe,d=>{let u=d;if(o===null||i===null)return!1;let h=o.flatMap(E=>E.items).find(E=>E.key===i);return h?(u.preventDefault(),u.stopImmediatePropagation(),g(h),!0):!1},k),e.registerCommand(me,d=>{if(o===null||i===null)return!1;let x=o.flatMap(h=>h.items).find(h=>h.key===i);return x?(d!==null&&(d.preventDefault(),d.stopImmediatePropagation()),g(x),!0):!1},k)),[g,t,e,o,i,l]);let p=xe(()=>({groups:o,selectedItemKey:i,selectItemAndCleanUp:g,setSelectedItemKey:a}),[g,i,o]);return n(r,p,c.match?c.match.matchingString:"")}function Fe(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 ht(r,t,e,o){let n=dt(14),[c]=mt(),s;n[0]===Symbol.for("react.memo_cache_sentinel")?(s=st?document.createElement("div"):null,n[0]=s):s=n[0];let i=Ee(s),a;n[1]!==r||n[2]!==o||n[3]!==c||n[4]!==t?(a=()=>{if(i.current===null||parent===void 0)return;let d=c.getRootElement(),u=i.current,x=u.firstChild;if(d!==null&&t!==null){let{height:h,width:E}=t.getRect(),{left:_,top:T}=t.getRect(),N=T;if(T=T-(r.getBoundingClientRect().top+window.scrollY),_=_-(r.getBoundingClientRect().left+window.scrollX),u.style.left=`${_+window.scrollX}px`,u.style.height=`${h}px`,u.style.width=`${E}px`,x!==null){let S=x.getBoundingClientRect(),F=S.height,w=S.width,I=d.getBoundingClientRect();_+w>I.right&&(u.style.left=`${I.right-w+window.scrollX}px`);let y=N+F+32>window.innerHeight,A=N<0;y&&!A?u.style.top=`${T+32-F+window.scrollY-(h+24)}px`:u.style.top=`${T+window.scrollY+32}px`}u.isConnected||(Fe(u,o),r.append(u)),u.setAttribute("id","slash-menu"),i.current=u,d.setAttribute("aria-controls","slash-menu")}},n[1]=r,n[2]=o,n[3]=c,n[4]=t,n[5]=a):a=n[5];let f=a,l,m;n[6]!==c||n[7]!==f||n[8]!==t?(l=()=>{let d=c.getRootElement();if(t!==null)return f(),()=>{d!==null&&d.removeAttribute("aria-controls");let u=i.current;u!==null&&u.isConnected&&(u.remove(),u.removeAttribute("id"))}},m=[c,f,t],n[6]=c,n[7]=f,n[8]=t,n[9]=l,n[10]=m):(l=n[9],m=n[10]),M(l,m);let g;return n[11]!==t||n[12]!==e?(g=d=>{t!==null&&(d||e(null))},n[11]=t,n[12]=e,n[13]=g):g=n[13],Re(t,i,f,g),i}var eo=`\\.,\\+\\*\\?\\$\\@\\|#{}\\(\\)\\^\\-\\[\\]\\\\/!%'"~=<>_:;`;function $e(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 Et(r,t,e){let o=Me(e);if(o===null||!o.isCollapsed)return!1;let n=o.anchorNode,c=r,s=o.anchorOffset;if(n==null||s==null)return!1;try{t.setStart(n,c),t.setEnd(n,s>1?s:1)}catch{return!1}return!0}function De(r){let t;return r.getEditorState().read(()=>{let e=V();Z(e)&&(t=$e(e))}),t}function _t(r,t){return t!==0?!1:r.getEditorState().read(()=>{let e=V();if(Z(e)){let c=e.anchor.getNode().getPreviousSibling();return Ae(c)&&c.isTextEntity()}return!1})}function Tt(r){q.startTransition?q.startTransition(r):r()}var Be=ke("ENABLE_SLASH_MENU_COMMAND");function no(r){let t=Ne(30),{anchorClassName:e,anchorElem:o,groups:n,menuRenderFn:c,onClose:s,onOpen:i,onQueryChange:a,triggerFn:f}=r,[l]=ye(),[m,g]=Le(null),p=ht(o,m,g,e),d;t[0]!==s||t[1]!==m?(d=()=>{g(null),s!=null&&m!==null&&s()},t[0]=s,t[1]=m,t[2]=d):d=t[2];let u=d,x;t[3]!==i||t[4]!==m?(x=F=>{g(F),i!=null&&m===null&&i(F)},t[3]=i,t[4]=m,t[5]=x):x=t[5];let h=x,E,_;t[6]!==l||t[7]!==h?(E=()=>Oe(l.registerCommand(Be,F=>{let{node:w}=F;return l.getEditorState().read(()=>{let I={leadOffset:0,matchingString:"",replaceableString:""};if(!_t(l,I.leadOffset)&&w!==null){let y=l._window??window,A=y.document.createRange();Et(I.leadOffset,A,y)!==null&&Tt(()=>h({getRect:()=>A.getBoundingClientRect(),match:I}));return}}),!0},be)),_=[l,h],t[6]=l,t[7]=h,t[8]=E,t[9]=_):(E=t[8],_=t[9]),xt(E,_);let T;t[10]!==u||t[11]!==l||t[12]!==a||t[13]!==h||t[14]!==f?(T=()=>{let F=()=>{l.getEditorState().read(()=>{let I=l._window??window,y=I.document.createRange(),A=V(),W=De(l);if(!Z(A)||!A.isCollapsed()||W===void 0||y===null){u();return}let b=f({editor:l,query:W});if(a(b?b.matchingString:null),b!==null&&!_t(l,b.leadOffset)&&Et(b.leadOffset,y,I)!==null){Tt(()=>h({getRect:()=>y.getBoundingClientRect(),match:b}));return}u()})},w=l.registerUpdateListener(F);return()=>{w()}},t[10]=u,t[11]=l,t[12]=a,t[13]=h,t[14]=f,t[15]=T):T=t[15];let N;t[16]!==u||t[17]!==l||t[18]!==a||t[19]!==h||t[20]!==m||t[21]!==f?(N=[l,f,a,m,u,h],t[16]=u,t[17]=l,t[18]=a,t[19]=h,t[20]=m,t[21]=f,t[22]=N):N=t[22],xt(T,N);let S;return t[23]!==p||t[24]!==u||t[25]!==l||t[26]!==n||t[27]!==c||t[28]!==m?(S=p.current===null||m===null||l===null?null:Ie(pt,{anchorElementRef:p,close:u,editor:l,groups:n,menuRenderFn:c,resolution:m,shouldSplitNodeWithQuery:!0}),t[23]=p,t[24]=u,t[25]=l,t[26]=n,t[27]=c,t[28]=m,t[29]=S):S=t[29],S}var St=class r{_bottom;_left;_right;_top;constructor(t,e,o,n){let[c,s]=e<=n?[e,n]:[n,e],[i,a]=t<=o?[t,o]:[o,t];this._top=c,this._right=a,this._left=i,this._bottom=s}static fromDOM(t){let{height:e,left:o,top:n,width:c}=t.getBoundingClientRect();return r.fromLWTH(o,c,n,e)}static fromDOMRect(t){let{height:e,left:o,top:n,width:c}=t;return r.fromLWTH(o,c,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:c,y:s}=e;return r.fromLTRB(o,n,c,s)}contains(t){if(ct(t)){let{x:s,y:i}=t,a=i<this._top,f=i>this._bottom,l=s<this._left,m=s>this._right;return{reason:{isOnBottomSide:f,isOnLeftSide:l,isOnRightSide:m,isOnTopSide:a},result:!a&&!f&&!l&&!m}}let{bottom:e,left:o,right:n,top:c}=t;return c>=this._top&&c<=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:c}=t,{height:s,left:i,top:a,width:f}=this,l=o+c>=i+f?o+c:i+f,m=n+e>=a+s?n+e:a+s,g=o<=i?o:i,p=n<=a?n:a;return l-g<=c+f&&m-p<=e+s}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)}};function so({editorConfig:r}){return Pe({nodes:r.features.nodes})}function Pe({nodes:r}){return r.map(t=>"node"in t?t.node:t)}import{$getRoot as We,$isDecoratorNode as Nt,$isElementNode as U,$isLineBreakNode as Qe,$isTextNode as G}from"lexical";import{$isListItemNode as ve,$isListNode as wt}from"@lexical/list";import{$isHeadingNode as He,$isQuoteNode as Ke}from"@lexical/rich-text";import{$isParagraphNode as Ue,$isTextNode as Ge}from"lexical";var C={markdownFormatKind:null,regEx:/(?:)/,regExForAutoFormatting:/(?:)/,requiresParagraphStart:!1},R={...C,requiresParagraphStart:!0},uo={...R,export:L(1),markdownFormatKind:"paragraphH1",regEx:/^# /,regExForAutoFormatting:/^# /},mo={...R,export:L(2),markdownFormatKind:"paragraphH2",regEx:/^## /,regExForAutoFormatting:/^## /},go={...R,export:L(3),markdownFormatKind:"paragraphH3",regEx:/^### /,regExForAutoFormatting:/^### /},po={...R,export:L(4),markdownFormatKind:"paragraphH4",regEx:/^#### /,regExForAutoFormatting:/^#### /},ho={...R,export:L(5),markdownFormatKind:"paragraphH5",regEx:/^##### /,regExForAutoFormatting:/^##### /},xo={...R,export:L(6),markdownFormatKind:"paragraphH6",regEx:/^###### /,regExForAutoFormatting:/^###### /},Eo={...R,export:ze,markdownFormatKind:"paragraphBlockQuote",regEx:/^> /,regExForAutoFormatting:/^> /},_o={...R,export:J,markdownFormatKind:"paragraphUnorderedList",regEx:/^(\s{0,10})- /,regExForAutoFormatting:/^(\s{0,10})- /},To={...R,export:J,markdownFormatKind:"paragraphUnorderedList",regEx:/^(\s{0,10})\* /,regExForAutoFormatting:/^(\s{0,10})\* /},So={...R,export:J,markdownFormatKind:"paragraphOrderedList",regEx:/^(\s{0,10})(\d+)\.\s/,regExForAutoFormatting:/^(\s{0,10})(\d+)\.\s/},wo={...R,markdownFormatKind:"horizontalRule",regEx:/^\*\*\*$/,regExForAutoFormatting:/^\*\*\* /},Co={...R,markdownFormatKind:"horizontalRule",regEx:/^---$/,regExForAutoFormatting:/^--- /},Ro={...C,exportFormat:"code",exportTag:"`",markdownFormatKind:"code",regEx:/(`)(\s*)([^`]*)(\s*)(`)()/,regExForAutoFormatting:/(`)(\s*\b)([^`]*)(\b\s*)(`)(\s)$/},Fo={...C,exportFormat:"bold",exportTag:"**",markdownFormatKind:"bold",regEx:/(\*\*)(\s*)([^*]*)(\s*)(\*\*)()/,regExForAutoFormatting:/(\*\*)(\s*\b)([^*]*)(\b\s*)(\*\*)(\s)$/},No={...C,exportFormat:"italic",exportTag:"*",markdownFormatKind:"italic",regEx:/(\*)(\s*)([^*]*)(\s*)(\*)()/,regExForAutoFormatting:/(\*)(\s*\b)([^*]*)(\b\s*)(\*)(\s)$/},Io={...C,exportFormat:"bold",exportTag:"_",markdownFormatKind:"bold",regEx:/(__)(\s*)([^_]*)(\s*)(__)()/,regExForAutoFormatting:/(__)(\s*)([^_]*)(\s*)(__)(\s)$/},yo={...C,exportFormat:"italic",exportTag:"_",markdownFormatKind:"italic",regEx:/(_)()([^_]*)()(_)()/,regExForAutoFormatting:/(_)()([^_]*)()(_)(\s)$/},Oo={...C,exportFormat:"underline",exportTag:"<u>",exportTagClose:"</u>",markdownFormatKind:"underline",regEx:/(<u>)(\s*)([^<]*)(\s*)(<\/u>)()/,regExForAutoFormatting:/(<u>)(\s*\b)([^<]*)(\b\s*)(<\/u>)(\s)$/},Ao={...C,exportFormat:"strikethrough",exportTag:"~~",markdownFormatKind:"strikethrough",regEx:/(~~)(\s*)([^~]*)(\s*)(~~)()/,regExForAutoFormatting:/(~~)(\s*\b)([^~]*)(\b\s*)(~~)(\s)$/},bo={...C,markdownFormatKind:"strikethrough_italic_bold",regEx:/(~~_\*\*)(\s*\b)([^*_~]+)(\b\s*)(\*\*_~~)()/,regExForAutoFormatting:/(~~_\*\*)(\s*\b)([^*_~]+)(\b\s*)(\*\*_~~)(\s)$/},ko={...C,markdownFormatKind:"italic_bold",regEx:/(_\*\*)(\s*\b)([^*_]+)(\b\s*)(\*\*_)/,regExForAutoFormatting:/(_\*\*)(\s*\b)([^*_]+)(\b\s*)(\*\*_)(\s)$/},Mo={...C,markdownFormatKind:"strikethrough_italic",regEx:/(~~_)(\s*)([^_~]+)(\s*)(_~~)/,regExForAutoFormatting:/(~~_)(\s*)([^_~]+)(\s*)(_~~)(\s)$/},Lo={...C,markdownFormatKind:"strikethrough_bold",regEx:/(~~\*\*)(\s*\b)([^*~]+)(\b\s*)(\*\*~~)/,regExForAutoFormatting:/(~~\*\*)(\s*\b)([^*~]+)(\b\s*)(\*\*~~)(\s)$/},$o={...C,markdownFormatKind:"link",regEx:/(\[)([^\]]*)(\]\()([^)]*)(\)*)()/,regExForAutoFormatting:/(\[)([^\]]*)(\]\()([^)]*)(\)*)(\s)$/};function L(r){return(t,e)=>He(t)&&t.getTag()==="h"+r?"#".repeat(r)+" "+e(t):null}function J(r,t){return wt(r)?Ct(r,t,0):null}var Xe=4;function Ct(r,t,e){let o=[],n=r.getChildren(),c=0;for(let s of n)if(ve(s)){if(s.getChildrenSize()===1){let f=s.getFirstChild();if(wt(f)){o.push(Ct(f,t,e+1));continue}}let i=" ".repeat(e*Xe),a=r.getListType()==="bullet"?"- ":`${r.getStart()+c}. `;o.push(i+a+t(s)),c++}return o.join(`
2
2
  `)}function ze(r,t){return Ke(r)?"> "+t(r):null}function H(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 $(r){let t=H(r,e=>e.type);return{element:t.element||[],multilineElement:t["multiline-element"]||[],textFormat:t["text-format"]||[],textMatch:t["text-match"]||[]}}var D=/[!-/:-@[-`{-~\s]/,Ye=/^\s{0,3}$/;function v(r){if(!Ue(r))return!1;let t=r.getFirstChild();return t==null||r.getChildrenSize()===1&&Ge(t)&&Ye.test(t.getTextContent())}function It(r,t=!1){let e=$(r),o=[...e.multilineElement,...e.element],n=!t,c=e.textFormat.filter(s=>s.format.length===1).sort((s,i)=>s.format.includes("code")&&!i.format.includes("code")?1:!s.format.includes("code")&&i.format.includes("code")?-1:0);return s=>{let i=[],a=(s||We()).getChildren();return a.forEach((f,l)=>{let m=je(f,o,c,e.textMatch);m!=null&&i.push(n&&l>0&&!v(f)&&!v(a[l-1])?`
3
3
  `.concat(m):m)}),i.join(`
4
4
  `)}}function je(r,t,e,o){for(let n of t){if(!n.export)continue;let c=n.export(r,s=>X(s,e,o));if(c!=null)return c}return U(r)?X(r,e,o):Nt(r)?r.getTextContent():null}function X(r,t,e,o,n){let c=[],s=r.getChildren();o||(o=[]),n||(n=[]);t:for(let i of s){for(let a of e){if(!a.export)continue;let f=a.export(i,l=>X(l,t,e,o,[...n,...o]),(l,m)=>Rt(l,m,t,o,n));if(f!=null){c.push(f);continue t}}Qe(i)?c.push(`
@@ -9,4 +9,4 @@ var st=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.cre
9
9
  `)},regExp:Yt,replace:(r,t,e,o)=>{if(o){let c=r.getPreviousSibling();if(Pt(c)){c.splice(c.getChildrenSize(),0,[Fn(),...t]),c.select(0,0),r.remove();return}}let n=Sn();n.append(...t),r.replace(n),n.select(0,0)}},qt={type:"element",dependencies:[rt,ot],export:(r,t)=>P(r)?Y(r,t,0):null,regExp:Xt,replace:it("bullet")},kn={type:"element",dependencies:[rt,ot],export:(r,t)=>P(r)?Y(r,t,0):null,regExp:zt,replace:it("check")},Vt={type:"element",dependencies:[rt,ot],export:(r,t)=>P(r)?Y(r,t,0):null,regExp:Gt,replace:it("number")},Zt={type:"text-format",format:["code"],tag:"`"},Jt={type:"text-format",format:["highlight"],tag:"=="},te={type:"text-format",format:["bold","italic"],tag:"***"},ee={type:"text-format",format:["bold","italic"],intraword:!1,tag:"___"},ne={type:"text-format",format:["bold"],tag:"**"},oe={type:"text-format",format:["bold"],intraword:!1,tag:"__"},re={type:"text-format",format:["strikethrough"],tag:"~~"},ie={type:"text-format",format:["italic"],tag:"*"},se={type:"text-format",format:["italic"],intraword:!1,tag:"_"};function ce(r,t){let e=r.split(`
10
10
  `),o=!1,n=[],c=0;for(let s=0;s<e.length;s++){let i=e[s],a=n[n.length-1];if(In.test(i)){n.push(i);continue}if(Ht.test(i)){c===0&&(o=!0),c===1&&(o=!1),c>0&&c--,n.push(i);continue}if(Nn.test(i)){o=!0,c++,n.push(i);continue}if(o){n.push(i);continue}vt.test(i)||vt.test(a)||!a||nt.test(a)||nt.test(i)||Yt.test(i)||Gt.test(i)||Xt.test(i)||zt.test(i)||yn.test(i)||On.test(i)||!t||Kt.test(i)||Ut.test(i)||Kt.test(a)||Ut.test(a)||Ht.test(a)?n.push(i):n[n.length-1]=a+" "+i.trim()}return n.join(`
11
11
  `)}var Mn=[Qt,jt,qt,Vt],Ln=[],$n=[Zt,te,ee,ne,oe,Jt,ie,se,re],Dn=[],z=[...Mn,...Ln,...$n,...Dn];function dr(r,t=z,e,o=!1,n=!0){let c=o?r:ce(r,n);return Mt(t,o)(c,e)}function mr(r=z,t,e=!1){return It(r,e)(t)}export{st as a,or as b,dr as c,mr as d,Q as e,ct as f,eo as g,Be as h,no as i,St as j,so as k};
12
- //# sourceMappingURL=chunk-DOZWITPU.js.map
12
+ //# sourceMappingURL=chunk-LUNX5J6B.js.map