(window["webpackJsonp"] = window["webpackJsonp"] || []).push([[0],{

/***/ "../sample-base/lib/component/Opener.js":
/*!**********************************************!*\
  !*** ../sample-base/lib/component/Opener.js ***!
  \**********************************************/
/*! exports provided: Opener, default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Opener", function() { return Opener; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return Opener; });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "../../node_modules/react/index.js");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var mobx_react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! mobx-react */ "../../node_modules/mobx-react/index.module.js");
/* harmony import */ var _twii_core_ui_lib_component_AppLink__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @twii/core-ui/lib/component/AppLink */ "../core-ui/lib/component/AppLink.js");
/* harmony import */ var _twii_core_ui_lib_component_AppLink__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_twii_core_ui_lib_component_AppLink__WEBPACK_IMPORTED_MODULE_2__);
/* harmony import */ var _twii_core_ui_fabric_lib_component_BoundTextField__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @twii/core-ui-fabric/lib/component/BoundTextField */ "../core-ui-fabric/lib/component/BoundTextField.js");
/* harmony import */ var _twii_core_ui_fabric_lib_component_BoundTextField__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_twii_core_ui_fabric_lib_component_BoundTextField__WEBPACK_IMPORTED_MODULE_3__);
/* harmony import */ var office_ui_fabric_react_lib_Button__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! office-ui-fabric-react/lib/Button */ "../../node_modules/office-ui-fabric-react/lib/Button.js");
/* harmony import */ var office_ui_fabric_react_lib_Button__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(office_ui_fabric_react_lib_Button__WEBPACK_IMPORTED_MODULE_4__);
var __extends = (undefined && undefined.__extends) || (function () {
    var extendStatics = Object.setPrototypeOf ||
        ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
        function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
var __decorate = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};





var AppHostDetails = /** @class */ (function (_super) {
    __extends(AppHostDetails, _super);
    function AppHostDetails() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this._onClose = function () {
            _this.props.host.close();
        };
        return _this;
    }
    AppHostDetails.prototype.render = function () {
        return (react__WEBPACK_IMPORTED_MODULE_0__["createElement"]("div", { style: { margin: 8, padding: 8, border: "1px solid #cccccc" } },
            react__WEBPACK_IMPORTED_MODULE_0__["createElement"]("div", { style: { paddingTop: 8, paddingBottom: 8 } },
                "Host Id: ",
                this.props.host.id),
            react__WEBPACK_IMPORTED_MODULE_0__["createElement"](_twii_core_ui_fabric_lib_component_BoundTextField__WEBPACK_IMPORTED_MODULE_3__["BoundTextField"], { label: "Window Title", binding: { target: this.props.host, key: "title" } }),
            react__WEBPACK_IMPORTED_MODULE_0__["createElement"](office_ui_fabric_react_lib_Button__WEBPACK_IMPORTED_MODULE_4__["PrimaryButton"], { onClick: this._onClose }, "Close Host")));
    };
    AppHostDetails = __decorate([
        mobx_react__WEBPACK_IMPORTED_MODULE_1__["observer"]
    ], AppHostDetails);
    return AppHostDetails;
}(react__WEBPACK_IMPORTED_MODULE_0__["Component"]));
var Opener = /** @class */ (function (_super) {
    __extends(Opener, _super);
    function Opener(props) {
        var _this = _super.call(this, props) || this;
        _this._onHostOpened = function (host) {
            _this._beforeUnloadHandler = function () {
                _this._onHostClosed(host);
            };
            host.addEventListener("beforeunload", _this._beforeUnloadHandler);
            var openHosts = [host].concat(_this.state.openHosts);
            _this.setState({ openHosts: openHosts });
        };
        _this._onHostClosed = function (host) {
            host.removeEventListener("beforeunload", _this._beforeUnloadHandler);
            var openHosts = [].concat(_this.state.openHosts);
            var idx = openHosts.indexOf(host);
            if (idx >= 0) {
                openHosts.splice(idx, 1);
                _this.setState({ openHosts: openHosts });
            }
        };
        _this.state = { openHosts: [] };
        return _this;
    }
    Opener.prototype.render = function () {
        return (react__WEBPACK_IMPORTED_MODULE_0__["createElement"]("div", null,
            react__WEBPACK_IMPORTED_MODULE_0__["createElement"]("div", { style: { padding: 8 } },
                react__WEBPACK_IMPORTED_MODULE_0__["createElement"](_twii_core_ui_lib_component_AppLink__WEBPACK_IMPORTED_MODULE_2__["AppLink"], { host: this.props.host, request: { path: "/samples/common/opener" }, open: true, onHostOpened: this._onHostOpened }, "Open Another Opener")),
            react__WEBPACK_IMPORTED_MODULE_0__["createElement"]("div", null, this.state.openHosts.map(function (h, idx) {
                return react__WEBPACK_IMPORTED_MODULE_0__["createElement"](AppHostDetails, { key: idx, host: h });
            }))));
    };
    return Opener;
}(react__WEBPACK_IMPORTED_MODULE_0__["Component"]));

//# sourceMappingURL=Opener.js.map

/***/ })

}]);
//# sourceMappingURL=0.js.map