{"version":3,"file":"zt-toast-x.mjs","sources":["../../../projects/zt-toast-x/src/lib/zt-toast-x.service.ts","../../../projects/zt-toast-x/src/lib/zt-toast-x.ts","../../../projects/zt-toast-x/src/lib/zt-toast-x.module.ts","../../../projects/zt-toast-x/src/public-api.ts","../../../projects/zt-toast-x/src/zt-toast-x.ts"],"sourcesContent":["/**\r\n * ZT-Toast-X Service\r\n *\r\n * A robust, reactive service for centralized toast notification management in Angular applications.\r\n * This service provides a complete API for displaying, managing, and customizing toast notifications\r\n * with reactive state management using RxJS observables.\r\n *\r\n * Core Capabilities:\r\n * - 🎯 **Centralized State Management**: Single source of truth for all toast notifications\r\n * - 🔄 **Reactive Updates**: RxJS-based observable streams for real-time UI updates\r\n * - ⏰ **Auto-dismiss Logic**: Intelligent scheduling and cleanup of timed notifications\r\n * - 🎨 **Type Safety**: Full TypeScript support with comprehensive interfaces\r\n * - 🔧 **Flexible Configuration**: Extensive customization options for each toast\r\n * - 🧹 **Memory Management**: Proper cleanup and resource management\r\n * - 📊 **Progress Tracking**: Built-in support for progress indicators\r\n * - 🎭 **Position Management**: Screen position coordination and conflict resolution\r\n *\r\n * Architecture Details:\r\n * - **BehaviorSubject Pattern**: Uses RxJS BehaviorSubject for reactive state\r\n * - **Unique ID Generation**: Cryptographically secure random ID generation\r\n * - **Timer Management**: Efficient setTimeout scheduling with cleanup\r\n * - **Immutable Updates**: Pure functions for state transitions\r\n * - **Error Boundaries**: Graceful error handling and recovery\r\n *\r\n * Service Lifecycle:\r\n * 1. **Initialization**: Creates BehaviorSubject with empty toast array\r\n * 2. **Toast Creation**: Generates unique IDs and schedules auto-removal\r\n * 3. **State Updates**: Emits new state to all subscribers\r\n * 4. **Cleanup**: Removes expired toasts and clears timers\r\n * 5. **Destruction**: Complete cleanup on service destruction\r\n *\r\n * Integration Patterns:\r\n * - **Singleton Injection**: Provided in root for app-wide availability\r\n * - **Component Communication**: Observable subscription pattern\r\n * - **Method Chaining**: Fluent API for complex toast configurations\r\n * - **Error Handling**: Try-catch blocks for robust operation\r\n *\r\n * @example Basic Service Usage\r\n * ```typescript\r\n * import { Component } from '@angular/core';\r\n * import { ZtToastXService } from 'zt-toast-x';\r\n *\r\n * @Component({...})\r\n * export class MyComponent {\r\n *   constructor(private toastService: ZtToastXService) {}\r\n *\r\n *   showSuccess() {\r\n *     this.toastService.success('Data saved successfully!');\r\n *   }\r\n *\r\n *   showError() {\r\n *     this.toastService.error('Failed to save data.', 'Save Error');\r\n *   }\r\n * }\r\n * ```\r\n *\r\n * @example Advanced Configuration\r\n * ```typescript\r\n * showCustomToast() {\r\n *   this.toastService.show({\r\n *     type: 'warning',\r\n *     message: 'This action cannot be undone',\r\n *     title: 'Confirmation Required',\r\n *     duration: 10000, // 10 seconds\r\n *     position: 'top-center',\r\n *     dismissible: true,\r\n *     showProgress: true\r\n *   });\r\n * }\r\n * ```\r\n *\r\n * @example Reactive Subscription\r\n * ```typescript\r\n * ngOnInit() {\r\n *   this.toastService.toasts.subscribe(toasts => {\r\n *     console.log('Active toasts:', toasts.length);\r\n *     // Custom logic based on toast state\r\n *   });\r\n * }\r\n * ```\r\n */\r\n\r\nimport { Injectable } from '@angular/core';\r\nimport { BehaviorSubject, Observable } from 'rxjs';\r\n\r\n/**\r\n * Toast notification configuration interface\r\n *\r\n * Defines the structure and options for individual toast notifications.\r\n * All properties are optional except for the message and type.\r\n */\r\nexport interface ZtToastX {\r\n  /** Unique identifier for the toast */\r\n  id: string;\r\n  /** Type of toast that determines styling and icon */\r\n  type: 'success' | 'error' | 'info' | 'warning';\r\n  /** Optional title for the toast */\r\n  title?: string;\r\n  /** Main message content */\r\n  message: string;\r\n  /** Auto-dismiss duration in milliseconds (0 = never auto-dismiss) */\r\n  duration?: number;\r\n  /** Position on screen where toast appears */\r\n  position?: 'top-right' | 'top-left' | 'bottom-right' | 'bottom-left' | 'top-center' | 'bottom-center';\r\n  /** Whether the toast can be manually dismissed by clicking */\r\n  dismissible?: boolean;\r\n  /** Whether to show a progress bar indicating time remaining */\r\n  showProgress?: boolean;\r\n}\r\n\r\n/**\r\n * Toast service providing centralized management of notifications\r\n *\r\n * This service maintains the global state of all active toasts and provides\r\n * convenient methods for displaying different types of notifications.\r\n *\r\n * The service uses BehaviorSubject for reactive state management, allowing\r\n * components to subscribe to toast changes and update their UI accordingly.\r\n */\r\n@Injectable({\r\n  providedIn: 'root'\r\n})\r\nexport class ZtToastXService {\r\n  /** Internal subject managing the current list of active toasts */\r\n  private toasts$ = new BehaviorSubject<ZtToastX[]>([]);\r\n\r\n  /**\r\n   * Observable stream of current toasts\r\n   * Components can subscribe to this to reactively display toasts\r\n   */\r\n  get toasts(): Observable<ZtToastX[]> {\r\n    return this.toasts$.asObservable();\r\n  }\r\n\r\n  /**\r\n   * Display a new toast notification\r\n   *\r\n   * Creates a unique toast with the provided configuration and adds it to the active toasts.\r\n   * Automatically schedules removal based on the duration setting.\r\n   *\r\n   * @param toast - Toast configuration (id will be auto-generated)\r\n   */\r\n  show(toast: Omit<ZtToastX, 'id'>): void {\r\n    const id = Math.random().toString(36).substr(2, 9);\r\n    const newToast: ZtToastX = {\r\n      id,\r\n      type: toast.type,\r\n      title: toast.title,\r\n      message: toast.message,\r\n      duration: toast.duration ?? 5000,\r\n      position: toast.position || 'top-right',\r\n      dismissible: toast.dismissible !== false,\r\n      showProgress: toast.showProgress !== false,\r\n    };\r\n\r\n    const currentToasts = this.toasts$.value;\r\n    this.toasts$.next([...currentToasts, newToast]);\r\n\r\n    // Schedule auto-removal if duration is set\r\n    if (newToast.duration && newToast.duration > 0) {\r\n      setTimeout(() => {\r\n        this.remove(id);\r\n      }, newToast.duration);\r\n    }\r\n  }\r\n\r\n  /**\r\n   * Remove a specific toast by ID\r\n   *\r\n   * @param id - Unique identifier of the toast to remove\r\n   */\r\n  remove(id: string): void {\r\n    const currentToasts = this.toasts$.value;\r\n    this.toasts$.next(currentToasts.filter(toast => toast.id !== id));\r\n  }\r\n\r\n  /**\r\n   * Remove all active toasts\r\n   *\r\n   * Useful for clearing all notifications at once, such as when navigating away from a page.\r\n   */\r\n  clear(): void {\r\n    this.toasts$.next([]);\r\n  }\r\n\r\n  /**\r\n   * Show a success toast notification\r\n   *\r\n   * @param message - Main message content\r\n   * @param title - Optional title (defaults to 'Success')\r\n   * @param options - Additional toast configuration options\r\n   */\r\n  success(message: string, title?: string, options?: Partial<ZtToastX>): void {\r\n    this.show({ ...options, type: 'success', message, title });\r\n  }\r\n\r\n  /**\r\n   * Show an error toast notification\r\n   *\r\n   * @param message - Main message content\r\n   * @param title - Optional title (defaults to 'Error')\r\n   * @param options - Additional toast configuration options\r\n   */\r\n  error(message: string, title?: string, options?: Partial<ZtToastX>): void {\r\n    this.show({ ...options, type: 'error', message, title });\r\n  }\r\n\r\n  /**\r\n   * Show an info toast notification\r\n   *\r\n   * @param message - Main message content\r\n   * @param title - Optional title (defaults to 'Info')\r\n   * @param options - Additional toast configuration options\r\n   */\r\n  info(message: string, title?: string, options?: Partial<ZtToastX>): void {\r\n    this.show({ ...options, type: 'info', message, title });\r\n  }\r\n\r\n  /**\r\n   * Show a warning toast notification\r\n   *\r\n   * @param message - Main message content\r\n   * @param title - Optional title (defaults to 'Warning')\r\n   * @param options - Additional toast configuration options\r\n   */\r\n  warning(message: string, title?: string, options?: Partial<ZtToastX>): void {\r\n    this.show({ ...options, type: 'warning', message, title });\r\n  }\r\n}\r\n","/**\r\n * ZT-Toast-X Component\r\n *\r\n * A comprehensive, standalone toast notification component for Angular applications.\r\n * This component provides a complete toast notification system built from scratch\r\n * without external dependencies, offering full customization and accessibility features.\r\n *\r\n * Key Features:\r\n * - 🎨 **Multiple Toast Types**: Four distinct visual styles (success, error, info, warning)\r\n *   with appropriate color coding and icons for immediate recognition\r\n * - 📍 **Flexible Positioning**: Six strategic screen positions for optimal UX\r\n * - ⏱️ **Smart Auto-dismiss**: Configurable duration with automatic cleanup\r\n * - ❌ **Manual Dismissal**: Optional close buttons with hover states\r\n * - 📊 **Progress Indicators**: Visual progress bars showing remaining time\r\n * - 📱 **Responsive Design**: Adaptive layouts for mobile and desktop\r\n * - 🎭 **Smooth Animations**: CSS-based slide-in animations for professional feel\r\n * - ♿ **Accessibility**: ARIA labels, keyboard navigation, and screen reader support\r\n * - 🧪 **Development Tools**: Built-in demo buttons for testing and Storybook integration\r\n * - 🔧 **Zero Dependencies**: Pure Angular implementation, no external libraries required\r\n *\r\n * Architecture:\r\n * - Uses Angular's standalone component architecture for modern applications\r\n * - Implements reactive state management with RxJS BehaviorSubject\r\n * - Follows Angular lifecycle patterns with proper cleanup\r\n * - Provides TypeScript interfaces for type safety\r\n * - Includes comprehensive JSDoc documentation\r\n *\r\n * Usage Patterns:\r\n * - **Standalone Components**: Direct import and use in modern Angular apps\r\n * - **Module-based Apps**: Import via NgModule for legacy applications\r\n * - **Service Integration**: Inject ZtToastXService for programmatic control\r\n * - **Storybook Development**: Demo buttons for interactive testing\r\n *\r\n * @example Basic HTML Usage\r\n * ```html\r\n * <!-- Simple usage with default settings -->\r\n * <zt-toast-x></zt-toast-x>\r\n *\r\n * <!-- With custom position and demo buttons -->\r\n * <zt-toast-x position=\"bottom-left\" [showDemoButtons]=\"true\"></zt-toast-x>\r\n * ```\r\n *\r\n * @example Service Integration\r\n * ```typescript\r\n * import { Component } from '@angular/core';\r\n * import { ZtToastXService } from 'zt-toast-x';\r\n *\r\n * @Component({...})\r\n * export class MyComponent {\r\n *   constructor(private toastService: ZtToastXService) {}\r\n *\r\n *   showSuccess() {\r\n *     this.toastService.success('Data saved successfully!', 'Save Complete');\r\n *   }\r\n *\r\n *   showCustomToast() {\r\n *     this.toastService.show({\r\n *       type: 'info',\r\n *       message: 'Custom notification with options',\r\n *       title: 'Custom Toast',\r\n *       duration: 10000,\r\n *       position: 'top-center',\r\n *       dismissible: true,\r\n *       showProgress: true\r\n *     });\r\n *   }\r\n * }\r\n * ```\r\n *\r\n * @example Standalone Component Setup\r\n * ```typescript\r\n * import { Component } from '@angular/core';\r\n * import { ZtToastXComponent, ZtToastXService } from 'zt-toast-x';\r\n *\r\n * @Component({\r\n *   selector: 'app-root',\r\n *   standalone: true,\r\n *   imports: [ZtToastXComponent],\r\n *   template: `\r\n *     <button (click)=\"showToast()\">Show Toast</button>\r\n *     <zt-toast-x position=\"top-right\"></zt-toast-x>\r\n *   `,\r\n *   providers: [ZtToastXService]\r\n * })\r\n * export class AppComponent {\r\n *   constructor(private toastService: ZtToastXService) {}\r\n *\r\n *   showToast() {\r\n *     this.toastService.success('Hello from ZT-Toast-X!');\r\n *   }\r\n * }\r\n * ```\r\n *\r\n * @example Module-based Application Setup\r\n * ```typescript\r\n * import { NgModule } from '@angular/core';\r\n * import { BrowserModule } from '@angular/platform-browser';\r\n * import { ZtToastXModule } from 'zt-toast-x';\r\n *\r\n * @NgModule({\r\n *   declarations: [AppComponent],\r\n *   imports: [BrowserModule, ZtToastXModule],\r\n *   bootstrap: [AppComponent]\r\n * })\r\n * export class AppModule { }\r\n * ```\r\n */\r\n\r\nimport { Component, OnInit, OnDestroy, Input } from '@angular/core';\r\nimport { CommonModule } from '@angular/common';\r\nimport { ZtToastXService, ZtToastX } from './zt-toast-x.service';\r\nimport { Subject } from 'rxjs';\r\nimport { takeUntil } from 'rxjs/operators';\r\n\r\n/**\r\n * Toast notification component that displays messages in various positions on the screen\r\n *\r\n * This component subscribes to the ZtToastXService to receive toast notifications and\r\n * displays them with appropriate styling, animations, and interactive elements.\r\n * It handles the complete lifecycle of toasts including display, progress tracking,\r\n * and cleanup.\r\n */\r\n@Component({\r\n  selector: 'zt-toast-x',\r\n  standalone: true,\r\n  imports: [CommonModule],\r\n  template: `\r\n    <div class=\"toast-container\" [ngClass]=\"'toast-' + position\">\r\n      <div\r\n        *ngFor=\"let toast of toasts\"\r\n        class=\"toast\"\r\n        [ngClass]=\"'toast-' + toast.type\"\r\n      >\r\n        <div class=\"toast-icon\" [ngClass]=\"'icon-' + toast.type\"></div>\r\n        <div class=\"toast-content\">\r\n          <div class=\"toast-title\" *ngIf=\"toast.title\">{{ toast.title }}</div>\r\n          <div class=\"toast-message\">{{ toast.message }}</div>\r\n        </div>\r\n        <button\r\n          *ngIf=\"toast.dismissible\"\r\n          class=\"toast-close\"\r\n          (click)=\"removeToast(toast.id)\"\r\n          aria-label=\"Close toast\"\r\n        >\r\n          ×\r\n        </button>\r\n        <div\r\n          *ngIf=\"toast.showProgress\"\r\n          class=\"toast-progress\"\r\n          [style.width.%]=\"getProgress(toast)\"\r\n        ></div>\r\n      </div>\r\n    </div>\r\n\r\n    <!-- Demo buttons for Storybook -->\r\n    <div class=\"demo-buttons\" *ngIf=\"showDemoButtons\">\r\n      <button (click)=\"showSuccess()\">Success</button>\r\n      <button (click)=\"showError()\">Error</button>\r\n      <button (click)=\"showInfo()\">Info</button>\r\n      <button (click)=\"showWarning()\">Warning</button>\r\n    </div>\r\n  `,\r\n  styles: [`\r\n    .toast-container {\r\n      position: fixed;\r\n      z-index: 9999;\r\n      pointer-events: none;\r\n      max-width: 400px;\r\n    }\r\n\r\n    .toast-container.toast-top-right {\r\n      top: 20px;\r\n      right: 20px;\r\n    }\r\n\r\n    .toast-container.toast-top-left {\r\n      top: 20px;\r\n      left: 20px;\r\n    }\r\n\r\n    .toast-container.toast-bottom-right {\r\n      bottom: 20px;\r\n      right: 20px;\r\n    }\r\n\r\n    .toast-container.toast-bottom-left {\r\n      bottom: 20px;\r\n      left: 20px;\r\n    }\r\n\r\n    .toast-container.toast-top-center {\r\n      top: 20px;\r\n      left: 50%;\r\n      transform: translateX(-50%);\r\n    }\r\n\r\n    .toast-container.toast-bottom-center {\r\n      bottom: 20px;\r\n      left: 50%;\r\n      transform: translateX(-50%);\r\n    }\r\n\r\n    .toast {\r\n      display: flex;\r\n      align-items: flex-start;\r\n      margin-bottom: 10px;\r\n      padding: 16px;\r\n      border-radius: 8px;\r\n      box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);\r\n      color: white;\r\n      pointer-events: auto;\r\n      position: relative;\r\n      overflow: hidden;\r\n      animation: slideIn 0.3s ease-out;\r\n    }\r\n\r\n    .toast-success {\r\n      background-color: #28a745;\r\n    }\r\n\r\n    .toast-error {\r\n      background-color: #dc3545;\r\n    }\r\n\r\n    .toast-info {\r\n      background-color: #17a2b8;\r\n    }\r\n\r\n    .toast-warning {\r\n      background-color: #ffc107;\r\n      color: #212529;\r\n    }\r\n\r\n    .toast-icon {\r\n      margin-right: 12px;\r\n      font-size: 20px;\r\n      flex-shrink: 0;\r\n    }\r\n\r\n    .icon-success::before {\r\n      content: '✓';\r\n    }\r\n\r\n    .icon-error::before {\r\n      content: '✕';\r\n    }\r\n\r\n    .icon-info::before {\r\n      content: 'ℹ';\r\n    }\r\n\r\n    .icon-warning::before {\r\n      content: '⚠';\r\n    }\r\n\r\n    .toast-content {\r\n      flex: 1;\r\n    }\r\n\r\n    .toast-title {\r\n      font-weight: 600;\r\n      margin-bottom: 4px;\r\n    }\r\n\r\n    .toast-message {\r\n      font-size: 14px;\r\n      line-height: 1.4;\r\n    }\r\n\r\n    .toast-close {\r\n      background: none;\r\n      border: none;\r\n      color: inherit;\r\n      font-size: 20px;\r\n      cursor: pointer;\r\n      padding: 0;\r\n      margin-left: 12px;\r\n      opacity: 0.7;\r\n      transition: opacity 0.2s;\r\n    }\r\n\r\n    .toast-close:hover {\r\n      opacity: 1;\r\n    }\r\n\r\n    .toast-progress {\r\n      position: absolute;\r\n      bottom: 0;\r\n      left: 0;\r\n      height: 4px;\r\n      background-color: rgba(255, 255, 255, 0.3);\r\n      transition: width 0.1s linear;\r\n    }\r\n\r\n    .demo-buttons {\r\n      display: flex;\r\n      gap: 10px;\r\n      margin-top: 20px;\r\n    }\r\n\r\n    .demo-buttons button {\r\n      padding: 8px 16px;\r\n      border: none;\r\n      border-radius: 4px;\r\n      cursor: pointer;\r\n      font-size: 14px;\r\n    }\r\n\r\n    .demo-buttons button:nth-child(1) {\r\n      background-color: #28a745;\r\n      color: white;\r\n    }\r\n\r\n    .demo-buttons button:nth-child(2) {\r\n      background-color: #dc3545;\r\n      color: white;\r\n    }\r\n\r\n    .demo-buttons button:nth-child(3) {\r\n      background-color: #17a2b8;\r\n      color: white;\r\n    }\r\n\r\n    .demo-buttons button:nth-child(4) {\r\n      background-color: #ffc107;\r\n      color: #212529;\r\n    }\r\n\r\n    @keyframes slideIn {\r\n      from {\r\n        transform: translateX(100%);\r\n        opacity: 0;\r\n      }\r\n      to {\r\n        transform: translateX(0);\r\n        opacity: 1;\r\n      }\r\n    }\r\n\r\n    /* Responsive */\r\n    @media (max-width: 480px) {\r\n      .toast-container {\r\n        left: 10px;\r\n        right: 10px;\r\n        max-width: none;\r\n        transform: none !important;\r\n      }\r\n\r\n      .toast {\r\n        margin-bottom: 8px;\r\n      }\r\n    }\r\n  `]\r\n})\r\n/**\r\n * Toast component implementation class\r\n *\r\n * Manages the display and lifecycle of toast notifications. This component:\r\n * - Subscribes to toast service updates\r\n * - Tracks progress for each toast\r\n * - Handles manual dismissal\r\n * - Provides demo functionality for development\r\n * - Manages cleanup on component destruction\r\n */\r\nexport class ZtToastXComponent implements OnInit, OnDestroy {\r\n  /** Array of currently active toasts to display */\r\n  toasts: ZtToastX[] = [];\r\n\r\n  /** Subject for managing subscription cleanup */\r\n  private destroy$ = new Subject<void>();\r\n\r\n  /** Map tracking timing information for progress calculation */\r\n  private toastTimers: Map<string, { startTime: number; duration: number }> = new Map();\r\n\r\n  /**\r\n   * Show demo buttons for testing toast functionality\r\n   * Useful in development and Storybook environments\r\n   */\r\n  @Input() showDemoButtons = false;\r\n\r\n  /**\r\n   * Position where toasts should appear on the screen\r\n   * Affects the CSS classes applied to the toast container\r\n   */\r\n  @Input() position: 'top-right' | 'top-left' | 'bottom-right' | 'bottom-left' | 'top-center' | 'bottom-center' = 'top-right';\r\n\r\n  /**\r\n   * Constructor - injects the toast service for managing notifications\r\n   */\r\n  constructor(private toastService: ZtToastXService) {}\r\n\r\n  /**\r\n   * Component initialization lifecycle hook\r\n   *\r\n   * Sets up subscription to the toast service and initializes progress tracking\r\n   * for any existing toasts. Uses takeUntil pattern for proper cleanup.\r\n   */\r\n  ngOnInit(): void {\r\n    this.toastService.toasts\r\n      .pipe(takeUntil(this.destroy$))\r\n      .subscribe(toasts => {\r\n        // Track new toasts for progress calculation\r\n        toasts.forEach(toast => {\r\n          if (!this.toastTimers.has(toast.id) && toast.duration && toast.duration > 0) {\r\n            this.toastTimers.set(toast.id, {\r\n              startTime: Date.now(),\r\n              duration: toast.duration\r\n            });\r\n          }\r\n        });\r\n\r\n        // Remove timers for toasts that are no longer present\r\n        this.toastTimers.forEach((_, id) => {\r\n          if (!toasts.find(t => t.id === id)) {\r\n            this.toastTimers.delete(id);\r\n          }\r\n        });\r\n\r\n        this.toasts = toasts;\r\n      });\r\n  }\r\n\r\n  /**\r\n   * Component destruction lifecycle hook\r\n   *\r\n   * Cleans up all subscriptions and timers to prevent memory leaks.\r\n   * This is crucial for proper component lifecycle management.\r\n   */\r\n  ngOnDestroy(): void {\r\n    this.destroy$.next();\r\n    this.destroy$.complete();\r\n    this.toastTimers.clear();\r\n  }\r\n\r\n  /**\r\n   * Manually remove a toast notification\r\n   *\r\n   * Called when user clicks the close button on a dismissible toast.\r\n   * Also cleans up the associated timer.\r\n   *\r\n   * @param id - Unique identifier of the toast to remove\r\n   */\r\n  removeToast(id: string): void {\r\n    this.toastService.remove(id);\r\n    this.toastTimers.delete(id);\r\n  }\r\n\r\n  /**\r\n   * Calculate progress percentage for a toast\r\n   *\r\n   * Used to display a progress bar showing how much time is remaining\r\n   * before the toast auto-dismisses. Returns 0-100 percentage value.\r\n   *\r\n   * @param toast - Toast object to calculate progress for\r\n   * @returns Progress percentage (0-100)\r\n   */\r\n  getProgress(toast: ZtToastX): number {\r\n    if (!toast.duration || toast.duration <= 0) {\r\n      return 0;\r\n    }\r\n\r\n    const timer = this.toastTimers.get(toast.id);\r\n    if (!timer) {\r\n      return 100;\r\n    }\r\n\r\n    const elapsed = Date.now() - timer.startTime;\r\n    const progress = Math.max(0, 100 - (elapsed / timer.duration) * 100);\r\n    return Math.round(progress);\r\n  }\r\n\r\n  // Demo methods for Storybook and development testing\r\n\r\n  /**\r\n   * Demo method to show a success toast\r\n   * Used in Storybook and development environments for testing\r\n   */\r\n  showSuccess(): void {\r\n    this.toastService.success('Operation completed successfully!', 'Operation Complete');\r\n  }\r\n\r\n  /**\r\n   * Demo method to show an error toast\r\n   * Used in Storybook and development environments for testing\r\n   */\r\n  showError(): void {\r\n    this.toastService.error('An error occurred while processing your request.', 'Error Occurred');\r\n  }\r\n\r\n  /**\r\n   * Demo method to show an info toast\r\n   * Used in Storybook and development environments for testing\r\n   */\r\n  showInfo(): void {\r\n    this.toastService.info('Here is some information for you.', 'Information');\r\n  }\r\n\r\n  /**\r\n   * Demo method to show a warning toast\r\n   * Used in Storybook and development environments for testing\r\n   */\r\n  showWarning(): void {\r\n    this.toastService.warning('Please be cautious with this action.', 'Caution');\r\n  }\r\n}\r\n","/**\r\n * ZT-Toast-X Module\r\n *\r\n * A minimal Angular module that provides toast notification functionality for legacy\r\n * module-based Angular applications. This module serves as a bridge for applications\r\n * that haven't migrated to standalone components, offering the same powerful toast\r\n * system in a traditional NgModule wrapper.\r\n *\r\n * Module Architecture:\r\n * - **Zero Declarations**: No component declarations - relies on standalone components\r\n * - **Minimal Imports**: Only CommonModule for essential Angular directives\r\n * - **Empty Exports**: Components are imported directly, not exported through module\r\n * - **Service Provision**: Toast service is provided in root, not through module\r\n *\r\n * Design Philosophy:\r\n * - **Standalone-First**: Encourages modern Angular standalone component usage\r\n * - **Backward Compatibility**: Supports legacy module-based applications\r\n * - **Clean Separation**: Clear distinction between module and standalone usage\r\n * - **Future-Proof**: Designed for eventual module system deprecation\r\n *\r\n * Usage Patterns:\r\n * - **Legacy Applications**: Traditional NgModule-based Angular projects\r\n * - **Gradual Migration**: Step-by-step migration from modules to standalone\r\n * - **Library Integration**: Easy integration with existing module ecosystems\r\n * - **Testing Environments**: Module-based testing setups\r\n *\r\n * Important Notes:\r\n * - This module is intentionally minimal and doesn't declare or export components\r\n * - For new applications, prefer standalone component imports\r\n * - The module exists primarily for backward compatibility\r\n * - Service injection works identically in both patterns\r\n *\r\n * @example Module-based Application Setup\r\n * ```typescript\r\n * import { NgModule } from '@angular/core';\r\n * import { BrowserModule } from '@angular/platform-browser';\r\n * import { ZtToastXModule } from 'zt-toast-x';\r\n *\r\n * @NgModule({\r\n *   declarations: [AppComponent],\r\n *   imports: [\r\n *     BrowserModule,\r\n *     ZtToastXModule, // Provides toast infrastructure\r\n *     // Other modules...\r\n *   ],\r\n *   bootstrap: [AppComponent]\r\n * })\r\n * export class AppModule { }\r\n * ```\r\n *\r\n * @example Component Usage in Module-based App\r\n * ```typescript\r\n * import { Component } from '@angular/core';\r\n * import { ZtToastXComponent } from 'zt-toast-x';\r\n *\r\n * @Component({\r\n *   selector: 'app-toast-demo',\r\n *   template: `\r\n *     <button (click)=\"showToast()\">Show Toast</button>\r\n *     <zt-toast-x position=\"top-right\"></zt-toast-x>\r\n *   `,\r\n *   // Note: ZtToastXComponent must be declared in a module\r\n * })\r\n * export class ToastDemoComponent {\r\n *   // Component logic...\r\n * }\r\n * ```\r\n *\r\n * Migration Recommendation:\r\n * For new Angular applications (v14+), consider using standalone components directly:\r\n * ```typescript\r\n * @Component({\r\n *   standalone: true,\r\n *   imports: [ZtToastXComponent],\r\n *   // ... component config\r\n * })\r\n * ```\r\n */\r\n\r\nimport { NgModule } from '@angular/core';\r\nimport { CommonModule } from '@angular/common';\r\nimport { ZtToastXComponent } from './zt-toast-x';\r\n\r\n/**\r\n * Toast module providing toast notification functionality\r\n *\r\n * This module serves as a convenient way to import the toast component\r\n * in traditional NgModule-based Angular applications. For standalone\r\n * components, you can import ZtToastXComponent directly.\r\n */\r\n@NgModule({\r\n  declarations: [],\r\n  imports: [\r\n    CommonModule,\r\n  ],\r\n  exports: []\r\n})\r\nexport class ZtToastXModule { }\r\n","/*\r\n * Public API Surface of zt-toast-x\r\n */\r\n\r\nexport * from './lib/zt-toast-x';\r\nexport * from './lib/zt-toast-x.service';\r\nexport * from './lib/zt-toast-x.module';\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":["i1.ZtToastXService"],"mappings":";;;;;;;AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgFG;AA8BH;;;;;;;;AAQG;MAIU,eAAe,CAAA;;AAElB,IAAA,OAAO,GAAG,IAAI,eAAe,CAAa,EAAE,CAAC;AAErD;;;AAGG;AACH,IAAA,IAAI,MAAM,GAAA;AACR,QAAA,OAAO,IAAI,CAAC,OAAO,CAAC,YAAY,EAAE;IACpC;AAEA;;;;;;;AAOG;AACH,IAAA,IAAI,CAAC,KAA2B,EAAA;AAC9B,QAAA,MAAM,EAAE,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC;AAClD,QAAA,MAAM,QAAQ,GAAa;YACzB,EAAE;YACF,IAAI,EAAE,KAAK,CAAC,IAAI;YAChB,KAAK,EAAE,KAAK,CAAC,KAAK;YAClB,OAAO,EAAE,KAAK,CAAC,OAAO;AACtB,YAAA,QAAQ,EAAE,KAAK,CAAC,QAAQ,IAAI,IAAI;AAChC,YAAA,QAAQ,EAAE,KAAK,CAAC,QAAQ,IAAI,WAAW;AACvC,YAAA,WAAW,EAAE,KAAK,CAAC,WAAW,KAAK,KAAK;AACxC,YAAA,YAAY,EAAE,KAAK,CAAC,YAAY,KAAK,KAAK;SAC3C;AAED,QAAA,MAAM,aAAa,GAAG,IAAI,CAAC,OAAO,CAAC,KAAK;AACxC,QAAA,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,GAAG,aAAa,EAAE,QAAQ,CAAC,CAAC;;QAG/C,IAAI,QAAQ,CAAC,QAAQ,IAAI,QAAQ,CAAC,QAAQ,GAAG,CAAC,EAAE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