module.exports = "import * as React from 'react';\nimport {\n  CommandBar,\n  IContextualMenuItem\n} from '../../../../index';\nimport { items, farItems } from './data';\n\nexport interface IChangingItemsCommandBarState {\n  items?: IContextualMenuItem[];\n  farItems?: IContextualMenuItem[];\n}\n\nexport class CommandBarRandomItemsExample extends React.Component<any, IChangingItemsCommandBarState> {\n  private _changeTimerId;\n\n  constructor() {\n    super();\n\n    this.state = {\n      items: items,\n      farItems: farItems\n    };\n\n  };\n\n  public componentDidMount() {\n    this._changeTimerId = window.setInterval(this._updateItems.bind(this), 5000);\n  }\n\n  public componentWillUnmount() {\n    if (this._changeTimerId) {\n      window.clearInterval(this._changeTimerId);\n    }\n  }\n\n  public render() {\n\n    return (\n      <div className='ms-ChangedItemsCommandBarExample'>\n        <CommandBar\n          items={ this.state.items }\n          farItems={ this.state.farItems }\n          />\n      </div>\n    );\n  }\n\n  private _updateItems() {\n    this.setState({\n      items: _getRandomizedArray(items, 2),\n      farItems: _getRandomizedArray(farItems, 1)\n    });\n  }\n}\n\nfunction _getRandomizedArray(array: any[], min: number) {\n  let count = min + Math.round(Math.random() * (array.length - min));\n  let itemsLeft = [].concat(array);\n  let newArray = [];\n\n  for (let i = 0; i < count; i++) {\n    newArray = newArray.concat(itemsLeft.splice(Math.floor(Math.random() * itemsLeft.length), 1));\n  }\n\n  return newArray;\n}\n";