{"version":3,"sources":["../src/index.tsx","../src/constants.ts","../src/utils.ts","../src/HolyProgress.ts"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { HolyProgress } from './HolyProgress';\nimport { DEFAULTS, START_HOLY_EVENT, STOP_HOLY_EVENT } from './constants';\nimport {\n  isSameHost,\n  isSamePageAnchor,\n  toAbsoluteURL,\n  hasSameQueryParameters,\n  isSamePathname,\n} from './utils';\n\nexport interface HolyLoaderProps {\n  /**\n   * Specifies the color of the top-loading bar.\n   * Default: \"#59a2ff\" (a shade of blue)\n   */\n  color?: string;\n\n  /**\n   * Sets the initial position of the top-loading bar as a percentage of the total width.\n   * Default: 0.08 (8% of the total width)\n   */\n  initialPosition?: number;\n\n  /**\n   * Specifies the height of the top-loading bar in either pixels (number) or css unit (string).\n   * Default: 4 pixels\n   */\n  height?: number | string;\n\n  /**\n   * Specifies the easing function to use for the loading animation. Accepts any valid CSS easing string.\n   * Default: \"ease\"\n   */\n  easing?: string;\n\n  /**\n   * Sets the animation speed of the top-loading bar in milliseconds.\n   * Default: 200 milliseconds\n   */\n  speed?: number;\n\n  /**\n   * Defines the z-index property of the top-loading bar, controlling its stacking order.\n   * Default: 2147483647\n   */\n  zIndex?: number;\n\n  /**\n   * Specifies the shadow effect to be applied to the top-loading bar.\n   * For example: \"0 0 10px #59a2ff, 0 0 5px #59a2ff\"\n   */\n  boxShadow?: string;\n\n  /**\n   * Specifies whether to accompany the loading bar with a spinner.\n   * Default: false\n   */\n  showSpinner?: boolean;\n\n  /**\n   * Specifies if search parameters should be ignored when evaluating\n   * whether to start the progress bar.\n   * Default: false\n   */\n  ignoreSearchParams?: boolean;\n\n  /**\n   * Specifies the direction of the loading bar.\n   * Default: \"ltr\"\n   */\n  dir?: 'ltr' | 'rtl';\n}\n\n/**\n * Dispatches the event to manually start the HolyLoader progress bar.\n */\nexport const startHolyLoader = (): void => {\n  document.dispatchEvent(new Event(START_HOLY_EVENT));\n};\n\n/**\n * Dispatches the event to manually stop the HolyLoader progress bar.\n */\nexport const stopHolyLoader = (): void => {\n  document.dispatchEvent(new Event(STOP_HOLY_EVENT));\n};\n\n/**\n * HolyLoader is a React component that provides a customizable top-loading progress bar.\n *\n * @param {HolyLoaderProps} props The properties for configuring the HolyLoader.\n * @returns {null}\n */\nconst HolyLoader = ({\n  color = DEFAULTS.color,\n  initialPosition = DEFAULTS.initialPosition,\n  height = DEFAULTS.height,\n  easing = DEFAULTS.easing,\n  speed = DEFAULTS.speed,\n  zIndex = DEFAULTS.zIndex,\n  boxShadow = DEFAULTS.boxShadow,\n  showSpinner = DEFAULTS.showSpinner,\n  ignoreSearchParams = DEFAULTS.ignoreSearchParams,\n  dir = DEFAULTS.dir, \n}: HolyLoaderProps): null => {\n  const holyProgressRef = React.useRef<HolyProgress | null>(null);\n\n  React.useEffect(() => {\n    const startProgress = (): void => {\n      if (holyProgressRef.current === null) {\n        return;\n      }\n\n      try {\n        holyProgressRef.current.start();\n      } catch (error) {}\n    };\n\n    const stopProgress = (): void => {\n      if (holyProgressRef.current === null) {\n        return;\n      }\n\n      try {\n        holyProgressRef.current.complete();\n      } catch (error) {}\n    };\n\n    /**\n     * Flag to prevent redundant patching of History API methods.\n     * This is essential to avoid pushState & replaceState increasingly nesting\n     * within patched versions of itself\n     */\n    let isHistoryPatched = false;\n\n    /**\n     * Enhances browser history methods (pushState and replaceState) to ensure that the\n     * progress indicator is appropriately halted when navigating through single-page applications\n     */\n    const stopProgressOnHistoryUpdate = (): void => {\n      if (isHistoryPatched) {\n        return;\n      }\n\n      const originalPushState = history.pushState.bind(history);\n      history.pushState = (...args) => {\n        const url = args[2];\n        if (\n          url &&\n          isSamePathname(window.location.href, url) &&\n          (ignoreSearchParams ||\n            hasSameQueryParameters(window.location.href, url))\n        ) {\n          originalPushState(...args);\n          return;\n        }\n        stopProgress();\n        originalPushState(...args);\n      };\n\n      // This is crucial for Next.js Link components using the 'replace' prop.\n      const originalReplaceState = history.replaceState.bind(history);\n      history.replaceState = (...args) => {\n        const url = args[2];\n        if (\n          url &&\n          isSamePathname(window.location.href, url) &&\n          (ignoreSearchParams ||\n            hasSameQueryParameters(window.location.href, url))\n        ) {\n          originalReplaceState(...args);\n          return;\n        }\n        stopProgress();\n        originalReplaceState(...args);\n      };\n\n      isHistoryPatched = true;\n    };\n\n    /**\n     * Handles click events on anchor tags, starting the progress bar for page navigation.\n     * It checks for various conditions to decide whether to start the progress bar or not.\n     *\n     * @param {MouseEvent} event The mouse event triggered by clicking an anchor tag.\n     */\n    const handleClick = (event: MouseEvent): void => {\n      try {\n        const target = event.target as HTMLElement;\n        const anchor = target.closest('a');\n\n        if (\n          anchor === null ||\n          anchor.target === '_blank' ||\n          anchor.hasAttribute('download') ||\n          event.ctrlKey ||\n          event.metaKey ||\n          // Skip if URL points to a different domain\n          !isSameHost(window.location.href, anchor.href) ||\n          // Skip if URL is a same-page anchor (href=\"#\", href=\"#top\", etc.).\n          isSamePageAnchor(window.location.href, anchor.href) ||\n          // Skip if URL uses a non-http/https protocol (mailto:, tel:, etc.).\n          !toAbsoluteURL(anchor.href).startsWith('http') ||\n          // Skip if the URL is the same as the current page\n          (isSamePathname(window.location.href, anchor.href) &&\n            (ignoreSearchParams ||\n              hasSameQueryParameters(window.location.href, anchor.href)))\n        ) {\n          return;\n        }\n\n        startProgress();\n      } catch (error) {\n        stopProgress();\n      }\n    };\n\n    try {\n      if (holyProgressRef.current === null) {\n        holyProgressRef.current = new HolyProgress({\n          color,\n          height,\n          initialPosition,\n          easing,\n          speed,\n          zIndex,\n          boxShadow,\n          showSpinner,\n          dir\n        });\n      }\n\n      document.addEventListener('click', handleClick);\n      document.addEventListener(START_HOLY_EVENT, startProgress);\n      document.addEventListener(STOP_HOLY_EVENT, stopProgress);\n      stopProgressOnHistoryUpdate();\n    } catch (error) {}\n\n    return () => {\n      document.removeEventListener('click', handleClick);\n      document.removeEventListener(START_HOLY_EVENT, startProgress);\n      document.removeEventListener(STOP_HOLY_EVENT, stopProgress);\n    };\n  }, [holyProgressRef]);\n\n  return null;\n};\n\nexport default HolyLoader;\n","export const DEFAULTS = {\n  color: '#59a2ff',\n  initialPosition: 0.08,\n  height: 4,\n  easing: 'ease',\n  speed: 200,\n  zIndex: 2147483647,\n  showSpinner: false,\n  boxShadow: undefined,\n  ignoreSearchParams: false,\n  dir: 'ltr',\n} as const;\n\nexport const START_HOLY_EVENT = 'holy-progress-start';\nexport const STOP_HOLY_EVENT = 'holy-progress-stop';\n","/**\n * Converts a given URL to an absolute URL based on the current window location.\n * If the input URL is already absolute, it remains unchanged.\n *\n * @param {string} url - The URL to be converted. Can be an absolute or relative URL.\n * @returns {string} The absolute URL derived from the given URL and the current window location.\n */\nexport const toAbsoluteURL = (url: string): string => {\n  return new URL(url, window.location.href).href;\n};\n\n/**\n * Determines if two URLs refer to the same page, differing only by the anchor.\n *\n * @param {string} currentUrl The current URL.\n * @param {string} newUrl The new URL to compare with the current URL.\n * @returns {boolean} True if the URLs refer to the same page (excluding the anchor), false otherwise.\n */\nexport const isSamePageAnchor = (\n  currentUrl: string,\n  newUrl: string,\n): boolean => {\n  const current = new URL(toAbsoluteURL(currentUrl));\n  const next = new URL(toAbsoluteURL(newUrl));\n  return current.href.split('#')[0] === next.href.split('#')[0];\n};\n\n/**\n * Determines if two URLs have the same host.\n *\n * @param {string} currentUrl The current URL.\n * @param {string} newUrl The new URL to compare with the current URL.\n * @returns {boolean} True if the URLs have the same host, false otherwise.\n */\nexport const isSameHost = (currentUrl: string, newUrl: string): boolean => {\n  const current = new URL(toAbsoluteURL(currentUrl));\n  const next = new URL(toAbsoluteURL(newUrl));\n  return (\n    current.hostname.replace(/^www\\./, '') ===\n    next.hostname.replace(/^www\\./, '')\n  );\n};\n\nconst paramsAreEqual = (params1: URLSearchParams, params2: URLSearchParams) =>\n  Array.from(params1).every(\n    ([key, value]) => params2.has(key) && params2.get(key) === value,\n  );\n\n/**\n * Determines if two URLs have the same query parameters.\n *\n * @param {string} currentUrl The current URL.\n * @param {string} newUrl The new URL to compare with the current URL.\n * @returns {boolean} True if the URLs have the same query parameters, false otherwise.\n */\nexport const hasSameQueryParameters = (\n  currentUrl: string,\n  newUrl: string | URL,\n): boolean => {\n  const current = new URL(toAbsoluteURL(currentUrl));\n  const next = newUrl instanceof URL ? newUrl : new URL(toAbsoluteURL(newUrl));\n\n  const currentParams = new URLSearchParams(current.search);\n  const nextParams = new URLSearchParams(next.search);\n\n  return (\n    paramsAreEqual(currentParams, nextParams) &&\n    paramsAreEqual(nextParams, currentParams)\n  );\n};\n\n/**\n * Determines if two URLs have the same pathname.\n *\n * @param {string} currentUrl The current URL.\n * @param {string} newUrl The new URL to compare with the current URL.\n * @returns {boolean} True if the URLs have the same pathname, false otherwise.\n */\nexport const isSamePathname = (\n  currentUrl: string,\n  newUrl: string | URL,\n): boolean => {\n  const current = new URL(toAbsoluteURL(currentUrl));\n  const next = newUrl instanceof URL ? newUrl : new URL(toAbsoluteURL(newUrl));\n  return current.pathname === next.pathname;\n};\n\nexport const clamp = (n: number, min: number, max: number): number =>\n  Math.max(min, Math.min(n, max));\n\nexport const queue = (() => {\n  const pending: Array<(next: () => void) => void> = [];\n\n  const next = (): void => {\n    const fn = pending.shift();\n    if (fn !== undefined) {\n      fn(next);\n    }\n  };\n\n  return (fn: (next: () => void) => void) => {\n    pending.push(fn);\n    if (pending.length === 1) {\n      next();\n    }\n  };\n})();\n\nexport const repaintElement = (obj: HTMLElement): HTMLElement => {\n  void obj.offsetWidth;\n  return obj;\n};\n","import { DEFAULTS } from './constants';\nimport { clamp, queue, repaintElement } from './utils';\n\ntype HolyProgressProps = {\n  /**\n   * Specifies the minimum value for the progress bar to start at.\n   * Default: 0.08 (8% of the total width)\n   */\n  initialPosition: number;\n\n  /**\n   * Specifies the CSS easing type for the progress bar animation.\n   * Default: 'linear'\n   */\n  easing: string;\n\n  /**\n   * Specifies the speed of the progress bar animation in milliseconds.\n   * Default: 200\n   */\n  speed: number;\n\n  /**\n   * Specifies the color of the progress bar.\n   * Default: '#59a2ff'\n   */\n  color: string;\n\n  /**\n   * Specifies the height of the progress bar in either pixels (number) or css unit (string).\n   * Default: 4\n   */\n  height: number | string;\n\n  /**\n   * Specifies the z-index of the progress bar.\n   * Default: 2147483647\n   */\n  zIndex: number;\n\n  /**\n   * Specifies the shadow effect to be applied to the progress bar.\n   * For example: \"0 0 10px #59a2ff, 0 0 5px #59a2ff\"\n   */\n  boxShadow?: string;\n\n  /**\n   * Specifies whether to accompany the loading bar with a spinner.\n   * Default: false\n   */\n  showSpinner?: boolean;\n\n  /**\n   * Specifies the direction of the loading bar.\n   * Default: \"ltr\"\n   */\n  dir?: 'ltr' | 'rtl';\n};\n\ntype TransformStrategy = 'translate3d' | 'translate' | 'margin';\n\n/**\n * Class representing a HolyProgress bar.\n * @class\n * @classdesc A flexible, customizable progress bar for web applications.\n */\nexport class HolyProgress {\n  private readonly settings: HolyProgressProps;\n\n  /**\n   * The progres of the bar as a number between 0 and 1.\n   * If 0 is reached, the status is null\n   */\n  private progressN: number | null;\n\n  private bar: HTMLElement | null;\n\n  /**\n   * Create a HolyProgress instance.\n   * @param {Partial<HolyProgressProps>} [customSettings] - Optional custom settings to override defaults.\n   */\n  constructor(customSettings?: Partial<HolyProgressProps>) {\n    this.settings = { ...DEFAULTS, ...customSettings };\n    this.progressN = null;\n    this.bar = null;\n  }\n\n  /**\n   * Sets the progress to a specific value.\n   * @private\n   * @param {number} n - The new progress value (0 to 1).\n   * @returns {HolyProgress} The current instance for chaining methods.\n   */\n  private readonly setTo = (n: number): HolyProgress => {\n    const isStarted = typeof this.progressN === 'number';\n\n    n = clamp(n, this.settings.initialPosition, 1);\n\n    this.progressN = n === 1 ? null : n;\n\n    const progressBar = this.getOrCreateBar(!isStarted);\n\n    if (!progressBar) {\n      return this;\n    }\n\n    repaintElement(progressBar);\n\n    queue((next) => {\n      if (!this.bar) {\n        return;\n      }\n\n      Object.assign(this.bar.style, this.barPositionCSS(n), {\n        transition: `all ${this.settings.speed}ms ${this.settings.easing}`,\n      });\n\n      if (n === 1) {\n        progressBar.style.transition = 'none';\n        progressBar.style.opacity = '1';\n        repaintElement(progressBar);\n\n        setTimeout(() => {\n          progressBar.style.transition = `all ${this.settings.speed}ms linear`;\n          progressBar.style.opacity = '0';\n          setTimeout(() => {\n            this.removeBarFromDOM();\n            next();\n          }, this.settings.speed);\n\n          this.removeSpinnerFromDOM();\n        }, this.settings.speed);\n      } else {\n        setTimeout(next, this.settings.speed);\n      }\n    });\n    return this;\n  };\n\n  /**\n   * Converts a progress value (0 to 1) into a percentage representation.\n   * Used for calculating the visual width of the progress bar.\n   * @private\n   * @param {number} n - The progress value to convert.\n   * @returns {number} The percentage representation of the progress value.\n   */\n  private readonly toBarPercentage = (n: number): number =>\n    this.settings.dir === 'ltr' ? (-1 + n) * 100 : (1 - n) * 100;\n\n  /**\n   * Initiates the progress bar's movement. If already started, it continues from the current position.\n   * Automatically handles automatic incrementation ('trickle') if enabled.\n   * @public\n   * @returns {HolyProgress} The current instance for chaining methods.\n   */\n  public readonly start = (): HolyProgress => {\n    if (this.progressN === null) {\n      this.setTo(0);\n\n      this.startTrickle();\n\n      if (this.settings.showSpinner === true) {\n        this.createSpinner();\n      }\n    }\n\n    return this;\n  };\n\n  /**\n   * Performs automatic incrementation of the progress bar.\n   * This function is recursive and continues to increment the progress at intervals defined by `speed`.\n   * @private\n   */\n  private readonly startTrickle = (): void => {\n    const run = (): void => {\n      if (this.progressN === null) return;\n\n      this.incrementStatus();\n      setTimeout(run, this.settings.speed);\n    };\n\n    setTimeout(run, this.settings.speed);\n  };\n\n  /**\n   * Completes the progress, moving it to 100%\n   * @public\n   * @returns {HolyProgress} The current instance for chaining methods.\n   */\n  public readonly complete = (): HolyProgress => this.setTo(1);\n\n  /**\n   * Calculates an increment value based on the current status of the progress.\n   * This is used to determine the amount of progress to add during automatic incrementation.\n   * @private\n   * @param {number} status - The current progress status.\n   * @returns {number} The calculated increment value.\n   */\n  private readonly calculateIncrement = (status: number): number => {\n    const base = 0.1;\n    const scale = 5;\n    return base * Math.exp(-scale * status);\n  };\n\n  /**\n   * Increments the progress bar by a specified amount, or by an amount determined by `calculateIncrement` if not specified.\n   * @private\n   * @param {number} [amount] - The amount to increment the progress bar.\n   * @returns {HolyProgress} The current instance for chaining methods.\n   */\n  private readonly incrementStatus = (amount?: number): HolyProgress => {\n    if (this.progressN === null) {\n      return this.start();\n    }\n\n    if (this.progressN > 1) {\n      return this;\n    }\n\n    if (typeof amount !== 'number') {\n      amount = this.calculateIncrement(this.progressN);\n    }\n\n    /**\n     * Do not clamp to 1 - the progress bar can only fully finish by being set to 1 by the user.\n     * This prevents the progress bar completing itself by incrementing to 1 before an action has been completed or a page loaded.\n     */\n    this.progressN = clamp(this.progressN + amount, 0, 0.994);\n\n    return this.setTo(this.progressN);\n  };\n\n  /**\n   * Creates and initializes a new progress bar element in the DOM.\n   * It sets up the necessary styles and appends the element to the document body.\n   * @private\n   * @param {boolean} fromStart - Indicates if the bar is created from the start position.\n   * @returns {HTMLElement | null} The created progress bar element, or null if creation fails.\n   */\n  private readonly createBar = (fromStart: boolean): HTMLElement | null => {\n    const barContainer = document.createElement('div');\n    barContainer.id = 'holy-progress';\n    barContainer.style.pointerEvents = 'none';\n    barContainer.innerHTML = '<div class=\"bar\" role=\"bar\"></div>';\n\n    this.bar = barContainer.querySelector(\n      '[role=\"bar\"]',\n    ) satisfies HTMLElement | null;\n\n    if (!this.bar) {\n      return null;\n    }\n\n    const percentage = this.toBarPercentage(\n      fromStart ? 0 : (this.progressN ?? 0),\n    );\n\n    this.bar.style.background = this.settings.color;\n    if (typeof this.settings.height === 'number') {\n      this.bar.style.height = `${this.settings.height}px`;\n    } else {\n      this.bar.style.height = this.settings.height;\n    }\n    this.bar.style.zIndex = this.settings.zIndex.toString();\n    this.bar.style.position = 'fixed';\n    this.bar.style.width = '100%';\n    this.bar.style.top = '0';\n    this.bar.style.left = '0';\n    this.bar.style.transition = 'all 0 linear';\n    this.bar.style.transform = `translate3d(${percentage}%,0,0)`;\n    this.bar.style.boxShadow = this.settings.boxShadow ?? '';\n\n    document.body.appendChild(barContainer);\n\n    return barContainer;\n  };\n\n  /**\n   * Creates and initializes a new spinner element in the DOM.\n   * It sets up the necessary styles and appends the element to the document body.\n   * @private\n   * @returns {void}\n   */\n  private readonly createSpinner = (): void => {\n    /** only createSpinner if it doesn't exist */\n    if (document.getElementById('holy-progress-spinner') !== null) {\n      return;\n    }\n\n    const spinner = document.createElement('div');\n    spinner.id = 'holy-progress-spinner';\n    spinner.style.pointerEvents = 'none';\n\n    spinner.style.display = 'block';\n    spinner.style.position = 'fixed';\n    spinner.style.zIndex = this.settings.zIndex.toString();\n    spinner.style.top = '15px';\n    spinner.style.right = '15px';\n\n    spinner.style.width = '18px';\n    spinner.style.height = '18px';\n    spinner.style.boxSizing = 'border-box';\n\n    spinner.style.border = 'solid 2px transparent';\n    spinner.style.borderTopColor = this.settings.color;\n    spinner.style.borderLeftColor = this.settings.color;\n    spinner.style.borderRadius = '50%';\n    spinner.style.animation = 'holy-progress-spinner 400ms linear infinite';\n\n    const keyframes = `\n      @keyframes holy-progress-spinner {\n        0%   { transform: rotate(0deg); }\n        100% { transform: rotate(360deg); }\n      }\n    `;\n\n    const style = document.createElement('style');\n    style.innerHTML = keyframes;\n    spinner.appendChild(style);\n\n    document.body.appendChild(spinner);\n  };\n\n  private readonly getOrCreateBar = (fromStart: boolean): HTMLElement | null =>\n    document.getElementById('holy-progress') ?? this.createBar(fromStart);\n\n  private readonly removeBarFromDOM = (): void =>\n    document.getElementById('holy-progress')?.remove();\n\n  private readonly removeSpinnerFromDOM = (): void =>\n    document.getElementById('holy-progress-spinner')?.remove();\n\n  /**\n   * Determines the most suitable CSS positioning strategy based on browser capabilities.\n   * Checks for transform properties with vendor prefixes and standard un-prefixed properties.\n   * @private\n   * @returns {TransformStrategy} - The optimal CSS positioning strategy ('translate3d', 'translate', or 'margin').\n   */\n  private readonly getTransformStrategy = (): TransformStrategy => {\n    const style = document.body.style;\n    const prefixes = ['Webkit', 'Moz', 'ms', 'O', ''];\n    let transformProp = '';\n\n    for (let i = 0; i < prefixes.length; i++) {\n      if (`${prefixes[i]}Transform` in style) {\n        transformProp = prefixes[i];\n        break;\n      }\n    }\n\n    if (transformProp !== '' && `${transformProp}Perspective` in style) {\n      return 'translate3d';\n    }\n    if (transformProp !== '') {\n      return 'translate';\n    }\n    return 'margin';\n  };\n\n  /**\n   * Generates the CSS for the progress bar position based on the detected positioning strategy.\n   * Dynamically sets the transform or margin-left properties for the bar's position.\n   * @private\n   * @param {number} n - Position value of the bar, as a number between 0 and 1.\n   * @returns {Object} - CSS styles for the progress bar.\n   */\n  private readonly barPositionCSS = (n: number): Record<string, string> => {\n    const transformStrategy = this.getTransformStrategy();\n    const barPosition = `${this.toBarPercentage(n)}%`;\n\n    if (transformStrategy === 'translate3d') {\n      return { transform: `translate3d(${barPosition},0,0)` };\n    }\n    if (transformStrategy === 'translate') {\n      return { transform: `translate(${barPosition},0)` };\n    }\n    return { marginLeft: barPosition };\n  };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,YAAuB;;;ACFhB,IAAM,WAAW;AAAA,EACtB,OAAO;AAAA,EACP,iBAAiB;AAAA,EACjB,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,aAAa;AAAA,EACb,WAAW;AAAA,EACX,oBAAoB;AAAA,EACpB,KAAK;AACP;AAEO,IAAM,mBAAmB;AACzB,IAAM,kBAAkB;;;ACPxB,IAAM,gBAAgB,wBAAC,QAAwB;AACpD,SAAO,IAAI,IAAI,KAAK,OAAO,SAAS,IAAI,EAAE;AAC5C,GAF6B;AAWtB,IAAM,mBAAmB,wBAC9B,YACA,WACY;AACZ,QAAM,UAAU,IAAI,IAAI,cAAc,UAAU,CAAC;AACjD,QAAM,OAAO,IAAI,IAAI,cAAc,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