YUI.add('widget-stdmod', function (Y, NAME) {

/**
 * Provides standard module support for Widgets through an extension.
 *
 * @module widget-stdmod
 */
    var L = Y.Lang,
        Node = Y.Node,
        UA = Y.UA,
        Widget = Y.Widget,

        EMPTY = "",
        HD = "hd",
        BD = "bd",
        FT = "ft",
        HEADER = "header",
        BODY = "body",
        FOOTER = "footer",
        FILL_HEIGHT = "fillHeight",
        STDMOD = "stdmod",

        NODE_SUFFIX = "Node",
        CONTENT_SUFFIX = "Content",

        FIRST_CHILD = "firstChild",
        CHILD_NODES = "childNodes",
        OWNER_DOCUMENT = "ownerDocument",

        CONTENT_BOX = "contentBox",

        HEIGHT = "height",
        OFFSET_HEIGHT = "offsetHeight",
        AUTO = "auto",

        HeaderChange = "headerContentChange",
        BodyChange = "bodyContentChange",
        FooterChange = "footerContentChange",
        FillHeightChange = "fillHeightChange",
        HeightChange = "heightChange",
        ContentUpdate = "contentUpdate",

        RENDERUI = "renderUI",
        BINDUI = "bindUI",
        SYNCUI = "syncUI",

        APPLY_PARSED_CONFIG = "_applyParsedConfig",

        UI = Y.Widget.UI_SRC;

    /**
     * Widget extension, which can be used to add Standard Module support to the
     * base Widget class, through the <a href="Base.html#method_build">Base.build</a>
     * method.
     * <p>
     * The extension adds header, body and footer sections to the Widget's content box and
     * provides the corresponding methods and attributes to modify the contents of these sections.
     * </p>
     * @class WidgetStdMod
     * @param {Object} The user configuration object
     */
    function StdMod(config) {}

    /**
     * Constant used to refer the the standard module header, in methods which expect a section specifier
     *
     * @property HEADER
     * @static
     * @type String
     */
    StdMod.HEADER = HEADER;

    /**
     * Constant used to refer the the standard module body, in methods which expect a section specifier
     *
     * @property BODY
     * @static
     * @type String
     */
    StdMod.BODY = BODY;

    /**
     * Constant used to refer the the standard module footer, in methods which expect a section specifier
     *
     * @property FOOTER
     * @static
     * @type String
     */
    StdMod.FOOTER = FOOTER;

    /**
     * Constant used to specify insertion position, when adding content to sections of the standard module in
     * methods which expect a "where" argument.
     * <p>
     * Inserts new content <em>before</em> the sections existing content.
     * </p>
     * @property AFTER
     * @static
     * @type String
     */
    StdMod.AFTER = "after";

    /**
     * Constant used to specify insertion position, when adding content to sections of the standard module in
     * methods which expect a "where" argument.
     * <p>
     * Inserts new content <em>before</em> the sections existing content.
     * </p>
     * @property BEFORE
     * @static
     * @type String
     */
    StdMod.BEFORE = "before";
    /**
     * Constant used to specify insertion position, when adding content to sections of the standard module in
     * methods which expect a "where" argument.
     * <p>
     * <em>Replaces</em> the sections existing content, with new content.
     * </p>
     * @property REPLACE
     * @static
     * @type String
     */
    StdMod.REPLACE = "replace";

    var STD_HEADER = StdMod.HEADER,
        STD_BODY = StdMod.BODY,
        STD_FOOTER = StdMod.FOOTER,

        HEADER_CONTENT = STD_HEADER + CONTENT_SUFFIX,
        FOOTER_CONTENT = STD_FOOTER + CONTENT_SUFFIX,
        BODY_CONTENT = STD_BODY + CONTENT_SUFFIX;

    /**
     * Static property used to define the default attribute
     * configuration introduced by WidgetStdMod.
     *
     * @property ATTRS
     * @type Object
     * @static
     */
    StdMod.ATTRS = {

        /**
         * @attribute headerContent
         * @type HTML
         * @default undefined
         * @description The content to be added to the header section. This will replace any existing content
         * in the header. If you want to append, or insert new content, use the <a href="#method_setStdModContent">setStdModContent</a> method.
         */
        headerContent: {
            value:null
        },

        /**
         * @attribute footerContent
         * @type HTML
         * @default undefined
         * @description The content to be added to the footer section. This will replace any existing content
         * in the footer. If you want to append, or insert new content, use the <a href="#method_setStdModContent">setStdModContent</a> method.
         */
        footerContent: {
            value:null
        },

        /**
         * @attribute bodyContent
         * @type HTML
         * @default undefined
         * @description The content to be added to the body section. This will replace any existing content
         * in the body. If you want to append, or insert new content, use the <a href="#method_setStdModContent">setStdModContent</a> method.
         */
        bodyContent: {
            value:null
        },

        /**
         * @attribute fillHeight
         * @type {String}
         * @default WidgetStdMod.BODY
         * @description The section (WidgetStdMod.HEADER, WidgetStdMod.BODY or WidgetStdMod.FOOTER) which should be resized to fill the height of the standard module, when a
         * height is set on the Widget. If a height is not set on the widget, then all sections are sized based on
         * their content.
         */
        fillHeight: {
            value: StdMod.BODY,
            validator: function(val) {
                 return this._validateFillHeight(val);
            }
        }
    };

    /**
     * The HTML parsing rules for the WidgetStdMod class.
     *
     * @property HTML_PARSER
     * @static
     * @type Object
     */
    StdMod.HTML_PARSER = {
        headerContent: function(contentBox) {
            return this._parseStdModHTML(STD_HEADER);
        },

        bodyContent: function(contentBox) {
            return this._parseStdModHTML(STD_BODY);
        },

        footerContent : function(contentBox) {
            return this._parseStdModHTML(STD_FOOTER);
        }
    };

    /**
     * Static hash of default class names used for the header,
     * body and footer sections of the standard module, keyed by
     * the section identifier (WidgetStdMod.STD_HEADER, WidgetStdMod.STD_BODY, WidgetStdMod.STD_FOOTER)
     *
     * @property SECTION_CLASS_NAMES
     * @static
     * @type Object
     */
    StdMod.SECTION_CLASS_NAMES = {
        header: Widget.getClassName(HD),
        body: Widget.getClassName(BD),
        footer: Widget.getClassName(FT)
    };

    /**
     * The template HTML strings for each of the standard module sections. Section entries are keyed by the section constants,
     * WidgetStdMod.HEADER, WidgetStdMod.BODY, WidgetStdMod.FOOTER, and contain the HTML to be added for each section.
     * e.g.
     * <pre>
     *    {
     *       header : '&lt;div class="yui-widget-hd"&gt;&lt;/div&gt;',
     *       body : '&lt;div class="yui-widget-bd"&gt;&lt;/div&gt;',
     *       footer : '&lt;div class="yui-widget-ft"&gt;&lt;/div&gt;'
     *    }
     * </pre>
     * @property TEMPLATES
     * @type Object
     * @static
     */
    StdMod.TEMPLATES = {
        header : '<div class="' + StdMod.SECTION_CLASS_NAMES[STD_HEADER] + '"></div>',
        body : '<div class="' + StdMod.SECTION_CLASS_NAMES[STD_BODY] + '"></div>',
        footer : '<div class="' + StdMod.SECTION_CLASS_NAMES[STD_FOOTER] + '"></div>'
    };

    StdMod.prototype = {

        initializer : function() {
            this._stdModNode = this.get(CONTENT_BOX);

            Y.before(this._renderUIStdMod, this, RENDERUI);
            Y.before(this._bindUIStdMod, this, BINDUI);
            Y.before(this._syncUIStdMod, this, SYNCUI);
        },

        /**
         * Synchronizes the UI to match the Widgets standard module state.
         * <p>
         * This method is invoked after syncUI is invoked for the Widget class
         * using YUI's aop infrastructure.
         * </p>
         * @method _syncUIStdMod
         * @protected
         */
        _syncUIStdMod : function() {
            var stdModParsed = this._stdModParsed;

            if (!stdModParsed || !stdModParsed[HEADER_CONTENT]) {
                this._uiSetStdMod(STD_HEADER, this.get(HEADER_CONTENT));
            }

            if (!stdModParsed || !stdModParsed[BODY_CONTENT]) {
                this._uiSetStdMod(STD_BODY, this.get(BODY_CONTENT));
            }

            if (!stdModParsed || !stdModParsed[FOOTER_CONTENT]) {
                this._uiSetStdMod(STD_FOOTER, this.get(FOOTER_CONTENT));
            }

            this._uiSetFillHeight(this.get(FILL_HEIGHT));
        },

        /**
         * Creates/Initializes the DOM for standard module support.
         * <p>
         * This method is invoked after renderUI is invoked for the Widget class
         * using YUI's aop infrastructure.
         * </p>
         * @method _renderUIStdMod
         * @protected
         */
        _renderUIStdMod : function() {
            this._stdModNode.addClass(Widget.getClassName(STDMOD));
            this._renderStdModSections();

            //This normally goes in bindUI but in order to allow setStdModContent() to work before renderUI
            //stage, these listeners should be set up at the earliest possible time.
            this.after(HeaderChange, this._afterHeaderChange);
            this.after(BodyChange, this._afterBodyChange);
            this.after(FooterChange, this._afterFooterChange);
        },

        _renderStdModSections : function() {
            if (L.isValue(this.get(HEADER_CONTENT))) { this._renderStdMod(STD_HEADER); }
            if (L.isValue(this.get(BODY_CONTENT))) { this._renderStdMod(STD_BODY); }
            if (L.isValue(this.get(FOOTER_CONTENT))) { this._renderStdMod(STD_FOOTER); }
        },

        /**
         * Binds event listeners responsible for updating the UI state in response to
         * Widget standard module related state changes.
         * <p>
         * This method is invoked after bindUI is invoked for the Widget class
         * using YUI's aop infrastructure.
         * </p>
         * @method _bindUIStdMod
         * @protected
         */
        _bindUIStdMod : function() {
            // this.after(HeaderChange, this._afterHeaderChange);
            // this.after(BodyChange, this._afterBodyChange);
            // this.after(FooterChange, this._afterFooterChange);

            this.after(FillHeightChange, this._afterFillHeightChange);
            this.after(HeightChange, this._fillHeight);
            this.after(ContentUpdate, this._fillHeight);
        },

        /**
         * Default attribute change listener for the headerContent attribute, responsible
         * for updating the UI, in response to attribute changes.
         *
         * @method _afterHeaderChange
         * @protected
         * @param {EventFacade} e The event facade for the attribute change
         */
        _afterHeaderChange : function(e) {
            if (e.src !== UI) {
                this._uiSetStdMod(STD_HEADER, e.newVal, e.stdModPosition);
            }
        },

        /**
         * Default attribute change listener for the bodyContent attribute, responsible
         * for updating the UI, in response to attribute changes.
         *
         * @method _afterBodyChange
         * @protected
         * @param {EventFacade} e The event facade for the attribute change
         */
        _afterBodyChange : function(e) {
            if (e.src !== UI) {
                this._uiSetStdMod(STD_BODY, e.newVal, e.stdModPosition);
            }
        },

        /**
         * Default attribute change listener for the footerContent attribute, responsible
         * for updating the UI, in response to attribute changes.
         *
         * @method _afterFooterChange
         * @protected
         * @param {EventFacade} e The event facade for the attribute change
         */
        _afterFooterChange : function(e) {
            if (e.src !== UI) {
                this._uiSetStdMod(STD_FOOTER, e.newVal, e.stdModPosition);
            }
        },

        /**
         * Default attribute change listener for the fillHeight attribute, responsible
         * for updating the UI, in response to attribute changes.
         *
         * @method _afterFillHeightChange
         * @protected
         * @param {EventFacade} e The event facade for the attribute change
         */
        _afterFillHeightChange: function (e) {
            this._uiSetFillHeight(e.newVal);
        },

        /**
         * Default validator for the fillHeight attribute. Verifies that the
         * value set is a valid section specifier - one of WidgetStdMod.HEADER, WidgetStdMod.BODY or WidgetStdMod.FOOTER,
         * or a falsey value if fillHeight is to be disabled.
         *
         * @method _validateFillHeight
         * @protected
         * @param {String} val The section which should be setup to fill height, or false/null to disable fillHeight
         * @return true if valid, false if not
         */
        _validateFillHeight : function(val) {
            return !val || val == StdMod.BODY || val == StdMod.HEADER || val == StdMod.FOOTER;
        },

        /**
         * Updates the rendered UI, to resize the provided section so that the standard module fills out
         * the specified widget height. Note: This method does not check whether or not a height is set
         * on the Widget.
         *
         * @method _uiSetFillHeight
         * @protected
         * @param {String} fillSection A valid section specifier - one of WidgetStdMod.HEADER, WidgetStdMod.BODY or WidgetStdMod.FOOTER
         */
        _uiSetFillHeight : function(fillSection) {
            var fillNode = this.getStdModNode(fillSection);
            var currNode = this._currFillNode;

            if (currNode && fillNode !== currNode){
                currNode.setStyle(HEIGHT, EMPTY);
            }

            if (fillNode) {
                this._currFillNode = fillNode;
            }

            this._fillHeight();
        },

        /**
         * Updates the rendered UI, to resize the current section specified by the fillHeight attribute, so
         * that the standard module fills out the Widget height. If a height has not been set on Widget,
         * the section is not resized (height is set to "auto").
         *
         * @method _fillHeight
         * @private
         */
        _fillHeight : function() {
            if (this.get(FILL_HEIGHT)) {
                var height = this.get(HEIGHT);
                if (height != EMPTY && height != AUTO) {
                    this.fillHeight(this.getStdModNode(this.get(FILL_HEIGHT)));
                }
            }
        },

        /**
         * Updates the rendered UI, adding the provided content (either an HTML string, or node reference),
         * to the specified section. The content is either added before, after or replaces existing content
         * in the section, based on the value of the <code>where</code> argument.
         *
         * @method _uiSetStdMod
         * @protected
         *
         * @param {String} section The section to be updated. Either WidgetStdMod.HEADER, WidgetStdMod.BODY or WidgetStdMod.FOOTER.
         * @param {String | Node} content The new content (either as an HTML string, or Node reference) to add to the section
         * @param {String} where Optional. Either WidgetStdMod.AFTER, WidgetStdMod.BEFORE or WidgetStdMod.REPLACE.
         * If not provided, the content will replace existing content in the section.
         */
        _uiSetStdMod : function(section, content, where) {
            // Using isValue, so that "" is valid content
            if (L.isValue(content)) {
                var node = this.getStdModNode(section, true);

                this._addStdModContent(node, content, where);

                this.set(section + CONTENT_SUFFIX, this._getStdModContent(section), {src:UI});
            } else {
                this._eraseStdMod(section);
            }
            this.fire(ContentUpdate);
        },

        /**
         * Creates the DOM node for the given section, and inserts it into the correct location in the contentBox.
         *
         * @method _renderStdMod
         * @protected
         * @param {String} section The section to create/render. Either WidgetStdMod.HEADER, WidgetStdMod.BODY or WidgetStdMod.FOOTER.
         * @return {Node} A reference to the added section node
         */
        _renderStdMod : function(section) {

            var contentBox = this.get(CONTENT_BOX),
                sectionNode = this._findStdModSection(section);

            if (!sectionNode) {
                sectionNode = this._getStdModTemplate(section);
            }

            this._insertStdModSection(contentBox, section, sectionNode);

            this[section + NODE_SUFFIX] = sectionNode;
            return this[section + NODE_SUFFIX];
        },

        /**
         * Removes the DOM node for the given section.
         *
         * @method _eraseStdMod
         * @protected
         * @param {String} section The section to remove. Either WidgetStdMod.HEADER, WidgetStdMod.BODY or WidgetStdMod.FOOTER.
         */
        _eraseStdMod : function(section) {
            var sectionNode = this.getStdModNode(section);
            if (sectionNode) {
                sectionNode.remove(true);
                delete this[section + NODE_SUFFIX];
            }
        },

        /**
         * Helper method to insert the Node for the given section into the correct location in the contentBox.
         *
         * @method _insertStdModSection
         * @private
         * @param {Node} contentBox A reference to the Widgets content box.
         * @param {String} section The section to create/render. Either WidgetStdMod.HEADER, WidgetStdMod.BODY or WidgetStdMod.FOOTER.
         * @param {Node} sectionNode The Node for the section.
         */
        _insertStdModSection : function(contentBox, section, sectionNode) {
            var fc = contentBox.get(FIRST_CHILD);

            if (section === STD_FOOTER || !fc) {
                contentBox.appendChild(sectionNode);
            } else {
                if (section === STD_HEADER) {
                    contentBox.insertBefore(sectionNode, fc);
                } else {
                    var footer = this[STD_FOOTER + NODE_SUFFIX];
                    if (footer) {
                        contentBox.insertBefore(sectionNode, footer);
                    } else {
                        contentBox.appendChild(sectionNode);
                    }
                }
            }
        },

        /**
         * Gets a new Node reference for the given standard module section, by cloning
         * the stored template node.
         *
         * @method _getStdModTemplate
         * @protected
         * @param {String} section The section to create a new node for. Either WidgetStdMod.HEADER, WidgetStdMod.BODY or WidgetStdMod.FOOTER.
         * @return {Node} The new Node instance for the section
         */
        _getStdModTemplate : function(section) {
            return Node.create(StdMod.TEMPLATES[section], this._stdModNode.get(OWNER_DOCUMENT));
        },

        /**
         * Helper method to add content to a StdMod section node.
         * The content is added either before, after or replaces the existing node content
         * based on the value of the <code>where</code> argument.
         *
         * @method _addStdModContent
         * @private
         *
         * @param {Node} node The section Node to be updated.
         * @param {Node|NodeList|String} children The new content Node, NodeList or String to be added to section Node provided.
         * @param {String} where Optional. Either WidgetStdMod.AFTER, WidgetStdMod.BEFORE or WidgetStdMod.REPLACE.
         * If not provided, the content will replace existing content in the Node.
         */
        _addStdModContent : function(node, children, where) {

            // StdMod where to Node where
            switch (where) {
                case StdMod.BEFORE:  // 0 is before fistChild
                    where = 0;
                    break;
                case StdMod.AFTER:   // undefined is appendChild
                    where = undefined;
                    break;
                default:            // replace is replace, not specified is replace
                    where = StdMod.REPLACE;
            }

            node.insert(children, where);
        },

        /**
         * Helper method to obtain the precise height of the node provided, including padding and border.
         * The height could be a sub-pixel value for certain browsers, such as Firefox 3.
         *
         * @method _getPreciseHeight
         * @private
         * @param {Node} node The node for which the precise height is required.
         * @return {Number} The height of the Node including borders and padding, possibly a float.
         */
        _getPreciseHeight : function(node) {
            var height = (node) ? node.get(OFFSET_HEIGHT) : 0,
                getBCR = "getBoundingClientRect";

            if (node && node.hasMethod(getBCR)) {
                var preciseRegion = node.invoke(getBCR);
                if (preciseRegion) {
                    height = preciseRegion.bottom - preciseRegion.top;
                }
            }

            return height;
        },

        /**
         * Helper method to to find the rendered node for the given section,
         * if it exists.
         *
         * @method _findStdModSection
         * @private
         * @param {String} section The section for which the render Node is to be found. Either WidgetStdMod.HEADER, WidgetStdMod.BODY or WidgetStdMod.FOOTER.
         * @return {Node} The rendered node for the given section, or null if not found.
         */
        _findStdModSection: function(section) {
            return this.get(CONTENT_BOX).one("> ." + StdMod.SECTION_CLASS_NAMES[section]);
        },

        /**
         * Utility method, used by WidgetStdMods HTML_PARSER implementation
         * to extract data for each section from markup.
         *
         * @method _parseStdModHTML
         * @private
         * @param {String} section
         * @return {String} Inner HTML string with the contents of the section
         */
        _parseStdModHTML : function(section) {

            var node = this._findStdModSection(section);

            if (node) {
                if (!this._stdModParsed) {
                    this._stdModParsed = {};
                    Y.before(this._applyStdModParsedConfig, this, APPLY_PARSED_CONFIG);
                }
                this._stdModParsed[section + CONTENT_SUFFIX] = 1;

                return node.get("innerHTML");
            }

            return null;
        },

        /**
         * This method is injected before the _applyParsedConfig step in
         * the application of HTML_PARSER, and sets up the state to
         * identify whether or not we should remove the current DOM content
         * or not, based on whether or not the current content attribute value
         * was extracted from the DOM, or provided by the user configuration
         *
         * @method _applyStdModParsedConfig
         * @private
         */
        _applyStdModParsedConfig : function(node, cfg, parsedCfg) {
            var parsed = this._stdModParsed;
            if (parsed) {
                parsed[HEADER_CONTENT] = !(HEADER_CONTENT in cfg) && (HEADER_CONTENT in parsed);
                parsed[BODY_CONTENT] = !(BODY_CONTENT in cfg) && (BODY_CONTENT in parsed);
                parsed[FOOTER_CONTENT] = !(FOOTER_CONTENT in cfg) && (FOOTER_CONTENT in parsed);
            }
        },

        /**
         * Retrieves the child nodes (content) of a standard module section
         *
         * @method _getStdModContent
         * @private
         * @param {String} section The standard module section whose child nodes are to be retrieved. Either WidgetStdMod.HEADER, WidgetStdMod.BODY or WidgetStdMod.FOOTER.
         * @return {Node} The child node collection of the standard module section.
         */
        _getStdModContent : function(section) {
            return (this[section + NODE_SUFFIX]) ? this[section + NODE_SUFFIX].get(CHILD_NODES) : null;
        },

        /**
         * Updates the body section of the standard module with the content provided (either an HTML string, or node reference).
         * <p>
         * This method can be used instead of the corresponding section content attribute if you'd like to retain the current content of the section,
         * and insert content before or after it, by specifying the <code>where</code> argument.
         * </p>
         * @method setStdModContent
         * @param {String} section The standard module section whose content is to be updated. Either WidgetStdMod.HEADER, WidgetStdMod.BODY or WidgetStdMod.FOOTER.
         * @param {String | Node} content The content to be added, either an HTML string or a Node reference.
         * @param {String} where Optional. Either WidgetStdMod.AFTER, WidgetStdMod.BEFORE or WidgetStdMod.REPLACE.
         * If not provided, the content will replace existing content in the section.
         */
        setStdModContent : function(section, content, where) {
            //var node = this.getStdModNode(section) || this._renderStdMod(section);
            this.set(section + CONTENT_SUFFIX, content, {stdModPosition:where});
            //this._addStdModContent(node, content, where);
        },

        /**
        Returns the node reference for the specified `section`.

        **Note:** The DOM is not queried for the node reference. The reference
        stored by the widget instance is returned if it was set. Passing a
        truthy for `forceCreate` will create the section node if it does not
        already exist.

        @method getStdModNode
        @param {String} section The section whose node reference is required.
            Either `WidgetStdMod.HEADER`, `WidgetStdMod.BODY`, or
            `WidgetStdMod.FOOTER`.
        @param {Boolean} forceCreate Whether the section node should be created
            if it does not already exist.
        @return {Node} The node reference for the `section`, or null if not set.
        **/
        getStdModNode : function(section, forceCreate) {
            var node = this[section + NODE_SUFFIX] || null;

            if (!node && forceCreate) {
                node = this._renderStdMod(section);
            }

            return node;
        },

        /**
         * Sets the height on the provided header, body or footer element to
         * fill out the height of the Widget. It determines the height of the
         * widgets bounding box, based on it's configured height value, and
         * sets the height of the provided section to fill out any
         * space remaining after the other standard module section heights
         * have been accounted for.
         *
         * <p><strong>NOTE:</strong> This method is not designed to work if an explicit
         * height has not been set on the Widget, since for an "auto" height Widget,
         * the heights of the header/body/footer will drive the height of the Widget.</p>
         *
         * @method fillHeight
         * @param {Node} node The node which should be resized to fill out the height
         * of the Widget bounding box. Should be a standard module section node which belongs
         * to the widget.
         */
        fillHeight : function(node) {
            if (node) {
                var contentBox = this.get(CONTENT_BOX),
                    stdModNodes = [this.headerNode, this.bodyNode, this.footerNode],
                    stdModNode,
                    cbContentHeight,
                    filled = 0,
                    remaining = 0,

                    validNode = false;

                for (var i = 0, l = stdModNodes.length; i < l; i++) {
                    stdModNode = stdModNodes[i];
                    if (stdModNode) {
                        if (stdModNode !== node) {
                            filled += this._getPreciseHeight(stdModNode);
                        } else {
                            validNode = true;
                        }
                    }
                }

                if (validNode) {
                    if (UA.ie || UA.opera) {
                        // Need to set height to 0, to allow height to be reduced
                        node.set(OFFSET_HEIGHT, 0);
                    }

                    cbContentHeight = contentBox.get(OFFSET_HEIGHT) -
                            parseInt(contentBox.getComputedStyle("paddingTop"), 10) -
                            parseInt(contentBox.getComputedStyle("paddingBottom"), 10) -
                            parseInt(contentBox.getComputedStyle("borderBottomWidth"), 10) -
                            parseInt(contentBox.getComputedStyle("borderTopWidth"), 10);

                    if (L.isNumber(cbContentHeight)) {
                        remaining = cbContentHeight - filled;
                        if (remaining >= 0) {
                            node.set(OFFSET_HEIGHT, remaining);
                        }
                    }
                }
            }
        }
    };

    Y.WidgetStdMod = StdMod;


}, 'patched-v3.18.1', {"requires": ["base-build", "widget"]});

YUI.add('aui-aria', function (A, NAME) {

/**
 * The Aria Component.
 *
 * @module aui-aria
 */

var Lang = A.Lang,
    isBoolean = Lang.isBoolean,
    isFunction = Lang.isFunction,
    isObject = Lang.isObject,
    isString = Lang.isString,
    STR_REGEX = /([^a-z])/ig,

    _toAriaRole = A.cached(function(str) {
        return str.replace(STR_REGEX, function() {
            return '';
        }).toLowerCase();
    });

/**
 * A base class for Aria.
 *
 * @class A.Plugin.Aria
 * @extends Plugin.Base
 * @param {Object} config Object literal specifying widget configuration
 *     properties.
 * @constructor
 */
var Aria = A.Component.create({

    /**
     * Static property provides a string to identify the class.
     *
     * @property NAME
     * @type String
     * @static
     */
    NAME: 'aria',

    /**
     * Static property provides a string to identify the namespace.
     *
     * @property NS
     * @type String
     * @static
     */
    NS: 'aria',

    /**
     * Static property used to define the default attribute configuration for
     * the `A.Aria`.
     *
     * @property ATTRS
     * @type Object
     * @static
     */
    ATTRS: {

        /**
         * The ARIA attributes collection.
         *
         * @attribute attributes
         * @default {}
         * @type Object
         */
        attributes: {
            value: {},
            validator: isObject
        },

        /**
         * The ARIA attribute value format.
         *
         * @attribute attributeValueFormat
         * @type Function
         */
        attributeValueFormat: {
            value: function(val) {
                return val;
            },
            validator: isFunction
        },

        /**
         * Node container for the ARIA attribute.
         *
         * @attribute attributeNode
         * @writeOnce
         */
        attributeNode: {
            writeOnce: true,
            setter: A.one,
            valueFn: function() {
                return this.get('host').get('boundingBox');
            }
        },

        /**
         * The ARIA role name.
         *
         * @attribute roleName
         * @type String
         */
        roleName: {
            valueFn: function() {
                var instance = this;
                var host = instance.get('host');
                var roleName = _toAriaRole(host.constructor.NAME || '');

                return (instance.isValidRole(roleName) ? roleName : '');
            },
            validator: isString
        },

        /**
         * Node container for the ARIA role.
         *
         * @attribute roleNode
         * @writeOnce
         */
        roleNode: {
            writeOnce: true,
            setter: A.one,
            valueFn: function() {
                return this.get('host').get('boundingBox');
            }
        },

        /**
         * Checks if the attribute is valid with W3C rules.
         *
         * @attribute validateW3C
         * @default true
         * @type Boolean
         */
        validateW3C: {
            value: true,
            validator: isBoolean
        }
    },

    /**
     * Static property used to define which component it extends.
     *
     * @property EXTENDS
     * @type Object
     * @static
     */
    EXTENDS: A.Plugin.Base,

    prototype: {

        /**
         * Construction logic executed during Aria instantiation. Lifecycle.
         *
         * @method initializer
         * @protected
         */
        initializer: function() {
            var instance = this;

            instance.publish('aria:processAttribute', {
                defaultFn: instance._defProcessFn,
                queuable: false,
                emitFacade: true,
                bubbles: true,
                prefix: 'aria'
            });

            instance._uiSetRoleName(
                instance.get('roleName')
            );

            instance.after('roleNameChange', instance._afterRoleNameChange);

            instance._bindHostAttributes();
        },

        /**
         * Checks if the ARIA attribute is valid.
         *
         * @method isValidAttribute
         * @param attrName
         * @return {Boolean}
         */
        isValidAttribute: function(attrName) {
            var instance = this;

            return (instance.get('validateW3C') ? A.Plugin.Aria.W3C_ATTRIBUTES[attrName] : true);
        },

        /**
         * Checks if the ARIA role is valid.
         *
         * @method isValidRole
         * @param roleName
         * @return {Boolean}
         */
        isValidRole: function(roleName) {
            var instance = this;

            return (instance.get('validateW3C') ? A.Plugin.Aria.W3C_ROLES[roleName] : true);
        },

        /**
         * Set a single ARIA attribute.
         *
         * @method setAttribute
         * @param attrName
         * @param attrValue
         * @param node
         * @return {Boolean}
         */
        setAttribute: function(attrName, attrValue, node) {
            var instance = this;

            if (instance.isValidAttribute(attrName)) {
                (node || instance.get('attributeNode')).set('aria-' + attrName, attrValue);

                return true;
            }

            return false;
        },

        /**
         * Set a list of ARIA attributes.
         *
         * @method setAttributes
         * @param attributes
         */
        setAttributes: function(attributes) {
            var instance = this;

            A.Array.each(attributes, function(attribute) {
                instance.setAttribute(attribute.name, attribute.value, attribute.node);
            });
        },

        /**
         * Set a single ARIA role.
         *
         * @method setRole
         * @param roleName
         * @param node
         * @return {Boolean}
         */
        setRole: function(roleName, node) {
            var instance = this;

            if (instance.isValidRole(roleName)) {
                (node || instance.get('roleNode')).set('role', roleName);

                return true;
            }

            return false;
        },

        /**
         * Set a list of ARIA roles.
         *
         * @method setRoles
         * @param roles
         */
        setRoles: function(roles) {
            var instance = this;

            A.Array.each(roles, function(role) {
                instance.setRole(role.name, role.node);
            });
        },

        /**
         * Fires after a host attribute change.
         *
         * @method _afterHostAttributeChange
         * @param event
         * @protected
         */
        _afterHostAttributeChange: function(event) {
            var instance = this;

            instance._handleProcessAttribute(event);
        },

        /**
         * Triggers after `roleName` attribute change.
         *
         * @method _afterRoleNameChange
         * @param event
         * @protected
         */
        _afterRoleNameChange: function(event) {
            var instance = this;

            instance._uiSetRoleName(event.newVal);
        },

        /**
         * Bind the list of host attributes.
         *
         * @method _bindHostAttributes
         * @protected
         */
        _bindHostAttributes: function() {
            var instance = this;
            var attributes = instance.get('attributes');

            A.each(attributes, function(aria, attrName) {
                var ariaAttr = instance._getAriaAttribute(aria, attrName);

                instance._handleProcessAttribute({
                    aria: ariaAttr
                });

                instance.afterHostEvent(attrName + 'Change', function(event) {
                    event.aria = ariaAttr;
                    instance._afterHostAttributeChange(event);
                });
            });
        },

        /**
         * Calls the `_setAttribute` method.
         *
         * @method _defProcessFn
         * @param event
         * @protected
         */
        _defProcessFn: function(event) {
            var instance = this;

            instance._setAttribute(event.aria);
        },

        /**
         * Get the ARIA attribute.
         *
         * @method _getAriaAttribute
         * @param aria
         * @param attrName
         * @protected
         * @return {Object}
         */
        _getAriaAttribute: function(aria, attrName) {
            var instance = this;
            var attributeValueFormat = instance.get('attributeValueFormat');
            var prepared = {};

            if (isString(aria)) {
                prepared = A.merge(prepared, {
                    ariaName: aria,
                    attrName: attrName,
                    format: attributeValueFormat,
                    node: null
                });
            }
            else if (isObject(aria)) {
                prepared = A.mix(aria, {
                    ariaName: '',
                    attrName: attrName,
                    format: attributeValueFormat,
                    node: null
                });
            }

            return prepared;
        },

        /**
         * Fires ARIA process attribute event handle.
         *
         * @method _handleProcessAttribute
         * @param event
         * @protected
         */
        _handleProcessAttribute: function(event) {
            var instance = this;

            instance.fire('aria:processAttribute', {
                aria: event.aria
            });
        },

        /**
         * Set the attribute in the DOM.
         *
         * @method _setAttribute
         * @param ariaAttr
         * @protected
         */
        _setAttribute: function(ariaAttr) {
            var instance = this;
            var host = instance.get('host');
            var attrValue = host.get(ariaAttr.attrName);
            var attrNode = ariaAttr.node;

            if (isFunction(attrNode)) {
                attrNode = attrNode.apply(instance, [ariaAttr]);
            }

            instance.setAttribute(
                ariaAttr.ariaName,
                ariaAttr.format.apply(instance, [attrValue, ariaAttr]),
                attrNode
            );
        },

        /**
         * Set the `roleName` attribute on the UI.
         *
         * @method _uiSetRoleName
         * @param val
         * @protected
         */
        _uiSetRoleName: function(val) {
            var instance = this;

            instance.setRole(val);
        }
    }
});

A.Plugin.Aria = Aria;
/**
 * Static property used to define [W3C's Roles Model](http://www.w3.org/TR/wai-
 * aria/roles).
 *
 * @property W3C_ROLES
 * @type Object
 * @static
 */
A.Plugin.Aria.W3C_ROLES = {
    'alert': 1,
    'alertdialog': 1,
    'application': 1,
    'article': 1,
    'banner': 1,
    'button': 1,
    'checkbox': 1,
    'columnheader': 1,
    'combobox': 1,
    'command': 1,
    'complementary': 1,
    'composite': 1,
    'contentinfo': 1,
    'definition': 1,
    'dialog': 1,
    'directory': 1,
    'document': 1,
    'form': 1,
    'grid': 1,
    'gridcell': 1,
    'group': 1,
    'heading': 1,
    'img': 1,
    'input': 1,
    'landmark': 1,
    'link': 1,
    'list': 1,
    'listbox': 1,
    'listitem': 1,
    'log': 1,
    'main': 1,
    'marquee': 1,
    'math': 1,
    'menu': 1,
    'menubar': 1,
    'menuitem': 1,
    'menuitemcheckbox': 1,
    'menuitemradio': 1,
    'navigation': 1,
    'note': 1,
    'option': 1,
    'presentation': 1,
    'progressbar': 1,
    'radio': 1,
    'radiogroup': 1,
    'range': 1,
    'region': 1,
    'roletype': 1,
    'row': 1,
    'rowheader': 1,
    'scrollbar': 1,
    'search': 1,
    'section': 1,
    'sectionhead': 1,
    'select': 1,
    'separator': 1,
    'slider': 1,
    'spinbutton': 1,
    'status': 1,
    'structure': 1,
    'tab': 1,
    'tablist': 1,
    'tabpanel': 1,
    'textbox': 1,
    'timer': 1,
    'toolbar': 1,
    'tooltip': 1,
    'tree': 1,
    'treegrid': 1,
    'treeitem': 1,
    'widget': 1,
    'window': 1
};
/**
 * Static property used to define [W3C's Supported States and
 * Properties](http://www.w3.org/TR/wai-aria/states_and_properties).
 *
 * @property W3C_ATTRIBUTES
 * @type Object
 * @static
 */
A.Plugin.Aria.W3C_ATTRIBUTES = {
    'activedescendant': 1,
    'atomic': 1,
    'autocomplete': 1,
    'busy': 1,
    'checked': 1,
    'controls': 1,
    'describedby': 1,
    'disabled': 1,
    'dropeffect': 1,
    'expanded': 1,
    'flowto': 1,
    'grabbed': 1,
    'haspopup': 1,
    'hidden': 1,
    'invalid': 1,
    'label': 1,
    'labelledby': 1,
    'level': 1,
    'live': 1,
    'multiline': 1,
    'multiselectable': 1,
    'orientation': 1,
    'owns': 1,
    'posinset': 1,
    'pressed': 1,
    'readonly': 1,
    'relevant': 1,
    'required': 1,
    'selected': 1,
    'setsize': 1,
    'sort': 1,
    'valuemax': 1,
    'valuemin': 1,
    'valuenow': 1,
    'valuetext': 1
};


}, '3.1.0-deprecated.85', {"requires": ["plugin", "aui-component"]});

