define(['exports', 'aurelia-framework', './../../lib/device-helper'], function (exports, _aureliaFramework, _deviceHelper) {
    'use strict';

    exports.__esModule = true;
    exports.MasterDetail = undefined;

    function _initDefineProp(target, property, descriptor, context) {
        if (!descriptor) return;
        Object.defineProperty(target, property, {
            enumerable: descriptor.enumerable,
            configurable: descriptor.configurable,
            writable: descriptor.writable,
            value: descriptor.initializer ? descriptor.initializer.call(context) : void 0
        });
    }

    function _applyDecoratedDescriptor(target, property, decorators, descriptor, context) {
        var desc = {};
        Object['ke' + 'ys'](descriptor).forEach(function (key) {
            desc[key] = descriptor[key];
        });
        desc.enumerable = !!desc.enumerable;
        desc.configurable = !!desc.configurable;

        if ('value' in desc || desc.initializer) {
            desc.writable = true;
        }

        desc = decorators.slice().reverse().reduce(function (desc, decorator) {
            return decorator(target, property, desc) || desc;
        }, desc);

        if (context && desc.initializer !== void 0) {
            desc.value = desc.initializer ? desc.initializer.call(context) : void 0;
            desc.initializer = undefined;
        }

        if (desc.initializer === void 0) {
            Object['define' + 'Property'](target, property, desc);
            desc = null;
        }

        return desc;
    }

    function _initializerWarningHelper(descriptor, context) {
        throw new Error('Decorating class property failed. Please ensure that transform-class-properties is enabled.');
    }

    var _dec, _dec2, _class, _desc, _value, _class2, _descriptor;

    let MasterDetail = exports.MasterDetail = (_dec = (0, _aureliaFramework.customElement)('master-detail'), _dec2 = (0, _aureliaFramework.inject)(Element), _dec(_class = _dec2(_class = (_class2 = class MasterDetail {

        constructor(element) {
            _initDefineProp(this, 'isMasterVisible', _descriptor, this);

            this.element = element;
            this.element.classList.add((0, _deviceHelper.isMobile)() ? "master-detail-mobile-layout" : "master-detail-desktop-layout");
        }

        attached() {
            this.masterElement = this.element.querySelector(".master");
            this.updateMasterVisiblity();
        }

        detached() {
            this.masterElement = null;
        }

        isMasterVisibleChanged() {
            this.updateMasterVisiblity();
        }

        updateMasterVisiblity() {
            if (this.masterElement) {
                if (this.isMasterVisible) {
                    this.element.classList.remove("master-closed");
                } else {
                    this.element.classList.add("master-closed");
                }
            }
        }
    }, (_descriptor = _applyDecoratedDescriptor(_class2.prototype, 'isMasterVisible', [_aureliaFramework.bindable], {
        enumerable: true,
        initializer: null
    })), _class2)) || _class) || _class);
});
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm1hc3Rlci1kZXRhaWwuanMiXSwibmFtZXMiOlsiTWFzdGVyRGV0YWlsIiwiRWxlbWVudCIsImNvbnN0cnVjdG9yIiwiZWxlbWVudCIsImNsYXNzTGlzdCIsImFkZCIsImF0dGFjaGVkIiwibWFzdGVyRWxlbWVudCIsInF1ZXJ5U2VsZWN0b3IiLCJ1cGRhdGVNYXN0ZXJWaXNpYmxpdHkiLCJkZXRhY2hlZCIsImlzTWFzdGVyVmlzaWJsZUNoYW5nZWQiLCJpc01hc3RlclZpc2libGUiLCJyZW1vdmUiXSwibWFwcGluZ3MiOiI7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7OztRQUthQSxZLFdBQUFBLFksV0FGWixxQ0FBYyxlQUFkLEMsVUFDQSw4QkFBT0MsT0FBUCxDLDBDQUNNLE1BQU1ELFlBQU4sQ0FBbUI7O0FBTXRCRSxvQkFBWUMsT0FBWixFQUFxQjtBQUFBOztBQUNqQixpQkFBS0EsT0FBTCxHQUFlQSxPQUFmO0FBQ0EsaUJBQUtBLE9BQUwsQ0FBYUMsU0FBYixDQUF1QkMsR0FBdkIsQ0FBMkIsZ0NBQWEsNkJBQWIsR0FBNkMsOEJBQXhFO0FBQ0g7O0FBRURDLG1CQUFXO0FBQ1AsaUJBQUtDLGFBQUwsR0FBcUIsS0FBS0osT0FBTCxDQUFhSyxhQUFiLENBQTJCLFNBQTNCLENBQXJCO0FBQ0EsaUJBQUtDLHFCQUFMO0FBQ0g7O0FBRURDLG1CQUFXO0FBQ1AsaUJBQUtILGFBQUwsR0FBcU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