import * as lit_html from 'lit-html';
import * as lit from 'lit';
import { LitElement, nothing } from 'lit';
import { Configure } from 'configure';

/**
 * Base class for all Configure Web Components.
 * Provides shared SDK wiring, design tokens, and event helpers.
 */
declare class ConfigureBase extends LitElement {
    apiKey: string;
    baseUrl: string;
    authToken: string;
    userId: string;
    agent: string;
    agentName: string;
    agentLogo: string;
    font: string;
    presentation: 'card' | 'bare';
    theme: string;
    protected _client: Configure | null;
    static baseStyles: lit.CSSResult;
    protected get hasApiKey(): boolean;
    protected renderApiKeyNotice(): typeof nothing | lit_html.TemplateResult<1>;
    protected get client(): Configure;
    protected updated(changed: Map<string, unknown>): void;
    connectedCallback(): void;
    disconnectedCallback(): void;
    private _handleAuth;
    protected _openOAuthPopup(url: string): Window | null;
    protected emit<T>(name: string, detail: T): void;
}

declare class ConfigurePhoneInput extends ConfigureBase {
    loading: boolean;
    error: string;
    disabled: boolean;
    agent: string;
    loginHint: string;
    private _rawDigits;
    private _formatted;
    private _selectedCountry;
    private _showPicker;
    private _pickerSearch;
    private _invalid;
    private _input;
    private _pickerInput;
    private _clickOutsideHandler?;
    connectedCallback(): void;
    disconnectedCallback(): void;
    updated(changed: Map<string, unknown>): void;
    static styles: lit.CSSResult[];
    private _format;
    private _applyLoginHint;
    private _getPlaceholder;
    private _isValid;
    private _getE164;
    private _handleInput;
    private _handleKeydown;
    private _handleBlur;
    private _handleFocus;
    private _submit;
    private _togglePicker;
    private _selectCountry;
    private _handlePickerSearch;
    private _filteredCountries;
    private _addClickOutside;
    private _removeClickOutside;
    render(): lit_html.TemplateResult<1>;
}

declare class ConfigureOtpInput extends ConfigureBase {
    phone: string;
    externalId: string;
    embedFlow: boolean;
    loading: boolean;
    error: string;
    private _code;
    private _canResend;
    private _countdown;
    private _hiddenInput;
    private _timer?;
    static styles: lit.CSSResult[];
    private _otpAbort?;
    connectedCallback(): void;
    disconnectedCallback(): void;
    firstUpdated(): Promise<void>;
    private _tryWebOTP;
    private _startCountdown;
    private _handleInput;
    private _handleKeydown;
    private _focusInput;
    private _resend;
    render(): lit_html.TemplateResult<1>;
}

interface AuthenticatedDetail {
    token: string;
    userId?: string;
}
interface PhoneSubmitDetail {
    phone: string;
}
interface OtpVerifyDetail {
    code: string;
}
interface ToolConnectDetail {
    tool: string;
}
interface ToolDisconnectDetail {
    tool: string;
}
interface ToolApprovalDetail {
    actionId: string;
}
interface MemoryEditDetail {
    key: string;
}
interface MemoryDeleteDetail {
    key: string;
}
interface IdentityUpdateDetail {
    field: string;
    value: string;
}
interface ErrorDetail {
    message: string;
    code?: string;
}
interface ConnectionData {
    id: string;
    name: string;
    connected: boolean;
    loading?: boolean;
}
interface MemoryData {
    key: string;
    value: string;
}
interface ToolApprovalParams {
    to?: string;
    subject?: string;
    body?: string;
    title?: string;
    start_time?: string;
    end_time?: string;
    location?: string;
    description?: string;
}
interface ConfirmationDetail {
    confirmed: boolean;
}
type ExportProvider = 'chatgpt' | 'claude' | 'gemini';
interface ExportClickDetail {
    provider: string;
}
interface ImportStartDetail {
    provider: string;
    stageId: string;
}
interface ImportCompleteDetail {
    provider: string;
    source: string;
}
interface ImportErrorDetail {
    message: string;
    phase: 'stage' | 'auth' | 'claim' | 'processing';
}
interface PromptCopiedDetail {
    prompt: string;
}
interface ProfileApprovedDetail {
    userId: string;
    agent: string;
    approvedCategories?: string[];
    subtitle?: string;
}
interface OtpVerifiedDetail {
    token: string;
    userId: string;
    phone: string;
}
interface AccessRequestDetail {
    tool: string;
    agent: string;
}
interface PersonalizationOpenDetail {
    agent: string;
    agentName?: string;
}
interface PersonalizationAssetSelectDetail {
    agent: string;
    agentName?: string;
}
interface PersonalizationMenuToggleDetail {
    open: boolean;
}

