/**
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 *
 */

import{HorizontalRuleNode as e}from"@lexical/extension";export{$isHorizontalRuleNode,INSERT_HORIZONTAL_RULE_COMMAND}from"@lexical/extension";import{useLexicalComposerContext as t}from"@lexical/react/LexicalComposerContext";import{useLexicalNodeSelection as r}from"@lexical/react/useLexicalNodeSelection";import{mergeRegister as o,addClassNamesToElement as n,removeClassNamesFromElement as i}from"@lexical/utils";import{$applyNodeReplacement as l,CLICK_COMMAND as c,COMMAND_PRIORITY_LOW as a}from"lexical";import{useEffect as m}from"react";import{jsx as s}from"react/jsx-runtime";function u({nodeKey:e}){const[l]=t(),[s,u,p]=r(e);return m(()=>o(l.registerCommand(c,t=>{const r=l.getElementByKey(e);return t.target===r&&(t.shiftKey||p(),u(!s),!0)},a)),[p,l,s,e,u]),m(()=>{const t=l.getElementByKey(e),r=l._config.theme.hrSelected??"selected";null!==t&&(s?n(t,r):i(t,r))},[l,s,e]),null}class p extends e{static getType(){return"horizontalrule"}static clone(e){return new p(e.__key)}static importJSON(e){return f().updateFromJSON(e)}static importDOM(){return{hr:()=>({conversion:x,priority:0})}}decorate(){return s(u,{nodeKey:this.__key})}}function x(){return{node:f()}}function f(){return l(new p)}export{f as $createHorizontalRuleNode,p as HorizontalRuleNode};
