@payloadcms/richtext-lexical 3.29.0-internal.2984e42 → 3.29.0-internal.9400be9
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-5SZDDPZE.js → Field-MAUKSOAP.js} +2 -2
- package/dist/exports/client/bundled.css +1 -1
- package/dist/exports/client/chunk-DOZWITPU.js +12 -0
- package/dist/exports/client/chunk-DOZWITPU.js.map +7 -0
- package/dist/exports/client/index.js +10 -10
- package/dist/exports/client/index.js.map +4 -4
- package/dist/features/converters/lexicalToHtml/async/converters/upload.js.map +1 -1
- package/dist/features/converters/lexicalToHtml/sync/converters/upload.js.map +1 -1
- package/dist/features/experimental_table/client/plugins/TableActionMenuPlugin/index.d.ts.map +1 -1
- package/dist/features/experimental_table/client/plugins/TableActionMenuPlugin/index.js +2 -3
- package/dist/features/experimental_table/client/plugins/TableActionMenuPlugin/index.js.map +1 -1
- package/dist/features/indent/client/index.d.ts +2 -1
- package/dist/features/indent/client/index.d.ts.map +1 -1
- package/dist/features/indent/client/index.js +41 -19
- package/dist/features/indent/client/index.js.map +1 -1
- package/dist/field/bundled.css +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/packages/@lexical/markdown/MarkdownExport.js +4 -0
- package/dist/packages/@lexical/markdown/MarkdownExport.js.map +1 -1
- package/dist/packages/@lexical/markdown/MarkdownImport.d.ts.map +1 -1
- package/dist/packages/@lexical/markdown/MarkdownImport.js +8 -6
- package/dist/packages/@lexical/markdown/MarkdownImport.js.map +1 -1
- package/dist/packages/@lexical/markdown/importTextTransformers.d.ts.map +1 -1
- package/dist/packages/@lexical/markdown/importTextTransformers.js +4 -5
- package/dist/packages/@lexical/markdown/importTextTransformers.js.map +1 -1
- package/package.json +18 -18
- package/dist/exports/client/chunk-XO6X2M3F.js +0 -12
- package/dist/exports/client/chunk-XO6X2M3F.js.map +0 -7
- /package/dist/exports/client/{Field-5SZDDPZE.js.map → Field-MAUKSOAP.js.map} +0 -0
|
@@ -31,7 +31,6 @@ export function importTextTransformers(textNode, textFormatTransformersIndex, te
|
|
|
31
31
|
if (result.transformedNode && $isTextNode(result.transformedNode) && !result.transformedNode.hasFormat('code')) {
|
|
32
32
|
importTextTransformers(result.transformedNode, textFormatTransformersIndex, textMatchTransformers);
|
|
33
33
|
}
|
|
34
|
-
return;
|
|
35
34
|
} else if (foundTextMatch) {
|
|
36
35
|
const result = importFoundTextMatchTransformer(textNode, foundTextMatch.startIndex, foundTextMatch.endIndex, foundTextMatch.transformer, foundTextMatch.match);
|
|
37
36
|
if (!result) {
|
|
@@ -46,10 +45,10 @@ export function importTextTransformers(textNode, textFormatTransformersIndex, te
|
|
|
46
45
|
if (result.transformedNode && $isTextNode(result.transformedNode) && !result.transformedNode.hasFormat('code')) {
|
|
47
46
|
importTextTransformers(result.transformedNode, textFormatTransformersIndex, textMatchTransformers);
|
|
48
47
|
}
|
|
49
|
-
return;
|
|
50
|
-
} else {
|
|
51
|
-
// Done!
|
|
52
|
-
return;
|
|
53
48
|
}
|
|
49
|
+
// Handle escape characters
|
|
50
|
+
const textContent = textNode.getTextContent();
|
|
51
|
+
const escapedText = textContent.replace(/\\([*_`~])/g, '$1');
|
|
52
|
+
textNode.setTextContent(escapedText);
|
|
54
53
|
}
|
|
55
54
|
//# sourceMappingURL=importTextTransformers.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"importTextTransformers.js","names":["$isTextNode","findOutermostTextFormatTransformer","importTextFormatTransformer","findOutermostTextMatchTransformer","importFoundTextMatchTransformer","importTextTransformers","textNode","textFormatTransformersIndex","textMatchTransformers","foundTextFormat","foundTextMatch","startIndex","endIndex","result","transformer","match","nodeAfter","hasFormat","nodeBefore","transformedNode"],"sources":["../../../../src/packages/@lexical/markdown/importTextTransformers.ts"],"sourcesContent":["import { $isTextNode, type TextNode } from 'lexical'\n\n/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\nimport type { TextFormatTransformersIndex } from './MarkdownImport.js'\nimport type { TextMatchTransformer } from './MarkdownTransformers.js'\n\nimport {\n findOutermostTextFormatTransformer,\n importTextFormatTransformer,\n} from './importTextFormatTransformer.js'\nimport {\n findOutermostTextMatchTransformer,\n importFoundTextMatchTransformer,\n} from './importTextMatchTransformer.js'\n\n/**\n * Handles applying both text format and text match transformers.\n * It finds the outermost text format or text match and applies it,\n * then recursively calls itself to apply the next outermost transformer,\n * until there are no more transformers to apply.\n */\nexport function importTextTransformers(\n textNode: TextNode,\n textFormatTransformersIndex: TextFormatTransformersIndex,\n textMatchTransformers: Array<TextMatchTransformer>,\n) {\n let foundTextFormat = findOutermostTextFormatTransformer(textNode, textFormatTransformersIndex)\n\n let foundTextMatch = findOutermostTextMatchTransformer(textNode, textMatchTransformers)\n\n if (foundTextFormat && foundTextMatch) {\n // Find the outermost transformer\n if (\n foundTextFormat.startIndex <= foundTextMatch.startIndex &&\n foundTextFormat.endIndex >= foundTextMatch.endIndex\n ) {\n // foundTextFormat wraps foundTextMatch - apply foundTextFormat by setting foundTextMatch to null\n foundTextMatch = null\n } else {\n // foundTextMatch wraps foundTextFormat - apply foundTextMatch by setting foundTextFormat to null\n foundTextFormat = null\n }\n }\n\n if (foundTextFormat) {\n const result = importTextFormatTransformer(\n textNode,\n foundTextFormat.startIndex,\n foundTextFormat.endIndex,\n foundTextFormat.transformer,\n foundTextFormat.match,\n )\n\n if (result.nodeAfter && $isTextNode(result.nodeAfter) && !result.nodeAfter.hasFormat('code')) {\n importTextTransformers(result.nodeAfter, textFormatTransformersIndex, textMatchTransformers)\n }\n if (\n result.nodeBefore &&\n $isTextNode(result.nodeBefore) &&\n !result.nodeBefore.hasFormat('code')\n ) {\n importTextTransformers(result.nodeBefore, textFormatTransformersIndex, textMatchTransformers)\n }\n if (\n result.transformedNode &&\n $isTextNode(result.transformedNode) &&\n !result.transformedNode.hasFormat('code')\n ) {\n importTextTransformers(\n result.transformedNode,\n textFormatTransformersIndex,\n textMatchTransformers,\n )\n }\n
|
|
1
|
+
{"version":3,"file":"importTextTransformers.js","names":["$isTextNode","findOutermostTextFormatTransformer","importTextFormatTransformer","findOutermostTextMatchTransformer","importFoundTextMatchTransformer","importTextTransformers","textNode","textFormatTransformersIndex","textMatchTransformers","foundTextFormat","foundTextMatch","startIndex","endIndex","result","transformer","match","nodeAfter","hasFormat","nodeBefore","transformedNode","textContent","getTextContent","escapedText","replace","setTextContent"],"sources":["../../../../src/packages/@lexical/markdown/importTextTransformers.ts"],"sourcesContent":["import { $isTextNode, type TextNode } from 'lexical'\n\n/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\nimport type { TextFormatTransformersIndex } from './MarkdownImport.js'\nimport type { TextMatchTransformer } from './MarkdownTransformers.js'\n\nimport {\n findOutermostTextFormatTransformer,\n importTextFormatTransformer,\n} from './importTextFormatTransformer.js'\nimport {\n findOutermostTextMatchTransformer,\n importFoundTextMatchTransformer,\n} from './importTextMatchTransformer.js'\n\n/**\n * Handles applying both text format and text match transformers.\n * It finds the outermost text format or text match and applies it,\n * then recursively calls itself to apply the next outermost transformer,\n * until there are no more transformers to apply.\n */\nexport function importTextTransformers(\n textNode: TextNode,\n textFormatTransformersIndex: TextFormatTransformersIndex,\n textMatchTransformers: Array<TextMatchTransformer>,\n) {\n let foundTextFormat = findOutermostTextFormatTransformer(textNode, textFormatTransformersIndex)\n\n let foundTextMatch = findOutermostTextMatchTransformer(textNode, textMatchTransformers)\n\n if (foundTextFormat && foundTextMatch) {\n // Find the outermost transformer\n if (\n foundTextFormat.startIndex <= foundTextMatch.startIndex &&\n foundTextFormat.endIndex >= foundTextMatch.endIndex\n ) {\n // foundTextFormat wraps foundTextMatch - apply foundTextFormat by setting foundTextMatch to null\n foundTextMatch = null\n } else {\n // foundTextMatch wraps foundTextFormat - apply foundTextMatch by setting foundTextFormat to null\n foundTextFormat = null\n }\n }\n\n if (foundTextFormat) {\n const result = importTextFormatTransformer(\n textNode,\n foundTextFormat.startIndex,\n foundTextFormat.endIndex,\n foundTextFormat.transformer,\n foundTextFormat.match,\n )\n\n if (result.nodeAfter && $isTextNode(result.nodeAfter) && !result.nodeAfter.hasFormat('code')) {\n importTextTransformers(result.nodeAfter, textFormatTransformersIndex, textMatchTransformers)\n }\n if (\n result.nodeBefore &&\n $isTextNode(result.nodeBefore) &&\n !result.nodeBefore.hasFormat('code')\n ) {\n importTextTransformers(result.nodeBefore, textFormatTransformersIndex, textMatchTransformers)\n }\n if (\n result.transformedNode &&\n $isTextNode(result.transformedNode) &&\n !result.transformedNode.hasFormat('code')\n ) {\n importTextTransformers(\n result.transformedNode,\n textFormatTransformersIndex,\n textMatchTransformers,\n )\n }\n } else if (foundTextMatch) {\n const result = importFoundTextMatchTransformer(\n textNode,\n foundTextMatch.startIndex,\n foundTextMatch.endIndex,\n foundTextMatch.transformer,\n foundTextMatch.match,\n )\n if (!result) {\n return\n }\n\n if (result.nodeAfter && $isTextNode(result.nodeAfter) && !result.nodeAfter.hasFormat('code')) {\n importTextTransformers(result.nodeAfter, textFormatTransformersIndex, textMatchTransformers)\n }\n if (\n result.nodeBefore &&\n $isTextNode(result.nodeBefore) &&\n !result.nodeBefore.hasFormat('code')\n ) {\n importTextTransformers(result.nodeBefore, textFormatTransformersIndex, textMatchTransformers)\n }\n if (\n result.transformedNode &&\n $isTextNode(result.transformedNode) &&\n !result.transformedNode.hasFormat('code')\n ) {\n importTextTransformers(\n result.transformedNode,\n textFormatTransformersIndex,\n textMatchTransformers,\n )\n }\n }\n // Handle escape characters\n const textContent = textNode.getTextContent()\n const escapedText = textContent.replace(/\\\\([*_`~])/g, '$1')\n textNode.setTextContent(escapedText)\n}\n"],"mappings":"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","ignoreList":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@payloadcms/richtext-lexical",
|
|
3
|
-
"version": "3.29.0-internal.
|
|
3
|
+
"version": "3.29.0-internal.9400be9",
|
|
4
4
|
"description": "The officially supported Lexical richtext adapter for Payload",
|
|
5
5
|
"homepage": "https://payloadcms.com",
|
|
6
6
|
"repository": {
|
|
@@ -340,23 +340,23 @@
|
|
|
340
340
|
]
|
|
341
341
|
},
|
|
342
342
|
"dependencies": {
|
|
343
|
-
"@lexical/headless": "0.
|
|
344
|
-
"@lexical/html": "0.
|
|
345
|
-
"@lexical/link": "0.
|
|
346
|
-
"@lexical/list": "0.
|
|
347
|
-
"@lexical/mark": "0.
|
|
348
|
-
"@lexical/react": "0.
|
|
349
|
-
"@lexical/rich-text": "0.
|
|
350
|
-
"@lexical/selection": "0.
|
|
351
|
-
"@lexical/table": "0.
|
|
352
|
-
"@lexical/utils": "0.
|
|
343
|
+
"@lexical/headless": "0.28.0",
|
|
344
|
+
"@lexical/html": "0.28.0",
|
|
345
|
+
"@lexical/link": "0.28.0",
|
|
346
|
+
"@lexical/list": "0.28.0",
|
|
347
|
+
"@lexical/mark": "0.28.0",
|
|
348
|
+
"@lexical/react": "0.28.0",
|
|
349
|
+
"@lexical/rich-text": "0.28.0",
|
|
350
|
+
"@lexical/selection": "0.28.0",
|
|
351
|
+
"@lexical/table": "0.28.0",
|
|
352
|
+
"@lexical/utils": "0.28.0",
|
|
353
353
|
"@types/uuid": "10.0.0",
|
|
354
354
|
"acorn": "8.12.1",
|
|
355
355
|
"bson-objectid": "2.0.4",
|
|
356
356
|
"dequal": "2.0.3",
|
|
357
357
|
"escape-html": "1.0.3",
|
|
358
358
|
"jsox": "1.2.121",
|
|
359
|
-
"lexical": "0.
|
|
359
|
+
"lexical": "0.28.0",
|
|
360
360
|
"mdast-util-from-markdown": "2.0.2",
|
|
361
361
|
"mdast-util-mdx-jsx": "3.1.3",
|
|
362
362
|
"micromark-extension-mdx-jsx": "3.0.1",
|
|
@@ -364,8 +364,8 @@
|
|
|
364
364
|
"react-error-boundary": "4.1.2",
|
|
365
365
|
"ts-essentials": "10.0.3",
|
|
366
366
|
"uuid": "10.0.0",
|
|
367
|
-
"@payloadcms/translations": "3.29.0-internal.
|
|
368
|
-
"@payloadcms/ui": "3.29.0-internal.
|
|
367
|
+
"@payloadcms/translations": "3.29.0-internal.9400be9",
|
|
368
|
+
"@payloadcms/ui": "3.29.0-internal.9400be9"
|
|
369
369
|
},
|
|
370
370
|
"devDependencies": {
|
|
371
371
|
"@babel/cli": "7.26.4",
|
|
@@ -373,7 +373,7 @@
|
|
|
373
373
|
"@babel/preset-env": "7.26.7",
|
|
374
374
|
"@babel/preset-react": "7.26.3",
|
|
375
375
|
"@babel/preset-typescript": "7.26.0",
|
|
376
|
-
"@lexical/eslint-plugin": "0.
|
|
376
|
+
"@lexical/eslint-plugin": "0.28.0",
|
|
377
377
|
"@types/escape-html": "1.0.4",
|
|
378
378
|
"@types/json-schema": "7.0.15",
|
|
379
379
|
"@types/node": "22.5.4",
|
|
@@ -386,15 +386,15 @@
|
|
|
386
386
|
"eslint-plugin-react-compiler": "19.0.0-beta-714736e-20250131",
|
|
387
387
|
"swc-plugin-transform-remove-imports": "3.1.0",
|
|
388
388
|
"@payloadcms/eslint-config": "3.28.0",
|
|
389
|
-
"payload": "3.29.0-internal.
|
|
389
|
+
"payload": "3.29.0-internal.9400be9"
|
|
390
390
|
},
|
|
391
391
|
"peerDependencies": {
|
|
392
392
|
"@faceless-ui/modal": "3.0.0-beta.2",
|
|
393
393
|
"@faceless-ui/scroll-info": "2.0.0",
|
|
394
394
|
"react": "^19.0.0 || ^19.0.0-rc-65a56d0e-20241020",
|
|
395
395
|
"react-dom": "^19.0.0 || ^19.0.0-rc-65a56d0e-20241020",
|
|
396
|
-
"@payloadcms/next": "3.29.0-internal.
|
|
397
|
-
"payload": "3.29.0-internal.
|
|
396
|
+
"@payloadcms/next": "3.29.0-internal.9400be9",
|
|
397
|
+
"payload": "3.29.0-internal.9400be9"
|
|
398
398
|
},
|
|
399
399
|
"engines": {
|
|
400
400
|
"node": "^18.20.2 || >=20.9.0"
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
var R=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";var j=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 ft(r){return r instanceof j}import{c as Oe}from"react/compiler-runtime";import{jsx as ye}from"react/jsx-runtime";import{useLexicalComposerContext as be}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as ke}from"@lexical/utils";import{$getSelection as Z,$isRangeSelection as J,$isTextNode as Me,COMMAND_PRIORITY_LOW as Le,createCommand as $e,getDOMSelection as De}from"lexical";import{useEffect as Tt,useState as Be}from"react";import*as V from"react";import{c as pt}from"react/compiler-runtime";import{useLexicalComposerContext as ht}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as ut}from"@lexical/utils";import{$getSelection as xt,$isRangeSelection as ue,$setSelection as de,COMMAND_PRIORITY_LOW as M,createCommand as me,KEY_ARROW_DOWN_COMMAND as ge,KEY_ARROW_UP_COMMAND as pe,KEY_ENTER_COMMAND as he,KEY_ESCAPE_COMMAND as xe,KEY_TAB_COMMAND as Ee}from"lexical";import{useCallback as q,useEffect as L,useLayoutEffect as _e,useMemo as Te,useRef as Se,useState as we}from"react";var Re="slash-menu-popup",dt=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 Ce(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 Ie(r){let t=xt();if(!ue(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,i=o.getTextContent().slice(0,n),c=r.replaceableString.length,s=Ce(i,r.matchingString,c),a=n-s;if(a<0)return;let f;return a===0?[f]=o.splitText(n):[,f]=o.splitText(a,n),f}function Fe(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 i=r;i=i.parentElement;)if(e=getComputedStyle(i),!(o&&e.position==="static")&&n.test(e.overflow+e.overflowY+e.overflowX))return i;return document.body}function mt(r,t){let e=r.getBoundingClientRect(),o=t.getBoundingClientRect();return e.top>o.top&&e.top<o.bottom}function Ne(r,t,e,o){let n=pt(12),[i]=ht(),c;n[0]!==i||n[1]!==e||n[2]!==o||n[3]!==r||n[4]!==t.current?(c=()=>{let a=t.current;if(a!=null&&r!=null){let f=i.getRootElement(),l=f!=null?Fe(f,!1):document.body,m;m=!1;let g;g=mt(a,l);let p=function(){m||(window.requestAnimationFrame(function(){e(),m=!1}),m=!0);let u=mt(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]=i,n[1]=e,n[2]=o,n[3]=r,n[4]=t.current,n[5]=c):c=n[5];let s;n[6]!==i||n[7]!==e||n[8]!==o||n[9]!==r||n[10]!==t?(s=[i,o,e,r,t],n[6]=i,n[7]=e,n[8]=o,n[9]=r,n[10]=t,n[11]=s):s=n[11],L(c,s)}var gt=me("SCROLL_TYPEAHEAD_OPTION_INTO_VIEW_COMMAND");function Et({anchorElementRef:r,close:t,editor:e,groups:o,menuRenderFn:n,resolution:i,shouldSplitNodeWithQuery:c=!1}){let[s,a]=we(null),f=i.match&&i.match.matchingString||"",l=q(d=>{let u=e.getRootElement();u!==null&&(u.setAttribute("aria-activedescendant",`${Re}__item-${d.key}`),a(d.key))},[e]),m=q(()=>{if(o!==null&&f!=null){let d=o.flatMap(u=>u.items);if(d.length){let u=d[0];l(u)}}},[o,l,f]);L(()=>{m()},[f,m]);let g=q(d=>{t(),e.update(()=>{let u=i.match!=null&&c?Ie(i.match):null;u&&u.remove()}),setTimeout(()=>{let u;e.read(()=>{u=xt()?.clone()}),e.update(()=>{u&&de(u)}),d.onSelect({editor:e,queryString:i.match?i.match.matchingString:""})},0)},[e,c,i.match,t]);L(()=>()=>{let d=e.getRootElement();d!==null&&d.removeAttribute("aria-activedescendant")},[e]),_e(()=>{o===null?a(null):s===null&&m()},[o,s,l,m]),L(()=>ut(e.registerCommand(gt,({item:d})=>d.ref&&d.ref.current!=null?(dt(d.ref.current),!0):!1,M)),[e,l]),L(()=>ut(e.registerCommand(ge,d=>{let u=d;if(o!==null&&o.length&&s!==null){let x=o.flatMap(T=>T.items),h=x.findIndex(T=>T.key===s),E=h!==x.length-1?h+1:0,_=x[E];if(!_)return!1;l(_),_.ref!=null&&_.ref.current&&e.dispatchCommand(gt,{index:E,item:_}),u.preventDefault(),u.stopImmediatePropagation()}return!0},M),e.registerCommand(pe,d=>{let u=d;if(o!==null&&o.length&&s!==null){let x=o.flatMap(T=>T.items),h=x.findIndex(T=>T.key===s),E=h!==0?h-1:x.length-1,_=x[E];if(!_)return!1;l(_),_.ref!=null&&_.ref.current&&dt(_.ref.current),u.preventDefault(),u.stopImmediatePropagation()}return!0},M),e.registerCommand(xe,d=>{let u=d;return u.preventDefault(),u.stopImmediatePropagation(),t(),!0},M),e.registerCommand(Ee,d=>{let u=d;if(o===null||s===null)return!1;let h=o.flatMap(E=>E.items).find(E=>E.key===s);return h?(u.preventDefault(),u.stopImmediatePropagation(),g(h),!0):!1},M),e.registerCommand(he,d=>{if(o===null||s===null)return!1;let x=o.flatMap(h=>h.items).find(h=>h.key===s);return x?(d!==null&&(d.preventDefault(),d.stopImmediatePropagation()),g(x),!0):!1},M)),[g,t,e,o,s,l]);let p=Te(()=>({groups:o,selectedItemKey:s,selectItemAndCleanUp:g,setSelectedItemKey:a}),[g,s,o]);return n(r,p,i.match?i.match.matchingString:"")}function Ae(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 _t(r,t,e,o){let n=pt(14),[i]=ht(),c;n[0]===Symbol.for("react.memo_cache_sentinel")?(c=R?document.createElement("div"):null,n[0]=c):c=n[0];let s=Se(c),a;n[1]!==r||n[2]!==o||n[3]!==i||n[4]!==t?(a=()=>{if(s.current===null||parent===void 0)return;let d=i.getRootElement(),u=s.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,A=d.getBoundingClientRect();_+w>A.right&&(u.style.left=`${A.right-w+window.scrollX}px`);let O=N+F+32>window.innerHeight,b=N<0;O&&!b?u.style.top=`${T+32-F+window.scrollY-(h+24)}px`:u.style.top=`${T+window.scrollY+32}px`}u.isConnected||(Ae(u,o),r.append(u)),u.setAttribute("id","slash-menu"),s.current=u,d.setAttribute("aria-controls","slash-menu")}},n[1]=r,n[2]=o,n[3]=i,n[4]=t,n[5]=a):a=n[5];let f=a,l,m;n[6]!==i||n[7]!==f||n[8]!==t?(l=()=>{let d=i.getRootElement();if(t!==null)return f(),()=>{d!==null&&d.removeAttribute("aria-controls");let u=s.current;u!==null&&u.isConnected&&(u.remove(),u.removeAttribute("id"))}},m=[i,f,t],n[6]=i,n[7]=f,n[8]=t,n[9]=l,n[10]=m):(l=n[9],m=n[10]),L(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],Ne(t,s,f,g),s}var so=`\\.,\\+\\*\\?\\$\\@\\|#{}\\(\\)\\^\\-\\[\\]\\\\/!%'"~=<>_:;`;function Pe(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 St(r,t,e){let o=De(e);if(o===null||!o.isCollapsed)return!1;let n=o.anchorNode,i=r,c=o.anchorOffset;if(n==null||c==null)return!1;try{t.setStart(n,i),t.setEnd(n,c>1?c:1)}catch{return!1}return!0}function ve(r){let t;return r.getEditorState().read(()=>{let e=Z();J(e)&&(t=Pe(e))}),t}function wt(r,t){return t!==0?!1:r.getEditorState().read(()=>{let e=Z();if(J(e)){let i=e.anchor.getNode().getPreviousSibling();return Me(i)&&i.isTextEntity()}return!1})}function Rt(r){V.startTransition?V.startTransition(r):r()}var He=$e("ENABLE_SLASH_MENU_COMMAND");function co(r){let t=Oe(30),{anchorClassName:e,anchorElem:o,groups:n,menuRenderFn:i,onClose:c,onOpen:s,onQueryChange:a,triggerFn:f}=r,[l]=be(),[m,g]=Be(null),p=_t(o,m,g,e),d;t[0]!==c||t[1]!==m?(d=()=>{g(null),c!=null&&m!==null&&c()},t[0]=c,t[1]=m,t[2]=d):d=t[2];let u=d,x;t[3]!==s||t[4]!==m?(x=F=>{g(F),s!=null&&m===null&&s(F)},t[3]=s,t[4]=m,t[5]=x):x=t[5];let h=x,E,_;t[6]!==l||t[7]!==h?(E=()=>ke(l.registerCommand(He,F=>{let{node:w}=F;return l.getEditorState().read(()=>{let A={leadOffset:0,matchingString:"",replaceableString:""};if(!wt(l,A.leadOffset)&&w!==null){let O=l._window??window,b=O.document.createRange();St(A.leadOffset,b,O)!==null&&Rt(()=>h({getRect:()=>b.getBoundingClientRect(),match:A}));return}}),!0},Le)),_=[l,h],t[6]=l,t[7]=h,t[8]=E,t[9]=_):(E=t[8],_=t[9]),Tt(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 A=l._window??window,O=A.document.createRange(),b=Z(),Q=ve(l);if(!J(b)||!b.isCollapsed()||Q===void 0||O===null){u();return}let k=f({editor:l,query:Q});if(a(k?k.matchingString:null),k!==null&&!wt(l,k.leadOffset)&&St(k.leadOffset,O,A)!==null){Rt(()=>h({getRect:()=>O.getBoundingClientRect(),match:k}));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],Tt(T,N);let S;return t[23]!==p||t[24]!==u||t[25]!==l||t[26]!==n||t[27]!==i||t[28]!==m?(S=p.current===null||m===null||l===null?null:ye(Et,{anchorElementRef:p,close:u,editor:l,groups:n,menuRenderFn:i,resolution:m,shouldSplitNodeWithQuery:!0}),t[23]=p,t[24]=u,t[25]=l,t[26]=n,t[27]=i,t[28]=m,t[29]=S):S=t[29],S}var Ct=class r{_bottom;_left;_right;_top;constructor(t,e,o,n){let[i,c]=e<=n?[e,n]:[n,e],[s,a]=t<=o?[t,o]:[o,t];this._top=i,this._right=a,this._left=s,this._bottom=c}static fromDOM(t){let{height:e,left:o,top:n,width:i}=t.getBoundingClientRect();return r.fromLWTH(o,i,n,e)}static fromDOMRect(t){let{height:e,left:o,top:n,width:i}=t;return r.fromLWTH(o,i,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:i,y:c}=e;return r.fromLTRB(o,n,i,c)}contains(t){if(ft(t)){let{x:c,y:s}=t,a=s<this._top,f=s>this._bottom,l=c<this._left,m=c>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:i}=t;return i>=this._top&&i<=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:i}=t,{height:c,left:s,top:a,width:f}=this,l=o+i>=s+f?o+i:s+f,m=n+e>=a+c?n+e:a+c,g=o<=s?o:s,p=n<=a?n:a;return l-g<=i+f&&m-p<=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)}};function uo({editorConfig:r}){return Ke({nodes:r.features.nodes})}function Ke({nodes:r}){return r.map(t=>"node"in t?t.node:t)}var Ue=R&&"documentMode"in document?document.documentMode:null,po=R&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),ho=R&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),xo=R&&"InputEvent"in window&&!Ue?"getTargetRanges"in new window.InputEvent("input"):!1,tt=R&&/Version\/[\d.].*Safari/.test(navigator.userAgent),et=R&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,Eo=R&&/Android/.test(navigator.userAgent),_o=R&&/Win/.test(navigator.platform),Ge=R&&/^(?=.*Chrome).*/i.test(navigator.userAgent),nt=R&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&!Ge;import{$getRoot as Ze,$isDecoratorNode as Ot,$isElementNode as G,$isLineBreakNode as Je,$isTextNode as W}from"lexical";import{$isListItemNode as We,$isListNode as It}from"@lexical/list";import{$isHeadingNode as Xe,$isQuoteNode as ze}from"@lexical/rich-text";import{$isParagraphNode as Ye,$isTextNode as Qe}from"lexical";var C={markdownFormatKind:null,regEx:/(?:)/,regExForAutoFormatting:/(?:)/,requiresParagraphStart:!1},I={...C,requiresParagraphStart:!0},Co={...I,export:$(1),markdownFormatKind:"paragraphH1",regEx:/^# /,regExForAutoFormatting:/^# /},Io={...I,export:$(2),markdownFormatKind:"paragraphH2",regEx:/^## /,regExForAutoFormatting:/^## /},Fo={...I,export:$(3),markdownFormatKind:"paragraphH3",regEx:/^### /,regExForAutoFormatting:/^### /},No={...I,export:$(4),markdownFormatKind:"paragraphH4",regEx:/^#### /,regExForAutoFormatting:/^#### /},Ao={...I,export:$(5),markdownFormatKind:"paragraphH5",regEx:/^##### /,regExForAutoFormatting:/^##### /},Oo={...I,export:$(6),markdownFormatKind:"paragraphH6",regEx:/^###### /,regExForAutoFormatting:/^###### /},yo={...I,export:qe,markdownFormatKind:"paragraphBlockQuote",regEx:/^> /,regExForAutoFormatting:/^> /},bo={...I,export:ot,markdownFormatKind:"paragraphUnorderedList",regEx:/^(\s{0,10})- /,regExForAutoFormatting:/^(\s{0,10})- /},ko={...I,export:ot,markdownFormatKind:"paragraphUnorderedList",regEx:/^(\s{0,10})\* /,regExForAutoFormatting:/^(\s{0,10})\* /},Mo={...I,export:ot,markdownFormatKind:"paragraphOrderedList",regEx:/^(\s{0,10})(\d+)\.\s/,regExForAutoFormatting:/^(\s{0,10})(\d+)\.\s/},Lo={...I,markdownFormatKind:"horizontalRule",regEx:/^\*\*\*$/,regExForAutoFormatting:/^\*\*\* /},$o={...I,markdownFormatKind:"horizontalRule",regEx:/^---$/,regExForAutoFormatting:/^--- /},Do={...C,exportFormat:"code",exportTag:"`",markdownFormatKind:"code",regEx:/(`)(\s*)([^`]*)(\s*)(`)()/,regExForAutoFormatting:/(`)(\s*\b)([^`]*)(\b\s*)(`)(\s)$/},Bo={...C,exportFormat:"bold",exportTag:"**",markdownFormatKind:"bold",regEx:/(\*\*)(\s*)([^*]*)(\s*)(\*\*)()/,regExForAutoFormatting:/(\*\*)(\s*\b)([^*]*)(\b\s*)(\*\*)(\s)$/},Po={...C,exportFormat:"italic",exportTag:"*",markdownFormatKind:"italic",regEx:/(\*)(\s*)([^*]*)(\s*)(\*)()/,regExForAutoFormatting:/(\*)(\s*\b)([^*]*)(\b\s*)(\*)(\s)$/},vo={...C,exportFormat:"bold",exportTag:"_",markdownFormatKind:"bold",regEx:/(__)(\s*)([^_]*)(\s*)(__)()/,regExForAutoFormatting:/(__)(\s*)([^_]*)(\s*)(__)(\s)$/},Ho={...C,exportFormat:"italic",exportTag:"_",markdownFormatKind:"italic",regEx:/(_)()([^_]*)()(_)()/,regExForAutoFormatting:/(_)()([^_]*)()(_)(\s)$/},Ko={...C,exportFormat:"underline",exportTag:"<u>",exportTagClose:"</u>",markdownFormatKind:"underline",regEx:/(<u>)(\s*)([^<]*)(\s*)(<\/u>)()/,regExForAutoFormatting:/(<u>)(\s*\b)([^<]*)(\b\s*)(<\/u>)(\s)$/},Uo={...C,exportFormat:"strikethrough",exportTag:"~~",markdownFormatKind:"strikethrough",regEx:/(~~)(\s*)([^~]*)(\s*)(~~)()/,regExForAutoFormatting:/(~~)(\s*\b)([^~]*)(\b\s*)(~~)(\s)$/},Go={...C,markdownFormatKind:"strikethrough_italic_bold",regEx:/(~~_\*\*)(\s*\b)([^*_~]+)(\b\s*)(\*\*_~~)()/,regExForAutoFormatting:/(~~_\*\*)(\s*\b)([^*_~]+)(\b\s*)(\*\*_~~)(\s)$/},Wo={...C,markdownFormatKind:"italic_bold",regEx:/(_\*\*)(\s*\b)([^*_]+)(\b\s*)(\*\*_)/,regExForAutoFormatting:/(_\*\*)(\s*\b)([^*_]+)(\b\s*)(\*\*_)(\s)$/},Xo={...C,markdownFormatKind:"strikethrough_italic",regEx:/(~~_)(\s*)([^_~]+)(\s*)(_~~)/,regExForAutoFormatting:/(~~_)(\s*)([^_~]+)(\s*)(_~~)(\s)$/},zo={...C,markdownFormatKind:"strikethrough_bold",regEx:/(~~\*\*)(\s*\b)([^*~]+)(\b\s*)(\*\*~~)/,regExForAutoFormatting:/(~~\*\*)(\s*\b)([^*~]+)(\b\s*)(\*\*~~)(\s)$/},Yo={...C,markdownFormatKind:"link",regEx:/(\[)([^\]]*)(\]\()([^)]*)(\)*)()/,regExForAutoFormatting:/(\[)([^\]]*)(\]\()([^)]*)(\)*)(\s)$/};function $(r){return(t,e)=>Xe(t)&&t.getTag()==="h"+r?"#".repeat(r)+" "+e(t):null}function ot(r,t){return It(r)?Ft(r,t,0):null}var je=4;function Ft(r,t,e){let o=[],n=r.getChildren(),i=0;for(let c of n)if(We(c)){if(c.getChildrenSize()===1){let f=c.getFirstChild();if(It(f)){o.push(Ft(f,t,e+1));continue}}let s=" ".repeat(e*je),a=r.getListType()==="bullet"?"- ":`${r.getStart()+i}. `;o.push(s+a+t(c)),i++}return o.join(`
|
|
2
|
-
`)}function qe(r,t){return ze(r)?"> "+t(r):null}function K(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 D(r){let t=K(r,e=>e.type);return{element:t.element||[],multilineElement:t["multiline-element"]||[],textFormat:t["text-format"]||[],textMatch:t["text-match"]||[]}}var B=/[!-/:-@[-`{-~\s]/,Ve=/^\s{0,3}$/;function H(r){if(!Ye(r))return!1;let t=r.getFirstChild();return t==null||r.getChildrenSize()===1&&Qe(t)&&Ve.test(t.getTextContent())}function yt(r,t=!1){let e=D(r),o=[...e.multilineElement,...e.element],n=!t,i=e.textFormat.filter(c=>c.format.length===1).sort((c,s)=>c.format.includes("code")&&!s.format.includes("code")?1:!c.format.includes("code")&&s.format.includes("code")?-1:0);return c=>{let s=[],a=(c||Ze()).getChildren();return a.forEach((f,l)=>{let m=tn(f,o,i,e.textMatch);m!=null&&s.push(n&&l>0&&!H(f)&&!H(a[l-1])?`
|
|
3
|
-
`.concat(m):m)}),s.join(`
|
|
4
|
-
`)}}function tn(r,t,e,o){for(let n of t){if(!n.export)continue;let i=n.export(r,c=>X(c,e,o));if(i!=null)return i}return G(r)?X(r,e,o):Ot(r)?r.getTextContent():null}function X(r,t,e,o,n){let i=[],c=r.getChildren();o||(o=[]),n||(n=[]);t:for(let s of c){for(let a of e){if(!a.export)continue;let f=a.export(s,l=>X(l,t,e,o,[...n,...o]),(l,m)=>Nt(l,m,t,o,n));if(f!=null){i.push(f);continue t}}Je(s)?i.push(`
|
|
5
|
-
`):W(s)?i.push(Nt(s,s.getTextContent(),t,o,n)):G(s)?i.push(X(s,t,e,o,n)):Ot(s)&&i.push(s.getTextContent())}return i.join("")}function Nt(r,t,e,o,n){let i=t.trim(),c=i,s="",a="",f="",l=At(r,!0),m=At(r,!1),g=new Set;for(let p of e){let d=p.format[0],u=p.tag;U(r,d)&&!g.has(d)&&(g.add(d),(!U(l,d)||!o.find(x=>x.tag===u))&&(o.push({format:d,tag:u}),s+=u))}for(let p=0;p<o.length;p++){let d=o[p],u=U(r,d.format),x=U(m,d.format);if(u&&x)continue;let h=[...o];for(;h.length>p;){let E=h.pop();n&&E&&n.find(_=>_.tag===E.tag)||(E&&typeof E.tag=="string"&&(u?x||(f+=E.tag):a+=E.tag),o.pop())}break}return c=s+c+f,a+t.replace(i,()=>c)}function At(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(G(e)){if(!e.isInline())break;let o=t?e.getLastDescendant():e.getFirstDescendant();if(W(o))return o;e=t?e.getPreviousSibling():e.getNextSibling()}if(W(e))return e;if(!G(e))return null}return null}function U(r,t){return W(r)&&r.hasFormat(t)}import{$isListItemNode as nn,$isListNode as $t}from"@lexical/list";import{$isQuoteNode as on}from"@lexical/rich-text";import{$findMatchingParent as rn}from"@lexical/utils";import{$createLineBreakNode as sn,$createParagraphNode as cn,$createTextNode as an,$getRoot as ln,$getSelection as fn,$isParagraphNode as un}from"lexical";import{$isTextNode as P}from"lexical";function bt(r,t){let e=r.getTextContent(),o=en(e,t);if(!o)return null;let n=o.index||0,i=n+o[0].length,c=t.transformersByTag[o[1]];return{endIndex:i,match:o,startIndex:n,transformer:c}}function en(r,t){let e=r.match(t.openTagsRegExp);if(e==null)return null;for(let o of e){let n=o.replace(/^\s/,""),i=t.fullMatchRegExpByTag[n];if(i==null)continue;let c=r.match(i),s=t.transformersByTag[n];if(c!=null&&s!=null){if(s.intraword!==!1)return c;let{index:a=0}=c,f=r[a-1],l=r[a+c[0].length];if((!f||B.test(f))&&(!l||B.test(l)))return c}}return null}function kt(r,t,e,o,n){let i=r.getTextContent(),c,s,a;if(n[0]===i?a=r:t===0?[a,c]=r.splitText(e):[s,a,c]=r.splitText(t,e),a.setTextContent(n[2]),o)for(let f of o.format)a.hasFormat(f)||a.toggleFormat(f);return{nodeAfter:c,nodeBefore:s,transformedNode:a}}function Mt(r,t){let e=r,o,n,i,c;for(let s of t){if(!s.replace||!s.importRegExp)continue;let a=e.getTextContent().match(s.importRegExp);if(!a)continue;let f=a.index||0,l=s.getEndIndex?s.getEndIndex(e,a):f+a[0].length;l!==!1&&(o===void 0||n===void 0||f<o&&l>n)&&(o=f,n=l,i=s,c=a)}return o===void 0||n===void 0||i===void 0||c===void 0?null:{endIndex:n,match:c,startIndex:o,transformer:i}}function Lt(r,t,e,o,n){let i,c,s;if(t===0?[s,i]=r.splitText(e):[c,s,i]=r.splitText(t,e),!o.replace)return null;let a=s?o.replace(s,n):void 0;return{nodeAfter:i,nodeBefore:c,transformedNode:a||void 0}}function y(r,t,e){let o=bt(r,t),n=Mt(r,e);if(o&&n&&(o.startIndex<=n.startIndex&&o.endIndex>=n.endIndex?n=null:o=null),o){let i=kt(r,o.startIndex,o.endIndex,o.transformer,o.match);i.nodeAfter&&P(i.nodeAfter)&&!i.nodeAfter.hasFormat("code")&&y(i.nodeAfter,t,e),i.nodeBefore&&P(i.nodeBefore)&&!i.nodeBefore.hasFormat("code")&&y(i.nodeBefore,t,e),i.transformedNode&&P(i.transformedNode)&&!i.transformedNode.hasFormat("code")&&y(i.transformedNode,t,e);return}else if(n){let i=Lt(r,n.startIndex,n.endIndex,n.transformer,n.match);if(!i)return;i.nodeAfter&&P(i.nodeAfter)&&!i.nodeAfter.hasFormat("code")&&y(i.nodeAfter,t,e),i.nodeBefore&&P(i.nodeBefore)&&!i.nodeBefore.hasFormat("code")&&y(i.nodeBefore,t,e),i.transformedNode&&P(i.transformedNode)&&!i.transformedNode.hasFormat("code")&&y(i.transformedNode,t,e);return}else return}function Dt(r,t=!1){let e=D(r),o=gn(e.textFormat);return(n,i)=>{let c=n.split(`
|
|
6
|
-
`),s=c.length,a=i||ln();a.clear();for(let l=0;l<s;l++){let m=c[l],[g,p]=dn(c,l,e.multilineElement,a);if(g){l=p;continue}mn(m,a,e.element,o,e.textMatch)}let f=a.getChildren();for(let l of f)!t&&H(l)&&a.getChildrenSize()>1&&l.remove();fn()!==null&&a.selectStart()}}function dn(r,t,e,o){for(let n of e){let{handleImportAfterStartMatch:i,regExpEnd:c,regExpStart:s,replace:a}=n,f=r[t]?.match(s);if(!f)continue;if(i){let d=i({lines:r,rootNode:o,startLineIndex:t,startMatch:f,transformer:n});if(d===null)continue;if(d)return d}let l=typeof c=="object"&&"regExp"in c?c.regExp:c,m=c&&typeof c=="object"&&"optional"in c?c.optional:!c,g=t,p=r.length;for(;g<p;){let d=l?r[g]?.match(l):null;if(!d&&(!m||m&&g<p-1)){g++;continue}if(d&&t===g&&d.index===f.index){g++;continue}let u=[];if(d&&t===g)u.push(r[t].slice(f[0].length,-d[0].length));else for(let x=t;x<=g;x++){let h=r[x];if(x===t){let E=h.slice(f[0].length);u.push(E)}else if(x===g&&d){let E=h.slice(0,-d[0].length);u.push(E)}else u.push(h)}if(a(o,null,f,d,u,!0)!==!1)return[!0,g];break}}return[!1,t]}function mn(r,t,e,o,n){let i=an(r),c=cn();c.append(i),t.append(c);for(let{regExp:s,replace:a}of e){let f=r.match(s);if(f&&(i.setTextContent(r.slice(f[0].length)),a(c,[i],f,!0)!==!1))break}if(y(i,o,n),c.isAttached()&&r.length>0){let s=c.getPreviousSibling();if(un(s)||on(s)||$t(s)){let a=s;if($t(s)){let f=s.getLastDescendant();f==null?a=null:a=rn(f,nn)}a!=null&&a.getTextContentSize()>0&&(a.splice(a.getChildrenSize(),0,[sn(),...c.getChildren()]),c.remove())}}}function gn(r){let t={},e={},o=[],n="(?<![\\\\])";for(let i of r){let{tag:c}=i;t[c]=i;let s=c.replace(/([*^+])/g,"\\$1");o.push(s),tt||et||nt?e[c]=new RegExp(`(${s})(?![${s}\\s])(.*?[^${s}\\s])${s}(?!${s})`):e[c]=new RegExp(`(?<![\\\\${s}])(${s})((\\\\${s})?.*?[^${s}\\s](\\\\${s})?)((?<!\\\\)|(?<=\\\\\\\\))(${s})(?![\\\\${s}])`)}return{fullMatchRegExpByTag:e,openTagsRegExp:new RegExp((tt||et||nt?"":`${n}`)+"("+o.join("|")+")","g"),transformersByTag:t}}import{$createRangeSelection as pn,$getSelection as rt,$isLineBreakNode as hn,$isRangeSelection as it,$isRootOrShadowRoot as Pt,$isTextNode as vt,$setSelection as xn}from"lexical";function En(r,t,e,o){let n=r.getParent();if(!Pt(n)||r.getFirstChild()!==t)return!1;let i=t.getTextContent();if(i[e-1]!==" ")return!1;for(let{regExp:c,replace:s}of o){let a=i.match(c);if(a&&a[0].length===(a[0].endsWith(" ")?e:e-1)){let f=t.getNextSiblings(),[l,m]=t.splitText(e);l?.remove();let g=m?[m,...f]:f;if(s(r,g,a,!1)!==!1)return!0}}return!1}function _n(r,t,e,o){let n=r.getParent();if(!Pt(n)||r.getFirstChild()!==t)return!1;let i=t.getTextContent();if(i[e-1]!==" ")return!1;for(let{regExpEnd:c,regExpStart:s,replace:a}of o){if(c&&!("optional"in c)||c&&"optional"in c&&!c.optional)continue;let f=i.match(s);if(f&&f[0].length===(f[0].endsWith(" ")?e:e-1)){let l=t.getNextSiblings(),[m,g]=t.splitText(e);m?.remove();let p=g?[g,...l]:l;if(a(r,p,f,null,null,!1)!==!1)return!0}}return!1}function Tn(r,t,e){let o=r.getTextContent(),n=o[t-1],i=e[n];if(i==null)return!1;t<o.length&&(o=o.slice(0,t));for(let c of i){if(!c.replace||!c.regExp)continue;let s=o.match(c.regExp);if(s===null)continue;let a=s.index||0,f=a+s[0].length,l;return a===0?[l]=r.splitText(f):[,l]=r.splitText(a,f),l&&(l.selectNext(0,0),c.replace(l,s)),!0}return!1}function Sn(r,t,e){let o=r.getTextContent(),n=t-1,i=o[n],c=e[i];if(!c)return!1;for(let s of c){let{tag:a}=s,f=a.length,l=n-f+1;if(f>1&&!Ht(o,l,a,0,f)||o[l-1]===" ")continue;let m=o[n+1];if(s.intraword===!1&&m&&!B.test(m))continue;let g=r,p=g,d=Bt(o,l,a),u=p;for(;d<0&&(u=u.getPreviousSibling())&&!hn(u);)if(vt(u)){let w=u.getTextContent();p=u,d=Bt(w,w.length,a)}if(d<0||p===g&&d+f===l)continue;let x=p.getTextContent();if(d>0&&x[d-1]===i)continue;let h=x[d-1];if(s.intraword===!1&&h&&!B.test(h))continue;let E=g.getTextContent(),_=E.slice(0,l)+E.slice(n+1);g.setTextContent(_);let T=p===g?_:x;p.setTextContent(T.slice(0,d)+T.slice(d+f));let N=rt(),S=pn();xn(S);let F=n-f*(p===g?2:1)+1;S.anchor.set(p.__key,d,"text"),S.focus.set(g.__key,F,"text");for(let w of s.format)S.hasFormat(w)||S.formatText(w);S.anchor.set(S.focus.key,S.focus.offset,S.focus.type);for(let w of s.format)S.hasFormat(w)&&S.toggleFormat(w);return it(N)&&(S.format=N.format),!0}return!1}function Bt(r,t,e){let o=e.length;for(let n=t;n>=o;n--){let i=n-o;if(Ht(r,i,e,0,o)&&r[i+o]!==" ")return i}return-1}function Ht(r,t,e,o,n){for(let i=0;i<n;i++)if(r[t+i]!==e[o+i])return!1;return!0}function hr(r,t=z){let e=D(t),o=K(e.textFormat,({tag:c})=>c[c.length-1]),n=K(e.textMatch,({trigger:c})=>c);for(let c of t){let s=c.type;if(s==="element"||s==="text-match"||s==="multiline-element"){let a=c.dependencies;for(let f of a)if(!r.hasNode(f))throw new Error("MarkdownShortcuts: missing dependency %s for transformer. Ensure node dependency is included in editor initial config."+f.getType())}}let i=(c,s,a)=>{En(c,s,a,e.element)||_n(c,s,a,e.multilineElement)||Tn(s,a,n)||Sn(s,a,o)};return r.registerUpdateListener(({dirtyLeaves:c,editorState:s,prevEditorState:a,tags:f})=>{if(f.has("collaboration")||f.has("historic")||r.isComposing())return;let l=s.read(rt),m=a.read(rt);if(!it(m)||!it(l)||!l.isCollapsed()||l.is(m))return;let g=l.anchor.key,p=l.anchor.offset,d=s._nodeMap.get(g);!vt(d)||!c.has(g)||p!==1&&p>m.anchor.offset+1||r.update(()=>{if(d.hasFormat("code"))return;let u=d.getParent();u!==null&&i(u,d,l.anchor.offset)})})}import{$createListItemNode as wn,$createListNode as Rn,$isListItemNode as Cn,$isListNode as v,ListItemNode as ct,ListNode as at}from"@lexical/list";import{$createHeadingNode as In,$createQuoteNode as Fn,$isHeadingNode as Nn,$isQuoteNode as Kt,HeadingNode as An,QuoteNode as On}from"@lexical/rich-text";import{$createLineBreakNode as yn}from"lexical";var Ut=/^[\t ]*$/,zt=/^(\s*)(\d+)\.\s/,Yt=/^(\s*)[-*+]\s/,Qt=/^(\s*)(?:-\s)?\s?(\[(\s|x)?\])\s/i,st=/^(#{1,6})\s/,jt=/^>\s/,bn=/^[ \t]*(\\`\\`\\`|```)(\w+)?/,Gt=/[ \t]*(\\`\\`\\`|```)$/,kn=/^[ \t]*```[^`]+(?:(?:`{1,2}|`{4,})[^`]+)*```(?:[^`]|$)/,Mn=/^\|(.+)\|\s?$/,Ln=/^(\| ?:?-*:? ?)+\|\s?$/,Wt=/^[ \t]*<[a-z_][\w-]*(?:\s[^<>]*)?\/?>/i,Xt=/^[ \t]*<\/[a-z_][\w-]*\s*>/i,$n=r=>(t,e,o)=>{let n=r(o);n.append(...e),t.replace(n),n.select(0,0)},qt=4;function Dn(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 lt=r=>(t,e,o)=>{let n=t.getPreviousSibling(),i=t.getNextSibling(),c=wn(r==="check"?o[3]==="x":void 0);if(v(i)&&i.getListType()===r){let a=i.getFirstChild();a!==null?a.insertBefore(c):i.append(c),t.remove()}else if(v(n)&&n.getListType()===r)n.append(c),t.remove();else{let a=Rn(r,r==="number"?Number(o[2]):void 0);a.append(c),t.replace(a)}c.append(...e),c.select(0,0);let s=Dn(o[1]);s&&c.setIndent(s)},Y=(r,t,e)=>{let o=[],n=r.getChildren(),i=0;for(let c of n)if(Cn(c)){if(c.getChildrenSize()===1){let l=c.getFirstChild();if(v(l)){o.push(Y(l,t,e+1));continue}}let s=" ".repeat(e*qt),a=r.getListType(),f=a==="number"?`${r.getStart()+i}. `:a==="check"?`- [${c.getChecked()?"x":" "}] `:"- ";o.push(s+f+t(c)),i++}return o.join(`
|
|
7
|
-
`)},Vt={type:"element",dependencies:[An],export:(r,t)=>{if(!Nn(r))return null;let e=Number(r.getTag().slice(1));return"#".repeat(e)+" "+t(r)},regExp:st,replace:$n(r=>{let t="h"+r[1].length;return In(t)})},Zt={type:"element",dependencies:[On],export:(r,t)=>{if(!Kt(r))return null;let e=t(r).split(`
|
|
8
|
-
`),o=[];for(let n of e)o.push("> "+n);return o.join(`
|
|
9
|
-
`)},regExp:jt,replace:(r,t,e,o)=>{if(o){let i=r.getPreviousSibling();if(Kt(i)){i.splice(i.getChildrenSize(),0,[yn(),...t]),i.select(0,0),r.remove();return}}let n=Fn();n.append(...t),r.replace(n),n.select(0,0)}},Jt={type:"element",dependencies:[at,ct],export:(r,t)=>v(r)?Y(r,t,0):null,regExp:Yt,replace:lt("bullet")},Bn={type:"element",dependencies:[at,ct],export:(r,t)=>v(r)?Y(r,t,0):null,regExp:Qt,replace:lt("check")},te={type:"element",dependencies:[at,ct],export:(r,t)=>v(r)?Y(r,t,0):null,regExp:zt,replace:lt("number")},ee={type:"text-format",format:["code"],tag:"`"},ne={type:"text-format",format:["highlight"],tag:"=="},oe={type:"text-format",format:["bold","italic"],tag:"***"},re={type:"text-format",format:["bold","italic"],intraword:!1,tag:"___"},ie={type:"text-format",format:["bold"],tag:"**"},se={type:"text-format",format:["bold"],intraword:!1,tag:"__"},ce={type:"text-format",format:["strikethrough"],tag:"~~"},ae={type:"text-format",format:["italic"],tag:"*"},le={type:"text-format",format:["italic"],intraword:!1,tag:"_"};function fe(r,t){let e=r.split(`
|
|
10
|
-
`),o=!1,n=[],i=0;for(let c=0;c<e.length;c++){let s=e[c],a=n[n.length-1];if(kn.test(s)){n.push(s);continue}if(Gt.test(s)){i===0&&(o=!0),i===1&&(o=!1),i>0&&i--,n.push(s);continue}if(bn.test(s)){o=!0,i++,n.push(s);continue}if(o){n.push(s);continue}Ut.test(s)||Ut.test(a)||!a||st.test(a)||st.test(s)||jt.test(s)||zt.test(s)||Yt.test(s)||Qt.test(s)||Mn.test(s)||Ln.test(s)||!t||Wt.test(s)||Xt.test(s)||Wt.test(a)||Xt.test(a)||Gt.test(a)?n.push(s):n[n.length-1]=a+" "+s.trim()}return n.join(`
|
|
11
|
-
`)}var Pn=[Vt,Zt,Jt,te],vn=[],Hn=[ee,oe,re,ie,se,ne,ae,le,ce],Kn=[],z=[...Pn,...vn,...Hn,...Kn];function Ir(r,t=z,e,o=!1,n=!0){let i=o?r:fe(r,n);return Dt(t,o)(i,e)}function Fr(r=z,t,e=!1){return yt(r,e)(t)}export{R as a,po as b,hr as c,Ir as d,Fr as e,j as f,ft as g,so as h,He as i,co as j,Ct as k,uo as l};
|
|
12
|
-
//# sourceMappingURL=chunk-XO6X2M3F.js.map
|