declare class ConfigureConnectionRow extends ConfigureBase {
    name: string;
    toolId: string;
    connected: boolean;
    loading: boolean;
    userScoped: boolean;
    private _connectionRequestId;
    private _error;
    private _pollTimer?;
    private _visibilityHandler?;
    private _focusHandler?;
    private _pageshowHandler?;
    private _polling;
    static styles: lit.CSSResult[];
    disconnectedCallback(): void;
    updated(changed: Map<string, unknown>): void;
    private get _pendingKey();
    private _storePendingConnection;
    private _clearPendingConnection;
    private _restorePendingConnection;
    private _stopPolling;
    private _friendlyError;
    private _handleClick;
    private _connectUserScoped;
    private _confirmConnection;
    private _requestUserTool;
    private _isPendingOAuthError;
    private _markConnected;
    private _startPolling;
    render(): lit_html.TemplateResult<1>;
}

declare class ConfigureExportButton extends ConfigureBase {
    provider: string;
    prompt: string;
    label: string;
    static styles: lit.CSSResult[];
    private get _url();
    private get _label();
    private _handleClick;
    render(): lit_html.TemplateResult<1>;
}

declare class ConfigureExportPrompt extends ConfigureBase {
    prompt: string;
    private _copied;
    static styles: lit.CSSResult[];
    private get _prompt();
    private _handleCopy;
    render(): lit_html.TemplateResult<1>;
}

declare class ConfigureMemoryImport extends ConfigureBase {
    providers: string;
    agent: string;
    sectionLabel: string;
    importedProviders: string;
    embedded: boolean;
    private _phase;
    private _selectedProvider;
    private _stageId;
    private _pasteValue;
    private _phone;
    private _errorMessage;
    private _importSource;
    private _claimedStage;
    private _statusTimer?;
    private _statusInFlight;
    private _baselineImportMarker;
    private _claimedAt;
    static styles: lit.CSSResult[];
    connectedCallback(): void;
    disconnectedCallback(): void;
    updated(changed: Map<string, unknown>): void;
    private get _apiBase();
    private get _isAuthenticated();
    private get _providerList();
    private get _storageKey();
    private _providerName;
    private _providerUrl;
    private _importedSet;
    private _restoreDraft;
    private _persistDraft;
    private _selectProvider;
    private _handlePasteInput;
    private _focusPaste;
    private _onFocus;
    private _onVisibility;
    private _resumeImportStatus;
    private _handleSubmit;
    private _claim;
    private _pollStatus;
    private _stopStatusPolling;
    private _importMarker;
    private _currentImportMarker;
    private _profileShowsFreshImportedSource;
    private _claimedImportExpired;
    private _expireClaimedImport;
    private _completeImport;
    private _failImport;
    private _handlePhoneSubmit;
    private _handleAuthenticated;
    private _reset;
    private _copyPrompt;
    private _renderRows;
    private _renderPastePanel;
    render(): typeof nothing | lit_html.TemplateResult<1>;
}

declare class ConfigureConnectionList extends ConfigureBase {
    connections: ConnectionData[];
    connectors: string;
    importedProviders: string;
    showActions: boolean;
    userScoped: boolean;
    private _connectionStates;
    private _importedProviders;
    private _fetched;
    private _dropdownOpen;
    static styles: lit.CSSResult[];
    connectedCallback(): void;
    disconnectedCallback(): void;
    updated(changed: Map<string, unknown>): void;
    private _onToolStateChange;
    private _fetchConnectionStates;
    private _fetchUserProfileState;
    private _fetchProfileImports;
    private _getConnections;
    private _connectedFor;
    private _imported;
    private _onImportComplete;
    private _emitContinue;
    private _emitSkip;
    private _emitShowProfile;
    render(): lit_html.TemplateResult<1>;
    private _renderConnection;
}

/**
 * Shared "you're connected / approved" surface.
 *
 * Pure render — no fetches, no event listeners, no internal state.
 * Used by:
 *  - configure-auth (success step)
 *  - configure-profile-editor (approved state)
 *  - apps/web/embed/auth/index.html (showComplete)
 *
 * The embed page mounts this via document.createElement('configure-success-card')
 * so the visual treatment stays consistent between the production iframe path and
 * the dev/lab component path.
 */
