{"version":3,"sources":["webpack:///../src/utilities/keytips/KeytipConstants.ts","webpack:///../src/utilities/positioning/positioning.types.ts","webpack:///../src/utilities/decorators/withResponsiveMode.tsx","webpack:///../src/utilities/decorators/BaseDecorator.ts","webpack:///../src/utilities/hooks/useResponsiveMode.tsx","webpack:///../src/utilities/contextualMenu/contextualMenuUtility.ts","webpack:///../src/utilities/MenuContext/MenuContext.ts","webpack:///../src/utilities/positioning/positioning.ts","webpack:///../src/utilities/keytips/KeytipManager.ts","webpack:///../src/utilities/keytips/KeytipUtils.ts"],"names":["__webpack_require__","d","__webpack_exports__","KTP_PREFIX","KTP_SEPARATOR","DATAKTP_TARGET","DATAKTP_EXECUTE_TARGET","KTP_LAYER_ID","KeytipEvents","KEYTIP_ADDED","KEYTIP_REMOVED","KEYTIP_UPDATED","PERSISTED_KEYTIP_ADDED","PERSISTED_KEYTIP_REMOVED","PERSISTED_KEYTIP_EXECUTE","ENTER_KEYTIP_MODE","EXIT_KEYTIP_MODE","RectangleEdge","Position","ResponsiveMode","_super","BaseDecorator","props","_this","call","this","_updateComposedComponentRef","bind","Object","tslib_es6","prototype","composedComponentInstance","_composedComponentInstance","_hoisted","hoist","compat_module","_defaultMode","_lastMode","RESPONSIVE_MAX_CONSTRAINT","getInitialResponsiveMode","large","getResponsiveMode","currentWindow","responsiveMode","small","innerWidth","e","undefined","Error","useResponsiveMode","react__WEBPACK_IMPORTED_MODULE_0__","_fluentui_utilities__WEBPACK_IMPORTED_MODULE_1__","_fluentui_react_hooks__WEBPACK_IMPORTED_MODULE_2__","_decorators_withResponsiveMode__WEBPACK_IMPORTED_MODULE_3__","_WindowProvider__WEBPACK_IMPORTED_MODULE_4__","elementRef","_a","lastResponsiveMode","setLastResponsiveMode","onResize","newResponsiveMode","current","win","getIsChecked","item","canCheck","isChecked","checked","hasSubmenu","subMenuProps","items","isItemDisabled","isDisabled","disabled","getMenuItemAriaRole","MenuContext","_createPositionData","targetEdge","alignmentEdge","isAuto","DirectionalDictionary","_common_DirectionalHint__WEBPACK_IMPORTED_MODULE_1__","topLeftEdge","_positioning_types__WEBPACK_IMPORTED_MODULE_4__","top","left","topCenter","topRightEdge","right","topAutoEdge","bottomLeftEdge","bottom","bottomCenter","bottomRightEdge","bottomAutoEdge","leftTopEdge","leftCenter","leftBottomEdge","rightTopEdge","rightCenter","rightBottomEdge","_isRectangleWithinBounds","rect","boundingRect","_getOutOfBoundsEdges","outOfBounds","push","_getEdgeValue","edge","_setEdgeValue","value","_getCenterValue","edges","_getFlankingEdges","positiveEdge","negativeEdge","_getRelativeEdgeValue","_getRelativeRectEdgeValue","_getRelativeEdgeDifference","hostRect","_moveEdge","newValue","difference","_alignEdges","target","gap","_isEdgeInBounds","bounds","_adjustFitWithinBounds","element","bounding","positionData","directionalHintFixed","coverTarget","alignTargetEdge","elementEstimate","elementRectangle","directions","_Utilities__WEBPACK_IMPORTED_MODULE_2__","currentEstimate","currentEdge","currentAlignment","i","splice","indexOf","length","slice","_estimatePosition","_flipToFit","flippedElementEstimate","oppositeEdge","_flipAlignmentEdge","_alignOutOfBoundsEdges","outOfBoundsEdges","_i","outOfBoundsEdges_1","direction","_centerEdgeToPoint","point","elementToPosition","estimatedElementPosition","elementEdge","adjustedGap","_alignOppositeEdges","_finalizeReturnEdge","returnEdge","Math","abs","_calculateActualBeakWidthInPixels","beakWidth","sqrt","_getPositionData","directionalHint","directionalHintForRTL","previousPositions","positionInformation","tslib__WEBPACK_IMPORTED_MODULE_0__","getClosestEdge","targetCenter","boundingCenter","_positionElementWithinBounds","_finalizeBeakPosition","elementPosition","positionedBeak","actualElement","_Utilities__WEBPACK_IMPORTED_MODULE_5__","width","height","returnValue","closestEdge","_positionBeak","targetRectangle","beakTargetPoint","elementBounds","beakPosition","_getRectangleFromElement","clientRect","getBoundingClientRect","_getRectangleFromIRect","_getMaxHeightFromTargetRectangle","gapSpace","maxHeight","_positionElementRelative","targetRect","preventDefault","ev","clientX","clientY","rectOrPoint","x","top_1","y","outOfBounds_1","_getTargetRect","_getAlignmentData","positionedElement","_finalizePositionData","hostElement","doNotFinalizeReturnEdge","elementEdgeString","_finalizeElementPosition","_positionCallout","callout","isBeakVisible","positionProps","window","_Utilities__WEBPACK_IMPORTED_MODULE_3__","innerHeight","finalizedBeakPosition","positionCallout","positionCard","_positionCard","getMaxHeight","mouseTarget","elementTarget","rectOrPointTarget","boundingRectangle","stopPropagation","getBoundsFromTargetWindow","targetWindow","segments","getWindowSegments","segments_1","segment","_getBoundsFromTargetWindow","KeytipManager","keytips","persistedKeytips","sequenceMapping","inKeytipMode","shouldEnterKeytipMode","delayUpdatingKeytipChange","getInstance","_instance","init","register","keytipProps","persisted","addParentOverflow","keySequences","toString","uniqueKeytip","_getUniqueKtp","uniqueID","event_1","_utilities_keytips_KeytipConstants__WEBPACK_IMPORTED_MODULE_3__","_Utilities__WEBPACK_IMPORTED_MODULE_1__","raise","keytip","update","newKeytipProps","oldKeyTip","visible","unregister","keytipToRemove","event","enterKeytipMode","exitKeytipMode","getKeytips","keys","map","key","fullSequence","pop","parentKeytip","overflowSetSequence","menuExecute","overflowButtonSequences","keytipSequences","sequencesToID","reduce","prevValue","keySequence","_KeytipConstants__WEBPACK_IMPORTED_MODULE_1__","split","join","mergeOverflows","overflowKeySequences","overflowSequenceLen","overflowSequence","newKeySequences","getAriaDescribedBy","describedby"],"mappings":"0FAAAA,EAAAC,EAAAC,EAAA,sBAAAC,IAAAH,EAAAC,EAAAC,EAAA,sBAAAE,IAAAJ,EAAAC,EAAAC,EAAA,sBAAAG,IAAAL,EAAAC,EAAAC,EAAA,sBAAAI,IAAAN,EAAAC,EAAAC,EAAA,sBAAAK,IAAAP,EAAAC,EAAAC,EAAA,sBAAAM,IAAO,IAUUA,EAVJL,EAAa,MACbC,EAAgB,IAEhBC,EAAiB,kBACjBC,EAAyB,0BAEzBC,EAAe,gBAI5B,SAAiBC,GACFA,EAAAC,aAAe,cACfD,EAAAE,eAAiB,gBACjBF,EAAAG,eAAiB,gBACjBH,EAAA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,CAAA,GAAKoO,GAAeO,SAAQA,IAxLhClB,EAAAQ,UAA2B,IAAIR,EA0LhDA,EA3LA,oKCFO,SAAS4C,EAAc9B,GAC5B,OAAOA,EAAa+B,OAAO,SAACC,EAAmBC,GAC7C,OAAOD,EAAYE,EAAA,EAAgBD,EAAYE,MAAM,IAAIC,KAAKF,EAAA,IAC7DA,EAAA,GAUE,SAASG,EAAerC,EAAwBsC,GACrD,IAAMC,EAAsBD,EAAqBxJ,OAC3C0J,EAAmB/Q,OAAAoJ,EAAA,EAAApJ,CAAI6Q,GAAsBd,MAC7CiB,EAAkBhR,OAAAoJ,EAAA,EAAApJ,CAAIuO,GAC5B,OAAOvO,OAAA8G,EAAA,EAAA9G,CAAkBgR,EAAiBF,EAAsB,EAAGC,GA6B9D,SAASE,EAAmB1C,GACjC,IAAM2C,EAAc,IAAMT,EAAA,EAC1B,OAAKlC,EAAalH,OAKX6J,EAAc,IAAMb,EAAc9B,GAHhC2C","file":"3.9450a9c976adac8268dd.js","sourcesContent":["export const KTP_PREFIX = 'ktp';\nexport const KTP_SEPARATOR = '-';\nexport const KTP_FULL_PREFIX = KTP_PREFIX + KTP_SEPARATOR;\nexport const DATAKTP_TARGET = 'data-ktp-target';\nexport const DATAKTP_EXECUTE_TARGET = 'data-ktp-execute-target';\nexport const DATAKTP_ARIA_TARGET = 'data-ktp-aria-target';\nexport const KTP_LAYER_ID = 'ktp-layer-id';\nexport const KTP_ARIA_SEPARATOR = ', ';\n\n// Events\nexport namespace KeytipEvents {\n  export const KEYTIP_ADDED = 'keytipAdded';\n  export const KEYTIP_REMOVED = 'keytipRemoved';\n  export const KEYTIP_UPDATED = 'keytipUpdated';\n  export const PERSISTED_KEYTIP_ADDED = 'persistedKeytipAdded';\n  export const PERSISTED_KEYTIP_REMOVED = 'persistedKeytipRemoved';\n  export const PERSISTED_KEYTIP_EXECUTE = 'persistedKeytipExecute';\n  export const ENTER_KEYTIP_MODE = 'enterKeytipMode';\n  export const EXIT_KEYTIP_MODE = 'exitKeytipMode';\n}\n","import { DirectionalHint } from '../../common/DirectionalHint';\nimport { IRectangle, Point } from '../../Utilities';\n\n// eslint-disable-next-line deprecation/deprecation\nexport { Point, IPoint } from '../../Utilities';\n\nexport enum RectangleEdge {\n  top = 1,\n  bottom = -1,\n  left = 2,\n  right = -2,\n}\n\nexport enum Position {\n  top = 0,\n  bottom = 1,\n  start = 2,\n  end = 3,\n}\n\n/**\n * Window with typings for experimental features regarding Dual Screen devices.\n */\nexport interface IWindowWithSegments extends Window {\n  getWindowSegments?: () => DOMRect[];\n}\n\nexport interface IPositionProps {\n  target?: Element | MouseEvent | Point;\n  /** how the element should be positioned */\n  directionalHint?: DirectionalHint;\n  /**\n   * How the element should be positioned in RTL layouts.\n   * If not specified, a mirror of `directionalHint` will be used instead\n   */\n  directionalHintForRTL?: DirectionalHint;\n  /** The gap between the callout and the target */\n  gapSpace?: number;\n  /**\n   * The bounding rectangle for which  the contextual menu can appear in.\n   */\n  bounds?: IRectangle;\n  /**\n   * If true the position returned will have the menu element cover the target.\n   * If false then it will position next to the target;\n   */\n  coverTarget?: boolean;\n  /**\n   * If true the position will not change edges in an attempt to fit the rectangle within bounds.\n   * It will still attempt to align it to whatever bounds are given.\n   * @defaultvalue false\n   */\n  directionalHintFixed?: boolean;\n\n  /**\n   * If true the positioning logic will prefer flipping edges over nudging the rectangle to fit within bounds,\n   * thus making sure the element align perfectly with target.\n   */\n  alignTargetEdge?: boolean;\n}\n\nexport interface ICalloutPositionProps extends IPositionProps {\n  /**\n   * The width of the beak.\n   */\n  beakWidth?: number;\n\n  /**\n   * Whether or not the beak is visible\n   */\n  isBeakVisible?: boolean;\n}\n\nexport interface IPositionedData {\n  /**\n   * The new position of the element.\n   */\n  elementPosition: IPosition;\n  /**\n   * The finalized target edge that element is aligning to. For instance RectangleEdge.bottom would mean\n   * that the bottom edge of the target is being aligned to by the RectangleEdge.top of the element\n   * that is being positioned.\n   */\n  targetEdge: RectangleEdge;\n  /**\n   * The finalized alignment edge that the element is aligning too. For instance, RectangleEdge.left means\n   * that the left edge of the target should be in line with the left edge of the element being positioned.\n   */\n  alignmentEdge?: RectangleEdge;\n}\n\nexport interface ICalloutPositionedInfo extends IPositionedData {\n  beakPosition: ICalloutBeakPositionedInfo;\n}\n\nexport interface ICalloutBeakPositionedInfo extends IPositionedData {\n  closestEdge: RectangleEdge;\n}\n\n/**\n * Gives the position of some element on the page. Only a pair of vertical and horizontal edges need to be\n * given. So top/left or bottom/left is sufficient.\n * The number given is the distance in pixels from whatever host was given..\n * So bottom: 100 would be 100px up from the bottom of the host while top: 100px from the top.\n */\nexport interface IPosition {\n  top?: number;\n  left?: number;\n  bottom?: number;\n  right?: number;\n  [key: string]: number | undefined;\n}\n\nexport interface IPositionDirectionalHintData {\n  targetEdge: RectangleEdge;\n  alignmentEdge?: RectangleEdge;\n  isAuto?: boolean;\n  alignTargetEdge?: boolean;\n}\n\nexport interface IRelativePositions {\n  calloutPosition: IPosition;\n  beakPosition: { position: IPosition | undefined; display: 'block' };\n  directionalClassName: string;\n  submenuDirection: DirectionalHint;\n}\n","import * as React from 'react';\nimport { BaseDecorator } from './BaseDecorator';\nimport { getWindow, hoistStatics, EventGroup } from '../../Utilities';\nimport { WindowContext } from '../../WindowProvider';\n\n/**\n * @deprecated Decorator usage is deprecated. Either call `getResponsiveMode` manually, or\n * use the `useResponsiveMode` hook within a function component.\n */\nexport interface IWithResponsiveModeState {\n  responsiveMode?: ResponsiveMode;\n}\n\nexport enum ResponsiveMode {\n  /** Width \\<= 479px */\n  small = 0,\n  /** Width \\> 479px and \\<= 639px */\n  medium = 1,\n  /** Width \\> 639px and \\<= 1023px */\n  large = 2,\n  /** Width \\> 1023px and \\<= 1365px */\n  xLarge = 3,\n  /** Width \\> 1365px and \\<= 1919px */\n  xxLarge = 4,\n  /** Width \\> 1919px */\n  xxxLarge = 5,\n  unknown = 999,\n}\n\nconst RESPONSIVE_MAX_CONSTRAINT = [479, 639, 1023, 1365, 1919, 99999999];\n\n/**\n * User specified mode to default to, useful for server side rendering scenarios.\n */\nlet _defaultMode: ResponsiveMode | undefined;\n\n/**\n * Tracking the last mode we successfully rendered, which allows us to\n * paint initial renders with the correct size.\n */\nlet _lastMode: ResponsiveMode | undefined;\n\n/**\n * Allows a server rendered scenario to provide a **default** responsive mode.\n * This WILL NOT trigger any updates to components that have already consumed the responsive mode!\n */\nexport function setResponsiveMode(responsiveMode: ResponsiveMode | undefined): void {\n  _defaultMode = responsiveMode;\n}\n\n/**\n * Initializes the responsive mode to the current window size. This can be used to avoid\n * a re-render during first component mount since the window would otherwise not be measured\n * until after mounting.\n *\n * This WILL NOT trigger any updates to components that have already consumed the responsive mode!\n */\nexport function initializeResponsiveMode(element?: HTMLElement): void {\n  const currentWindow = getWindow(element);\n\n  if (currentWindow) {\n    getResponsiveMode(currentWindow);\n  }\n}\n\nexport function getInitialResponsiveMode() {\n  return _defaultMode || _lastMode || ResponsiveMode.large;\n}\n\n/**\n * @deprecated Decorator usage is deprecated. Either call `getResponsiveMode` manually, or\n * use the `useResponsiveMode` hook within a function component.\n */\nexport function withResponsiveMode<TProps extends { responsiveMode?: ResponsiveMode }, TState>(\n  ComposedComponent: new (props: TProps, ...args: any[]) => React.Component<TProps, TState>,\n): any {\n  // eslint-disable-next-line deprecation/deprecation\n  const resultClass = class WithResponsiveMode extends BaseDecorator<TProps, IWithResponsiveModeState> {\n    public static contextType = WindowContext;\n    public context: React.ContextType<typeof WindowContext>;\n\n    private _events: EventGroup;\n\n    constructor(props: TProps) {\n      super(props);\n      this._events = new EventGroup(this);\n      this._updateComposedComponentRef = this._updateComposedComponentRef.bind(this);\n\n      this.state = {\n        responsiveMode: getInitialResponsiveMode(),\n      };\n    }\n\n    public componentDidMount(): void {\n      this._events.on(this.context.window, 'resize', this._onResize);\n      this._onResize();\n    }\n\n    public componentWillUnmount(): void {\n      this._events.dispose();\n    }\n\n    public render(): JSX.Element | null {\n      const { responsiveMode } = this.state;\n\n      return responsiveMode === ResponsiveMode.unknown ? null : (\n        <ComposedComponent\n          ref={this._updateComposedComponentRef}\n          responsiveMode={responsiveMode}\n          {...(this.props as any)}\n        />\n      );\n    }\n\n    private _onResize = () => {\n      const responsiveMode = getResponsiveMode(this.context.window);\n\n      if (responsiveMode !== this.state.responsiveMode) {\n        this.setState({\n          responsiveMode,\n        });\n      }\n    };\n  };\n  return hoistStatics(ComposedComponent, resultClass);\n}\n\n/**\n * Hook to get the current responsive mode (window size category).\n * @param currentWindow - Use this window when determining the responsive mode.\n */\nexport function getResponsiveMode(currentWindow: Window | undefined): ResponsiveMode {\n  let responsiveMode = ResponsiveMode.small;\n\n  if (currentWindow) {\n    try {\n      while (currentWindow.innerWidth > RESPONSIVE_MAX_CONSTRAINT[responsiveMode]) {\n        responsiveMode++;\n      }\n    } catch (e) {\n      // Return a best effort result in cases where we're in the browser but it throws on getting innerWidth.\n      responsiveMode = getInitialResponsiveMode();\n    }\n\n    // Tracking last mode just gives us a better default in future renders,\n    // which avoids starting with the wrong value if we've measured once.\n    _lastMode = responsiveMode;\n  } else {\n    if (_defaultMode !== undefined) {\n      responsiveMode = _defaultMode;\n    } else {\n      throw new Error(\n        'Content was rendered in a server environment without providing a default responsive mode. ' +\n          'Call setResponsiveMode to define what the responsive mode is.',\n      );\n    }\n  }\n\n  return responsiveMode;\n}\n","import * as React from 'react';\nimport { hoistMethods, unhoistMethods } from '../../Utilities';\n\nexport class BaseDecorator<TProps, TState> extends React.Component<TProps, TState> {\n  protected _composedComponentInstance: React.Component<TProps, TState>;\n\n  private _hoisted: string[];\n\n  constructor(props: TProps) {\n    super(props);\n    this._updateComposedComponentRef = this._updateComposedComponentRef.bind(this);\n  }\n\n  /**\n   * Updates the ref to the component composed by the decorator, which will also take care of hoisting\n   * (and unhoisting as appropriate) methods from said component.\n   *\n   * Pass this method as the argument to the 'ref' property of the composed component.\n   */\n  protected _updateComposedComponentRef(composedComponentInstance: React.Component<TProps, TState>): void {\n    this._composedComponentInstance = composedComponentInstance;\n    if (composedComponentInstance) {\n      this._hoisted = hoistMethods(this, composedComponentInstance);\n    } else if (this._hoisted) {\n      unhoistMethods(this, this._hoisted);\n    }\n  }\n}\n","import * as React from 'react';\nimport { getWindow } from '@fluentui/utilities';\nimport { useOnEvent } from '@fluentui/react-hooks';\nimport { ResponsiveMode, getResponsiveMode, getInitialResponsiveMode } from '../decorators/withResponsiveMode';\nimport { useWindow } from '../../WindowProvider';\n\n/**\n * Hook to get the current responsive mode (window size category).\n * @param elementRef - Use this element's parent window when determining the responsive mode.\n */\nexport const useResponsiveMode = (elementRef: React.RefObject<HTMLElement | null>) => {\n  const [lastResponsiveMode, setLastResponsiveMode] = React.useState<ResponsiveMode>(getInitialResponsiveMode);\n\n  const onResize = React.useCallback(() => {\n    const newResponsiveMode = getResponsiveMode(getWindow(elementRef.current));\n\n    // Setting the same value should not cause a re-render.\n    if (lastResponsiveMode !== newResponsiveMode) {\n      setLastResponsiveMode(newResponsiveMode);\n    }\n  }, [elementRef, lastResponsiveMode]);\n\n  const win = useWindow();\n  useOnEvent(win, 'resize', onResize as (ev: Event) => void);\n\n  // Call resize function initially on mount.\n  React.useEffect(() => {\n    onResize();\n    // eslint-disable-next-line react-hooks/exhaustive-deps -- only meant to run on mount\n  }, []);\n\n  return lastResponsiveMode;\n};\n","import { IContextualMenuItem } from '../../index';\n\n/**\n * Determines the effective checked state of a menu item.\n *\n * @param item {IContextualMenuItem} to get the check state of.\n * @returns {true} if the item is checked.\n * @returns {false} if the item is unchecked.\n * @returns {null} if the item is not checkable.\n */\nexport function getIsChecked(item: IContextualMenuItem): boolean | null {\n  if (item.canCheck) {\n    return !!(item.isChecked || item.checked);\n  }\n\n  if (typeof item.isChecked === 'boolean') {\n    return item.isChecked;\n  }\n\n  if (typeof item.checked === 'boolean') {\n    return item.checked;\n  }\n\n  // Item is not checkable.\n  return null;\n}\n\nexport function hasSubmenu(item: IContextualMenuItem): boolean {\n  return !!(item.subMenuProps || item.items);\n}\n\nexport function isItemDisabled(item: IContextualMenuItem): boolean {\n  return !!(item.isDisabled || item.disabled);\n}\n\nexport function getMenuItemAriaRole(item: IContextualMenuItem): string {\n  const isChecked = getIsChecked(item);\n  const canCheck: boolean = isChecked !== null;\n  return canCheck ? 'menuitemcheckbox' : 'menuitem';\n}\n","import * as React from 'react';\nimport { MinimalMenuProps } from './types';\n\nexport const MenuContext = React.createContext<MinimalMenuProps>({});\n\nexport const useMenuContext = () => {\n  return React.useContext(MenuContext);\n};\n","import { DirectionalHint } from '../../common/DirectionalHint';\nimport { getScrollbarWidth, getRTL, IRectangle } from '../../Utilities';\nimport {\n  IPositionDirectionalHintData,\n  IPositionedData,\n  ICalloutPositionedInfo,\n  ICalloutBeakPositionedInfo,\n  IPositionProps,\n  ICalloutPositionProps,\n  RectangleEdge,\n  IWindowWithSegments,\n} from './positioning.types';\nimport { Point, Rectangle } from '../../Utilities';\n\nfunction _createPositionData(\n  targetEdge: RectangleEdge,\n  alignmentEdge?: RectangleEdge,\n  isAuto?: boolean,\n): IPositionDirectionalHintData {\n  return {\n    targetEdge: targetEdge,\n    alignmentEdge: alignmentEdge,\n    isAuto: isAuto,\n  };\n}\n\n// Currently the beakPercent is set to 50 for all positions meaning that it should tend to the center of the target\nconst DirectionalDictionary: { [key: number]: IPositionDirectionalHintData } = {\n  [DirectionalHint.topLeftEdge]: _createPositionData(RectangleEdge.top, RectangleEdge.left),\n  [DirectionalHint.topCenter]: _createPositionData(RectangleEdge.top),\n  [DirectionalHint.topRightEdge]: _createPositionData(RectangleEdge.top, RectangleEdge.right),\n  [DirectionalHint.topAutoEdge]: _createPositionData(RectangleEdge.top, undefined, true),\n  [DirectionalHint.bottomLeftEdge]: _createPositionData(RectangleEdge.bottom, RectangleEdge.left),\n  [DirectionalHint.bottomCenter]: _createPositionData(RectangleEdge.bottom),\n  [DirectionalHint.bottomRightEdge]: _createPositionData(RectangleEdge.bottom, RectangleEdge.right),\n  [DirectionalHint.bottomAutoEdge]: _createPositionData(RectangleEdge.bottom, undefined, true),\n  [DirectionalHint.leftTopEdge]: _createPositionData(RectangleEdge.left, RectangleEdge.top),\n  [DirectionalHint.leftCenter]: _createPositionData(RectangleEdge.left),\n  [DirectionalHint.leftBottomEdge]: _createPositionData(RectangleEdge.left, RectangleEdge.bottom),\n  [DirectionalHint.rightTopEdge]: _createPositionData(RectangleEdge.right, RectangleEdge.top),\n  [DirectionalHint.rightCenter]: _createPositionData(RectangleEdge.right),\n  [DirectionalHint.rightBottomEdge]: _createPositionData(RectangleEdge.right, RectangleEdge.bottom),\n};\n\n/**\n * Do not call methods from this directly, use either positionCallout or positionElement or make another function that\n * utilizes them.\n * START Private functions and interfaces\n */\n\nexport interface IElementPosition {\n  elementRectangle: Rectangle;\n  targetEdge: RectangleEdge;\n  alignmentEdge: RectangleEdge | undefined;\n}\n\nexport interface IElementPositionInfo extends IElementPosition {\n  targetRectangle: Rectangle;\n}\n\ntype PartialIRectangle = Partial<IRectangle>;\n\ninterface IPartialIRectangle extends PartialIRectangle {\n  [key: string]: number | undefined;\n}\n\nfunction _isRectangleWithinBounds(rect: Rectangle, boundingRect: Rectangle): boolean {\n  if (rect.top < boundingRect.top) {\n    return false;\n  }\n  if (rect.bottom > boundingRect.bottom) {\n    return false;\n  }\n  if (rect.left < boundingRect.left) {\n    return false;\n  }\n  if (rect.right > boundingRect.right) {\n    return false;\n  }\n\n  return true;\n}\n\n/**\n * Gets all of the edges of a rectangle that are outside of the given bounds.\n * If there are no out of bounds edges it returns an empty array.\n */\nfunction _getOutOfBoundsEdges(rect: Rectangle, boundingRect: Rectangle): RectangleEdge[] {\n  const outOfBounds: RectangleEdge[] = [];\n\n  if (rect.top < boundingRect.top) {\n    outOfBounds.push(RectangleEdge.top);\n  }\n  if (rect.bottom > boundingRect.bottom) {\n    outOfBounds.push(RectangleEdge.bottom);\n  }\n  if (rect.left < boundingRect.left) {\n    outOfBounds.push(RectangleEdge.left);\n  }\n  if (rect.right > boundingRect.right) {\n    outOfBounds.push(RectangleEdge.right);\n  }\n\n  return outOfBounds;\n}\n\nfunction _getEdgeValue(rect: Rectangle, edge: RectangleEdge): number {\n  return (rect as any)[RectangleEdge[edge]] as number;\n}\n\nfunction _setEdgeValue(rect: Rectangle, edge: RectangleEdge, value: number) {\n  (rect as any)[RectangleEdge[edge]] = value;\n  return rect;\n}\n\n/**\n * Returns the middle value of an edge. Only returns 1 value rather than xy coordinates as\n * the itself already contains the other coordinate.\n * For instance, a bottom edge's current value is it's y coordinate, so the number returned is the x.\n */\nfunction _getCenterValue(rect: Rectangle, edge: RectangleEdge): number {\n  const edges = _getFlankingEdges(edge);\n  return (_getEdgeValue(rect, edges.positiveEdge) + _getEdgeValue(rect, edges.negativeEdge)) / 2;\n}\n\n/**\n * Flips the value depending on the edge.\n * If the edge is a \"positive\" edge, Top or Left, then the value should stay as it is.\n * If the edge is a \"negative\" edge, Bottom or Right, then the value should be flipped.\n * This is to account for the fact that the coordinates are effectively reveserved in certain cases for the\n * \"negative\" edges.\n *\n * For example, when testing to see if a bottom edge 1 is within the bounds of another bottom edge 2:\n * If edge 1 is greater than edge 2 then it is out of bounds. This is reversed for top edge 1 and top edge 2.\n * If top edge 1 is less than edge 2 then it is out of bounds.\n */\nfunction _getRelativeEdgeValue(edge: RectangleEdge, value: number): number {\n  if (edge > 0) {\n    return value;\n  } else {\n    return value * -1;\n  }\n}\n\nfunction _getRelativeRectEdgeValue(edge: RectangleEdge, rect: Rectangle): number {\n  return _getRelativeEdgeValue(edge, _getEdgeValue(rect, edge));\n}\n\nfunction _getRelativeEdgeDifference(rect: Rectangle, hostRect: Rectangle, edge: RectangleEdge): number {\n  const edgeDifference = _getEdgeValue(rect, edge) - _getEdgeValue(hostRect, edge);\n  return _getRelativeEdgeValue(edge, edgeDifference);\n}\n\n/**\n * Moves the edge of a rectangle to the value given. It only moves the edge in a linear direction based on that edge.\n * For example, if it's a bottom edge it will only change y coordinates.\n */\nfunction _moveEdge(rect: Rectangle, edge: RectangleEdge, newValue: number): Rectangle {\n  const difference = _getEdgeValue(rect, edge) - newValue;\n  rect = _setEdgeValue(rect, edge, newValue);\n  rect = _setEdgeValue(rect, edge * -1, _getEdgeValue(rect, edge * -1) - difference);\n  return rect;\n}\n\n/**\n * Aligns the edge on the passed in rect to the target. If there is a gap then it will have that space between the two.\n */\nfunction _alignEdges(rect: Rectangle, target: Rectangle, edge: RectangleEdge, gap: number = 0): Rectangle {\n  return _moveEdge(rect, edge, _getEdgeValue(target, edge) + _getRelativeEdgeValue(edge, gap));\n}\n\n/**\n * Aligns the targetEdge on the passed in target to the rects corresponding opposite edge.\n * For instance if targetEdge is bottom, then the rects top will be moved to match it.\n */\nfunction _alignOppositeEdges(\n  rect: Rectangle,\n  target: Rectangle,\n  targetEdge: RectangleEdge,\n  gap: number = 0,\n): Rectangle {\n  const oppositeEdge = targetEdge * -1;\n  const adjustedGap = _getRelativeEdgeValue(oppositeEdge, gap);\n  return _moveEdge(rect, targetEdge * -1, _getEdgeValue(target, targetEdge) + adjustedGap);\n}\n\n/**\n * Tests to see if the given edge is within the bounds of the given rectangle.\n */\nfunction _isEdgeInBounds(rect: Rectangle, bounds: Rectangle, edge: RectangleEdge): boolean {\n  const adjustedRectValue = _getRelativeRectEdgeValue(edge, rect);\n  return adjustedRectValue > _getRelativeRectEdgeValue(edge, bounds);\n}\n\n/**\n * Attempts to move the rectangle through various sides of the target to find a place to fit.\n * If no fit is found, the original position should be returned.\n */\nfunction _flipToFit(\n  rect: Rectangle,\n  target: Rectangle,\n  bounding: Rectangle,\n  positionData: IPositionDirectionalHintData,\n  gap: number = 0,\n): IElementPosition {\n  const directions: RectangleEdge[] = [\n    RectangleEdge.left,\n    RectangleEdge.right,\n    RectangleEdge.bottom,\n    RectangleEdge.top,\n  ];\n  // In RTL page, RectangleEdge.right has a higher priority than RectangleEdge.left, so the order should be updated.\n  if (getRTL()) {\n    directions[0] *= -1;\n    directions[1] *= -1;\n  }\n  let currentEstimate = rect;\n  let currentEdge = positionData.targetEdge;\n  let currentAlignment = positionData.alignmentEdge;\n  // Keep switching sides until one is found with enough space.\n  // If all sides don't fit then return the unmodified element.\n  for (let i = 0; i < 4; i++) {\n    if (!_isEdgeInBounds(currentEstimate, bounding, currentEdge)) {\n      directions.splice(directions.indexOf(currentEdge), 1);\n      if (directions.length > 0) {\n        if (directions.indexOf(currentEdge * -1) > -1) {\n          currentEdge = currentEdge * -1;\n        } else {\n          currentAlignment = currentEdge;\n          currentEdge = directions.slice(-1)[0];\n        }\n        currentEstimate = _estimatePosition(\n          rect,\n          target,\n          { targetEdge: currentEdge, alignmentEdge: currentAlignment },\n          gap,\n        );\n      }\n    } else {\n      return {\n        elementRectangle: currentEstimate,\n        targetEdge: currentEdge,\n        alignmentEdge: currentAlignment,\n      };\n    }\n  }\n  return {\n    elementRectangle: rect,\n    targetEdge: positionData.targetEdge,\n    alignmentEdge: positionData.alignmentEdge,\n  };\n}\n\n/**\n * Flips only the alignment edge of an element rectangle. This is used instead of nudging the alignment edges\n * into position, when `alignTargetEdge` is specified.\n */\nfunction _flipAlignmentEdge(\n  elementEstimate: IElementPosition,\n  target: Rectangle,\n  gap: number,\n  coverTarget?: boolean,\n): IElementPosition {\n  const { alignmentEdge, targetEdge, elementRectangle } = elementEstimate;\n  const oppositeEdge = alignmentEdge! * -1;\n  const newEstimate = _estimatePosition(\n    elementRectangle,\n    target,\n    { targetEdge: targetEdge, alignmentEdge: oppositeEdge },\n    gap,\n    coverTarget,\n  );\n\n  return {\n    elementRectangle: newEstimate,\n    targetEdge: targetEdge,\n    alignmentEdge: oppositeEdge,\n  };\n}\n\n/**\n * Adjusts a element rectangle to fit within the bounds given. If directionalHintFixed or covertarget is passed in\n * then the element will not flip sides on the target. They will, however, be nudged to fit within the bounds given.\n */\nfunction _adjustFitWithinBounds(\n  element: Rectangle,\n  target: Rectangle,\n  bounding: Rectangle,\n  positionData: IPositionDirectionalHintData,\n  gap: number = 0,\n  directionalHintFixed?: boolean,\n  coverTarget?: boolean,\n): IElementPosition {\n  const { alignmentEdge, alignTargetEdge } = positionData;\n  let elementEstimate: IElementPosition = {\n    elementRectangle: element,\n    targetEdge: positionData.targetEdge,\n    alignmentEdge: alignmentEdge,\n  };\n\n  if (!directionalHintFixed && !coverTarget) {\n    elementEstimate = _flipToFit(element, target, bounding, positionData, gap);\n  }\n  const outOfBounds = _getOutOfBoundsEdges(element, bounding);\n\n  if (alignTargetEdge) {\n    // The edge opposite to the alignment edge might be out of bounds.\n    // Flip alignment to see if we can get it within bounds.\n    if (elementEstimate.alignmentEdge && outOfBounds.indexOf(elementEstimate.alignmentEdge * -1) > -1) {\n      const flippedElementEstimate = _flipAlignmentEdge(elementEstimate, target, gap, coverTarget);\n      if (_isRectangleWithinBounds(flippedElementEstimate.elementRectangle, bounding)) {\n        return flippedElementEstimate;\n      } else {\n        // If the flipped elements edges are still out of bounds, try nudging it.\n        elementEstimate = _alignOutOfBoundsEdges(\n          _getOutOfBoundsEdges(flippedElementEstimate.elementRectangle, bounding),\n          elementEstimate,\n          bounding,\n        );\n      }\n    }\n  } else {\n    elementEstimate = _alignOutOfBoundsEdges(outOfBounds, elementEstimate, bounding);\n  }\n\n  return elementEstimate;\n}\n\n/**\n * Iterates through a list of out of bounds edges and tries to nudge and align them.\n * @param outOfBoundsEdges - Array of edges that are out of bounds\n * @param elementEstimate - The current element positioning estimate\n * @param bounding - The current bounds\n */\nfunction _alignOutOfBoundsEdges(\n  outOfBoundsEdges: RectangleEdge[],\n  elementEstimate: IElementPosition,\n  bounding: Rectangle,\n) {\n  for (const direction of outOfBoundsEdges) {\n    elementEstimate.elementRectangle = _alignEdges(elementEstimate.elementRectangle, bounding, direction);\n  }\n\n  return elementEstimate;\n}\n\n/**\n * Moves the middle point on an edge to the point given.\n * Only moves in one direction. For instance if a bottom edge is passed in, then\n * the bottom edge will be moved in the x axis to match the point.\n */\nfunction _centerEdgeToPoint(rect: Rectangle, edge: RectangleEdge, point: number): Rectangle {\n  const { positiveEdge } = _getFlankingEdges(edge);\n  const elementMiddle = _getCenterValue(rect, edge);\n  const distanceToMiddle = elementMiddle - _getEdgeValue(rect, positiveEdge);\n  return _moveEdge(rect, positiveEdge, point - distanceToMiddle);\n}\n\n/**\n * Moves the element rectangle to be appropriately positioned relative to a given target.\n * Does not flip or adjust the element.\n */\nfunction _estimatePosition(\n  elementToPosition: Rectangle,\n  target: Rectangle,\n  positionData: IPositionDirectionalHintData,\n  gap: number = 0,\n  coverTarget?: boolean,\n): Rectangle {\n  let estimatedElementPosition: Rectangle;\n  const { alignmentEdge, targetEdge } = positionData;\n  const elementEdge = coverTarget ? targetEdge : targetEdge * -1;\n  estimatedElementPosition = coverTarget\n    ? _alignEdges(elementToPosition, target, targetEdge, gap)\n    : _alignOppositeEdges(elementToPosition, target, targetEdge, gap);\n  // if no alignment edge is provided it's supposed to be centered.\n  if (!alignmentEdge) {\n    const targetMiddlePoint = _getCenterValue(target, targetEdge);\n    estimatedElementPosition = _centerEdgeToPoint(estimatedElementPosition, elementEdge, targetMiddlePoint);\n  } else {\n    estimatedElementPosition = _alignEdges(estimatedElementPosition, target, alignmentEdge);\n  }\n\n  return estimatedElementPosition;\n}\n\n/**\n * Returns the non-opposite edges of the target edge.\n * For instance if bottom is passed in then left and right will be returned.\n */\nfunction _getFlankingEdges(edge: RectangleEdge): { positiveEdge: RectangleEdge; negativeEdge: RectangleEdge } {\n  if (edge === RectangleEdge.top || edge === RectangleEdge.bottom) {\n    return {\n      positiveEdge: RectangleEdge.left,\n      negativeEdge: RectangleEdge.right,\n    };\n  } else {\n    return {\n      positiveEdge: RectangleEdge.top,\n      negativeEdge: RectangleEdge.bottom,\n    };\n  }\n}\n\n/**\n * Retrieve the final value for the return edge of `elementRectangle`. If the `elementRectangle` is closer to one side\n * of the bounds versus the other, the return edge is flipped to grow inward.\n */\nfunction _finalizeReturnEdge(\n  elementRectangle: Rectangle,\n  returnEdge: RectangleEdge,\n  bounds?: Rectangle,\n): RectangleEdge {\n  if (\n    bounds &&\n    Math.abs(_getRelativeEdgeDifference(elementRectangle, bounds, returnEdge)) >\n      Math.abs(_getRelativeEdgeDifference(elementRectangle, bounds, returnEdge * -1))\n  ) {\n    return returnEdge * -1;\n  }\n\n  return returnEdge;\n}\n\n/**\n * Finalizes the element positon based on the hostElement. Only returns the\n * rectangle values to position such that they are anchored to the target.\n * This helps prevent resizing from looking very strange.\n * For instance, if the target edge is top and aligned with the left side then\n * the bottom and left values are returned so as the callou shrinks it shrinks towards that corner.\n */\nfunction _finalizeElementPosition(\n  elementRectangle: Rectangle,\n  hostElement: HTMLElement,\n  targetEdge: RectangleEdge,\n  bounds?: Rectangle,\n  alignmentEdge?: RectangleEdge,\n  coverTarget?: boolean,\n  doNotFinalizeReturnEdge?: boolean,\n): IPartialIRectangle {\n  const returnValue: IPartialIRectangle = {};\n\n  const hostRect: Rectangle = _getRectangleFromElement(hostElement);\n  const elementEdge = coverTarget ? targetEdge : targetEdge * -1;\n  const elementEdgeString = RectangleEdge[elementEdge];\n  let returnEdge = alignmentEdge ? alignmentEdge : _getFlankingEdges(targetEdge).positiveEdge;\n  if (!doNotFinalizeReturnEdge) {\n    returnEdge = _finalizeReturnEdge(elementRectangle, returnEdge, bounds);\n  }\n\n  returnValue[elementEdgeString] = _getRelativeEdgeDifference(elementRectangle, hostRect, elementEdge);\n  returnValue[RectangleEdge[returnEdge]] = _getRelativeEdgeDifference(elementRectangle, hostRect, returnEdge);\n\n  return returnValue;\n}\n\n// Since the beak is rotated 45 degrees the actual height/width is the length of the diagonal.\n// We still want to position the beak based on it's midpoint which does not change. It will\n// be at (beakwidth / 2, beakwidth / 2)\nfunction _calculateActualBeakWidthInPixels(beakWidth: number): number {\n  return Math.sqrt(beakWidth * beakWidth * 2);\n}\n\n/**\n * Returns the appropriate IPositionData based on the props altered for RTL.\n * If directionalHintForRTL is passed in that is used if the page is RTL.\n * If directionalHint is specified, no directionalHintForRTL is available, and the page is RTL, the hint will be\n * flipped (e.g. bottomLeftEdge would become bottomRightEdge).\n *\n * If there is no directionalHint passed in, bottomAutoEdge is chosen automatically.\n */\nfunction _getPositionData(\n  directionalHint: DirectionalHint = DirectionalHint.bottomAutoEdge,\n  directionalHintForRTL?: DirectionalHint,\n  previousPositions?: IPositionDirectionalHintData,\n): IPositionDirectionalHintData {\n  if (previousPositions) {\n    return {\n      alignmentEdge: previousPositions.alignmentEdge,\n      isAuto: previousPositions.isAuto,\n      targetEdge: previousPositions.targetEdge,\n    };\n  }\n  const positionInformation: IPositionDirectionalHintData = { ...DirectionalDictionary[directionalHint] };\n  if (getRTL()) {\n    // If alignment edge exists and that alignment edge is -2 or 2, right or left, then flip it.\n    if (positionInformation.alignmentEdge && positionInformation.alignmentEdge % 2 === 0) {\n      positionInformation.alignmentEdge = positionInformation.alignmentEdge * -1;\n    }\n\n    return directionalHintForRTL !== undefined ? DirectionalDictionary[directionalHintForRTL] : positionInformation;\n  }\n  return positionInformation;\n}\n\n/**\n * Get's the alignment data for the given information. This only really matters if the positioning is Auto.\n * If it is auto then the alignmentEdge should be chosen based on the target edge's position relative to\n * the center of the page.\n */\nfunction _getAlignmentData(\n  positionData: IPositionDirectionalHintData,\n  target: Rectangle,\n  boundingRect: Rectangle,\n  coverTarget?: boolean,\n  alignTargetEdge?: boolean,\n): IPositionDirectionalHintData {\n  if (positionData.isAuto) {\n    positionData.alignmentEdge = getClosestEdge(positionData.targetEdge, target, boundingRect);\n  }\n\n  positionData.alignTargetEdge = alignTargetEdge;\n  return positionData;\n}\n\nfunction getClosestEdge(targetEdge: RectangleEdge, target: Rectangle, boundingRect: Rectangle): RectangleEdge {\n  const targetCenter: number = _getCenterValue(target, targetEdge);\n  const boundingCenter: number = _getCenterValue(boundingRect, targetEdge);\n  const { positiveEdge, negativeEdge } = _getFlankingEdges(targetEdge);\n  if (targetCenter <= boundingCenter) {\n    return positiveEdge;\n  } else {\n    return negativeEdge;\n  }\n}\n\nfunction _positionElementWithinBounds(\n  elementToPosition: Rectangle,\n  target: Rectangle,\n  bounding: Rectangle,\n  positionData: IPositionDirectionalHintData,\n  gap: number,\n  directionalHintFixed?: boolean,\n  coverTarget?: boolean,\n): IElementPosition {\n  const estimatedElementPosition: Rectangle = _estimatePosition(\n    elementToPosition,\n    target,\n    positionData,\n    gap,\n    coverTarget,\n  );\n  if (_isRectangleWithinBounds(estimatedElementPosition, bounding)) {\n    return {\n      elementRectangle: estimatedElementPosition,\n      targetEdge: positionData.targetEdge,\n      alignmentEdge: positionData.alignmentEdge,\n    };\n  } else {\n    return _adjustFitWithinBounds(\n      elementToPosition,\n      target,\n      bounding,\n      positionData,\n      gap,\n      directionalHintFixed,\n      coverTarget,\n    );\n  }\n}\n\nfunction _finalizeBeakPosition(\n  elementPosition: IElementPosition,\n  positionedBeak: Rectangle,\n  bounds?: Rectangle,\n): ICalloutBeakPositionedInfo {\n  const targetEdge = elementPosition.targetEdge * -1;\n  // The \"host\" element that we will use to help position the beak.\n  const actualElement = new Rectangle(\n    0,\n    elementPosition.elementRectangle.width,\n    0,\n    elementPosition.elementRectangle.height,\n  );\n  const returnValue: IPartialIRectangle = {};\n  const returnEdge = _finalizeReturnEdge(\n    elementPosition.elementRectangle,\n    elementPosition.alignmentEdge ? elementPosition.alignmentEdge : _getFlankingEdges(targetEdge).positiveEdge,\n    bounds,\n  );\n\n  returnValue[RectangleEdge[targetEdge]] = _getEdgeValue(positionedBeak, targetEdge);\n  returnValue[RectangleEdge[returnEdge]] = _getRelativeEdgeDifference(positionedBeak, actualElement, returnEdge);\n\n  return {\n    elementPosition: { ...returnValue },\n    closestEdge: getClosestEdge(elementPosition.targetEdge, positionedBeak, actualElement),\n    targetEdge: targetEdge,\n  };\n}\n\nfunction _positionBeak(beakWidth: number, elementPosition: IElementPositionInfo): Rectangle {\n  const target = elementPosition.targetRectangle;\n  /**\n   * Note about beak positioning: The actual beak width only matters for getting the gap between the callout and\n   * target, it does not impact the beak placement within the callout. For example example, if the beakWidth is 8,\n   * then the actual beakWidth is sqrroot(8^2 + 8^2) = 11.31x11.31. So the callout will need to be an extra 3 pixels\n   * away from its target. While the beak is being positioned in the callout it still acts as though it were 8x8.\n   */\n  const { positiveEdge, negativeEdge } = _getFlankingEdges(elementPosition.targetEdge);\n  const beakTargetPoint = _getCenterValue(target, elementPosition.targetEdge);\n  const elementBounds = new Rectangle(\n    beakWidth / 2,\n    elementPosition.elementRectangle.width - beakWidth / 2,\n    beakWidth / 2,\n    elementPosition.elementRectangle.height - beakWidth / 2,\n  );\n\n  let beakPosition: Rectangle = new Rectangle(0, beakWidth, 0, beakWidth);\n\n  beakPosition = _moveEdge(beakPosition, elementPosition.targetEdge * -1, -beakWidth / 2);\n\n  beakPosition = _centerEdgeToPoint(\n    beakPosition,\n    elementPosition.targetEdge * -1,\n    beakTargetPoint - _getRelativeRectEdgeValue(positiveEdge, elementPosition.elementRectangle),\n  );\n\n  if (!_isEdgeInBounds(beakPosition, elementBounds, positiveEdge)) {\n    beakPosition = _alignEdges(beakPosition, elementBounds, positiveEdge);\n  } else if (!_isEdgeInBounds(beakPosition, elementBounds, negativeEdge)) {\n    beakPosition = _alignEdges(beakPosition, elementBounds, negativeEdge);\n  }\n\n  return beakPosition;\n}\n\nfunction _getRectangleFromElement(element: Element): Rectangle {\n  const clientRect: ClientRect = element.getBoundingClientRect();\n\n  return new Rectangle(clientRect.left, clientRect.right, clientRect.top, clientRect.bottom);\n}\n\nfunction _getRectangleFromIRect(rect: IRectangle): Rectangle {\n  return new Rectangle(rect.left, rect.right, rect.top, rect.bottom);\n}\n\nfunction _getTargetRect(bounds: Rectangle, target: Element | MouseEvent | Point | Rectangle | undefined): Rectangle {\n  let targetRectangle: Rectangle;\n  if (target) {\n    // eslint-disable-next-line no-extra-boolean-cast\n    if (!!(target as MouseEvent).preventDefault) {\n      const ev = target as MouseEvent;\n      targetRectangle = new Rectangle(ev.clientX, ev.clientX, ev.clientY, ev.clientY);\n      // eslint-disable-next-line no-extra-boolean-cast\n    } else if (!!(target as Element).getBoundingClientRect) {\n      targetRectangle = _getRectangleFromElement(target as Element);\n      // HTMLImgElements can have x and y values. The check for it being a point must go last.\n    } else {\n      const rectOrPoint: Point & Rectangle = target as Point & Rectangle;\n      // eslint-disable-next-line deprecation/deprecation\n      const left = rectOrPoint.left || rectOrPoint.x;\n      // eslint-disable-next-line deprecation/deprecation\n      const top = rectOrPoint.top || rectOrPoint.y;\n      const right = rectOrPoint.right || left;\n      const bottom = rectOrPoint.bottom || top;\n      targetRectangle = new Rectangle(left, right, top, bottom);\n    }\n\n    if (!_isRectangleWithinBounds(targetRectangle, bounds)) {\n      const outOfBounds: RectangleEdge[] = _getOutOfBoundsEdges(targetRectangle, bounds);\n\n      for (const direction of outOfBounds) {\n        (targetRectangle as any)[RectangleEdge[direction]] = (bounds as any)[RectangleEdge[direction]];\n      }\n    }\n  } else {\n    targetRectangle = new Rectangle(0, 0, 0, 0);\n  }\n\n  return targetRectangle;\n}\n\n/**\n * If max height is less than zero it returns the bounds height instead.\n */\nfunction _getMaxHeightFromTargetRectangle(\n  targetRectangle: Rectangle,\n  targetEdge: DirectionalHint,\n  gapSpace: number,\n  bounds: Rectangle,\n  coverTarget?: boolean,\n) {\n  let maxHeight = 0;\n  const directionalHint = DirectionalDictionary[targetEdge];\n\n  // If cover target is set, then the max height should be calculated using the opposite of the target edge since\n  // that's the direction that the callout will expand in.\n  // For instance, if the directionalhint is bottomLeftEdge then the callout will position so it's bottom edge\n  // is aligned with the bottom of the target and expand up towards the top of the screen and the calculated max height\n  // is (bottom of target) - (top of screen) - gapSpace.\n  const target = coverTarget ? directionalHint.targetEdge * -1 : directionalHint.targetEdge;\n\n  if (target === RectangleEdge.top) {\n    maxHeight = _getEdgeValue(targetRectangle, directionalHint.targetEdge) - bounds.top - gapSpace;\n  } else if (target === RectangleEdge.bottom) {\n    maxHeight = bounds.bottom - _getEdgeValue(targetRectangle, directionalHint.targetEdge) - gapSpace;\n  } else {\n    maxHeight = bounds.bottom - targetRectangle.top - gapSpace;\n  }\n\n  return maxHeight > 0 ? maxHeight : bounds.height;\n}\n\nfunction _positionElementRelative(\n  props: IPositionProps,\n  elementToPosition: HTMLElement,\n  boundingRect: Rectangle,\n  previousPositions?: IPositionedData,\n): IElementPositionInfo {\n  const gap: number = props.gapSpace ? props.gapSpace : 0;\n  const targetRect: Rectangle = _getTargetRect(boundingRect, props.target);\n  const positionData: IPositionDirectionalHintData = _getAlignmentData(\n    _getPositionData(props.directionalHint, props.directionalHintForRTL, previousPositions)!,\n    targetRect,\n    boundingRect,\n    props.coverTarget,\n    props.alignTargetEdge,\n  );\n  const positionedElement: IElementPosition = _positionElementWithinBounds(\n    _getRectangleFromElement(elementToPosition),\n    targetRect,\n    boundingRect,\n    positionData,\n    gap,\n    props.directionalHintFixed,\n    props.coverTarget,\n  );\n  return { ...positionedElement, targetRectangle: targetRect };\n}\n\nfunction _finalizePositionData(\n  positionedElement: IElementPosition,\n  hostElement: HTMLElement,\n  bounds?: Rectangle,\n  coverTarget?: boolean,\n  doNotFinalizeReturnEdge?: boolean,\n): IPositionedData {\n  const finalizedElement: IPartialIRectangle = _finalizeElementPosition(\n    positionedElement.elementRectangle,\n    hostElement,\n    positionedElement.targetEdge,\n    bounds,\n    positionedElement.alignmentEdge,\n    coverTarget,\n    doNotFinalizeReturnEdge,\n  );\n  return {\n    elementPosition: finalizedElement,\n    targetEdge: positionedElement.targetEdge,\n    alignmentEdge: positionedElement.alignmentEdge,\n  };\n}\n\nfunction _positionElement(\n  props: IPositionProps,\n  hostElement: HTMLElement,\n  elementToPosition: HTMLElement,\n  previousPositions?: IPositionedData,\n): IPositionedData {\n  const boundingRect: Rectangle = props.bounds\n    ? _getRectangleFromIRect(props.bounds)\n    : new Rectangle(0, window.innerWidth - getScrollbarWidth(), 0, window.innerHeight);\n  const positionedElement: IElementPosition = _positionElementRelative(\n    props,\n    elementToPosition,\n    boundingRect,\n    previousPositions,\n  );\n  return _finalizePositionData(positionedElement, hostElement, boundingRect, props.coverTarget);\n}\n\nfunction _positionCallout(\n  props: ICalloutPositionProps,\n  hostElement: HTMLElement,\n  callout: HTMLElement,\n  previousPositions?: ICalloutPositionedInfo,\n  doNotFinalizeReturnEdge?: boolean,\n): ICalloutPositionedInfo {\n  const beakWidth: number = props.isBeakVisible ? props.beakWidth || 0 : 0;\n  const gap: number = _calculateActualBeakWidthInPixels(beakWidth) / 2 + (props.gapSpace ? props.gapSpace : 0);\n  const positionProps: IPositionProps = props;\n  positionProps.gapSpace = gap;\n  const boundingRect: Rectangle = props.bounds\n    ? _getRectangleFromIRect(props.bounds)\n    : new Rectangle(0, window.innerWidth - getScrollbarWidth(), 0, window.innerHeight);\n  const positionedElement: IElementPositionInfo = _positionElementRelative(\n    positionProps,\n    callout,\n    boundingRect,\n    previousPositions,\n  );\n  const beakPositioned: Rectangle = _positionBeak(beakWidth, positionedElement);\n  const finalizedBeakPosition: ICalloutBeakPositionedInfo = _finalizeBeakPosition(\n    positionedElement,\n    beakPositioned,\n    boundingRect,\n  );\n  return {\n    ..._finalizePositionData(positionedElement, hostElement, boundingRect, props.coverTarget, doNotFinalizeReturnEdge),\n    beakPosition: finalizedBeakPosition,\n  };\n}\n\nfunction _positionCard(\n  props: ICalloutPositionProps,\n  hostElement: HTMLElement,\n  callout: HTMLElement,\n  previousPositions?: ICalloutPositionedInfo,\n): ICalloutPositionedInfo {\n  return _positionCallout(props, hostElement, callout, previousPositions, true);\n}\n// END PRIVATE FUNCTIONS\n\nexport const __positioningTestPackage = {\n  _finalizePositionData,\n  _finalizeBeakPosition,\n  _calculateActualBeakWidthInPixels,\n  _positionElementWithinBounds,\n  _positionBeak,\n  _getPositionData,\n  _getMaxHeightFromTargetRectangle,\n};\n\n/**\n * Used to position an element relative to the given positioning props.\n * If positioning has been completed before, previousPositions can be passed to ensure that the positioning element\n * repositions based on its previous targets rather than starting with directionalhint.\n */\nexport function positionElement(\n  props: IPositionProps,\n  hostElement: HTMLElement,\n  elementToPosition: HTMLElement,\n  previousPositions?: IPositionedData,\n): IPositionedData {\n  return _positionElement(props, hostElement, elementToPosition, previousPositions);\n}\n\nexport function positionCallout(\n  props: IPositionProps,\n  hostElement: HTMLElement,\n  elementToPosition: HTMLElement,\n  previousPositions?: ICalloutPositionedInfo,\n): ICalloutPositionedInfo {\n  return _positionCallout(props, hostElement, elementToPosition, previousPositions);\n}\n\nexport function positionCard(\n  props: IPositionProps,\n  hostElement: HTMLElement,\n  elementToPosition: HTMLElement,\n  previousPositions?: ICalloutPositionedInfo,\n): ICalloutPositionedInfo {\n  return _positionCard(props, hostElement, elementToPosition, previousPositions);\n}\n\n/**\n * Gets the maximum height that a rectangle can have in order to fit below or above a target.\n * If the directional hint specifies a left or right edge (i.e. leftCenter) it will limit the height to the topBorder\n * of the target given.\n * If no bounds are provided then the window is treated as the bounds.\n */\nexport function getMaxHeight(\n  target: Element | MouseEvent | Point | Rectangle,\n  targetEdge: DirectionalHint,\n  gapSpace: number = 0,\n  bounds?: IRectangle,\n  coverTarget?: boolean,\n): number {\n  const mouseTarget: MouseEvent = target as MouseEvent;\n  const elementTarget: Element = target as Element;\n  const rectOrPointTarget: Point & Rectangle = target as Point & Rectangle;\n  let targetRect: Rectangle;\n  const boundingRectangle = bounds\n    ? _getRectangleFromIRect(bounds)\n    : new Rectangle(0, window.innerWidth - getScrollbarWidth(), 0, window.innerHeight);\n\n  // eslint-disable-next-line deprecation/deprecation\n  const left = rectOrPointTarget.left || rectOrPointTarget.x;\n  // eslint-disable-next-line deprecation/deprecation\n  const top = rectOrPointTarget.top || rectOrPointTarget.y;\n  const right = rectOrPointTarget.right || left;\n  const bottom = rectOrPointTarget.bottom || top;\n\n  // eslint-disable-next-line no-extra-boolean-cast -- may not actually be a MouseEvent\n  if (!!mouseTarget.stopPropagation) {\n    targetRect = new Rectangle(mouseTarget.clientX, mouseTarget.clientX, mouseTarget.clientY, mouseTarget.clientY);\n  } else if (left !== undefined && top !== undefined) {\n    targetRect = new Rectangle(left, right, top, bottom);\n  } else {\n    targetRect = _getRectangleFromElement(elementTarget);\n  }\n\n  return _getMaxHeightFromTargetRectangle(targetRect, targetEdge, gapSpace, boundingRectangle, coverTarget);\n}\n\n/**\n * Returns the opposite edge of the given RectangleEdge.\n */\nexport function getOppositeEdge(edge: RectangleEdge): RectangleEdge {\n  return edge * -1;\n}\n\nfunction _getBoundsFromTargetWindow(\n  target: Element | MouseEvent | Point | Rectangle | null,\n  targetWindow: IWindowWithSegments,\n): IRectangle {\n  let segments = undefined;\n  if (targetWindow.getWindowSegments) {\n    segments = targetWindow.getWindowSegments();\n  }\n\n  // Identify if we're dealing with single screen scenarios.\n  if (segments === undefined || segments.length <= 1) {\n    return {\n      top: 0,\n      left: 0,\n      right: targetWindow.innerWidth,\n      bottom: targetWindow.innerHeight,\n      width: targetWindow.innerWidth,\n      height: targetWindow.innerHeight,\n    };\n  }\n\n  // Logic for determining dual screen scenarios.\n  let x: number | undefined = 0;\n  let y: number | undefined = 0;\n\n  // If the target is an Element get coordinates for its center.\n  if (target !== null && !!(target as Element).getBoundingClientRect) {\n    const clientRect = (target as Element).getBoundingClientRect();\n    x = (clientRect.left + clientRect.right) / 2;\n    y = (clientRect.top + clientRect.bottom) / 2;\n  }\n  // If the target is not null get x-axis and y-axis coordinates directly.\n  else if (target !== null) {\n    // eslint-disable-next-line deprecation/deprecation\n    x = (target as Point).left || (target as MouseEvent | Point).x;\n    // eslint-disable-next-line deprecation/deprecation\n    y = (target as Point).top || (target as MouseEvent | Point).y;\n  }\n\n  let bounds = { top: 0, left: 0, right: 0, bottom: 0, width: 0, height: 0 };\n\n  // Define which window segment are the coordinates in and calculate bounds based on that.\n  for (const segment of segments) {\n    if (x && segment.left <= x && segment.right >= x && y && segment.top <= y && segment.bottom >= y) {\n      bounds = {\n        top: segment.top,\n        left: segment.left,\n        right: segment.right,\n        bottom: segment.bottom,\n        width: segment.width,\n        height: segment.height,\n      };\n    }\n  }\n\n  return bounds;\n}\n\nexport function getBoundsFromTargetWindow(\n  target: Element | MouseEvent | Point | Rectangle | null,\n  targetWindow: IWindowWithSegments,\n): IRectangle {\n  return _getBoundsFromTargetWindow(target, targetWindow);\n}\n","import { IKeytipProps } from '../../Keytip';\nimport { EventGroup, getId } from '../../Utilities';\nimport { KeytipEvents } from '../../utilities/keytips/KeytipConstants';\n\nexport interface IUniqueKeytip {\n  uniqueID: string;\n  keytip: IKeytipProps;\n}\n\n/**\n * This class is responsible for handling registering, updating, and unregistering of keytips\n */\nexport class KeytipManager {\n  private static _instance: KeytipManager = new KeytipManager();\n\n  public keytips: { [key: string]: IUniqueKeytip } = {};\n  public persistedKeytips: { [key: string]: IUniqueKeytip } = {};\n  public sequenceMapping: { [key: string]: IKeytipProps } = {};\n\n  // This is (and should be) updated and kept in sync\n  // with the inKeytipMode in KeytipLayer.\n  public inKeytipMode = false;\n\n  // Boolean that gets checked before entering keytip mode by the KeytipLayer\n  // Used for an override in special cases (e.g. Disable entering keytip mode when a modal is shown)\n  public shouldEnterKeytipMode = true;\n\n  // Boolean to indicate whether to delay firing an event to update subscribers of\n  // keytip data changed.\n  public delayUpdatingKeytipChange = false;\n\n  /**\n   * Static function to get singleton KeytipManager instance\n   *\n   * @returns Singleton KeytipManager instance\n   */\n  public static getInstance(): KeytipManager {\n    return this._instance;\n  }\n\n  /**\n   * Initialization code to set set parameters to define\n   * how the KeytipManager handles keytip data.\n   *\n   * @param delayUpdatingKeytipChange - T/F if we should delay notifiying keytip subscribers\n   * of keytip changes\n   */\n  public init(delayUpdatingKeytipChange: boolean) {\n    this.delayUpdatingKeytipChange = delayUpdatingKeytipChange;\n  }\n\n  /**\n   * Registers a keytip\n   *\n   * @param keytipProps - Keytip to register\n   * @param persisted - T/F if this keytip should be persisted, default is false\n   * @returns Unique ID for this keytip\n   */\n  public register(keytipProps: IKeytipProps, persisted: boolean = false): string {\n    let props: IKeytipProps = keytipProps;\n    if (!persisted) {\n      // Add the overflowSetSequence if necessary\n      props = this.addParentOverflow(keytipProps);\n      this.sequenceMapping[props.keySequences.toString()] = props;\n    }\n    // Create a unique keytip\n    const uniqueKeytip: IUniqueKeytip = this._getUniqueKtp(props);\n    // Add to dictionary\n    persisted\n      ? (this.persistedKeytips[uniqueKeytip.uniqueID] = uniqueKeytip)\n      : (this.keytips[uniqueKeytip.uniqueID] = uniqueKeytip);\n\n    // We only want to add something new if we are currently showing keytip mode\n    if (this.inKeytipMode || !this.delayUpdatingKeytipChange) {\n      const event = persisted ? KeytipEvents.PERSISTED_KEYTIP_ADDED : KeytipEvents.KEYTIP_ADDED;\n      EventGroup.raise(this, event, {\n        keytip: props,\n        uniqueID: uniqueKeytip.uniqueID,\n      });\n    }\n\n    return uniqueKeytip.uniqueID;\n  }\n\n  /**\n   * Update a keytip\n   *\n   * @param keytipProps - Keytip to update\n   * @param uniqueID - Unique ID of this keytip\n   */\n  public update(keytipProps: IKeytipProps, uniqueID: string): void {\n    const newKeytipProps = this.addParentOverflow(keytipProps);\n    const uniqueKeytip = this._getUniqueKtp(newKeytipProps, uniqueID);\n    const oldKeyTip = this.keytips[uniqueID];\n    if (oldKeyTip) {\n      // Update everything except 'visible'\n      uniqueKeytip.keytip.visible = oldKeyTip.keytip.visible;\n      // Update keytip in this.keytips\n      this.keytips[uniqueID] = uniqueKeytip;\n\n      // Update the sequence to be up to date\n      delete this.sequenceMapping[oldKeyTip.keytip.keySequences.toString()];\n      this.sequenceMapping[uniqueKeytip.keytip.keySequences.toString()] = uniqueKeytip.keytip;\n\n      // Raise event only if we are currently in keytip mode\n      if (this.inKeytipMode || !this.delayUpdatingKeytipChange) {\n        EventGroup.raise(this, KeytipEvents.KEYTIP_UPDATED, {\n          keytip: uniqueKeytip.keytip,\n          uniqueID: uniqueKeytip.uniqueID,\n        });\n      }\n    }\n  }\n\n  /**\n   * Unregisters a keytip\n   *\n   * @param keytipToRemove - IKeytipProps of the keytip to remove\n   * @param uniqueID - Unique ID of this keytip\n   * @param persisted - T/F if this keytip should be persisted, default is false\n   */\n  public unregister(keytipToRemove: IKeytipProps, uniqueID: string, persisted: boolean = false): void {\n    persisted ? delete this.persistedKeytips[uniqueID] : delete this.keytips[uniqueID];\n    !persisted && delete this.sequenceMapping[keytipToRemove.keySequences.toString()];\n\n    const event = persisted ? KeytipEvents.PERSISTED_KEYTIP_REMOVED : KeytipEvents.KEYTIP_REMOVED;\n    // Update keytips only if we're in keytip mode\n    if (this.inKeytipMode || !this.delayUpdatingKeytipChange) {\n      EventGroup.raise(this, event, {\n        keytip: keytipToRemove,\n        uniqueID: uniqueID,\n      });\n    }\n  }\n\n  /**\n   * Manual call to enter keytip mode\n   */\n  public enterKeytipMode(): void {\n    EventGroup.raise(this, KeytipEvents.ENTER_KEYTIP_MODE);\n  }\n\n  /**\n   * Manual call to exit keytip mode\n   */\n  public exitKeytipMode(): void {\n    EventGroup.raise(this, KeytipEvents.EXIT_KEYTIP_MODE);\n  }\n\n  /**\n   * Gets all IKeytipProps from this.keytips\n   *\n   * @returns All keytips stored in the manager\n   */\n  public getKeytips(): IKeytipProps[] {\n    return Object.keys(this.keytips).map(key => this.keytips[key].keytip);\n  }\n\n  /**\n   * Adds the overflowSetSequence to the keytipProps if its parent keytip also has it\n   *\n   * @param keytipProps - Keytip props to add overflowSetSequence to if necessary\n   * @returns - Modified keytip props, if needed to be modified\n   */\n  public addParentOverflow(keytipProps: IKeytipProps): IKeytipProps {\n    const fullSequence = [...keytipProps.keySequences];\n    fullSequence.pop();\n    if (fullSequence.length !== 0) {\n      const parentKeytip = this.sequenceMapping[fullSequence.toString()];\n      if (parentKeytip && parentKeytip.overflowSetSequence) {\n        return {\n          ...keytipProps,\n          overflowSetSequence: parentKeytip.overflowSetSequence,\n        };\n      }\n    }\n    return keytipProps;\n  }\n\n  /**\n   * Public function to bind for overflow items that have a submenu\n   */\n  public menuExecute(overflowButtonSequences: string[], keytipSequences: string[]) {\n    EventGroup.raise(this, KeytipEvents.PERSISTED_KEYTIP_EXECUTE, {\n      overflowButtonSequences,\n      keytipSequences,\n    });\n  }\n\n  /**\n   * Creates an IUniqueKeytip object\n   *\n   * @param keytipProps - IKeytipProps\n   * @param uniqueID - Unique ID, will default to the next unique ID if not passed\n   * @returns IUniqueKeytip object\n   */\n  private _getUniqueKtp(keytipProps: IKeytipProps, uniqueID: string = getId()): IUniqueKeytip {\n    return { keytip: { ...keytipProps }, uniqueID };\n  }\n}\n","import { KTP_SEPARATOR, KTP_PREFIX, DATAKTP_TARGET, DATAKTP_EXECUTE_TARGET, KTP_LAYER_ID } from './KeytipConstants';\nimport { addElementAtIndex } from '../../Utilities';\n\n/**\n * Converts a whole set of KeySequences into one keytip ID, which will be the ID for the last keytip sequence specified\n * keySequences should not include the initial keytip 'start' sequence.\n *\n * @param keySequences - Full path of IKeySequences for one keytip.\n * @returns String to use for the keytip ID.\n */\nexport function sequencesToID(keySequences: string[]): string {\n  return keySequences.reduce((prevValue: string, keySequence: string): string => {\n    return prevValue + KTP_SEPARATOR + keySequence.split('').join(KTP_SEPARATOR);\n  }, KTP_PREFIX);\n}\n\n/**\n * Merges an overflow sequence with a key sequence.\n *\n * @param keySequences - Full sequence for one keytip.\n * @param overflowKeySequences - Full overflow keytip sequence.\n * @returns Sequence that will be used by the keytip when in the overflow.\n */\nexport function mergeOverflows(keySequences: string[], overflowKeySequences: string[]): string[] {\n  const overflowSequenceLen = overflowKeySequences.length;\n  const overflowSequence = [...overflowKeySequences].pop();\n  const newKeySequences = [...keySequences];\n  return addElementAtIndex(newKeySequences, overflowSequenceLen - 1, overflowSequence!);\n}\n\n/**\n * Constructs the data-ktp-target attribute selector from a full key sequence.\n *\n * @param keySequences - Full string[] for a Keytip.\n * @returns String selector to use to query for the keytip target.\n */\nexport function ktpTargetFromSequences(keySequences: string[]): string {\n  return '[' + DATAKTP_TARGET + '=\"' + sequencesToID(keySequences) + '\"]';\n}\n\n/**\n * Constructs the data-ktp-execute-target attribute selector from a keytip ID.\n *\n * @param keytipId - ID of the Keytip.\n * @returns String selector to use to query for the keytip execute target.\n */\nexport function ktpTargetFromId(keytipId: string): string {\n  return '[' + DATAKTP_EXECUTE_TARGET + '=\"' + keytipId + '\"]';\n}\n\n/**\n * Gets the aria-describedby value to put on the component with this keytip.\n *\n * @param keySequences - KeySequences of the keytip.\n * @returns The aria-describedby value to set on the component with this keytip.\n */\nexport function getAriaDescribedBy(keySequences: string[]): string {\n  const describedby = ' ' + KTP_LAYER_ID;\n  if (!keySequences.length) {\n    // Return just the layer ID\n    return describedby;\n  }\n\n  return describedby + ' ' + sequencesToID(keySequences);\n}\n"],"sourceRoot":"","x_microsoft_symbol_client_key":"85d122d95f282a1accfd3b40d75b0a450602b7be3db22a00a80f81484a243218"}