license /** The possible ways the browser may handle the horizontal scroll axis in RTL languages. */ export const enum RtlScrollAxisType { /**
     * scrollLeft is 0 when scrolled all the way left and (scrollWidth - clientWidth) when scrolled
     * all the way right.
     */ NORMAL , /**
     * scrollLeft is -(scrollWidth - clientWidth) when scrolled all the way left and 0 when scrolled
     * all the way right.
     */ NEGATED , /**
     * scrollLeft is (scrollWidth - clientWidth) when scrolled all the way left and 0 when scrolled
     * all the way right.
     */ INVERTED } /** Cached result of the way the browser handles the horizontal scroll axis in RTL mode. */ let rtlScrollAxisType ; /** Cached result of the check that indicates whether the browser supports scroll behaviors. */ let scrollBehaviorSupported ; /** Check whether the browser supports scroll behaviors. */ export function supportsScrollBehavior ( ) { if ( scrollBehaviorSupported == null ) { if ( typeof document !== 'object' || ! document || typeof Element !== 'function' || ! Element ) { scrollBehaviorSupported = false ; return scrollBehaviorSupported ; } if ( 'scrollBehavior' in document . documentElement ! . style ) { scrollBehaviorSupported = true ; } else { const scrollToFunction = Element . prototype . scrollTo ; if ( scrollToFunction ) { scrollBehaviorSupported = ! /\{\s*\[native code\]\s*\}/ . test ( scrollToFunction . toString ( ) ) ; } else { scrollBehaviorSupported = false ; } } } return scrollBehaviorSupported ; } /**
 * Checks the type of RTL scroll axis used by this browser. As of time of writing, Chrome is NORMAL,
 * Firefox & Safari are NEGATED, and IE & Edge are INVERTED.
 */ export function getRtlScrollAxisType ( ) { if ( typeof document !== 'object' || ! document ) { return RtlScrollAxisType . NORMAL ; } if ( rtlScrollAxisType == null ) { const scrollContainer = document . createElement ( 'div' ) ; const containerStyle = scrollContainer . style ; scrollContainer . dir = 'rtl' ; containerStyle . width = '1px' ; containerStyle . overflow = 'auto' ; containerStyle . visibility = 'hidden' ; containerStyle . pointerEvents = 'none' ; containerStyle . position = 'absolute' ; const content = document . createElement ( 'div' ) ; const contentStyle = content . style ; contentStyle . width = '2px' ; contentStyle . height = '1px' ; scrollContainer . appendChild ( content ) ; document . body . appendChild ( scrollContainer ) ; rtlScrollAxisType = RtlScrollAxisType . NORMAL ; if ( scrollContainer . scrollLeft === 0 ) { scrollContainer . scrollLeft = 1 ; rtlScrollAxisType = scrollContainer . scrollLeft === 0 ? RtlScrollAxisType . NEGATED : RtlScrollAxisType . INVERTED ; } scrollContainer . remove ( ) ; } return rtlScrollAxisType ; }