import { TemplateResult, nothing } from 'lit';
import { StyleInfo } from 'lit/directives/style-map.js';
import { IFile, IUser, AccessOperation, PermissionRole, IPermission, IApplication, FilePatchBroadcastEvent } from '@api-client/core/build/browser.js';
import UiDialog from '../../ui/dialog/UiDialog.js';
import UiListbox from '../../ui/list/UiListbox.js';
import '../../define/ui/ui-listbox.js';
import '../../define/ui/ui-list-item.js';
import '../../define/ui/ui-list.js';
import '../../define/ui/ui-button.js';
import '../../define/ui/ui-icon.js';
import '../../define/ui/ui-chip.js';
import '../../define/ui/ui-divider.js';
import '../../define/ui/ui-dropdown-list.js';
import '../../define/user/user-avatar.js';
/**
 * A dialog that shows users that the file is shared with and allows to share a file.
 *
 * Listen to the `closed` on the dialog. The CustomEvent has the `detail`
 * object with the `closingReason` retails:
 * - canceled: whether the dialog was cancelled (ESC, outside click, dismiss button)
 * - confirmed: whether the dialog was confirmed by the user
 *
 * ```javascript
 * const dialog = document.createElement('share-file');
 * dialog.key = 'file key';
 * // or
 * dialog.file = file;
 * dialog.appInfo="${AppInfo}"
 * dialog.user="${currentUser}"
 * dialog.opened = true;
 * document.body.appendChild(dialog);
 * dialog.addEventListener('closed', (ev: Event) => {
 *   document.body.removeChild(dialog);
 * });
 * ```
 */
export default class ShareFile extends UiDialog {
    private keyInternal?;
    /**
     * The key of the file to share.
     */
    get key(): string | undefined;
    set key(value: string | undefined);
    protected fileInternal?: IFile;
    /**
     * When known, set this instead of the `key` to skip requesting the file info.
     * Also, when file is set and then the `key` is set the HTTP request won't be made.
     */
    get file(): IFile | undefined;
    set file(value: IFile | undefined);
    /**
     * The current user to filter out the user from the suggestions and the shared list.
     */
    user?: IUser;
    /**
     * This property is required for the API access to work.
     * Set it to the current application information.
     *
     * It will throw an error when trying to patch access without setting this property.
     */
    appInfo?: IApplication;
    /**
     * A flag set when requesting the the file meta
     */
    protected loadingFile: boolean;
    /**
     * A flag set when requesting the current list of users for the file.
     */
    protected loadingFileUsers: boolean;
    /**
     * Computed value of whether currently loading file or file users.
     */
    get loading(): boolean;
    protected readonly input: HTMLInputElement;
    protected readonly suggestionsContainer: HTMLDivElement;
    protected readonly suggestionsList: UiListbox;
    /**
     * The list of users to render in the suggestion box.
     */
    protected userSuggestions?: IUser[];
    /**
     * Whether the suggestion box is opened.
     */
    protected suggestionsOpened: boolean;
    /**
     * The list of users that were selected by the users to share the file with.
     */
    protected selectedUsers?: IUser[];
    /**
     * The list of users that have permission to the file read from the store
     * when the component was initializing.
     */
    protected permissionUsers: IUser[];
    /**
     * A list of permissions to set on the users after the user confirms the change.
     * These are pending changes and only populated when the user changes any of the roles of
     * an existing user.
     */
    protected pendingPermissions?: AccessOperation[];
    /**
     * The last user query sent to the server. Used by the suggestions logic.
     */
    protected lastUserQuery?: string;
    /**
     * Computed value telling whether the main input should be disabled for the current state.
     */
    protected get inputDisabled(): boolean;
    /**
     * Computed value whether there are selected users
     */
    get hasSelectedUsers(): boolean;
    /**
     * Whether there are pending permissions to be set.
     */
    get hasPending(): boolean;
    protected get fileId(): string;
    filesChannel: BroadcastChannel;
    /**
     * Computed positioning styles for the suggestion box.
     */
    protected suggestionStyles?: StyleInfo;
    protected selectedRole: PermissionRole;
    constructor();
    connectedCallback(): void;
    disconnectedCallback(): void;
    protected fileMetaMessageHandler(e: MessageEvent): void;
    protected handleFilePatch(event: FilePatchBroadcastEvent): void;
    protected processFileKey(value?: string): void;
    protected requestFileInfo(key: string): Promise<void>;
    protected requestFileUsers(key: string): Promise<void>;
    protected handleInput(e: Event): void;
    protected handleKeydown(event: KeyboardEvent): void;
    protected handleSuggestionSelect(e: CustomEvent): void;
    protected selectUserSuggestion(key: string): void;
    protected deselectUserSuggestion(key: string): void;
    protected handleUserChipRemove(e: Event): void;
    protected removeLastSelectedUser(): void;
    protected queryUsers(q: string): Promise<void>;
    protected toggleSuggestions(opened: boolean): void;
    protected getUserEmail(user: IUser): string | undefined;
    protected handleRoleOption(e: CustomEvent): void;
    protected cancelShareUser(): void;
    protected handleShare(): void;
    protected share(role: PermissionRole): Promise<void>;
    protected handleRoleChangeOption(e: CustomEvent): void;
    protected handleCommitChanges(): Promise<void>;
    renderIcon(): TemplateResult;
    renderTitle(): TemplateResult;
    renderBody(): TemplateResult;
    renderButtons(): TemplateResult;
    protected overviewActionsTemplate(): TemplateResult;
    protected selectedUsersActionsTemplate(): TemplateResult;
    protected pendingActionsTemplate(): TemplateResult;
    protected userInputTemplate(): TemplateResult;
    protected renderInput(): TemplateResult;
    protected renderAutocomplete(): TemplateResult;
    /**
     * @returns The template for the suggestions list.
     */
    protected renderSuggestionList(): TemplateResult[] | string;
    /**
     * @returns The template for an URL suggestion item.
     */
    protected renderSuggestionItem(user: IUser): TemplateResult;
    protected renderSelectedUserChips(): TemplateResult | string;
    protected renderUserChip(user: IUser): TemplateResult;
    protected roleSelectorTemplate(): TemplateResult | string;
    protected renderCurrentUsers(): TemplateResult | string;
    protected renderUserPermission(permission: IPermission): TemplateResult | typeof nothing;
    protected permissionRoleTemplate(role: PermissionRole, userId: string): TemplateResult;
    protected roleItemTemplate(role: PermissionRole, userRole: PermissionRole): TemplateResult;
}
//# sourceMappingURL=ShareFile.element.d.ts.map