declare class ConfigureSuccessCard extends ConfigureBase {
    title: string;
    subtitle: string;
    showProgress: boolean;
    showProfileAction: boolean;
    static styles: lit.CSSResult[];
    private _showProfile;
    render(): lit_html.TemplateResult<1>;
}

declare class ConfigureProfileEditor extends ConfigureBase {
    agent: string;
    demo: boolean;
    private _loading;
    private _error;
    private _sessionRequired;
    private _categories;
    private _details;
    private _showDetails;
    private _saving;
    private _permissions;
    private _approved;
    private _saveTimer;
    private _lastSaveFailed;
    private _touchedCategories;
    static styles: lit.CSSResult[];
    connectedCallback(): void;
    updated(changed: Map<string, unknown>): void;
    private _loadDemo;
    private _valueLabel;
    private _isDenied;
    private _pathDenied;
    private _globMatch;
    private _ruleDeniesAgent;
    private _managedPermissionPaths;
    private _isManagedRulePath;
    private _isAggregateCategoryPath;
    private _aggregateCategoryForPath;
    private _categoryHasAggregateDeny;
    private _removeAgentFromDenyRule;
    private _fetchProfile;
    private _toggleCategory;
    private _toggleDetail;
    private _debouncedSave;
    private _savePermissions;
    private _approve;
    private _iconFor;
    private _formatApprovedLabels;
    private _approvalSubtitle;
    private _renderShell;
    render(): lit_html.TemplateResult<1>;
}

declare class ConfigureAuth extends ConfigureBase {
    agent: string;
    userName: string;
    externalId: string;
    connectors: string;
    private _step;
    private _phone;
    private _hasProfileData;
    private _successSubtitle;
    static styles: lit.CSSResult[];
    connectedCallback(): void;
    disconnectedCallback(): void;
    private _restoreSession;
    private _onPhoneSubmit;
    private _onOtpVerified;
    private _checkProfileData;
    private _onProfileApproved;
    private _onConnectionsContinue;
    private _onProfileBack;
    private _onConnectionsSkip;
    /** Returns the current auth token, or null if not authenticated. */
    getToken(): string | null;
    /** Returns the current user ID, or null if not authenticated. */
    getUserId(): string | null;
    /** Clears stored auth and resets to the phone input step. */
    logout(): void;
    render(): lit_html.TemplateResult<1>;
}

declare class ConfigureSingleConnector extends ConfigureBase {
    toolId: string;
    message: string;
    name: string;
    connected: boolean;
    loading: boolean;
    static styles: lit.CSSResult[];
    private _getName;
    render(): lit_html.TemplateResult<1>;
}

declare class ConfigureToolApproval extends ConfigureBase {
    actionId: string;
    tool: string;
    params: ToolApprovalParams;
    timeoutSeconds: number;
    private _decided;
    private _secondsLeft;
    private _timer?;
    static styles: lit.CSSResult[];
    connectedCallback(): void;
    disconnectedCallback(): void;
    private _approve;
    private _deny;
    private _alwaysAllow;
    private _getTitle;
    private _getResultText;
    render(): lit_html.TemplateResult<1>;
}

declare class ConfigureConfirmation extends ConfigureBase {
    message: string;
    confirmLabel: string;
    cancelLabel: string;
    private _decided;
    static styles: lit.CSSResult[];
    private _confirm;
    private _cancel;
    render(): lit_html.TemplateResult<1>;
}

declare class ConfigureAccessRequest extends ConfigureBase {
    agent: string;
    tool: string;
    message: string;
    description: string;
    private _decided;
    private _saving;
    static styles: lit.CSSResult[];
    private _allow;
    private _deny;
    private _showProfile;
    render(): lit_html.TemplateResult<1>;
}

declare class ConfigureMemoryCard extends ConfigureBase {
    memories: MemoryData[];
    maxVisible: number;
    showSettings: boolean;
    showActions: boolean;
    private _expanded;
    static styles: lit.CSSResult[];
    private _toggle;
    render(): lit_html.TemplateResult<1>;
}

declare class ConfigureRuntimeReading extends ConfigureBase {
    label: string;
    private _head;
    private _hue;
    private _timer?;
    static styles: lit.CSSResult[];
    connectedCallback(): void;
    disconnectedCallback(): void;
    private _dotStyle;
    render(): lit_html.TemplateResult<1>;
}

