import { Argument , defineFunction } from './definitions-utils' ; import type { Atom , ToLatexOptions } from '../core/atom-class' ; import { OverunderAtom } from '../core-atoms/overunder' ; import { PrivateStyle } from '../core/context' ; defineFunction ( [ 'overrightarrow' , 'overleftarrow' , 'Overrightarrow' , 'overleftharpoon' , 'overrightharpoon' , 'overleftrightarrow' , 'overlinesegment' , 'overgroup' , ] , '{:auto}' , { createAtom : ( command , args , style ) : Atom => new OverunderAtom ( command , { body : args [ 0 ] as Atom [ ] , skipBoundary : false , supsubPlacement : 'over-under' , padded : true , boxType : 'mrel' , style , svgAbove : command . slice ( 1 ) , } ) , } ) ; defineFunction ( 'overbrace' , '{:auto}' , { createAtom : ( command , args , style ) : Atom => new OverunderAtom ( command , { body : args [ 0 ] as Atom [ ] , skipBoundary : false , supsubPlacement : 'over-under' , padded : true , boxType : 'mord' , style , svgAbove : command . slice ( 1 ) , } ) , } ) ; defineFunction ( [ 'underrightarrow' , 'underleftarrow' , 'underleftrightarrow' , 'underlinesegment' , 'undergroup' , ] , '{:auto}' , { createAtom : ( command , args , style ) : Atom => new OverunderAtom ( command , { body : args [ 0 ] as Atom [ ] , skipBoundary : false , supsubPlacement : 'over-under' , padded : true , boxType : 'mrel' , style , svgBelow : command . slice ( 1 ) , } ) , } ) ; defineFunction ( [ 'underbrace' ] , '{:auto}' , { createAtom : ( command , args , style ) : Atom => new OverunderAtom ( command , { body : args [ 0 ] as Atom [ ] , skipBoundary : false , supsubPlacement : 'over-under' , padded : true , boxType : 'mord' , style , svgBelow : command . slice ( 1 ) , } ) , } ) ; defineFunction ( [ 'xrightarrow' , 'xleftarrow' , 'xRightarrow' , 'xLeftarrow' , 'xleftharpoonup' , 'xleftharpoondown' , 'xrightharpoonup' , 'xrightharpoondown' , 'xlongequal' , 'xtwoheadleftarrow' , 'xtwoheadrightarrow' , 'xleftrightarrow' , 'xLeftrightarrow' , 'xrightleftharpoons' , 'xleftrightharpoons' , 'xhookleftarrow' , 'xhookrightarrow' , 'xmapsto' , 'xtofrom' , 'xrightleftarrows' , 'xrightequilibrium' , 'xleftequilibrium' , ] , '[:auto]{:auto}' , { createAtom : ( command , args , style ) : Atom => new OverunderAtom ( command , { style , svgBody : command . slice ( 1 ) , above : ( args [ 1 ] as Atom [ ] ) ?. length === 0 ? undefined : ( args [ 1 ] as Atom [ ] ) , below : ( args [ 0 ] as Atom [ ] ) ?? null , skipBoundary : false , supsubPlacement : 'over-under' , padded : true , boxType : 'mrel' , serialize : ( atom , options ) => command + ( ! atom . hasEmptyBranch ( 'below' ) ? `[${ atom . belowToLatex ( options ) }]` : '' ) + `{${ atom . aboveToLatex ( options ) }}` , } ) , } ) ;