{"version":3,"file":"button-menu.bundle.mjs","sources":["../../../../node_modules/govuk-frontend/dist/govuk/common/index.mjs","../../../../node_modules/govuk-frontend/dist/govuk/errors/index.mjs","../../../../node_modules/govuk-frontend/dist/govuk/component.mjs","../../../../node_modules/govuk-frontend/dist/govuk/common/configuration.mjs","../../../../src/moj/components/button-menu/button-menu.mjs"],"sourcesContent":["function getBreakpoint(name) {\n  const property = `--govuk-breakpoint-${name}`;\n  const value = window.getComputedStyle(document.documentElement).getPropertyValue(property);\n  return {\n    property,\n    value: value || undefined\n  };\n}\nfunction setFocus($element, options = {}) {\n  var _options$onBeforeFocu;\n  const isFocusable = $element.getAttribute('tabindex');\n  if (!isFocusable) {\n    $element.setAttribute('tabindex', '-1');\n  }\n  function onFocus() {\n    $element.addEventListener('blur', onBlur, {\n      once: true\n    });\n  }\n  function onBlur() {\n    var _options$onBlur;\n    (_options$onBlur = options.onBlur) == null || _options$onBlur.call($element);\n    if (!isFocusable) {\n      $element.removeAttribute('tabindex');\n    }\n  }\n  $element.addEventListener('focus', onFocus, {\n    once: true\n  });\n  (_options$onBeforeFocu = options.onBeforeFocus) == null || _options$onBeforeFocu.call($element);\n  $element.focus();\n}\nfunction isInitialised($root, moduleName) {\n  return $root instanceof HTMLElement && $root.hasAttribute(`data-${moduleName}-init`);\n}\n\n/**\n * Checks if GOV.UK Frontend is supported on this page\n *\n * Some browsers will load and run our JavaScript but GOV.UK Frontend\n * won't be supported.\n *\n * @param {HTMLElement | null} [$scope] - (internal) `<body>` HTML element checked for browser support\n * @returns {boolean} Whether GOV.UK Frontend is supported on this page\n */\nfunction isSupported($scope = document.body) {\n  if (!$scope) {\n    return false;\n  }\n  return $scope.classList.contains('govuk-frontend-supported');\n}\nfunction isArray(option) {\n  return Array.isArray(option);\n}\nfunction isObject(option) {\n  return !!option && typeof option === 'object' && !isArray(option);\n}\nfunction isScope($scope) {\n  return !!$scope && ($scope instanceof Element || $scope instanceof Document);\n}\nfunction formatErrorMessage(Component, message) {\n  return `${Component.moduleName}: ${message}`;\n}\n/**\n * @typedef ComponentWithModuleName\n * @property {string} moduleName - Name of the component\n */\n\nexport { formatErrorMessage, getBreakpoint, isInitialised, isObject, isScope, isSupported, setFocus };\n//# sourceMappingURL=index.mjs.map\n","import { isObject, formatErrorMessage } from '../common/index.mjs';\n\nclass GOVUKFrontendError extends Error {\n  constructor(...args) {\n    super(...args);\n    this.name = 'GOVUKFrontendError';\n  }\n}\nclass SupportError extends GOVUKFrontendError {\n  /**\n   * Checks if GOV.UK Frontend is supported on this page\n   *\n   * @param {HTMLElement | null} [$scope] - HTML element `<body>` checked for browser support\n   */\n  constructor($scope = document.body) {\n    const supportMessage = 'noModule' in HTMLScriptElement.prototype ? 'GOV.UK Frontend initialised without `<body class=\"govuk-frontend-supported\">` from template `<script>` snippet' : 'GOV.UK Frontend is not supported in this browser';\n    super($scope ? supportMessage : 'GOV.UK Frontend initialised without `<script type=\"module\">`');\n    this.name = 'SupportError';\n  }\n}\nclass ConfigError extends GOVUKFrontendError {\n  constructor(...args) {\n    super(...args);\n    this.name = 'ConfigError';\n  }\n}\nclass ElementError extends GOVUKFrontendError {\n  constructor(messageOrOptions) {\n    let message = typeof messageOrOptions === 'string' ? messageOrOptions : '';\n    if (isObject(messageOrOptions)) {\n      const {\n        component,\n        identifier,\n        element,\n        expectedType\n      } = messageOrOptions;\n      message = identifier;\n      message += element ? ` is not of type ${expectedType != null ? expectedType : 'HTMLElement'}` : ' not found';\n      if (component) {\n        message = formatErrorMessage(component, message);\n      }\n    }\n    super(message);\n    this.name = 'ElementError';\n  }\n}\nclass InitError extends GOVUKFrontendError {\n  constructor(componentOrMessage) {\n    const message = typeof componentOrMessage === 'string' ? componentOrMessage : formatErrorMessage(componentOrMessage, `Root element (\\`$root\\`) already initialised`);\n    super(message);\n    this.name = 'InitError';\n  }\n}\n/**\n * @import { ComponentWithModuleName } from '../common/index.mjs'\n */\n\nexport { ConfigError, ElementError, GOVUKFrontendError, InitError, SupportError };\n//# sourceMappingURL=index.mjs.map\n","import { isInitialised, isSupported } from './common/index.mjs';\nimport { InitError, ElementError, SupportError } from './errors/index.mjs';\n\nclass Component {\n  /**\n   * Returns the root element of the component\n   *\n   * @protected\n   * @returns {RootElementType} - the root element of component\n   */\n  get $root() {\n    return this._$root;\n  }\n  constructor($root) {\n    this._$root = void 0;\n    const childConstructor = this.constructor;\n    if (typeof childConstructor.moduleName !== 'string') {\n      throw new InitError(`\\`moduleName\\` not defined in component`);\n    }\n    if (!($root instanceof childConstructor.elementType)) {\n      throw new ElementError({\n        element: $root,\n        component: childConstructor,\n        identifier: 'Root element (`$root`)',\n        expectedType: childConstructor.elementType.name\n      });\n    } else {\n      this._$root = $root;\n    }\n    childConstructor.checkSupport();\n    this.checkInitialised();\n    const moduleName = childConstructor.moduleName;\n    this.$root.setAttribute(`data-${moduleName}-init`, '');\n  }\n  checkInitialised() {\n    const constructor = this.constructor;\n    const moduleName = constructor.moduleName;\n    if (moduleName && isInitialised(this.$root, moduleName)) {\n      throw new InitError(constructor);\n    }\n  }\n  static checkSupport() {\n    if (!isSupported()) {\n      throw new SupportError();\n    }\n  }\n}\n\n/**\n * @typedef ChildClass\n * @property {string} moduleName - The module name that'll be looked for in the DOM when initialising the component\n */\n\n/**\n * @typedef {typeof Component & ChildClass} ChildClassConstructor\n */\nComponent.elementType = HTMLElement;\n\nexport { Component };\n//# sourceMappingURL=component.mjs.map\n","import { Component } from '../component.mjs';\nimport { ConfigError } from '../errors/index.mjs';\nimport { isObject, formatErrorMessage, isScope } from './index.mjs';\n\nconst configOverride = Symbol.for('configOverride');\nclass ConfigurableComponent extends Component {\n  [configOverride](param) {\n    return {};\n  }\n\n  /**\n   * Returns the root element of the component\n   *\n   * @protected\n   * @returns {ConfigurationType} - the root element of component\n   */\n  get config() {\n    return this._config;\n  }\n  constructor($root, config) {\n    super($root);\n    this._config = void 0;\n    const childConstructor = this.constructor;\n    if (!isObject(childConstructor.defaults)) {\n      throw new ConfigError(formatErrorMessage(childConstructor, 'Config passed as parameter into constructor but no defaults defined'));\n    }\n    const datasetConfig = normaliseDataset(childConstructor, this._$root.dataset);\n    this._config = mergeConfigs(childConstructor.defaults, config != null ? config : {}, this[configOverride](datasetConfig), datasetConfig);\n  }\n}\nfunction normaliseString(value, property) {\n  const trimmedValue = value ? value.trim() : '';\n  let output;\n  let outputType = property == null ? void 0 : property.type;\n  if (!outputType) {\n    if (['true', 'false'].includes(trimmedValue)) {\n      outputType = 'boolean';\n    }\n    if (trimmedValue.length > 0 && isFinite(Number(trimmedValue))) {\n      outputType = 'number';\n    }\n  }\n  switch (outputType) {\n    case 'boolean':\n      output = trimmedValue === 'true';\n      break;\n    case 'number':\n      output = Number(trimmedValue);\n      break;\n    default:\n      output = value;\n  }\n  return output;\n}\nfunction normaliseDataset(Component, dataset) {\n  if (!isObject(Component.schema)) {\n    throw new ConfigError(formatErrorMessage(Component, 'Config passed as parameter into constructor but no schema defined'));\n  }\n  const out = {};\n  const entries = Object.entries(Component.schema.properties);\n  for (const entry of entries) {\n    const [namespace, property] = entry;\n    const field = namespace.toString();\n    if (field in dataset) {\n      out[field] = normaliseString(dataset[field], property);\n    }\n    if ((property == null ? void 0 : property.type) === 'object') {\n      out[field] = extractConfigByNamespace(Component.schema, dataset, namespace);\n    }\n  }\n  return out;\n}\nfunction normaliseOptions(scopeOrOptions) {\n  let $scope = document;\n  let onError;\n  if (isObject(scopeOrOptions)) {\n    const options = scopeOrOptions;\n    if (isScope(options.scope) || options.scope === null) {\n      $scope = options.scope;\n    }\n    if (typeof options.onError === 'function') {\n      onError = options.onError;\n    }\n  }\n  if (isScope(scopeOrOptions)) {\n    $scope = scopeOrOptions;\n  } else if (scopeOrOptions === null) {\n    $scope = null;\n  } else if (typeof scopeOrOptions === 'function') {\n    onError = scopeOrOptions;\n  }\n  return {\n    scope: $scope,\n    onError\n  };\n}\nfunction mergeConfigs(...configObjects) {\n  const formattedConfigObject = {};\n  for (const configObject of configObjects) {\n    for (const key of Object.keys(configObject)) {\n      const option = formattedConfigObject[key];\n      const override = configObject[key];\n      if (isObject(option) && isObject(override)) {\n        formattedConfigObject[key] = mergeConfigs(option, override);\n      } else {\n        formattedConfigObject[key] = override;\n      }\n    }\n  }\n  return formattedConfigObject;\n}\nfunction validateConfig(schema, config) {\n  const validationErrors = [];\n  for (const [name, conditions] of Object.entries(schema)) {\n    const errors = [];\n    if (Array.isArray(conditions)) {\n      for (const {\n        required,\n        errorMessage\n      } of conditions) {\n        if (!required.every(key => !!config[key])) {\n          errors.push(errorMessage);\n        }\n      }\n      if (name === 'anyOf' && !(conditions.length - errors.length >= 1)) {\n        validationErrors.push(...errors);\n      }\n    }\n  }\n  return validationErrors;\n}\nfunction extractConfigByNamespace(schema, dataset, namespace) {\n  const property = schema.properties[namespace];\n  if ((property == null ? void 0 : property.type) !== 'object') {\n    return;\n  }\n  const newObject = {\n    [namespace]: {}\n  };\n  for (const [key, value] of Object.entries(dataset)) {\n    let current = newObject;\n    const keyParts = key.split('.');\n    for (const [index, name] of keyParts.entries()) {\n      if (isObject(current)) {\n        if (index < keyParts.length - 1) {\n          if (!isObject(current[name])) {\n            current[name] = {};\n          }\n          current = current[name];\n        } else if (key !== namespace) {\n          current[name] = normaliseString(value);\n        }\n      }\n    }\n  }\n  return newObject[namespace];\n}\n/**\n * Schema for component config\n *\n * @template {Partial<Record<keyof ConfigurationType, unknown>>} ConfigurationType\n * @typedef {object} Schema\n * @property {Record<keyof ConfigurationType, SchemaProperty | undefined>} properties - Schema properties\n * @property {SchemaCondition<ConfigurationType>[]} [anyOf] - List of schema conditions\n */\n/**\n * Schema property for component config\n *\n * @typedef {object} SchemaProperty\n * @property {'string' | 'boolean' | 'number' | 'object'} type - Property type\n */\n/**\n * Schema condition for component config\n *\n * @template {Partial<Record<keyof ConfigurationType, unknown>>} ConfigurationType\n * @typedef {object} SchemaCondition\n * @property {(keyof ConfigurationType)[]} required - List of required config fields\n * @property {string} errorMessage - Error message when required config fields not provided\n */\n/**\n * @template {Partial<Record<keyof ConfigurationType, unknown>>} [ConfigurationType=ObjectNested]\n * @typedef ChildClass\n * @property {string} moduleName - The module name that'll be looked for in the DOM when initialising the component\n * @property {Schema<ConfigurationType>} [schema] - The schema of the component configuration\n * @property {ConfigurationType} [defaults] - The default values of the configuration of the component\n */\n/**\n * @template {Partial<Record<keyof ConfigurationType, unknown>>} [ConfigurationType=ObjectNested]\n * @typedef {typeof Component & ChildClass<ConfigurationType>} ChildClassConstructor<ConfigurationType>\n */\n/**\n * @import { CompatibleClass, Config, CreateAllOptions, OnErrorCallback } from '../init.mjs'\n */\n\nexport { ConfigurableComponent, configOverride, extractConfigByNamespace, mergeConfigs, normaliseDataset, normaliseOptions, normaliseString, validateConfig };\n//# sourceMappingURL=configuration.mjs.map\n","import { ConfigurableComponent } from 'govuk-frontend'\n\n/**\n * @augments {ConfigurableComponent<ButtonMenuConfig>}\n */\nexport class ButtonMenu extends ConfigurableComponent {\n  /**\n   * @param {Element | null} $root - HTML element to use for button menu\n   * @param {ButtonMenuConfig} [config] - Button menu config\n   */\n  constructor($root, config = {}) {\n    super($root, config)\n\n    // If only one button is provided, don't initiate a menu and toggle button\n    // if classes have been provided for the toggleButton, apply them to the single item\n    if (this.$root.children.length === 1) {\n      const $button = this.$root.children[0]\n\n      $button.classList.forEach((className) => {\n        if (className.startsWith('govuk-button-')) {\n          $button.classList.remove(className)\n        }\n\n        $button.classList.remove('moj-button-menu__item')\n        $button.classList.add('moj-button-menu__single-button')\n      })\n\n      if (this.config.buttonClasses) {\n        $button.classList.add(...this.config.buttonClasses.split(' '))\n      }\n    }\n    // Otherwise initialise a button menu\n    if (this.$root.children.length > 1) {\n      this.initMenu()\n    }\n  }\n\n  initMenu() {\n    this.$menu = this.createMenu()\n    this.$root.insertAdjacentHTML('afterbegin', this.toggleTemplate())\n    this.setupMenuItems()\n\n    this.$menuToggle = this.$root.querySelector(':scope > button')\n    this.$items = this.$menu.querySelectorAll('a, button')\n\n    this.$menuToggle.addEventListener('click', (event) => {\n      this.toggleMenu(event)\n    })\n\n    this.$root.addEventListener('keydown', (event) => {\n      this.handleKeyDown(event)\n    })\n\n    document.addEventListener('click', (event) => {\n      if (event.target instanceof Node && !this.$root.contains(event.target)) {\n        this.closeMenu(false)\n      }\n    })\n  }\n\n  createMenu() {\n    const $menu = document.createElement('ul')\n\n    $menu.setAttribute('role', 'list')\n    $menu.hidden = true\n    $menu.classList.add('moj-button-menu__wrapper')\n\n    if (this.config.alignMenu === 'right') {\n      $menu.classList.add('moj-button-menu__wrapper--right')\n    }\n\n    this.$root.appendChild($menu)\n\n    while (this.$root.firstChild !== $menu) {\n      $menu.appendChild(this.$root.firstChild)\n    }\n\n    return $menu\n  }\n\n  setupMenuItems() {\n    Array.from(this.$menu.children).forEach(($menuItem) => {\n      // wrap item in li tag\n      const $listItem = document.createElement('li')\n      this.$menu.insertBefore($listItem, $menuItem)\n      $listItem.appendChild($menuItem)\n\n      $menuItem.setAttribute('tabindex', '-1')\n\n      if ($menuItem.tagName === 'BUTTON') {\n        $menuItem.setAttribute('type', 'button')\n      }\n\n      $menuItem.classList.forEach((className) => {\n        if (className.startsWith('govuk-button')) {\n          $menuItem.classList.remove(className)\n        }\n      })\n\n      // add a slight delay after click before closing the menu, makes it *feel* better\n      $menuItem.addEventListener('click', () => {\n        setTimeout(() => {\n          this.closeMenu(false)\n        }, 50)\n      })\n    })\n  }\n\n  toggleTemplate() {\n    return `\n    <button type=\"button\" class=\"govuk-button moj-button-menu__toggle-button ${this.config.buttonClasses || ''}\" aria-haspopup=\"true\" aria-expanded=\"false\">\n      <span>\n       ${this.config.buttonText}\n       <svg width=\"11\" height=\"5\" viewBox=\"0 0 11 5\"  xmlns=\"http://www.w3.org/2000/svg\">\n         <path d=\"M5.5 0L11 5L0 5L5.5 0Z\" fill=\"currentColor\"/>\n       </svg>\n      </span>\n    </button>`\n  }\n\n  /**\n   * @returns {boolean}\n   */\n  isOpen() {\n    return this.$menuToggle.getAttribute('aria-expanded') === 'true'\n  }\n\n  /**\n   * @param {MouseEvent} event - Click event\n   */\n  toggleMenu(event) {\n    event.preventDefault()\n\n    // If menu is triggered with mouse don't move focus to first item\n    const keyboardEvent = event.detail === 0\n    const focusIndex = keyboardEvent ? 0 : -1\n\n    if (this.isOpen()) {\n      this.closeMenu()\n    } else {\n      this.openMenu(focusIndex)\n    }\n  }\n\n  /**\n   * Opens the menu and optionally sets the focus to the item with given index\n   *\n   * @param {number} focusIndex - The index of the item to focus\n   */\n  openMenu(focusIndex = 0) {\n    this.$menu.hidden = false\n    this.$menuToggle.setAttribute('aria-expanded', 'true')\n    if (focusIndex !== -1) {\n      this.focusItem(focusIndex)\n    }\n  }\n\n  /**\n   * Closes the menu and optionally returns focus back to menuToggle\n   *\n   * @param {boolean} moveFocus - whether to return focus to the toggle button\n   */\n  closeMenu(moveFocus = true) {\n    this.$menu.hidden = true\n    this.$menuToggle.setAttribute('aria-expanded', 'false')\n    if (moveFocus) {\n      this.$menuToggle.focus()\n    }\n  }\n\n  /**\n   * Focuses the menu item at the specified index\n   *\n   * @param {number} index - the index of the item to focus\n   */\n  focusItem(index) {\n    if (index >= this.$items.length) index = 0\n    if (index < 0) index = this.$items.length - 1\n\n    const $menuItem = this.$items.item(index)\n    if ($menuItem) {\n      $menuItem.focus()\n    }\n  }\n\n  currentFocusIndex() {\n    const $activeElement = document.activeElement\n    const $menuItems = Array.from(this.$items)\n\n    return (\n      ($activeElement instanceof HTMLAnchorElement ||\n        $activeElement instanceof HTMLButtonElement) &&\n      $menuItems.indexOf($activeElement)\n    )\n  }\n\n  /**\n   * @param {KeyboardEvent} event - Keydown event\n   */\n  handleKeyDown(event) {\n    if (event.target === this.$menuToggle) {\n      switch (event.key) {\n        case 'ArrowDown':\n          event.preventDefault()\n          this.openMenu()\n          break\n        case 'ArrowUp':\n          event.preventDefault()\n          this.openMenu(this.$items.length - 1)\n          break\n      }\n    }\n\n    if (\n      event.target instanceof Node &&\n      this.$menu.contains(event.target) &&\n      this.isOpen()\n    ) {\n      switch (event.key) {\n        case 'ArrowDown':\n          event.preventDefault()\n          if (this.currentFocusIndex() !== -1) {\n            this.focusItem(this.currentFocusIndex() + 1)\n          }\n          break\n        case 'ArrowUp':\n          event.preventDefault()\n          if (this.currentFocusIndex() !== -1) {\n            this.focusItem(this.currentFocusIndex() - 1)\n          }\n          break\n        case 'Home':\n          event.preventDefault()\n          this.focusItem(0)\n          break\n        case 'End':\n          event.preventDefault()\n          this.focusItem(this.$items.length - 1)\n          break\n      }\n    }\n\n    if (event.key === 'Escape' && this.isOpen()) {\n      this.closeMenu()\n    }\n    if (event.key === 'Tab' && this.isOpen()) {\n      this.closeMenu(false)\n    }\n  }\n\n  /**\n   * Name for the component used when initialising using data-module attributes.\n   */\n  static moduleName = 'moj-button-menu'\n\n  /**\n   * Button menu config\n   *\n   * @type {ButtonMenuConfig}\n   */\n  static defaults = Object.freeze({\n    buttonText: 'Actions',\n    alignMenu: 'left',\n    buttonClasses: ''\n  })\n\n  /**\n   * Button menu config schema\n   *\n   * @type {Schema<ButtonMenuConfig>}\n   */\n  static schema = Object.freeze(\n    /** @type {const} */ ({\n      properties: {\n        buttonText: { type: 'string' },\n        buttonClasses: { type: 'string' },\n        alignMenu: { type: 'string' }\n      }\n    })\n  )\n}\n\n/**\n * @typedef {object} ButtonMenuConfig\n * @property {string} [buttonText='Actions'] - Label for the toggle button\n * @property {\"left\" | \"right\"} [alignMenu='left'] - the alignment of the menu\n * @property {string} [buttonClasses='govuk-button--secondary'] - css classes applied to the toggle button\n */\n\n/**\n * @import { Schema } from 'govuk-frontend/dist/govuk/common/configuration.mjs'\n */\n"],"names":["isInitialised","$root","moduleName","HTMLElement","hasAttribute","isSupported","$scope","document","body","classList","contains","isArray","option","Array","isObject","formatErrorMessage","Component","message","GOVUKFrontendError","Error","constructor","args","name","SupportError","supportMessage","HTMLScriptElement","prototype","ConfigError","ElementError","messageOrOptions","component","identifier","element","expectedType","InitError","componentOrMessage","_$root","childConstructor","elementType","checkSupport","checkInitialised","setAttribute","configOverride","Symbol","for","ConfigurableComponent","param","config","_config","defaults","datasetConfig","normaliseDataset","dataset","mergeConfigs","normaliseString","value","property","trimmedValue","trim","output","outputType","type","includes","length","isFinite","Number","schema","out","entries","Object","properties","entry","namespace","field","toString","extractConfigByNamespace","configObjects","formattedConfigObject","configObject","key","keys","override","newObject","current","keyParts","split","index","ButtonMenu","children","$button","forEach","className","startsWith","remove","add","buttonClasses","initMenu","$menu","createMenu","insertAdjacentHTML","toggleTemplate","setupMenuItems","$menuToggle","querySelector","$items","querySelectorAll","addEventListener","event","toggleMenu","handleKeyDown","target","Node","closeMenu","createElement","hidden","alignMenu","appendChild","firstChild","from","$menuItem","$listItem","insertBefore","tagName","setTimeout","buttonText","isOpen","getAttribute","preventDefault","keyboardEvent","detail","focusIndex","openMenu","focusItem","moveFocus","focus","item","currentFocusIndex","$activeElement","activeElement","$menuItems","HTMLAnchorElement","HTMLButtonElement","indexOf","freeze"],"mappings":"AAmFO,SAASA,aAAaA,CAACC,KAAK,EAAEC,UAAU,EAAE;EAC/C,OACED,KAAK,YAAYE,WAAW,IAC5BF,KAAK,CAACG,YAAY,CAAC,CAAA,KAAA,EAAQF,UAAU,CAAA,KAAA,CAAO,CAAC;AAEjD;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASG,WAAWA,CAACC,MAAM,GAAGC,QAAQ,CAACC,IAAI,EAAE;EAClD,IAAI,CAACF,MAAM,EAAE;AACX,IAAA,OAAO,KAAK;AACd,EAAA;AAEA,EAAA,OAAOA,MAAM,CAACG,SAAS,CAACC,QAAQ,CAAC,0BAA0B,CAAC;AAC9D;AASA,SAASC,OAAOA,CAACC,MAAM,EAAE;AACvB,EAAA,OAAOC,KAAK,CAACF,OAAO,CAACC,MAAM,CAAC;AAC9B;AAUO,SAASE,QAAQA,CAACF,MAAM,EAAE;AAC/B,EAAA,OAAO,CAAC,CAACA,MAAM,IAAI,OAAOA,MAAM,KAAK,QAAQ,IAAI,CAAC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