YUI.add('aui-io-plugin-deprecated', function (A, NAME) {

/**
 * The IOPlugin Utility - When plugged to a Node or Widget loads the content
 * of a URI and set as its content, parsing the <code>script</code> tags if
 * present on the code.
 *
 * @module aui-io
 * @submodule aui-io-plugin
 */

var L = A.Lang,
    isBoolean = L.isBoolean,
    isString = L.isString,

    isNode = function(v) {
        return (v instanceof A.Node);
    },

    StdMod = A.WidgetStdMod,

    TYPE_NODE = 'Node',
    TYPE_WIDGET = 'Widget',

    EMPTY = '',
    FAILURE = 'failure',
    FAILURE_MESSAGE = 'failureMessage',
    HOST = 'host',
    ICON = 'icon',
    IO = 'io',
    IO_PLUGIN = 'IOPlugin',
    LOADING = 'loading',
    LOADING_MASK = 'loadingMask',
    NODE = 'node',
    OUTER = 'outer',
    PARSE_CONTENT = 'parseContent',
    QUEUE = 'queue',
    RENDERED = 'rendered',
    SECTION = 'section',
    SHOW_LOADING = 'showLoading',
    SUCCESS = 'success',
    TYPE = 'type',
    WHERE = 'where',

    getCN = A.getClassName,

    CSS_ICON_LOADING = getCN(ICON, LOADING);

/**
 * A base class for IOPlugin, providing:
 * <ul>
 *    <li>Loads the content of a URI as content of a Node or Widget</li>
 *    <li>Use <a href="ParseContent.html">ParseContent</a> to parse the JavaScript tags from the content and evaluate them</li>
 * </ul>
 *
 * Quick Example:<br/>
 *
 * <pre><code>A.one('#content').plug(A.Plugin.IO, { uri: 'assets/content.html', method: 'GET' });</code></pre>
 *
 * Check the list of <a href="A.Plugin.IO.html#configattributes">Configuration Attributes</a> available for
 * IOPlugin.
 *
 * @param config {Object} Object literal specifying widget configuration properties.
 *
 * @class A.Plugin.IO
 * @constructor
 * @extends IORequest
 */
var IOPlugin = A.Component.create({
    /**
     * Static property provides a string to identify the class.
     *
     * @property A.Plugin.IO.NAME
     * @type String
     * @static
     */
    NAME: IO_PLUGIN,

    /**
     * Static property provides a string to identify the namespace.
     *
     * @property A.Plugin.IO.NS
     * @type String
     * @static
     */
    NS: IO,

    /**
     * Static property used to define the default attribute
     * configuration for the A.Plugin.IO.
     *
     * @property A.Plugin.IO.ATTRS
     * @type Object
     * @static
     */
    ATTRS: {
        /**
         * Plug IO in any object we want, the setContent will use the node to
         * set the content.
         *
         * @attribute node
         * @default null
         * @type Node | String
         */
        node: {
            value: null,
            getter: function(value) {
                var instance = this;

                if (!value) {
                    var host = instance.get(HOST);
                    var type = instance.get(TYPE);

                    if (type == TYPE_NODE) {
                        value = host;
                    }
                    else if (type == TYPE_WIDGET) {
                        var section = instance.get(SECTION);

                        // if there is no node for the SECTION, forces creation
                        if (!host.getStdModNode(section)) {
                            host.setStdModContent(section, EMPTY);
                        }

                        value = host.getStdModNode(section);
                    }
                }

                return A.one(value);
            },
            validator: isNode
        },

        /**
         * Message to be set on the content when the transaction fails.
         *
         * @attribute failureMessage
         * @default 'Failed to retrieve content'
         * @type String
         */
        failureMessage: {
            value: 'Failed to retrieve content',
            validator: isString
        },

        /**
         * Options passed to the <a href="LoadingMask.html">LoadingMask</a>.
         *
         * @attribute loadingMask
         * @default {}
         * @type Object
         */
        loadingMask: {
            value: {}
        },

        /**
         * If true the <a href="ParseContent.html">ParseContent</a> plugin
         * will be plugged to the <a href="A.Plugin.IO.html#config_node">node</a>.
         *
         * @attribute parseContent
         * @default true
         * @type boolean
         */
        parseContent: {
            value: true,
            validator: isBoolean
        },

        /**
         * Show the <a href="LoadingMask.html">LoadingMask</a> covering the <a
         * href="A.Plugin.IO.html#config_node">node</a> while loading.
         *
         * @attribute showLoading
         * @default true
         * @type boolean
         */
        showLoading: {
            value: true,
            validator: isBoolean
        },

        /**
         * Section where the content will be set in case you are plugging it
         * on a instace of <a href="WidgetStdMod.html">WidgetStdMod</a>.
         *
         * @attribute section
         * @default StdMod.BODY
         * @type String
         */
        section: {
            value: StdMod.BODY,
            validator: function(val) {
                return (!val || val == StdMod.BODY || val == StdMod.HEADER || val == StdMod.FOOTER);
            }
        },

        /**
         * Type of the <code>instance</code> we are pluggin the A.Plugin.IO.
         * Could be a Node, or a Widget.
         *
         * @attribute type
         * @default 'Node'
         * @readOnly
         * @type String
         */
        type: {
            readOnly: true,
            valueFn: function() {
                var instance = this;
                // NOTE: default type
                var type = TYPE_NODE;

                if (instance.get(HOST) instanceof A.Widget) {
                    type = TYPE_WIDGET;
                }

                return type;
            },
            validator: isString
        },

        /**
         * Where to insert the content, AFTER, BEFORE or REPLACE. If you're plugging a Node, there is a fourth option called OUTER that will not only replace the entire node itself. This is different from REPLACE, in that REPLACE will replace the *contents* of the node, OUTER will replace the entire Node itself.
         *
         * @attribute where
         * @default StdMod.REPLACE
         * @type String
         */
        where: {
            value: StdMod.REPLACE,
            validator: function(val) {
                return (!val || val == StdMod.AFTER || val == StdMod.BEFORE || val == StdMod.REPLACE || val ==
                    OUTER);
            }
        }
    },

    EXTENDS: A.IORequest,

    prototype: {
        /**
         * Bind the events on the A.Plugin.IO UI. Lifecycle.
         *
         * @method bindUI
         * @protected
         */
        bindUI: function() {
            var instance = this;

            instance.on('activeChange', instance._onActiveChange);

            instance.on(SUCCESS, instance._successHandler);
            instance.on(FAILURE, instance._failureHandler);

            if ((instance.get(TYPE) == TYPE_WIDGET) && instance.get(SHOW_LOADING)) {
                var host = instance.get(HOST);

                host.after('heightChange', instance._syncLoadingMaskUI, instance);
                host.after('widthChange', instance._syncLoadingMaskUI, instance);
            }
        },

        /**
         * Invoke the <code>start</code> method (autoLoad attribute).
         *
         * @method _autoStart
         * @protected
         */
        _autoStart: function() {
            var instance = this;

            instance.bindUI();

            IOPlugin.superclass._autoStart.apply(this, arguments);
        },

        /**
         * Bind the ParseContent plugin on the <code>instance</code>.
         *
         * @method _bindParseContent
         * @protected
         */
        _bindParseContent: function() {
            var instance = this;
            var node = instance.get(NODE);

            if (node && !node.ParseContent && instance.get(PARSE_CONTENT)) {
                node.plug(A.Plugin.ParseContent);
            }
        },

        /**
         * Invoke the <a href="OverlayMask.html#method_hide">OverlayMask hide</a> method.
         *
         * @method hideLoading
         */
        hideLoading: function() {
            var instance = this;

            var node = instance.get(NODE);

            if (node.loadingmask) {
                node.loadingmask.hide();
            }
        },

        /**
         * Set the content of the <a href="A.Plugin.IO.html#config_node">node</a>.
         *
         * @method setContent
         */
        setContent: function(content) {
            var instance = this;

            instance._bindParseContent();

            instance._getContentSetterByType().apply(instance, [content]);

            if (instance.overlayMaskBoundingBox) {
                instance.overlayMaskBoundingBox.remove();
            }
        },

        /**
         * Invoke the <a href="OverlayMask.html#method_show">OverlayMask show</a> method.
         *
         * @method showLoading
         */
        showLoading: function() {
            var instance = this;
            var node = instance.get(NODE);

            if (node.loadingmask) {
                if (instance.overlayMaskBoundingBox) {
                    node.append(instance.overlayMaskBoundingBox);
                }
            }
            else {
                node.plug(
                    A.LoadingMask,
                    instance.get(LOADING_MASK)
                );

                instance.overlayMaskBoundingBox = node.loadingmask.overlayMask.get('boundingBox');
            }

            node.loadingmask.show();
        },

        /**
         * Overload to the <a href="IORequest.html#method_start">IORequest
         * start</a> method. Check if the <code>host</code> is already rendered,
         * otherwise wait to after render phase and to show the LoadingMask.
         *
         * @method start
         */
        start: function() {
            var instance = this;
            var host = instance.get(HOST);

            if (!host.get(RENDERED)) {
                host.after('render', function() {
                    instance._setLoadingUI(true);
                });
            }

            IOPlugin.superclass.start.apply(instance, arguments);
        },

        /**
         * Get the appropriated <a
         * href="A.Plugin.IO.html#method_setContent">setContent</a> function
         * implementation for each <a href="A.Plugin.IO.html#config_type">type</a>.
         *
         * @method _getContentSetterByType
         * @protected
         * @return {function}
         */
        _getContentSetterByType: function() {
            var instance = this;

            var setters = {
                // NOTE: default setter, see 'type' attribute definition
                Node: function(content) {
                    var instance = this;
                    // when this.get(HOST) is a Node instance the NODE is the host
                    var node = instance.get(NODE);

                    if (content instanceof A.NodeList) {
                        content = content.toFrag();
                    }

                    if (content instanceof A.Node) {
                        content = content._node;
                    }

                    var where = instance.get(WHERE);

                    if (where == OUTER) {
                        node.replace(content);
                    }
                    else {
                        node.insert(content, where);
                    }
                },

                // Widget forces set the content on the SECTION node using setStdModContent method
                Widget: function(content) {
                    var instance = this;
                    var host = instance.get(HOST);

                    host.setStdModContent.apply(host, [
       instance.get(SECTION),
       content,
       instance.get(WHERE)
      ]);
                }
            };

            return setters[this.get(TYPE)];
        },

        /**
         * Whether the <code>show</code> is true show the LoadingMask.
         *
         * @method _setLoadingUI
         * @param {boolean} show
         * @protected
         */
        _setLoadingUI: function(show) {
            var instance = this;

            if (instance.get(SHOW_LOADING)) {
                if (show) {
                    instance.showLoading();
                }
                else {
                    instance.hideLoading();
                }
            }
        },

        /**
         * Sync the loading mask UI.
         *
         * @method _syncLoadingMaskUI
         * @protected
         */
        _syncLoadingMaskUI: function() {
            var instance = this;

            instance.get(NODE).loadingmask.refreshMask();
        },

        /**
         * Internal success callback for the IO transaction.
         *
         * @method _successHandler
         * @param {EventFavade} event
         * @param {String} id Id of the IO transaction.
         * @param {Object} obj XHR transaction Object.
         * @protected
         */
        _successHandler: function(event, id, xhr) {
            var instance = this;

            instance.setContent(
                this.get('responseData')
            );
        },

        /**
         * Internal failure callback for the IO transaction.
         *
         * @method _failureHandler
         * @param {EventFavade} event
         * @param {String} id Id of the IO transaction.
         * @param {Object} obj XHR transaction Object.
         * @protected
         */
        _failureHandler: function(event, id, xhr) {
            var instance = this;

            instance.setContent(
                instance.get(FAILURE_MESSAGE)
            );
        },

        /**
         * Fires after the value of the
         * <a href="A.Plugin.IO.html#config_active">active</a> attribute change.
         *
         * @method _onActiveChange
         * @param {EventFacade} event
         * @protected
         */
        _onActiveChange: function(event) {
            var instance = this;
            var host = instance.get(HOST);
            var widget = instance.get(TYPE) == TYPE_WIDGET;

            if (!widget || (widget && host && host.get(RENDERED))) {
                instance._setLoadingUI(event.newVal);
            }
        }
    }
});

A.Node.prototype.load = function(uri, config, callback) {
    var instance = this;

    var index = uri.indexOf(' ');
    var selector;

    if (index > 0) {
        selector = uri.slice(index, uri.length);

        uri = uri.slice(0, index);
    }

    if (L.isFunction(config)) {
        callback = config;
        config = null;
    }

    config = config || {};

    if (callback) {
        config.after = config.after || {};

        config.after.success = callback;
    }

    var where = config.where;

    config.uri = uri;
    config.where = where;

    if (selector) {
        config.selector = selector;
        config.where = where || 'replace';
    }

    instance.plug(A.Plugin.IO, config);

    return instance;
};

A.namespace('Plugin').IO = IOPlugin;


}, '3.1.0-deprecated.85', {
    "requires": [
        "aui-overlay-base-deprecated",
        "aui-parse-content",
        "aui-io-request",
        "aui-loading-mask-deprecated"
    ]
});

YUI.add('aui-io-request', function (A, NAME) {

/**
 * The IORequest Utility - Provides response data normalization for 'xml', 'json',
 * JavaScript and cache option.
 *
 * @module aui-io
 * @submodule aui-io-request
 */

var L = A.Lang,
    isBoolean = L.isBoolean,
    isFunction = L.isFunction,
    isString = L.isString,

    defaults = A.namespace('config.io'),

    getDefault = function(attr) {
        return function() {
            return defaults[attr];
        };
    },

    ACCEPTS = {
        all: '*/*',
        html: 'text/html',
        json: 'application/json, text/javascript',
        text: 'text/plain',
        xml: 'application/xml, text/xml'
    };

/**
 * A base class for IORequest, providing:
 *
 * - Response data normalization for XML, JSON, JavaScript
 * - Cache options
 *
 * Check the [live demo](http://alloyui.com/examples/io/).
 *
 * @class A.IORequest
 * @extends Plugin.Base
 * @param {Object} config Object literal specifying widget configuration
 *     properties.
 * @uses io
 * @constructor
 * @include http://alloyui.com/examples/io/basic.js
 */
var IORequest = A.Component.create({
    /**
     * Static property provides a string to identify the class.
     *
     * @property NAME
     * @type String
     * @static
     */
    NAME: 'IORequest',

    /**
     * Static property used to define the default attribute
     * configuration for the IORequest.
     *
     * @property ATTRS
     * @type Object
     * @static
     */
    ATTRS: {

        /**
         * If `true` invoke the [start](A.IORequest.html#method_start) method
         * automatically, initializing the IO transaction.
         *
         * @attribute autoLoad
         * @default true
         * @type Boolean
         */
        autoLoad: {
            value: true,
            validator: isBoolean
        },

        /**
         * If `false` the current timestamp will be appended to the
         * url, avoiding the url to be cached.
         *
         * @attribute cache
         * @default true
         * @type Boolean
         */
        cache: {
            value: true,
            validator: isBoolean
        },

        /**
         * The type of the request (i.e., could be xml, json, javascript, text).
         *
         * @attribute dataType
         * @default null
         * @type String
         */
        dataType: {
            setter: function(v) {
                return (v || '').toLowerCase();
            },
            value: null,
            validator: isString
        },

        /**
         * This is a normalized attribute for the response data. It's useful to
         * retrieve the correct type for the
         * [dataType](A.IORequest.html#attr_dataType) (i.e., in json requests
         * the `responseData`) is a JSONObject.
         *
         * @attribute responseData
         * @default null
         * @type String | JSONObject | XMLDocument
         */
        responseData: {
            setter: function(v) {
                return this._setResponseData(v);
            },
            value: null
        },

        /**
         * URI to be requested using AJAX.
         *
         * @attribute uri
         * @default null
         * @type String
         */
        uri: {
            setter: function(v) {
                return this._parseURL(v);
            },
            value: null,
            validator: isString
        },

        // User readOnly variables

        /**
         * Whether the transaction is active or not.
         *
         * @attribute active
         * @default false
         * @type Boolean
         */
        active: {
            value: false,
            validator: isBoolean
        },

        /**
         * Object containing all the [IO Configuration Attributes](A.io.html).
         * This Object is passed to the `A.io` internally.
         *
         * @attribute cfg
         * @default Object containing all the [IO Configuration
         *     Attributes](A.io.html).
         * @readOnly
         * @type String
         */
        cfg: {
            getter: function() {
                var instance = this;

                // keep the current cfg object always synchronized with the
                // mapped public attributes when the user call .start() it
                // always retrieve the last set values for each mapped attr
                return {
                    arguments: instance.get('arguments'),
                    context: instance.get('context'),
                    data: instance.getFormattedData(),
                    form: instance.get('form'),
                    headers: instance.get('headers'),
                    method: instance.get('method'),
                    on: {
                        complete: A.bind(instance.fire, instance, 'complete'),
                        end: A.bind(instance._end, instance),
                        failure: A.bind(instance.fire, instance, 'failure'),
                        start: A.bind(instance.fire, instance, 'start'),
                        success: A.bind(instance._success, instance)
                    },
                    sync: instance.get('sync'),
                    timeout: instance.get('timeout'),
                    xdr: instance.get('xdr')
                };
            },
            readOnly: true
        },

        /**
         * Stores the IO Object of the current transaction.
         *
         * @attribute transaction
         * @default null
         * @type Object
         */
        transaction: {
            value: null
        },

        // Configuration Object mapping
        // To take advantages of the Attribute listeners of A.Base
        // See: http://yuilibrary.com/yui/docs/io/

        /**
         * See [IO
         * Configuration](http://yuilibrary.com/yui/docs/io/#the-configuration-object).
         *
         * @attribute arguments
         * @default Value mapped on YUI.AUI.defaults.io.
         * @type Object
         */
        arguments: {
            valueFn: getDefault('arguments')
        },

        /**
         * See [IO
         * Configuration](http://yuilibrary.com/yui/docs/io/#the-configuration-object).
         *
         * @attribute context
         * @default Value mapped on YUI.AUI.defaults.io.
         * @type Object
         */
        context: {
            valueFn: getDefault('context')
        },

        /**
         * See [IO
         * Configuration](http://yuilibrary.com/yui/docs/io/#the-configuration-object).
         *
         * @attribute data
         * @default Value mapped on YUI.AUI.defaults.io.
         * @type Object
         */
        data: {
            valueFn: getDefault('data')
        },

        /**
         * See [IO
         * Configuration](http://yuilibrary.com/yui/docs/io/#the-configuration-object).
         *
         * @attribute form
         * @default Value mapped on YUI.AUI.defaults.io.
         * @type Object
         */
        form: {
            valueFn: getDefault('form')
        },

        /**
         * Set the correct ACCEPT header based on the dataType.
         *
         * @attribute headers
         * @default Object
         * @type Object
         */
        headers: {
            getter: function(value) {
                var header = [];
                var instance = this;
                var dataType = instance.get('dataType');

                if (dataType) {
                    header.push(
                        ACCEPTS[dataType]
                    );
                }

                // always add *.* to the accept header
                header.push(
                    ACCEPTS.all
                );

                return A.merge(
                    value, {
                        Accept: header.join(', ')
                    }
                );
            },
            valueFn: getDefault('headers')
        },

        /**
         * See [IO
         * Configuration](http://yuilibrary.com/yui/docs/io/#the-configuration-object).
         *
         * @attribute method
         * @default Value mapped on YUI.AUI.defaults.io.
         * @type String
         */
        method: {
            setter: function(val) {
                return val.toLowerCase();
            },
            valueFn: getDefault('method')
        },

        /**
         * A selector to be used to query against the response of the
         * request. Only works if the response is XML or HTML.
         *
         * @attribute selector
         * @default null
         * @type String
         */
        selector: {
            value: null
        },

        /**
         * See [IO
         * Configuration](http://yuilibrary.com/yui/docs/io/#the-configuration-object).
         *
         * @attribute sync
         * @default Value mapped on YUI.AUI.defaults.io.
         * @type Boolean
         */
        sync: {
            valueFn: getDefault('sync')
        },

        /**
         * See [IO
         * Configuration](http://yuilibrary.com/yui/docs/io/#the-configuration-object).
         *
         * @attribute timeout
         * @default Value mapped on YUI.AUI.defaults.io.
         * @type Number
         */
        timeout: {
            valueFn: getDefault('timeout')
        },

        /**
         * See [IO
         * Configuration](http://yuilibrary.com/yui/docs/io/#the-configuration-object).
         *
         * @attribute xdr
         * @default Value mapped on YUI.AUI.defaults.io.
         * @type Object
         */
        xdr: {
            valueFn: getDefault('xdr')
        }
    },

    /**
     * Static property used to define which component it extends.
     *
     * @property EXTENDS
     * @type Object
     * @static
     */
    EXTENDS: A.Plugin.Base,

    prototype: {

        /**
         * Construction logic executed during IORequest instantiation.
         * Lifecycle.
         *
         * @method initializer
         * @param config
         * @protected
         */
        init: function() {
            var instance = this;

            IORequest.superclass.init.apply(this, arguments);

            instance._autoStart();
        },

        /**
         * Destructor lifecycle implementation for the `IORequest` class.
         * Purges events attached to the node (and all child nodes).
         *
         * @method destructor
         * @protected
         */
        destructor: function() {
            var instance = this;

            instance.stop();

            instance.set('transaction', null);
        },

        /**
         * Applies the `YUI.AUI.defaults.io.dataFormatter` if
         * defined and return the formatted data.
         *
         * @method getFormattedData
         * @return {String}
         */
        getFormattedData: function() {
            var instance = this;
            var value = instance.get('data');
            var dataFormatter = defaults.dataFormatter;

            if (isFunction(dataFormatter)) {
                value = dataFormatter.call(instance, value);
            }

            return value;
        },

        /**
         * Starts the IO transaction. Used to refresh the content also.
         *
         * @method start
         */
        start: function() {
            var instance = this;

            instance.destructor();

            instance.set('active', true);

            var ioObj = instance._yuiIOObj;

            if (!ioObj) {
                ioObj = new A.IO();

                instance._yuiIOObj = ioObj;
            }

            var transaction = ioObj.send(
                instance.get('uri'),
                instance.get('cfg')
            );

            instance.set('transaction', transaction);
        },

        /**
         * Stops the IO transaction.
         *
         * @method stop
         */
        stop: function() {
            var instance = this;
            var transaction = instance.get('transaction');

            if (transaction) {
                transaction.abort();
            }
        },

        /**
         * Invoke the `start` method (autoLoad attribute).
         *
         * @method _autoStart
         * @protected
         */
        _autoStart: function() {
            var instance = this;

            if (instance.get('autoLoad')) {
                instance.start();
            }
        },

        /**
         * Parse the [uri](A.IORequest.html#attr_uri) to add a
         * timestamp if [cache](A.IORequest.html#attr_cache) is
         * `true`. Also applies the `YUI.AUI.defaults.io.uriFormatter`.
         *
         * @method _parseURL
         * @param {String} url
         * @protected
         * @return {String}
         */
        _parseURL: function(url) {
            var instance = this;
            var cache = instance.get('cache');
            var method = instance.get('method');

            // reusing logic to add a timestamp on the url from jQuery 1.3.2
            if ((cache === false) && (method === 'get')) {
                var ts = +new Date();
                // try replacing _= if it is there
                var ret = url.replace(/(\?|&)_=.*?(&|$)/, '$1_=' + ts + '$2');
                // if nothing was replaced, add timestamp to the end
                url = ret + ((ret === url) ? (url.match(/\?/) ? '&' : '?') + '_=' + ts : '');
            }

            // formatting the URL with the default uriFormatter after the cache
            // timestamp was added
            var uriFormatter = defaults.uriFormatter;

            if (isFunction(uriFormatter)) {
                url = uriFormatter.apply(instance, [url]);
            }

            return url;
        },

        /**
         * Internal end callback for the IO transaction.
         *
         * @method _end
         * @param {Number} id ID of the IO transaction.
         * @param {Object} args Custom arguments, passed to the event handler.
         *     See [IO](http://yuilibrary.com/yui/docs/io/#the-configuration-object).
         * @protected
         */
        _end: function(id, args) {
            var instance = this;

            instance.set('active', false);
            instance.set('transaction', null);

            instance.fire('end', id, args);
        },

        /**
         * Internal success callback for the IO transaction.
         *
         * @method _success
         * @param {Number} id ID of the IO transaction.
         * @param {Object} obj IO transaction Object.
         * @param {Object} args Custom arguments, passed to the event handler.
         *     See [IO](http://yuilibrary.com/yui/docs/io/#the-configuration-object).
         * @protected
         */
        _success: function(id, obj, args) {
            var instance = this;

            // update the responseData attribute with the new data from xhr
            instance.set('responseData', obj);

            instance.fire('success', id, obj, args);
        },

        /**
         * Setter for [responseData](A.IORequest.html#attr_responseData).
         *
         * @method _setResponseData
         * @protected
         * @param {Object} xhr XHR Object.
         * @return {Object}
         */
        _setResponseData: function(xhr) {
            var data = null;
            var instance = this;

            if (xhr) {
                var dataType = instance.get('dataType');
                var contentType = xhr.getResponseHeader('content-type') || '';

                // if the dataType or the content-type is XML...
                if ((dataType === 'xml') ||
                    (!dataType && contentType.indexOf('xml') >= 0)) {

                    // use responseXML
                    data = xhr.responseXML;

                    // check if the XML was parsed correctly
                    if (data.documentElement.tagName === 'parsererror') {
                        throw 'Parser error: IO dataType is not correctly parsing';
                    }
                }
                else {
                    // otherwise use the responseText
                    data = xhr.responseText;
                }

                // empty string is not a valid 'json', convert it to null
                if (data === '') {
                    data = null;
                }

                // trying to parse to JSON if dataType is a valid json
                if (dataType === 'json') {
                    try {
                        data = A.JSON.parse(data);
                    }
                    catch (e) {
                        // throw 'Parser error: IO dataType is not correctly parsing';
                    }
                }
                else {
                    var selector = instance.get('selector');

                    if (data && selector) {
                        var tempRoot;

                        if (data.documentElement) {
                            tempRoot = A.one(data);
                        }
                        else {
                            tempRoot = A.Node.create(data);
                        }

                        data = tempRoot.all(selector);
                    }
                }
            }

            return data;
        }
    }
});

A.IORequest = IORequest;

/**
 * Alloy IO extension
 *
 * @class A.io
 * @static
 */

/**
 * Static method to invoke the [IORequest](A.IORequest.html).
 * Likewise [IO](A.io.html).
 *
 * @method A.io.request
 * @for A.io
 * @param {String} uri URI to be requested.
 * @param {Object} config Configuration Object for the [IO](A.io.html).
 * @return {IORequest}
 */
A.io.request = function(uri, config) {
    return new A.IORequest(
        A.merge(config, {
            uri: uri
        })
    );
};


}, '3.1.0-deprecated.85', {"requires": ["io-base", "json", "plugin", "querystring-stringify", "aui-component"]});

