/**
 * pacem v0.51.10-faraday (https://js.pacem.it)
 * Copyright 2025 Pacem (https://pacem.it)
 * Licensed under Apache-2.0
 */
declare namespace Pacem.Cms {
    interface Permission {
        claimType: string;
        claimValue: string;
        translate: boolean;
        read: boolean;
        update: boolean;
        create: boolean;
        delete: boolean;
    }
    const PermissionEditEventName = "permissionedit";
    class PermissionEditEvent extends CustomEvent<Permissible> {
        constructor(permissible: Permissible);
    }
    interface Permissible {
        permissions: Permission[];
    }
    type Claims = {
        [name: string]: string[];
    };
    class Permissible {
        static canEdit(claims: Claims, resource: Permissible): boolean;
        static canRead(claims: Claims, resource: Permissible): boolean;
        static canAdd(claims: Claims, resource: Permissible): boolean;
        static canDelete(claims: Claims, resource: Permissible): boolean;
        static canTranslate(claims: Claims, resource: Permissible): boolean;
        private static _canDoSomethingToResource;
    }
}
declare namespace Pacem.Cms.OpenApi {
    interface StorageCache {
        getPropertyValue: (name: string) => any;
        setPropertyValue: (name: string, value: any, persistent?: boolean) => void;
        removeProperty: (name: string) => void;
    }
    export class SwaggerCmsParser {
        private _openApi;
        constructor(_openApi?: Scaffolding.OpenApi.OpenApiParser);
        cache: StorageCache;
        load(url: string, headers?: {
            [name: string]: string;
        }): Promise<Pacem.Scaffolding.OpenApi.ApiManifest>;
        private _enrichSchemas;
        private _cachedMetadataUrls;
        clearCache(): void;
        /**
         *
         * @param def1
         * @param headers HTTP headers for API fetching
         */
        private _fetchMetadata;
    }
    export {};
}
declare namespace Pacem.Components.Cms {
    /** Function container proxy (used in metadata) */
    const Functions: {
        [key: string]: Function;
    };
    /** Default metadata ('expression' field) 'type' factory. */
    const EXPRESSION_METADATA_TYPE: (host: Pacem.Components.Scaffolding.PacemFormFieldElement, hostRef?: string, hostEntityRef?: string) => {
        tagName: string;
        attrs: {
            [name: string]: string;
        };
    };
}
declare namespace Pacem.Components.Cms {
    abstract class PacemElementPickerElementBase extends Pacem.Components.Scaffolding.PacemBaseElement {
        selector: string;
        filter: (e: Element) => boolean;
        labeler: (e: Element) => string;
    }
    class PacemElementPickerElement extends PacemElementPickerElementBase {
        protected get inputFields(): HTMLElement[];
        protected toggleReadonlyView(readonly: boolean): void;
        protected onChange(_?: Event): PromiseLike<any>;
        protected acceptValue(val: any): void;
        protected getViewValue(value: any): string;
        protected convertValueAttributeToProperty(attr: string): any;
        private _select;
        viewActivatedCallback(): void;
        propertyChangedCallback(name: string, old: any, val: any, first?: boolean): void;
        private _databind;
    }
}
declare namespace Pacem.Components.Cms {
    enum ExpressionSource {
        Constant = "const",
        PropertyReference = "property",
        Expression = "expr"
    }
    class PacemExpressionElement extends PacemElementPickerElementBase {
        converter: PropertyConverter;
        private _editing;
        private _source;
        private _sourceRef;
        private _propRef;
        private _picker;
        private _editor;
        private _view;
        private _eval;
        propertyChangedCallback(name: string, old: any, val: any, first?: boolean): void;
        protected get inputFields(): HTMLElement[];
        protected toggleReadonlyView(readonly: boolean): void;
        setPristine(): void;
        protected onChange(_?: Event): PromiseLike<any>;
        protected acceptValue(val: any): void;
        private _setFeedbackText;
        protected getViewValue(value: any): string;
        protected convertValueAttributeToProperty(attr: string): string;
        private _reverseStructure;
    }
}
declare namespace Pacem.Components.Cms {
    const DEFAULT_METADATA: Pacem.Scaffolding.TypeMetadata;
    function gridifyMetadata(metadata?: Pacem.Scaffolding.TypeMetadata): Pacem.Scaffolding.TypeMetadata;
    function buildWidgetMetadata(metadata?: Pacem.Scaffolding.TypeMetadata): Pacem.Scaffolding.TypeMetadata;
    /** Default metadata ('expression' field) 'extra' object. */
    const EXPRESSION_WIDGET_METADATA_EXTRA: {
        selector: string;
        labeler: (e: Widget) => string;
    };
    interface Widget extends Pacem.Cms.Permissible {
        metadata: Pacem.Scaffolding.TypeMetadata;
        permissionMetadata: Pacem.Scaffolding.TypeMetadata;
        /** Gets or sets whether the widget is currently in editing mode. */
        editing: boolean;
        /** Gets or sets whether thet widget might be edited or not. */
        editable: boolean;
        tag: string;
        readonly id: string;
    }
    class Widget {
        /**
         * Utility method for widget gathering.
         * @param predicate Predicate for filtering
         */
        static findAll(predicate?: (w: PacemWidgetElement) => boolean): PacemWidgetElement[];
    }
    class PacemWidgetToolbarElement extends PacemElement {
        target: PacemWidgetElement;
        private _toolbar;
        private _btnEdit;
        private _btnPerms;
        private _btnRemove;
        private _proxy;
        /** Gets the toolbar's edit button. */
        get editButton(): UI.PacemButtonElement;
        /** Gets the toolbar's permimssions button. */
        get permissionsButton(): UI.PacemButtonElement;
        /** Gets the toolbar's remove button. */
        get removeButton(): UI.PacemButtonElement;
        private _edit;
        private _editPermissions;
        private _popoutJustInCase;
    }
    abstract class PacemWidgetElement extends PacemElement implements Widget {
        constructor(metadata: Pacem.Scaffolding.TypeMetadata, role?: string);
        connectedCallback(): void;
        propertyChangedCallback(name: string, old: any, val: any, first?: boolean): void;
        viewActivatedCallback(): void;
        disconnectedCallback(): void;
        private _assignIcon;
        private _balloon;
        private _ensureBalloon;
        private _disposeBalloon;
        /** Gets or sets whether the widget is currently in editing mode. */
        editing: boolean;
        editable: boolean;
        tag: string;
        permissions: Pacem.Cms.Permission[];
        metadata: Pacem.Scaffolding.TypeMetadata;
        permissionMetadata: Pacem.Scaffolding.TypeMetadata;
    }
}
declare namespace Pacem.Components.Cms {
    const FETCH_CREDENTIALS_METADATA: Pacem.Scaffolding.PropertyMetadata;
    const ACCESS_TOKEN_METADATA: Pacem.Scaffolding.PropertyMetadata;
    abstract class PacemBearerWidgetElement extends PacemWidgetElement implements Pacem.Net.OAuthFetchable {
        fetchCredentials: RequestCredentials;
        fetchHeaders: {
            [key: string]: string;
        };
        accessToken: {
            [key: string]: string;
        };
        fetching: boolean;
        propertyChangedCallback(name: string, old: any, val: any, first?: boolean): void;
    }
}
declare namespace Pacem.Components.Cms {
    class PacemWidgetApiManifestElement extends PacemBearerWidgetElement {
        private _openapi;
        private _cache;
        constructor(_openapi?: Pacem.Cms.OpenApi.SwaggerCmsParser, _cache?: Storage);
        url: string;
        usecache: boolean;
        manifest: Pacem.Scaffolding.OpenApi.ApiManifest;
        propertyChangedCallback(name: string, old: any, val: any, first?: boolean): void;
        viewActivatedCallback(): void;
        private _scaffold;
    }
}
declare namespace Pacem.Components.Cms {
    class PacemWidgetClockElement extends PacemWidgetElement {
        constructor();
        interval: number;
        time: number;
    }
}
declare namespace Pacem.Components.Cms {
    class PacemWidgetDataElement extends PacemWidgetElement {
        constructor();
        model: any;
    }
}
declare namespace Pacem.Components.Cms {
    class PacemWidgetFetchParameterElement extends PacemEventTarget {
        private _fetcher;
        required: boolean;
        name: string;
        value: any;
        propertyChangedCallback(name: string, old: any, val: any, first?: boolean): void;
        viewActivatedCallback(): void;
    }
    class PacemWidgetFetchElement extends PacemBearerWidgetElement {
        constructor();
        manifest: Pacem.Scaffolding.OpenApi.ApiManifest;
        endpoint: Pacem.Scaffolding.OpenApi.ApiEndpoint;
        url: string;
        method: Pacem.Net.HttpMethod;
        fields: Pacem.Scaffolding.TypeMetadata | Pacem.Scaffolding.PropertyMetadata[];
        parameters: any[];
        result: any[];
        fetching: boolean;
        success: boolean;
        failure: boolean;
        private _fetcher;
        private _itemsElement;
        private _onerror;
        private _onsuccess;
        private _onresult;
        get _parameters(): PacemWidgetFetchParameterElement[];
        fetch(): Promise<Response>;
        viewActivatedCallback(): void;
        propertyChangedCallback(name: string, old: any, val: any, first?: boolean): void;
        private _mergeEndpoint;
    }
}
declare namespace Pacem.Components.Cms {
    class PacemWidgetTranslatorElement extends PacemWidgetElement {
    }
}
declare namespace Pacem.Cms {
    interface DataColumn {
        header: string;
        /** expression, constant, ... */
        content: string;
        width?: number | 'auto';
    }
}
declare namespace Pacem.Components.Cms {
    /** Default metadata ('expression' field) 'type' factory. */
    const DATACOLUMNS_METADATA_TYPE: (host: Pacem.Components.Scaffolding.PacemFormFieldElement, hostRef?: string, hostEntityRef?: string) => {
        tagName: string;
        attrs: {
            [name: string]: string;
        };
    };
    class PacemDataColumnElement extends PacemElement {
        header: string;
        content: string;
        contentExpression: string;
        private _form;
        propertyChangedCallback(name: string, old: any, val: any, first?: boolean): void;
        viewActivatedCallback(): void;
    }
    class PacemDataColumnsElement extends Pacem.Components.Scaffolding.PacemBaseElement {
        private _repeater;
        private _propDragger;
        private _colDragger;
        private _dropTarget;
        properties: Partial<Pacem.Scaffolding.PropertyMetadata>[];
        protected get inputFields(): HTMLElement[];
        protected toggleReadonlyView(readonly: boolean): void;
        protected onChange(evt?: Event): PromiseLike<any>;
        protected acceptValue(val: any): void;
        protected getViewValue(value: any): string;
        protected convertValueAttributeToProperty(attr: string): any;
        private _dropHandler;
        viewActivatedCallback(): void;
        disconnectedCallback(): void;
        private _columnifyMetadata;
    }
}
declare namespace Pacem.Components.Cms {
    abstract class PacemUiWidgetElement extends PacemWidgetElement {
        constructor(metadata: Pacem.Scaffolding.TypeMetadata, colspan?: number, role?: string);
        connectedCallback(): void;
        propertyChangedCallback(name: string, old: any, val: any, first?: boolean): void;
        private _container;
        protected get container(): PacemCompositeWidgetElement;
        /** @overridable */
        protected findContainer(): PacemCompositeWidgetElement;
        viewActivatedCallback(): void;
        disconnectedCallback(): void;
        /** Default configuration (grid) */
        column: number;
        row: number;
        colspan: number;
        rowspan: number;
        borders: boolean;
        corners: boolean;
    }
    interface CompositeWidget extends ItemsContainer<PacemUiWidgetElement> {
        readonly itemsElement: Element;
        register(item: PacemUiWidgetElement): boolean;
        unregister(item: PacemUiWidgetElement): boolean;
    }
    const WidgetRegisterEventName = "widgetregister";
    const WidgetUnregisterEventName = "widgetunregister";
    const LayoutChangeEventName = "layoutchange";
    class WidgetRegisterEvent extends CustomEvent<PacemWidgetElement> {
        constructor(item: PacemWidgetElement, eventInit?: EventInit);
    }
    class WidgetUnregisterEvent extends CustomEvent<PacemWidgetElement> {
        constructor(item: PacemWidgetElement, eventInit?: EventInit);
    }
    abstract class PacemCompositeWidgetElement extends PacemUiWidgetElement implements CompositeWidget {
        items: PacemUiWidgetElement[];
        get itemsElement(): this;
        protected validate(item: PacemUiWidgetElement): boolean;
        viewActivatedCallback(): void;
        /**
         * Appends a child Element to this CompositeWidget's itemsElement.
         * @param item New child element
         */
        appendItem(item: Element): void;
        /**
         * Registers a new item among the items.
         * @param item {PacemUiWidgetElement} Item to be enrolled
         */
        register(item: PacemUiWidgetElement): boolean;
        /**
         * Removes an existing element from the items.
         * @param item {PacemUiWidgetElement} Item to be removed
         */
        unregister(item: PacemUiWidgetElement): boolean;
    }
}
declare namespace Pacem.Components.Cms {
    class PacemWidgetTextElement extends PacemUiWidgetElement {
        constructor();
        text: string;
    }
}
declare namespace Pacem.Components.Cms {
    const GRID_COLUMNS = 12;
    class PacemGridWidgetElement extends PacemCompositeWidgetElement {
        constructor();
        register(item: PacemUiWidgetElement): boolean;
        unregister(item: PacemUiWidgetElement): boolean;
        private _widgetPropertyChange;
        unit: number;
        marginTop: number;
        marginBottom: number;
        columns: number;
        rows: number;
        minRowheight: number | 'string';
        rowheight: number | 'string';
        rowGap: number;
        columnGap: number;
        private _dragDrop;
        private _rescaler;
        private _initState;
        private _dragDropHandler;
        private _resizeHandler;
        private _intersects;
        connectedCallback(): void;
        viewActivatedCallback(): void;
        propertyChangedCallback(name: string, old: any, val: any, first?: boolean): void;
        disconnectedCallback(): void;
        private _normalize;
        protected unitPixels(qty: number): number;
        protected adapt(): void;
        private _gridBoxes;
        private _setGridLines;
    }
}
declare namespace Pacem.Components.Cms {
    /**
     * UI widget container that eases dragdrop-based enrollment into composite widgets.
     */
    class PacemWidgetPickerElement extends PacemCompositeWidgetElement {
        register(item: PacemUiWidgetElement): boolean;
        private _dragDrop;
    }
}
declare namespace Pacem.Components.Cms {
    class PacemWidgetDataGridElement extends PacemUiWidgetElement {
        constructor();
        columns: Pacem.Cms.DataColumn[];
        datasource: any[];
        datarowMetadata: Partial<Pacem.Scaffolding.PropertyMetadata>[];
        _datatable: HTMLElement;
        _template: HTMLTemplateElement;
        _repeater: PacemRepeaterElement;
        private _gridify;
        propertyChangedCallback(name: string, old: any, val: any, first?: boolean): void;
        viewActivatedCallback(): void;
        private _seekArray;
        private _builtUponDatasource;
        private _extractMetadataJustInCase;
    }
}
