packageDocumentation module import * as React from "react" ; internal export class TildeFinder { param node returns public static findAfterTilde = ( node ) : { character : string | undefined ; node : React . ReactNode ; } => { if ( typeof node === "string" ) { const tildeIndex = node . indexOf ( "~" ) ; if ( tildeIndex !== - 1 && tildeIndex <= node . length - 2 ) { const ch = node . charAt ( tildeIndex + 1 ) ; const s1 = node . substring ( 0 , tildeIndex ) ; const n = < u key = "hotkey" > { ch } < /u>; const s2 = node . substring ( tildeIndex + 2 ) ; return { character : ch . toUpperCase ( ) , node : [ s1 , n , s2 ] } ; } } else if ( node && typeof node === "object" ) { if ( Array . isArray ( node ) ) { let ret = { character : undefined , node } ; node = node . map ( ( child ) => { const r = TildeFinder . findAfterTilde ( child ) ; if ( r . character ) { ret = r ; return r . node ; } return child ; } ) ; if ( ret . character ) { return { character : ret . character , node } ; } } else if ( "props" in node ) { const ret = { character : undefined , node } ; ret . node = React . cloneElement ( node , { children : React . Children . map ( node . props . children as React . ReactNode , ( child ) => { const r = TildeFinder . findAfterTilde ( child ) ; if ( r . character ) { ret . character = r . character ; return r . node ; } return child ; } ) } ) ; if ( ret . character ) { return ret ; } } } return { character : undefined , node } ; } ; }