YUI.add('aui-loading-mask-deprecated', function (A, NAME) {

/**
 * The LoadingMask Utility
 *
 * @module aui-loading-mask
 */

var Lang = A.Lang,

    BOUNDING_BOX = 'boundingBox',
    CONTENT_BOX = 'contentBox',
    HIDE = 'hide',
    HOST = 'host',
    MESSAGE_EL = 'messageEl',
    NAME = 'loadingmask',
    POSITION = 'position',
    SHOW = 'show',
    STATIC = 'static',
    STRINGS = 'strings',
    TARGET = 'target',
    TOGGLE = 'toggle',

    getClassName = A.getClassName,

    CSS_LOADINGMASK = getClassName(NAME),
    CSS_MASKED = getClassName(NAME, 'masked'),
    CSS_MASKED_RELATIVE = getClassName(NAME, 'masked', 'relative'),
    CSS_MESSAGE_LOADING = getClassName(NAME, 'message'),
    CSS_MESSAGE_LOADING_CONTENT = getClassName(NAME, 'message', 'content'),

    TPL_MESSAGE_LOADING = '<div class="' + CSS_MESSAGE_LOADING + '"><div class="' + CSS_MESSAGE_LOADING_CONTENT +
        '">{0}</div></div>';

/**
 * <p><img src="assets/images/aui-loading-mask/main.png"/></p>
 *
 * A base class for LoadingMask, providing:
 * <ul>
 *    <li>Cross browser mask functionality to cover an element or the entire page</li>
 *    <li>Customizable mask (i.e., background, opacity)</li>
 *    <li>Display a centered "loading" message on the masked node</li>
 * </ul>
 *
 * Quick Example:<br/>
 *
 * <pre><code>node.plug(A.LoadingMask, { background: '#000' });</code></pre>
 *
 * Check the list of <a href="LoadingMask.html#configattributes">Configuration Attributes</a> available for
 * LoadingMask.
 *
 * @param config {Object} Object literal specifying widget configuration properties.
 *
 * @class LoadingMask
 * @constructor
 * @extends Plugin.Base
 */
var LoadingMask = A.Component.create({

    /**
     * Static property provides a string to identify the class.
     *
     * @property LoadingMask.NAME
     * @type String
     * @static
     */
    NAME: NAME,

    /**
     * Static property provides a string to identify the namespace.
     *
     * @property LoadingMask.NS
     * @type String
     * @static
     */
    NS: NAME,

    /**
     * Static property used to define the default attribute
     * configuration for the LoadingMask.
     *
     * @property LoadingMask.ATTRS
     * @type Object
     * @static
     */
    ATTRS: {
        /**
         * Node element to display the message.
         *
         * @attribute messageEl
         * @default Generated HTML div element.
         * @type String
         */
        messageEl: {
            valueFn: function(val) {
                var instance = this;
                var strings = instance.get(STRINGS);

                return A.Node.create(
                    Lang.sub(TPL_MESSAGE_LOADING, [strings.loading])
                );
            }
        },

        /**
         * Strings used on the LoadingMask. See
         * <a href="Widget.html#method_strings">strings</a>.
         *
         * @attribute strings
         * @default { loading: 'Loading&hellip;' }
         * @type Object
         */
        strings: {
            value: {
                loading: 'Loading&hellip;'
            }
        },

        /**
         * Node where the mask will be positioned and re-dimensioned.
         *
         * @attribute target
         * @default null
         * @type Node | Widget
         */
        target: {
            setter: function() {
                var instance = this;
                var target = instance.get(HOST);

                if (target instanceof A.Widget) {
                    target = target.get(CONTENT_BOX);
                }

                return target;
            },
            value: null
        }
    },

    EXTENDS: A.Plugin.Base,

    prototype: {
        /**
         * Construction logic executed during LoadingMask instantiation. Lifecycle.
         *
         * @method initializer
         * @protected
         */
        initializer: function(config) {
            var instance = this;

            instance.IGNORED_ATTRS = A.merge({
                    host: true
                },
                LoadingMask.ATTRS
            );

            instance.renderUI();
            instance.bindUI();

            instance._createDynamicAttrs(config);
        },

        /**
         * Create the DOM structure for the LoadingMask. Lifecycle.
         *
         * @method renderUI
         * @protected
         */
        renderUI: function() {
            var instance = this;
            var strings = instance.get(STRINGS);

            instance._renderOverlayMask();

            instance.overlayMask.get(BOUNDING_BOX).append(
                instance.get(MESSAGE_EL)
            );
        },

        /**
         * Bind the events on the LoadingMask UI. Lifecycle.
         *
         * @method bindUI
         * @protected
         */
        bindUI: function() {
            var instance = this;

            instance._bindOverlayMaskUI();
        },

        destructor: function() {
            var instance = this;

            instance.overlayMask.destroy();

            instance._visibleChangeHandle.detach();
        },

        /**
         * Bind events to the
         * <a href="LoadingMask.html#property_overlayMask">overlayMask</a>.
         *
         * @method _bindOverlayMaskUI
         * @protected
         */
        _bindOverlayMaskUI: function() {
            var instance = this;

            instance._visibleChangeHandle = instance.overlayMask.after('visibleChange', instance._afterVisibleChange, instance);
        },

        /**
         * Center the
         * <a href="LoadingMask.html#config_messageEl">messageEl</a> with the
         * <a href="LoadingMask.html#config_target">target</a> node.
         *
         * @method centerMessage
         */
        centerMessage: function() {
            var instance = this;

            instance.get(MESSAGE_EL).center(
                instance.overlayMask.get(BOUNDING_BOX)
            );
        },

        /**
         * Invoke the
         * <a href="LoadingMask.html#property_overlayMask">overlayMask</a>
         * <code>refreshMask</code> method.
         *
         * @method refreshMask
         */
        refreshMask: function() {
            var instance = this;

            instance.overlayMask.refreshMask();

            instance.centerMessage();
        },

        /**
         * Fires after the value of the
         * <a href="LoadingMask.html#config_visible">visible</a> attribute change.
         *
         * @method _afterVisibleChange
         * @param {EventFacade} event
         * @protected
         */
        _afterVisibleChange: function(event) {
            var instance = this;
            var target = instance.get(TARGET);
            var isStaticPositioned = (target.getStyle(POSITION) == STATIC);

            target.toggleClass(CSS_MASKED, (event.newVal));
            target.toggleClass(CSS_MASKED_RELATIVE, (event.newVal && isStaticPositioned));

            if (event.newVal) {
                instance.refreshMask();
            }
        },

        /**
         * Render
         * <a href="LoadingMask.html#property_overlayMask">overlayMask</a>
         * instance.
         *
         * @method _renderOverlayMask
         * @protected
         */
        _renderOverlayMask: function() {
            var instance = this;
            var target = instance.get(TARGET);

            /**
             * Stores the <a href="OverlayMask.html">OverlayMask</a> used
             * internally.
             *
             * @property overlayMask
             * @type OverlayMask
             * @protected
             */
            instance.overlayMask = new A.OverlayMask({
                target: target,
                cssClass: CSS_LOADINGMASK
            }).render(target);
        },

        /**
         * Create dynamic attributes listeners to invoke the setter on
         * <a href="LoadingMask.html#property_overlayMask">overlayMask</a> after
         * the attribute is set on the LoadingMask instance.
         *
         * @method _createDynamicAttrs
         * @param {Object} config Object literal specifying widget configuration properties.
         * @protected
         */
        _createDynamicAttrs: function(config) {
            var instance = this;

            A.each(config, function(value, key) {
                var ignoredAttr = instance.IGNORED_ATTRS[key];

                if (!ignoredAttr) {
                    instance.addAttr(key, {
                        setter: function(val) {
                            this.overlayMask.set(key, val);

                            return val;
                        },
                        value: value
                    });
                }
            });
        }
    }
});

A.each([HIDE, SHOW, TOGGLE], function(method) {
    /**
     * Invoke the
     * <a href="LoadingMask.html#property_overlayMask">overlayMask</a>
     * <code>hide</code> method.
     *
     * @method hide
     */

    /**
     * Invoke the
     * <a href="LoadingMask.html#property_overlayMask">overlayMask</a>
     * <code>show</code> method.
     *
     * @method show
     */

    /**
     * Invoke the
     * <a href="LoadingMask.html#property_overlayMask">overlayMask</a>
     * <code>toggle</code> method.
     *
     * @method toggle
     */
    LoadingMask.prototype[method] = function() {
        this.overlayMask[method]();
    };
});

A.LoadingMask = LoadingMask;


}, '3.1.0-deprecated.85', {"requires": ["plugin", "aui-overlay-mask-deprecated"], "skinnable": true});

YUI.add('aui-overlay-base-deprecated', function (A, NAME) {

/**
 * Provides a basic Overlay widget, with Standard Module content support. The Overlay widget
 * provides Page XY positioning support, alignment and centering support along with basic
 * stackable support (z-index and shimming).
 *
 * @module aui-overlay
 * @submodule aui-overlay-base
 */

/**
 * A basic Overlay Widget, which can be positioned based on Page XY co-ordinates and is stackable (z-index support).
 * It also provides alignment and centering support and uses a standard module format for it's content, with header,
 * body and footer section support.
 *
 * @class OverlayBase
 * @constructor
 * @extends Component
 * @uses WidgetStdMod
 * @uses WidgetPosition
 * @uses WidgetStack
 * @uses WidgetPositionAlign
 * @uses WidgetPositionConstrain
 * @param {Object} object The user configuration for the instance.
 */
A.OverlayBase = A.Component.create({
    NAME: 'overlay',
    ATTRS: {
        hideClass: {
            value: false
        }
    },
    AUGMENTS: [A.WidgetPosition, A.WidgetStack, A.WidgetPositionAlign, A.WidgetPositionConstrain, A.WidgetStdMod]
});


}, '3.1.0-deprecated.85', {
    "requires": [
        "widget-position",
        "widget-stack",
        "widget-position-align",
        "widget-position-constrain",
        "widget-stdmod",
        "aui-component"
    ]
});

YUI.add('aui-overlay-context-deprecated', function (A, NAME) {

/**
 * The OverlayContext Utility
 *
 * @module aui-overlay
 * @submodule aui-overlay-context
 */

var L = A.Lang,
    isString = L.isString,
    isNumber = L.isNumber,
    isObject = L.isObject,
    isBoolean = L.isBoolean,

    isNodeList = function(v) {
        return (v instanceof A.NodeList);
    },

    ALIGN = 'align',
    BL = 'bl',
    BOUNDING_BOX = 'boundingBox',
    CANCELLABLE_HIDE = 'cancellableHide',
    OVERLAY_CONTEXT = 'overlaycontext',
    CURRENT_NODE = 'currentNode',
    FOCUSED = 'focused',
    HIDE = 'hide',
    HIDE_DELAY = 'hideDelay',
    HIDE_ON = 'hideOn',
    HIDE_ON_DOCUMENT_CLICK = 'hideOnDocumentClick',
    MOUSEDOWN = 'mousedown',
    SHOW = 'show',
    SHOW_DELAY = 'showDelay',
    SHOW_ON = 'showOn',
    TL = 'tl',
    TRIGGER = 'trigger',
    USE_ARIA = 'useARIA',
    VISIBLE = 'visible';

/**
 * <p><img src="assets/images/aui-overlay-context/main.png"/></p>
 *
 * A base class for OverlayContext, providing:
 * <ul>
 *    <li>Widget Lifecycle (initializer, renderUI, bindUI, syncUI, destructor)</li>
 *    <li>Able to display an <a href="Overlay.html">Overlay</a> at a specified corner of an element <a href="OverlayContext.html#config_trigger">trigger</a></li>
 * </ul>
 *
 * Quick Example:<br/>
 *
 * <pre><code>var instance = new A.OverlayContext({
 *  boundingBox: '#OverlayBoundingBox',
 *  hideOn: 'mouseleave',
 *  showOn: 'mouseenter',
 *	trigger: '.menu-trigger'
 * }).render();
 * </code></pre>
 *
 * Check the list of <a href="OverlayContext.html#configattributes">Configuration Attributes</a> available for
 * OverlayContext.
 *
 * @class OverlayContext
 * @constructor
 * @extends OverlayBase
 * @param config {Object} Object literal specifying widget configuration properties.
 */
var OverlayContext = A.Component.create({
    /**
     * Static property provides a string to identify the class.
     *
     * @property OverlayContext.NAME
     * @type String
     * @static
     */
    NAME: OVERLAY_CONTEXT,

    /**
     * Static property used to define the default attribute
     * configuration for the OverlayContext.
     *
     * @property OverlayContext.ATTRS
     * @type Object
     * @static
     */
    ATTRS: {
        /**
         * Inherited from <a href="Overlay.html#config_align">Overlay</a>.
         *
         * @attribute align
         * @default { node: null, points: [ TL, BL ] }
         * @type Object
         */
        align: {
            value: {
                node: null,
                points: [TL, BL]
            }
        },

        /**
         * Cancel auto hide delay if the user interact with the Overlay
         * (focus, click, mouseover)
         *
         * @attribute cancellableHide
         * @default true
         * @type boolean
         */
        cancellableHide: {
            value: true,
            validator: isBoolean
        },

        /**
         * OverlayContext allow multiple elements to be the
         * <a href="OverlayContext.html#config_trigger">trigger</a>, the
         * currentNode stores the current active one.
         *
         * @attribute currentNode
         * @default First item of the
         * <a href="OverlayContext.html#config_trigger">trigger</a> NodeList.
         * @type Node
         */
        currentNode: {
            valueFn: function() {
                // define default currentNode as the first item from trigger
                return this.get(TRIGGER).item(0);
            }
        },

        delay: {
            value: null,
            validator: isObject
        },

        /**
         * The event which is responsible to hide the OverlayContext.
         *
         * @attribute hideOn
         * @default mouseout
         * @type String
         */
        hideOn: {
            lazyAdd: false,
            value: 'mouseout',
            setter: function(v) {
                return this._setHideOn(v);
            }
        },

        /**
         * If true the instance is registered on the
         * <a href="OverlayContextManager.html">OverlayContextManager</a> static
         * class and will be hide when the user click on document.
         *
         * @attribute hideOnDocumentClick
         * @default true
         * @type boolean
         */
        hideOnDocumentClick: {
            lazyAdd: false,
            setter: function(v) {
                return this._setHideOnDocumentClick(v);
            },
            value: true,
            validator: isBoolean
        },

        /**
         * Number of milliseconds after the hide method is invoked to hide the
         * OverlayContext.
         *
         * @attribute hideDelay
         * @default 0
         * @type Number
         */
        hideDelay: {
            lazyAdd: false,
            setter: '_setHideDelay',
            value: 0,
            validator: isNumber
        },

        /**
         * The event which is responsible to show the OverlayContext.
         *
         * @attribute showOn
         * @default mouseover
         * @type String
         */
        showOn: {
            lazyAdd: false,
            value: 'mouseover',
            setter: function(v) {
                return this._setShowOn(v);
            }
        },

        /**
         * Number of milliseconds after the show method is invoked to show the
         * OverlayContext.
         *
         * @attribute showDelay
         * @default 0
         * @type Number
         */
        showDelay: {
            lazyAdd: false,
            setter: '_setShowDelay',
            value: 0,
            validator: isNumber
        },

        /**
         * Node, NodeList or Selector which will be used as trigger elements
         * to show or hide the OverlayContext.
         *
         * @attribute trigger
         * @default null
         * @type {Node | NodeList | String}
         */
        trigger: {
            lazyAdd: false,
            setter: function(v) {
                if (isNodeList(v)) {
                    return v;
                }
                else if (isString(v)) {
                    return A.all(v);
                }

                return new A.NodeList([v]);
            }
        },

        /**
         * True if Overlay should use ARIA plugin
         *
         * @attribute useARIA
         * @default true
         * @type Boolean
         */
        useARIA: {
            value: true
        },

        /**
         * If true the OverlayContext is visible by default after the render phase.
         * Inherited from <a href="Overlay.html">Overlay</a>.
         *
         * @attribute visible
         * @default false
         * @type boolean
         */
        visible: {
            value: false
        }
    },

    EXTENDS: A.OverlayBase,

    constructor: function(config) {
        var instance = this;

        instance._showCallback = null;
        instance._hideCallback = null;

        OverlayContext.superclass.constructor.apply(this, arguments);
    },

    prototype: {
        /**
         * Construction logic executed during OverlayContext instantiation. Lifecycle.
         *
         * @method initializer
         * @protected
         */
        initializer: function() {
            var instance = this;

            var trigger = instance.get(TRIGGER);

            if (trigger && trigger.size()) {
                instance.set('align.node', trigger.item(0));
            }
        },

        /**
         * Bind the events on the OverlayContext UI. Lifecycle.
         *
         * @method bindUI
         * @protected
         */
        bindUI: function() {
            var instance = this;
            var boundingBox = instance.get(BOUNDING_BOX);

            boundingBox.on(MOUSEDOWN, instance._stopTriggerEventPropagation);

            instance.before('triggerChange', instance._beforeTriggerChange);
            instance.before('showOnChange', instance._beforeShowOnChange);
            instance.before('hideOnChange', instance._beforeHideOnChange);

            instance.after('triggerChange', instance._afterTriggerChange);
            instance.after('showOnChange', instance._afterShowOnChange);
            instance.after('hideOnChange', instance._afterHideOnChange);

            boundingBox.on('click', A.bind(instance._cancelAutoHide, instance));
            boundingBox.on('mouseenter', A.bind(instance._cancelAutoHide, instance));
            boundingBox.on('mouseleave', A.bind(instance._invokeHideTaskOnInteraction, instance));
            instance.after('focusedChange', A.bind(instance._invokeHideTaskOnInteraction, instance));

            instance.on('visibleChange', instance._onVisibleChangeOverlayContext);
        },

        /**
         * Hides the OverlayContext.
         *
         * @method hide
         */
        hide: function() {
            var instance = this;

            instance.clearIntervals();

            instance.fire('hide');

            OverlayContext.superclass.hide.apply(instance, arguments);
        },

        /**
         * Shows the OverlayContext.
         *
         * @method hide
         */
        show: function(event) {
            var instance = this;

            instance.clearIntervals();

            instance.updateCurrentNode(event);

            instance.fire('show');

            OverlayContext.superclass.show.apply(instance, arguments);

            instance.refreshAlign();
        },

        /**
         * Refreshes the rendered UI, based on Widget State
         *
         * @method syncUI
         * @protected
         *
         */
        syncUI: function() {
            var instance = this;

            if (instance.get(USE_ARIA)) {
                instance.plug(A.Plugin.Aria, {
                    attributes: {
                        trigger: {
                            ariaName: 'controls',
                            format: function(value) {
                                var id = instance.get(BOUNDING_BOX).generateID();

                                return id;
                            },
                            node: function() {
                                return instance.get(TRIGGER);
                            }
                        },
                        visible: {
                            ariaName: 'hidden',
                            format: function(value) {
                                return !value;
                            }
                        }
                    },
                    roleName: 'dialog'
                });
            }
        },

        /**
         * Toggles visibility of the OverlayContext.
         *
         * @method toggle
         * @param {EventFacade} event
         */
        toggle: function(event) {
            var instance = this;

            if (instance.get(VISIBLE)) {
                instance._hideTask(event);
            }
            else {
                instance._showTask(event);
            }
        },

        /**
         * Clear the intervals to show or hide the OverlayContext. See
         * <a href="OverlayContext.html#config_hideDelay">hideDelay</a> and
         * <a href="OverlayContext.html#config_showDelay">showDelay</a>.
         *
         * @method clearIntervals
         */
        clearIntervals: function() {
            this._hideTask.cancel();
            this._showTask.cancel();
        },

        /**
         * Refreshes the alignment of the OverlayContext with the
         * <a href="OverlayContext.html#config_currentNode">currentNode</a>. See
         * also <a href="OverlayContext.html#config_align">align</a>.
         *
         * @method refreshAlign
         */
        refreshAlign: function() {
            var instance = this;
            var align = instance.get(ALIGN);
            var currentNode = instance.get(CURRENT_NODE);

            if (currentNode) {
                instance._uiSetAlign(currentNode, align.points);
            }
        },

        /**
         * Update the
         * <a href="OverlayContext.html#config_currentNode">currentNode</a> with the
         * <a href="OverlayContext.html#config_align">align</a> node or the
         * event.currentTarget and in last case with the first item of the
         * <a href="OverlayContext.html#config_trigger">trigger</a>.
         *
         * @method updateCurrentNode
         * @param {EventFacade} event
         */
        updateCurrentNode: function(event) {
            var instance = this;
            var align = instance.get(ALIGN);
            var trigger = instance.get(TRIGGER);
            var currentTarget = null;

            if (event) {
                currentTarget = event.currentTarget;
            }

            var node = currentTarget || trigger.item(0) || align.node;

            if (node) {
                instance.set(CURRENT_NODE, node);
            }
        },

        /**
         * Handles the logic for the
         * <a href="OverlayContext.html#method_toggle">toggle</a>.
         *
         * @method _toggle
         * @param {EventFacade} event
         * @protected
         */
        _toggle: function(event) {
            var instance = this;

            if (instance.get('disabled')) {
                return;
            }

            var currentTarget = event.currentTarget;

            // check if the target is different and simulate a .hide() before toggle
            if (instance._lastTarget != currentTarget) {
                instance.hide();
            }

            instance.toggle(event);

            event.stopPropagation();

            instance._lastTarget = currentTarget;
        },

        /**
         * Fires after the <a href="OverlayContext.html#config_showOn">showOn</a>
         * attribute change.
         *
         * @method _afterShowOnChange
         * @param {EventFacade} event
         * @protected
         */
        _afterShowOnChange: function(event) {
            var instance = this;
            var wasToggle = event.prevVal == instance.get(HIDE_ON);

            if (wasToggle) {
                var trigger = instance.get(TRIGGER);

                // if wasToggle remove the toggle callback
                trigger.detach(event.prevVal, instance._hideCallback);
                // and re attach the hide event
                instance._setHideOn(instance.get(HIDE_ON));
            }
        },

        /**
         * Fires after the <a href="OverlayContext.html#config_hideOn">hideOn</a>
         * attribute change.
         *
         * @method _afterHideOnChange
         * @param {EventFacade} event
         * @protected
         */
        _afterHideOnChange: function(event) {
            var instance = this;
            var wasToggle = event.prevVal == instance.get(SHOW_ON);

            if (wasToggle) {
                var trigger = instance.get(TRIGGER);

                // if wasToggle remove the toggle callback
                trigger.detach(event.prevVal, instance._showCallback);
                // and re attach the show event
                instance._setShowOn(instance.get(SHOW_ON));
            }
        },

        /**
         * Fires after the <a href="OverlayContext.html#config_trigger">trigger</a>
         * attribute change.
         *
         * @method _afterTriggerChange
         * @param {EventFacade} event
         * @protected
         */
        _afterTriggerChange: function(event) {
            var instance = this;

            instance._setShowOn(instance.get(SHOW_ON));
            instance._setHideOn(instance.get(HIDE_ON));
        },

        /**
         * Fires before the <a href="OverlayContext.html#config_showOn">showOn</a>
         * attribute change.
         *
         * @method _beforeShowOnChange
         * @param {EventFacade} event
         * @protected
         */
        _beforeShowOnChange: function(event) {
            var instance = this;
            var trigger = instance.get(TRIGGER);

            // detach the old callback
            trigger.detach(event.prevVal, instance._showCallback);
        },

        /**
         * Fires before the <a href="OverlayContext.html#config_hideOn">hideOn</a>
         * attribute change.
         *
         * @method _beforeHideOnChange
         * @param {EventFacade} event
         * @protected
         */
        _beforeHideOnChange: function(event) {
            var instance = this;
            var trigger = instance.get(TRIGGER);

            // detach the old callback
            trigger.detach(event.prevVal, instance._hideCallback);
        },

        /**
         * Fires before the <a href="OverlayContext.html#config_trigger">trigger</a>
         * attribute change.
         *
         * @method _beforeTriggerChange
         * @param {EventFacade} event
         * @protected
         */
        _beforeTriggerChange: function(event) {
            var instance = this;
            var trigger = instance.get(TRIGGER);
            var showOn = instance.get(SHOW_ON);
            var hideOn = instance.get(HIDE_ON);

            trigger.detach(showOn, instance._showCallback);
            trigger.detach(hideOn, instance._hideCallback);
            trigger.detach(MOUSEDOWN, instance._stopTriggerEventPropagation);
        },

        /**
         * Cancel hide event if the user does some interaction with the
         * OverlayContext (focus, click or mouseover).
         *
         * @method _cancelAutoHide
         * @param {EventFacade} event
         * @protected
         */
        _cancelAutoHide: function(event) {
            var instance = this;

            if (instance.get(CANCELLABLE_HIDE)) {
                instance.clearIntervals();
            }

            event.stopPropagation();
        },

        /**
         * Invoke the hide event when the OverlayContext looses the focus.
         *
         * @method _invokeHideTaskOnInteraction
         * @param {EventFacade} event
         * @protected
         */
        _invokeHideTaskOnInteraction: function(event) {
            var instance = this;
            var cancellableHide = instance.get(CANCELLABLE_HIDE);
            var focused = instance.get(FOCUSED);

            if (!focused && !cancellableHide) {
                instance._hideTask();
            }
        },

        /**
         * Fires when the <a href="OverlayContext.html#config_visible">visible</a>
         * attribute changes.
         *
         * @method _onVisibleChangeOverlayContext
         * @param {EventFacade} event
         * @protected
         */
        _onVisibleChangeOverlayContext: function(event) {
            var instance = this;

            if (event.newVal && instance.get('disabled')) {
                event.preventDefault();
            }
        },

        /**
         * Helper method to invoke event.stopPropagation().
         *
         * @method _stopTriggerEventPropagation
         * @param {EventFacade} event
         * @protected
         */
        _stopTriggerEventPropagation: function(event) {
            event.stopPropagation();
        },

        /**
         * Setter for the
         * <a href="OverlayContext.html#config_hideDelay">hideDelay</a>
         * attribute.
         *
         * @method _setHideDelay
         * @param {number} val
         * @protected
         * @return {number}
         */
        _setHideDelay: function(val) {
            var instance = this;

            instance._hideTask = A.debounce(instance.hide, val, instance);

            return val;
        },

        /**
         * Setter for the <a href="OverlayContext.html#config_hideOn">hideOn</a>
         * attribute.
         *
         * @method _setHideOn
         * @param {String} eventType Event type
         * @protected
         * @return {String}
         */
        _setHideOn: function(eventType) {
            var instance = this;
            var trigger = instance.get(TRIGGER);
            var toggle = eventType == instance.get(SHOW_ON);

            if (toggle) {
                instance._hideCallback = A.bind(instance._toggle, instance);

                // only one attached event is enough for toggle
                trigger.detach(eventType, instance._showCallback);
            }
            else {
                var delay = instance.get(HIDE_DELAY);

                instance._hideCallback = function(event) {
                    instance._hideTask(event);

                    event.stopPropagation();
                };
            }

            trigger.on(eventType, instance._hideCallback);

            return eventType;
        },

        /**
         * Setter for the
         * <a href="OverlayContext.html#config_hideOnDocumentClick">hideOnDocumentClick</a>
         * attribute.
         *
         * @method _setHideOn
         * @param {boolean} value
         * @protected
         * @return {boolean}
         */
        _setHideOnDocumentClick: function(value) {
            var instance = this;

            if (value) {
                A.OverlayContextManager.register(instance);
            }
            else {
                A.OverlayContextManager.remove(instance);
            }

            return value;
        },

        /**
         * Setter for the
         * <a href="OverlayContext.html#config_showDelay">showDelay</a>
         * attribute.
         *
         * @method _setShowDelay
         * @param {number} val
         * @protected
         * @return {number}
         */
        _setShowDelay: function(val) {
            var instance = this;

            instance._showTask = A.debounce(instance.show, val, instance);

            return val;
        },

        /**
         * Setter for the <a href="OverlayContext.html#config_showOn">showOn</a>
         * attribute.
         *
         * @method _setShowOn
         * @param {String} eventType Event type
         * @protected
         * @return {String}
         */
        _setShowOn: function(eventType) {
            var instance = this;
            var trigger = instance.get(TRIGGER);
            var toggle = eventType == instance.get(HIDE_ON);

            if (toggle) {
                instance._showCallback = A.bind(instance._toggle, instance);

                // only one attached event is enough for toggle
                trigger.detach(eventType, instance._hideCallback);
            }
            else {
                var delay = instance.get(SHOW_DELAY);

                instance._showCallback = function(event) {
                    instance._showTask(event);

                    event.stopPropagation();
                };
            }

            if (eventType != MOUSEDOWN) {
                trigger.on(MOUSEDOWN, instance._stopTriggerEventPropagation);
            }
            else {
                trigger.detach(MOUSEDOWN, instance._stopTriggerEventPropagation);
            }

            trigger.on(eventType, instance._showCallback);

            return eventType;
        }
    }
});

A.OverlayContext = OverlayContext;

/**
 * A base class for OverlayContextManager:
 *
 * @param config {Object} Object literal specifying widget configuration properties.
 *
 * @class OverlayContextManager
 * @constructor
 * @extends OverlayManager
 * @static
 */
A.OverlayContextManager = new A.OverlayManager({});

A.on(MOUSEDOWN, function() {
    A.OverlayContextManager.hideAll();
}, A.getDoc());


}, '3.1.0-deprecated.85', {"requires": ["aui-overlay-manager-deprecated", "aui-delayed-task-deprecated", "aui-aria"]});

YUI.add('aui-overlay-manager-deprecated', function (A, NAME) {

/**
 * The OverlayManager Utility
 *
 * @module aui-overlay
 * @submodule aui-overlay-manager
 */

var Lang = A.Lang,
    isArray = Lang.isArray,
    isBoolean = Lang.isBoolean,
    isNumber = Lang.isNumber,
    isString = Lang.isString,

    BOUNDING_BOX = 'boundingBox',
    DEFAULT = 'default',
    HOST = 'host',
    OVERLAY_MANAGER = 'OverlayManager',
    GROUP = 'group',
    Z_INDEX = 'zIndex',
    Z_INDEX_BASE = 'zIndexBase';

/**
 * <p><img src="assets/images/aui-overlay-manager/main.png"/></p>
 *
 * A base class for OverlayManager, providing:
 * <ul>
 *    <li>Grouping overlays</li>
 *    <li>Show or hide the entire group of registered overlays</li>
 *    <li>Basic Overlay Stackability (zIndex support)</li>
 * </ul>
 *
 * Quick Example:<br/>
 *
 * <pre><code>var groupOverlayManager = new A.OverlayManager();
 * groupOverlayManager.register([overlay1, overlay2, overlay3]);
 * groupOverlayManager.hideAll();
 * </code></pre>
 *
 * Check the list of <a href="OverlayManager.html#configattributes">Configuration Attributes</a> available for
 * OverlayManager.
 *
 * @param config {Object} Object literal specifying widget configuration properties.
 *
 * @class OverlayManager
 * @constructor
 * @extends Base
 */
var OverlayManager = A.Component.create({
    /**
     * Static property provides a string to identify the class.
     *
     * @property OverlayManager.NAME
     * @type String
     * @static
     */
    NAME: OVERLAY_MANAGER.toLowerCase(),

    /**
     * Static property used to define the default attribute
     * configuration for the OverlayManager.
     *
     * @property OverlayManager.ATTRS
     * @type Object
     * @static
     */
    ATTRS: {
        /**
         * The zIndex base to be used on the stacking for all overlays
         * registered on the OverlayManager.
         *
         * @attribute zIndexBase
         * @default 1000
         * @type Number
         */
        zIndexBase: {
            value: 1000,
            validator: isNumber,
            setter: Lang.toInt
        }
    },

    EXTENDS: A.Base,

    prototype: {
        /**
         * Construction logic executed during OverlayManager instantiation. Lifecycle.
         *
         * @method initializer
         * @protected
         */
        initializer: function() {
            var instance = this;

            instance._overlays = [];
        },

        /**
         * Set the passed overlay zIndex to the highest value.
         *
         * @method bringToTop
         * @param {Overlay} overlay Instance of
         * <a href="Overlay.html">Overlay</a>.
         */
        bringToTop: function(overlay) {
            var instance = this;

            var overlays = instance._overlays.sort(instance.sortByZIndexDesc);

            var highest = overlays[0];

            if (highest !== overlay) {
                var overlayZ = overlay.get(Z_INDEX);
                var highestZ = highest.get(Z_INDEX);

                overlay.set(Z_INDEX, highestZ + 1);

                overlay.set('focused', true);
            }
        },

        /**
         * Destructor lifecycle implementation for the OverlayManager class.
         * Purges events attached to the node (and all child nodes).
         *
         * @method destructor
         * @protected
         */
        destructor: function() {
            var instance = this;

            instance._overlays = [];
        },

        /**
         * Register the passed <a href="Overlay.html">Overlay</a> to this
         * OverlayManager.
         *
         * @method register
         * @param {Overlay} overlay <a href="Overlay.html">Overlay</a> instance to be registered
         * @return {Array} Registered overlays
         */
        register: function(overlay) {
            var instance = this;

            var overlays = instance._overlays;

            if (isArray(overlay)) {
                A.Array.each(overlay, function(o) {
                    instance.register(o);
                });
            }
            else {
                var zIndexBase = instance.get(Z_INDEX_BASE);
                var registered = instance._registered(overlay);

                if (!registered && overlay &&
                    ((overlay instanceof A.Overlay) ||
                        (A.Component && overlay instanceof A.Component))
                ) {
                    var boundingBox = overlay.get(BOUNDING_BOX);

                    overlays.push(overlay);

                    var zIndex = overlay.get(Z_INDEX) || 0;
                    var newZIndex = overlays.length + zIndex + zIndexBase;

                    overlay.set(Z_INDEX, newZIndex);

                    overlay.on('focusedChange', instance._onFocusedChange, instance);
                    boundingBox.on('mousedown', instance._onMouseDown, instance);
                }
            }

            return overlays;
        },

        /**
         * Remove the passed <a href="Overlay.html">Overlay</a> from this
         * OverlayManager.
         *
         * @method remove
         * @param {Overlay} overlay <a href="Overlay.html">Overlay</a> instance to be removed
         * @return {null}
         */
        remove: function(overlay) {
            var instance = this;

            var overlays = instance._overlays;

            if (overlays.length) {
                return A.Array.removeItem(overlays, overlay);
            }

            return null;
        },

        /**
         * Loop through all registered <a href="Overlay.html">Overlay</a> and
         * execute a callback.
         *
         * @method each
         * @param {function} fn Callback to be executed on the
         * <a href="Array.html#method_each">Array.each</a>
         * @return {null}
         */
        each: function(fn) {
            var instance = this;

            var overlays = instance._overlays;

            A.Array.each(overlays, fn);
        },

        /**
         * Invoke the <a href="Overlay.html#method_show">show</a> method from
         * all registered Overlays.
         *
         * @method showAll
         */
        showAll: function() {
            this.each(
                function(overlay) {
                    overlay.show();
                }
            );
        },

        /**
         * Invoke the <a href="Overlay.html#method_hide">hide</a> method from
         * all registered Overlays.
         *
         * @method hideAll
         */
        hideAll: function() {
            this.each(
                function(overlay) {
                    overlay.hide();
                }
            );
        },

        /**
         * zIndex comparator. Used on Array.sort.
         *
         * @method sortByZIndexDesc
         * @param {Overlay} a Overlay
         * @param {Overlay} b Overlay
         * @return {Number}
         */
        sortByZIndexDesc: function(a, b) {
            if (!a || !b || !a.hasImpl(A.WidgetStack) || !b.hasImpl(A.WidgetStack)) {
                return 0;
            }
            else {
                var aZ = a.get(Z_INDEX);
                var bZ = b.get(Z_INDEX);

                if (aZ > bZ) {
                    return -1;
                }
                else if (aZ < bZ) {
                    return 1;
                }
                else {
                    return 0;
                }
            }
        },

        /**
         * Check if the overlay is registered.
         *
         * @method _registered
         * @param {Overlay} overlay Overlay
         * @protected
         * @return {boolean}
         */
        _registered: function(overlay) {
            var instance = this;

            return A.Array.indexOf(instance._overlays, overlay) != -1;
        },

        /**
         * Mousedown event handler, used to invoke
         * <a href="OverlayManager.html#method_bringToTop">bringToTop</a>.
         *
         * @method _onMouseDown
         * @param {EventFacade} event
         * @protected
         */
        _onMouseDown: function(event) {
            var instance = this;
            var overlay = A.Widget.getByNode(event.currentTarget || event.target);
            var registered = instance._registered(overlay);

            if (overlay && registered) {
                instance.bringToTop(overlay);
            }
        },

        /**
         * Fires when the <a href="Widget.html#config_focused">focused</a>
         * attribute change. Used to invoke
         * <a href="OverlayManager.html#method_bringToTop">bringToTop</a>.
         *
         * @method _onFocusedChange
         * @param {EventFacade} event
         * @protected
         */
        _onFocusedChange: function(event) {
            var instance = this;

            if (event.newVal) {
                var overlay = event.currentTarget || event.target;
                var registered = instance._registered(overlay);

                if (overlay && registered) {
                    instance.bringToTop(overlay);
                }
            }
        }
    }
});

A.OverlayManager = OverlayManager;


}, '3.1.0-deprecated.85', {"requires": ["overlay", "plugin", "aui-base-deprecated", "aui-overlay-base-deprecated"]});

