grep-components 2.17.0-GREPF-2744.2 → 2.17.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4,7 +4,7 @@ interface Props {
4
4
  title: string;
5
5
  pages: NavigationProps[];
6
6
  style?: React.CSSProperties;
7
- onPageClick: (page: NavigationProps, event: React.MouseEvent) => void;
7
+ onPageClick: (page: NavigationProps) => void;
8
8
  }
9
9
  declare const _default: React.ComponentType<Props>;
10
10
  export default _default;
@@ -8,7 +8,7 @@ export type DropdownMenuItem<T> = Omit<MenuItemProps, 'disabled'> & {
8
8
  tooltipPlacement?: TooltipPlacement;
9
9
  disabled?: BooleanFunction<T> | boolean;
10
10
  children?: Array<DropdownMenuItem<T>>;
11
- handleClick?: (context?: T, mouseEvent?: React.MouseEvent) => void;
11
+ handleClick?: (context?: T) => void;
12
12
  };
13
13
  export interface DropdownMenuProps<T> extends MenuProps {
14
14
  context?: T;
@@ -33,7 +33,7 @@ export interface GrepTableProps<T> extends Pick<TableProps, 'size' | 'stickyHead
33
33
  sortDirection?: 'desc' | 'asc';
34
34
  isRowDisabled?: (row: T) => boolean;
35
35
  onSelectedRowChange?: (row: T | null) => void;
36
- onRowClick?: (row: T, mouseEvent?: React.MouseEvent) => void;
36
+ onRowClick?: (row: T) => void;
37
37
  menuTooltip?: (row: T) => string;
38
38
  menuDisabled?: (row: T) => boolean;
39
39
  onContextIdChanged?: (row: T) => void;
@@ -3,7 +3,7 @@ import { NavigationProps } from '../AppBarNavList';
3
3
  interface Props {
4
4
  title: string;
5
5
  pages: NavigationProps[];
6
- onPageClick: (page: NavigationProps, mouseEvent: React.MouseEvent) => unknown;
6
+ onPageClick: (page: NavigationProps) => unknown;
7
7
  }
8
8
  declare const _default: React.ComponentType<Props>;
9
9
  export default _default;
@@ -3,7 +3,7 @@ import { NavigationProps } from '..';
3
3
  export interface SidebarProps {
4
4
  currentPageId?: number;
5
5
  pages: NavigationProps[];
6
- onPageClick: (page: NavigationProps, mouseEvent?: React.MouseEvent) => void;
6
+ onPageClick: (page: NavigationProps) => void;
7
7
  expandOnIcon?: boolean;
8
8
  }
9
9
  declare const Sidebar: ({ pages, onPageClick, currentPageId, expandOnIcon, }: SidebarProps) => React.JSX.Element;
package/dist/index.js CHANGED
@@ -55,7 +55,7 @@ import { HistoryPlugin } from '@lexical/react/LexicalHistoryPlugin';
55
55
  import { LexicalErrorBoundary } from '@lexical/react/LexicalErrorBoundary';
56
56
  import { OnChangePlugin } from '@lexical/react/LexicalOnChangePlugin';
57
57
  import { EditorRefPlugin } from '@lexical/react/LexicalEditorRefPlugin';
58
- import { $isElementNode, ArtificialNode__DO_NOT_USE, $createLineBreakNode, $isRootOrShadowRoot, $isBlockElementNode, isBlockDomNode, isInlineDomNode, $createParagraphNode, ElementNode, isHTMLElement as isHTMLElement$1, $applyNodeReplacement, setNodeIndentFromDOM, createCommand, FOCUS_COMMAND, COMMAND_PRIORITY_EDITOR, BLUR_COMMAND, TextNode, ParagraphNode, PASTE_COMMAND, $createTextNode, $insertNodes, LineBreakNode, RootNode, $getSelection, $isRangeSelection, $isTextNode, $isParagraphNode, SELECTION_CHANGE_COMMAND, COMMAND_PRIORITY_LOW, FORMAT_TEXT_COMMAND } from 'lexical';
58
+ import { $isElementNode, $caretFromPoint, $isExtendableTextPointCaret, $extendCaretToRange, $isChildCaret, $isDecoratorNode, $isRootNode, $getEditor, $isTokenOrSegmented, $getCharacterOffsets, $cloneWithPropertiesEphemeral, $findMatchingParent, isDOMDocumentNode, ArtificialNode__DO_NOT_USE, $createLineBreakNode, $isRootOrShadowRoot, $isBlockElementNode, isBlockDomNode, isInlineDomNode, $createParagraphNode, $getRoot, $isTextNode, getRegisteredNode, isHTMLElement as isHTMLElement$1, isDocumentFragment, $isRangeSelection, $getSelection, $createTabNode, getDOMSelection, COPY_COMMAND, COMMAND_PRIORITY_CRITICAL, SELECTION_INSERT_CLIPBOARD_NODES_COMMAND, $isTextPointCaret, $getCaretRange, $getChildCaret, $parseSerializedNode, isSelectionWithinEditor, defineExtension, safeCast, RootNode, TextNode, LineBreakNode, TabNode, ParagraphNode, $isEditorState, HISTORY_MERGE_TAG, createCommand, mergeRegister, CLICK_COMMAND, isDOMNode, $getNodeFromDOMNode, $isNodeSelection, $createNodeSelection, $setSelection, COMMAND_PRIORITY_LOW, addClassNamesToElement, removeClassNamesFromElement, CLEAR_EDITOR_COMMAND, COMMAND_PRIORITY_EDITOR, DecoratorNode, $getNodeByKey, KEY_TAB_COMMAND, $createRangeSelection, $normalizeSelection__EXPERIMENTAL, OUTDENT_CONTENT_COMMAND, INDENT_CONTENT_COMMAND, INSERT_TAB_COMMAND, $create, ElementNode, $applyNodeReplacement, setNodeIndentFromDOM, DELETE_CHARACTER_COMMAND, DELETE_WORD_COMMAND, DELETE_LINE_COMMAND, CONTROLLED_TEXT_INSERTION_COMMAND, REMOVE_TEXT_COMMAND, FORMAT_TEXT_COMMAND, FORMAT_ELEMENT_COMMAND, INSERT_LINE_BREAK_COMMAND, INSERT_PARAGRAPH_COMMAND, $insertNodes, KEY_ARROW_UP_COMMAND, $getAdjacentNode, KEY_ARROW_DOWN_COMMAND, KEY_ARROW_LEFT_COMMAND, KEY_ARROW_RIGHT_COMMAND, KEY_BACKSPACE_COMMAND, KEY_DELETE_COMMAND, KEY_ENTER_COMMAND, KEY_ESCAPE_COMMAND, DROP_COMMAND, $getNearestNodeFromDOMNode, DRAGSTART_COMMAND, DRAGOVER_COMMAND, SELECT_ALL_COMMAND, $selectAll, CUT_COMMAND, PASTE_COMMAND, isSelectionCapturedInDecoratorInput, PASTE_TAG, KEY_SPACE_COMMAND, BLUR_COMMAND, FOCUS_COMMAND, $createTextNode, $isParagraphNode, SELECTION_CHANGE_COMMAND } from 'lexical';
59
59
  import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext';
60
60
  import FormatBold from '@mui/icons-material/FormatBold';
61
61
  import FormatItalic from '@mui/icons-material/FormatItalic';
@@ -1745,17 +1745,7 @@ const DropdownMenu = ({ context, menuItems, ...menuProps }) => {
1745
1745
  return;
1746
1746
  }
1747
1747
  menuProps.onClose && menuProps.onClose(e, 'backdropClick');
1748
- handleClick && handleClick(context, e);
1749
- };
1750
- props.onMouseDown = (e) => {
1751
- // 1 = middle mouse button / wheel
1752
- if (isDisabled || e.button !== 1) {
1753
- return;
1754
- }
1755
- e.preventDefault();
1756
- e.stopPropagation();
1757
- menuProps.onClose && menuProps.onClose(e, 'backdropClick');
1758
- handleClick && handleClick(context, e);
1748
+ !isDisabled && handleClick && handleClick(context);
1759
1749
  };
1760
1750
  return (React__default.createElement(CollapsableMenuItem, { sx: isDisabled && !children ? { cursor: 'not-allowed' } : {}, level: level, id: label, disabled: isDisabled, items: children?.map(renderChild(level + 1, isDisabled)), ...props },
1761
1751
  React__default.createElement("span", { style: style }, label)));
