{"ast":null,"code":"\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n  value: true\n});\nexports.getSpaceUntilMaxLength = getSpaceUntilMaxLength;\nvar _isElementType = require(\"../misc/isElementType\");\nvar _getValue = require(\"./getValue\");\nvar maxLengthSupportedTypes;\n(function (maxLengthSupportedTypes) {\n  maxLengthSupportedTypes[\"email\"] = \"email\";\n  maxLengthSupportedTypes[\"password\"] = \"password\";\n  maxLengthSupportedTypes[\"search\"] = \"search\";\n  maxLengthSupportedTypes[\"telephone\"] = \"telephone\";\n  maxLengthSupportedTypes[\"text\"] = \"text\";\n  maxLengthSupportedTypes[\"url\"] = \"url\";\n})(maxLengthSupportedTypes || (maxLengthSupportedTypes = {}));\nfunction getSpaceUntilMaxLength(element) {\n  const value = (0, _getValue.getValue)(element);\n  /* istanbul ignore if */\n\n  if (value === null) {\n    return undefined;\n  }\n  const maxLength = getSanitizedMaxLength(element);\n  return maxLength ? maxLength - value.length : undefined;\n} // can't use .maxLength property because of a jsdom bug:\n// https://github.com/jsdom/jsdom/issues/2927\n\nfunction getSanitizedMaxLength(element) {\n  var _element$getAttribute;\n  if (!supportsMaxLength(element)) {\n    return undefined;\n  }\n  const attr = (_element$getAttribute = element.getAttribute('maxlength')) != null ? _element$getAttribute : '';\n  return /^\\d+$/.test(attr) && Number(attr) >= 0 ? Number(attr) : undefined;\n}\nfunction supportsMaxLength(element) {\n  return (0, _isElementType.isElementType)(element, 'textarea') || (0, _isElementType.isElementType)(element, 'input') && Boolean(maxLengthSupportedTypes[element.type]);\n}","map":{"version":3,"names":["Object","defineProperty","exports","value","getSpaceUntilMaxLength","_isElementType","require","_getValue","maxLengthSupportedTypes","element","getValue","undefined","maxLength","getSanitizedMaxLength","length","_element$getAttribute","supportsMaxLength","attr","getAttribute","test","Number","isElementType","Boolean","type"],"sources":["C:/Users/user/Desktop/000newport/node_modules/@testing-library/user-event/dist/utils/edit/maxLength.js"],"sourcesContent":["\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n  value: true\n});\nexports.getSpaceUntilMaxLength = getSpaceUntilMaxLength;\n\nvar _isElementType = require(\"../misc/isElementType\");\n\nvar _getValue = require(\"./getValue\");\n\nvar maxLengthSupportedTypes;\n\n(function (maxLengthSupportedTypes) {\n  maxLengthSupportedTypes[\"email\"] = \"email\";\n  maxLengthSupportedTypes[\"password\"] = \"password\";\n  maxLengthSupportedTypes[\"search\"] = \"search\";\n  maxLengthSupportedTypes[\"telephone\"] = \"telephone\";\n  maxLengthSupportedTypes[\"text\"] = \"text\";\n  maxLengthSupportedTypes[\"url\"] = \"url\";\n})(maxLengthSupportedTypes || (maxLengthSupportedTypes = {}));\n\nfunction getSpaceUntilMaxLength(element) {\n  const value = (0, _getValue.getValue)(element);\n  /* istanbul ignore if */\n\n  if (value === null) {\n    return undefined;\n  }\n\n  const maxLength = getSanitizedMaxLength(element);\n  return maxLength ? maxLength - value.length : undefined;\n} // can't use .maxLength property because of a jsdom bug:\n// https://github.com/jsdom/jsdom/issues/2927\n\n\nfunction getSanitizedMaxLength(element) {\n  var _element$getAttribute;\n\n  if (!supportsMaxLength(element)) {\n    return undefined;\n  }\n\n  const attr = (_element$getAttribute = element.getAttribute('maxlength')) != null ? _element$getAttribute : '';\n  return /^\\d+$/.test(attr) && Number(attr) >= 0 ? Number(attr) : undefined;\n}\n\nfunction supportsMaxLength(element) {\n  return (0, _isElementType.isElementType)(element, 'textarea') || (0, _isElementType.isElementType)(element, 'input') && Boolean(maxLengthSupportedTypes[element.type]);\n}"],"mappings":"AAAA,YAAY;;AAEZA,MAAM,CAACC,cAAc,CAACC,OAAO,EAAE,YAAY,EAAE;EAC3CC,KAAK,EAAE;AACT,CAAC,CAAC;AACFD,OAAO,CAACE,sBAAsB,GAAGA,sBAAsB;AAEvD,IAAIC,cAAc,GAAGC,OAAO,CAAC,uBAAuB,CAAC;AAErD,IAAIC,SAAS,GAAGD,OAAO,CAAC,YAAY,CAAC;AAErC,IAAIE,uBAAuB;AAE3B,CAA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