declare class ConfigurePersonalizationButton extends ConfigureBase {
    placeholder: string;
    personalizationLabel: string;
    imageLabel: string;
    fileLabel: string;
    connectors: string;
    externalId: string;
    hideImages: boolean;
    hideFiles: boolean;
    manual: boolean;
    private _menuOpen;
    private _linkOpen;
    private _linked;
    private _linkFrame;
    private _handleDocumentPointerDown;
    private _handleDocumentKeydown;
    static styles: lit.CSSResult[];
    disconnectedCallback(): void;
    connectedCallback(): void;
    private _toggleMenu;
    private _destroyLink;
    private _selectImage;
    private _selectFile;
    private _openPersonalization;
    private _icon;
    render(): lit_html.TemplateResult<1>;
}

declare const EXPORT_PROMPT = "Export all of my stored memories and any context you've learned about me from past conversations. Preserve my words verbatim where possible, especially for instructions and preferences.\n\nOutput EXACTLY this format. Use these EXACT section markers on their own line. Do NOT add extra headings, bullets, or formatting.\n\n---SECTION:Instructions---\n[YYYY-MM-DD] Entry content here\n[unknown] Entry with no known date\n\n---SECTION:Identity---\n[YYYY-MM-DD] Entry content here\n\n---SECTION:Career---\n[YYYY-MM-DD] Entry content here\n\n---SECTION:Projects---\n[YYYY-MM-DD] Entry content here\n\n---SECTION:Preferences---\n[YYYY-MM-DD] Entry content here\n\n---END---\n\nRULES:\n- Each entry is ONE line starting with [YYYY-MM-DD] or [unknown]\n- Do NOT use bullet points, dashes, asterisks, or numbering before the date bracket\n- Do NOT add sub-headings within sections\n- Do NOT wrap output in a code block\n- If a section has no entries, include the section marker with no entries below it\n- Sort entries oldest first within each section\n- After ---END--- state whether this is the complete set or if more remain";
/** Provider URL builders */
declare const PROVIDER_URLS: Record<string, (prompt: string) => string>;
/** Default labels per provider */
declare const PROVIDER_LABELS: Record<string, string>;
/** Which prompt each provider uses */
declare const PROVIDER_PROMPTS: Record<string, string>;

declare class ConfigureAuthModal extends ConfigureBase {
    open: boolean;
    connectors: string;
    agent: string;
    private _step;
    private _phone;
    private _error;
    private _hasProfileData;
    static styles: lit.CSSResult[];
    connectedCallback(): void;
    disconnectedCallback(): void;
    private _onPhoneSubmit;
    private _onOtpVerified;
    private _checkProfileData;
    private _onProfileApproved;
    private _close;
    private _continueFromConnections;
    private _skipConnections;
    private _backToConnections;
    private _showProfile;
    render(): typeof nothing | lit_html.TemplateResult<1>;
}

export { type AccessRequestDetail, type AuthenticatedDetail, ConfigureAccessRequest, ConfigureAuth, ConfigureAuthModal, ConfigureBase, ConfigureConfirmation, ConfigureConnectionList, ConfigureConnectionRow, ConfigureExportButton, ConfigureExportPrompt, ConfigureMemoryCard, ConfigureMemoryImport, ConfigureOtpInput, ConfigurePersonalizationButton, ConfigurePhoneInput, ConfigureProfileEditor, ConfigureRuntimeReading, ConfigureSingleConnector, ConfigureSuccessCard, ConfigureToolApproval, type ConfirmationDetail, type ConnectionData, EXPORT_PROMPT, type ErrorDetail, type ExportClickDetail, type ExportProvider, type IdentityUpdateDetail, type ImportCompleteDetail, type ImportErrorDetail, type ImportStartDetail, type MemoryData, type MemoryDeleteDetail, type MemoryEditDetail, type OtpVerifiedDetail, type OtpVerifyDetail, PROVIDER_LABELS, PROVIDER_PROMPTS, PROVIDER_URLS, type PersonalizationAssetSelectDetail, type PersonalizationMenuToggleDetail, type PersonalizationOpenDetail, type PhoneSubmitDetail, type ProfileApprovedDetail, type PromptCopiedDetail, type ToolApprovalDetail, type ToolApprovalParams, type ToolConnectDetail, type ToolDisconnectDetail };
