import * as i0 from '@angular/core'; import { Signal, InjectionToken } from '@angular/core'; import { ZFormatNumExcelOptions } from '@shival99/z-ui/utils'; import { HttpHeaders, HttpContext, HttpParams, HttpClient } from '@angular/common/http'; import { Router } from '@angular/router'; import * as rxjs from 'rxjs'; import { Observable } from 'rxjs'; import { TranslationObject, TranslateService } from '@ngx-translate/core'; import { OverlayRef } from '@angular/cdk/overlay'; interface ZCacheEntry { data: T; timestamp: number; ttl: number; } interface ZCacheConfig { prefix?: string; encrypt?: boolean; } declare class ZCacheService { private static _prefix; private static _encrypt; static configure(config: ZCacheConfig): void; private static _encode; private static _decode; private static _normalizeLegacyKey; private static _normalizeKey; private static _toStorageKey; private static _getFullKey; private static _getLegacyFullKey; private static _getCandidateStorageKeys; private static _decodeStorageKey; private static _isManagedStorageKey; private static _safeOperation; static get(key: string, defaultValue?: T, encrypt?: boolean): T | undefined; static set(key: string, data: T, encrypt?: boolean): boolean; static delete(key: string): boolean; static deleteMultiple(keys: string[]): boolean; static clear(): boolean; static has(key: string, encrypt?: boolean): boolean; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵprov: i0.ɵɵInjectableDeclaration; } type ZExcelAlign = 'left' | 'center' | 'right'; interface ZExcelTableColumnConfig { id: string; visible?: boolean | (() => boolean); accessorKey?: keyof T & string; accessorFn?: (row: T) => unknown; header?: string | { content?: string | (() => string); align?: ZExcelAlign; }; size?: number; columns?: ZExcelTableColumnConfig[]; } interface ZExcelTableHeaderConfig { content?: string | (() => string); class?: string; style?: Record; align?: string; tooltip?: string | object; rowSpan?: number; colSpan?: number; } interface ZExcelCell { value: unknown; font?: { name?: string; size?: number; bold?: boolean; italic?: boolean; color?: { argb?: string; }; }; fill?: { type?: string; pattern?: string; fgColor?: { argb?: string; }; }; alignment?: { horizontal?: 'left' | 'center' | 'right'; vertical?: 'top' | 'middle' | 'bottom'; wrapText?: boolean; }; border?: { top?: { style?: string; }; left?: { style?: string; }; bottom?: { style?: string; }; right?: { style?: string; }; }; note?: string; numFmt?: string; } interface ZExcelCellContext { row: T; rowIndex: number; data: T[]; cell: ZExcelCell; } interface ZExcelHeaderContext { colIndex: number; cell: ZExcelCell; } interface ZExcelColumnConfig { id: string; header?: string; accessorKey?: keyof T & string; accessorFn?: (row: T, rowIndex: number, data: T[]) => unknown; width?: number; autoFit?: boolean; align?: ZExcelAlign; headerAlign?: ZExcelAlign; rowSpan?: number | ((row: T, rowIndex: number, data: T[]) => number); colSpan?: number | ((row: T, rowIndex: number, data: T[]) => number); headerRowSpan?: number; headerColSpan?: number; format?: (context: ZExcelCellContext) => void; formatNum?: ZFormatNumExcelOptions; formatHeader?: (cell: ZExcelCell) => void; note?: (row: T, rowIndex: number, data: T[]) => string | undefined; columns?: ZExcelColumnConfig[]; visible?: boolean; } interface ZExcelSheetSource { sheetName?: string; data: T[]; } interface ZExcelConfig { fileName?: string; columns: ZExcelColumnConfig[]; source: ZExcelSheetSource[]; } interface ZExcelToastHandler { success?: (message: string) => void; error?: (message: string) => void; } interface ZExcelExportOptions { addTimestamp?: boolean; showNotification?: boolean; /** * Optional toast handler for showing success/error notifications. * If not provided, no notifications will be shown. */ toast?: ZExcelToastHandler; } interface ZExcelExportResult { buffer: ArrayBuffer; fileName: string; } interface ZExcelFontConfig { name: string; size: number; bold?: boolean; } interface ZExcelHeaderColors { level0: string; level1: string; [key: string]: string; } interface ZExcelDefaultConfig { font: ZExcelFontConfig; headerFont: ZExcelFontConfig; headerColors: ZExcelHeaderColors; } type ZTableToExcelColumn = Omit, 'header'> & { header?: string | ((col: ZExcelTableColumnConfig) => string); }; interface ZExcelFromTableConfig { fileName?: string; tableColumns: ZExcelTableColumnConfig[]; excelOverrides?: Partial>>>; source: ZExcelSheetSource[]; excludeColumns?: string[]; headerResolver?: (col: ZExcelTableColumnConfig) => string; } declare class ZExcelService { private static _isHeaderConfig; private static _getHeaderConfig; exportExcel(config: ZExcelConfig, options?: ZExcelExportOptions): Promise; exportFromTable(config: ZExcelFromTableConfig, options?: ZExcelExportOptions): Promise; exportFromElement(elementId: string, fileName?: string, options?: ZExcelExportOptions): Promise; exportFromElementXlsx(elementId: string, fileName?: string, options?: ZExcelExportOptions): Promise; static exportExcelStatic(config: ZExcelConfig): Promise; static exportFromElementStatic(elementId: string, fileName?: string): Promise; private _saveFile; private _convertTableColumnsToExcel; private static _flattenColumns; private static _calculateHeaderLevels; private static _createHeaderRows; private static _buildHeaderStructure; private static _getLeafCount; private static _getCellValue; private static _processMergeRegions; private static _applyAutoFitWidth; private static _applyAutoFitWidthForTable; private static _getMergedColumnSpan; private static _calculateCellWidth; private static _processTableElement; private static _parseContentValue; private static _applyCellFormatFromHTML; private static _getExcelAlignment; private static _getExcelVerticalAlignment; private static _formatTimestamp; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵprov: i0.ɵɵInjectableDeclaration; } type ZHttpParamsType = { [K in keyof T]: string | number | boolean | ReadonlyArray; }; type ZHttpContentType = 'json' | 'urlencoded' | 'form-data'; interface ZHttpBaseOptions { headers?: HttpHeaders | Record; context?: HttpContext; observe?: 'body'; params?: HttpParams | Record>; reportProgress?: boolean; responseType?: 'json' | 'arraybuffer' | 'blob' | 'text'; withCredentials?: boolean; credentials?: RequestCredentials; keepalive?: boolean; priority?: RequestPriority; cache?: RequestCache; mode?: RequestMode; redirect?: RequestRedirect; transferCache?: { includeHeaders?: string[]; } | boolean; body?: unknown; log?: boolean; } interface ZHttpOptions extends ZHttpBaseOptions { contentType?: ZHttpContentType; api?: TApiType; skipToken?: boolean; params?: HttpParams | ZHttpParamsType; enableCache?: boolean; keyCache?: string; timeCache?: number; skipErrorToast?: boolean; } interface ZHttpCacheEntry { data: T; timestamp: number; ttl: number; } interface ZHttpError { message: string; status: number; error?: unknown; endpoint?: string; method?: string; body?: unknown; options?: ZHttpOptions; } interface ZHttpConfig { defaultCacheTime?: number; networkCheckCacheTime?: number; tokenKey?: string; userInfoKey?: string; lastUrlKey?: string; loginRoute?: string; homeRoute?: string; unauthorizedRoute?: string; } interface ZHttpNetworkCheck { time: number; isOnline: boolean; } interface ZIndexDbStoreConfig { name: string; encrypt?: boolean; protectedKeys?: string[]; } interface ZIndexDbConfig { dbName?: string; version?: number; mode?: IDBTransactionMode; stores?: ZIndexDbStoreConfig[]; defaultStore?: string; protectedKeys?: string[]; encrypt?: boolean; } interface ZIndexDbGetOptions { defaultValue?: T; storeName?: string; encrypt?: boolean; } interface ZIndexDbSetOptions { storeName?: string; encrypt?: boolean; } declare class ZIndexDbService { private _db; private _dbName; private _legacyDbName; private _version; private _mode; private _dbReady; private _stores; private _defaultStoreName; private _globalProtectedKeys; private _encrypt; constructor(config?: ZIndexDbConfig); private _getStoreConfig; /** * Determines if encryption should be used. * Priority: per-call > store-level > global * @param storeConfig - Store configuration * @param perCallEncrypt - Per-call encrypt override (highest priority) */ private _shouldEncrypt; private _normalizeLegacyKey; private _normalizeKey; private _resolveLegacyNormalizedKey; private _buildStorageKeys; private _encryptData; private _decryptData; private _closeConnection; private _reconnect; private _withRetry; private _initDb; private _adoptLegacyDbNameIfNeeded; private _getExistingDbVersion; private _probeDbMetadataByOpen; private _getCurrentDbVersion; private _triggerUpgrade; private _resetDatabase; private _getMissingStores; private _ensureStoreExists; get(key: string, options?: ZIndexDbGetOptions): Promise; set(key: string, value: T, options?: ZIndexDbSetOptions): Promise; /** * Delete key(s) from IndexDB. If storeName not provided, deletes from all stores. * Tries both encrypted and non-encrypted versions of the key. */ delete(key: string | string[], storeName?: string): Promise; private _deleteFromStore; clear(storeName?: string): Promise; getAll(storeName?: string): Promise>; setMultiple(items: Record, options?: ZIndexDbSetOptions): Promise; getStoreNames(): string[]; hasStore(storeName: string): boolean; addStore(config: ZIndexDbStoreConfig): Promise; clearAll(): Promise; } declare class ZTranslateService { private readonly _translate; private readonly _destroyRef; readonly currentLang: i0.WritableSignal; readonly availableLangs: i0.WritableSignal; constructor(); private _initialize; private _bindTranslateEvents; private _setCurrentLang; private _syncAvailableLangs; use(lang: string): void; getLang(): string; getLocale(): string; locale(): Signal; instant(key: string, params?: Record): string; /** * Returns a computed signal that automatically updates when language changes. * Use this instead of instant() when you need reactive translations. * * @example * ```typescript * // In component * protected readonly title = this._zTranslate.translate('my_title_key'); * * // In template *

{{ title() }}

* ``` */ translate(key: string, params?: Record): Signal; get(key: string, params?: Record): Promise; get$(key: string, params?: Record): Observable; stream$(key: string, params?: Record): Observable; getMany(keys: string[], params?: Record): Promise>; has(key: string): boolean; setTranslation(lang: string, translations: TranslationObject, shouldMerge?: boolean): void; getNgxTranslate(): TranslateService; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵprov: i0.ɵɵInjectableDeclaration; } declare const Z_HTTP_DEFAULT_CONFIG: Required; declare abstract class ZHttpAbstractService { protected readonly http: HttpClient; protected readonly router: Router; protected readonly cacheService: typeof ZCacheService; protected readonly translateService: ZTranslateService; protected readonly indexDbService: ZIndexDbService; private _httpConfig; private _networkCache; constructor(); /** * Returns the HTTP configuration. Override this method in subclasses to customize. * @example * ```typescript * protected override setHttpConfig(): Partial { * return { * tokenKey: 'MY_TOKEN', * loginRoute: '/auth/login', * }; * } * ``` */ protected setHttpConfig(): Partial; protected get config(): Required; protected abstract resolveBaseUrl(apiType?: TApiType): string; protected get(endpoint: string, options?: ZHttpOptions): Observable; protected post(endpoint: string, body: unknown, options?: ZHttpOptions): Observable; protected put(endpoint: string, body: unknown, options?: ZHttpOptions): Observable; protected patch(endpoint: string, body: unknown, options?: ZHttpOptions): Observable; protected delete(endpoint: string, body?: unknown, options?: ZHttpOptions): Observable; private _buildRequest; private _buildHttpOptions; private _handleCacheAndRequest; private _executeHttpCall; private _generateCacheKey; private _resolveCacheKey; private _cacheData; private _getCachedData; private _detectNetworkStatus; private _checkNetworkWithRetry; private _performNetworkCheck; private _handleError; private _buildErrorObject; private _localizeError; private _get401Message; private _handleStatusCode; private _redirectToLogin; static ɵfac: i0.ɵɵFactoryDeclaration, never>; static ɵprov: i0.ɵɵInjectableDeclaration>; } /** * Service to coordinate overlay container lifecycle events. * Used by overlay containers (z-modal, z-drawer, etc.) to notify * child components (z-popover, z-select dropdown, etc.) when they should close. * * This enables smooth closing behavior when a parent overlay container closes - * all child popovers/dropdowns will close immediately without waiting for DOM removal. */ declare class ZOverlayContainerService { private readonly _closeAll$; /** * Observable that emits when an overlay container starts closing. * Child components should subscribe to this and close themselves immediately. */ readonly closeAll$: rxjs.Observable; /** * Called by overlay containers (z-modal, z-drawer, etc.) when they start closing. * This will notify all subscribed child components to close immediately. */ notifyClosing(): void; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵprov: i0.ɵɵInjectableDeclaration; } /** * Global z-index counter for overlay components (z-modal, z-drawer, etc.). * * Each time an overlay opens, it calls `next()` to get a unique, incrementing * z-index value. This guarantees that overlays opened later always stack on top * of earlier ones — regardless of DOM order or HMR re-creation. */ declare class ZOverlayZIndexService { private _currentZIndex; private readonly _platformId; /** * Returns the next z-index value and increments the counter. * Kept for backward compatibility with existing overlay flow. */ next(): number; applyToOverlay(overlayRef: OverlayRef): number; deferMoveToTop(overlayRef: OverlayRef): void; moveToTop(overlayRef: OverlayRef): void; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵprov: i0.ɵɵInjectableDeclaration; } type ZSubjectType = 'subject' | 'behavior'; declare class ZSubjectService { private readonly _subjects; private readonly _behaviorSubjects; /** * Emit a value to a subject * @param key - Subject identifier * @param type - 'subject' for Subject, 'behavior' for BehaviorSubject * @param value - Value to emit */ emit(key: string, type: ZSubjectType, value: T): void; /** * Get an observable for a subject * @param key - Subject identifier * @param type - 'subject' for Subject, 'behavior' for BehaviorSubject * @param initialValue - Initial value for BehaviorSubject (required for new behavior subjects) */ on$(key: string, type: ZSubjectType, initialValue?: T): Observable; /** * Get the current value of a BehaviorSubject * @param key - Subject identifier */ getValue(key: string): T | undefined; /** * Complete and remove a subject * @param key - Subject identifier * @param type - 'subject' for Subject, 'behavior' for BehaviorSubject */ complete(key: string, type: ZSubjectType): void; /** * Complete all subjects */ completeAll(): void; /** * Check if a subject exists * @param key - Subject identifier * @param type - 'subject' for Subject, 'behavior' for BehaviorSubject */ has(key: string, type: ZSubjectType): boolean; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵprov: i0.ɵɵInjectableDeclaration; } type ZThemeName = 'green' | 'orange' | 'violet' | 'neutral' | 'stone' | 'zinc' | 'gray' | 'slate' | 'hospital'; interface ZThemeConfig { defaultTheme?: ZThemeName; defaultDarkMode?: boolean; cacheKey?: string; } declare const Z_THEME_CONFIG: InjectionToken; declare const Z_DEFAULT_THEME: ZThemeName; /** Single cache key for all theme preferences */ declare const Z_THEME_PREFERENCES_CACHE_KEY = "Z_THEME_PREFERENCES"; /** Cached theme preferences structure */ interface ZThemePreferences { theme: ZThemeName; isDark: boolean; } declare const Z_THEME_CSS_MAP: Record; declare class ZThemeService { private readonly _document; private readonly _platformId; private readonly _config; private readonly _isBrowser; private readonly _defaultTheme; private readonly _defaultDarkMode; private readonly _preferencesCacheKey; private readonly _isDark; private readonly _currentTheme; private readonly _loadedThemes; readonly isDark: i0.Signal; readonly currentTheme: i0.Signal; constructor(); setTheme(theme: ZThemeName): void; toggleDarkMode(isDark: boolean): void; preloadTheme(theme: ZThemeName): void; private _initializeTheme; private _getInitialPreferences; private _savePreferences; private _isValidTheme; private _loadThemeCSS; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵprov: i0.ɵɵInjectableDeclaration; } declare function zBuildScopedCacheKey(baseKey: string): string; declare function zBuildScopedDbName(baseDbName: string): string; declare function zStripScopedCacheKey(key: string): string; declare const Z_EXCEL_COLORS: { readonly 'green-50': "FFF0FDF4"; readonly 'green-100': "FFDCFCE7"; readonly 'green-200': "FFBBF7D0"; readonly 'green-300': "FF86EFAC"; readonly 'green-400': "FF4ADE80"; readonly 'green-500': "FF22C55E"; readonly 'blue-50': "FFEFF6FF"; readonly 'blue-100': "FFDBEAFE"; readonly 'blue-200': "FFBFDBFE"; readonly 'blue-300': "FF93C5FD"; readonly 'blue-400': "FF60A5FA"; readonly 'blue-500': "FF3B82F6"; readonly 'gray-50': "FFF9FAFB"; readonly 'gray-100': "FFF3F4F6"; readonly 'gray-200': "FFE5E7EB"; readonly 'gray-300': "FFD1D5DB"; readonly 'gray-400': "FF9CA3AF"; readonly 'gray-500': "FF6B7280"; readonly 'yellow-50': "FFFFFBEB"; readonly 'yellow-100': "FFFEF3C7"; readonly 'yellow-200': "FFFDE68A"; readonly 'yellow-300': "FFFCD34D"; readonly 'red-50': "FFFEF2F2"; readonly 'red-100': "FFFEE2E2"; readonly 'red-200': "FFFECACA"; readonly 'red-300': "FFFCA5A5"; readonly white: "FFFFFFFF"; readonly black: "FF000000"; readonly transparent: "00000000"; }; declare const Z_EXCEL_DEFAULT_CONFIG: ZExcelDefaultConfig; declare const Z_EXCEL_BORDER_THIN: { top: { style: "thin"; }; left: { style: "thin"; }; bottom: { style: "thin"; }; right: { style: "thin"; }; }; declare const Z_EXCEL_CHAR_WIDTH_MAP: Record; declare const Z_EXCEL_FONT_MULTIPLIERS: Record; declare const Z_EXCEL_WIDTH_LIMITS: { min: number; max: number; tableMin: number; tableMax: number; default: number; }; declare const Z_INDEXDB_DEFAULT_CONFIG: Required>; declare const Z_INDEXDB_BATCH_SIZE = 100; declare const Z_INDEXDB_MAX_VERSION = 1000; declare const Z_LANG_TO_LOCALE: Record; interface ZTranslateConfig { /** Default language */ defaultLang?: string; /** Available languages */ availableLangs?: string[]; /** Path to translation files */ translationPath?: string; /** Translation file extension */ fileExtension?: string; } interface ZTranslateI18nConfig { defaultLang?: string; availableLangs?: string[]; } declare const Z_LANG_CACHE_KEY = "Z_LANGUAGE"; export { ZCacheService, ZExcelService, ZHttpAbstractService, ZIndexDbService, ZOverlayContainerService, ZOverlayZIndexService, ZSubjectService, ZThemeService, ZTranslateService, Z_DEFAULT_THEME, Z_EXCEL_BORDER_THIN, Z_EXCEL_CHAR_WIDTH_MAP, Z_EXCEL_COLORS, Z_EXCEL_DEFAULT_CONFIG, Z_EXCEL_FONT_MULTIPLIERS, Z_EXCEL_WIDTH_LIMITS, Z_HTTP_DEFAULT_CONFIG, Z_INDEXDB_BATCH_SIZE, Z_INDEXDB_DEFAULT_CONFIG, Z_INDEXDB_MAX_VERSION, Z_LANG_CACHE_KEY, Z_LANG_TO_LOCALE, Z_THEME_CONFIG, Z_THEME_CSS_MAP, Z_THEME_PREFERENCES_CACHE_KEY, zBuildScopedCacheKey, zBuildScopedDbName, zStripScopedCacheKey }; export type { ZCacheConfig, ZCacheEntry, ZExcelAlign, ZExcelCell, ZExcelCellContext, ZExcelColumnConfig, ZExcelConfig, ZExcelDefaultConfig, ZExcelExportOptions, ZExcelExportResult, ZExcelFontConfig, ZExcelFromTableConfig, ZExcelHeaderColors, ZExcelHeaderContext, ZExcelSheetSource, ZExcelTableColumnConfig, ZExcelTableHeaderConfig, ZExcelToastHandler, ZHttpBaseOptions, ZHttpCacheEntry, ZHttpConfig, ZHttpContentType, ZHttpError, ZHttpNetworkCheck, ZHttpOptions, ZHttpParamsType, ZIndexDbConfig, ZIndexDbGetOptions, ZIndexDbSetOptions, ZIndexDbStoreConfig, ZTableToExcelColumn, ZThemeConfig, ZThemeName, ZThemePreferences, ZTranslateConfig, ZTranslateI18nConfig };