YUI.add('aui-overlay-mask-deprecated', function (A, NAME) {

/**
 * The OverlayMask Utility
 *
 * @module aui-overlay
 * @submodule aui-overlay-mask
 */

var L = A.Lang,
    isArray = L.isArray,
    isString = L.isString,
    isNumber = L.isNumber,
    isValue = L.isValue,

    CONFIG = A.config,

    UA = A.UA,

    IE6 = (UA.ie <= 6),

    ABSOLUTE = 'absolute',
    ALIGN_POINTS = 'alignPoints',
    BACKGROUND = 'background',
    BOUNDING_BOX = 'boundingBox',
    CONTENT_BOX = 'contentBox',
    FIXED = 'fixed',
    HEIGHT = 'height',
    OFFSET_HEIGHT = 'offsetHeight',
    OFFSET_WIDTH = 'offsetWidth',
    OPACITY = 'opacity',
    OVERLAY_MASK = 'overlaymask',
    POSITION = 'position',
    TARGET = 'target',
    WIDTH = 'width';

/**
 * A base class for OverlayMask, providing:
 * <ul>
 *    <li>Widget Lifecycle (initializer, renderUI, bindUI, syncUI, destructor)</li>
 *    <li>Cross browser mask functionality to cover an element or the entire page</li>
 *    <li>Customizable mask (i.e., background, opacity)</li>
 * </ul>
 *
 * Quick Example:<br/>
 *
 * <pre><code>var instance = new A.OverlayMask().render();</code></pre>
 *
 * Check the list of <a href="OverlayMask.html#configattributes">Configuration Attributes</a> available for
 * OverlayMask.
 *
 * @param config {Object} Object literal specifying widget configuration properties.
 *
 * @class OverlayMask
 * @constructor
 * @extends OverlayBase
 */
var OverlayMask = A.Component.create({
    /**
     * Static property provides a string to identify the class.
     *
     * @property OverlayMask.NAME
     * @type String
     * @static
     */
    NAME: OVERLAY_MASK,

    /**
     * Static property used to define the default attribute
     * configuration for the OverlayMask.
     *
     * @property OverlayMask.ATTRS
     * @type Object
     * @static
     */
    ATTRS: {
        /**
         * Points to align the <a href="Overlay.html">Overlay</a> used as
         * mask.
         *
         * @attribute alignPoints
         * @default [ 'tl', 'tl' ]
         * @type Array
         */
        alignPoints: {
            value: ['tl', 'tl'],
            validator: isArray
        },

        /**
         * Background color of the mask.
         *
         * @attribute background
         * @default null
         * @type String
         */
        background: {
            lazyAdd: false,
            value: null,
            validator: isString,
            setter: function(v) {
                if (v) {
                    this.get(CONTENT_BOX).setStyle(BACKGROUND, v);
                }

                return v;
            }
        },

        /**
         * Node where the mask will be positioned and re-dimensioned. The
         * default is the document, which means that if not specified the mask
         * takes the full screen.
         *
         * @attribute target
         * @default document
         * @type Node | String
         */
        target: {
            cloneDefaultValue: false,
            lazyAdd: false,
            value: CONFIG.doc,
            setter: function(v) {
                var instance = this;

                var target = A.one(v);

                var isDoc = instance._isDoc = target.compareTo(CONFIG.doc);
                var isWin = instance._isWin = target.compareTo(CONFIG.win);

                instance._fullPage = isDoc || isWin;

                return target;
            }
        },

        /**
         * CSS opacity of the mask.
         *
         * @attribute opacity
         * @default .5
         * @type Number
         */
        opacity: {
            value: 0.5,
            validator: isNumber,
            setter: function(v) {
                return this._setOpacity(v);
            }
        },

        /**
         * Use shim option.
         *
         * @attribute shim
         * @default True on IE.
         * @type boolean
         */
        shim: {
            value: A.UA.ie
        },

        /**
         * If true the Overlay is visible by default after the render phase.
         * Inherited from <a href="Overlay.html">Overlay</a>.
         *
         * @attribute visible
         * @default false
         * @type boolean
         */
        visible: {
            value: false
        },

        /**
         * zIndex of the OverlayMask.
         *
         * @attribute zIndex
         * @default 1000
         * @type Number
         */
        zIndex: {
            value: 1000
        }
    },

    EXTENDS: A.OverlayBase,

    prototype: {
        /**
         * Bind the events on the OverlayMask UI. Lifecycle.
         *
         * @method bindUI
         * @protected
         */
        bindUI: function() {
            var instance = this;

            OverlayMask.superclass.bindUI.apply(this, arguments);

            instance._eventHandles = [
                instance.after('targetChange', instance._afterTargetChange),
                instance.after('visibleChange', instance._afterVisibleChange),

                // window:resize YUI normalized event is not working, bug?
                A.on('windowresize', A.bind(instance.refreshMask, instance))
            ];
        },

        /**
         * Sync the OverlayMask UI. Lifecycle.
         *
         * @method syncUI
         * @protected
         */
        syncUI: function() {
            var instance = this;

            instance.refreshMask();
        },

        destructor: function() {
            var instance = this;

            (new A.EventHandle(instance._eventHandles)).detach();
        },

        /**
         * Get the size of the
         * <a href="OverlayMask.html#config_target">target</a>. Used to dimension
         * the mask node.
         *
         * @method getTargetSize
         * @return {Object} Object containing the { height: height, width: width }.
         */
        getTargetSize: function() {
            var instance = this;
            var target = instance.get(TARGET);

            var isDoc = instance._isDoc;
            var isWin = instance._isWin;

            var height = target.get(OFFSET_HEIGHT);
            var width = target.get(OFFSET_WIDTH);

            if (IE6) {
                // IE6 doesn't support height/width 100% on doc/win
                if (isWin) {
                    width = A.DOM.winWidth();
                    height = A.DOM.winHeight();
                }
                else if (isDoc) {
                    width = A.DOM.docWidth();
                    height = A.DOM.docHeight();
                }
            }
            // good browsers...
            else if (instance._fullPage) {
                height = '100%';
                width = '100%';
            }

            return {
                height: height,
                width: width
            };
        },

        /**
         * Repaint the OverlayMask UI, respecting the
         * <a href="OverlayMask.html#config_target">target</a> size and the
         * <a href="OverlayMask.html#config_alignPoints">alignPoints</a>.
         *
         * @method refreshMask
         */
        refreshMask: function() {
            var instance = this;
            var alignPoints = instance.get(ALIGN_POINTS);
            var target = instance.get(TARGET);
            var boundingBox = instance.get(BOUNDING_BOX);
            var targetSize = instance.getTargetSize();

            var fullPage = instance._fullPage;

            boundingBox.setStyles({
                position: (IE6 || !fullPage) ? ABSOLUTE : FIXED,
                left: 0,
                top: 0
            });

            var height = targetSize.height;
            var width = targetSize.width;

            if (isValue(height)) {
                instance.set(HEIGHT, height);
            }

            if (isValue(width)) {
                instance.set(WIDTH, width);
            }

            // if its not a full mask...
            if (!fullPage) {
                // if the target is not document|window align the overlay
                instance.align(target, alignPoints);
            }
        },

        /**
         * Setter for <a href="Paginator.html#config_opacity">opacity</a>.
         *
         * @method _setOpacity
         * @protected
         * @param {Number} v
         * @return {Number}
         */
        _setOpacity: function(v) {
            var instance = this;

            instance.get(CONTENT_BOX).setStyle(OPACITY, v);

            return v;
        },

        /**
         * Invoke the <code>OverlayMask.superclass._uiSetVisible</code>. Used to
         * reset the <code>opacity</code> to work around IE bugs when set opacity
         * of hidden elements.
         *
         * @method _uiSetVisible
         * @param {boolean} val
         * @protected
         */
        _uiSetVisible: function(val) {
            var instance = this;

            OverlayMask.superclass._uiSetVisible.apply(this, arguments);

            if (val) {
                instance._setOpacity(
                    instance.get(OPACITY)
                );
            }
        },

        /**
         * Fires after the value of the
         * <a href="Paginator.html#config_target">target</a> attribute change.
         *
         * @method _afterTargetChange
         * @param {EventFacade} event
         * @protected
         */
        _afterTargetChange: function(event) {
            var instance = this;

            instance.refreshMask();
        },

        /**
         * Fires after the value of the
         * <a href="Paginator.html#config_visible">visible</a> attribute change.
         *
         * @method _afterVisibleChange
         * @param {EventFacade} event
         * @protected
         */
        _afterVisibleChange: function(event) {
            var instance = this;

            instance._uiSetVisible(event.newVal);
        },

        /**
         * UI Setter for the
         * <a href="Paginator.html#config_xy">XY</a> attribute.
         *
         * @method _uiSetXY
         * @param {EventFacade} event
         * @protected
         */
        _uiSetXY: function() {
            var instance = this;

            if (!instance._fullPage || IE6) {
                OverlayMask.superclass._uiSetXY.apply(instance, arguments);
            }
        }
    }
});

A.OverlayMask = OverlayMask;


}, '3.1.0-deprecated.85', {"requires": ["event-resize", "aui-base-deprecated", "aui-overlay-base-deprecated"], "skinnable": true});

YUI.add('aui-parse-content', function (A, NAME) {

/**
 * The ParseContent Utility - Parse the content of a Node so that all of the
 * javascript contained in that Node will be executed according to the order
 * that it appears.
 *
 * @module aui-parse-content
 */

/*
 * NOTE: The inspiration of ParseContent cames from the "Caridy Patino" Node
 *       Dispatcher Plugin http://github.com/caridy/yui3-gallery/blob/master/src
 *       /gallery-dispatcher/
 */

var L = A.Lang,
    isString = L.isString,

    DOC = A.config.doc,
    PADDING_NODE = '<div>_</div>',

    SCRIPT_TYPES = {
        '': 1,
        'text/javascript': 1,
        'text/parsed': 1
    };

/**
 * A base class for ParseContent, providing:
 *
 * - After plug ParseContent on a A.Node instance the javascript chunks will be
 *   executed (remote and inline scripts)
 * - All the javascripts within a content will be executed according to the
 *   order of apparition
 *
 * **NOTE:** For performance reasons on DOM manipulation,
 * ParseContent only parses the content passed to the
 * [setContent](Node.html#method_setContent),
 * [prepend](Node.html#method_prepend) and
 * [append](Node.html#method_append) methods.
 *
 * Quick Example:
 *
 * ```
 * node.plug(A.Plugin.ParseContent);
 * ```
 *
 * @class A.ParseContent
 * @extends Plugin.Base
 * @param {Object} config Object literal specifying widget configuration
 *     properties.
 * @constructor
 */
var ParseContent = A.Component.create({
    /**
     * Static property provides a string to identify the class.
     *
     * @property NAME
     * @type String
     * @static
     */
    NAME: 'ParseContent',

    /**
     * Static property provides a string to identify the namespace.
     *
     * @property NS
     * @type String
     * @static
     */
    NS: 'ParseContent',

    /**
     * Static property used to define the default attribute
     * configuration for the ParseContent.
     *
     * @property ATTRS
     * @type Object
     * @static
     */
    ATTRS: {
        /**
         * A queue of elements to be parsed.
         *
         * @attribute queue
         * @default null
         */
        queue: {
            value: null
        },

        /**
         * When true, script nodes will not be removed from original content,
         * instead the script type attribute will be set to `text/plain`.
         *
         * @attribute preserveScriptNodes
         * @default false
         */
        preserveScriptNodes: {
            validator: L.isBoolean,
            value: false
        }
    },

    /**
     * Static property used to define which component it extends.
     *
     * @property EXTENDS
     * @type Object
     * @static
     */
    EXTENDS: A.Plugin.Base,

    prototype: {

        /**
         * Construction logic executed during ParseContent instantiation.
         * Lifecycle.
         *
         * @method initializer
         * @protected
         */
        initializer: function() {
            var instance = this;

            ParseContent.superclass.initializer.apply(this, arguments);

            instance.set(
                'queue',
                new A.AsyncQueue()
            );

            instance._bindAOP();
        },

        /**
         * Global eval the <data>data</data> passed.
         *
         * @method globalEval
         * @param {String} data JavaScript String.
         */
        globalEval: function(data) {
            var doc = A.getDoc();
            var head = doc.one('head') || doc.get('documentElement');

            // NOTE: A.Node.create('<script></script>') doesn't work correctly
            // on Opera
            var newScript = DOC.createElement('script');

            newScript.type = 'text/javascript';

            if (data) {
                // NOTE: newScript.set(TEXT, data) breaks on IE, YUI BUG.
                newScript.text = L.trim(data);
            }

            //removes the script node immediately after executing it
            head.appendChild(newScript).remove();
        },

        /**
         * Extract the `script` tags from the string content and
         * evaluate the chunks.
         *
         * @method parseContent
         * @param {String} content HTML string
         * @return {String}
         */
        parseContent: function(content) {
            var instance = this;

            var output = instance._extractScripts(content);

            instance._dispatch(output);

            return output;
        },

        /**
         * Add inline script data to the queue.
         *
         * @method _addInlineScript
         * @param {String} data The script content which should be added to the
         *     queue
         * @protected
         */
        _addInlineScript: function(data) {
            var instance = this;

            instance.get('queue').add({
                args: data,
                context: instance,
                fn: instance.globalEval,
                timeout: 0
            });
        },

        /**
         * Bind listeners on the `insert` and `setContent` methods of the Node
         * instance where you are plugging the ParseContent. These listeners are
         * responsible for intercept the HTML passed and parse them.
         *
         * @method _bindAOP
         * @protected
         */
        _bindAOP: function() {
            var instance = this;

            var cleanFirstArg = function(content) {
                var args = Array.prototype.slice.call(arguments);
                var output = instance.parseContent(content);

                // replace the first argument with the clean fragment
                args.splice(0, 1, output.fragment);

                return new A.Do.AlterArgs(null, args);
            };

            this.doBefore('insert', cleanFirstArg);
            this.doBefore('replaceChild', cleanFirstArg);

            var cleanArgs = function(content) {
                var output = instance.parseContent(content);

                return new A.Do.AlterArgs(null, [output.fragment]);
            };

            this.doBefore('replace', cleanArgs);
            this.doBefore('setContent', cleanArgs);
        },

        /**
         * Create an HTML fragment with the String passed, extract all the
         * script tags and return an Object with a reference for the extracted
         * scripts and the fragment.
         *
         * @method clean
         * @param {String} content HTML content.
         * @protected
         * @return {Object}
         */
        _extractScripts: function(content) {
            var instance = this,
                fragment = A.Node.create('<div></div>'),
                output = {},
                preserveScriptNodes = instance.get('preserveScriptNodes');

            // For PADDING_NODE, instead of fixing all tags in the content to be
            // "XHTML"-style, we make the firstChild be a valid non-empty tag,
            // then we remove it later

            if (isString(content)) {
                content = PADDING_NODE + content;

                // create fragment from {String}
                A.DOM.addHTML(fragment, content, 'append');
            }
            else {
                fragment.append(PADDING_NODE);

                // create fragment from {Y.Node | HTMLElement}
                fragment.append(content);
            }

            output.js = fragment.all('script').filter(function(script) {
                var includeScript = SCRIPT_TYPES[script.getAttribute('type').toLowerCase()];
                if (preserveScriptNodes) {
                    script.setAttribute('type', 'text/parsed');
                }
                return includeScript;
            });

            if (!preserveScriptNodes) {
                output.js.each(
                    function(node) {
                        node.remove();
                    }
                );
            }

            // remove PADDING_NODE
            fragment.get('firstChild').remove();

            output.fragment = fragment.get('childNodes').toFrag();

            return output;
        },

        /**
         * Loop trough all extracted `script` tags and evaluate them.
         *
         * @method _dispatch
         * @param {Object} output Object containing the reference for the
         *     fragment and the extracted `script` tags.
         * @protected
         * @return {String}
         */
        _dispatch: function(output) {
            var instance = this;

            var queue = instance.get('queue');

            var scriptContent = [];

            output.js.each(function(node) {
                var src = node.get('src');

                if (src) {
                    if (scriptContent.length) {
                        instance._addInlineScript(scriptContent.join(';'));

                        scriptContent.length = 0;
                    }

                    queue.add({
                        autoContinue: false,
                        fn: function() {
                            A.Get.script(src, {
                                onEnd: function(o) {
                                    //removes the script node immediately after
                                    //executing it
                                    o.purge();
                                    queue.run();
                                }
                            });
                        },
                        timeout: 0
                    });
                }
                else {
                    var dom = node._node;

                    scriptContent.push(dom.text || dom.textContent || dom.innerHTML || '');
                }
            });

            if (scriptContent.length) {
                instance._addInlineScript(scriptContent.join(';'));
            }

            queue.run();
        }
    }
});

A.namespace('Plugin').ParseContent = ParseContent;


}, '3.1.0-deprecated.85', {"requires": ["async-queue", "plugin", "io-base", "aui-component", "aui-node-base"]});

