window.treeviewStorage = {
    save: function (storageKey, keysJson) {
        sessionStorage.setItem("treeview:" + storageKey, keysJson);
    },
    load: function (storageKey) {
        return sessionStorage.getItem("treeview:" + storageKey);
    },
    // Blazor cannot bind input.indeterminate natively (only `checked`). The
    // TreeView's Checkbox-selection mode calls this from OnAfterRenderAsync to
    // toggle the tri-state visual on each render.
    setIndeterminate: function (el, value) {
        if (el) {
            el.indeterminate = !!value;
        }
    }
};
