//\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
// TypeScript support for Blazor-WASM application | Author: Sergei Y.Kitaev
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Instance base class for SPA-page:
class PageBase {
    constructor() {
        this.WithSelectInputFocusRestoring = false;
        PageBase._CurrentPage_ = this;
    }
    SaveFocus(withSelectRestoring = false) {
        return this.SaveFocusExplicit(HDoc.FocusedElement());
    }
    SaveFocusExplicit(element, withSelectRestoring = false) {
        this.SavedFocus = element;
        this.WithSelectInputFocusRestoring = HOps.BoolDefaultFalse(withSelectRestoring);
        return !!this.SavedFocus;
    }
    RestoreFocus() {
        let element = this.SavedFocus;
        if (!element)
            return false;
        if (this.WithSelectInputFocusRestoring)
            HElement.DeferredFocusSelect(element);
        else
            HElement.DeferredFocus(element);
        this.ResetSavedFocus();
        return true;
    }
    ResetSavedFocus() {
        let rslt = this.SavedFocus != null;
        this.SavedFocus = null;
        this.WithSelectInputFocusRestoring = false;
        return rslt;
    }
    SaveScrolling() {
        this.SavedScrollLeft = Magistral.GetScrollLeft();
        this.SavedScrollTop = Magistral.GetScrollTop();
        return true;
    }
    RestoreScrolling() {
        let scrollLeft = this.SavedScrollLeft;
        let scrollTop = this.SavedScrollTop;
        if (scrollLeft == null && scrollTop == null)
            return false;
        Page.DeferredScrollTo(scrollLeft, scrollTop);
        this.ResetSavedScrolling();
        return true;
    }
    ResetSavedScrolling() {
        this.SavedScrollLeft = null;
        this.SavedScrollTop = null;
        return true;
    }
    static HasCurrentPage() {
        return !!PageBase.CurrentPage();
    }
    static CurrentPage() {
        return PageBase._CurrentPage_;
    }
    static ResetCurrentPage() {
        PageBase._CurrentPage_ = null;
    }
} // PageBase
//==================================================================================================
// PageBase — INITIALIZATION:
//--------------------------------------------------------------------------------------------------
//==================================================================================================
// PageBase — FUNCTIONS:
//--------------------------------------------------------------------------------------------------
function PageBase_ResetCurrentPage() {
    PageBase.ResetCurrentPage();
}
function PageBase_SaveFocus(withSelectRestoring = false) {
    let curr = PageBase.CurrentPage();
    return curr ? curr.SaveFocus(withSelectRestoring) : false;
}
function PageBase_SaveFocusExplicit(element, withSelectRestoring = false) {
    let curr = PageBase.CurrentPage();
    return curr ? curr.SaveFocusExplicit(element, withSelectRestoring) : false;
}
function PageBase_RestoreFocus() {
    let curr = PageBase.CurrentPage();
    return curr ? curr.RestoreFocus() : false;
}
function PageBase_ResetSavedFocus() {
    let curr = PageBase.CurrentPage();
    return curr ? curr.ResetSavedFocus() : false;
}
function PageBase_SaveScrolling() {
    let curr = PageBase.CurrentPage();
    return curr ? curr.SaveScrolling() : false;
}
function PageBase_RestoreScrolling() {
    let curr = PageBase.CurrentPage();
    return curr ? curr.RestoreScrolling() : false;
}
function PageBase_ResetSavedScrolling() {
    let curr = PageBase.CurrentPage();
    return curr ? curr.ResetSavedScrolling() : false;
}
//==================================================================================================
//# sourceMappingURL=!PageBase.js.map