function ownKeys(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),i.push.apply(i,r)}return i}function _objectSpread(e){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?ownKeys(Object(i),!0).forEach((function(t){_defineProperty(e,t,i[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):ownKeys(Object(i)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))}))}return e}function _defineProperty(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}AUI.add("liferay-session",(e=>{var t=e.Lang,i=[],r=e.config,n=r.doc,a={active:"activated"},s={},o={src:s};const g="sessionToast";var l=themeDisplay.getPathMain()+"/portal/",d=e.Component.create({ATTRS:{autoExtend:{value:!1},redirectOnExpire:{value:!0},redirectUrl:{value:""},sessionLength:{getter:"_getLengthInMillis",value:0},sessionState:{value:"active"},sessionTimeoutOffset:{getter:"_getLengthInMillis",value:0},timestamp:{getter:"_getTimestamp",setter:"_setTimestamp",value:0},warningLength:{getter:"_getLengthInMillis",setter:"_setWarningLength",value:0},warningTime:{getter:"_getWarningTime",value:0}},EXTENDS:e.Base,NAME:"liferaysession",prototype:{_afterSessionStateChange(e){var t=e.details,i=e.newVal,r=null;"src"in e&&t.length&&(r=t[0]),this.fire(a[i]||i,r)},_defActivatedFn(e){this.set("timestamp"),e.src==s&&Liferay.Util.fetch(l+"extend_session")},_defExpiredFn(t){var i=this;e.clearInterval(i._intervalId),i.set("timestamp","expired"),t.src===s&&i._expireSession()},_expireSession(){var t=this;Liferay.Util.fetch(l+"expire_session").then((i=>{i.ok?(Liferay.fire("sessionExpired"),t.get("redirectOnExpire")&&(location.href=t.get("redirectUrl"))):e.setTimeout((()=>{t._expireSession()}),1e3)}))},_getLengthInMillis:e=>1e3*e,_getTimestamp(){var t=this;return e.Cookie.get(t._cookieKey,t._cookieOptions)||t._initTimestamp},_getWarningTime(){return this.get("sessionLength")-this.get("warningLength")},_initEvents(){var i=this;i.publish("activated",{defaultFn:e.bind("_defActivatedFn",i)}),i.publish("expired",{defaultFn:e.bind("_defExpiredFn",i)}),i.publish("warned"),i._eventHandlers=[i.on("sessionStateChange",i._onSessionStateChange),i.after("sessionStateChange",i._afterSessionStateChange),e.on("io:complete",((e,r,n)=>{(!n||n&&n.sessionExtend||!t.isBoolean(n.sessionExtend))&&i.resetInterval()})),Liferay.once("screenLoad",(()=>{i.destroy()}))]},_onSessionStateChange(e){var t=e.newVal,i=e.prevVal;"expired"==i&&i!=t?e.preventDefault():"active"==i&&i==t&&this._afterSessionStateChange(e)},_setTimestamp(t){var i=this;t=String(t||Date.now()),i._initTimestamp=t,navigator.cookieEnabled&&e.Cookie.set(i._cookieKey,t,i._cookieOptions)},_setWarningLength(e){return Math.min(this.get("sessionLength"),e)},_startTimer(){var i=this,r=i.get("sessionLength"),n=i.get("sessionTimeoutOffset"),a=i.get("warningTime"),s=i._registered;i._intervalId=e.setInterval((()=>{var e=i.get("sessionState"),g=i.get("timestamp"),l=r;t.toInt(g)?(l=1e3*Math.floor((Date.now()-g)/1e3),i._initTimestamp!==g&&(i.set("timestamp",g),"active"!=e&&i.set("sessionState","active",o))):g="expired";var d=i.get("autoExtend"),p=!1,_=!1,c=l>=r,h=l>=r-n,u=l>=a;for(var v in(h||u)&&("expired"==g&&(p=!0,d=!1,c=!0,h=!0),h&&"expired"!=e?d&&!c?(p=!1,c=!1,h=!1,u=!1,_=!1,i.extend()):(i.expire(),p=!0):!u||h||d||"warned"==e||(i.warn(),_=!0)),s)s[v](l,1e3,u,c,h,_,p)}),1e3)},_stopTimer(){e.clearInterval(this._intervalId)},destructor(){new e.EventHandle(this._eventHandlers).detach(),this._stopTimer()},expire(){this.set("sessionState","expired",o)},extend(){this.set("sessionState","active",o)},initializer(){var t=this;t._cookieKey="LFR_SESSION_STATE_"+themeDisplay.getUserId(),t._cookieOptions={path:"/",secure:e.UA.secure},t._registered={},t.set("timestamp"),t._initEvents(),t._startTimer()},registerInterval(i){var r,n=this._registered;return t.isFunction(i)&&(n[r=e.stamp(i)]=i),r},resetInterval(){this._stopTimer(),this._startTimer()},unregisterInterval(e){var t=this._registered;return Object.prototype.hasOwnProperty.call(t,e)&&delete t[e],e},warn(){this.set("sessionState","warned",o)}}});d.SRC=s;var p=e.Component.create({ATTRS:{openToast:{validator:t.isFunction},pageTitle:{value:n.title}},EXTENDS:e.Plugin.Base,NAME:"liferaysessiondisplay",NS:"display",prototype:{_afterDefActivatedFn(){this._uiSetActivated()},_afterDefExpiredFn(){var e=this;e._host.unregisterInterval(e._intervalId),e._uiSetExpired()},_beforeHostWarned(){var e=this,i=e._host,r=i.get("sessionLength"),n=i.get("timestamp"),a=i.get("warningLength"),s=r;t.toInt(n)&&(s=1e3*Math.floor((Date.now()-n)/1e3));var o=r-s;o>a&&(o=a),e._getBanner();const l=document.querySelector("#".concat(g," .countdown-timer"));e._uiSetRemainingTime(o,l),e._intervalId=i.registerInterval(((t,i,s,g,d)=>{s?g||(d&&o<=0&&(o=a),t=1e3*Math.floor((Date.now()-n)/1e3),o=r-t,e._uiSetRemainingTime(o,l)):e._uiSetActivated(),o-=i}))},_destroyBanner(){const e=document.getElementById(g),t=null==e?void 0:e.parentElement;Liferay.destroyComponent(g),t&&t.remove(),this._banner=!1},_formatNumber:e=>t.String.padNumber(Math.floor(e),2),_formatTime(e){var r=this;return e=Number(e),t.isNumber(e)&&e>0?(e/=1e3,i[0]=r._formatNumber(e/3600),e%=3600,i[1]=r._formatNumber(e/60),e%=60,i[2]=r._formatNumber(e),e=i.join(":")):e=0,e},_getBanner(){var e=this,t=e._banner;if(!t){var i=e.get("openToast"),r={onClick({event:t}){t.target.classList.contains("alert-link")&&e._host.extend()},renderData:{componentId:g},toastProps:{autoClose:!1,id:g,role:"alert"}};i(_objectSpread({message:e._warningText,type:"warning"},r)),t=_objectSpread({open(t){e._destroyBanner(),i(_objectSpread(_objectSpread({},t),r))}},Liferay.component(g)),e._banner=t}return t},_onHostSessionStateChange(e){"warned"==e.newVal&&this._beforeHostWarned(e)},_uiSetActivated(){var e=this;n.title=e.reset("pageTitle").get("pageTitle"),e._host.unregisterInterval(e._intervalId),e._banner&&e._destroyBanner()},_uiSetExpired(){var e=this;e._getBanner().open({message:e._expiredText,title:'Attenzione',type:"danger"}),n.title=e.get("pageTitle")},_uiSetRemainingTime(e,i){var r=this;if(e=r._formatTime(e),!r._alertClosed){var a=i.closest('div[role="alert"]');a&&(a.removeAttribute("role"),r._alert=a),i.innerHTML=e}n.title=t.sub('La\x20sessione\x20scadra\x20tra\x20\x7b0\x7d\x2e',[e])+" | "+r.get("pageTitle")},destructor(){this._banner&&this._destroyBanner()},initializer(){var e=this,i=e.get("host");Liferay.Util.getTop()==r.win?(e._host=i,e._toggleText={hide:'Nascondi',show:'Mostra'},e._expiredText='A\x20causa\x20di\x20inattività\x2c\x20la\x20sessione\x20è\x20scaduta\x2e\x20Prima\x20di\x20aggiornare\x20la\x20pagina\x20si\x20prega\x20di\x20salvare\x20tutti\x20i\x20dati\x20immessi\x2e',e._warningText='A\x20causa\x20di\x20inattività\x2c\x20la\x20sessione\x20scadrà\x20tra\x20\x7b0\x7d\x20minuti\x2e\x20Per\x20estendere\x20la\x20sessione\x20di\x20altri\x20\x7b1\x7d\x20minuto\x2fi\x2c\x20premere\x20il\x20tasto\x20\x3c\x2fem\x3eEstendi\x3cem\x3e\x2e\x20\x7b2\x7d',e._warningText=t.sub(e._warningText,['<span class="countdown-timer">{0}</span>',i.get("sessionLength")/6e4,'<a class="alert-link" href="javascript:;">'+'Estendi'+"</a>"]),i.on("sessionStateChange",e._onHostSessionStateChange,e),e.afterHostMethod("_defActivatedFn",e._afterDefActivatedFn),e.afterHostMethod("_defExpiredFn",e._afterDefExpiredFn)):i.unplug(e)}}});Liferay.SessionBase=d,Liferay.SessionDisplay=p}),"",{requires:["aui-base","aui-component","aui-timer","cookie","plugin"]});
//# sourceMappingURL=session.js.map
(function(A){var Util=Liferay.Util,Lang=A.Lang,AObject=A.Object,htmlEscapedValues=[],htmlUnescapedValues=[],MAP_HTML_CHARS_ESCAPED={'"':"&#034;","&":"&amp;","'":"&#039;","/":"&#047;","<":"&lt;",">":"&gt;","`":"&#096;"},MAP_HTML_CHARS_UNESCAPED={};AObject.each(MAP_HTML_CHARS_ESCAPED,((e,t)=>{MAP_HTML_CHARS_UNESCAPED[e]=t,htmlEscapedValues.push(e),htmlUnescapedValues.push(t)}));var REGEX_DASH=/-([a-z])/gi,STR_RIGHT_SQUARE_BRACKET="]";Util.actsAsAspect=function(object){object.yield=null,object.rv={},object.before=function(method,f){var original=eval("this."+method);this[method]=function(){return f.apply(this,arguments),original.apply(this,arguments)}},object.after=function(method,f){var original=eval("this."+method);this[method]=function(){return this.rv[method]=original.apply(this,arguments),f.apply(this,arguments)}},object.around=function(method,f){var original=eval("this."+method);this[method]=function(){return this.yield=original,f.apply(this,arguments)}}},Util.addInputFocus=function(){A.use("aui-base",(e=>{var t=function(e){var t=e.target,a=t.get("tagName");a&&(a=a.toLowerCase());var i=t.get("type");if("input"==a&&/text|password/.test(i)||"textarea"==a){var n="addClass";/blur|focusout/.test(e.type)&&(n="removeClass"),t[n]("focus")}};e.on("focus",t,document),e.on("blur",t,document)})),Util.addInputFocus=function(){}},Util.addInputType=function(e){return Util.addInputType=Lang.emptyFn,Util.addInputType(e)},Util.camelize=function(e,t){var a=REGEX_DASH;return t&&(a=new RegExp(t+"([a-z])","gi")),e=e.replace(a,((e,t)=>t.toUpperCase()))},Util.clamp=function(e,t,a){return Math.min(Math.max(e,t),a)},Util.isEditorPresent=function(e){return Liferay.EDITORS&&Liferay.EDITORS[e]},Util.randomMinMax=function(e,t){return Math.round(Math.random()*(t-e))+e},Util.selectAndCopy=function(e){(e.focus(),e.select(),document.all)&&e.createTextRange().execCommand("copy")},Util.setBox=function(e,t){for(var a=e.length-1;a>-1;a--)e.options[a]=null;for(a=0;a<t.length;a++)e.options[a]=new Option(t[a].value,a);e.options[0].selected=!0},Util.startsWith=function(e,t){return 0===e.indexOf(t)},Util.textareaTabs=function(e){var t=e.currentTarget.getDOM();if(e.isKey("TAB")){e.halt();var a=t.scrollTop;if(t.setSelectionRange){var i=t.selectionStart+1,n=t.value;t.value=n.substring(0,t.selectionStart)+"\t"+n.substring(t.selectionEnd,n.length),setTimeout((()=>{t.focus(),t.setSelectionRange(i,i)}),0)}else document.selection.createRange().text="\t";return t.scrollTop=a,!1}},Util.uncamelize=function(e,t){return t=t||" ",e=(e=e.replace(/([a-zA-Z][a-zA-Z])([A-Z])([a-z])/g,"$1"+t+"$2$3")).replace(/([a-z])([A-Z])/g,"$1"+t+"$2")},Liferay.provide(Util,"check",((e,t,a)=>{var i=A.one(e[t]);i&&i.attr("checked",a)}),["aui-base"]),Liferay.provide(Util,"disableSelectBoxes",((e,t,a)=>{var i=A.one("#"+a),n=A.one("#"+e);if(i&&n){var r=Lang.isFunction(t),o=function(){var e=i.val(),a=t==e;r&&(a=t(e,t)),n.attr("disabled",!a)};o(),i.on("change",o)}}),["aui-base"]),Liferay.provide(Util,"disableTextareaTabs",(e=>{(e=A.one(e))&&"enabled"!=e.attr("textareatabs")&&(e.attr("textareatabs","disabled"),e.detach("keydown",Util.textareaTabs))}),["aui-base"]),Liferay.provide(Util,"enableTextareaTabs",(e=>{(e=A.one(e))&&"enabled"!=e.attr("textareatabs")&&(e.attr("textareatabs","disabled"),e.on("keydown",Util.textareaTabs))}),["aui-base"]),Liferay.provide(Util,"removeItem",((e,t)=>{var a=(e=A.one(e)).get("selectedIndex");t?e.all("option[value="+t+STR_RIGHT_SQUARE_BRACKET).item(a).remove(!0):e.all("option").item(a).remove(!0)}),["aui-base"]),Liferay.provide(Util,"resizeTextarea",((e,t)=>{var a=A.one("#"+e);if(a||(a=A.one("textarea[name="+e+STR_RIGHT_SQUARE_BRACKET)),a){var i,n=A.getBody(),r=function(r){var o=n.get("winHeight");if(t)try{"iframe"!=a.get("nodeName").toLowerCase()&&(a=window[e])}catch(e){}if(!i){var l=n.one(".button-holder"),s=n.one(".lfr-template-editor");if(l&&s){var u=s.getXY();i=l.outerHeight(!0)+u[1]+25}else i=170}a=A.one(a);var c={width:"98%"};r&&(c.height=o-i),!t||a&&A.DOM.inDoc(a)?a&&a.setStyles(c):A.on("available",(()=>{(a=A.one(window[e]))&&a.setStyles(c)}),"#"+e+"_cp")};r();var o=Liferay.Util.getWindow();if(o){var l=o.iframe.after("resizeiframe:heightChange",r);A.getWin().on("unload",l.detach,l)}}}),["aui-base"]),Liferay.provide(Util,"setSelectedValue",((e,t)=>{var a=A.one(e).one("option[value="+t+STR_RIGHT_SQUARE_BRACKET);a&&a.attr("selected",!0)}),["aui-base"]),Liferay.provide(Util,"switchEditor",(e=>{var t=e.uri,a=Liferay.Util.getWindowName(),i=Liferay.Util.getWindow(a);i&&i.iframe.set("uri",t)}),["aui-io"])})(AUI());
//# sourceMappingURL=deprecated.js.map
!function(){var s={_scheduledTasks:[],_taskStates:[],addTask(s){this._scheduledTasks.push(s)},addTaskState(s){this._taskStates.push(s)},reset(){this._taskStates.length=0,this._scheduledTasks.length=0},runTasks(s){for(var t=this._scheduledTasks,a=this._taskStates,e=t.length,h=a.length,d=0;d<e;d++)for(var k=t[d],n=k.params,i=0;i<h;i++){var r=a[i];k.condition(r,n,s)&&k.action(r,n,s)}}};Liferay.DOMTaskRunner=s}();
//# sourceMappingURL=dom_task_runner.js.map
!function(e){var t={},a=Liferay.Util;e.use("attribute","oop",(e=>{e.augment(Liferay,e.Attribute,!0)})),Liferay.provide(Liferay,"delegateClick",((a,i)=>{var r=e.config.doc.getElementById(a);if(r&&r.id==a){var l=e.one(r).addClass("lfr-delegate-click").guid();t[l]=i,Liferay._baseDelegateHandle||(Liferay._baseDelegateHandle=e.getBody().delegate("click",Liferay._baseDelegate,".lfr-delegate-click"))}}),["aui-base"]),Liferay._baseDelegate=function(e){var a=e.currentTarget.attr("id"),i=t[a];i&&i.apply(this,arguments)},Liferay._CLICK_EVENTS=t,Liferay.provide(window,"submitForm",((t,i,r,l)=>{a._submitLocked||(t.jquery&&(t=t[0]),Liferay.fire("submitForm",{action:i,form:e.one(t),singleSubmit:r,validate:!1!==l}))}),["aui-base","aui-form-validator","aui-url","liferay-form"]),Liferay.publish("submitForm",{defaultFn(t){var i=t.form,r=!1;if(t.validate){var l=Liferay.Form.get(i.attr("id"));if(l){var o=l.formValidator;e.instanceOf(o,e.FormValidator)&&(o.validate(),(r=o.hasErrors())&&o.focusInvalidField())}}if(!r){var n,d,f=t.action||i.getAttribute("action"),u=t.singleSubmit,s=i.all("button[type=submit], input[type=button], input[type=image], input[type=reset], input[type=submit]");a.disableFormButtons(s,i),a._submitLocked=!1!==u||e.later(1e3,a,a.enableFormButtons,[s,i]);var m=f.indexOf("?");-1===m?(n=f,d=""):(n=f.slice(0,m),d=f.slice(m+1));var y=new URLSearchParams(d),g=y.get("p_auth")||"";g.includes("#")&&(g=g.substring(0,g.indexOf("#"))),g&&(i.append('<input name="p_auth" type="hidden" value="'+g+'" />'),y.delete("p_auth"),f=n+"?"+y.toString()),i.attr("action",f),a.submitForm(i),i.attr("target",""),a._submitLocked=null}}}),Liferay.after("closeWindow",(e=>{var t=e.id,i=a.getTop().Liferay.Util.Window.getById(t);if(i&&i.iframe){var r=i.iframe.node.get("contentWindow").getDOM().Liferay.Util.getOpener(),l=e.redirect;if(l)r.Liferay.Util.navigate(l);else{var o,n=e.refresh;if(n&&r)e.portletAjaxable||(o={portletAjaxable:!1}),r.Liferay.Portlet.refresh("#p_p_id_"+n+"_",o)}i.hide()}}))}(AUI());
//# sourceMappingURL=events.js.map
Liferay.lazyLoad=function(){var r,n,e,f=function(r){return"function"==typeof r};if(Array.isArray(arguments[0]))n=arguments[0],e=f(arguments[1])?arguments[1]:null,r=f(arguments[2])?arguments[2]:null;else{n=[];for(var i=0;i<arguments.length;++i)if("string"==typeof arguments[i])n[i]=arguments[i];else if(f(arguments[i])){e=arguments[i],r=f(arguments[++i])?arguments[i]:null;break}}return function(){for(var f=[],i=0;i<arguments.length;++i)f.push(arguments[i]);Liferay.Loader.require(n,(function(){for(var r=0;r<arguments.length;++r)f.splice(r,0,arguments[r]);e.apply(e,f)}),r)}};
//# sourceMappingURL=lazy_load.js.map
Liferay=window.Liferay||{},function(){var t=function(t){return"function"==typeof t},e=function(t){return t&&(t._node||t.jquery||t.nodeType)},r=/^get$/i;Liferay.namespace=function(t,e){void 0===e&&(e=t,t=this);for(var r,o=e.split(".");o.length&&(r=o.shift());)t=t[r]&&t[r]!==Object.prototype[r]?t[r]:t[r]={};return t};var o=function t(){var e=t.parseInvokeArgs(Array.prototype.slice.call(arguments,0));return t.invoke.apply(t,e)};function n(t){return function(){var e=Array.prototype.slice.call(arguments,0),r={method:t};return e.push(r),o.apply(o,e)}}o.URL_INVOKE=themeDisplay.getPathContext()+"/api/jsonws/invoke",o.bind=function(){var t=Array.prototype.slice.call(arguments,0);return function(){var e=Array.prototype.slice.call(arguments,0);return o.apply(o,t.concat(e))}},o.parseInvokeArgs=function(t){var e=this,r=t[0],o=e.parseIOConfig(t);if("string"==typeof r){r=e.parseStringPayload(t),e.parseIOFormConfig(o,t);var n=t[t.length-1];"object"==typeof n&&n.method&&(o.method=n.method)}return[r,o]},o.parseIOConfig=function(e){var o=e[0],n=o.io||{};if(delete o.io,!n.success){var a=e.filter(t),i=a[1],p=a[0];i||(i=p),n.error=i,n.complete=function(t){if(null===t||Object.prototype.hasOwnProperty.call(t,"exception")){if(i){var e=t?t.exception:"The server returned an empty response";i.call(this,e,t)}}else p&&p.call(this,t)}}return!Object.prototype.hasOwnProperty.call(n,"cache")&&r.test(n.type)&&(n.cache=!1),n},o.parseIOFormConfig=function(t,r){var o=r[1];e(o)&&("multipart/form-data"==o.enctype&&(t.contentType="multipart/form-data"),t.formData=new FormData(o))},o.parseStringPayload=function(r){var o={},n={},a=r[1];return t(a)||e(a)||(o=a),n[r[0]]=o,n},o.invoke=function(t,e){var r=JSON.stringify(t),o=r;return e.formData&&(e.formData.append("cmd",r),o=e.formData),Liferay.Util.fetch(this.URL_INVOKE,{body:o,headers:{contentType:e.contentType},method:"POST"}).then((t=>t.json())).then(e.complete).catch(e.error)},o.get=n("get"),o.del=n("delete"),o.post=n("post"),o.put=n("put"),o.update=n("update"),Liferay.Service=o,Liferay.Template={PORTLET:'<div class="portlet"><div class="portlet-topper"><div class="portlet-title"></div></div><div class="portlet-content"></div><div class="forbidden-action"></div></div>'}}();
//# sourceMappingURL=liferay.js.map
!function(e,t){for(var r in t)e[r]=t[r];t.__esModule&&Object.defineProperty(e,"__esModule",{value:!0})}(window,(()=>{var e={8686:(e,t,r)=>{var n,o=/[&<>"'`]/g,i=RegExp(o.source),a="object"==typeof r.g&&r.g&&r.g.Object===Object&&r.g,s="object"==typeof self&&self&&self.Object===Object&&self,c=a||s||Function("return this")(),l=(n={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","`":"&#96;"},function(e){return null==n?void 0:n[e]}),u=Object.prototype.toString,f=c.Symbol,d=f?f.prototype:void 0,p=d?d.toString:void 0;e.exports=function(e){var t;return(e=null==(t=e)?"":function(e){if("string"==typeof e)return e;if(function(e){return"symbol"==typeof e||function(e){return!!e&&"object"==typeof e}(e)&&"[object Symbol]"==u.call(e)}(e))return p?p.call(e):"";var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}(t))&&i.test(e)?e.replace(o,l):e}},1991:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var n,o=(n=r(1521))&&n.__esModule?n:{default:n};function i(e,t){let r=e.indexOf('">');const n=e.substring(r);r=t.indexOf('">');const o=t.substring(r);return n<o?-1:n>o?1:0}function a(e,t,r){const n=e[t],a=document.getElementById(n.select);if(!a)return;const s=function(e){return!!Array.isArray(e)||!(!e||"object"!=typeof e||"number"!=typeof e.length||e.tagName||e.scrollTo||e.document)}(l=n.selectVal)?Array.from(l):[l],c=[];var l;for(!1!==n.selectNullable&&c.push('<option selected value="0"></option>'),r.forEach((e=>{const t=Liferay.Util.escapeHTML(e[n.selectId]),r=Liferay.Util.escapeHTML(e[n.selectDesc]);let o="";s.indexOf(t)>-1&&(o='selected="selected"'),c.push("<option ".concat(o,' value="').concat(t,'">').concat(r,"</option>"))})),n.selectSort&&c.sort(i);a.lastChild;)a.removeChild(a.lastChild);a.innerHTML=c.join(""),n.selectDisableOnEmpty&&(0,o.default)(a,!r.length)}t.default=class{constructor(e){!function(e){e.forEach(((t,r)=>{const n=t.select,o=document.getElementById(n),i=t.selectData;if(o){let t;o.setAttribute("data-componentType","dynamic_select"),r>0&&(t=e[r-1].selectVal),i((t=>{a(e,r,t)}),t),o.getAttribute("name")||o.setAttribute("name",n),o.addEventListener("change",(()=>{!function(e,t){if(t+1<e.length){const r=document.getElementById(e[t].select);(0,e[t+1].selectData)((r=>{a(e,t+1,r)}),r&&r.value)}}(e,r)}))}}))}(e)}}},3337:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0,t.default={PHONE:768,TABLET:980}},2801:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.initComponentCache=t.getComponentCache=t.destroyUnfulfilledPromises=t.destroyComponents=t.destroyComponent=t.componentReady=t.component=void 0;const r={};let n={};const o={};let i={};const a={},s=["p_p_id","p_p_lifecycle"],c=["ddmStructureKey","fileEntryTypeId","folderId","navigation","status"],l="liferay.component",u=function(e){let t;if(e)t={promise:Promise.resolve(e),resolve(){}};else{let e;t={promise:new Promise((t=>{e=t})),resolve:e}}return t},f=function(e,t,r){const n=e.data;Object.keys(n).forEach((e=>{const t=r.querySelector("#".concat(e));t&&(t.innerHTML=n[e].html)}))},d=function(e){const t=new URL(window.location.href),n=new URL(e.path,window.location.href);if(s.every((e=>n.searchParams.get(e)===t.searchParams.get(e)))){var a=Object.keys(o);a=a.filter((e=>{const i=o[e];if(!i)return!1;const a=r[e],s=c.every((e=>{let r=!1;if(a){const o="_".concat(a.portletId,"_").concat(e);r=n.searchParams.get(o)===t.searchParams.get(o)}return r}));return"function"==typeof i.isCacheable&&i.isCacheable(n)&&s&&a&&a.cacheState&&i.element&&i.getState})),i=a.reduce(((e,t)=>{const n=o[t],i=r[t],a=n.getState(),s=i.cacheState.reduce(((e,t)=>(e[t]=a[t],e)),{});return e[t]={html:n.element.innerHTML,state:s},e}),[]),Liferay.DOMTaskRunner.addTask({action:f,condition:e=>e.owner===l}),Liferay.DOMTaskRunner.addTaskState({data:i,owner:l})}else i={}},p=function(e,t,i){let s;if(1===arguments.length){let t=o[e];t&&"function"==typeof t&&(a[e]=t,t=t(),o[e]=t),s=t}else if(o[e]&&null!==t&&(delete r[e],delete n[e],console.warn('Component with id "'+e+'" is being registered twice. This can lead to unexpected behaviour in the "Liferay.component" and "Liferay.componentReady" APIs, as well as in the "*:registered" events.')),s=o[e]=t,null===t)delete r[e],delete n[e];else{r[e]=i,Liferay.fire(e+":registered");const o=n[e];o?o.resolve(t):n[e]=u(t)}return s};t.component=p,t.componentReady=function e(){let t,r;if(1===arguments.length)t=arguments[0];else{t=[];for(var o=0;o<arguments.length;o++)t[o]=arguments[o]}if(Array.isArray(t))r=Promise.all(t.map((t=>e(t))));else{let e=n[t];e||(n[t]=e=u()),r=e.promise}return r};const h=function(e){const t=o[e];if(t){const i=t.destroy||t.dispose;i&&i.call(t),delete r[e],delete n[e],delete a[e],delete o[e]}};t.destroyComponent=h,t.destroyComponents=function(e){var t=Object.keys(o);e&&(t=t.filter((t=>e(o[t],r[t]||{})))),t.forEach(h)},t.destroyUnfulfilledPromises=function(){n={}},t.getComponentCache=function(e){const t=i[e];return t?t.state:{}},t.initComponentCache=function(){Liferay.on("startNavigate",d)};var y=p;t.default=y},5894:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0,t.default=class{constructor(){this._disposed=!1}dispose(){this._disposed||(this.disposeInternal(),this._disposed=!0)}disposeInternal(){}isDisposed(){return this._disposed}}},6454:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var n=i(r(5894)),o=i(r(2045));function i(e){return e&&e.__esModule?e:{default:e}}const a=[0];class s extends n.default{constructor(){super(),this._events=null,this._listenerHandlers=null,this._shouldUseFacade=!1}_addHandler(e,t){return e?(Array.isArray(e)||(e=[e]),e.push(t)):e=t,e}addListener(e,t,r){this._validateListener(t);const n=this._toEventsArray(e);for(let e=0;e<n.length;e++)this._addSingleListener(n[e],t,r);return new o.default(this,e,t)}_addSingleListener(e,t,r,n){this._runListenerHandlers(e),(r||n)&&(t={default:r,fn:t,origin:n}),this._events=this._events||{},this._events[e]=this._addHandler(this._events[e],t)}_buildFacade(e){if(this.getShouldUseFacade()){const t={preventDefault(){t.preventedDefault=!0},target:this,type:e};return t}}disposeInternal(){this._events=null}emit(e){const t=this._getRawListeners(e);if(0===t.length)return!1;const r=Array.prototype.slice.call(arguments,1);return this._runListeners(t,r,this._buildFacade(e)),!0}_getRawListeners(e){return c(this._events&&this._events[e]).concat(c(this._events&&this._events["*"]))}getShouldUseFacade(){return this._shouldUseFacade}listeners(e){return this._getRawListeners(e).map((e=>e.fn?e.fn:e))}many(e,t,r){const n=this._toEventsArray(e);for(let e=0;e<n.length;e++)this._many(n[e],t,r);return new o.default(this,e,r)}_many(e,t,r){const n=this;t<=0||n._addSingleListener(e,(function o(){0==--t&&n.removeListener(e,o),r.apply(n,arguments)}),!1,r)}_matchesListener(e,t){return(e.fn||e)===t||e.origin&&e.origin===t}off(e,t){if(this._validateListener(t),!this._events)return this;const r=this._toEventsArray(e);for(let e=0;e<r.length;e++)this._events[r[e]]=this._removeMatchingListenerObjs(c(this._events[r[e]]),t);return this}on(){return this.addListener.apply(this,arguments)}onListener(e){this._listenerHandlers=this._addHandler(this._listenerHandlers,e)}once(e,t){return this.many(e,1,t)}removeAllListeners(e){if(this._events)if(e){const t=this._toEventsArray(e);for(let e=0;e<t.length;e++)this._events[t[e]]=null}else this._events=null;return this}_removeMatchingListenerObjs(e,t){const r=[];for(let n=0;n<e.length;n++)this._matchesListener(e[n],t)||r.push(e[n]);return r.length>0?r:null}removeListener(){return this.off.apply(this,arguments)}_runListenerHandlers(e){let t=this._listenerHandlers;if(t){t=c(t);for(let r=0;r<t.length;r++)t[r](e)}}_runListeners(e,t,r){r&&t.push(r);const n=[];for(let r=0;r<e.length;r++){const o=e[r].fn||e[r];e[r].default?n.push(o):o.apply(this,t)}if(!r||!r.preventedDefault)for(let e=0;e<n.length;e++)n[e].apply(this,t)}setShouldUseFacade(e){return this._shouldUseFacade=e,this}_toEventsArray(e){return"string"==typeof e&&(a[0]=e,e=a),e}_validateListener(e){if("function"!=typeof e)throw new TypeError("Listener must be a function")}}function c(e){return e=e||[],Array.isArray(e)?e:[e]}var l=s;t.default=l},2045:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var n,o=(n=r(5894))&&n.__esModule?n:{default:n};class i extends o.default{constructor(e,t,r){super(),this._emitter=e,this._event=t,this._listener=r}disposeInternal(){this.removeListener(),this._emitter=null,this._listener=null}removeListener(){this._emitter.isDisposed()||this._emitter.removeListener(this._event,this._listener)}}var a=i;t.default=a},2698:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"portlet",{enumerable:!0,get:function(){return p.default}});var n=G(r(8686)),o=G(r(1593)),i=G(r(8652)),a=G(r(1093)),s=G(r(1991)),c=G(r(3337)),l=r(2801),u=r(34),f=r(9356),d=r(1425),p=function(e){if(e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var t=V();if(t&&t.has(e))return t.get(e);var r={},n=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if(Object.prototype.hasOwnProperty.call(e,o)){var i=n?Object.getOwnPropertyDescriptor(e,o):null;i&&(i.get||i.set)?Object.defineProperty(r,o,i):r[o]=e[o]}return r.default=e,t&&t.set(e,r),r}(r(5659)),h=G(r(7370)),y=G(r(9296)),_=G(r(3873)),g=G(r(9094)),v=G(r(6549)),m=G(r(85)),b=G(r(8002)),w=G(r(7494)),O=G(r(7535)),j=G(r(5273)),P=G(r(8206)),S=G(r(7019)),L=G(r(7068)),E=G(r(4968)),T=G(r(8999)),M=G(r(1166)),A=G(r(6797)),I=r(7387),U=G(r(6515)),C=G(r(5506)),R=G(r(7442)),D=G(r(386)),x=G(r(1625)),k=G(r(4294)),F=G(r(1357)),N=G(r(1146)),H=G(r(4821)),q=G(r(6535)),z=G(r(576)),W=r(3833),B=G(r(7639)),$=G(r(1521));function V(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return V=function(){return e},e}function G(e){return e&&e.__esModule?e:{default:e}}Liferay=window.Liferay||{},Liferay.BREAKPOINTS=c.default,Liferay.component=l.component,Liferay.componentReady=l.componentReady,Liferay.destroyComponent=l.destroyComponent,Liferay.destroyComponents=l.destroyComponents,Liferay.destroyUnfulfilledPromises=l.destroyUnfulfilledPromises,Liferay.getComponentCache=l.getComponentCache,Liferay.initComponentCache=l.initComponentCache,Liferay.Address={getCountries:_.default,getRegions:g.default},Liferay.DynamicSelect=s.default,Liferay.LayoutExporter={all:u.hideLayoutPane,details:u.toggleLayoutDetails,icons:(0,u.getLayoutIcons)(),proposeLayout:u.proposeLayout,publishToLive:u.publishToLive,selected:u.showLayoutPane},Liferay.Portal={Tabs:{show:f.showTab},ToolTip:{show:d.showTooltip}},Liferay.Portlet=Liferay.Portlet||{},Liferay.Portlet.minimize=p.minimizePortlet,Liferay.Portlet.openModal=(...e)=>{Liferay.Loader.require("frontend-js-web/liferay/modal/Modal",(t=>{t.openPortletModal(...e)}))},Liferay.Portlet.openWindow=(...e)=>{Liferay.Loader.require("frontend-js-web/liferay/modal/Modal",(t=>{t.openPortletWindow(...e)}))},Liferay.SideNavigation=h.default,Liferay.Util=Liferay.Util||{},Liferay.Util.MAP_HTML_CHARS_ESCAPED=I.MAP_HTML_CHARS_ESCAPED,Liferay.Util.addParams=y.default,Liferay.Util.disableEsc=()=>{document.all&&27===window.event.keyCode&&(window.event.returnValue=!1)},Liferay.Util.escape=n.default,Liferay.Util.escapeHTML=I.escapeHTML,Liferay.Util.fetch=v.default,Liferay.Util.focusFormField=m.default,Liferay.Util.formatStorage=P.default,Liferay.Util.formatXML=S.default,Liferay.Util.getCropRegion=L.default,Liferay.Util.getDOM=E.default,Liferay.Util.getElement=T.default,Liferay.Util.getFormElement=b.default,Liferay.Util.getPortletId=M.default,Liferay.Util.getPortletNamespace=A.default,Liferay.Util.groupBy=o.default,Liferay.Util.inBrowserView=U.default,Liferay.Util.isEqual=i.default,Liferay.Util.isPhone=C.default,Liferay.Util.isTablet=R.default,Liferay.Util.navigate=D.default,Liferay.Util.ns=k.default,Liferay.Util.objectToFormData=w.default,Liferay.Util.objectToURLSearchParams=F.default,Liferay.Util.normalizeFriendlyURL=x.default,Liferay.Util.PortletURL={createActionURL:N.default,createPortletURL:H.default,createRenderURL:q.default,createResourceURL:z.default},Liferay.Util.postForm=O.default,Liferay.Util.setFormValues=j.default,Liferay.Util.toCharCode=B.default,Liferay.Util.toggleDisabled=$.default,Liferay.Util.openModal=(...e)=>{Liferay.Loader.require("frontend-js-web/liferay/modal/Modal",(t=>{t.openModal(...e)}))},Liferay.Util.openSelectionModal=(...e)=>{Liferay.Loader.require("frontend-js-web/liferay/modal/Modal",(t=>{t.openSelectionModal(...e)}))},Liferay.Util.openToast=(...e)=>{Liferay.Loader.require("frontend-js-web/liferay/toast/commands/OpenToast.es",(t=>{t.openToast(...e)}))},Liferay.Util.Session={get:W.getSessionValue,set:W.setSessionValue},Liferay.Util.unescape=a.default,Liferay.Util.unescapeHTML=I.unescapeHTML},34:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.hideLayoutPane=function(e){var t=(e=e||{}).obj,r=e.pane;t&&t.checked&&(r=document.querySelector(r))&&r.classList.add("hide")},t.getLayoutIcons=function(){return{minus:themeDisplay.getPathThemeImages()+"/arrows/01_minus.png",plus:themeDisplay.getPathThemeImages()+"/arrows/01_plus.png"}},t.proposeLayout=function(e){var t=(e=e||{}).namespace,r=e.reviewers,n='<div><form action="'+e.url+'" method="post">';if(r.length>0){n+='<textarea name="'+t+'description" style="height: 100px; width: 284px;"></textarea><br /><br />'+'Revisore'+' <select name="'+t+'reviewUserId">';for(var o=0;o<r.length;o++)n+='<option value="'+r[o].userId+'">'+r[o].fullName+"</option>";n+='</select><br /><br /><input type="submit" value="'+'Procedi'+'" />'}else n+='Nessun\x20revisore\x20è\x20stato\x20trovato\x2e'+"<br />"+'Contatta\x20il\x20coordinatore\x20per\x20assegnare\x20i\x20revisori\x2e'+"<br /><br />";n+="</form></div>",Liferay.Util.openWindow({dialog:{destroyOnHide:!0},title:n})},t.publishToLive=function(e){e=e||{},Liferay.Util.openWindow({dialog:{constrain:!0,modal:!0,on:{visibleChange(e){e.newVal||this.destroy()}}},title:e.title,uri:e.url})},t.showLayoutPane=function(e){var t=(e=e||{}).obj,r=e.pane;t&&t.checked&&(r=document.querySelector(r))&&r.classList.remove("hide")},t.toggleLayoutDetails=function(e){e=e||{};var t=document.querySelector(e.detail),r=document.querySelector(e.toggle);if(t&&r){var n=themeDisplay.getPathThemeImages()+"/arrows/01_plus.png";t.classList.contains("hide")?(t.classList.remove("hide"),n=themeDisplay.getPathThemeImages()+"/arrows/01_minus.png"):t.classList.add("hide"),r.setAttribute("src",n)}}},9356:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.showTab=function(e,t,r,n){const s=e+(0,o.default)(r),c=document.getElementById(s+"TabsId"),l=document.getElementById(s+"TabsSection");if(c&&l){const o={id:r,names:t,namespace:e,selectedTab:c,selectedTabSection:l};n&&"function"==typeof n&&n.call(this,e,t,r,o);try{Liferay.on(i,a),Liferay.fire(i,o)}finally{Liferay.detach(i,a)}}},t.applyTabSelectionDOMChanges=a;var n,o=(n=r(7639))&&n.__esModule?n:{default:n};const i="showTab";function a({id:e,names:t,namespace:r,selectedTab:n,selectedTabSection:i}){const a=n.querySelector("a");if(n&&a){const e=n.parentElement.querySelector(".active");e&&e.classList.remove("active"),a.classList.add("active")}i&&i.classList.remove("hide");const s=document.getElementById(r+"dropdownTitle");let c;s&&a&&(s.innerHTML=a.textContent),t.splice(t.indexOf(e),1);for(var l=0;l<t.length;l++)c=document.getElementById(r+(0,o.default)(t[l])+"TabsSection"),c&&c.classList.add("hide")}},1425:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.showTooltip=function(e,t){e.setAttribute("title",t),e.classList.add("lfr-portal-tooltip")}},7212:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.PortletInit=void 0;var n=l(r(8633)),o=l(r(6549)),i=l(r(889)),a=l(r(1842)),s=l(r(7737)),c=r(6134);function l(e){return e&&e.__esModule?e:{default:e}}function u(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function f(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const d=window.history&&window.history.pushState;let p=!1;const h={},y=[];let _;class g{constructor(e){this._portletId=e,this.constants=function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?u(Object(r),!0).forEach((function(t){f(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):u(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}({},s.default),_||(_=r.g.portlet.data.pageRenderState,this._updateHistory(!0)),this.portletModes=_.portlets[this._portletId].allowedPM.slice(0),this.windowStates=_.portlets[this._portletId].allowedWS.slice(0)}_executeAction(e,t){return new Promise(((r,n)=>{(0,c.getUrl)(_,"ACTION",this._portletId,e).then((e=>{const i=(0,c.generateActionUrl)(this._portletId,e,t);(0,o.default)(i.url,i).then((e=>e.text())).then((e=>{const t=this._updatePageStateFromString(e,this._portletId);r(t)})).catch((e=>{n(e)}))}))}))}_hasListener(e){return Object.keys(h).map((e=>h[e].id)).includes(e)}_reportError(e,t){Object.keys(h).map((r=>{const n=h[r];return n.id===e&&"portlet.onError"===n.type&&setTimeout((()=>{n.handler("portlet.onError",t)})),!1}))}_setPageState(e,t){if("string"!=typeof t)throw new TypeError("Invalid update string: ".concat(t));this._updatePageState(t,e).then((e=>{this._updatePortletStates(e)}),(t=>{p=!1,this._reportError(e,t)}))}_setState(e){const t=(0,c.getUpdatedPublicRenderParameters)(_,this._portletId,e),r=[];Object.keys(t).forEach((e=>{const n=t[e],o=_.prpMap[e];Object.keys(o).forEach((e=>{if(e!==this._portletId){const t=o[e].split("|"),i=t[0],a=t[1];void 0===n?delete _.portlets[i].state.parameters[a]:_.portlets[i].state.parameters[a]=[...n],r.push(i)}}))}));const n=this._portletId;return _.portlets[n].state=e,r.push(n),r.forEach((e=>{_.portlets[e].renderData.content=null})),this._updateHistory(),Promise.resolve(r)}_setupAction(e,t){if(this.isInProgress())throw{message:"Operation is already in progress",name:"AccessDeniedException"};if(!this._hasListener(this._portletId))throw{message:"No onStateChange listener registered for portlet: ".concat(this._portletId),name:"NotInitializedException"};return p=!0,this._executeAction(e,t).then((e=>this._updatePortletStates(e).then((e=>(p=!1,e)))),(e=>{p=!1,this._reportError(this._portletId,e)}))}_updateHistory(e){d&&(0,c.getUrl)(_,"RENDER",null,{}).then((t=>{const r=JSON.stringify(_);if(e)history.replaceState(r,"");else try{history.pushState(r,"",t)}catch(e){}}))}_updatePageState(e){return new Promise(((t,r)=>{try{t(this._updatePageStateFromString(e,this._portletId))}catch(e){r(new Error("Partial Action decode status: ".concat(e.message)))}}))}_updatePageStateFromString(e,t){const r=(0,c.decodeUpdateString)(_,e),n=[];let o=!1;return Object.entries(r).forEach((([e,t])=>{_.portlets[e]=t,n.push(e),o=!0})),o&&t&&this._updateHistory(),n}_updatePortletStates(e){return new Promise((t=>{0===e.length?p=!1:e.forEach((e=>{this._updateStateForPortlet(e)})),t(e)}))}_updateState(e){if(p)throw{message:"Operation in progress",name:"AccessDeniedException"};if(!this._hasListener(this._portletId))throw{message:"No onStateChange listener registered for portlet: ".concat(this._portletId),name:"NotInitializedException"};p=!0,this._setState(e).then((e=>{this._updatePortletStates(e)})).catch((e=>{p=!1,this._reportError(this._portletId,e)}))}_updateStateForPortlet(e){const t=y.map((e=>e.handle));Object.entries(h).forEach((([r,n])=>{"portlet.onStateChange"===n.type&&(n.id!==e||t.includes(r)||y.push(n))})),y.length>0&&setTimeout((()=>{for(p=!0;y.length>0;){const e=y.shift(),t=e.handler,r=e.id;if(!_.portlets[r])continue;const n=_.portlets[r].renderData,o=new a.default(_.portlets[r].state);n&&n.content?t("portlet.onStateChange",o,n):t("portlet.onStateChange",o)}p=!1}))}action(...e){let t=null,r=0,n=null;return e.forEach((e=>{if(e instanceof HTMLFormElement){if(null!==n)throw new TypeError("Too many [object HTMLFormElement] arguments: ".concat(e,", ").concat(n));n=e}else if((0,i.default)(e)){if((0,c.validateParameters)(e),null!==t)throw new TypeError("Too many parameters arguments");t=e}else if(void 0!==e){const t=Object.prototype.toString.call(e);throw new TypeError("Invalid argument type. Argument ".concat(r+1," is of type ").concat(t))}r++})),n&&(0,c.validateForm)(n),this._setupAction(t,n).then((e=>{Promise.resolve(e)})).catch((e=>{Promise.reject(e)}))}addEventListener(e,t){if(arguments.length>2)throw new TypeError("Too many arguments passed to addEventListener");if("string"!=typeof e||"function"!=typeof t)throw new TypeError("Invalid arguments passed to addEventListener");const r=this._portletId;if(e.startsWith("portlet.")&&"portlet.onStateChange"!==e&&"portlet.onError"!==e)throw new TypeError("The system event type is invalid: ".concat(e));const o=(0,n.default)(),i={handle:o,handler:t,id:r,type:e};return h[o]=i,"portlet.onStateChange"===e&&this._updateStateForPortlet(this._portletId),o}createResourceUrl(e,t,r){if(arguments.length>3)throw new TypeError("Too many arguments. 3 arguments are allowed.");if(e){if(!(0,i.default)(e))throw new TypeError("Invalid argument type. Resource parameters must be a parameters object.");(0,c.validateParameters)(e)}let n=null;if(t){if("string"!=typeof t)throw new TypeError("Invalid argument type. Cacheability argument must be a string.");if("cacheLevelPage"!==t&&"cacheLevelPortlet"!==t&&"cacheLevelFull"!==t)throw new TypeError("Invalid cacheability argument: ".concat(t));n=t}if(n||(n="cacheLevelPage"),r&&"string"!=typeof r)throw new TypeError("Invalid argument type. Resource ID argument must be a string.");return(0,c.getUrl)(_,"RESOURCE",this._portletId,e,n,r)}dispatchClientEvent(e,t){if((0,c.validateArguments)(arguments,2,2,["string"]),e.match(new RegExp("^portlet[.].*")))throw new TypeError("The event type is invalid: "+e);return Object.keys(h).reduce(((r,n)=>{const o=h[n];return e.match(o.type)&&(o.handler(e,t),r++),r}),0)}isInProgress(){return p}newParameters(e={}){const t={};return Object.keys(e).forEach((r=>{Array.isArray(e[r])&&(t[r]=[...e[r]])})),t}newState(e){return new a.default(e)}removeEventListener(e){if(arguments.length>1)throw new TypeError("Too many arguments passed to removeEventListener");if(null==e)throw new TypeError("The event handle provided is ".concat(typeof e));let t=!1;if((0,i.default)(h[e])&&h[e].id===this._portletId){delete h[e];const r=y.length;for(let t=0;t<r;t++){const r=y[t];r&&r.handle===e&&y.splice(t,1)}t=!0}if(!t)throw new TypeError("The event listener handle doesn't match any listeners.")}setRenderState(e){if((0,c.validateArguments)(arguments,1,1,["object"]),_.portlets&&_.portlets[this._portletId]){const t=_.portlets[this._portletId];(0,c.validateState)(e,t),this._updateState(e)}}startPartialAction(e){const t=this;let r=null;if(arguments.length>1)throw new TypeError("Too many arguments. 1 arguments are allowed");if(void 0!==e){if(!(0,i.default)(e))throw new TypeError("Invalid argument type. Argument is of type ".concat(typeof e));(0,c.validateParameters)(e),r=e}if(!0===p)throw{message:"Operation in progress",name:"AccessDeniedException"};if(!this._hasListener(this._portletId))throw{message:"No onStateChange listener registered for portlet: ".concat(this._portletId),name:"NotInitializedException"};p=!0;const n={setPageState(e){t._setPageState(t._portletId,e)},url:""};return(0,c.getUrl)(_,"PARTIAL_ACTION",this._portletId,r).then((e=>(n.url=e,n)))}}t.PortletInit=g;var v=g;t.default=v},1842:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.RenderState=void 0;var n=i(r(889)),o=i(r(7737));function i(e){return e&&e.__esModule?e:{default:e}}class a{constructor(e){(0,n.default)(e)?this.from(e):(this.parameters={},this.portletMode=o.default.VIEW,this.windowState=o.default.NORMAL)}clone(){return new a(this)}from(e){this.parameters={},Object.keys(e.parameters).forEach((t=>{Array.isArray(e.parameters[t])&&(this.parameters[t]=e.parameters[t].slice(0))})),this.setPortletMode(e.portletMode),this.setWindowState(e.windowState)}getPortletMode(){return this.portletMode}getValue(e,t){if("string"!=typeof e)throw new TypeError("Parameter name must be a string");let r=this.parameters[e];return Array.isArray(r)&&(r=r[0]),void 0===r&&void 0!==t&&(r=t),r}getValues(e,t){if("string"!=typeof e)throw new TypeError("Parameter name must be a string");return this.parameters[e]||t}getWindowState(){return this.windowState}remove(e){if("string"!=typeof e)throw new TypeError("Parameter name must be a string");void 0!==this.parameters[e]&&delete this.parameters[e]}setPortletMode(e){if("string"!=typeof e)throw new TypeError("Portlet Mode must be a string");e!==o.default.EDIT&&e!==o.default.HELP&&e!==o.default.VIEW||(this.portletMode=e)}setValue(e,t){if("string"!=typeof e)throw new TypeError("Parameter name must be a string");if("string"!=typeof t&&null!==t&&!Array.isArray(t))throw new TypeError("Parameter value must be a string, an array or null");Array.isArray(t)||(t=[t]),this.parameters[e]=t}setValues(e,t){this.setValue(e,t)}setWindowState(e){if("string"!=typeof e)throw new TypeError("Window State must be a string");e!==o.default.MAXIMIZED&&e!==o.default.MINIMIZED&&e!==o.default.NORMAL||(this.windowState=e)}}t.RenderState=a;var s=a;t.default=s},5659:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.minimizePortlet=function(e,t,r){r=function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?c(Object(r),!0).forEach((function(t){l(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):c(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}({doAsUserId:themeDisplay.getDoAsUserIdEncoded(),plid:themeDisplay.getPlid()},r);const s=document.querySelector(e);if(s){const e=s.querySelector(".portlet-content-container");if(e){const c=e.classList.contains("d-none");if(c?(e.classList.remove("d-none"),s.classList.remove("portlet-minimized")):(e.classList.add("d-none"),s.classList.add("portlet-minimized")),t){const e=c?'Minimizza':'Ripristina';t.setAttribute("alt",e),t.setAttribute("title",e);const r=t.querySelector(".taglib-text-icon");r&&(r.innerHTML=e);const n=t.querySelector("i");n&&(n.classList.remove("icon-minus","icon-resize-vertical"),c?(n.classList.add("icon-minus"),n.classList.remove("icon-resize-vertical")):(n.classList.add("icon-resize-vertical"),n.classList.remove("icon-minus")))}const l=(0,i.default)(s.id),u=(0,o.default)({cmd:"minimize",doAsUserId:r.doAsUserId,p_auth:Liferay.authToken,p_l_id:r.plid,p_p_id:l,p_p_restore:c,p_v_l_s_g_id:themeDisplay.getSiteGroupId()});(0,n.default)(themeDisplay.getPathMain()+"/portal/update_layout",{body:u,method:"POST"}).then((e=>{if(e.ok&&c){const e={doAsUserId:r.doAsUserId,p_l_id:r.plid,p_p_boundary:!1,p_p_id:l,p_p_isolated:!0};(0,n.default)((0,a.default)(themeDisplay.getPathMain()+"/portal/render_portlet",e)).then((e=>e.text())).then((e=>{const t=document.createRange();t.selectNode(s),s.innerHTML="";const r=t.createContextualFragment(e);s.appendChild(r)})).catch((e=>{}))}})).catch((e=>{}))}}},t.default=void 0;var n=s(r(6549)),o=s(r(7494)),i=s(r(1166)),a=s(r(4821));function s(e){return e&&e.__esModule?e:{default:e}}function c(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function l(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var u={register:s(r(8203)).default};t.default=u},7737:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.PortletConstants=void 0;const r={EDIT:"edit",HELP:"help",VIEW:"view",MAXIMIZED:"maximized",MINIMIZED:"minimized",NORMAL:"normal",FULL:"cacheLevelFull",PAGE:"cacheLevelPage",PORTLET:"cacheLevelPortlet"};t.PortletConstants=r;var n=r;t.default=n},6134:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.validateState=t.validatePortletId=t.validateParameters=t.validateForm=t.validateArguments=t.getUrl=t.getUpdatedPublicRenderParameters=t.generatePortletModeAndWindowStateString=t.generateActionUrl=t.encodeFormAsString=t.decodeUpdateString=void 0;const r="p_r_p_",n="priv_r_p_",o=function(e,t){let r=!1;void 0===e&&void 0===t&&(r=!0),void 0!==e&&void 0!==t||(r=!1),e.length!==t.length&&(r=!1);for(let n=e.length-1;n>=0;n--)e[n]!==t[n]&&(r=!1);return r};t.decodeUpdateString=function(e,t){const r=e&&e.portlets?e.portlets:{};try{const n=JSON.parse(t);n.portlets&&Object.keys(r).forEach((t=>{const i=n.portlets[t].state,a=r[t].state;if(!i||!a)throw new Error("Invalid update string.\nold state=".concat(a,"\nnew state=").concat(i));(function(e,t,r){let n=!1;if(e&&e.portlets&&e.portlets[r]){const i=e.portlets[r].state;if(!t.portletMode||!t.windowState||!t.parameters)throw new Error("Error decoding state: ".concat(t));t.porletMode!==i.portletMode||t.windowState!==i.windowState?n=!0:(Object.keys(t.parameters).forEach((e=>{const r=t.parameters[e],a=i.parameters[e];o(r,a)||(n=!0)})),Object.keys(i.parameters).forEach((e=>{t.parameters[e]||(n=!0)})))}return n})(e,i,t)&&(r[t]=n.portlets[t])}))}catch(e){}return r};const i=function(e,t){const r=[];for(let n=0;n<t.elements.length;n++){const o=t.elements[n],i=o.name,a=o.nodeName.toUpperCase(),s="INPUT"===a?o.type.toUpperCase():"",c=o.value;if(i&&!o.disabled&&"FILE"!==s)if("SELECT"===a&&o.multiple)[...o.options].forEach((t=>{if(t.checked){const n=t.value,o=encodeURIComponent(e+i)+"="+encodeURIComponent(n);r.push(o)}}));else if("CHECKBOX"!==s&&"RADIO"!==s||o.checked){const t=encodeURIComponent(e+i)+"="+encodeURIComponent(c);r.push(t)}}return r.join("&")};t.encodeFormAsString=i;const a=function(e,t){let r="";return Array.isArray(t)&&(0===t.length?r+="&"+encodeURIComponent(e)+"=":t.forEach((t=>{r+="&"+encodeURIComponent(e),r+=null===t?"=":"="+encodeURIComponent(t)}))),r};t.generateActionUrl=function(e,t,r){const n={credentials:"same-origin",method:"POST",url:t};if(r)if("multipart/form-data"===r.enctype){const e=new FormData(r);n.body=e}else{const o=i(e,r);"GET"===(r.method?r.method.toUpperCase():"GET")?(t.indexOf("?")>=0?t+="&".concat(o):t+="?".concat(o),n.url=t):(n.body=o,n.headers={"Content-Type":"application/x-www-form-urlencoded"})}return n};const s=function(e,t,o,i,s){let c="";if(e.portlets&&e.portlets[t]){const l=e.portlets[t];if(l&&l.state&&l.state.parameters){const e=l.state.parameters[o];void 0!==e&&(c+=a(i===r?s:i===n?t+n+o:t+o,e))}}return c},c=function(e,t){let r="";if(e.portlets){const n=e.portlets[t];if(n.state){const e=n.state;r+="&p_p_mode="+encodeURIComponent(e.portletMode),r+="&p_p_state="+encodeURIComponent(e.windowState)}}return r};t.generatePortletModeAndWindowStateString=c,t.getUpdatedPublicRenderParameters=function(e,t,r){const n={};if(e&&e.portlets){const i=e.portlets[t];if(i&&i.pubParms){const a=i.pubParms;Object.keys(a).forEach((i=>{if(!function(e,t,r,n){let i=!1;if(e&&e.portlets){const a=e.portlets[t];if(r.parameters[n]&&a.state.parameters[n]){const e=r.parameters[n],t=a.state.parameters[n];i=o(e,t)}}return i}(e,t,r,i)){const e=a[i];n[e]=r.parameters[i]}}))}}return n},t.getUrl=function(e,t,o,i,l,u){let f="cacheLevelPage",d="",p="";if(e&&e.portlets){"RENDER"===t&&void 0===o&&(o=null);const i=e.portlets[o];if(i&&("RESOURCE"===t?(p=decodeURIComponent(i.encodedResourceURL),l&&(f=l),p+="&p_p_cacheability="+encodeURIComponent(f),u&&(p+="&p_p_resource_id="+encodeURIComponent(u))):"RENDER"===t&&null!==o?p=decodeURIComponent(i.encodedRenderURL):"RENDER"===t?p=decodeURIComponent(e.encodedCurrentURL):"ACTION"===t?(p=decodeURIComponent(i.encodedActionURL),p+="&p_p_hub="+encodeURIComponent("0")):"PARTIAL_ACTION"===t&&(p=decodeURIComponent(i.encodedActionURL),p+="&p_p_hub="+encodeURIComponent("1")),"RESOURCE"!==t||"cacheLevelFull"!==f)){if(o&&(p+=c(e,o)),o&&(d="",i.state&&i.state.parameters)){const t=i.state.parameters;Object.keys(t).forEach((t=>{(function(e,t,r){let n=!1;if(e&&e.portlets){const o=e.portlets[t];o&&o.pubParms&&(n=Object.keys(o.pubParms).includes(r))}return n})(e,o,t)||(d+=s(e,o,t,n))})),p+=d}if(e.prpMap){d="";const t={};Object.keys(e.prpMap).forEach((n=>{Object.keys(e.prpMap[n]).forEach((o=>{const i=e.prpMap[n][o].split("|");Object.hasOwnProperty.call(t,n)||(t[n]=s(e,i[0],i[1],r,n),d+=t[n])}))})),p+=d}}}return i&&(d="",Object.keys(i).forEach((e=>{d+=a(o+e,i[e])})),p+=d),Promise.resolve(p)},t.validateArguments=function(e=[],t=0,r=1,n=[]){if(e.length<t)throw new TypeError("Too few arguments provided: Number of arguments: ".concat(e.length));if(e.length>r)throw new TypeError("Too many arguments provided: ".concat([].join.call(e,", ")));if(Array.isArray(n)){let t=Math.min(e.length,n.length)-1;for(;t>=0;t--){if(typeof e[t]!==n[t])throw new TypeError("Parameter ".concat(t," is of type ").concat(typeof e[t]," rather than the expected type ").concat(n[t]));if(null===e[t]||void 0===e[t])throw new TypeError("Argument is ".concat(typeof e[t]))}}},t.validateForm=function(e){if(!(e instanceof HTMLFormElement))throw new TypeError("Element must be an HTMLFormElement");const t=e.method?e.method.toUpperCase():void 0;if(t&&"GET"!==t&&"POST"!==t)throw new TypeError("Invalid form method ".concat(t,". Allowed methods are GET & POST"));const r=e.enctype;if(r&&"application/x-www-form-urlencoded"!==r&&"multipart/form-data"!==r)throw new TypeError("Invalid form enctype ".concat(r,". Allowed: 'application/x-www-form-urlencoded' & 'multipart/form-data'"));if(r&&"multipart/form-data"===r&&"POST"!==t)throw new TypeError("Invalid method with multipart/form-data. Must be POST");if(!r||"application/x-www-form-urlencoded"===r){const t=e.elements.length;for(let r=0;r<t;r++)if("INPUT"===e.elements[r].nodeName.toUpperCase()&&"FILE"===e.elements[r].type.toUpperCase())throw new TypeError("Must use enctype = 'multipart/form-data' with input type FILE.")}};const l=function(e){if(null==e)throw new TypeError("The parameter object is: ".concat(typeof e));Object.keys(e).forEach((t=>{if(!Array.isArray(e[t]))throw new TypeError("".concat(t," parameter is not an array"));if(!e[t].length)throw new TypeError("".concat(t," parameter is an empty array"))}))};t.validateParameters=l,t.validatePortletId=function(e={},t=""){return e.portlets&&Object.keys(e.portlets).includes(t)},t.validateState=function(e={},t={}){l(e.parameters);const r=e.portletMode;if("string"!=typeof r)throw new TypeError("Invalid parameters. portletMode is ".concat(typeof r));{const e=t.allowedPM;if(!e.includes(r.toLowerCase()))throw new TypeError("Invalid portletMode=".concat(r," is not in ").concat(e))}const n=e.windowState;if("string"!=typeof n)throw new TypeError("Invalid parameters. windowState is ".concat(typeof n));{const e=t.allowedWS;if(!e.includes(n.toLowerCase()))throw new TypeError("Invalid windowState=".concat(n," is not in ").concat(e))}}},8203:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.register=void 0;var n,o=(n=r(7212))&&n.__esModule?n:{default:n},i=r(6134);const a=function(e){(0,i.validateArguments)(arguments,1,1,["string"]);const t=r.g.portlet.data.pageRenderState;return new Promise(((r,n)=>{(0,i.validatePortletId)(t,e)?r(new o.default(e)):n(new Error("Invalid portlet ID"))}))};t.register=a;var s=a;t.default=s},7370:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var n,o=(n=r(6454))&&n.__esModule?n:{default:n};function i(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function a(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?i(Object(r),!0).forEach((function(t){s(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):i(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function s(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const c={breakpoint:768,content:".sidenav-content",gutter:"0px",loadingIndicatorTPL:'<div class="loading-animation loading-animation-md"></div>',navigation:".sidenav-menu-slider",position:"left",type:"relative",typeMobile:"relative",url:null,width:"225px"},l=new WeakMap;function u(e){if(e&&e.jquery){if(e.length>1)throw new Error("getElement(): Expected at most one element, got ".concat(e.length));e=e.get(0)}return!e||e instanceof HTMLElement||(e=e.element),e}function f(e){return e=u(e),l.get(e)}const d=[/^aria-/,/^data-/,/^type$/];function p(e,t){y(e,{[t]:!0})}function h(e,t){y(e,{[t]:!1})}function y(e,t){(e=u(e))&&Object.entries(t).forEach((([t,r])=>{t.split(/\s+/).forEach((t=>{r?e.classList.add(t):e.classList.remove(t)}))}))}function _(e,t){return e=u(e),t.split(/\s+/).every((t=>e.classList.contains(t)))}function g(e,t){(e=u(e))&&Object.entries(t).forEach((([t,r])=>{e.style[t]=r}))}function v(e){return"number"==typeof e?e+"px":"string"==typeof e&&e.match(/^\s*\d+\s*$/)?e.trim()+"px":e}function m(e){return e.getBoundingClientRect().left+(e.ownerDocument.defaultView.pageOffsetX||0)}const b={};function w(e,t,r){if(e){b[t]||(b[t]={},document.body.addEventListener(t,(e=>function(e,t){Object.keys(b[e]).forEach((r=>{let n=!1,o=t.target;for(;o&&(n=o.matches&&o.matches(r),!n);)o=o.parentNode;n&&b[e][r].emit("click",t)}))}(t,e))));const n=b[t],i="string"==typeof e?e:function(e){if((e=u(e)).id)return"#".concat(e.id);let t=e.parentNode;for(;t&&!t.id;)t=t.parentNode;const r=Array.from(e.attributes).map((({name:e,value:t})=>d.some((t=>t.test(e)))?"[".concat(e,"=").concat(JSON.stringify(t),"]"):null)).filter(Boolean).sort();return[t?"#".concat(t.id," "):"",e.tagName.toLowerCase(),...r].join("")}(e);n[i]||(n[i]=new o.default);const a=n[i].on(t,(e=>{e.defaultPrevented||r(e)}));return{dispose(){a.dispose()}}}return null}function O(e){return parseInt(e,10)||0}function j(e,t){e=u(e),this.init(e,t)}function P(){const e=document.querySelectorAll('[data-toggle="liferay-sidenav"]');Array.from(e).forEach(j.initialize)}j.TRANSITION_DURATION=500,j.prototype={_bindUI(){this._subscribeClickTrigger(),this._subscribeClickSidenavClose()},_emit(e){this._emitter.emit(e,this)},_getSidenavWidth(){const e=this.options.widthOriginal;let t=e;const r=window.innerWidth;return r<e+40&&(t=r-40),t},_getSimpleSidenavType(){const e=this.options,t=this._isDesktop(),r=e.type,n=e.typeMobile;return t&&"fixed-push"===r?"desktop-fixed-push":t||"fixed-push"!==n?"fixed":"mobile-fixed-push"},_isDesktop(){return window.innerWidth>=this.options.breakpoint},_isSidenavRight(){const e=this.options;return _(document.querySelector(e.container),"sidenav-right")},_isSimpleSidenavClosed(){const e=this.options,t=e.openClass;return!_(document.querySelector(e.container),t)},_loadUrl(e,t){const r=this,n=e.querySelector(".sidebar-body");if(!r._fetchPromise&&n){for(;n.firstChild;)n.removeChild(n.firstChild);const e=document.createElement("div");p(e,"sidenav-loading"),e.innerHTML=r.options.loadingIndicatorTPL,n.appendChild(e),r._fetchPromise=Liferay.Util.fetch(t),r._fetchPromise.then((e=>{if(!e.ok)throw new Error("Failed to fetch ".concat(t));return e.text()})).then((t=>{const o=document.createRange();o.selectNode(n);const i=o.createContextualFragment(t);n.removeChild(e),n.appendChild(i),r.setHeight()})).catch((e=>{console.error(e)}))}},_renderNav(){const e=this,t=e.options,r=document.querySelector(t.container),n=r.querySelector(t.navigation).querySelector(".sidenav-menu"),o=_(r,"closed"),i=e._isSidenavRight(),a=e._getSidenavWidth();o?(g(n,{width:v(a)}),i&&g(n,{[t.rtl?"left":"right"]:v(a)})):(e.showSidenav(),e.setHeight())},_renderUI(){const e=this,t=e.options,r=document.querySelector(t.container),n=e.toggler,o=e.mobile,i=o?t.typeMobile:t.type;e.useDataAttribute||(o&&(y(r,{closed:!0,open:!1}),y(n,{active:!1,open:!1})),"right"===t.position&&p(r,"sidenav-right"),"relative"!==i&&p(r,"sidenav-fixed"),e._renderNav()),g(r,{display:""})},_subscribeClickSidenavClose(){const e=this,t=e.options.container;if(!e._sidenavCloseSubscription){const r="".concat(t," .sidenav-close");e._sidenavCloseSubscription=w(r,"click",(function(t){t.preventDefault(),e.toggle()}))}},_subscribeClickTrigger(){const e=this;if(!e._togglerSubscription){const t=e.toggler;e._togglerSubscription=w(t,"click",(function(t){e.toggle(),t.preventDefault()}))}},_subscribeSidenavTransitionEnd(e,t){setTimeout((()=>{h(e,"sidenav-transition"),t()}),j.TRANSITION_DURATION)},clearHeight(){const e=this.options,t=document.querySelector(e.container);t&&[t.querySelector(e.content),t.querySelector(e.navigation),t.querySelector(".sidenav-menu")].forEach((e=>{g(e,{height:"","min-height":""})}))},destroy(){const e=this;e._sidenavCloseSubscription&&(e._sidenavCloseSubscription.dispose(),e._sidenavCloseSubscription=null),e._togglerSubscription&&(e._togglerSubscription.dispose(),e._togglerSubscription=null),l.delete(e.toggler)},hide(){const e=this;e.useDataAttribute?e.hideSimpleSidenav():e.toggleNavigation(!1)},hideSidenav(){const e=this,t=e.options,r=document.querySelector(t.container);if(r){const n=r.querySelector(t.content),o=r.querySelector(t.navigation),i=o.querySelector(".sidenav-menu"),a=e._isSidenavRight();let s=t.rtl?"right":"left";a&&(s=t.rtl?"left":"right"),g(n,{["padding-"+s]:"",[s]:""}),g(o,{width:""}),a&&g(i,{[s]:v(e._getSidenavWidth())})}},hideSimpleSidenav(){const e=this,t=e.options;if(!e._isSimpleSidenavClosed()){const r=document.querySelector(t.content),n=document.querySelector(t.container),o=t.closedClass,i=t.openClass,a=e.toggler,s=a.dataset.target||a.getAttribute("href");e._emit("closedStart.lexicon.sidenav"),e._subscribeSidenavTransitionEnd(r,(()=>{h(n,"sidenav-transition"),h(a,"sidenav-transition"),e._emit("closed.lexicon.sidenav")})),_(r,i)&&y(r,{[o]:!0,[i]:!1,"sidenav-transition":!0}),p(n,"sidenav-transition"),p(a,"sidenav-transition"),y(n,{[o]:!0,[i]:!1});const c=document.querySelectorAll('[data-target="'.concat(s,'"], [href="').concat(s,'"]'));Array.from(c).forEach((e=>{y(e,{active:!1,[i]:!1}),y(e,{active:!1,[i]:!1})}))}},init(e,t){const r=this,n="liferay-sidenav"===e.dataset.toggle;(t=a(a({},c),t)).breakpoint=O(t.breakpoint),t.container=t.container||e.dataset.target||e.getAttribute("href"),t.gutter=O(t.gutter),t.rtl="rtl"===document.dir,t.width=O(t.width),t.widthOriginal=t.width,n&&(t.closedClass=e.dataset.closedClass||"closed",t.content=e.dataset.content,t.loadingIndicatorTPL=e.dataset.loadingIndicatorTpl||t.loadingIndicatorTPL,t.openClass=e.dataset.openClass||"open",t.type=e.dataset.type,t.typeMobile=e.dataset.typeMobile,t.url=e.dataset.url,t.width=""),r.toggler=e,r.options=t,r.useDataAttribute=n,r._emitter=new o.default,r._bindUI(),r._renderUI()},on(e,t){return this._emitter.on(e,t)},setHeight(){const e=this.options,t=document.querySelector(e.container),r=this.mobile?e.typeMobile:e.type;if("fixed"!==r&&"fixed-push"!==r){const r=t.querySelector(e.content),n=t.querySelector(e.navigation),o=t.querySelector(".sidenav-menu"),i=r.getBoundingClientRect().height,a=n.getBoundingClientRect().height,s=v(Math.max(i,a));g(r,{"min-height":s}),g(n,{height:"100%","min-height":s}),g(o,{height:"100%","min-height":s})}},show(){const e=this;e.useDataAttribute?e.showSimpleSidenav():e.toggleNavigation(!0)},showSidenav(){const e=this,t=e.mobile,r=e.options,n=document.querySelector(r.container),o=n.querySelector(r.content),i=n.querySelector(r.navigation),a=i.querySelector(".sidenav-menu"),s=e._isSidenavRight(),c=e._getSidenavWidth(),l=c+r.gutter,u=r.url;u&&e._loadUrl(a,u),g(i,{width:v(c)}),g(a,{width:v(c)});let f=r.rtl?"right":"left";s&&(f=r.rtl?"left":"right");const d=t?f:"padding-"+f;if("fixed"!==(t?r.typeMobile:r.type)){let e=_(n,"open")?m(i)-r.gutter:m(i)-l;const t=m(o),a=O(getComputedStyle(o).width);let c="";r.rtl&&s||!r.rtl&&"left"===r.position?(e=m(i)+l,e>t&&(c=e-t)):(r.rtl&&"left"===r.position||!r.rtl&&s)&&e<t+a&&(c=t+a-e,c>=l&&(c=l)),g(o,{[d]:v(c)})}},showSimpleSidenav(){const e=this,t=e.options;if(e._isSimpleSidenavClosed()){const r=document.querySelector(t.content),n=document.querySelector(t.container),o=t.closedClass,i=t.openClass,a=e.toggler,s=a.dataset.url;s&&e._loadUrl(n,s),e._emit("openStart.lexicon.sidenav"),e._subscribeSidenavTransitionEnd(r,(()=>{h(n,"sidenav-transition"),h(a,"sidenav-transition"),e._emit("open.lexicon.sidenav")})),y(r,{[o]:!1,[i]:!0,"sidenav-transition":!0}),y(n,{[o]:!1,[i]:!0,"sidenav-transition":!0}),y(a,{active:!0,[i]:!0,"sidenav-transition":!0})}},toggle(){const e=this;e.useDataAttribute?e.toggleSimpleSidenav():e.toggleNavigation()},toggleNavigation(e){const t=this,r=t.options,n=document.querySelector(r.container),o=n.querySelector(".sidenav-menu"),i=t.toggler,a=r.width,s="boolean"==typeof e?e:_(n,"closed"),c=t._isSidenavRight();if(s?t._emit("openStart.lexicon.sidenav"):t._emit("closedStart.lexicon.sidenav"),t._subscribeSidenavTransitionEnd(n,(()=>{const e=n.querySelector(".sidenav-menu");_(n,"closed")?(t.clearHeight(),y(i,{open:!1,"sidenav-transition":!1}),t._emit("closed.lexicon.sidenav")):(y(i,{open:!0,"sidenav-transition":!1}),t._emit("open.lexicon.sidenav")),t.mobile&&e.focus()})),s){t.setHeight(),g(o,{width:v(a)});const e=r.rtl?"left":"right";c&&g(o,{[e]:""})}p(n,"sidenav-transition"),p(i,"sidenav-transition"),s?t.showSidenav():t.hideSidenav(),y(n,{closed:!s,open:s}),y(i,{active:s,open:s})},toggleSimpleSidenav(){const e=this;e._isSimpleSidenavClosed()?e.showSimpleSidenav():e.hideSimpleSidenav()},visible(){const e=this;let t;if(e.useDataAttribute)t=e._isSimpleSidenavClosed();else{const r=document.querySelector(e.options.container);t=_(r,"sidenav-transition")?!_(r,"closed"):_(r,"closed")}return!t}},j.destroy=function(e){const t=f(e);t&&t.destroy()},j.hide=function(e){const t=f(e);t&&t.hide()},j.initialize=function(e,t={}){e=u(e);let r=l.get(e);return r||(r=new j(e,t),l.set(e,r)),r},j.instance=f,"loading"!==document.readyState?P():document.addEventListener("DOMContentLoaded",(()=>{P()}));var S=j;t.default=S},9296:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t){if(!e||"object"!=typeof e&&"string"!=typeof e)throw new TypeError("Parameter params must be an object or string");if("string"!=typeof t)throw new TypeError("Parameter baseUrl must be a string");const r=t.startsWith("/")?new URL(t,location.href):new URL(t);return"object"==typeof e?Object.entries(e).forEach((([e,t])=>{r.searchParams.append(e,t)})):new URLSearchParams(e.trim()).forEach(((e,t)=>{e?r.searchParams.append(t,e):r.searchParams.append(t,"")})),r.toString()}},3873:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){if("function"!=typeof e)throw new TypeError("Parameter callback must be a function");Liferay.Service("/country/get-countries",{active:!0},e)}},9094:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t){if("function"!=typeof e)throw new TypeError("Parameter callback must be a function");if("string"!=typeof t)throw new TypeError("Parameter selectKey must be a string");Liferay.Service("/region/get-regions",{active:!0,countryId:parseInt(t,10)},e)}},6549:(e,t)=>{function r(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function n(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?r(Object(n),!0).forEach((function(t){o(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):r(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t={}){const r=new Headers({"x-csrf-token":Liferay.authToken});new Headers(t.headers||{}).forEach(((e,t)=>{r.set(t,e)}));const o=n(n({},i),t);return o.headers=r,fetch(e,o)};const i={credentials:"include"}},85:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){if(e=(0,n.default)(e),(0,o.default)(e)){const t=function(e){const t=[];for(;e.parentElement;)e.parentElement.getAttribute("disabled")&&t.push(e.parentElement),e=e.parentElement;return t}(e),r=!e.getAttribute("disabled")&&e.offsetWidth>0&&e.offsetHeight>0&&!t.length,n=e.closest("form");if(!n||r)e.focus();else if(n){const t=n.getAttribute("data-fm-namespace")+"formReady",r=o=>{n.getAttribute("name")===o.formName&&(e.focus(),Liferay.detach(t,r))};Liferay.on(t,r)}}};var n=i(r(8999)),o=i(r(6515));function i(e){return e&&e.__esModule?e:{default:e}}},8002:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t){let r=null;if(void 0!==e&&"FORM"===e.nodeName&&"string"==typeof t){const n=e.dataset.fmNamespace||"";r=e.elements[n+t]||null}return r}},7494:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.default=function e(t={},r=new FormData,n){return Object.entries(t).forEach((([t,i])=>{const a=n?"".concat(n,"[").concat(t,"]"):t;Array.isArray(i)?i.forEach((t=>{e({[a]:t},r)})):!(0,o.default)(i)||i instanceof File?r.append(a,i):e(i,r,a)})),r};var n,o=(n=r(889))&&n.__esModule?n:{default:n}},7535:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t){if("string"==typeof e&&(e=document.querySelector(e)),e&&"FORM"===e.nodeName)if(e.setAttribute("method","post"),(0,n.default)(t)){const{data:r,url:i}=t;if(!(0,n.default)(r))return;(0,o.default)(e,r),void 0===i?submitForm(e):"string"==typeof i&&submitForm(e,i)}else submitForm(e)};var n=i(r(889)),o=i(r(5273));function i(e){return e&&e.__esModule?e:{default:e}}},5273:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t){void 0!==e&&"FORM"===e.nodeName&&(0,n.default)(t)&&Object.entries(t).forEach((([t,r])=>{const n=(0,o.default)(e,t);n&&(n.value=r)}))};var n=i(r(889)),o=i(r(8002));function i(e){return e&&e.__esModule?e:{default:e}}},8206:(e,t)=>{function r(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function n(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?r(Object(n),!0).forEach((function(t){o(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):r(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t={}){const{addSpaceBeforeSuffix:r,decimalSeparator:o,denominator:a,suffixGB:s,suffixKB:c,suffixMB:l}=n(n({},i),t);if("number"!=typeof e)throw new TypeError("Parameter size must be a number");let u=0,f=c;(e/=a)>=a&&(f=l,e/=a,u=1),e>=a&&(f=s,e/=a,u=1);let d=e.toFixed(u);return"."!==o&&(d=d.replace(/\./,o)),d+(r?" ":"")+f};const i={addSpaceBeforeSuffix:!1,decimalSeparator:".",denominator:1024,suffixGB:"GB",suffixKB:"KB",suffixMB:"MB"}},7019:(e,t)=>{function r(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function n(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?r(Object(n),!0).forEach((function(t){o(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):r(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t={}){const{newLine:r,tagIndent:o}=n(n({},j),t);if("string"!=typeof e)throw new TypeError("Parameter content must be a string");const S=[];e=(e=(e=(e=(e=(e=e.trim()).replace(i,(e=>(S.push(e),w)))).replace(m,"><")).replace(g,"~::~<")).replace(y,"~::~$1$2")).replace(O,(()=>S.shift()));let L=0,E=!1;const T=e.split(b);let M=0,A="";return T.forEach(((e,t)=>{i.test(e)?A+=P(M,r,o)+e:s.test(e)?(A+=P(M,r,o)+e,L++,E=!0,(a.test(e)||l.test(e))&&(L--,E=0!==L)):a.test(e)?(A+=e,L--,E=0!==L):u.exec(T[t-1])&&f.exec(e)&&d.exec(T[t-1])==p.exec(e)[0].replace("/","")?(A+=e,E||--M):!h.test(e)||_.test(e)||v.test(e)?h.test(e)&&_.test(e)?A+=E?e:P(M,r,o)+e:_.test(e)?A+=E?e:P(--M,r,o)+e:v.test(e)?A+=E?e:P(M,r,o)+e:(c.test(e),A+=P(M,r,o)+e):A+=E?e:P(M++,r,o)+e,new RegExp("^"+r).test(A)&&(A=A.slice(r.length))})),A};const i=/<!\[CDATA\[[\0-\uFFFF]*?\]\]>/g,a=/-->|\]>/,s=/<!/,c=/<\?/,l=/!DOCTYPE/,u=/^<\w/,f=/^<\/\w/,d=/^<[\w:\-.,]+/,p=/^<\/[\w:\-.,]+/,h=/<\w/,y=/\s*(xmlns)(:|=)/g,_=/<\//,g=/</g,v=/\/>/,m=/>\s+</g,b="~::~",w="<~::~CDATA~::~>",O=new RegExp(w,"g"),j={newLine:"\r\n",tagIndent:"\t"};function P(e,t,r){return t+new Array(e+1).join(r)}},7068:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t){if(!(0,o.default)(e)||(0,o.default)(e)&&"IMG"!==e.tagName)throw new TypeError("Parameter imagePreview must be an image");if(!(0,o.default)(t))throw new TypeError("Parameter region must be an object");const r=e.naturalWidth/e.offsetWidth,n=e.naturalHeight/e.offsetHeight;return{height:t.height?t.height*n:e.naturalHeight,width:t.width?t.width*r:e.naturalWidth,x:t.x?Math.max(t.x*r,0):0,y:t.y?Math.max(t.y*n,0):0}};var n,o=(n=r(889))&&n.__esModule?n:{default:n}},4968:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){return e._node||e._nodes?e.nodeType?e:e._node||null:e}},8999:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){const t=(0,o.default)(e);return"string"==typeof t?document.querySelector(t):t.jquery?t[0]:t};var n,o=(n=r(4968))&&n.__esModule?n:{default:n}},1166:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){return e.replace(r,"$1")};const r=/^(?:p_p_id)?_(.*)_.*$/},6797:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){if("string"!=typeof e)throw new TypeError("portletId must be a string");return"_".concat(e,"_")}},7387:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.escapeHTML=function(e){return e.replace(i,(e=>r[e]))},t.unescapeHTML=function(e){return e.replace(a,(e=>(new DOMParser).parseFromString(e,"text/html").documentElement.textContent))},t.MAP_HTML_CHARS_ESCAPED=void 0;const r={'"':"&#034;","&":"&amp;","'":"&#039;","/":"&#047;","<":"&lt;",">":"&gt;","`":"&#096;"};t.MAP_HTML_CHARS_ESCAPED=r;const n={};Object.entries(r).forEach((([e,t])=>{n[t]=e}));const o=Object.keys(r),i=new RegExp("[".concat(o.join(""),"]"),"g"),a=/&([^;]+);/g},6515:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.default=function e(t,r,n){let i=!1;if(t=(0,o.default)(t)){n||((n={left:(n=t.getBoundingClientRect()).left+window.scrollX,top:n.top+window.scrollY}).bottom=n.top+t.offsetHeight,n.right=n.left+t.offsetWidth),r||(r=window),r=(0,o.default)(r);const a={};if(a.left=r.scrollX,a.right=a.left+r.innerWidth,a.top=r.scrollY,a.bottom=a.top+r.innerHeight,i=n.bottom<=a.bottom&&n.left>=a.left&&n.right<=a.right&&n.top>=a.top,i){const o=r.frameElement;if(o){let s=o.getBoundingClientRect();s={left:s.left+window.scrollX,top:s.top+window.scrollY};const c=s.left-a.left;n.left+=c,n.right+=c;const l=s.top-a.top;n.top+=l,n.bottom+=l,i=e(t,r.parent,n)}}}return i};var n,o=(n=r(8999))&&n.__esModule?n:{default:n}},889:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){const t=typeof e;return"object"===t&&null!==e||"function"===t}},5506:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(){return window.innerWidth<o.default.PHONE};var n,o=(n=r(3337))&&n.__esModule?n:{default:n}},7442:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(){return window.innerWidth<o.default.TABLET};var n,o=(n=r(3337))&&n.__esModule?n:{default:n}},386:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t){var r,n,o;let i=e;"URL"===(null==e||null===(r=e.constructor)||void 0===r?void 0:r.name)&&(i=String(e)),(null===(n=Liferay.SPA)||void 0===n||null===(o=n.app)||void 0===o?void 0:o.canNavigate(i))?(Liferay.SPA.app.navigate(i),t&&Object.keys(t).forEach((e=>{Liferay.once(e,t[e])}))):function(e){let t;try{t=e.startsWith("/")?new URL(e,window.location.origin):new URL(e)}catch(e){return!1}return"http:"===t.protocol||"https:"===t.protocol}(i)&&(window.location.href=i)}},1625:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){if("string"!=typeof e)throw new TypeError("parameter text must be a string");return e.replace(/[^a-z0-9_-]/gi,"-").replace(/^-+/,"").replace(/--+/,"-").toLowerCase()}},4294:(e,t,r)=>{var n;Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t){let r;return"object"!=typeof t?r=o(e,t):(r={},Object.keys(t).forEach((n=>{const i=n;n=o(e,n),r[n]=t[i]}))),r};const o=(i=(e,t)=>(void 0!==t&&0!==t.lastIndexOf(e,0)&&(t="".concat(e).concat(t)),t),(0,((n=r(8511))&&n.__esModule?n:{default:n}).default)(i,((...e)=>e.length>1?Array.prototype.join.call(e,"_"):String(e[0]))));var i},1357:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){if(!(0,o.default)(e))throw new TypeError("Parameter obj must be an object");const t=new URLSearchParams;return Object.entries(e).forEach((([e,r])=>{if(Array.isArray(r))for(let n=0;n<r.length;n++)t.append(e,r[n]);else t.append(e,r)})),t};var n,o=(n=r(889))&&n.__esModule?n:{default:n}},1146:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t={}){return(0,o.default)(e,a(a({},t),{},{p_p_lifecycle:"1"}))};var n,o=(n=r(4821))&&n.__esModule?n:{default:n};function i(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function a(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?i(Object(r),!0).forEach((function(t){s(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):i(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function s(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}},4821:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t={}){if("string"!=typeof e)throw new TypeError("basePortletURL parameter must be a string");if(!t||"object"!=typeof t)throw new TypeError("parameters argument must be an object");const r=new Set(["doAsGroupId","doAsUserId","doAsUserLanguageId","p_auth","p_auth_secret","p_f_id","p_j_a_id","p_l_id","p_l_reset","p_p_auth","p_p_cacheability","p_p_i_id","p_p_id","p_p_isolated","p_p_lifecycle","p_p_mode","p_p_resource_id","p_p_state","p_p_state_rcv","p_p_static","p_p_url_type","p_p_width","p_t_lifecycle","p_v_l_s_g_id","refererGroupId","refererPlid","saveLastPath","scroll"]);var n;0===e.indexOf(Liferay.ThemeDisplay.getPortalURL())||(n=e,i.test(n))||(e=0!==e.indexOf("/")?"".concat(Liferay.ThemeDisplay.getPortalURL(),"/").concat(e):Liferay.ThemeDisplay.getPortalURL()+e);const a=new URL(e),s=new URLSearchParams(a.search),c=t.p_p_id||s.get("p_p_id");if(Object.entries(t).length&&!c)throw new TypeError("Portlet ID must not be null if parameters are provided");let l="";return Object.entries(t).length&&(l=(0,o.default)(c)),Object.keys(t).forEach((e=>{let n;n=r.has(e)?e:"".concat(l).concat(e),s.set(n,t[e])})),a.search=s.toString(),a};var n,o=(n=r(6797))&&n.__esModule?n:{default:n};const i=/^[a-z][a-z0-9+.-]*:/i},6535:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t={}){return(0,o.default)(e,a(a({},t),{},{p_p_lifecycle:"0"}))};var n,o=(n=r(4821))&&n.__esModule?n:{default:n};function i(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function a(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?i(Object(r),!0).forEach((function(t){s(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):i(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function s(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}},576:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t={}){return(0,o.default)(e,a(a({},t),{},{p_p_lifecycle:"2"}))};var n,o=(n=r(4821))&&n.__esModule?n:{default:n};function i(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function a(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?i(Object(r),!0).forEach((function(t){s(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):i(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function s(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}},3833:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.getSessionValue=function(e,t={}){const r=a("get");return r.append("key",e),t.useHttpSession&&r.append("useHttpSession",!0),(0,o.default)(s(),{body:r,method:"POST"}).then((e=>e.text())).then((e=>{if(e.startsWith(i)){const t=e.substring(i.length);e=JSON.parse(t)}return e}))},t.setSessionValue=function(e,t,r={}){const n=a("set");return t&&"object"==typeof t&&(t=i+JSON.stringify(t)),n.append(e,t),r.useHttpSession&&n.append("useHttpSession",!0),(0,o.default)(s(),{body:n,method:"POST"})};var n,o=(n=r(6549))&&n.__esModule?n:{default:n};const i="serialize://";function a(e){const t=Liferay.ThemeDisplay.getDoAsUserIdEncoded(),r=new FormData;return r.append("cmd",e),r.append("p_auth",Liferay.authToken),t&&r.append("doAsUserId",t),r}function s(){return"".concat(Liferay.ThemeDisplay.getPortalURL()).concat(Liferay.ThemeDisplay.getPathMain(),"/portal/session_click")}},7639:(e,t,r)=>{var n;Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var o=(0,((n=r(8511))&&n.__esModule?n:{default:n}).default)((e=>e.split("").map((e=>e.charCodeAt())).join("")));t.default=o},1521:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t){"string"==typeof e?e=document.querySelectorAll(e):e._node?e=[e._node]:e._nodes?e=e._nodes:e.nodeType===Node.ELEMENT_NODE&&(e=[e]),e.forEach((e=>{e.disabled=t,t?e.classList.add("disabled"):e.classList.remove("disabled")}))}},1593:(e,t,r)=>{e=r.nmd(e);var n="__lodash_hash_undefined__",o=9007199254740991,i="[object Arguments]",a="[object Array]",s="[object Boolean]",c="[object Date]",l="[object Error]",u="[object Function]",f="[object Map]",d="[object Number]",p="[object Object]",h="[object Promise]",y="[object RegExp]",_="[object Set]",g="[object String]",v="[object Symbol]",m="[object WeakMap]",b="[object ArrayBuffer]",w="[object DataView]",O=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,j=/^\w*$/,P=/^\./,S=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,L=/\\(\\)?/g,E=/^\[object .+?Constructor\]$/,T=/^(?:0|[1-9]\d*)$/,M={};M["[object Float32Array]"]=M["[object Float64Array]"]=M["[object Int8Array]"]=M["[object Int16Array]"]=M["[object Int32Array]"]=M["[object Uint8Array]"]=M["[object Uint8ClampedArray]"]=M["[object Uint16Array]"]=M["[object Uint32Array]"]=!0,M[i]=M[a]=M[b]=M[s]=M[w]=M[c]=M[l]=M[u]=M[f]=M[d]=M[p]=M[y]=M[_]=M[g]=M[m]=!1;var A="object"==typeof r.g&&r.g&&r.g.Object===Object&&r.g,I="object"==typeof self&&self&&self.Object===Object&&self,U=A||I||Function("return this")(),C=t&&!t.nodeType&&t,R=C&&e&&!e.nodeType&&e,D=R&&R.exports===C&&A.process,x=function(){try{return D&&D.binding("util")}catch(e){}}(),k=x&&x.isTypedArray;function F(e,t,r,n){for(var o=-1,i=e?e.length:0;++o<i;){var a=e[o];t(n,a,r(a),e)}return n}function N(e,t){for(var r=-1,n=e?e.length:0;++r<n;)if(t(e[r],r,e))return!0;return!1}function H(e){var t=!1;if(null!=e&&"function"!=typeof e.toString)try{t=!!(e+"")}catch(e){}return t}function q(e){var t=-1,r=Array(e.size);return e.forEach((function(e,n){r[++t]=[n,e]})),r}function z(e){var t=-1,r=Array(e.size);return e.forEach((function(e){r[++t]=e})),r}var W,B,$,V=Array.prototype,G=Function.prototype,X=Object.prototype,K=U["__core-js_shared__"],J=(W=/[^.]+$/.exec(K&&K.keys&&K.keys.IE_PROTO||""))?"Symbol(src)_1."+W:"",Y=G.toString,Z=X.hasOwnProperty,Q=X.toString,ee=RegExp("^"+Y.call(Z).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),te=U.Symbol,re=U.Uint8Array,ne=X.propertyIsEnumerable,oe=V.splice,ie=(B=Object.keys,$=Object,function(e){return B($(e))}),ae=xe(U,"DataView"),se=xe(U,"Map"),ce=xe(U,"Promise"),le=xe(U,"Set"),ue=xe(U,"WeakMap"),fe=xe(Object,"create"),de=Be(ae),pe=Be(se),he=Be(ce),ye=Be(le),_e=Be(ue),ge=te?te.prototype:void 0,ve=ge?ge.valueOf:void 0,me=ge?ge.toString:void 0;function be(e){var t=-1,r=e?e.length:0;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function we(e){var t=-1,r=e?e.length:0;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function Oe(e){var t=-1,r=e?e.length:0;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function je(e){var t=-1,r=e?e.length:0;for(this.__data__=new Oe;++t<r;)this.add(e[t])}function Pe(e){this.__data__=new we(e)}function Se(e,t){for(var r=e.length;r--;)if(Xe(e[r][0],t))return r;return-1}function Le(e,t,r,n){return Te(e,(function(e,o,i){t(n,e,r(e),i)})),n}be.prototype.clear=function(){this.__data__=fe?fe(null):{}},be.prototype.delete=function(e){return this.has(e)&&delete this.__data__[e]},be.prototype.get=function(e){var t=this.__data__;if(fe){var r=t[e];return r===n?void 0:r}return Z.call(t,e)?t[e]:void 0},be.prototype.has=function(e){var t=this.__data__;return fe?void 0!==t[e]:Z.call(t,e)},be.prototype.set=function(e,t){return this.__data__[e]=fe&&void 0===t?n:t,this},we.prototype.clear=function(){this.__data__=[]},we.prototype.delete=function(e){var t=this.__data__,r=Se(t,e);return!(r<0||(r==t.length-1?t.pop():oe.call(t,r,1),0))},we.prototype.get=function(e){var t=this.__data__,r=Se(t,e);return r<0?void 0:t[r][1]},we.prototype.has=function(e){return Se(this.__data__,e)>-1},we.prototype.set=function(e,t){var r=this.__data__,n=Se(r,e);return n<0?r.push([e,t]):r[n][1]=t,this},Oe.prototype.clear=function(){this.__data__={hash:new be,map:new(se||we),string:new be}},Oe.prototype.delete=function(e){return De(this,e).delete(e)},Oe.prototype.get=function(e){return De(this,e).get(e)},Oe.prototype.has=function(e){return De(this,e).has(e)},Oe.prototype.set=function(e,t){return De(this,e).set(e,t),this},je.prototype.add=je.prototype.push=function(e){return this.__data__.set(e,n),this},je.prototype.has=function(e){return this.__data__.has(e)},Pe.prototype.clear=function(){this.__data__=new we},Pe.prototype.delete=function(e){return this.__data__.delete(e)},Pe.prototype.get=function(e){return this.__data__.get(e)},Pe.prototype.has=function(e){return this.__data__.has(e)},Pe.prototype.set=function(e,t){var r=this.__data__;if(r instanceof we){var n=r.__data__;if(!se||n.length<199)return n.push([e,t]),this;r=this.__data__=new Oe(n)}return r.set(e,t),this};var Ee,Te=(Ee=function(e,t){return e&&Me(e,t,ot)},function(e,t){if(null==e)return e;if(!Ye(e))return Ee(e,t);for(var r=e.length,n=-1,o=Object(e);++n<r&&!1!==t(o[n],n,o););return e}),Me=function(e,t,r){for(var n=-1,o=Object(e),i=r(e),a=i.length;a--;){var s=i[++n];if(!1===t(o[s],s,o))break}return e};function Ae(e,t){for(var r=0,n=(t=Ne(t,e)?[t]:Ce(t)).length;null!=e&&r<n;)e=e[We(t[r++])];return r&&r==n?e:void 0}function Ie(e,t){return null!=e&&t in Object(e)}function Ue(e,t,r,n,o){return e===t||(null==e||null==t||!et(e)&&!tt(t)?e!=e&&t!=t:function(e,t,r,n,o,u){var h=Je(e),m=Je(t),O=a,j=a;h||(O=(O=ke(e))==i?p:O),m||(j=(j=ke(t))==i?p:j);var P=O==p&&!H(e),S=j==p&&!H(t),L=O==j;if(L&&!P)return u||(u=new Pe),h||nt(e)?Re(e,t,r,n,o,u):function(e,t,r,n,o,i,a){switch(r){case w:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case b:return!(e.byteLength!=t.byteLength||!n(new re(e),new re(t)));case s:case c:case d:return Xe(+e,+t);case l:return e.name==t.name&&e.message==t.message;case y:case g:return e==t+"";case f:var u=q;case _:var p=2&i;if(u||(u=z),e.size!=t.size&&!p)return!1;var h=a.get(e);if(h)return h==t;i|=1,a.set(e,t);var m=Re(u(e),u(t),n,o,i,a);return a.delete(e),m;case v:if(ve)return ve.call(e)==ve.call(t)}return!1}(e,t,O,r,n,o,u);if(!(2&o)){var E=P&&Z.call(e,"__wrapped__"),T=S&&Z.call(t,"__wrapped__");if(E||T){var M=E?e.value():e,A=T?t.value():t;return u||(u=new Pe),r(M,A,n,o,u)}}return!!L&&(u||(u=new Pe),function(e,t,r,n,o,i){var a=2&o,s=ot(e),c=s.length;if(c!=ot(t).length&&!a)return!1;for(var l=c;l--;){var u=s[l];if(!(a?u in t:Z.call(t,u)))return!1}var f=i.get(e);if(f&&i.get(t))return f==t;var d=!0;i.set(e,t),i.set(t,e);for(var p=a;++l<c;){var h=e[u=s[l]],y=t[u];if(n)var _=a?n(y,h,u,t,e,i):n(h,y,u,e,t,i);if(!(void 0===_?h===y||r(h,y,n,o,i):_)){d=!1;break}p||(p="constructor"==u)}if(d&&!p){var g=e.constructor,v=t.constructor;g==v||!("constructor"in e)||!("constructor"in t)||"function"==typeof g&&g instanceof g&&"function"==typeof v&&v instanceof v||(d=!1)}return i.delete(e),i.delete(t),d}(e,t,r,n,o,u))}(e,t,Ue,r,n,o))}function Ce(e){return Je(e)?e:ze(e)}function Re(e,t,r,n,o,i){var a=2&o,s=e.length,c=t.length;if(s!=c&&!(a&&c>s))return!1;var l=i.get(e);if(l&&i.get(t))return l==t;var u=-1,f=!0,d=1&o?new je:void 0;for(i.set(e,t),i.set(t,e);++u<s;){var p=e[u],h=t[u];if(n)var y=a?n(h,p,u,t,e,i):n(p,h,u,e,t,i);if(void 0!==y){if(y)continue;f=!1;break}if(d){if(!N(t,(function(e,t){if(!d.has(t)&&(p===e||r(p,e,n,o,i)))return d.add(t)}))){f=!1;break}}else if(p!==h&&!r(p,h,n,o,i)){f=!1;break}}return i.delete(e),i.delete(t),f}function De(e,t){var r,n,o=e.__data__;return("string"==(n=typeof(r=t))||"number"==n||"symbol"==n||"boolean"==n?"__proto__"!==r:null===r)?o["string"==typeof t?"string":"hash"]:o.map}function xe(e,t){var r=function(e,t){return null==e?void 0:e[t]}(e,t);return function(e){return!(!et(e)||function(e){return!!J&&J in e}(e))&&(Ze(e)||H(e)?ee:E).test(Be(e))}(r)?r:void 0}var ke=function(e){return Q.call(e)};function Fe(e,t){return!!(t=null==t?o:t)&&("number"==typeof e||T.test(e))&&e>-1&&e%1==0&&e<t}function Ne(e,t){if(Je(e))return!1;var r=typeof e;return!("number"!=r&&"symbol"!=r&&"boolean"!=r&&null!=e&&!rt(e))||j.test(e)||!O.test(e)||null!=t&&e in Object(t)}function He(e){return e==e&&!et(e)}function qe(e,t){return function(r){return null!=r&&r[e]===t&&(void 0!==t||e in Object(r))}}(ae&&ke(new ae(new ArrayBuffer(1)))!=w||se&&ke(new se)!=f||ce&&ke(ce.resolve())!=h||le&&ke(new le)!=_||ue&&ke(new ue)!=m)&&(ke=function(e){var t=Q.call(e),r=t==p?e.constructor:void 0,n=r?Be(r):void 0;if(n)switch(n){case de:return w;case pe:return f;case he:return h;case ye:return _;case _e:return m}return t});var ze=Ge((function(e){var t;e=null==(t=e)?"":function(e){if("string"==typeof e)return e;if(rt(e))return me?me.call(e):"";var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}(t);var r=[];return P.test(e)&&r.push(""),e.replace(S,(function(e,t,n,o){r.push(n?o.replace(L,"$1"):t||e)})),r}));function We(e){if("string"==typeof e||rt(e))return e;var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}function Be(e){if(null!=e){try{return Y.call(e)}catch(e){}try{return e+""}catch(e){}}return""}var $e,Ve=($e=function(e,t,r){Z.call(e,r)?e[r].push(t):e[r]=[t]},function(e,t){var r,n,o,i,a;return(Je(e)?F:Le)(e,$e,"function"==typeof(r=t)?r:null==r?it:"object"==typeof r?Je(r)?function(e,t){return Ne(e)&&He(t)?qe(We(e),t):function(r){var n=function(e,t,r){var n=null==e?void 0:Ae(e,t);return void 0===n?void 0:n}(r,e);return void 0===n&&n===t?function(e,t){return null!=e&&function(e,t,r){for(var n,o=-1,i=(t=Ne(t,e)?[t]:Ce(t)).length;++o<i;){var a=We(t[o]);if(!(n=null!=e&&r(e,a)))break;e=e[a]}return n||!!(i=e?e.length:0)&&Qe(i)&&Fe(a,i)&&(Je(e)||Ke(e))}(e,t,Ie)}(r,e):Ue(t,n,void 0,3)}}(r[0],r[1]):1==(o=function(e){for(var t=ot(e),r=t.length;r--;){var n=t[r],o=e[n];t[r]=[n,o,He(o)]}return t}(n=r)).length&&o[0][2]?qe(o[0][0],o[0][1]):function(e){return e===n||function(e,t,r,n){var o=r.length,i=o;if(null==e)return!i;for(e=Object(e);o--;){var a=r[o];if(a[2]?a[1]!==e[a[0]]:!(a[0]in e))return!1}for(;++o<i;){var s=(a=r[o])[0],c=e[s],l=a[1];if(a[2]){if(void 0===c&&!(s in e))return!1}else if(!Ue(l,c,undefined,3,new Pe))return!1}return!0}(e,0,o)}:Ne(i=r)?(a=We(i),function(e){return null==e?void 0:e[a]}):function(e){return function(t){return Ae(t,e)}}(i),{})});function Ge(e,t){if("function"!=typeof e||t&&"function"!=typeof t)throw new TypeError("Expected a function");var r=function(){var n=arguments,o=t?t.apply(this,n):n[0],i=r.cache;if(i.has(o))return i.get(o);var a=e.apply(this,n);return r.cache=i.set(o,a),a};return r.cache=new(Ge.Cache||Oe),r}function Xe(e,t){return e===t||e!=e&&t!=t}function Ke(e){return function(e){return tt(e)&&Ye(e)}(e)&&Z.call(e,"callee")&&(!ne.call(e,"callee")||Q.call(e)==i)}Ge.Cache=Oe;var Je=Array.isArray;function Ye(e){return null!=e&&Qe(e.length)&&!Ze(e)}function Ze(e){var t=et(e)?Q.call(e):"";return t==u||"[object GeneratorFunction]"==t}function Qe(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=o}function et(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function tt(e){return!!e&&"object"==typeof e}function rt(e){return"symbol"==typeof e||tt(e)&&Q.call(e)==v}var nt=k?function(e){return function(t){return e(t)}}(k):function(e){return tt(e)&&Qe(e.length)&&!!M[Q.call(e)]};function ot(e){return Ye(e)?function(e,t){var r=Je(e)||Ke(e)?function(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n}(e.length,String):[],n=r.length,o=!!n;for(var i in e)!Z.call(e,i)||o&&("length"==i||Fe(i,n))||r.push(i);return r}(e):function(e){if(r=(t=e)&&t.constructor,t!==("function"==typeof r&&r.prototype||X))return ie(e);var t,r,n=[];for(var o in Object(e))Z.call(e,o)&&"constructor"!=o&&n.push(o);return n}(e)}function it(e){return e}e.exports=Ve},8652:(e,t,r)=>{e=r.nmd(e);var n="__lodash_hash_undefined__",o=9007199254740991,i="[object Arguments]",a="[object Array]",s="[object Boolean]",c="[object Date]",l="[object Error]",u="[object Function]",f="[object Map]",d="[object Number]",p="[object Object]",h="[object Promise]",y="[object RegExp]",_="[object Set]",g="[object String]",v="[object WeakMap]",m="[object ArrayBuffer]",b="[object DataView]",w=/^\[object .+?Constructor\]$/,O=/^(?:0|[1-9]\d*)$/,j={};j["[object Float32Array]"]=j["[object Float64Array]"]=j["[object Int8Array]"]=j["[object Int16Array]"]=j["[object Int32Array]"]=j["[object Uint8Array]"]=j["[object Uint8ClampedArray]"]=j["[object Uint16Array]"]=j["[object Uint32Array]"]=!0,j[i]=j[a]=j[m]=j[s]=j[b]=j[c]=j[l]=j[u]=j[f]=j[d]=j[p]=j[y]=j[_]=j[g]=j[v]=!1;var P="object"==typeof r.g&&r.g&&r.g.Object===Object&&r.g,S="object"==typeof self&&self&&self.Object===Object&&self,L=P||S||Function("return this")(),E=t&&!t.nodeType&&t,T=E&&e&&!e.nodeType&&e,M=T&&T.exports===E,A=M&&P.process,I=function(){try{return A&&A.binding&&A.binding("util")}catch(e){}}(),U=I&&I.isTypedArray;function C(e,t){for(var r=-1,n=null==e?0:e.length;++r<n;)if(t(e[r],r,e))return!0;return!1}function R(e){var t=-1,r=Array(e.size);return e.forEach((function(e,n){r[++t]=[n,e]})),r}function D(e){var t=-1,r=Array(e.size);return e.forEach((function(e){r[++t]=e})),r}var x,k,F,N=Array.prototype,H=Function.prototype,q=Object.prototype,z=L["__core-js_shared__"],W=H.toString,B=q.hasOwnProperty,$=(x=/[^.]+$/.exec(z&&z.keys&&z.keys.IE_PROTO||""))?"Symbol(src)_1."+x:"",V=q.toString,G=RegExp("^"+W.call(B).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),X=M?L.Buffer:void 0,K=L.Symbol,J=L.Uint8Array,Y=q.propertyIsEnumerable,Z=N.splice,Q=K?K.toStringTag:void 0,ee=Object.getOwnPropertySymbols,te=X?X.isBuffer:void 0,re=(k=Object.keys,F=Object,function(e){return k(F(e))}),ne=Te(L,"DataView"),oe=Te(L,"Map"),ie=Te(L,"Promise"),ae=Te(L,"Set"),se=Te(L,"WeakMap"),ce=Te(Object,"create"),le=Ue(ne),ue=Ue(oe),fe=Ue(ie),de=Ue(ae),pe=Ue(se),he=K?K.prototype:void 0,ye=he?he.valueOf:void 0;function _e(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function ge(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function ve(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function me(e){var t=-1,r=null==e?0:e.length;for(this.__data__=new ve;++t<r;)this.add(e[t])}function be(e){var t=this.__data__=new ge(e);this.size=t.size}function we(e,t){for(var r=e.length;r--;)if(Ce(e[r][0],t))return r;return-1}function Oe(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":Q&&Q in Object(e)?function(e){var t=B.call(e,Q),r=e[Q];try{e[Q]=void 0;var n=!0}catch(e){}var o=V.call(e);return n&&(t?e[Q]=r:delete e[Q]),o}(e):function(e){return V.call(e)}(e)}function je(e){return He(e)&&Oe(e)==i}function Pe(e,t,r,n,o){return e===t||(null==e||null==t||!He(e)&&!He(t)?e!=e&&t!=t:function(e,t,r,n,o,u){var h=De(e),v=De(t),w=h?a:Ae(e),O=v?a:Ae(t),j=(w=w==i?p:w)==p,P=(O=O==i?p:O)==p,S=w==O;if(S&&xe(e)){if(!xe(t))return!1;h=!0,j=!1}if(S&&!j)return u||(u=new be),h||qe(e)?Se(e,t,r,n,o,u):function(e,t,r,n,o,i,a){switch(r){case b:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case m:return!(e.byteLength!=t.byteLength||!i(new J(e),new J(t)));case s:case c:case d:return Ce(+e,+t);case l:return e.name==t.name&&e.message==t.message;case y:case g:return e==t+"";case f:var u=R;case _:var p=1&n;if(u||(u=D),e.size!=t.size&&!p)return!1;var h=a.get(e);if(h)return h==t;n|=2,a.set(e,t);var v=Se(u(e),u(t),n,o,i,a);return a.delete(e),v;case"[object Symbol]":if(ye)return ye.call(e)==ye.call(t)}return!1}(e,t,w,r,n,o,u);if(!(1&r)){var L=j&&B.call(e,"__wrapped__"),E=P&&B.call(t,"__wrapped__");if(L||E){var T=L?e.value():e,M=E?t.value():t;return u||(u=new be),o(T,M,r,n,u)}}return!!S&&(u||(u=new be),function(e,t,r,n,o,i){var a=1&r,s=Le(e),c=s.length;if(c!=Le(t).length&&!a)return!1;for(var l=c;l--;){var u=s[l];if(!(a?u in t:B.call(t,u)))return!1}var f=i.get(e);if(f&&i.get(t))return f==t;var d=!0;i.set(e,t),i.set(t,e);for(var p=a;++l<c;){var h=e[u=s[l]],y=t[u];if(n)var _=a?n(y,h,u,t,e,i):n(h,y,u,e,t,i);if(!(void 0===_?h===y||o(h,y,r,n,i):_)){d=!1;break}p||(p="constructor"==u)}if(d&&!p){var g=e.constructor,v=t.constructor;g==v||!("constructor"in e)||!("constructor"in t)||"function"==typeof g&&g instanceof g&&"function"==typeof v&&v instanceof v||(d=!1)}return i.delete(e),i.delete(t),d}(e,t,r,n,o,u))}(e,t,r,n,Pe,o))}function Se(e,t,r,n,o,i){var a=1&r,s=e.length,c=t.length;if(s!=c&&!(a&&c>s))return!1;var l=i.get(e);if(l&&i.get(t))return l==t;var u=-1,f=!0,d=2&r?new me:void 0;for(i.set(e,t),i.set(t,e);++u<s;){var p=e[u],h=t[u];if(n)var y=a?n(h,p,u,t,e,i):n(p,h,u,e,t,i);if(void 0!==y){if(y)continue;f=!1;break}if(d){if(!C(t,(function(e,t){if(a=t,!d.has(a)&&(p===e||o(p,e,r,n,i)))return d.push(t);var a}))){f=!1;break}}else if(p!==h&&!o(p,h,r,n,i)){f=!1;break}}return i.delete(e),i.delete(t),f}function Le(e){return function(e,t,r){var n=t(e);return De(e)?n:function(e,t){for(var r=-1,n=t.length,o=e.length;++r<n;)e[o+r]=t[r];return e}(n,r(e))}(e,ze,Me)}function Ee(e,t){var r,n,o=e.__data__;return("string"==(n=typeof(r=t))||"number"==n||"symbol"==n||"boolean"==n?"__proto__"!==r:null===r)?o["string"==typeof t?"string":"hash"]:o.map}function Te(e,t){var r=function(e,t){return null==e?void 0:e[t]}(e,t);return function(e){return!(!Ne(e)||function(e){return!!$&&$ in e}(e))&&(ke(e)?G:w).test(Ue(e))}(r)?r:void 0}_e.prototype.clear=function(){this.__data__=ce?ce(null):{},this.size=0},_e.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},_e.prototype.get=function(e){var t=this.__data__;if(ce){var r=t[e];return r===n?void 0:r}return B.call(t,e)?t[e]:void 0},_e.prototype.has=function(e){var t=this.__data__;return ce?void 0!==t[e]:B.call(t,e)},_e.prototype.set=function(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=ce&&void 0===t?n:t,this},ge.prototype.clear=function(){this.__data__=[],this.size=0},ge.prototype.delete=function(e){var t=this.__data__,r=we(t,e);return!(r<0||(r==t.length-1?t.pop():Z.call(t,r,1),--this.size,0))},ge.prototype.get=function(e){var t=this.__data__,r=we(t,e);return r<0?void 0:t[r][1]},ge.prototype.has=function(e){return we(this.__data__,e)>-1},ge.prototype.set=function(e,t){var r=this.__data__,n=we(r,e);return n<0?(++this.size,r.push([e,t])):r[n][1]=t,this},ve.prototype.clear=function(){this.size=0,this.__data__={hash:new _e,map:new(oe||ge),string:new _e}},ve.prototype.delete=function(e){var t=Ee(this,e).delete(e);return this.size-=t?1:0,t},ve.prototype.get=function(e){return Ee(this,e).get(e)},ve.prototype.has=function(e){return Ee(this,e).has(e)},ve.prototype.set=function(e,t){var r=Ee(this,e),n=r.size;return r.set(e,t),this.size+=r.size==n?0:1,this},me.prototype.add=me.prototype.push=function(e){return this.__data__.set(e,n),this},me.prototype.has=function(e){return this.__data__.has(e)},be.prototype.clear=function(){this.__data__=new ge,this.size=0},be.prototype.delete=function(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r},be.prototype.get=function(e){return this.__data__.get(e)},be.prototype.has=function(e){return this.__data__.has(e)},be.prototype.set=function(e,t){var r=this.__data__;if(r instanceof ge){var n=r.__data__;if(!oe||n.length<199)return n.push([e,t]),this.size=++r.size,this;r=this.__data__=new ve(n)}return r.set(e,t),this.size=r.size,this};var Me=ee?function(e){return null==e?[]:(e=Object(e),function(t,r){for(var n=-1,o=null==t?0:t.length,i=0,a=[];++n<o;){var s=t[n];c=s,Y.call(e,c)&&(a[i++]=s)}var c;return a}(ee(e)))}:function(){return[]},Ae=Oe;function Ie(e,t){return!!(t=null==t?o:t)&&("number"==typeof e||O.test(e))&&e>-1&&e%1==0&&e<t}function Ue(e){if(null!=e){try{return W.call(e)}catch(e){}try{return e+""}catch(e){}}return""}function Ce(e,t){return e===t||e!=e&&t!=t}(ne&&Ae(new ne(new ArrayBuffer(1)))!=b||oe&&Ae(new oe)!=f||ie&&Ae(ie.resolve())!=h||ae&&Ae(new ae)!=_||se&&Ae(new se)!=v)&&(Ae=function(e){var t=Oe(e),r=t==p?e.constructor:void 0,n=r?Ue(r):"";if(n)switch(n){case le:return b;case ue:return f;case fe:return h;case de:return _;case pe:return v}return t});var Re=je(function(){return arguments}())?je:function(e){return He(e)&&B.call(e,"callee")&&!Y.call(e,"callee")},De=Array.isArray,xe=te||function(){return!1};function ke(e){if(!Ne(e))return!1;var t=Oe(e);return t==u||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t}function Fe(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=o}function Ne(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function He(e){return null!=e&&"object"==typeof e}var qe=U?function(e){return function(t){return e(t)}}(U):function(e){return He(e)&&Fe(e.length)&&!!j[Oe(e)]};function ze(e){return null!=(t=e)&&Fe(t.length)&&!ke(t)?function(e,t){var r=De(e),n=!r&&Re(e),o=!r&&!n&&xe(e),i=!r&&!n&&!o&&qe(e),a=r||n||o||i,s=a?function(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n}(e.length,String):[],c=s.length;for(var l in e)!B.call(e,l)||a&&("length"==l||o&&("offset"==l||"parent"==l)||i&&("buffer"==l||"byteLength"==l||"byteOffset"==l)||Ie(l,c))||s.push(l);return s}(e):function(e){if(r=(t=e)&&t.constructor,t!==("function"==typeof r&&r.prototype||q))return re(e);var t,r,n=[];for(var o in Object(e))B.call(e,o)&&"constructor"!=o&&n.push(o);return n}(e);var t}e.exports=function(e,t){return Pe(e,t)}},8511:(e,t,r)=>{var n,o="__lodash_hash_undefined__",i=/^\[object .+?Constructor\]$/,a="object"==typeof r.g&&r.g&&r.g.Object===Object&&r.g,s="object"==typeof self&&self&&self.Object===Object&&self,c=a||s||Function("return this")(),l=Array.prototype,u=Function.prototype,f=Object.prototype,d=c["__core-js_shared__"],p=(n=/[^.]+$/.exec(d&&d.keys&&d.keys.IE_PROTO||""))?"Symbol(src)_1."+n:"",h=u.toString,y=f.hasOwnProperty,_=f.toString,g=RegExp("^"+h.call(y).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),v=l.splice,m=L(c,"Map"),b=L(Object,"create");function w(e){var t=-1,r=e?e.length:0;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function O(e){var t=-1,r=e?e.length:0;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function j(e){var t=-1,r=e?e.length:0;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function P(e,t){for(var r,n,o=e.length;o--;)if((r=e[o][0])===(n=t)||r!=r&&n!=n)return o;return-1}function S(e,t){var r,n,o=e.__data__;return("string"==(n=typeof(r=t))||"number"==n||"symbol"==n||"boolean"==n?"__proto__"!==r:null===r)?o["string"==typeof t?"string":"hash"]:o.map}function L(e,t){var r=function(e,t){return null==e?void 0:e[t]}(e,t);return function(e){return!(!T(e)||(t=e,p&&p in t))&&(function(e){var t=T(e)?_.call(e):"";return"[object Function]"==t||"[object GeneratorFunction]"==t}(e)||function(e){var t=!1;if(null!=e&&"function"!=typeof e.toString)try{t=!!(e+"")}catch(e){}return t}(e)?g:i).test(function(e){if(null!=e){try{return h.call(e)}catch(e){}try{return e+""}catch(e){}}return""}(e));var t}(r)?r:void 0}function E(e,t){if("function"!=typeof e||t&&"function"!=typeof t)throw new TypeError("Expected a function");var r=function(){var n=arguments,o=t?t.apply(this,n):n[0],i=r.cache;if(i.has(o))return i.get(o);var a=e.apply(this,n);return r.cache=i.set(o,a),a};return r.cache=new(E.Cache||j),r}function T(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}w.prototype.clear=function(){this.__data__=b?b(null):{}},w.prototype.delete=function(e){return this.has(e)&&delete this.__data__[e]},w.prototype.get=function(e){var t=this.__data__;if(b){var r=t[e];return r===o?void 0:r}return y.call(t,e)?t[e]:void 0},w.prototype.has=function(e){var t=this.__data__;return b?void 0!==t[e]:y.call(t,e)},w.prototype.set=function(e,t){return this.__data__[e]=b&&void 0===t?o:t,this},O.prototype.clear=function(){this.__data__=[]},O.prototype.delete=function(e){var t=this.__data__,r=P(t,e);return!(r<0||(r==t.length-1?t.pop():v.call(t,r,1),0))},O.prototype.get=function(e){var t=this.__data__,r=P(t,e);return r<0?void 0:t[r][1]},O.prototype.has=function(e){return P(this.__data__,e)>-1},O.prototype.set=function(e,t){var r=this.__data__,n=P(r,e);return n<0?r.push([e,t]):r[n][1]=t,this},j.prototype.clear=function(){this.__data__={hash:new w,map:new(m||O),string:new w}},j.prototype.delete=function(e){return S(this,e).delete(e)},j.prototype.get=function(e){return S(this,e).get(e)},j.prototype.has=function(e){return S(this,e).has(e)},j.prototype.set=function(e,t){return S(this,e).set(e,t),this},E.Cache=j,e.exports=E},1093:(e,t,r)=>{var n,o=/&(?:amp|lt|gt|quot|#39|#96);/g,i=RegExp(o.source),a="object"==typeof r.g&&r.g&&r.g.Object===Object&&r.g,s="object"==typeof self&&self&&self.Object===Object&&self,c=a||s||Function("return this")(),l=(n={"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#39;":"'","&#96;":"`"},function(e){return null==n?void 0:n[e]}),u=Object.prototype.toString,f=c.Symbol,d=f?f.prototype:void 0,p=d?d.toString:void 0;e.exports=function(e){var t;return(e=null==(t=e)?"":function(e){if("string"==typeof e)return e;if(function(e){return"symbol"==typeof e||function(e){return!!e&&"object"==typeof e}(e)&&"[object Symbol]"==u.call(e)}(e))return p?p.call(e):"";var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}(t))&&i.test(e)?e.replace(o,l):e}},26:e=>{for(var t=[],r=0;r<256;++r)t[r]=(r+256).toString(16).substr(1);e.exports=function(e,r){var n=r||0,o=t;return[o[e[n++]],o[e[n++]],o[e[n++]],o[e[n++]],"-",o[e[n++]],o[e[n++]],"-",o[e[n++]],o[e[n++]],"-",o[e[n++]],o[e[n++]],"-",o[e[n++]],o[e[n++]],o[e[n++]],o[e[n++]],o[e[n++]],o[e[n++]]].join("")}},1814:e=>{var t="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof window.msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto);if(t){var r=new Uint8Array(16);e.exports=function(){return t(r),r}}else{var n=new Array(16);e.exports=function(){for(var e,t=0;t<16;t++)0==(3&t)&&(e=4294967296*Math.random()),n[t]=e>>>((3&t)<<3)&255;return n}}},8633:(e,t,r)=>{var n,o,i=r(1814),a=r(26),s=0,c=0;e.exports=function(e,t,r){var l=t&&r||0,u=t||[],f=(e=e||{}).node||n,d=void 0!==e.clockseq?e.clockseq:o;if(null==f||null==d){var p=i();null==f&&(f=n=[1|p[0],p[1],p[2],p[3],p[4],p[5]]),null==d&&(d=o=16383&(p[6]<<8|p[7]))}var h=void 0!==e.msecs?e.msecs:(new Date).getTime(),y=void 0!==e.nsecs?e.nsecs:c+1,_=h-s+(y-c)/1e4;if(_<0&&void 0===e.clockseq&&(d=d+1&16383),(_<0||h>s)&&void 0===e.nsecs&&(y=0),y>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");s=h,c=y,o=d;var g=(1e4*(268435455&(h+=122192928e5))+y)%4294967296;u[l++]=g>>>24&255,u[l++]=g>>>16&255,u[l++]=g>>>8&255,u[l++]=255&g;var v=h/4294967296*1e4&268435455;u[l++]=v>>>8&255,u[l++]=255&v,u[l++]=v>>>24&15|16,u[l++]=v>>>16&255,u[l++]=d>>>8|128,u[l++]=255&d;for(var m=0;m<6;++m)u[l+m]=f[m];return t||a(u)}}},t={};function r(n){if(t[n])return t[n].exports;var o=t[n]={id:n,loaded:!1,exports:{}};return e[n](o,o.exports,r),o.loaded=!0,o.exports}return r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),r.nmd=e=>(e.paths=[],e.children||(e.children=[]),e),r(2698)})());
//# sourceMappingURL=global.bundle.js.map
function ownKeys(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,a)}return r}function _objectSpread(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ownKeys(Object(r),!0).forEach((function(t){_defineProperty(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ownKeys(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function _defineProperty(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}!function(e){var t=e.Lang,r=Liferay.Util,a="head",o=_objectSpread(_objectSpread({},Liferay.Portlet),{},{_defCloseFn(e){if(e.portlet.remove(!0),!e.nestedPortlet){var t=Liferay.Util.objectToFormData({cmd:"delete",doAsUserId:e.doAsUserId,p_auth:Liferay.authToken,p_l_id:e.plid,p_p_id:e.portletId,p_v_l_s_g_id:themeDisplay.getSiteGroupId()});Liferay.Util.fetch(themeDisplay.getPathMain()+"/portal/update_layout",{body:t,method:"POST"}).then((e=>{e.ok&&Liferay.fire("updatedLayout")}))}},_loadMarkupHeadElements(t){var r=t.markupHeadElements;if(r&&r.length){e.one(a).append(r);var o=e.Node.create("<div />");o.plug(e.Plugin.ParseContent),o.setContent(r)}},_loadPortletFiles(t,r){var o=t.footerCssPaths||[],i=t.headerCssPaths||[],l=t.headerJavaScriptPaths||[];l=l.concat(t.footerJavaScriptPaths||[]);var d=e.getBody(),n=e.one(a);i.length&&e.Get.css(i,{insertBefore:n.get("firstChild").getDOM()});var s=d.get("lastChild").getDOM();o.length&&e.Get.css(o,{insertBefore:s});var p=t.portletHTML;l.length?e.Get.script(l,{onEnd(){r(p)}}):r(p)},_mergeOptions:(e,t)=>((t=t||{}).doAsUserId=t.doAsUserId||themeDisplay.getDoAsUserIdEncoded(),t.plid=t.plid||themeDisplay.getPlid(),t.portlet=e,t.portletId=e.portletId,t),_staticPortlets:{},destroyComponents(e){Liferay.destroyComponents(((t,r)=>e===r.portletId))},isStatic(e){return r.getPortletId(e.id||e)in this._staticPortlets},list:[],readyCounter:0,refreshLayout(e){},register(e){this.list.indexOf(e)<0&&this.list.push(e)}});Liferay.provide(o,"add",(function(t){var a=this;Liferay.fire("initLayout");var o=t.doAsUserId||themeDisplay.getDoAsUserIdEncoded(),i=t.plid||themeDisplay.getPlid(),l=t.portletData,d=t.portletId,n=t.portletItemId,s=t.placeHolder;s=s?e.one(s):e.Node.create('<div class="loading-animation" />');var p=t.beforePortletLoaded,f=t.onComplete,c=null;if(Liferay.Layout&&Liferay.Layout.INITIALIZED&&(c=Liferay.Layout.getActiveDropContainer()),c){var y=r.getColumnId(c.attr("id")),u=0;if(t.placeHolder){var h=s.get("parentNode");if(!h)return;s.addClass("portlet-boundary");var g=h.all(".portlet-boundary"),L=h.all(".portlet-nested-portlets");u=g.indexOf(s);var v=0;L.some((e=>{var t=g.indexOf(e);if(-1!==t&&t<u)v+=e.all(".portlet-boundary").size();else if(t>=u)return!0})),u-=v,y=r.getColumnId(h.attr("id"))}var m=themeDisplay.getPathMain()+"/portal/update_layout",P={cmd:"add",dataType:"JSON",doAsUserId:o,p_auth:Liferay.authToken,p_l_id:i,p_p_col_id:y,p_p_col_pos:u,p_p_i_id:n,p_p_id:d,p_p_isolated:!0,p_v_l_s_g_id:themeDisplay.getSiteGroupId(),portletData:l},_=c.one(".portlet-boundary"),I=_&&_.isStatic;t.placeHolder||t.plid||(I?_.placeAfter(s):c.prepend(s)),P.currentURL=Liferay.currentURL,a.addHTML({beforePortletLoaded:p,data:P,onComplete:function(e,t){f&&f(e,t),a.list.push(e.portletId),e&&e.attr("data-qa-id","app-loaded"),Liferay.fire("addPortlet",{portlet:e})},placeHolder:s,url:m})}}),["aui-base"]),Liferay.provide(o,"addHTML",(function(a){var i=this,l=null,d=a.beforePortletLoaded,n=a.data,s="HTML",p=a.onComplete,f=a.placeHolder,c=a.url;n&&t.isString(n.dataType)&&(s=n.dataType),s=s.toUpperCase();var y=function(t){var a,o=f.get("parentNode"),d=e.Node.create("<div></div>");if(d.plug(e.Plugin.ParseContent),d.setContent(t),d=d.one("> *")){var n=d.attr("id");a=r.getPortletId(n),d.portletId=a,f.hide(),f.placeAfter(d),f.remove(),i.refreshLayout(d),window.location.hash&&(window.location.href=window.location.hash),l=d;var s=Liferay.Layout;s&&s.INITIALIZED&&(s.updateCurrentPortletInfo(l),o&&s.syncEmptyColumnClassUI(o),s.syncDraggableClassUI(),s.updatePortletDropZones(l)),p&&p(l,a)}else f.remove();return a};d&&d(f),Liferay.Util.fetch(c,{body:Liferay.Util.objectToURLSearchParams(n),method:"POST"}).then((e=>"JSON"===s?e.json():e.text())).then((e=>{"HTML"===s?y(e):e.refresh?y(e.portletHTML):(o._loadMarkupHeadElements(e),o._loadPortletFiles(e,y)),n&&n.preventNotification||Liferay.fire("updatedLayout")})).catch((e=>{var t="string"==typeof e?e:'Errore\x20Inaspettato\x2e\x20Aggiorna\x20la\x20pagina\x20corrente\x2e';Liferay.Util.openToast({message:t,type:"danger"})}))}),["aui-parse-content"]),Liferay.provide(o,"close",(function(t,r,a){if((t=e.one(t))&&(r||confirm('Sei\x20sicuro\x20di\x20voler\x20rimuovere\x20questo\x20componente\x3f'))){var i=t.portletId,l=this.list.indexOf(i);l>=0&&this.list.splice(l,1),a=o._mergeOptions(t,a),o.destroyComponents(i),Liferay.fire("destroyPortlet",a),Liferay.fire("closePortlet",a)}else e.config.win.focus()}),[]),Liferay.provide(o,"destroy",((t,a)=>{if(t=e.one(t)){var i=t.portletId||r.getPortletId(t.attr("id"));o.destroyComponents(i),Liferay.fire("destroyPortlet",o._mergeOptions(t,a))}}),["aui-node-base"]),Liferay.provide(o,"onLoad",(function(t){var a=this,o=t.canEditTitle,i=t.columnPos,l="no"==t.isStatic?null:t.isStatic,d=t.namespacedId,n=t.portletId,s=t.refreshURL,p=t.refreshURLData;l&&a.registerStatic(n);var f=e.one("#"+d);if(f&&!f.portletProcessed&&(f.portletProcessed=!0,f.portletId=n,f.columnPos=i,f.isStatic=l,f.refreshURL=s,f.refreshURLData=p,o)){var c="focus";e.UA.touchEnabled||(c=["focus","mousemove"]);var y=f.on(c,(()=>{r.portletTitleEdit({doAsUserId:themeDisplay.getDoAsUserIdEncoded(),obj:f,plid:themeDisplay.getPlid(),portletId:n}),y.detach()}))}Liferay.fire("portletReady",{portlet:f,portletId:n}),a.readyCounter++,a.readyCounter===a.list.length&&Liferay.fire("allPortletsReady",{portletId:n})}),["aui-base","aui-timer","event-move"]),Liferay.provide(o,"refresh",(function(r,a,i){if(r=e.one(r)){a=i?e.merge(r.refreshURLData||{},a||{}):a||r.refreshURLData||{},Object.prototype.hasOwnProperty.call(a,"portletAjaxable")||(a.portletAjaxable=!0);var l=r.attr("portlet"),d=r.refreshURL,n=e.Node.create('<div class="loading-animation" id="p_p_id'+l+'" />');if(a.portletAjaxable&&d){r.placeBefore(n),r.remove(!0),o.destroyComponents(r.portletId);var s={},p=d.split("?");p.length>1&&(delete(s=e.QueryString.parse(p[1])).dataType,d=p[0]),this.addHTML({data:e.mix(s,a,!0),onComplete(e,t){e.refreshURL=d,e&&e.attr("data-qa-id","app-refreshed"),Liferay.fire(e.portletId+":portletRefreshed",{portlet:e,portletId:t})},placeHolder:n,url:d})}else if(!r.getData("pendingRefresh")){r.setData("pendingRefresh",!0);var f=t.sub('<div class="alert alert-info">{0}</div>',['Questa\x20modifica\x20sarà\x20mostrata\x20solo\x20dopo\x20l\x27aggiornamento\x20della\x20pagina\x20corrente\x2e']),c=r.one(".portlet-body");c.placeBefore(f),c.hide()}}}),["aui-base","querystring-parse"]),Liferay.provide(o,"registerStatic",(function(t){var a=e.Node;a&&t instanceof a?t=t.attr("id"):t.id&&(t=t.id);var o=r.getPortletId(t);this._staticPortlets[o]=!0}),["aui-base"]),Liferay.publish("closePortlet",{defaultFn:o._defCloseFn}),Liferay.publish("allPortletsReady",{fireOnce:!0}),o.ready=function(e){Liferay.on("portletReady",(t=>{e(t.portletId,t.portlet)}))},Liferay.Portlet=o}(AUI());
//# sourceMappingURL=portlet.js.map
Liferay.Workflow={ACTION_PUBLISH:1,ACTION_SAVE_DRAFT:2,STATUS_ANY:-1,STATUS_APPROVED:0,STATUS_DENIED:4,STATUS_DRAFT:2,STATUS_EXPIRED:3,STATUS_PENDING:1};
//# sourceMappingURL=workflow.js.map
/**
 * Copyright (c) 2000-present Liferay, Inc. All rights reserved.
 *
 * This library is free software; you can redistribute it and/or modify it under
 * the terms of the GNU Lesser General Public License as published by the Free
 * Software Foundation; either version 2.1 of the License, or (at your option)
 * any later version.
 *
 * This library is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
 * details.
 */

(function () {
	const CONTAINER_REQUESTS_SYMBOL = Symbol.for(
		'__LIFERAY_WEBPACK_CONTAINER_REQUESTS__'
	);
	const CONTAINERS_SYMBOL = Symbol.for('__LIFERAY_WEBPACK_CONTAINERS__');
	const GET_MODULE_SYMBOL = Symbol.for('__LIFERAY_WEBPACK_GET_MODULE__');
	const SHARED_SCOPE_SYMBOL = Symbol.for('__LIFERAY_WEBPACK_SHARED_SCOPE__');
	const WEBPACK_HELPERS_SYMBOL = Symbol.for('__LIFERAY_WEBPACK_HELPERS__');

	window[CONTAINER_REQUESTS_SYMBOL] = window[CONTAINER_REQUESTS_SYMBOL] || {};
	window[CONTAINERS_SYMBOL] = window[CONTAINERS_SYMBOL] || {};
	window[SHARED_SCOPE_SYMBOL] = window[SHARED_SCOPE_SYMBOL] || {};

	const containerRequests = window[CONTAINER_REQUESTS_SYMBOL];
	const sharedScope = window[SHARED_SCOPE_SYMBOL];

	let inGetModule = false;
	let nextCallId = 1;
	const queuedGetModuleCalls = [];
	const serializeModuleRequests = false;

	/**
	 * Create a new container request
	 */
	function createContainerRequest(url, onLoadHandler) {
		const script = document.createElement('script');

		const containerRequest = {

			// Set to the container's exported object

			container: undefined,

			// Set if request failed

			error: undefined,

			// Set to true if the .js file has been fetched from the server

			fetched: false,

			// Set to the exported values of each module (undefined if error set)

			modules: undefined,

			// Set to the <script> DOM node while it is being retrieved (undefined after)

			script,

			// Set to an array of functions to be invoked once the <script> loads

			subscribers: [],
		};

		script.src = url;
		script.onload = () => onLoadHandler(containerRequest);

		document.head.appendChild(script);

		return containerRequest;
	}

	/**
	 * Log messages if `explain resolutions` option is turned on.
	 */
	function explain(...things) {
		if (Liferay.EXPLAIN_RESOLUTIONS) {
			// eslint-disable-next-line no-console
			console.log(...things);
		}
	}

	/**
	 * Transform a webpack chunk script file name.
	 *
	 * The webpack federation runtimes for projects built with npm-scripts
	 * delegate to this method the logic to compose the URL to retrieve the
	 * chunk files from server.
	 */
	function transformChunkScriptFilename(chunkScriptFileName) {
		return (
			chunkScriptFileName +
			'?languageId=' +
			Liferay.ThemeDisplay.getLanguageId()
		);
	}

	/**
	 * Compute container URL for a given containerId
	 */
	function getContainerURL(containerId) {

		// Strip the scope to derive the context path (this can be done because
		// our SF rules enforce a certain structure on context and package
		// names, but it is not valid for the general case).

		if (containerId[0] === '@') {
			const i = containerId.indexOf('/');

			containerId = containerId.substr(i + 1);
		}

		return (
			'/o/' +
			containerId +
			'/__generated__/container.js?languageId=' +
			Liferay.ThemeDisplay.getLanguageId()
		);
	}

	/**
	 * Fetch a container
	 */
	function fetchContainer(callId, containerId, resolve, reject) {
		if (containerRequests[containerId]) {
			throw new Error(
				`A request is already registered for container ${containerId}`
			);
		}

		const url = getContainerURL(containerId);

		explain(callId, 'Fetching container from URL', url);

		containerRequests[containerId] = createContainerRequest(
			url,
			(containerRequest) => {
				explain(callId, 'Fetched container', containerId);

				const container = getContainer(containerId);

				if (container) {
					explain(
						callId,
						'Initializing container with scope:\n',
						'   ',
						Object.entries(sharedScope)
							.map(
								([name, data]) =>
									`${name}: ` +
									Object.entries(data).map(
										([version, data]) =>
											`(${version}: ${data.from})`
									)
							)
							.join('\n     ')
					);

					Promise.resolve(container.init(sharedScope))
						.then(() =>
							finalizeContainerRequest(
								callId,
								containerRequest,
								container
							)
						)
						.catch(reject);
				}
				else {
					const message =
						`Container ${containerId} was fetched but its script ` +
						`failed to register with Liferay`;

					console.warn(message);

					finalizeContainerRequest(
						callId,
						containerRequest,
						new Error(message)
					);
				}
			}
		);

		explain(callId, 'Subscribing to container request');

		subscribeContainerRequest(
			containerRequests[containerId],
			resolve,
			reject
		);
	}

	/**
	 * Finalize an ongoing container request: set its result (error or
	 * container object) and notify all pending subscribers.
	 */
	function finalizeContainerRequest(callId, containerRequest, result) {
		const {script, subscribers} = containerRequest;

		containerRequest.fetched = true;
		containerRequest.script = undefined;
		containerRequest.subscribers = undefined;

		if (result instanceof Error) {
			explain(
				callId,
				'Rejecting container',
				script.src,
				'for',
				subscribers.length,
				'subscribers'
			);

			containerRequest.error = result;

			subscribers.forEach(({reject}) => reject(result));
		}
		else {
			explain(
				callId,
				'Resolving container',
				script.src,
				'for',
				subscribers.length,
				'subscribers'
			);

			containerRequest.container = result;
			containerRequest.modules = {};

			subscribers.forEach(({resolve}) => resolve(result));
		}
	}

	/**
	 * Get a defined container object
	 */
	function getContainer(containerId) {
		if (containerId[0] === '@') {
			containerId = containerId.substr(1).replace('/', '!');
		}

		return window[CONTAINERS_SYMBOL][containerId];
	}

	/**
	 * Get a module (like require for webpack federation)
	 */
	function getModule(moduleName, caller) {

		// Queue this call for later resolution if needed

		if (serializeModuleRequests) {
			if (inGetModule) {
				return new Promise((resolve, reject) => {
					queuedGetModuleCalls.push(() =>
						getModule(moduleName, caller)
							.then(resolve)
							.catch(reject)
					);
				});
			}
			else {
				inGetModule = true;
			}
		}

		const callId = `[${nextCallId++}]`;

		caller = caller || `[${new Error().stack.split('\n')[1]}]`;

		explain(callId, 'Getting module', moduleName, 'for', caller);

		return new Promise((resolve, reject) => {
			const {containerId, path} = splitModuleName(moduleName);

			const dispatchNextQueuedCall = () => {
				if (!serializeModuleRequests) {
					return;
				}

				inGetModule = false;

				if (queuedGetModuleCalls.length) {
					setTimeout(queuedGetModuleCalls.shift(), 0);
				}
			};

			const resolveGetModuleCall = () => {
				const containerRequest = containerRequests[containerId];
				const {modules} = containerRequest;
				const module = modules[path];

				if (module) {
					explain(callId, 'Resolving cached module');

					resolve(module);

					dispatchNextQueuedCall();
				}
				else {
					const {container} = containerRequest;

					explain(callId, 'Getting module from container');

					Promise.resolve(container.get(path))
						.then((moduleFactory) => {
							const module = moduleFactory();

							modules[path] = module;

							return module;
						})
						.then((module) => {
							explain(callId, 'Resolving module');

							resolve(module);

							dispatchNextQueuedCall();
						})
						.catch((error) => {
							explain(callId, 'Rejecting module', error);

							reject(error);

							dispatchNextQueuedCall();
						});
				}
			};

			const containerRequest = containerRequests[containerId];

			if (containerRequest) {
				const {fetched} = containerRequest;

				if (!fetched) {
					explain(callId, 'Subscribing to container request');

					subscribeContainerRequest(
						containerRequest,
						resolveGetModuleCall,
						reject
					);

					return;
				}

				const {error} = containerRequest;

				if (error) {
					explain(callId, 'Rejecting with error', error);

					reject(error);

					return;
				}

				resolveGetModuleCall();
			}
			else {
				fetchContainer(
					callId,
					containerId,
					resolveGetModuleCall,
					reject
				);
			}
		});
	}

	/**
	 * Split a module name in its `containerId` and `path` parts
	 */
	function splitModuleName(moduleName) {
		let i = moduleName.indexOf('/');

		// Skip first / for scoped packages

		if (moduleName[0] === '@') {
			i = moduleName.indexOf('/', i + 1);
		}

		let containerId, path;

		if (i === -1) {
			containerId = moduleName;
			path = '.';
		}
		else {
			containerId = moduleName.substring(0, i);
			path = moduleName.substring(i + 1);
		}

		return {containerId, path};
	}

	/**
	 * Subscribe to a container request (to be notified when the <script>
	 * finishes loading)
	 */
	function subscribeContainerRequest(containerRequest, resolve, reject) {
		containerRequest.subscribers.push({reject, resolve});
	}

	window[GET_MODULE_SYMBOL] = getModule;
	window[WEBPACK_HELPERS_SYMBOL] = {
		transformChunkScriptFilename,
	};
})();

