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K,WACD,IACA,EAAM,SACN,MACJ,IAAK,UACD,IACA,EAAM,QACN,MACJ,IAAK,WACD,EAAM,SACN,MAIJ,QACI,EAAM,MAGd,QAAQ,eAAe,gBAAiB,EAAK,EAAO,OAAQ,aAAc,EAAO,KAAM,EAAO,SAC9F,EAAO,MAAM,SAAQ,SAAU,GAC3B,eAAe,EAAM,OACrB,eAAe,EAAM,OACzB,IACA,QAAQ,UACZ,IACA,QAAQ,YACJ,GAAa,IACb,MAAM,YAAA,OAAY,EAAS,uCAAA,OAAsC,EAAY,0FAInF,CAmBA,SAAS,SACP,EACA,EACA,EACA,EACA,EACA,QAFA,IAAA,MAAQ,IAIR,MAAQ,EACR,SAAW,EACX,QAAU,EACV,QAAU,EAEV,OAAS,GAAW,aAEpB,IAAM,GAHN,KAAO,GAGuB,QA4B9B,OA3BI,IACF,KAAY,MAAI,QACb,SAAS,GACT,KAAI,SAAA,GAAQ,OAAA,kBAAA,GAAM,GAAI,CAAE,GAAI,EAAK,OAAQ,SAAS,GAAtC,IACf,KAAwB,mBAAI,GAG1B,OAAO,KAAK,MAAM,OAAS,GAC7B,QAAQ,UAAU,MAEpB,QAAQ,UAAU,CAAE,eAAgB,CAAC,0BAChC,iBACH,eAAiB,MAAM,cAEvB,MAAM,cAAgB,W,IAAU,IAAA,EAAA,GAAA,EAAA,EAAA,EAAA,UAAA,OAAA,IAAA,EAAA,GAAA,UAAA,GAC9B,IAAM,EAAU,eAAe,MAAM,KAAM,GAQ3C,OANI,EAAQ,QAAU,EAAQ,OAAO,UACnC,aAAa,EAAQ,OAAO,WACnB,EAAQ,QAAU,EAAQ,OAAO,WAC1C,aAAa,EAAQ,OAAO,WAGvB,CACT,GAGK,eAAe,SAAS,KAAM,QACvC,CAEA,OAAA,QAAS","file":"/npm/axe-core-react-ffit@4.4.4/dist/index.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/axe-core-react-ffit@4.4.4/dist/index.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","/* global Promise */\r\nimport axeCore = require('axe-core');\r\nimport rIC = require('requestidlecallback');\r\nimport after = require('./after');\r\nimport cache from './cache';\r\n\r\nconst requestIdleCallback = rIC.request;\r\nconst cancelIdleCallback = rIC.cancel;\r\n\r\nlet React;\r\nlet ReactDOM;\r\nlet logger;\r\n\r\n// contrasted against Chrome default color of #ffffff\r\nconst lightTheme = {\r\n  serious: '#d93251',\r\n  minor: '#d24700',\r\n  text: 'black'\r\n};\r\n\r\n// contrasted against Safari dark mode color of #535353\r\nconst darkTheme = {\r\n  serious: '#ffb3b3',\r\n  minor: '#ffd500',\r\n  text: 'white'\r\n};\r\n\r\nconst theme =\r\n  window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches\r\n    ? darkTheme\r\n    : lightTheme;\r\n\r\nconst boldCourier = 'font-weight:bold;font-family:Courier;';\r\nconst critical = `color:${theme.serious};font-weight:bold;`;\r\nconst serious = `color:${theme.serious};font-weight:normal;`;\r\nconst moderate = `color:${theme.minor};font-weight:bold;`;\r\nconst minor = `color:${theme.minor};font-weight:normal;`;\r\nconst defaultReset = `font-color:${theme.text};font-weight:normal;`;\r\n\r\nlet idleId: number | undefined;\r\nlet timeout: number;\r\nlet context: axeCore.ElementContext | undefined;\r\nlet conf: ReactSpec;\r\nlet _createElement: typeof React.createElement;\r\nconst components: { [id: number]: React.Component } = {};\r\nconst nodes: Node[] = [document.documentElement];\r\n\r\n// Returns a function, that, as long as it continues to be invoked, will not\r\n// be triggered. The function will be called after it stops being called for\r\n// N milliseconds. If `immediate` is passed, trigger the function on the\r\n// leading edge, instead of the trailing.\r\n// @see https://davidwalsh.name/javascript-debounce-function\r\nfunction debounce(func: Function, wait: number, immediate?: boolean): Function {\r\n  let _timeout;\r\n  return function (...args): void {\r\n    const later = (): void => {\r\n      _timeout = null;\r\n      if (!immediate) func.apply(this, args);\r\n    };\r\n    const callNow = immediate && !_timeout;\r\n    clearTimeout(_timeout);\r\n    _timeout = setTimeout(later, wait);\r\n    if (callNow) func.apply(this, args);\r\n  };\r\n}\r\n\r\n/**\r\n * Return the entire parent tree of a node (from HTML down).\r\n * @param {Node} node\r\n * @return {Node[]}\r\n */\r\nfunction getPath(node: Node): Node[] {\r\n  const path: Node[] = [node];\r\n  while (node && node.nodeName.toLowerCase() !== 'html') {\r\n    path.push(node.parentNode);\r\n    node = node.parentNode;\r\n  }\r\n  if (!node || !node.parentNode) {\r\n    return null;\r\n  }\r\n  return path.reverse();\r\n}\r\n\r\n/**\r\n * Find the common parent of an array of nodes.\r\n * @param {Node[]} nodes\r\n * @return {Node}\r\n */\r\nfunction getCommonParent(nodes: Node[]): Node {\r\n  let path: Node[] | null;\r\n  let nextPath: Node[] | null;\r\n  if (nodes.length === 1) {\r\n    return nodes.pop();\r\n  }\r\n  while (!path && nodes.length) {\r\n    path = getPath(nodes.pop());\r\n  }\r\n  while (nodes.length) {\r\n    nextPath = getPath(nodes.pop());\r\n    if (nextPath) {\r\n      path = path.filter((node: Node, index: number) => {\r\n        return nextPath.length > index && nextPath[index] === node;\r\n      });\r\n    }\r\n  }\r\n  return path ? path[path.length - 1] : document;\r\n}\r\n\r\n/**\r\n * Log the axe result node to the console\r\n * @param {NodeResult} node\r\n * @param {Function} logFn console log function to use (error, warn, log, etc.)\r\n */\r\nfunction logElement(\r\n  node: axeCore.NodeResult | axeCore.RelatedNode,\r\n  logFn: (...args) => void\r\n): void {\r\n  const el = document.querySelector(node.target.toString());\r\n  if (!el) {\r\n    logFn('Selector: %c%s', boldCourier, node.target.toString());\r\n  } else {\r\n    logFn('Element: %o', el);\r\n  }\r\n}\r\n\r\n/**\r\n * Log the axe result node html tot he console\r\n * @param {NodeResult} node\r\n */\r\nfunction logHtml(node: axeCore.NodeResult | axeCore.RelatedNode): void {\r\n  console.log('HTML: %c%s', boldCourier, node.html);\r\n}\r\n\r\n/**\r\n * Log the failure message of a node result.\r\n * @param {NodeResult} node\r\n * @param {String} key which check array to log from (any, all, none)\r\n */\r\nfunction logFailureMessage(\r\n  node: axeCore.NodeResult,\r\n  key: AxeCoreNodeResultKey\r\n): void {\r\n  // this exists on axe but we don't export it as part of the typescript\r\n  // namespace, so just let me use it as I need\r\n  const message: string = (\r\n    axeCore as unknown as AxeWithAudit\r\n  )._audit.data.failureSummaries[key].failureMessage(\r\n    node[key].map(check => check.message || '')\r\n  );\r\n\r\n  console.error(message);\r\n}\r\n\r\n/**\r\n * Log as a group the node result and failure message.\r\n * @param {NodeResult} node\r\n * @param {String} key which check array to log from (any, all, none)\r\n */\r\nfunction failureSummary(\r\n  node: axeCore.NodeResult,\r\n  key: AxeCoreNodeResultKey\r\n): void {\r\n  if (node[key].length > 0) {\r\n    logElement(node, console.groupCollapsed);\r\n    logHtml(node);\r\n    logFailureMessage(node, key);\r\n\r\n    let relatedNodes: axeCore.RelatedNode[] = [];\r\n    node[key].forEach(check => {\r\n      relatedNodes = relatedNodes.concat(check.relatedNodes);\r\n    });\r\n\r\n    if (relatedNodes.length > 0) {\r\n      console.groupCollapsed('Related nodes');\r\n      relatedNodes.forEach(relatedNode => {\r\n        logElement(relatedNode, console.log);\r\n        logHtml(relatedNode);\r\n      });\r\n      console.groupEnd();\r\n    }\r\n\r\n    console.groupEnd();\r\n  }\r\n}\r\n\r\n/**\r\n * Run axe against the passed in node and report violations\r\n * @param {*} node\r\n * @param {Number} timeout force call of axe.run after the timeout has passed (if not called before)\r\n * @return {Promise}\r\n */\r\nfunction checkAndReport(node: Node, timeout: number): Promise<void> {\r\n  const disableDeduplicate = conf['disableDeduplicate'];\r\n\r\n  if (idleId) {\r\n    cancelIdleCallback(idleId);\r\n    idleId = undefined;\r\n  }\r\n\r\n  return new Promise((resolve, reject) => {\r\n    nodes.push(node);\r\n    idleId = requestIdleCallback(\r\n      () => {\r\n        let n: axeCore.ElementContext | Node = context;\r\n        if (n === undefined) {\r\n          n = getCommonParent(nodes.filter(node => node.isConnected));\r\n          if (n.nodeName.toLowerCase() === 'html') {\r\n            // if the only common parent is the body, then analyze the whole page\r\n            n = document;\r\n          }\r\n        }\r\n        axeCore.configure({ allowedOrigins: ['<unsafe_all_origins>'] });\r\n        axeCore.run(\r\n          n,\r\n          { reporter: 'v2' },\r\n          function (error: Error, results: axeCore.AxeResults) {\r\n            if (error) {\r\n              return reject(error);\r\n            }\r\n\r\n            results.violations = results.violations.filter(result => {\r\n              result.nodes = result.nodes.filter(node => {\r\n                const key: string = node.target.toString() + result.id;\r\n                const retVal = !cache.get(key);\r\n                cache.set(key, key);\r\n                return disableDeduplicate || retVal;\r\n              });\r\n              return !!result.nodes.length;\r\n            });\r\n\r\n            if (results.violations.length) {\r\n              logger(results);\r\n            }\r\n\r\n            resolve();\r\n          }\r\n        );\r\n      },\r\n      {\r\n        timeout: timeout\r\n      }\r\n    );\r\n  });\r\n}\r\n\r\n/**\r\n * Check the node for violations.\r\n * @param {Component} component\r\n */\r\nfunction checkNode(component: React.Component): void {\r\n  let node: Node;\r\n\r\n  try {\r\n    node = ReactDOM.findDOMNode(component);\r\n  } catch (e) {\r\n    console.group('%caxe error: could not check node', critical);\r\n    console.group('%cComponent', serious);\r\n    console.error(component);\r\n    console.groupEnd();\r\n    console.group('%cError', serious);\r\n    console.error(e);\r\n    console.groupEnd();\r\n    console.groupEnd();\r\n  }\r\n\r\n  if (node) {\r\n    checkAndReport(node, timeout);\r\n  }\r\n}\r\n\r\n/**\r\n * Check the component for violations whenever the DOM updates\r\n * @param {Component} component\r\n */\r\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\r\nfunction componentAfterRender(component: any): void {\r\n  const debounceCheckNode: Function = debounce(checkNode, timeout, true);\r\n  after(component, 'componentDidMount', debounceCheckNode);\r\n  after(component, 'componentDidUpdate', debounceCheckNode);\r\n}\r\n\r\n/**\r\n * Add a component to track.\r\n * @param {Component} component\r\n */\r\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\r\nfunction addComponent(component: any): void {\r\n  const reactInstance = component._reactInternalInstance || {};\r\n  const reactInstanceDebugID = reactInstance._debugID;\r\n  const reactFiberInstance = component._reactInternalFiber || {};\r\n  const reactFiberInstanceDebugID = reactFiberInstance._debugID;\r\n  const reactInternals = component._reactInternals || {};\r\n  const reactInternalsDebugID = reactInternals._debugID;\r\n\r\n  if (reactInstanceDebugID && !components[reactInstanceDebugID]) {\r\n    components[reactInstanceDebugID] = component;\r\n    componentAfterRender(component);\r\n  } else if (\r\n    reactFiberInstanceDebugID &&\r\n    !components[reactFiberInstanceDebugID]\r\n  ) {\r\n    components[reactFiberInstanceDebugID] = component;\r\n    componentAfterRender(component);\r\n  } else if (reactInternalsDebugID && !components[reactInternalsDebugID]) {\r\n    components[reactInternalsDebugID] = component;\r\n    componentAfterRender(component);\r\n  }\r\n}\r\n\r\n/**\r\n * Log axe violations to console.\r\n * @param {AxeResults} results\r\n */\r\n function logToConsole(results) {\r\n  console.group('%cNew accessibility issues', serious);\r\n  var critCount = 0;\r\n  var seriousCount = 0;\r\n  results.violations.forEach(function (result) {\r\n      var fmt;\r\n      switch (result.impact) {\r\n          case 'critical':\r\n              critCount++;\r\n              fmt = critical;\r\n              break;\r\n          case 'serious':\r\n              seriousCount++;\r\n              fmt = serious;\r\n              break;\r\n          case 'moderate':\r\n              fmt = moderate;\r\n              break;\r\n          case 'minor':\r\n              fmt = minor;\r\n              break;\r\n          default:\r\n              fmt = minor;\r\n              break;\r\n      }\r\n      console.groupCollapsed('%c%s: %c%s %s', fmt, result.impact, defaultReset, result.help, result.helpUrl);\r\n      result.nodes.forEach(function (node) {\r\n          failureSummary(node, 'any');\r\n          failureSummary(node, 'none');\r\n      });\r\n      console.groupEnd();\r\n  });\r\n  console.groupEnd();\r\n  if (critCount || seriousCount) {\r\n      alert(`You have ${critCount} critical accessibility errors and ${seriousCount} serious accessibility errors on your code. \r\n\r\nCheck the browser console to see them.`);\r\n  }\r\n}\r\n\r\n/**\r\n * To support paramater of type runOnly\r\n */\r\ninterface ReactSpec extends axeCore.Spec {\r\n  runOnly?: string[];\r\n  disableDeduplicate?: boolean;\r\n}\r\n\r\n/**\r\n * Run axe against all changes made in a React app.\r\n * @parma {React} _React React instance\r\n * @param {ReactDOM} _ReactDOM ReactDOM instance\r\n * @param {Number} _timeout debounce timeout in milliseconds\r\n * @parma {Spec} conf React axe.configure Spec object\r\n * @param {ElementContext} _context axe ElementContent object\r\n * @param {Function} _logger Logger implementation\r\n */\r\nfunction reactAxe(\r\n  _React: typeof React,\r\n  _ReactDOM: typeof ReactDOM,\r\n  _timeout: number,\r\n  _conf = {} as ReactSpec,\r\n  _context?: axeCore.ElementContext,\r\n  _logger?: (results: axeCore.AxeResults) => void\r\n): Promise<void> {\r\n  React = _React;\r\n  ReactDOM = _ReactDOM;\r\n  timeout = _timeout;\r\n  context = _context;\r\n  conf = _conf;\r\n  logger = _logger || logToConsole;\r\n\r\n  const runOnly = conf['runOnly'];\r\n  if (runOnly) {\r\n    conf['rules'] = axeCore\r\n      .getRules(runOnly)\r\n      .map(rule => ({ ...rule, id: rule.ruleId, enabled: true }));\r\n    conf['disableOtherRules'] = true;\r\n  }\r\n\r\n  if (Object.keys(conf).length > 0) {\r\n    axeCore.configure(conf);\r\n  }\r\n  axeCore.configure({ allowedOrigins: ['<unsafe_all_origins>'] });\r\n  if (!_createElement) {\r\n    _createElement = React.createElement;\r\n\r\n    React.createElement = function (...args): React.Component {\r\n      const reactEl = _createElement.apply(this, args);\r\n\r\n      if (reactEl._owner && reactEl._owner._instance) {\r\n        addComponent(reactEl._owner._instance);\r\n      } else if (reactEl._owner && reactEl._owner.stateNode) {\r\n        addComponent(reactEl._owner.stateNode);\r\n      }\r\n\r\n      return reactEl;\r\n    };\r\n  }\r\n\r\n  return checkAndReport(document.body, timeout);\r\n}\r\n\r\nexport = reactAxe;\r\n"]}