@@ -1894,18 +1884,12 @@ const Footer = ({ items, serviceNameText, udirLink, udirLogo, }) => {
1894
1884
  const LinkList = (props) => (React__default.createElement(Box$1, { width: "100%", flexDirection: "column" },
1895
1885
  React__default.createElement(Typography$1, { style: { fontSize: 24, color: Colors.black, marginBottom: 20 } }, props.title),
1896
1886
  React__default.createElement(List$1, null, props.pages.map((page) => (React__default.createElement(Box$1, { key: page.id },
1897
- React__default.createElement(ListItemButton, { onMouseDown: (e) => {
1898
- if (e.button === 1) {
1899
- e.stopPropagation();
1900
- e.preventDefault();
1901
- }
1902
- props.onPageClick(page, e);
1903
- }, style: { padding: '12px 4px' } },
1887
+ React__default.createElement(ListItemButton, { onClick: () => props.onPageClick(page), style: { padding: '12px 4px' } },
1904
1888
  React__default.createElement(ListItemText$1, { primary: page.label, slotProps: {
1905
1889
  primary: {
1906
1890
  color: 'primary',
1907
1891
  style: { fontSize: 18 },
1908
- },
1892
+ }
1909
1893
  } }),
1910
1894
  React__default.createElement(ListItemIcon, { style: { justifyContent: 'flex-end' } },
1911
1895
  React__default.createElement(ArrowForward, { color: "primary" }))),
@@ -1930,13 +1914,7 @@ const ContainedLinkList = (props) => {
1930
1914
  return (React.createElement(Box, { className: classes.container, style: props.style },
1931
1915
  React.createElement(Typography, { className: classes.title }, props.title),
1932
1916
  React.createElement(List, { style: { padding: 0 } }, props.pages.map((page) => (React.createElement(ListItem, { divider: true, key: page.id, disablePadding: true },
1933
- React.createElement(ListItemButton, { onMouseDown: (e) => {
1934
- if (e.button === 1) {
1935
- e.preventDefault();
1936
- e.stopPropagation();
1937
- }
1938
- props.onPageClick(page, e);
1939
- } },
1917
+ React.createElement(ListItemButton, { onClick: () => props.onPageClick(page) },
1940
1918
  page.linkIcon && React.createElement(ListItemIcon, null, page.linkIcon),
1941
1919
  React.createElement(ListItemText, { primary: page.label }))))))));
1942
1920
  };
@@ -2194,9 +2172,9 @@ const GrepTable = ({ placeholderText, dropdownItems, isRowDisabled, pagination,
2194
2172
  setDropdownContext(row);
2195
2173
  setMenuAnchor(e.currentTarget);
2196
2174
  };
2197
- const _handleRowClick = useCallback((row, event) => {
2198
- const disabled = (isRowDisabled && isRowDisabled(row)) ?? false;
2199
- !disabled && onRowClick && onRowClick(row, event);
2175
+ const _handleRowClick = useCallback((row) => {
2176
+ const disabled = isRowDisabled && isRowDisabled(row);
2177
+ !disabled && onRowClick && onRowClick(row);
2200
2178
  }, [onRowClick]);
2201
2179
  const _handlePageChange = (event, newPage) => {
2202
2180
  event && event.preventDefault();
@@ -2261,12 +2239,7 @@ const GrepTable = ({ placeholderText, dropdownItems, isRowDisabled, pagination,
2261
2239
  else {
2262
2240
  setSelectedElement(e.currentTarget);
2263
2241
  if (!disableSelectOnClick) {
2264
- const me = e;
2265
- if (me.button === 1) {
2266
- e.preventDefault();
2267
- e.stopPropagation();
2268
- }
2269
- _handleRowClick(row, me);
2242
+ _handleRowClick(row);
2270
2243
  }
2271
2244
  }
2272
2245
  }, columns: rowColumns, row: row, style: getRowStyle(row, index, clickableRows, disabled), onFocus: (e) => {
@@ -3223,12 +3196,12 @@ const Sidebar = ({ pages, onPageClick, currentPageId, expandOnIcon, }) => {
3223
3196
  setExpanded([...expanded, id]);
3224
3197
  }
3225
3198
  };
3226
- const handleClick = (page, mouseEvent) => {
3199
+ const handleClick = (page) => {
3227
3200
  if (expandOnIcon) {
3228
- onPageClick(page, mouseEvent);
3201
+ onPageClick(page);
3229
3202
  }
3230
3203
  else {
3231
- page.children ? toggleExpand(page.id) : onPageClick(page, mouseEvent);
3204
+ page.children ? toggleExpand(page.id) : onPageClick(page);
3232
3205
  }
3233
3206
  };
3234
3207
  const renderItem = (page) => (React__default.createElement(React__default.Fragment, null,
@@ -3239,8 +3212,7 @@ const Sidebar = ({ pages, onPageClick, currentPageId, expandOnIcon, }) => {
3239
3212
  if (expanded.includes(page.id)) {
3240
3213
  if (expandOnIcon) {
3241
3214
  return (React__default.createElement(ExpandLess, { onClick: (e) => {
3242
- e.stopPropagation();
3243
- toggleExpand(page.id);
3215
+ e.stopPropagation(), toggleExpand(page.id);
3244
3216
  } }));
3245
3217
  }
3246
3218
  else {
@@ -3250,8 +3222,7 @@ const Sidebar = ({ pages, onPageClick, currentPageId, expandOnIcon, }) => {
3250
3222
  else {
3251
3223
  if (expandOnIcon) {
3252
3224
  return (React__default.createElement(ExpandMore, { onClick: (e) => {
3253
- e.stopPropagation();
3254
- toggleExpand(page.id);
3225
+ e.stopPropagation(), toggleExpand(page.id);
3255
3226
  } }));
3256
3227
  }
3257
3228
  else {
@@ -3263,11 +3234,11 @@ const Sidebar = ({ pages, onPageClick, currentPageId, expandOnIcon, }) => {
3263
3234
  };
3264
3235
  return (React__default.createElement(Box$1, { className: classes.container },
3265
3236
  React__default.createElement(List$1, null, pages.map((page) => (React__default.createElement("div", { key: page.id },
3266
- React__default.createElement(ListItem$1, { key: page.id, tabIndex: 0, className: classes.item, onMouseDown: (e) => handleClick(page, e), onKeyPress: keyboard.onActivation(() => handleClick(page)) },
3237
+ React__default.createElement(ListItem$1, { key: page.id, tabIndex: 0, className: classes.item, onClick: () => handleClick(page), onKeyPress: keyboard.onActivation(() => handleClick(page)) },
3267
3238
  renderItem(page),
3268
3239
  renderExpandIcon(page)),
3269
3240
  React__default.createElement(Collapse$1, { in: expanded.includes(page.id), timeout: "auto", unmountOnExit: true },
3270
- React__default.createElement(List$1, { disablePadding: true }, page.children?.map((child) => (React__default.createElement(ListItem$1, { key: child.id, style: { paddingLeft: '30px' }, tabIndex: 0, className: classes.item, onMouseDown: (e) => handleClick(child, e), onKeyPress: keyboard.onActivation(() => handleClick(child)) }, renderItem(child))))))))))));
3241
+ React__default.createElement(List$1, { disablePadding: true }, page.children?.map((child) => (React__default.createElement(ListItem$1, { key: child.id, style: { paddingLeft: '30px' }, tabIndex: 0, className: classes.item, onClick: () => handleClick(child), onKeyPress: keyboard.onActivation(() => handleClick(child)) }, renderItem(child))))))))))));
3271
3242
  };
3272
3243
 
3273
3244
  var useStyles$4 = makeStyles()(() => ({
@@ -8414,7 +8385,37 @@ const SortableTable = ({ data, onChange, ...props }) => {
8414
8385
  *
8415
8386
  */
8416
8387
 
8417
- function N(e,...t){const n=new URL("https://lexical.dev/docs/error"),o=new URLSearchParams;o.append("code",e);for(const e of t)o.append("v",e);throw n.search=o.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function A(e){if("text"===e.type)return e.offset===e.getNode().getTextContentSize();const t=e.getNode();return $isElementNode(t)||N(177),e.offset===t.getChildrenSize()}
8388
+ function K(e,...t){const n=new URL("https://lexical.dev/docs/error"),o=new URLSearchParams;o.append("code",e);for(const e of t)o.append("v",e);throw n.search=o.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}const E$1=new Map;function F$2(e){const t={};if(!e)return t;const n=e.split(";");for(const e of n)if(""!==e){const[n,o]=e.split(/:([^]+)/);n&&o&&(t[n.trim()]=o.trim());}return t}function z(e){const n=$getEditor().getElementByKey(e.getKey());if(null===n)return null;const o=n.ownerDocument.defaultView;return null===o?null:o.getComputedStyle(n)}function O$1(e){return z($isRootNode(e)?e:e.getParentOrThrow())}function A$1(e){const t=O$1(e);return null!==t&&"rtl"===t.direction}function M$1(e,t,n="self"){const o=e.getStartEndPoints();if(t.isSelected(e)&&!$isTokenOrSegmented(t)&&null!==o){const[l,r]=o,s=e.isBackward(),i=l.getNode(),c=r.getNode(),f=t.is(i),u=t.is(c);if(f||u){const[o,l]=$getCharacterOffsets(e),r=i.is(c),f=t.is(s?c:i),u=t.is(s?i:c);let d,p=0;if(r)p=o>l?l:o,d=o>l?o:l;else if(f){p=s?l:o,d=void 0;}else if(u){p=0,d=s?o:l;}const h=t.__text.slice(p,d);h!==t.__text&&("clone"===n&&(t=$cloneWithPropertiesEphemeral(t)),t.__text=h);}}return t}function _$2(e){if("text"===e.type)return e.offset===e.getNode().getTextContentSize();const t=e.getNode();return $isElementNode(t)||K(177),e.offset===t.getChildrenSize()}function $(e){const t=e.getStyle(),n=F$2(t);E$1.set(t,n);}function Q$1(e){const t=Y$1(e);return null!==t&&"vertical-rl"===t.writingMode}function Y$1(e){const t=e.anchor.getNode();return $isElementNode(t)?z(t):O$1(t)}function Z$1(e,t){let n=Q$1(e)?!t:t;te(e)&&(n=!n);const l=$caretFromPoint(e.focus,n?"previous":"next");if($isExtendableTextPointCaret(l))return false;for(const e of $extendCaretToRange(l)){if($isChildCaret(e))return !e.origin.isInline();if(!$isElementNode(e.origin)){if($isDecoratorNode(e.origin))return true;break}}return false}function ee(e,t,n,o){e.modify(t?"extend":"move",n,o);}function te(e){const t=Y$1(e);return null!==t&&"rtl"===t.direction}function ne(e,t,n){const o=te(e);let l;l=Q$1(e)||o?!n:n,ee(e,t,l,"character");}
8389
+
8390
+ /**
8391
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
8392
+ *
8393
+ * This source code is licensed under the MIT license found in the
8394
+ * LICENSE file in the root directory of this source tree.
8395
+ *
8396
+ */
8397
+
8398
+ function T$1(t,...e){const n=new URL("https://lexical.dev/docs/error"),o=new URLSearchParams;o.append("code",t);for(const t of e)o.append("v",t);throw n.search=o.toString(),Error(`Minified Lexical error #${t}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}const B$1="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement,_$1=B$1&&"documentMode"in document?document.documentMode:null;!(!B$1||!("InputEvent"in window)||_$1)&&"getTargetRanges"in new window.InputEvent("input");function yt$1(t){const e=$findMatchingParent(t,t=>$isElementNode(t)&&!t.isInline());return $isElementNode(e)||T$1(4,t.__key),e}function At$2(t,e){return null!==t&&Object.getPrototypeOf(t).constructor.name===e.name}
8399
+
8400
+ /**
8401
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
8402
+ *
8403
+ * This source code is licensed under the MIT license found in the
8404
+ * LICENSE file in the root directory of this source tree.
8405
+ *
8406
+ */
8407
+
8408
+ function m(e,n){const t=isDOMDocumentNode(n)?n.body.childNodes:n.childNodes;let l=[];const r=[];for(const n of t)if(!w.has(n.nodeName)){const t=y(n,e,r,false);null!==t&&(l=l.concat(t));}return function(e){for(const n of e)n.getNextSibling()instanceof ArtificialNode__DO_NOT_USE&&n.insertAfter($createLineBreakNode());for(const n of e){const e=n.getChildren();for(const t of e)n.insertBefore(t);n.remove();}}(r),l}function g(e,n){if("undefined"==typeof document||"undefined"==typeof window&&void 0===global.window)throw new Error("To use $generateHtmlFromNodes in headless mode please initialize a headless browser implementation such as JSDom before calling this function.");const t=document.createElement("div"),o=$getRoot().getChildren();for(let l=0;l<o.length;l++){x(e,o[l],t,n);}return t.innerHTML}function x(t,o,l,u=null){let f=null===u||o.isSelected(u);const a=$isElementNode(o)&&o.excludeFromCopy("html");let d=o;null!==u&&$isTextNode(o)&&(d=M$1(u,o,"clone"));const p=$isElementNode(d)?d.getChildren():[],h=getRegisteredNode(t,d.getType());let m;m=h&&void 0!==h.exportDOM?h.exportDOM(t,d):d.exportDOM(t);const{element:g,after:w}=m;if(!g)return false;const y=document.createDocumentFragment();for(let e=0;e<p.length;e++){const n=p[e],l=x(t,n,y,u);!f&&$isElementNode(o)&&l&&o.extractWithChild(n,u,"html")&&(f=true);}if(f&&!a){if((isHTMLElement$1(g)||isDocumentFragment(g))&&g.append(y),l.append(g),w){const e=w.call(d,g);e&&(isDocumentFragment(g)?g.replaceChildren(e):g.replaceWith(e));}}else l.append(y);return f}const w=new Set(["STYLE","SCRIPT"]);function y(e,n,o,l,i=new Map,s){let c=[];if(w.has(e.nodeName))return c;let m=null;const g=function(e,n){const{nodeName:t}=e,o=n._htmlConversions.get(t.toLowerCase());let l=null;if(void 0!==o)for(const n of o){const t=n(e);null!==t&&(null===l||(l.priority||0)<=(t.priority||0))&&(l=t);}return null!==l?l.conversion:null}(e,n),x=g?g(e):null;let b=null;if(null!==x){b=x.after;const n=x.node;if(m=Array.isArray(n)?n[n.length-1]:n,null!==m){for(const[,e]of i)if(m=e(m,s),!m)break;m&&c.push(...Array.isArray(n)?n:[m]);}null!=x.forChild&&i.set(e.nodeName,x.forChild);}const S=e.childNodes;let v=[];const N=(null==m||!$isRootOrShadowRoot(m))&&(null!=m&&$isBlockElementNode(m)||l);for(let e=0;e<S.length;e++)v.push(...y(S[e],n,o,N,new Map(i),m));return null!=b&&(v=b(v)),isBlockDomNode(e)&&(v=C(e,v,N?()=>{const e=new ArtificialNode__DO_NOT_USE;return o.push(e),e}:$createParagraphNode)),null==m?v.length>0?c=c.concat(v):isBlockDomNode(e)&&function(e){if(null==e.nextSibling||null==e.previousSibling)return false;return isInlineDomNode(e.nextSibling)&&isInlineDomNode(e.previousSibling)}(e)&&(c=c.concat($createLineBreakNode())):$isElementNode(m)&&m.append(...v),c}function C(e,n,t){const o=e.style.textAlign,l=[];let r=[];for(let e=0;e<n.length;e++){const i=n[e];if($isBlockElementNode(i))o&&!i.getFormat()&&i.setFormat(o),l.push(i);else if(r.push(i),e===n.length-1||e<n.length-1&&$isBlockElementNode(n[e+1])){const e=t();e.setFormat(o),e.append(...r),l.push(e),r=[];}}return l}
8409
+
8410
+ /**
8411
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
8412
+ *
8413
+ * This source code is licensed under the MIT license found in the
8414
+ * LICENSE file in the root directory of this source tree.
8415
+ *
8416
+ */
8417
+
8418
+ function v(t,...e){const n=new URL("https://lexical.dev/docs/error"),o=new URLSearchParams;o.append("code",t);for(const t of e)o.append("v",t);throw n.search=o.toString(),Error(`Minified Lexical error #${t}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function D(e,n=$getSelection()){return null==n&&v(166),$isRangeSelection(n)&&n.isCollapsed()||0===n.getNodes().length?"":g(e,n)}function S(t,e=$getSelection()){return null==e&&v(166),$isRangeSelection(e)&&e.isCollapsed()||0===e.getNodes().length?null:JSON.stringify(E(t,e))}function R(t,n,o){const r=t.getData("application/x-lexical-editor");if(r)try{const t=JSON.parse(r);if(t.namespace===o._config.namespace&&Array.isArray(t.nodes)){return A(o,L$1(t.nodes),n)}}catch(t){console.error(t);}const c=t.getData("text/html"),a=t.getData("text/plain");if(c&&a!==c)try{const t=(new DOMParser).parseFromString(function(t){if(window.trustedTypes&&window.trustedTypes.createPolicy){return window.trustedTypes.createPolicy("lexical",{createHTML:t=>t}).createHTML(t)}return t}(c),"text/html");return A(o,m(o,t),n)}catch(t){console.error(t);}const u=a||t.getData("text/uri-list");if(null!=u)if($isRangeSelection(n)){const t=u.split(/(\r?\n|\t)/);""===t[t.length-1]&&t.pop();for(let e=0;e<t.length;e++){const n=$getSelection();if($isRangeSelection(n)){const o=t[e];"\n"===o||"\r\n"===o?n.insertParagraph():"\t"===o?n.insertNodes([$createTabNode()]):n.insertText(o);}}}else n.insertRawText(u);}function A(t,e,n){t.dispatchCommand(SELECTION_INSERT_CLIPBOARD_NODES_COMMAND,{nodes:e,selection:n})||(n.insertNodes(e),function(t){if($isRangeSelection(t)&&t.isCollapsed()){const e=t.anchor;let n=null;const o=$caretFromPoint(e,"previous");if(o)if($isTextPointCaret(o))n=o.origin;else {const t=$getCaretRange(o,$getChildCaret($getRoot(),"next").getFlipped());for(const e of t){if($isTextNode(e.origin)){n=e.origin;break}if($isElementNode(e.origin)&&!e.origin.isInline())break}}if(n&&$isTextNode(n)){const e=n.getFormat(),o=n.getStyle();t.format===e&&t.style===o||(t.format=e,t.style=o,t.dirty=true);}}}(n));}function P(t,e,n,r=[]){let i=null===e||n.isSelected(e);const l=$isElementNode(n)&&n.excludeFromCopy("html");let s=n;null!==e&&$isTextNode(s)&&(s=M$1(e,s,"clone"));const c=$isElementNode(s)?s.getChildren():[],a=function(t){const e=t.exportJSON(),n=t.constructor;if(e.type!==n.getType()&&v(58,n.name),$isElementNode(t)){const t=e.children;Array.isArray(t)||v(59,n.name);}return e}(s);$isTextNode(s)&&0===s.getTextContentSize()&&(i=false);for(let o=0;o<c.length;o++){const r=c[o],l=P(t,e,r,a.children);!i&&$isElementNode(n)&&l&&n.extractWithChild(r,e,"clone")&&(i=true);}if(i&&!l)r.push(a);else if(Array.isArray(a.children))for(let t=0;t<a.children.length;t++){const e=a.children[t];r.push(e);}return i}function E(t,e){const n=[],o=$getRoot().getChildren();for(let r=0;r<o.length;r++){P(t,e,o[r],n);}return {namespace:t._config.namespace,nodes:n}}function L$1(t){const e=[];for(let o=0;o<t.length;o++){const r=t[o],i=$parseSerializedNode(r);$isTextNode(i)&&$(i),e.push(i);}return e}let b=null;async function F$1(t,e,n){if(null!==b)return false;if(null!==e)return new Promise((o,r)=>{t.update(()=>{o(M(t,e,n));});});const o=t.getRootElement(),i=t._window||window,l=i.document,s=getDOMSelection(i);if(null===o||null===s)return false;const c=l.createElement("span");c.style.cssText="position: fixed; top: -1000px;",c.append(l.createTextNode("#")),o.append(c);const a=new Range;return a.setStart(c,0),a.setEnd(c,1),s.removeAllRanges(),s.addRange(a),new Promise((e,o)=>{const s=t.registerCommand(COPY_COMMAND,o=>(At$2(o,ClipboardEvent)&&(s(),null!==b&&(i.clearTimeout(b),b=null),e(M(t,o,n))),true),COMMAND_PRIORITY_CRITICAL);b=i.setTimeout(()=>{s(),b=null,e(false);},50),l.execCommand("copy"),c.remove();})}function M(t,e,n){if(void 0===n){const e=getDOMSelection(t._window),o=$getSelection();if(!o||o.isCollapsed())return false;if(!e)return false;const r=e.anchorNode,l=e.focusNode;if(null!==r&&null!==l&&!isSelectionWithinEditor(t,r,l))return false;n=_(o);}e.preventDefault();const o=e.clipboardData;return null!==o&&(J$1(o,n),true)}const O=[["text/html",D],["application/x-lexical-editor",S]];function _(t=$getSelection()){const e={"text/plain":t?t.getTextContent():""};if(t){const n=$getEditor();for(const[o,r]of O){const i=r(n,t);null!==i&&(e[o]=i);}}return e}function J$1(t,e){for(const[n]of O) void 0===e[n]&&t.setData(n,"");for(const n in e){const o=e[n];void 0!==o&&t.setData(n,o);}}
8418
8419
 
8419
8420
  /**
8420
8421
  * Copyright (c) Meta Platforms, Inc. and affiliates.
@@ -8424,7 +8425,7 @@ function N(e,...t){const n=new URL("https://lexical.dev/docs/error"),o=new URLSe
8424
8425
  *
8425
8426
  */
8426
8427
 
8427
- const M="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement,R=M&&"documentMode"in document?document.documentMode:null;!(!M||!("InputEvent"in window)||R)&&"getTargetRanges"in new window.InputEvent("input");function I(...t){const e=[];for(const n of t)if(n&&"string"==typeof n)for(const[t]of n.matchAll(/\S+/g))e.push(t);return e}function j(...t){return ()=>{for(let e=t.length-1;e>=0;e--)t[e]();t.length=0;}}function rt(t,...e){const n=I(...e);n.length>0&&t.classList.add(...n);}
8428
+ const L=Symbol.for("preact-signals");function T(){if(W>1)return void W--;let t,e=false;for(;void 0!==G;){let n=G;for(G=void 0,Z++;void 0!==n;){const i=n.o;if(n.o=void 0,n.f&=-3,!(8&n.f)&&X(n))try{n.c();}catch(n){e||(t=n,e=true);}n=i;}}if(Z=0,W--,e)throw t}function B(t){if(W>0)return t();W++;try{return t()}finally{T();}}let F,G;function V(t){const e=F;F=void 0;try{return t()}finally{F=e;}}let W=0,Z=0,J=0;function H(t){if(void 0===F)return;let e=t.n;return void 0===e||e.t!==F?(e={i:0,S:t,p:F.s,n:void 0,t:F,e:void 0,x:void 0,r:e},void 0!==F.s&&(F.s.n=e),F.s=e,t.n=e,32&F.f&&t.S(e),e):-1===e.i?(e.i=0,void 0!==e.n&&(e.n.p=e.p,void 0!==e.p&&(e.p.n=e.n),e.p=F.s,e.n=void 0,F.s.n=e,F.s=e),e):void 0}function q(t,e){this.v=t,this.i=0,this.n=void 0,this.t=void 0,this.W=null==e?void 0:e.watched,this.Z=null==e?void 0:e.unwatched,this.name=null==e?void 0:e.name;}function Q(t,e){return new q(t,e)}function X(t){for(let e=t.s;void 0!==e;e=e.n)if(e.S.i!==e.i||!e.S.h()||e.S.i!==e.i)return true;return false}function Y(t){for(let e=t.s;void 0!==e;e=e.n){const n=e.S.n;if(void 0!==n&&(e.r=n),e.S.n=e,e.i=-1,void 0===e.n){t.s=e;break}}}function tt(t){let e,n=t.s;for(;void 0!==n;){const t=n.p;-1===n.i?(n.S.U(n),void 0!==t&&(t.n=n.n),void 0!==n.n&&(n.n.p=t)):e=n,n.S.n=n.r,void 0!==n.r&&(n.r=void 0),n=t;}t.s=e;}function et(t,e){q.call(this,void 0),this.x=t,this.s=void 0,this.g=J-1,this.f=4,this.W=null==e?void 0:e.watched,this.Z=null==e?void 0:e.unwatched,this.name=null==e?void 0:e.name;}function nt(t,e){return new et(t,e)}function it(t){const e=t.u;if(t.u=void 0,"function"==typeof e){W++;const n=F;F=void 0;try{e();}catch(e){throw t.f&=-2,t.f|=8,ot(t),e}finally{F=n,T();}}}function ot(t){for(let e=t.s;void 0!==e;e=e.n)e.S.U(e);t.x=void 0,t.s=void 0,it(t);}function st(t){if(F!==this)throw new Error("Out-of-order effect");tt(this),F=t,this.f&=-2,8&this.f&&ot(this),T();}function rt(t,e){this.x=t,this.u=void 0,this.s=void 0,this.o=void 0,this.f=32,this.name=null==e?void 0:e.name;}function ct(t,e){const n=new rt(t,e);try{n.c();}catch(t){throw n.d(),t}const i=n.d.bind(n);return i[Symbol.dispose]=i,i}function dt(t,e={}){const n={};for(const i in t){const o=e[i],s=Q(void 0===o?t[i]:o);n[i]=s;}return n}q.prototype.brand=L,q.prototype.h=function(){return true},q.prototype.S=function(t){const e=this.t;e!==t&&void 0===t.e&&(t.x=e,this.t=t,void 0!==e?e.e=t:V(()=>{var t;null==(t=this.W)||t.call(this);}));},q.prototype.U=function(t){if(void 0!==this.t){const e=t.e,n=t.x;void 0!==e&&(e.x=n,t.e=void 0),void 0!==n&&(n.e=e,t.x=void 0),t===this.t&&(this.t=n,void 0===n&&V(()=>{var t;null==(t=this.Z)||t.call(this);}));}},q.prototype.subscribe=function(t){return ct(()=>{const e=this.value,n=F;F=void 0;try{t(e);}finally{F=n;}},{name:"sub"})},q.prototype.valueOf=function(){return this.value},q.prototype.toString=function(){return this.value+""},q.prototype.toJSON=function(){return this.value},q.prototype.peek=function(){const t=F;F=void 0;try{return this.value}finally{F=t;}},Object.defineProperty(q.prototype,"value",{get(){const t=H(this);return void 0!==t&&(t.i=this.i),this.v},set(t){if(t!==this.v){if(Z>100)throw new Error("Cycle detected");this.v=t,this.i++,J++,W++;try{for(let t=this.t;void 0!==t;t=t.x)t.t.N();}finally{T();}}}}),et.prototype=new q,et.prototype.h=function(){if(this.f&=-3,1&this.f)return false;if(32==(36&this.f))return true;if(this.f&=-5,this.g===J)return true;if(this.g=J,this.f|=1,this.i>0&&!X(this))return this.f&=-2,true;const t=F;try{Y(this),F=this;const t=this.x();(16&this.f||this.v!==t||0===this.i)&&(this.v=t,this.f&=-17,this.i++);}catch(t){this.v=t,this.f|=16,this.i++;}return F=t,tt(this),this.f&=-2,true},et.prototype.S=function(t){if(void 0===this.t){this.f|=36;for(let t=this.s;void 0!==t;t=t.n)t.S.S(t);}q.prototype.S.call(this,t);},et.prototype.U=function(t){if(void 0!==this.t&&(q.prototype.U.call(this,t),void 0===this.t)){this.f&=-33;for(let t=this.s;void 0!==t;t=t.n)t.S.U(t);}},et.prototype.N=function(){if(!(2&this.f)){this.f|=6;for(let t=this.t;void 0!==t;t=t.x)t.t.N();}},Object.defineProperty(et.prototype,"value",{get(){if(1&this.f)throw new Error("Cycle detected");const t=H(this);if(this.h(),void 0!==t&&(t.i=this.i),16&this.f)throw this.v;return this.v}}),rt.prototype.c=function(){const t=this.S();try{if(8&this.f)return;if(void 0===this.x)return;const t=this.x();"function"==typeof t&&(this.u=t);}finally{t();}},rt.prototype.S=function(){if(1&this.f)throw new Error("Cycle detected");this.f|=1,this.f&=-9,it(this),Y(this),W++;const t=F;return F=this,st.bind(this,t)},rt.prototype.N=function(){2&this.f||(this.f|=2,this.o=G,G=this);},rt.prototype.d=function(){this.f|=8,1&this.f||ot(this);},rt.prototype.dispose=function(){this.d();};defineExtension({build:(t,e,n)=>dt(e),config:safeCast({defaultSelection:"rootEnd",disabled:false}),name:"@lexical/extension/AutoFocus",register(t,e,n){const i=n.getOutput();return ct(()=>i.disabled.value?void 0:t.registerRootListener(e=>{t.focus(()=>{const t=document.activeElement;null===e||null!==t&&e.contains(t)||e.focus({preventScroll:true});},{defaultSelection:i.defaultSelection.peek()});}))}});function ft(){const t=$getRoot(),e=$getSelection(),n=$createParagraphNode();t.clear(),t.append(n),null!==e&&n.select(),$isRangeSelection(e)&&(e.format=0);}function ut(t,e=ft){return t.registerCommand(CLEAR_EDITOR_COMMAND,n=>(t.update(e),true),COMMAND_PRIORITY_EDITOR)}defineExtension({build:(t,e,n)=>dt(e),config:safeCast({$onClear:ft}),name:"@lexical/extension/ClearEditor",register(t,e,n){const{$onClear:i}=n.getOutput();return ct(()=>ut(t,i.value))}});function pt$1(t,e){let n;return Q(t(),{unwatched(){n&&(n(),n=void 0);},watched(){this.value=t(),n=e(this);}})}const mt=defineExtension({build:t=>pt$1(()=>t.getEditorState(),e=>t.registerUpdateListener(t=>{e.value=t.editorState;})),name:"@lexical/extension/EditorState"});const jt={tag:HISTORY_MERGE_TAG};function At$1(){const t=$getRoot();t.isEmpty()&&t.append($createParagraphNode());}defineExtension({config:safeCast({setOptions:jt,updateOptions:jt}),init:({$initialEditorState:t=At$1})=>({$initialEditorState:t,initialized:false}),afterRegistration(t,{updateOptions:e,setOptions:n},i){const o=i.getInitResult();if(!o.initialized){o.initialized=true;const{$initialEditorState:i}=o;if($isEditorState(i))t.setEditorState(i,n);else if("function"==typeof i)t.update(()=>{i(t);},e);else if(i&&("string"==typeof i||"object"==typeof i)){const e=t.parseEditorState(i);t.setEditorState(e,n);}}return ()=>{}},name:"@lexical/extension/InitialState",nodes:[RootNode,TextNode,LineBreakNode,TabNode,ParagraphNode]});const Vt=new Set,Wt=defineExtension({build(t,e,n){const i=n.getDependency(mt).output,o=Q({watchedNodeKeys:new Map}),r=pt$1(()=>{},()=>ct(()=>{const t=r.peek(),{watchedNodeKeys:e}=o.value;let n,c=false;i.value.read(()=>{if($getSelection())for(const[i,o]of e.entries()){if(0===o.size){e.delete(i);continue}const s=$getNodeByKey(i),r=s&&s.isSelected()||false;c=c||r!==(!!t&&t.has(i)),r&&(n=n||new Set,n.add(i));}}),!c&&n&&t&&n.size===t.size||(r.value=n);}));return {watchNodeKey:function(t){const e=nt(()=>(r.value||Vt).has(t)),{watchedNodeKeys:n}=o.peek();let i=n.get(t);const s=void 0!==i;return i=i||new Set,i.add(e),s||(n.set(t,i),o.value={watchedNodeKeys:n}),e}}},dependencies:[mt],name:"@lexical/extension/NodeSelection"});createCommand("INSERT_HORIZONTAL_RULE_COMMAND");let Jt$1 = class Jt extends DecoratorNode{static getType(){return "horizontalrule"}static clone(t){return new Jt(t.__key)}static importJSON(t){return qt().updateFromJSON(t)}static importDOM(){return {hr:()=>({conversion:Ht,priority:0})}}exportDOM(){return {element:document.createElement("hr")}}createDOM(t){const e=document.createElement("hr");return addClassNamesToElement(e,t.theme.hr),e}getTextContent(){return "\n"}isInline(){return false}updateDOM(){return false}};function Ht(){return {node:qt()}}function qt(){return $create(Jt$1)}function Qt(t){return t instanceof Jt$1}defineExtension({dependencies:[mt,Wt],name:"@lexical/extension/HorizontalRule",nodes:()=>[Jt$1],register(t,e,n){const{watchNodeKey:i}=n.getDependency(Wt).output,o=Q({nodeSelections:new Map}),r=t._config.theme.hrSelected??"selected";return mergeRegister(t.registerCommand(CLICK_COMMAND,t=>{if(isDOMNode(t.target)){const e=$getNodeFromDOMNode(t.target);if(Qt(e))return function(t,e=false){const n=$getSelection(),i=t.isSelected(),o=t.getKey();let r;e&&$isNodeSelection(n)?r=n:(r=$createNodeSelection(),$setSelection(r)),i?r.delete(o):r.add(o);}(e,t.shiftKey),true}return false},COMMAND_PRIORITY_LOW),t.registerMutationListener(Jt$1,(e,n)=>{B(()=>{let n=!1;const{nodeSelections:s}=o.peek();for(const[o,r]of e.entries())if("destroyed"===r)s.delete(o),n=!0;else {const e=s.get(o),r=t.getElementByKey(o);e?e.domNode.value=r:(n=!0,s.set(o,{domNode:Q(r),selectedSignal:i(o)}));}n&&(o.value={nodeSelections:s});});}),ct(()=>{const t=[];for(const{domNode:e,selectedSignal:n}of o.value.nodeSelections.values())t.push(ct(()=>{const t=e.value;if(t){n.value?addClassNamesToElement(t,r):removeClassNamesFromElement(t,r);}}));return mergeRegister(...t)}))}});function Yt(t,e){return mergeRegister(t.registerCommand(KEY_TAB_COMMAND,e=>{const n=$getSelection();if(!$isRangeSelection(n))return false;e.preventDefault();const i=function(t){if(t.getNodes().filter(t=>$isBlockElementNode(t)&&t.canIndent()).length>0)return true;const e=t.anchor,n=t.focus,i=n.isBefore(e)?n:e,o=i.getNode(),s=yt$1(o);if(s.canIndent()){const t=s.getKey();let e=$createRangeSelection();if(e.anchor.set(t,0,"element"),e.focus.set(t,0,"element"),e=$normalizeSelection__EXPERIMENTAL(e),e.anchor.is(i))return true}return false}(n)?e.shiftKey?OUTDENT_CONTENT_COMMAND:INDENT_CONTENT_COMMAND:INSERT_TAB_COMMAND;return t.dispatchCommand(i,void 0)},COMMAND_PRIORITY_EDITOR),t.registerCommand(INDENT_CONTENT_COMMAND,()=>{const t="number"==typeof e?e:e?e.peek():null;if(null==t)return false;const n=$getSelection();if(!$isRangeSelection(n))return false;const i=n.getNodes().map(t=>yt$1(t).getIndent());return Math.max(...i)+1>=t},COMMAND_PRIORITY_CRITICAL))}defineExtension({build:(t,e,n)=>dt(e),config:safeCast({disabled:false,maxIndent:null}),name:"@lexical/extension/TabIndentation",register(t,e,n){const{disabled:i,maxIndent:o}=n.getOutput();return ct(()=>{if(!i.value)return Yt(t,o)})}});
8428
8429
 
8429
8430
  /**
8430
8431
  * Copyright (c) Meta Platforms, Inc. and affiliates.
@@ -8434,7 +8435,7 @@ const M="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.do
8434
8435
  *
8435
8436
  */
8436
8437
 
8437
- function m(e,n){const t=n.body?n.body.childNodes:[];let o=[];const l=[];for(let n=0;n<t.length;n++){const r=t[n];if(!y.has(r.nodeName)){const n=w(r,e,l,false);null!==n&&(o=o.concat(n));}}return function(e){for(const n of e)n.getNextSibling()instanceof ArtificialNode__DO_NOT_USE&&n.insertAfter($createLineBreakNode());for(const n of e){const e=n.getChildren();for(const t of e)n.insertBefore(t);n.remove();}}(l),o}const y=new Set(["STYLE","SCRIPT"]);function w(e,n,o,r,i=new Map,s){let c=[];if(y.has(e.nodeName))return c;let m=null;const g=function(e,n){const{nodeName:t}=e,o=n._htmlConversions.get(t.toLowerCase());let l=null;if(void 0!==o)for(const n of o){const t=n(e);null!==t&&(null===l||(l.priority||0)<=(t.priority||0))&&(l=t);}return null!==l?l.conversion:null}(e,n),x=g?g(e):null;let C=null;if(null!==x){C=x.after;const n=x.node;if(m=Array.isArray(n)?n[n.length-1]:n,null!==m){for(const[,e]of i)if(m=e(m,s),!m)break;m&&c.push(...Array.isArray(n)?n:[m]);}null!=x.forChild&&i.set(e.nodeName,x.forChild);}const S=e.childNodes;let v=[];const N=(null==m||!$isRootOrShadowRoot(m))&&(null!=m&&$isBlockElementNode(m)||r);for(let e=0;e<S.length;e++)v.push(...w(S[e],n,o,N,new Map(i),m));return null!=C&&(v=C(v)),isBlockDomNode(e)&&(v=b(e,v,N?()=>{const e=new ArtificialNode__DO_NOT_USE;return o.push(e),e}:$createParagraphNode)),null==m?v.length>0?c=c.concat(v):isBlockDomNode(e)&&function(e){if(null==e.nextSibling||null==e.previousSibling)return false;return isInlineDomNode(e.nextSibling)&&isInlineDomNode(e.previousSibling)}(e)&&(c=c.concat($createLineBreakNode())):$isElementNode(m)&&m.append(...v),c}function b(e,n,t){const o=e.style.textAlign,l=[];let r=[];for(let e=0;e<n.length;e++){const i=n[e];if($isBlockElementNode(i))o&&!i.getFormat()&&i.setFormat(o),l.push(i);else if(r.push(i),e===n.length-1||e<n.length-1&&$isBlockElementNode(n[e+1])){const e=t();e.setFormat(o),e.append(...r),l.push(e),r=[];}}return l}
8438
+ function s(e){const t=window.location.origin,n=n=>{if(n.origin!==t)return;const o=e.getRootElement();if(document.activeElement!==o)return;const s=n.data;if("string"==typeof s){let t;try{t=JSON.parse(s);}catch(e){return}if(t&&"nuanria_messaging"===t.protocol&&"request"===t.type){const o=t.payload;if(o&&"makeChanges"===o.functionId){const t=o.args;if(t){const[o,s,d,c,g]=t;e.update(()=>{const e=$getSelection();if($isRangeSelection(e)){const t=e.anchor;let i=t.getNode(),a=0,l=0;if($isTextNode(i)&&o>=0&&s>=0&&(a=o,l=o+s,e.setTextNodeRange(i,a,i,l)),a===l&&""===d||(e.insertRawText(d),i=t.getNode()),$isTextNode(i)){a=c,l=c+g;const t=i.getTextContentSize();a=a>t?t:a,l=l>t?t:l,e.setTextNodeRange(i,a,i,l);}n.stopImmediatePropagation();}});}}}}};return window.addEventListener("message",n,true),()=>{window.removeEventListener("message",n,true);}}const d=defineExtension({build:(e,n,o)=>dt(n),config:safeCast({disabled:"undefined"==typeof window}),name:"@lexical/dragon",register:(t,n,o)=>ct(()=>o.getOutput().disabled.value?void 0:s(t))});
8438
8439
 
8439
8440
  /**
8440
8441
  * Copyright (c) Meta Platforms, Inc. and affiliates.
@@ -8444,7 +8445,7 @@ function m(e,n){const t=n.body?n.body.childNodes:[];let o=[];const l=[];for(let
8444
8445
  *
8445
8446
  */
8446
8447
 
8447
- const ft="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement,gt=ft&&"documentMode"in document?document.documentMode:null;!(!ft||!("InputEvent"in window)||gt)&&"getTargetRanges"in new window.InputEvent("input");createCommand("DRAG_DROP_PASTE_FILE");class Et extends ElementNode{static getType(){return "heading"}static clone(t){return new Et(t.__tag,t.__key)}constructor(t,e){super(e),this.__tag=t;}getTag(){return this.__tag}setTag(t){const e=this.getWritable();return this.__tag=t,e}createDOM(t){const e=this.__tag,n=document.createElement(e),r=t.theme.heading;if(void 0!==r){const t=r[e];rt(n,t);}return n}updateDOM(t,e,n){return t.__tag!==this.__tag}static importDOM(){return {h1:t=>({conversion:Tt,priority:0}),h2:t=>({conversion:Tt,priority:0}),h3:t=>({conversion:Tt,priority:0}),h4:t=>({conversion:Tt,priority:0}),h5:t=>({conversion:Tt,priority:0}),h6:t=>({conversion:Tt,priority:0}),p:t=>{const e=t.firstChild;return null!==e&&Ot(e)?{conversion:()=>({node:null}),priority:3}:null},span:t=>Ot(t)?{conversion:t=>({node:At("h1")}),priority:3}:null}}exportDOM(t){const{element:e}=super.exportDOM(t);if(isHTMLElement$1(e)){this.isEmpty()&&e.append(document.createElement("br"));const t=this.getFormatType();t&&(e.style.textAlign=t);const n=this.getDirection();n&&(e.dir=n);}return {element:e}}static importJSON(t){return At(t.tag).updateFromJSON(t)}updateFromJSON(t){return super.updateFromJSON(t).setTag(t.tag)}exportJSON(){return {...super.exportJSON(),tag:this.getTag()}}insertNewAfter(t,e=true){const n=t?t.anchor.offset:0,r=this.getLastDescendant(),o=!r||t&&t.anchor.key===r.getKey()&&n===r.getTextContentSize()||!t?$createParagraphNode():At(this.getTag()),i=this.getDirection();if(o.setDirection(i),this.insertAfter(o,e),0===n&&!this.isEmpty()&&t){const t=$createParagraphNode();t.select(),this.replace(t,true);}return o}collapseAtStart(){const t=this.isEmpty()?$createParagraphNode():At(this.getTag());return this.getChildren().forEach((e=>t.append(e))),this.replace(t),true}extractWithChild(){return true}}function Ot(t){return "span"===t.nodeName.toLowerCase()&&"26pt"===t.style.fontSize}function Tt(t){const e=t.nodeName.toLowerCase();let n=null;return "h1"!==e&&"h2"!==e&&"h3"!==e&&"h4"!==e&&"h5"!==e&&"h6"!==e||(n=At(e),null!==t.style&&(setNodeIndentFromDOM(t,n),n.setFormat(t.style.textAlign))),{node:n}}function At(t="h1"){return $applyNodeReplacement(new Et(t))}
8448
+ function gt(t,e){if(void 0!==document.caretRangeFromPoint){const n=document.caretRangeFromPoint(t,e);return null===n?null:{node:n.startContainer,offset:n.startOffset}}if("undefined"!==document.caretPositionFromPoint){const n=document.caretPositionFromPoint(t,e);return null===n?null:{node:n.offsetNode,offset:n.offset}}return null}const pt="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement,ht=pt&&"documentMode"in document?document.documentMode:null,vt=pt&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),Ct=!(!pt||!("InputEvent"in window)||ht)&&"getTargetRanges"in new window.InputEvent("input"),yt=pt&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),xt=pt&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,Dt=pt&&/^(?=.*Chrome).*/i.test(navigator.userAgent),Nt=pt&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&vt&&!Dt,wt=createCommand("DRAG_DROP_PASTE_FILE");class Et extends ElementNode{static getType(){return "quote"}static clone(t){return new Et(t.__key)}createDOM(t){const e=document.createElement("blockquote");return addClassNamesToElement(e,t.theme.quote),e}updateDOM(t,e){return false}static importDOM(){return {blockquote:t=>({conversion:Ft,priority:0})}}exportDOM(t){const{element:e}=super.exportDOM(t);if(isHTMLElement$1(e)){this.isEmpty()&&e.append(document.createElement("br"));const t=this.getFormatType();t&&(e.style.textAlign=t);const n=this.getDirection();n&&(e.dir=n);}return {element:e}}static importJSON(t){return _t().updateFromJSON(t)}insertNewAfter(t,e){const n=$createParagraphNode(),r=this.getDirection();return n.setDirection(r),this.insertAfter(n,e),n}collapseAtStart(){const t=$createParagraphNode();return this.getChildren().forEach(e=>t.append(e)),this.replace(t),true}canMergeWhenEmpty(){return true}}function _t(){return $applyNodeReplacement(new Et)}class Pt extends ElementNode{__tag;static getType(){return "heading"}static clone(t){return new Pt(t.__tag,t.__key)}constructor(t,e){super(e),this.__tag=t;}getTag(){return this.__tag}setTag(t){const e=this.getWritable();return this.__tag=t,e}createDOM(t){const e=this.__tag,n=document.createElement(e),r=t.theme.heading;if(void 0!==r){const t=r[e];addClassNamesToElement(n,t);}return n}updateDOM(t,e,n){return t.__tag!==this.__tag}static importDOM(){return {h1:t=>({conversion:At,priority:0}),h2:t=>({conversion:At,priority:0}),h3:t=>({conversion:At,priority:0}),h4:t=>({conversion:At,priority:0}),h5:t=>({conversion:At,priority:0}),h6:t=>({conversion:At,priority:0}),p:t=>{const e=t.firstChild;return null!==e&&Tt(e)?{conversion:()=>({node:null}),priority:3}:null},span:t=>Tt(t)?{conversion:t=>({node:St("h1")}),priority:3}:null}}exportDOM(t){const{element:e}=super.exportDOM(t);if(isHTMLElement$1(e)){this.isEmpty()&&e.append(document.createElement("br"));const t=this.getFormatType();t&&(e.style.textAlign=t);const n=this.getDirection();n&&(e.dir=n);}return {element:e}}static importJSON(t){return St(t.tag).updateFromJSON(t)}updateFromJSON(t){return super.updateFromJSON(t).setTag(t.tag)}exportJSON(){return {...super.exportJSON(),tag:this.getTag()}}insertNewAfter(t,e=true){const n=t?t.anchor.offset:0,r=this.getLastDescendant(),o=!r||t&&t.anchor.key===r.getKey()&&n===r.getTextContentSize()||!t?$createParagraphNode():St(this.getTag()),i=this.getDirection();if(o.setDirection(i),this.insertAfter(o,e),0===n&&!this.isEmpty()&&t){const t=$createParagraphNode();t.select(),this.replace(t,true);}return o}collapseAtStart(){const t=this.isEmpty()?$createParagraphNode():St(this.getTag());return this.getChildren().forEach(e=>t.append(e)),this.replace(t),true}extractWithChild(){return true}}function Tt(t){return "span"===t.nodeName.toLowerCase()&&"26pt"===t.style.fontSize}function At(t){const e=t.nodeName.toLowerCase();let n=null;return "h1"!==e&&"h2"!==e&&"h3"!==e&&"h4"!==e&&"h5"!==e&&"h6"!==e||(n=St(e),null!==t.style&&(setNodeIndentFromDOM(t,n),n.setFormat(t.style.textAlign))),{node:n}}function Ft(t){const e=_t();return null!==t.style&&(e.setFormat(t.style.textAlign),setNodeIndentFromDOM(t,e)),{node:e}}function St(t="h1"){return $applyNodeReplacement(new Pt(t))}function Mt(t){let e=null;if(At$2(t,DragEvent)?e=t.dataTransfer:At$2(t,ClipboardEvent)&&(e=t.clipboardData),null===e)return [false,[],false];const n=e.types,r=n.includes("Files"),o=n.includes("text/html")||n.includes("text/plain");return [r,Array.from(e.files),o]}function bt(t){const e=$getSelection();if(!$isRangeSelection(e))return false;const n=new Set,r=e.getNodes();for(let e=0;e<r.length;e++){const o=r[e],i=o.getKey();if(n.has(i))continue;const s=$findMatchingParent(o,t=>$isElementNode(t)&&!t.isInline());if(null===s)continue;const c=s.getKey();s.canIndent()&&!n.has(c)&&(n.add(c),t(s));}return n.size>0}function Kt(t){const e=$getNearestNodeFromDOMNode(t);return $isDecoratorNode(e)}function kt(t){for(const e of ["lowercase","uppercase","capitalize"])t.hasFormat(e)&&t.toggleFormat(e);}function Jt(n){return mergeRegister(n.registerCommand(CLICK_COMMAND,t=>{const e=$getSelection();return !!$isNodeSelection(e)&&(e.clear(),true)},COMMAND_PRIORITY_EDITOR),n.registerCommand(DELETE_CHARACTER_COMMAND,t=>{const e=$getSelection();return $isRangeSelection(e)?(e.deleteCharacter(t),true):!!$isNodeSelection(e)&&(e.deleteNodes(),true)},COMMAND_PRIORITY_EDITOR),n.registerCommand(DELETE_WORD_COMMAND,t=>{const e=$getSelection();return !!$isRangeSelection(e)&&(e.deleteWord(t),true)},COMMAND_PRIORITY_EDITOR),n.registerCommand(DELETE_LINE_COMMAND,t=>{const e=$getSelection();return !!$isRangeSelection(e)&&(e.deleteLine(t),true)},COMMAND_PRIORITY_EDITOR),n.registerCommand(CONTROLLED_TEXT_INSERTION_COMMAND,e=>{const r=$getSelection();if("string"==typeof e)null!==r&&r.insertText(e);else {if(null===r)return false;const o=e.dataTransfer;if(null!=o)R(o,r,n);else if($isRangeSelection(r)){const t=e.data;return t&&r.insertText(t),true}}return true},COMMAND_PRIORITY_EDITOR),n.registerCommand(REMOVE_TEXT_COMMAND,()=>{const t=$getSelection();return !!$isRangeSelection(t)&&(t.removeText(),true)},COMMAND_PRIORITY_EDITOR),n.registerCommand(FORMAT_TEXT_COMMAND,t=>{const e=$getSelection();return !!$isRangeSelection(e)&&(e.formatText(t),true)},COMMAND_PRIORITY_EDITOR),n.registerCommand(FORMAT_ELEMENT_COMMAND,t=>{const e=$getSelection();if(!$isRangeSelection(e)&&!$isNodeSelection(e))return false;const n=e.getNodes();for(const e of n){const n=$findMatchingParent(e,t=>$isElementNode(t)&&!t.isInline());null!==n&&n.setFormat(t);}return true},COMMAND_PRIORITY_EDITOR),n.registerCommand(INSERT_LINE_BREAK_COMMAND,t=>{const e=$getSelection();return !!$isRangeSelection(e)&&(e.insertLineBreak(t),true)},COMMAND_PRIORITY_EDITOR),n.registerCommand(INSERT_PARAGRAPH_COMMAND,()=>{const t=$getSelection();return !!$isRangeSelection(t)&&(t.insertParagraph(),true)},COMMAND_PRIORITY_EDITOR),n.registerCommand(INSERT_TAB_COMMAND,()=>($insertNodes([$createTabNode()]),true),COMMAND_PRIORITY_EDITOR),n.registerCommand(INDENT_CONTENT_COMMAND,()=>bt(t=>{const e=t.getIndent();t.setIndent(e+1);}),COMMAND_PRIORITY_EDITOR),n.registerCommand(OUTDENT_CONTENT_COMMAND,()=>bt(t=>{const e=t.getIndent();e>0&&t.setIndent(Math.max(0,e-1));}),COMMAND_PRIORITY_EDITOR),n.registerCommand(KEY_ARROW_UP_COMMAND,t=>{const e=$getSelection();if($isNodeSelection(e)){const n=e.getNodes();if(n.length>0)return t.preventDefault(),n[0].selectPrevious(),true}else if($isRangeSelection(e)){const n=$getAdjacentNode(e.focus,true);if(!t.shiftKey&&$isDecoratorNode(n)&&!n.isIsolated()&&!n.isInline())return n.selectPrevious(),t.preventDefault(),true}return false},COMMAND_PRIORITY_EDITOR),n.registerCommand(KEY_ARROW_DOWN_COMMAND,t=>{const e=$getSelection();if($isNodeSelection(e)){const n=e.getNodes();if(n.length>0)return t.preventDefault(),n[0].selectNext(0,0),true}else if($isRangeSelection(e)){if(function(t){const e=t.focus;return "root"===e.key&&e.offset===$getRoot().getChildrenSize()}(e))return t.preventDefault(),true;const n=$getAdjacentNode(e.focus,false);if(!t.shiftKey&&$isDecoratorNode(n)&&!n.isIsolated()&&!n.isInline())return n.selectNext(),t.preventDefault(),true}return false},COMMAND_PRIORITY_EDITOR),n.registerCommand(KEY_ARROW_LEFT_COMMAND,t=>{const e=$getSelection();if($isNodeSelection(e)){const n=e.getNodes();if(n.length>0)return t.preventDefault(),A$1(n[0])?n[0].selectNext(0,0):n[0].selectPrevious(),true}if(!$isRangeSelection(e))return false;if(Z$1(e,true)){const n=t.shiftKey;return t.preventDefault(),ne(e,n,true),true}return false},COMMAND_PRIORITY_EDITOR),n.registerCommand(KEY_ARROW_RIGHT_COMMAND,t=>{const e=$getSelection();if($isNodeSelection(e)){const n=e.getNodes();if(n.length>0)return t.preventDefault(),A$1(n[0])?n[0].selectPrevious():n[0].selectNext(0,0),true}if(!$isRangeSelection(e))return false;const n=t.shiftKey;return !!Z$1(e,false)&&(t.preventDefault(),ne(e,n,false),true)},COMMAND_PRIORITY_EDITOR),n.registerCommand(KEY_BACKSPACE_COMMAND,t=>{if(Kt(t.target))return false;const e=$getSelection();if($isRangeSelection(e)){if(function(t){if(!t.isCollapsed())return false;const{anchor:e}=t;if(0!==e.offset)return false;const n=e.getNode();if($isRootNode(n))return false;const r=yt$1(n);return r.getIndent()>0&&(r.is(n)||n.is(r.getFirstDescendant()))}(e))return t.preventDefault(),n.dispatchCommand(OUTDENT_CONTENT_COMMAND,void 0);if(xt&&"ko-KR"===navigator.language)return false}else if(!$isNodeSelection(e))return false;return t.preventDefault(),n.dispatchCommand(DELETE_CHARACTER_COMMAND,true)},COMMAND_PRIORITY_EDITOR),n.registerCommand(KEY_DELETE_COMMAND,t=>{if(Kt(t.target))return false;const e=$getSelection();return !(!$isRangeSelection(e)&&!$isNodeSelection(e))&&(t.preventDefault(),n.dispatchCommand(DELETE_CHARACTER_COMMAND,false))},COMMAND_PRIORITY_EDITOR),n.registerCommand(KEY_ENTER_COMMAND,t=>{const e=$getSelection();if(!$isRangeSelection(e))return false;if(kt(e),null!==t){if((xt||yt||Nt)&&Ct)return false;if(t.preventDefault(),t.shiftKey)return n.dispatchCommand(INSERT_LINE_BREAK_COMMAND,false)}return n.dispatchCommand(INSERT_PARAGRAPH_COMMAND,void 0)},COMMAND_PRIORITY_EDITOR),n.registerCommand(KEY_ESCAPE_COMMAND,()=>{const t=$getSelection();return !!$isRangeSelection(t)&&(n.blur(),true)},COMMAND_PRIORITY_EDITOR),n.registerCommand(DROP_COMMAND,t=>{const[,e]=Mt(t);if(e.length>0){const r=gt(t.clientX,t.clientY);if(null!==r){const{offset:t,node:o}=r,i=$getNearestNodeFromDOMNode(o);if(null!==i){const e=$createRangeSelection();if($isTextNode(i))e.anchor.set(i.getKey(),t,"text"),e.focus.set(i.getKey(),t,"text");else {const t=i.getParentOrThrow().getKey(),n=i.getIndexWithinParent()+1;e.anchor.set(t,n,"element"),e.focus.set(t,n,"element");}const n=$normalizeSelection__EXPERIMENTAL(e);$setSelection(n);}n.dispatchCommand(wt,e);}return t.preventDefault(),true}const r=$getSelection();return !!$isRangeSelection(r)},COMMAND_PRIORITY_EDITOR),n.registerCommand(DRAGSTART_COMMAND,t=>{const[e]=Mt(t),n=$getSelection();return !(e&&!$isRangeSelection(n))},COMMAND_PRIORITY_EDITOR),n.registerCommand(DRAGOVER_COMMAND,t=>{const[e]=Mt(t),n=$getSelection();if(e&&!$isRangeSelection(n))return false;const r=gt(t.clientX,t.clientY);if(null!==r){const e=$getNearestNodeFromDOMNode(r.node);$isDecoratorNode(e)&&t.preventDefault();}return true},COMMAND_PRIORITY_EDITOR),n.registerCommand(SELECT_ALL_COMMAND,()=>($selectAll(),true),COMMAND_PRIORITY_EDITOR),n.registerCommand(COPY_COMMAND,t=>(F$1(n,At$2(t,ClipboardEvent)?t:null),true),COMMAND_PRIORITY_EDITOR),n.registerCommand(CUT_COMMAND,t=>(async function(t,n){await F$1(n,At$2(t,ClipboardEvent)?t:null),n.update(()=>{const t=$getSelection();$isRangeSelection(t)?t.removeText():$isNodeSelection(t)&&t.getNodes().forEach(t=>t.remove());});}(t,n),true),COMMAND_PRIORITY_EDITOR),n.registerCommand(PASTE_COMMAND,e=>{const[,r,o]=Mt(e);if(r.length>0&&!o)return n.dispatchCommand(wt,r),true;if(isDOMNode(e.target)&&isSelectionCapturedInDecoratorInput(e.target))return false;return null!==$getSelection()&&(function(e,n){e.preventDefault(),n.update(()=>{const r=$getSelection(),o=At$2(e,InputEvent)||At$2(e,KeyboardEvent)?null:e.clipboardData;null!=o&&null!==r&&R(o,r,n);},{tag:PASTE_TAG});}(e,n),true)},COMMAND_PRIORITY_EDITOR),n.registerCommand(KEY_SPACE_COMMAND,t=>{const e=$getSelection();return $isRangeSelection(e)&&kt(e),false},COMMAND_PRIORITY_EDITOR),n.registerCommand(KEY_TAB_COMMAND,t=>{const e=$getSelection();return $isRangeSelection(e)&&kt(e),false},COMMAND_PRIORITY_EDITOR))}defineExtension({conflictsWith:["@lexical/plain-text"],dependencies:[d],name:"@lexical/rich-text",nodes:()=>[Pt,Et],register:Jt});
8448
8449
 
8449
8450
  const useEditorStyles = makeStyles()((theme, { hasFocus, hasContent, readOnly, hasCustomToolbar }) => ({
8450
8451
  root: {
@@ -8541,7 +8542,7 @@ function StyleWrapperPlugin({ showCharcount, helperText, readOnly, classes, labe
8541
8542
  });
8542
8543
  const [charCount, setCharCount] = useState(0);
8543
8544
  useEffect(() => {
8544
- return j(editor.registerCommand(BLUR_COMMAND, () => {
8545
+ return mergeRegister(editor.registerCommand(BLUR_COMMAND, () => {
8545
8546
  setFocused(editor.getRootElement() === document.activeElement);
8546
8547
  return false;
8547
8548
  }, COMMAND_PRIORITY_EDITOR), editor.registerCommand(FOCUS_COMMAND, () => {
@@ -8623,7 +8624,7 @@ const htmlExportMap = new Map([
8623
8624
  },
8624
8625
  ],
8625
8626
  [
8626
- Et,
8627
+ Pt,
8627
8628
  (editor, node) => {
8628
8629
  const headingNode = node;
8629
8630
  const element = headingNode.createDOM(editor._config);
@@ -8687,7 +8688,7 @@ function ModifyPastePlugin({ blockPasting, stripPastedStyles, }) {
8687
8688
  function PreventNewlinesPlugin({ disableNewlines, }) {
8688
8689
  const [editor] = useLexicalComposerContext();
8689
8690
  if (disableNewlines) {
8690
- j(editor.registerNodeTransform(RootNode, (rootNode) => {
8691
+ mergeRegister(editor.registerNodeTransform(RootNode, (rootNode) => {
8691
8692
  if (rootNode.getChildrenSize() <= 1)
8692
8693
  return;
8693
8694
  rootNode.getLastChild()?.remove();
@@ -8798,10 +8799,10 @@ function getSelectedNode(selection) {
8798
8799
  }
8799
8800
  const isBackward = selection.isBackward();
8800
8801
  if (isBackward) {
8801
- return A(focus) ? anchorNode : focusNode;
8802
+ return _$2(focus) ? anchorNode : focusNode;
8802
8803
  }
8803
8804
  else {
8804
- return A(anchor) ? anchorNode : focusNode;
8805
+ return _$2(anchor) ? anchorNode : focusNode;
8805
8806
  }
8806
8807
  }
8807
8808
 
@@ -8886,7 +8887,7 @@ function TextFormatFloatingToolbar({ editor, anchorElem, isBold, isItalic, butto
8886
8887
  editor.getEditorState().read(() => {
8887
8888
  updateTextFormatFloatingToolbar();
8888
8889
  });
8889
- return j(editor.registerUpdateListener(({ editorState }) => {
8890
+ return mergeRegister(editor.registerUpdateListener(({ editorState }) => {
8890
8891
  editorState.read(() => {
8891
8892
  updateTextFormatFloatingToolbar();
8892
8893
  });
@@ -8952,7 +8953,7 @@ function useFloatingTextFormatToolbar(editor, anchorElem, buttons, CustomToolbar
8952
8953
  };
8953
8954
  }, [updatePopup]);
8954
8955
  useEffect(() => {
8955
- return j(editor.registerUpdateListener(() => {
8956
+ return mergeRegister(editor.registerUpdateListener(() => {
8956
8957
  updatePopup();
8957
8958
  }), editor.registerRootListener(() => {
8958
8959
  if (editor.getRootElement() === null) {
@@ -9012,12 +9013,12 @@ function HeadingPlugin({ html }) {
9012
9013
  // Only replace if tag is heading.
9013
9014
  if (tag) {
9014
9015
  editor.registerNodeTransform(ParagraphNode, (node) => {
9015
- node.replace(At(`${tag}`));
9016
+ node.replace(St(`${tag}`));
9016
9017
  });
9017
9018
  }
9018
9019
  else {
9019
9020
  // Replace a heading with paragraph
9020
- editor.registerNodeTransform(Et, (node) => {
9021
+ editor.registerNodeTransform(Pt, (node) => {
9021
9022
  node.replace($createParagraphNode(), true);
9022
9023
  });
9023
9024
  }
@@ -9167,7 +9168,7 @@ function Editor({ html, label, classes, autoFocus, helperText, showCharCount, al
9167
9168
  theme,
9168
9169
  editable: !readOnly,
9169
9170
  onError,
9170
- nodes: [Et],
9171
+ nodes: [Pt],
9171
9172
  html: {
9172
9173
  export: htmlExportMap,
9173
9174
  },