var CollapsiblePanel = Namespace.declare("com.twitter.Bootstrap",
    class CollapsiblePanel extends UcpComponent {
        static get implements() { return []; };
        static start() {}
        static get dependencies() {
            return [
                "/EAMD.ucp/Components/com/twitter/Bootstrap/Accordion/3.3.7/Accordion.component.xml"
            ];
        }


        constructor() {
            super();
            this.heading = "CollapsiblePanel.heading";
            this.cssClasses = "col-sm-12";
        }

        init() {
            if (this._private.isInitialized)
                return;
            super.init();
            return this;
        }

        get name() {
            return this.heading;
        }

        set name(newValue) {
            if (this.properties)
                this.properties.heading = newValue;
            else
                this.heading = newValue;
        }

        get opened() {
            return this.panelBodyDocumentElement.classList.contains("in");
        }

        set opened(newValue) {
            this.properties.opened = newValue;
            const panelBDE = this.panelBodyDocumentElement;
            if (panelBDE.classList.contains("in") == newValue) {

            } else if (newValue) {
                panelBDE.classList.add("in");
            } else {
                panelBDE.classList.remove("in");
            }

        }

        get panelBodyDocumentElement() {
            return this.defaultView.documentElement.children[1];
        }

        handleSelection(event, item) {
            console.debug(this.constructor.name + ": handleSelection", item);
        }

        updateView(view) {
            console.debug("update " + this.constructor.name);
        }
    }
);