var __extends = (this && this.__extends) || function (d, b) {
    for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
    function __() { this.constructor = d; }
    d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
define(["require", "exports", 'react', '../../../../index'], function (require, exports, React, index_1) {
    "use strict";
    var PeoplePickerEditModeExample = (function (_super) {
        __extends(PeoplePickerEditModeExample, _super);
        function PeoplePickerEditModeExample() {
            _super.call(this);
            this._existingList = [
                {
                    imageUrl: '//www.fillmurray.com/200/200',
                    imageInitials: 'PV',
                    primaryText: 'Peter Venkman',
                    secondaryText: 'Ghostbuster',
                    tertiaryText: 'In a meeting',
                    optionalText: 'Available at 4:00pm'
                },
                {
                    imageUrl: '//www.fillmurray.com/200/200',
                    imageInitials: 'PC',
                    primaryText: 'Phil Connors',
                    secondaryText: 'Reporter',
                    tertiaryText: 'In a meeting',
                    optionalText: 'Available at 4:00pm'
                },
            ];
            this._peopleList = [
                {
                    imageUrl: '//www.fillmurray.com/200/200',
                    imageInitials: 'PV',
                    primaryText: 'Peter Venkman',
                    secondaryText: 'Ghostbuster',
                    tertiaryText: 'In a meeting',
                    optionalText: 'Available at 4:00pm'
                },
                {
                    imageUrl: '//www.fillmurray.com/200/200',
                    imageInitials: 'PC',
                    primaryText: 'Phil Connors',
                    secondaryText: 'Reporter',
                    tertiaryText: 'In a meeting',
                    optionalText: 'Available at 4:00pm'
                },
                {
                    imageUrl: '//www.fillmurray.com/200/200',
                    imageInitials: 'CS',
                    primaryText: 'Carl Spackler',
                    secondaryText: 'Golpher',
                    tertiaryText: 'In a meeting',
                    optionalText: 'Available at 4:00pm'
                },
                {
                    imageUrl: '//www.fillmurray.com/200/200',
                    imageInitials: 'SZ',
                    primaryText: 'Steve Zissou',
                    secondaryText: 'Oceanographer',
                    tertiaryText: 'In a meeting',
                    optionalText: 'Available at 4:00pm'
                },
                {
                    imageUrl: '//www.fillmurray.com/200/200',
                    imageInitials: 'BH',
                    primaryText: 'Bob Harris',
                    secondaryText: 'Actor',
                    tertiaryText: 'In a meeting',
                    optionalText: 'Available at 4:00pm'
                },
                {
                    imageUrl: '//www.fillmurray.com/200/200',
                    imageInitials: 'BB',
                    primaryText: 'Bunny Breckinridge',
                    secondaryText: 'Actor',
                    tertiaryText: 'In a meeting',
                    optionalText: 'Available at 4:00pm'
                },
            ];
            this._onFilterChanged = this._onFilterChanged.bind(this);
            this._onRemoveSuggestion = this._onRemoveSuggestion.bind(this);
            this.state = {
                suggestions: this._peopleList,
                initialItems: this._existingList
            };
        }
        PeoplePickerEditModeExample.prototype.render = function () {
            var _this = this;
            var _a = this.state, suggestions = _a.suggestions, initialItems = _a.initialItems;
            return (React.createElement("div", null, React.createElement(index_1.PeoplePicker, {ref: function (c) { return _this._peoplePickerRef = c; }, suggestions: suggestions, initialItems: initialItems, type: index_1.PeoplePickerType.compact, canSearchMore: false, addedMemberCountFormatText: '{0} people added', searchCategoryName: 'Suggested Contacts', noResultsText: 'No Results Available', onSearchFieldChanged: this._onFilterChanged, onRemoveSuggestion: this._onRemoveSuggestion, primarySearchText: 'Showing top results', secondarySearchText: 'Search Contacts & Directory', disconnectedText: 'We are having trouble connecting to the server.<br>Please try again in a few minutes.'})));
        };
        PeoplePickerEditModeExample.prototype._onFilterChanged = function (filterText) {
            this.setState({
                suggestions: this._peopleList.filter(function (item) { return item.primaryText.toLowerCase().indexOf(filterText.toLowerCase()) >= 0; })
            });
        };
        ;
        PeoplePickerEditModeExample.prototype._onRemoveSuggestion = function (index, persona) {
            var personas = this.state.suggestions;
            personas.splice(index, 1);
            this.setState({
                suggestions: personas
            });
        };
        return PeoplePickerEditModeExample;
    }(React.Component));
    exports.PeoplePickerEditModeExample = PeoplePickerEditModeExample;
});
