import { CaretNode, h, VNode } from "@caret-js/core"; export class RadicalNode extends CaretNode { constructor( public radicand: CaretNode, public index: CaretNode | null = null ) { super(); } static from( radicand: CaretNode, index: CaretNode | null = null ): RadicalNode { return new RadicalNode(radicand, index); } toDebugMathML(): VNode { if (this.index === null) { return h("msqrt", {}, this.radicand.toDebugMathML()); } return h( "mroot", {}, this.radicand.toDebugMathML(), this.index.toDebugMathML() ); } }