@projectwallace/css-analyzer 5.13.2 → 5.13.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"analyzer.modern.js","sources":["../src/string-utils.js","../src/css-tree-node-types.js","../src/atrules/atrules.js","../src/vendor-prefix.js","../src/selectors/utils.js","../src/keyword-set.js","../src/values/colors.js","../src/values/destructure-font-shorthand.js","../src/values/values.js","../src/values/animations.js","../src/values/vendor-prefix.js","../src/collection.js","../src/context-collection.js","../src/aggregate-collection.js","../src/properties/property-utils.js","../src/values/browserhacks.js","../src/index.js","../src/stylesheet/stylesheet.js"],"sourcesContent":["/**\n * @param {string} str\n * @param {number} at\n */\nfunction charCodeAt(str, at) {\n return str.charCodeAt(at)\n}\n\n/**\n * Case-insensitive compare two character codes\n * @param {string} referenceCode\n * @param {string} testCode\n * @see https://github.com/csstree/csstree/blob/41f276e8862d8223eeaa01a3d113ab70bb13d2d9/lib/tokenizer/utils.js#L22\n */\nfunction compareChar(referenceCode, testCode) {\n // if uppercase\n if (testCode >= 0x0041 && testCode <= 0x005A) {\n // shifting the 6th bit makes a letter lowercase\n testCode = testCode | 32\n }\n return referenceCode === testCode\n}\n\n/**\n * Case-insensitive string-comparison\n * @example\n * strEquals('test', 'test') // true\n * strEquals('test', 'TEST') // true\n * strEquals('test', 'TesT') // true\n * strEquals('test', 'derp') // false\n *\n * @param {string} base The string to check against\n * @param {string} maybe The test string, possibly containing uppercased characters\n * @returns {boolean} true if the two strings are the same, false otherwise\n */\nexport function strEquals(base, maybe) {\n let len = base.length;\n if (len !== maybe.length) return false\n\n for (let i = 0; i < len; i++) {\n if (compareChar(charCodeAt(base, i), charCodeAt(maybe, i)) === false) {\n return false\n }\n }\n\n return true\n}\n\n/**\n * Case-insensitive testing whether a string ends with a given substring\n *\n * @example\n * endsWith('test', 'my-test') // true\n * endsWith('test', 'est') // false\n *\n * @param {string} base e.g. '-webkit-transform'\n * @param {string} maybe e.g. 'transform'\n * @returns {boolean} true if `test` ends with `base`, false otherwise\n */\nexport function endsWith(base, maybe) {\n let len = maybe.length\n let offset = len - base.length\n\n if (offset < 0) {\n return false\n }\n\n for (let i = len - 1; i >= offset; i--) {\n if (compareChar(charCodeAt(base, i - offset), charCodeAt(maybe, i)) === false) {\n return false\n }\n }\n\n return true\n}\n\n/**\n * Case-insensitive testing whether a string starts with a given substring\n * @param {string} base\n * @param {string} maybe\n * @returns {boolean} true if `test` starts with `base`, false otherwise\n */\nexport function startsWith(base, maybe) {\n let len = base.length\n if (maybe.length < len) return false\n\n for (let i = 0; i < len; i++) {\n if (compareChar(charCodeAt(base, i), charCodeAt(maybe, i)) === false) {\n return false\n }\n }\n\n return true\n}\n","// Atrule\nexport const Atrule = 'Atrule'\nexport const MediaQuery = 'MediaQuery'\nexport const MediaFeature = 'MediaFeature'\n// Rule\nexport const Rule = 'Rule'\n\n// Selector\nexport const Selector = 'Selector'\nexport const TypeSelector = 'TypeSelector'\nexport const PseudoClassSelector = 'PseudoClassSelector'\nexport const AttributeSelector = 'AttributeSelector'\nexport const IdSelector = 'IdSelector'\nexport const ClassSelector = 'ClassSelector'\nexport const PseudoElementSelector = 'PseudoElementSelector'\n\n// Declaration\nexport const Declaration = 'Declaration'\n\n// Values\nexport const Value = 'Value'\nexport const Identifier = 'Identifier'\nexport const Nth = 'Nth'\nexport const Combinator = 'Combinator'\nexport const Nr = 'Number'\nexport const Dimension = 'Dimension'\nexport const Operator = 'Operator'\nexport const Hash = 'Hash'\nexport const Url = 'Url'\nexport const Func = 'Function'\n","import { strEquals, startsWith, endsWith } from '../string-utils.js'\nimport walk from 'css-tree/walker'\nimport {\n Identifier,\n MediaQuery,\n MediaFeature,\n Declaration,\n} from '../css-tree-node-types.js'\n\n/**\n * Check whether node.property === property and node.value === value,\n * but case-insensitive and fast.\n * @param {import('css-tree').Declaration} node\n * @param {string} property - The CSS property to compare with (case-insensitive)\n * @param {string} value - The identifier/keyword value to compare with\n * @returns true if declaratioNode is the given property: value, false otherwise\n */\nfunction isPropertyValue(node, property, value) {\n let firstChild = node.value.children.first\n return strEquals(property, node.property)\n && firstChild.type === Identifier\n && strEquals(value, firstChild.name)\n}\n\n/**\n * Check if an @supports atRule is a browserhack\n * @param {import('css-tree').AtrulePrelude} prelude\n * @returns true if the atrule is a browserhack\n */\nexport function isSupportsBrowserhack(prelude) {\n let returnValue = false\n\n walk(prelude, function (node) {\n if (node.type === Declaration) {\n if (\n isPropertyValue(node, '-webkit-appearance', 'none')\n || isPropertyValue(node, '-moz-appearance', 'meterbar')\n ) {\n returnValue = true\n return this.break\n }\n }\n })\n\n return returnValue\n}\n\n/**\n * Check if a @media atRule is a browserhack\n * @param {import('css-tree').AtrulePrelude} prelude\n * @returns true if the atrule is a browserhack\n */\nexport function isMediaBrowserhack(prelude) {\n let returnValue = false\n\n walk(prelude, function (node) {\n let children = node.children\n let name = node.name\n let value = node.value\n\n if (node.type === MediaQuery\n && children.size === 1\n && children.first.type === Identifier\n ) {\n let n = children.first.name\n // Note: CSSTree adds a trailing space to \\\\9\n if (startsWith('\\\\0', n) || endsWith('\\\\9 ', n)) {\n returnValue = true\n return this.break\n }\n }\n if (node.type === MediaFeature) {\n if (value !== null && value.unit === '\\\\0') {\n returnValue = true\n return this.break\n }\n if (strEquals('-moz-images-in-menus', name)\n || strEquals('min--moz-device-pixel-ratio', name)\n || strEquals('-ms-high-contrast', name)\n ) {\n returnValue = true\n return this.break\n }\n if (strEquals('min-resolution', name)\n && strEquals('.001', value.value)\n && strEquals('dpcm', value.unit)\n ) {\n returnValue = true\n return this.break\n }\n if (strEquals('-webkit-min-device-pixel-ratio', name)) {\n let val = value.value\n if ((strEquals('0', val) || strEquals('10000', val))) {\n returnValue = true\n return this.break\n }\n }\n }\n })\n\n return returnValue\n}","const HYPHENMINUS = 45; // '-'.charCodeAt()\n\n/**\n * @param {string} keyword\n * @returns {boolean}\n */\nfunction hasVendorPrefix(keyword) {\n if (keyword.charCodeAt(0) === HYPHENMINUS && keyword.charCodeAt(1) !== HYPHENMINUS) {\n // String must have a 2nd occurrence of '-', at least at position 3 (offset=2)\n if (keyword.indexOf('-', 2) !== -1) {\n return true\n }\n }\n\n return false\n}\n\nexport {\n hasVendorPrefix\n}","import walk from 'css-tree/walker'\nimport { startsWith, strEquals } from '../string-utils.js'\nimport { hasVendorPrefix } from '../vendor-prefix.js'\nimport {\n PseudoClassSelector,\n PseudoElementSelector,\n TypeSelector,\n Combinator,\n Selector,\n AttributeSelector,\n Nth,\n} from '../css-tree-node-types.js'\n\n/**\n *\n * @param {import('css-tree').SelectorList} selectorListAst\n * @returns {Selector[]} Analyzed selectors in the selectorList\n */\nfunction analyzeList(selectorListAst, cb) {\n let childSelectors = []\n walk(selectorListAst, {\n visit: Selector,\n enter: function (node) {\n childSelectors.push(cb(node))\n }\n })\n\n return childSelectors\n}\n\nfunction isPseudoFunction(name) {\n return (\n strEquals(name, 'not')\n || strEquals(name, 'nth-child')\n || strEquals(name, 'nth-last-child')\n || strEquals(name, 'where')\n || strEquals(name, 'is')\n || strEquals(name, 'has')\n || strEquals(name, 'matches')\n || strEquals(name, '-webkit-any')\n || strEquals(name, '-moz-any')\n )\n}\n\n/** @param {import('css-tree').Selector} selector */\nexport function isAccessibility(selector) {\n let isA11y = false\n\n walk(selector, function (node) {\n if (node.type === AttributeSelector) {\n let name = node.name.name\n if (strEquals('role', name) || startsWith('aria-', name)) {\n isA11y = true\n return this.break\n }\n }\n // Test for [aria-] or [role] inside :is()/:where() and friends\n else if (node.type === PseudoClassSelector) {\n if (isPseudoFunction(node.name)) {\n let list = analyzeList(node, isAccessibility)\n\n if (list.some(b => b === true)) {\n isA11y = true\n return this.skip\n }\n\n return this.skip\n }\n }\n })\n\n return isA11y;\n}\n\n/**\n * @param {import('css-tree').Selector} selector\n * @returns {boolean} Whether the selector contains a vendor prefix\n */\nexport function isPrefixed(selector) {\n let isPrefixed = false\n\n walk(selector, function (node) {\n if (node.type === PseudoElementSelector\n || node.type === TypeSelector\n || node.type === PseudoClassSelector\n ) {\n if (hasVendorPrefix(node.name)) {\n isPrefixed = true\n return this.break\n }\n } else if (node.type === AttributeSelector) {\n if (hasVendorPrefix(node.name.name)) {\n isPrefixed = true\n return this.break\n }\n }\n })\n\n return isPrefixed;\n}\n\n/**\n * Get the Complexity for the AST of a Selector Node\n * @param {import('css-tree').Selector} selector - AST Node for a Selector\n * @return {[number, boolean]} - The numeric complexity of the Selector and whether it's prefixed or not\n */\nexport function getComplexity(selector) {\n let complexity = 0\n\n walk(selector, function (node) {\n if (node.type === Selector || node.type === Nth) return\n\n complexity++\n\n if (node.type === PseudoElementSelector\n || node.type === TypeSelector\n || node.type === PseudoClassSelector\n ) {\n if (hasVendorPrefix(node.name)) {\n complexity++\n }\n }\n\n if (node.type === AttributeSelector) {\n if (node.value) {\n complexity++\n }\n if (hasVendorPrefix(node.name.name)) {\n complexity++\n }\n return this.skip\n }\n\n if (node.type === PseudoClassSelector) {\n if (isPseudoFunction(node.name)) {\n let list = analyzeList(node, getComplexity)\n\n // Bail out for empty/non-existent :nth-child() params\n if (list.length === 0) return\n\n list.forEach((c) => {\n complexity += c\n })\n return this.skip\n }\n }\n })\n\n return complexity\n}\n\n/**\n * Walk a selector node and trigger a callback every time a Combinator was found\n * We need create the `loc` for descendant combinators manually, because CSSTree\n * does not keep track of whitespace for us. We'll assume that the combinator is\n * alwas a single ` ` (space) character, even though there could be newlines or\n * multiple spaces\n * @param {import('css-tree').CssNode} node\n * @param {*} onMatch\n */\nexport function getCombinators(node, onMatch) {\n walk(node, function (\n /** @type {import('css-tree').CssNode} */ selectorNode,\n /** @type {import('css-tree').ListItem} */ item\n ) {\n if (selectorNode.type === Combinator) {\n let loc = selectorNode.loc\n let name = selectorNode.name\n\n // .loc is null when selectorNode.name === ' '\n if (loc === null) {\n let previousLoc = item.prev.data.loc.end\n let start = {\n offset: previousLoc.offset,\n line: previousLoc.line,\n column: previousLoc.column\n }\n\n onMatch({\n name,\n loc: {\n start,\n end: {\n offset: start.offset + 1,\n line: start.line,\n column: start.column + 1\n }\n }\n })\n } else {\n onMatch({\n name,\n loc\n })\n }\n }\n })\n}\n","import { strEquals } from \"./string-utils.js\"\n\n/**\n * @description A Set-like construct to search CSS keywords in a case-insensitive way\n */\nexport class KeywordSet {\n\n\t/** @param {string[]} items */\n\tconstructor(items) {\n\t\t/** @type {string[]} */\n\t\tthis.set = items\n\t}\n\n\t/** @param {string} item */\n\thas(item) {\n\t\tlet len = this.set.length\n\n\t\tfor (let index = 0; index < len; index++) {\n\t\t\tif (strEquals(this.set[index], item)) {\n\t\t\t\treturn true\n\t\t\t}\n\t\t}\n\t\treturn false\n\t}\n}","import { KeywordSet } from \"../keyword-set.js\"\n\nexport const namedColors = new KeywordSet([\n // CSS Named Colors\n // Spec: https://drafts.csswg.org/css-color/#named-colors\n\n // Heuristic: popular names first for quick finding in set.has()\n 'white',\n 'black',\n 'red',\n 'blue',\n 'gray',\n 'grey',\n 'green',\n 'rebeccapurple',\n 'yellow',\n 'orange',\n\n 'aliceblue',\n 'antiquewhite',\n 'aqua',\n 'aquamarine',\n 'azure',\n 'beige',\n 'bisque',\n 'blanchedalmond',\n 'blueviolet',\n 'brown',\n 'burlywood',\n 'cadetblue',\n 'chartreuse',\n 'chocolate',\n 'coral',\n 'cornflowerblue',\n 'cornsilk',\n 'crimson',\n 'cyan',\n 'darkblue',\n 'darkcyan',\n 'darkgoldenrod',\n 'darkgray',\n 'darkgreen',\n 'darkgrey',\n 'darkkhaki',\n 'darkmagenta',\n 'darkolivegreen',\n 'darkorange',\n 'darkorchid',\n 'darkred',\n 'darksalmon',\n 'darkseagreen',\n 'darkslateblue',\n 'darkslategray',\n 'darkslategrey',\n 'darkturquoise',\n 'darkviolet',\n 'deeppink',\n 'deepskyblue',\n 'dimgray',\n 'dimgrey',\n 'dodgerblue',\n 'firebrick',\n 'floralwhite',\n 'forestgreen',\n 'fuchsia',\n 'gainsboro',\n 'ghostwhite',\n 'gold',\n 'goldenrod',\n 'greenyellow',\n 'honeydew',\n 'hotpink',\n 'indianred',\n 'indigo',\n 'ivory',\n 'khaki',\n 'lavender',\n 'lavenderblush',\n 'lawngreen',\n 'lemonchiffon',\n 'lightblue',\n 'lightcoral',\n 'lightcyan',\n 'lightgoldenrodyellow',\n 'lightgray',\n 'lightgreen',\n 'lightgrey',\n 'lightpink',\n 'lightsalmon',\n 'lightseagreen',\n 'lightskyblue',\n 'lightslategray',\n 'lightslategrey',\n 'lightsteelblue',\n 'lightyellow',\n 'lime',\n 'limegreen',\n 'linen',\n 'magenta',\n 'maroon',\n 'mediumaquamarine',\n 'mediumblue',\n 'mediumorchid',\n 'mediumpurple',\n 'mediumseagreen',\n 'mediumslateblue',\n 'mediumspringgreen',\n 'mediumturquoise',\n 'mediumvioletred',\n 'midnightblue',\n 'mintcream',\n 'mistyrose',\n 'moccasin',\n 'navajowhite',\n 'navy',\n 'oldlace',\n 'olive',\n 'olivedrab',\n 'orangered',\n 'orchid',\n 'palegoldenrod',\n 'palegreen',\n 'paleturquoise',\n 'palevioletred',\n 'papayawhip',\n 'peachpuff',\n 'peru',\n 'pink',\n 'plum',\n 'powderblue',\n 'purple',\n 'rosybrown',\n 'royalblue',\n 'saddlebrown',\n 'salmon',\n 'sandybrown',\n 'seagreen',\n 'seashell',\n 'sienna',\n 'silver',\n 'skyblue',\n 'slateblue',\n 'slategray',\n 'slategrey',\n 'snow',\n 'springgreen',\n 'steelblue',\n 'tan',\n 'teal',\n 'thistle',\n 'tomato',\n 'turquoise',\n 'violet',\n 'wheat',\n 'whitesmoke',\n 'yellowgreen',\n])\n\nexport const systemColors = new KeywordSet([\n // CSS System Colors\n // Spec: https://drafts.csswg.org/css-color/#css-system-colors\n 'canvas',\n 'canvastext',\n 'linktext',\n 'visitedtext',\n 'activetext',\n 'buttonface',\n 'buttontext',\n 'buttonborder',\n 'field',\n 'fieldtext',\n 'highlight',\n 'highlighttext',\n 'selecteditem',\n 'selecteditemtext',\n 'mark',\n 'marktext',\n 'graytext',\n\n // TODO: Deprecated CSS System colors\n // Spec: https://drafts.csswg.org/css-color/#deprecated-system-colors\n])\n\nexport const colorFunctions = new KeywordSet([\n 'rgb',\n 'rgba',\n 'hsl',\n 'hsla',\n 'hwb',\n 'lab',\n 'lch',\n 'oklab',\n 'oklch',\n 'color',\n])\n\nexport const colorKeywords = new KeywordSet([\n 'transparent',\n 'currentcolor',\n])\n","import { KeywordSet } from \"../keyword-set.js\"\nimport { Identifier, Nr, Dimension, Operator } from '../css-tree-node-types.js'\n\nconst SYSTEM_FONTS = new KeywordSet([\n\t'caption',\n\t'icon',\n\t'menu',\n\t'message-box',\n\t'small-caption',\n\t'status-bar',\n])\n\nconst SIZE_KEYWORDS = new KeywordSet([\n\t/* <absolute-size> values */\n\t'xx-small',\n\t'x-small',\n\t'small',\n\t'medium',\n\t'large',\n\t'x-large',\n\t'xx-large',\n\t'xxx-large',\n\t/* <relative-size> values */\n\t'smaller',\n\t'larger',\n])\n\nconst COMMA = 44 // ','.charCodeAt(0) === 44\nconst SLASH = 47 // '/'.charCodeAt(0) === 47\n\n/**\n * @param {string} str\n * @param {number} at\n */\nfunction charCodeAt(str, at) {\n\treturn str.charCodeAt(at)\n}\n\nexport function isSystemFont(node) {\n\tlet firstChild = node.children.first\n\tif (firstChild === null) return false\n\treturn firstChild.type === Identifier && SYSTEM_FONTS.has(firstChild.name)\n}\n\n/**\n * @param {import('css-tree').Value} value\n * @param {*} stringifyNode\n */\nexport function destructure(value, stringifyNode) {\n\tlet font_family = Array.from({ length: 2 })\n\tlet font_size\n\tlet line_height\n\n\tvalue.children.forEach(function (node, item) {\n\t\t// any node that comes before the '/' is the font-size\n\t\tif (\n\t\t\titem.next &&\n\t\t\titem.next.data.type === Operator &&\n\t\t\tcharCodeAt(item.next.data.value, 0) === SLASH\n\t\t) {\n\t\t\tfont_size = stringifyNode(node)\n\t\t\treturn\n\t\t}\n\n\t\t// any node that comes after '/' is the line-height\n\t\tif (\n\t\t\titem.prev &&\n\t\t\titem.prev.data.type === Operator &&\n\t\t\tcharCodeAt(item.prev.data.value, 0) === SLASH\n\t\t) {\n\t\t\tline_height = stringifyNode(node)\n\t\t\treturn\n\t\t}\n\n\t\t// any node that's followed by ',' is a font-family\n\t\tif (\n\t\t\titem.next &&\n\t\t\titem.next.data.type === Operator &&\n\t\t\tcharCodeAt(item.next.data.value, 0) === COMMA &&\n\t\t\t!font_family[0]\n\t\t) {\n\t\t\tfont_family[0] = node\n\n\t\t\tif (!font_size && item.prev !== null) {\n\t\t\t\tfont_size = stringifyNode(item.prev.data)\n\t\t\t}\n\n\t\t\treturn\n\t\t}\n\n\t\t// any node that's a number and not previously caught by line-height or font-size is the font-weight\n\t\t// (oblique <angle> will not be caught here, because that's a Dimension, not a Number)\n\t\tif (node.type === Nr) {\n\t\t\treturn\n\t\t}\n\n\t\t// last node always ends the font-family\n\t\tif (item.next === null) {\n\t\t\tfont_family[1] = node\n\n\t\t\t// if, at the last node, we don;t have a size yet, it *must* be the previous node\n\t\t\t// unless `font: menu` (system font), because then there's simply no size\n\t\t\tif (!font_size && !font_family[0] && item.prev) {\n\t\t\t\tfont_size = stringifyNode(item.prev.data)\n\t\t\t}\n\n\t\t\treturn\n\t\t}\n\n\t\t// Any remaining identifiers can be font-size, font-style, font-stretch, font-variant or font-weight\n\t\tif (node.type === Identifier) {\n\t\t\tlet name = node.name\n\t\t\tif (SIZE_KEYWORDS.has(name)) {\n\t\t\t\tfont_size = name\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t})\n\n\treturn {\n\t\tfont_size,\n\t\tline_height,\n\t\tfont_family: (font_family[0] || font_family[1]) ? stringifyNode({\n\t\t\tloc: {\n\t\t\t\tstart: {\n\t\t\t\t\toffset: (font_family[0] || font_family[1]).loc.start.offset\n\t\t\t\t},\n\t\t\t\tend: {\n\t\t\t\t\toffset: font_family[1].loc.end.offset\n\t\t\t\t}\n\t\t\t}\n\t\t}) : null,\n\t}\n}","import { KeywordSet } from \"../keyword-set.js\"\nimport { Identifier } from \"../css-tree-node-types.js\"\n\nconst keywords = new KeywordSet([\n 'auto',\n 'inherit',\n 'initial',\n 'unset',\n 'revert',\n 'revert-layer',\n 'none', // for `text-shadow`, `box-shadow` and `background`\n])\n\n/**\n * @param {import('css-tree').Value} node\n */\nexport function isValueKeyword(node) {\n let children = node.children\n let size = children.size\n\n if (!children) return false\n if (size > 1 || size === 0) return false\n\n let firstChild = children.first\n return firstChild.type === Identifier && keywords.has(firstChild.name)\n}\n","import { KeywordSet } from \"../keyword-set.js\"\nimport {\n Operator,\n Dimension,\n Identifier,\n Func,\n} from '../css-tree-node-types.js'\n\nconst TIMING_KEYWORDS = new KeywordSet([\n 'linear',\n 'ease',\n 'ease-in',\n 'ease-out',\n 'ease-in-out',\n 'step-start',\n 'step-end',\n])\n\nconst TIMING_FUNCTION_VALUES = new KeywordSet([\n 'cubic-bezier',\n 'steps'\n])\n\nexport function analyzeAnimation(children, stringifyNode) {\n let durationFound = false\n let durations = []\n let timingFunctions = []\n\n children.forEach(child => {\n let type = child.type\n let name = child.name\n\n // Right after a ',' we start over again\n if (type === Operator) {\n return durationFound = false\n }\n if (type === Dimension && durationFound === false) {\n durationFound = true\n return durations.push(stringifyNode(child))\n }\n if (type === Identifier && TIMING_KEYWORDS.has(name)) {\n return timingFunctions.push(stringifyNode(child))\n }\n if (type === Func && TIMING_FUNCTION_VALUES.has(name)) {\n return timingFunctions.push(stringifyNode(child))\n }\n })\n\n return [durations, timingFunctions]\n}\n","import { hasVendorPrefix } from '../vendor-prefix.js'\nimport { Func, Identifier } from '../css-tree-node-types.js'\n\n/**\n * @param {import('css-tree').Value} node\n */\nexport function isValuePrefixed(node) {\n let children = node.children\n\n if (!children) {\n return false\n }\n\n let list = children.toArray()\n\n for (let index = 0; index < list.length; index++) {\n let node = list[index]\n let { type, name } = node;\n\n if (type === Identifier && hasVendorPrefix(name)) {\n return true\n }\n\n if (type === Func) {\n if (hasVendorPrefix(name)) {\n return true\n }\n\n if (isValuePrefixed(node)) {\n return true\n }\n }\n }\n\n return false\n}\n","export class Collection {\n\t/** @param {boolean} useLocations */\n\tconstructor(useLocations = false) {\n\t\t/** @type {Map<string, number[]>} */\n\t\tthis._items = new Map()\n\t\tthis._total = 0\n\n\t\tif (useLocations) {\n\t\t\t/** @type {number[]} */\n\t\t\tthis._node_lines = []\n\t\t\t/** @type {number[]} */\n\t\t\tthis._node_columns = []\n\t\t\t/** @type {number[]} */\n\t\t\tthis._node_lengths = []\n\t\t\t/** @type {number[]} */\n\t\t\tthis._node_offsets = []\n\t\t}\n\n\t\t/** @type {boolean} */\n\t\tthis._useLocations = useLocations\n\t}\n\n\t/**\n\t * @param {string} item\n\t * @param {import('css-tree').CssLocation} node_location\n\t */\n\tp(item, node_location) {\n\t\tlet index = this._total\n\n\t\tif (this._useLocations) {\n\t\t\tlet start = node_location.start\n\t\t\tlet start_offset = start.offset\n\n\t\t\tthis._node_lines[index] = start.line\n\t\t\tthis._node_columns[index] = start.column\n\t\t\tthis._node_offsets[index] = start_offset\n\t\t\tthis._node_lengths[index] = node_location.end.offset - start_offset\n\t\t}\n\n\t\tif (this._items.has(item)) {\n\t\t\t/** @type number[] */\n\t\t\tlet list = this._items.get(item)\n\t\t\tlist.push(index)\n\t\t\tthis._total++\n\t\t\treturn\n\t\t}\n\n\t\tthis._items.set(item, [index])\n\t\tthis._total++\n\t}\n\n\tsize() {\n\t\treturn this._total\n\t}\n\n\t/**\n\t * @typedef CssLocation\n\t * @property {number} line\n\t * @property {number} column\n\t * @property {number} offset\n\t * @property {number} length\n\t *\n\t * @returns {{ total: number; totalUnique: number; uniquenessRatio: number; unique: Record<string, number>; __unstable__uniqueWithLocations: Record<string, CssLocation[]>}}\n\t */\n\tc() {\n\t\tlet useLocations = this._useLocations\n\t\tlet uniqueWithLocations = new Map()\n\t\tlet unique = {}\n\t\tlet items = this._items\n\t\tlet size = items.size\n\n\t\titems.forEach((list, key) => {\n\t\t\tif (useLocations) {\n\t\t\t\tlet nodes = list.map(index => ({\n\t\t\t\t\tline: this._node_lines[index],\n\t\t\t\t\tcolumn: this._node_columns[index],\n\t\t\t\t\toffset: this._node_offsets[index],\n\t\t\t\t\tlength: this._node_lengths[index],\n\t\t\t\t}))\n\t\t\t\tuniqueWithLocations.set(key, nodes)\n\t\t\t}\n\t\t\tunique[key] = list.length\n\t\t})\n\n\t\tif (this._useLocations) {\n\t\t\treturn {\n\t\t\t\ttotal: this._total,\n\t\t\t\ttotalUnique: size,\n\t\t\t\tunique,\n\t\t\t\tuniquenessRatio: this._total === 0 ? 0 : size / this._total,\n\t\t\t\t__unstable__uniqueWithLocations: Object.fromEntries(uniqueWithLocations),\n\t\t\t}\n\t\t}\n\n\t\treturn {\n\t\t\ttotal: this._total,\n\t\t\ttotalUnique: size,\n\t\t\tunique,\n\t\t\tuniquenessRatio: this._total === 0 ? 0 : size / this._total,\n\t\t}\n\t}\n}\n","import { Collection } from './collection.js'\n\nclass ContextCollection {\n /** @param {boolean} useLocations */\n constructor(useLocations) {\n this._list = new Collection(useLocations)\n /** @type {Map<string, Collection>} */\n this._contexts = new Map()\n /** @type {boolean} */\n this._useLocations = useLocations\n }\n\n /**\n * Add an item to this _list's context\n * @param {string} item Item to push\n * @param {string} context Context to push Item to\n * @param {import('css-tree').CssLocation} node_location\n */\n push(item, context, node_location) {\n this._list.p(item, node_location)\n\n if (!this._contexts.has(context)) {\n this._contexts.set(context, new Collection(this._useLocations))\n }\n\n this._contexts.get(context).p(item, node_location)\n }\n\n count() {\n /**\n * @type {Map<string, {\n * total: number,\n * totalUnique: number,\n * unique: Record<string, number>,\n * uniquenessRatio: number\n * }>}\n */\n let itemsPerContext = new Map()\n\n for (let [context, value] of this._contexts.entries()) {\n itemsPerContext.set(context, value.c())\n }\n\n return Object.assign(this._list.c(), {\n itemsPerContext: Object.fromEntries(itemsPerContext)\n })\n }\n}\n\nexport {\n ContextCollection\n}","/**\n * Find the mode (most occurring value) in an array of Numbers\n * Takes the mean/average of multiple values if multiple values occur the same amount of times.\n *\n * @see https://github.com/angus-c/just/blob/684af9ca0c7808bc78543ec89379b1fdfce502b1/packages/array-mode/index.js\n * @param {Array} arr - Array to find the mode value for\n * @returns {Number} mode - The `mode` value of `arr`\n */\nfunction Mode(arr) {\n let frequencies = new Map()\n let maxOccurrences = -1\n let maxOccurenceCount = 0\n let sum = 0\n let len = arr.length\n\n for (let i = 0; i < len; i++) {\n let element = arr[i]\n let updatedCount = (frequencies.get(element) || 0) + 1\n frequencies.set(element, updatedCount)\n\n if (updatedCount > maxOccurrences) {\n maxOccurrences = updatedCount\n maxOccurenceCount = 0\n sum = 0\n }\n\n if (updatedCount >= maxOccurrences) {\n maxOccurenceCount++\n sum += element\n }\n }\n\n return sum / maxOccurenceCount\n}\n\n/**\n * Find the middle number in an Array of Numbers\n * Returns the average of 2 numbers if the Array length is an even number\n * @see https://github.com/angus-c/just/blob/684af9ca0c7808bc78543ec89379b1fdfce502b1/packages/array-median/index.js\n * @param {Array} arr - A sorted Array\n * @returns {Number} - The array's Median\n */\nfunction Median(arr) {\n let middle = arr.length / 2\n let lowerMiddleRank = Math.floor(middle)\n\n if (middle !== lowerMiddleRank) {\n return arr[lowerMiddleRank]\n }\n return (arr[lowerMiddleRank] + arr[lowerMiddleRank - 1]) / 2\n}\n\nclass AggregateCollection {\n constructor() {\n /** @type number[] */\n this._items = []\n this._sum = 0\n }\n\n /**\n * Add a new Integer at the end of this AggregateCollection\n * @param {number} item - The item to add\n */\n push(item) {\n this._items.push(item)\n this._sum += item\n }\n\n size() {\n return this._items.length\n }\n\n aggregate() {\n let len = this._items.length\n\n if (len === 0) {\n return {\n min: 0,\n max: 0,\n mean: 0,\n mode: 0,\n median: 0,\n range: 0,\n sum: 0,\n }\n }\n\n // TODO: can we avoid this sort()? It's slow\n /** @type Number[] */\n let sorted = this._items.slice().sort((a, b) => a - b)\n let min = sorted[0]\n let max = sorted[len - 1]\n\n let mode = Mode(sorted)\n let median = Median(sorted)\n let sum = this._sum\n\n return {\n min,\n max,\n mean: sum / len,\n mode,\n median,\n range: max - min,\n sum: sum,\n }\n }\n\n /**\n * @returns {number[]} All _items in this collection\n */\n toArray() {\n return this._items\n }\n}\n\nexport {\n AggregateCollection\n}","import { hasVendorPrefix } from '../vendor-prefix.js'\nimport { endsWith } from '../string-utils.js'\n\n/**\n * @param {string} property\n * @see https://github.com/csstree/csstree/blob/master/lib/utils/names.js#L69\n */\nexport function isHack(property) {\n if (isCustom(property) || hasVendorPrefix(property)) return false\n\n let code = property.charCodeAt(0)\n\n return code === 47 // /\n || code === 95 // _\n || code === 43 // +\n || code === 42 // *\n || code === 38 // &\n || code === 36 // $\n || code === 35 // #\n}\n\nexport function isCustom(property) {\n if (property.length < 3) return false\n // 45 === '-'.charCodeAt(0)\n return property.charCodeAt(0) === 45 && property.charCodeAt(1) === 45\n}\n\n/**\n * A check to verify that a propery is `basename` or a prefixed\n * version of that, but never a custom property that accidentally\n * ends with the same substring.\n *\n * @example\n * isProperty('animation', 'animation') // true\n * isProperty('animation', '-webkit-animation') // true\n * isProperty('animation', '--my-animation') // false\n *\n * @param {string} basename\n * @param {string} property\n * @returns {boolean} True if `property` equals `basename` without prefix\n */\nexport function isProperty(basename, property) {\n if (isCustom(property)) return false\n return endsWith(basename, property)\n}","import { endsWith } from \"../string-utils.js\"\nimport { Identifier } from \"../css-tree-node-types.js\"\n\n/**\n * @param {import('css-tree').Value} node\n */\nexport function isIe9Hack(node) {\n\tlet children = node.children\n\tif (children) {\n\t\tlet last = children.last\n\t\treturn last\n\t\t\t&& last.type === Identifier\n\t\t\t&& endsWith('\\\\9', last.name)\n\t}\n\treturn false\n}\n\n/**\n * @param {import('css-tree').Value} node\n * @param {boolean|string} important - // i.e. `property: value !ie`\n */\nexport function isBrowserhack(node, important) {\n\treturn isIe9Hack(node) || typeof important === 'string'\n}","import parse from 'css-tree/parser'\nimport walk from 'css-tree/walker'\nimport { calculate } from '@bramus/specificity/core'\nimport { isSupportsBrowserhack, isMediaBrowserhack } from './atrules/atrules.js'\nimport { getCombinators, getComplexity, isAccessibility, isPrefixed } from './selectors/utils.js'\nimport { colorFunctions, colorKeywords, namedColors, systemColors } from './values/colors.js'\nimport { destructure, isSystemFont } from './values/destructure-font-shorthand.js'\nimport { isValueKeyword } from './values/values.js'\nimport { analyzeAnimation } from './values/animations.js'\nimport { isValuePrefixed } from './values/vendor-prefix.js'\nimport { ContextCollection } from './context-collection.js'\nimport { Collection } from './collection.js'\nimport { AggregateCollection } from './aggregate-collection.js'\nimport { strEquals, startsWith, endsWith } from './string-utils.js'\nimport { hasVendorPrefix } from './vendor-prefix.js'\nimport { isCustom, isHack, isProperty } from './properties/property-utils.js'\nimport { getEmbedType } from './stylesheet/stylesheet.js'\nimport { isIe9Hack } from './values/browserhacks.js'\nimport {\n Atrule,\n Selector,\n Dimension,\n Url,\n Value,\n Declaration,\n Hash,\n Rule,\n Identifier,\n Func,\n Operator\n} from './css-tree-node-types.js'\n\n/** @typedef {[number, number, number]} Specificity */\n\nfunction ratio(part, total) {\n if (total === 0) return 0\n return part / total\n}\n\nlet defaults = {\n useUnstableLocations: false\n}\n\n/**\n * @typedef Options\n * @property {boolean} useUnstableLocations **WARNING: EXPERIMENTAL!** Use Locations (`{ 'item': [{ line, column, offset, length }] }`) instead of a regular count per occurrence (`{ 'item': 3 }`)\n */\n\n/**\n * Analyze CSS\n * @param {string} css\n * @param {Options} options\n */\nexport function analyze(css, options = {}) {\n let settings = Object.assign({}, defaults, options)\n let useLocations = settings.useUnstableLocations === true\n let start = Date.now()\n\n /**\n * Recreate the authored CSS from a CSSTree node\n * @param {import('css-tree').CssNode} node - Node from CSSTree AST to stringify\n * @returns {string} str - The stringified node\n */\n function stringifyNode(node) {\n return stringifyNodePlain(node).trim()\n }\n\n function stringifyNodePlain(node) {\n let loc = node.loc\n return css.substring(loc.start.offset, loc.end.offset)\n }\n\n // Stylesheet\n let totalComments = 0\n let commentsSize = 0\n let embeds = new Collection(useLocations)\n let embedSize = 0\n let embedTypes = {\n total: 0,\n /** @type {Map<string, {size: number, count: number}>} */\n unique: new Map()\n }\n\n let startParse = Date.now()\n\n let ast = parse(css, {\n parseCustomProperty: true, // To find font-families, colors, etc.\n positions: true, // So we can use stringifyNode()\n /** @param {string} comment */\n onComment: function (comment) {\n totalComments++\n commentsSize += comment.length\n },\n })\n\n let startAnalysis = Date.now()\n let linesOfCode = ast.loc.end.line - ast.loc.start.line + 1\n\n // Atrules\n let totalAtRules = 0\n let atRuleComplexities = new AggregateCollection()\n /** @type {Record<string, string>[]} */\n let fontfaces = []\n let fontfaces_with_loc = new Collection(useLocations)\n let layers = new Collection(useLocations)\n let imports = new Collection(useLocations)\n let medias = new Collection(useLocations)\n let mediaBrowserhacks = new Collection(useLocations)\n let charsets = new Collection(useLocations)\n let supports = new Collection(useLocations)\n let supportsBrowserhacks = new Collection(useLocations)\n let keyframes = new Collection(useLocations)\n let prefixedKeyframes = new Collection(useLocations)\n let containers = new Collection(useLocations)\n let registeredProperties = new Collection(useLocations)\n\n // Rules\n let totalRules = 0\n let emptyRules = 0\n let ruleSizes = new AggregateCollection()\n let selectorsPerRule = new AggregateCollection()\n let declarationsPerRule = new AggregateCollection()\n let uniqueRuleSize = new Collection(useLocations)\n let uniqueSelectorsPerRule = new Collection(useLocations)\n let uniqueDeclarationsPerRule = new Collection(useLocations)\n\n // Selectors\n let keyframeSelectors = new Collection(useLocations)\n let uniqueSelectors = new Set()\n let prefixedSelectors = new Collection(useLocations)\n /** @type {Specificity} */\n let maxSpecificity\n /** @type {Specificity} */\n let minSpecificity\n let specificityA = new AggregateCollection()\n let specificityB = new AggregateCollection()\n let specificityC = new AggregateCollection()\n let uniqueSpecificities = new Collection(useLocations)\n let selectorComplexities = new AggregateCollection()\n let uniqueSelectorComplexities = new Collection(useLocations)\n /** @type {Specificity[]} */\n let specificities = []\n let ids = new Collection(useLocations)\n let a11y = new Collection(useLocations)\n let combinators = new Collection(useLocations)\n\n // Declarations\n let uniqueDeclarations = new Set()\n let totalDeclarations = 0\n let declarationComplexities = new AggregateCollection()\n let importantDeclarations = 0\n let importantsInKeyframes = 0\n let importantCustomProperties = new Collection(useLocations)\n\n // Properties\n let properties = new Collection(useLocations)\n let propertyHacks = new Collection(useLocations)\n let propertyVendorPrefixes = new Collection(useLocations)\n let customProperties = new Collection(useLocations)\n let propertyComplexities = new AggregateCollection()\n\n // Values\n let valueComplexities = new AggregateCollection()\n let vendorPrefixedValues = new Collection(useLocations)\n let valueBrowserhacks = new Collection(useLocations)\n let zindex = new Collection(useLocations)\n let textShadows = new Collection(useLocations)\n let boxShadows = new Collection(useLocations)\n let fontFamilies = new Collection(useLocations)\n let fontSizes = new Collection(useLocations)\n let lineHeights = new Collection(useLocations)\n let timingFunctions = new Collection(useLocations)\n let durations = new Collection(useLocations)\n let colors = new ContextCollection(useLocations)\n let colorFormats = new Collection(useLocations)\n let units = new ContextCollection(useLocations)\n let gradients = new Collection(useLocations)\n\n walk(ast, function (node) {\n switch (node.type) {\n case Atrule: {\n totalAtRules++\n\n let atRuleName = node.name\n\n if (atRuleName === 'font-face') {\n let descriptors = {}\n\n if (useLocations) {\n fontfaces_with_loc.p(node.loc.start.offset, node.loc)\n }\n\n node.block.children.forEach(descriptor => {\n // Ignore 'Raw' nodes in case of CSS syntax errors\n if (descriptor.type === Declaration) {\n descriptors[descriptor.property] = stringifyNode(descriptor.value)\n }\n })\n\n fontfaces.push(descriptors)\n atRuleComplexities.push(1)\n break\n }\n\n let complexity = 1\n\n // All the AtRules in here MUST have a prelude, so we can count their names\n if (node.prelude !== null) {\n let prelude = node.prelude\n let preludeStr = prelude && stringifyNode(node.prelude)\n let loc = prelude.loc\n\n if (atRuleName === 'media') {\n medias.p(preludeStr, loc)\n if (isMediaBrowserhack(prelude)) {\n mediaBrowserhacks.p(preludeStr, loc)\n complexity++\n }\n } else if (atRuleName === 'supports') {\n supports.p(preludeStr, loc)\n // TODO: analyze vendor prefixes in @supports\n // TODO: analyze complexity of @supports 'declaration'\n if (isSupportsBrowserhack(prelude)) {\n supportsBrowserhacks.p(preludeStr, loc)\n complexity++\n }\n } else if (endsWith('keyframes', atRuleName)) {\n let name = '@' + atRuleName + ' ' + preludeStr\n if (hasVendorPrefix(atRuleName)) {\n prefixedKeyframes.p(name, loc)\n complexity++\n }\n keyframes.p(name, loc)\n } else if (atRuleName === 'import') {\n imports.p(preludeStr, loc)\n // TODO: analyze complexity of media queries, layers and supports in @import\n // see https://github.com/projectwallace/css-analyzer/issues/326\n } else if (atRuleName === 'charset') {\n charsets.p(preludeStr, loc)\n } else if (atRuleName === 'container') {\n containers.p(preludeStr, loc)\n // TODO: calculate complexity of container 'declaration'\n } else if (atRuleName === 'layer') {\n preludeStr\n .split(',')\n .forEach(name => layers.p(name.trim(), loc))\n } else if (atRuleName === 'property') {\n registeredProperties.p(preludeStr, loc)\n // TODO: add complexity for descriptors\n }\n } else {\n if (atRuleName === 'layer') {\n layers.p('<anonymous>', node.loc)\n complexity++\n }\n }\n atRuleComplexities.push(complexity)\n break\n }\n case Rule: {\n let prelude = node.prelude\n let block = node.block\n let preludeChildren = prelude.children\n let blockChildren = block.children\n let numSelectors = preludeChildren ? preludeChildren.size : 0\n let numDeclarations = blockChildren ? blockChildren.size : 0\n\n ruleSizes.push(numSelectors + numDeclarations)\n uniqueRuleSize.p(numSelectors + numDeclarations, node.loc)\n selectorsPerRule.push(numSelectors)\n uniqueSelectorsPerRule.p(numSelectors, prelude.loc)\n declarationsPerRule.push(numDeclarations)\n uniqueDeclarationsPerRule.p(numDeclarations, block.loc)\n\n totalRules++\n\n if (numDeclarations === 0) {\n emptyRules++\n }\n break\n }\n case Selector: {\n let selector = stringifyNode(node)\n\n if (this.atrule && endsWith('keyframes', this.atrule.name)) {\n keyframeSelectors.p(selector, node.loc)\n return this.skip\n }\n\n if (isAccessibility(node)) {\n a11y.p(selector, node.loc)\n }\n\n let complexity = getComplexity(node)\n\n if (isPrefixed(node)) {\n prefixedSelectors.p(selector, node.loc)\n }\n\n uniqueSelectors.add(selector)\n selectorComplexities.push(complexity)\n uniqueSelectorComplexities.p(complexity, node.loc)\n\n // #region specificity\n let [{ value: specificityObj }] = calculate(node)\n let sa = specificityObj.a\n let sb = specificityObj.b\n let sc = specificityObj.c\n\n /** @type {Specificity} */\n let specificity = [sa, sb, sc]\n\n uniqueSpecificities.p(sa + ',' + sb + ',' + sc, node.loc)\n\n specificityA.push(sa)\n specificityB.push(sb)\n specificityC.push(sc)\n\n if (maxSpecificity === undefined) {\n maxSpecificity = specificity\n }\n\n if (minSpecificity === undefined) {\n minSpecificity = specificity\n }\n\n if (minSpecificity !== undefined && compareSpecificity(minSpecificity, specificity) < 0) {\n minSpecificity = specificity\n }\n\n if (maxSpecificity !== undefined && compareSpecificity(maxSpecificity, specificity) > 0) {\n maxSpecificity = specificity\n }\n\n specificities.push(specificity)\n // #endregion\n\n if (sa > 0) {\n ids.p(selector, node.loc)\n }\n\n getCombinators(node, function onCombinator(combinator) {\n combinators.p(combinator.name, combinator.loc)\n })\n\n // Avoid deeper walking of selectors to not mess with\n // our specificity calculations in case of a selector\n // with :where() or :is() that contain SelectorLists\n // as children\n return this.skip\n }\n case Dimension: {\n if (!this.declaration) {\n break\n }\n\n /** @type {string} */\n let unit = node.unit\n\n if (endsWith('\\\\9', unit)) {\n units.push(unit.substring(0, unit.length - 2), this.declaration.property, node.loc)\n } else {\n units.push(unit, this.declaration.property, node.loc)\n }\n\n return this.skip\n }\n case Url: {\n if (startsWith('data:', node.value)) {\n let embed = node.value\n let size = embed.length\n let type = getEmbedType(embed)\n\n embedTypes.total++\n embedSize += size\n\n let loc = {\n line: node.loc.start.line,\n column: node.loc.start.column,\n offset: node.loc.start.offset,\n length: node.loc.end.offset - node.loc.start.offset,\n }\n\n if (embedTypes.unique.has(type)) {\n let item = embedTypes.unique.get(type)\n item.count++\n item.size += size\n embedTypes.unique.set(type, item)\n if (useLocations) {\n item.__unstable__uniqueWithLocations.push(loc)\n }\n } else {\n let new_item = {\n count: 1,\n size\n }\n if (useLocations) {\n new_item.__unstable__uniqueWithLocations = [loc]\n }\n embedTypes.unique.set(type, new_item)\n }\n\n // @deprecated\n embeds.p(embed, node.loc)\n }\n break\n }\n case Value: {\n if (isValueKeyword(node)) {\n valueComplexities.push(1)\n break\n }\n\n let declaration = this.declaration\n let { property, important } = declaration\n let complexity = 1\n\n if (isValuePrefixed(node)) {\n vendorPrefixedValues.p(stringifyNode(node), node.loc)\n complexity++\n }\n\n // i.e. `property: value !ie`\n if (typeof important === 'string') {\n valueBrowserhacks.p(stringifyNodePlain(node) + '!' + important, node.loc)\n complexity++\n }\n\n // i.e. `property: value\\9`\n if (isIe9Hack(node)) {\n valueBrowserhacks.p(stringifyNode(node), node.loc)\n complexity++\n }\n\n let children = node.children\n let loc = node.loc\n\n // TODO: should shorthands be counted towards complexity?\n valueComplexities.push(complexity)\n\n // Process properties first that don't have colors,\n // so we can avoid further walking them;\n if (isProperty('z-index', property)) {\n zindex.p(stringifyNode(node), loc)\n return this.skip\n } else if (isProperty('font', property)) {\n if (isSystemFont(node)) return\n\n let { font_size, line_height, font_family } = destructure(node, stringifyNode)\n\n if (font_family) {\n fontFamilies.p(font_family, loc)\n }\n if (font_size) {\n fontSizes.p(font_size, loc)\n }\n if (line_height) {\n lineHeights.p(line_height, loc)\n }\n\n break\n } else if (isProperty('font-size', property)) {\n if (!isSystemFont(node)) {\n fontSizes.p(stringifyNode(node), loc)\n }\n break\n } else if (isProperty('font-family', property)) {\n if (!isSystemFont(node)) {\n fontFamilies.p(stringifyNode(node), loc)\n }\n break\n } else if (isProperty('line-height', property)) {\n lineHeights.p(stringifyNode(node), loc)\n } else if (isProperty('transition', property) || isProperty('animation', property)) {\n let [times, fns] = analyzeAnimation(children, stringifyNode)\n for (let i = 0; i < times.length; i++) {\n durations.p(times[i], loc)\n }\n for (let i = 0; i < fns.length; i++) {\n timingFunctions.p(fns[i], loc)\n }\n break\n } else if (isProperty('animation-duration', property) || isProperty('transition-duration', property)) {\n if (children && children.size > 1) {\n children.forEach(child => {\n if (child.type !== Operator) {\n durations.p(stringifyNode(child), loc)\n }\n })\n } else {\n durations.p(stringifyNode(node), loc)\n }\n break\n } else if (isProperty('transition-timing-function', property) || isProperty('animation-timing-function', property)) {\n if (children && children.size > 1) {\n children.forEach(child => {\n if (child.type !== Operator) {\n timingFunctions.p(stringifyNode(child), loc)\n }\n })\n } else {\n timingFunctions.p(stringifyNode(node), loc)\n }\n break\n } else if (isProperty('text-shadow', property)) {\n if (!isValueKeyword(node)) {\n textShadows.p(stringifyNode(node), loc)\n }\n // no break here: potentially contains colors\n } else if (isProperty('box-shadow', property)) {\n if (!isValueKeyword(node)) {\n boxShadows.p(stringifyNode(node), loc)\n }\n // no break here: potentially contains colors\n }\n\n walk(node, function (valueNode) {\n let nodeName = valueNode.name\n\n switch (valueNode.type) {\n case Hash: {\n let hexLength = valueNode.value.length\n if (endsWith('\\\\9', valueNode.value)) {\n hexLength = hexLength - 2\n }\n colors.push('#' + valueNode.value, property, loc)\n colorFormats.p(`hex` + hexLength, loc)\n\n return this.skip\n }\n case Identifier: {\n // Bail out if it can't be a color name\n // 20 === 'lightgoldenrodyellow'.length\n // 3 === 'red'.length\n let nodeLen = nodeName.length\n if (nodeLen > 20 || nodeLen < 3) {\n return this.skip\n }\n\n if (namedColors.has(nodeName)) {\n let stringified = stringifyNode(valueNode)\n colors.push(stringified, property, loc)\n colorFormats.p('named', loc)\n return\n }\n\n if (colorKeywords.has(nodeName)) {\n let stringified = stringifyNode(valueNode)\n colors.push(stringified, property, loc)\n colorFormats.p(nodeName.toLowerCase(), loc)\n return\n }\n\n if (systemColors.has(nodeName)) {\n let stringified = stringifyNode(valueNode)\n colors.push(stringified, property, loc)\n colorFormats.p('system', loc)\n return\n }\n return this.skip\n }\n case Func: {\n // Don't walk var() multiple times\n if (strEquals('var', nodeName)) {\n return this.skip\n }\n\n if (colorFunctions.has(nodeName)) {\n colors.push(stringifyNode(valueNode), property, valueNode.loc)\n colorFormats.p(nodeName.toLowerCase(), valueNode.loc)\n return\n }\n\n if (endsWith('gradient', nodeName)) {\n gradients.p(stringifyNode(valueNode), valueNode.loc)\n return\n }\n // No this.skip here intentionally,\n // otherwise we'll miss colors in linear-gradient() etc.\n }\n }\n })\n break\n }\n case Declaration: {\n // Do not process Declarations in atRule preludes\n // because we will handle them manually\n if (this.atrulePrelude !== null) {\n return this.skip\n }\n\n totalDeclarations++\n let complexity = 1\n\n uniqueDeclarations.add(stringifyNode(node))\n\n if (node.important === true) {\n importantDeclarations++\n complexity++\n\n if (this.atrule && endsWith('keyframes', this.atrule.name)) {\n importantsInKeyframes++\n complexity++\n }\n }\n\n declarationComplexities.push(complexity)\n\n let { property, loc: { start } } = node\n let propertyLoc = {\n start: {\n line: start.line,\n column: start.column,\n offset: start.offset\n },\n end: {\n offset: start.offset + property.length\n }\n }\n\n properties.p(property, propertyLoc)\n\n if (hasVendorPrefix(property)) {\n propertyVendorPrefixes.p(property, propertyLoc)\n propertyComplexities.push(2)\n } else if (isHack(property)) {\n propertyHacks.p(property, propertyLoc)\n propertyComplexities.push(2)\n } else if (isCustom(property)) {\n customProperties.p(property, propertyLoc)\n propertyComplexities.push(node.important ? 3 : 2)\n\n if (node.important === true) {\n importantCustomProperties.p(property, propertyLoc)\n }\n } else {\n propertyComplexities.push(1)\n }\n\n break\n }\n }\n })\n\n let embeddedContent = embeds.c()\n delete embeddedContent.__unstable__uniqueWithLocations\n\n let totalUniqueDeclarations = uniqueDeclarations.size\n\n let totalSelectors = selectorComplexities.size()\n let specificitiesA = specificityA.aggregate()\n let specificitiesB = specificityB.aggregate()\n let specificitiesC = specificityC.aggregate()\n let totalUniqueSelectors = uniqueSelectors.size\n let assign = Object.assign\n let cssLen = css.length\n let fontFacesCount = fontfaces.length\n let atRuleComplexity = atRuleComplexities.aggregate()\n let selectorComplexity = selectorComplexities.aggregate()\n let declarationComplexity = declarationComplexities.aggregate()\n let propertyComplexity = propertyComplexities.aggregate()\n let valueComplexity = valueComplexities.aggregate()\n\n return {\n stylesheet: {\n sourceLinesOfCode: totalAtRules + totalSelectors + totalDeclarations + keyframeSelectors.size(),\n linesOfCode,\n size: cssLen,\n complexity: atRuleComplexity.sum + selectorComplexity.sum + declarationComplexity.sum + propertyComplexity.sum + valueComplexity.sum,\n comments: {\n total: totalComments,\n size: commentsSize,\n },\n embeddedContent: assign(embeddedContent, {\n size: {\n total: embedSize,\n ratio: ratio(embedSize, cssLen),\n },\n types: {\n total: embedTypes.total,\n totalUnique: embedTypes.unique.size,\n uniquenessRatio: ratio(embedTypes.unique.size, embedTypes.total),\n unique: Object.fromEntries(embedTypes.unique),\n },\n }),\n },\n atrules: {\n fontface: assign({\n total: fontFacesCount,\n totalUnique: fontFacesCount,\n unique: fontfaces,\n uniquenessRatio: fontFacesCount === 0 ? 0 : 1,\n }, useLocations ? {\n __unstable__uniqueWithLocations: fontfaces_with_loc.c().__unstable__uniqueWithLocations,\n } : {}),\n import: imports.c(),\n media: assign(\n medias.c(),\n {\n browserhacks: mediaBrowserhacks.c(),\n }\n ),\n charset: charsets.c(),\n supports: assign(\n supports.c(),\n {\n browserhacks: supportsBrowserhacks.c(),\n },\n ),\n keyframes: assign(\n keyframes.c(), {\n prefixed: assign(\n prefixedKeyframes.c(), {\n ratio: ratio(prefixedKeyframes.size(), keyframes.size())\n }),\n }),\n container: containers.c(),\n layer: layers.c(),\n property: registeredProperties.c(),\n total: totalAtRules,\n complexity: atRuleComplexity\n },\n rules: {\n total: totalRules,\n empty: {\n total: emptyRules,\n ratio: ratio(emptyRules, totalRules)\n },\n sizes: assign(\n ruleSizes.aggregate(),\n {\n items: ruleSizes.toArray(),\n },\n uniqueRuleSize.c(),\n ),\n selectors: assign(\n selectorsPerRule.aggregate(),\n {\n items: selectorsPerRule.toArray(),\n },\n uniqueSelectorsPerRule.c(),\n ),\n declarations: assign(\n declarationsPerRule.aggregate(),\n {\n items: declarationsPerRule.toArray(),\n },\n uniqueDeclarationsPerRule.c(),\n ),\n },\n selectors: {\n total: totalSelectors,\n totalUnique: totalUniqueSelectors,\n uniquenessRatio: ratio(totalUniqueSelectors, totalSelectors),\n specificity: assign(\n {\n /** @type Specificity */\n min: minSpecificity === undefined ? [0, 0, 0] : minSpecificity,\n /** @type Specificity */\n max: maxSpecificity === undefined ? [0, 0, 0] : maxSpecificity,\n /** @type Specificity */\n sum: [specificitiesA.sum, specificitiesB.sum, specificitiesC.sum],\n /** @type Specificity */\n mean: [specificitiesA.mean, specificitiesB.mean, specificitiesC.mean],\n /** @type Specificity */\n mode: [specificitiesA.mode, specificitiesB.mode, specificitiesC.mode],\n /** @type Specificity */\n median: [specificitiesA.median, specificitiesB.median, specificitiesC.median],\n items: specificities,\n },\n uniqueSpecificities.c(),\n ),\n complexity: assign(\n selectorComplexity,\n uniqueSelectorComplexities.c(),\n {\n items: selectorComplexities.toArray(),\n }\n ),\n id: assign(\n ids.c(), {\n ratio: ratio(ids.size(), totalSelectors),\n }),\n accessibility: assign(\n a11y.c(), {\n ratio: ratio(a11y.size(), totalSelectors),\n }),\n keyframes: keyframeSelectors.c(),\n prefixed: assign(\n prefixedSelectors.c(),\n {\n ratio: ratio(prefixedSelectors.size(), totalSelectors),\n },\n ),\n combinators: combinators.c(),\n },\n declarations: {\n total: totalDeclarations,\n totalUnique: totalUniqueDeclarations,\n uniquenessRatio: ratio(totalUniqueDeclarations, totalDeclarations),\n // @TODO: deprecated, remove in next major version\n unique: {\n total: totalUniqueDeclarations,\n ratio: ratio(totalUniqueDeclarations, totalDeclarations),\n },\n importants: {\n total: importantDeclarations,\n ratio: ratio(importantDeclarations, totalDeclarations),\n inKeyframes: {\n total: importantsInKeyframes,\n ratio: ratio(importantsInKeyframes, importantDeclarations),\n },\n },\n complexity: declarationComplexity,\n },\n properties: assign(\n properties.c(),\n {\n prefixed: assign(\n propertyVendorPrefixes.c(),\n {\n ratio: ratio(propertyVendorPrefixes.size(), properties.size()),\n },\n ),\n custom: assign(\n customProperties.c(),\n {\n ratio: ratio(customProperties.size(), properties.size()),\n importants: assign(\n importantCustomProperties.c(),\n {\n ratio: ratio(importantCustomProperties.size(), customProperties.size()),\n }\n ),\n },\n ),\n browserhacks: assign(\n propertyHacks.c(), {\n ratio: ratio(propertyHacks.size(), properties.size()),\n }),\n complexity: propertyComplexity,\n }),\n values: {\n colors: assign(\n colors.count(),\n {\n formats: colorFormats.c(),\n },\n ),\n gradients: gradients.c(),\n fontFamilies: fontFamilies.c(),\n fontSizes: fontSizes.c(),\n lineHeights: lineHeights.c(),\n zindexes: zindex.c(),\n textShadows: textShadows.c(),\n boxShadows: boxShadows.c(),\n animations: {\n durations: durations.c(),\n timingFunctions: timingFunctions.c(),\n },\n prefixes: vendorPrefixedValues.c(),\n browserhacks: valueBrowserhacks.c(),\n units: units.count(),\n complexity: valueComplexity,\n },\n __meta__: {\n parseTime: startAnalysis - startParse,\n analyzeTime: Date.now() - startAnalysis,\n total: Date.now() - start\n }\n }\n}\n\n/**\n * Compare specificity A to Specificity B\n * @param {Specificity} a - Specificity A\n * @param {Specificity} b - Specificity B\n * @returns {number} sortIndex - 0 when a==b, 1 when a<b, -1 when a>b\n */\nexport function compareSpecificity(a, b) {\n if (a[0] === b[0]) {\n if (a[1] === b[1]) {\n return b[2] - a[2]\n }\n\n return b[1] - a[1]\n }\n\n return b[0] - a[0]\n}\n\nexport {\n getComplexity as selectorComplexity,\n isPrefixed as isSelectorPrefixed,\n isAccessibility as isAccessibilitySelector,\n} from './selectors/utils.js'\n\nexport {\n isSupportsBrowserhack,\n isMediaBrowserhack\n} from './atrules/atrules.js'\n\nexport {\n isBrowserhack as isValueBrowserhack\n} from './values/browserhacks.js'\n\nexport {\n isHack as isPropertyHack,\n} from './properties/property-utils.js'\n\nexport {\n isValuePrefixed\n} from './values/vendor-prefix.js'\n\nexport { hasVendorPrefix } from './vendor-prefix.js'\n","/**\n * @param {string} str\n * @param {number} start\n * @param {number} end\n */\nfunction substring(str, start, end) {\n\treturn str.substring(start, end)\n}\n\n/** @param {string} embed */\nexport function getEmbedType(embed) {\n\t// data:image/gif;base64,R0lG\n\tlet start = 5 // `data:`.length\n\tlet semicolon = embed.indexOf(';')\n\tlet comma = embed.indexOf(',')\n\n\tif (semicolon === -1) {\n\t\treturn substring(embed, start, comma)\n\t}\n\n\tif (comma !== -1 && comma < semicolon) {\n\t\treturn substring(embed, start, comma);\n\t}\n\n\treturn substring(embed, start, semicolon)\n}"],"names":["charCodeAt","str","at","compareChar","referenceCode","testCode","strEquals","base","maybe","len","length","i","endsWith","offset","startsWith","Func","isPropertyValue","node","property","value","firstChild","children","first","type","name","isSupportsBrowserhack","prelude","returnValue","walk","break","isMediaBrowserhack","size","n","unit","val","hasVendorPrefix","keyword","indexOf","analyzeList","selectorListAst","cb","childSelectors","visit","enter","push","isPseudoFunction","isAccessibility","selector","isA11y","some","b","skip","isPrefixed","getComplexity","complexity","list","forEach","c","KeywordSet","constructor","items","this","set","has","item","index","namedColors","systemColors","colorFunctions","colorKeywords","SYSTEM_FONTS","SIZE_KEYWORDS","isSystemFont","keywords","isValueKeyword","TIMING_KEYWORDS","TIMING_FUNCTION_VALUES","isValuePrefixed","toArray","Collection","useLocations","_items","Map","_total","_node_lines","_node_columns","_node_lengths","_node_offsets","_useLocations","p","node_location","start","start_offset","line","column","end","get","uniqueWithLocations","unique","key","nodes","map","total","totalUnique","uniquenessRatio","__unstable__uniqueWithLocations","Object","fromEntries","ContextCollection","_list","_contexts","context","count","itemsPerContext","entries","assign","AggregateCollection","_sum","aggregate","min","max","mean","mode","median","range","sum","sorted","slice","sort","a","arr","frequencies","maxOccurrences","maxOccurenceCount","element","updatedCount","Mode","middle","lowerMiddleRank","Math","floor","Median","isHack","isCustom","code","isProperty","basename","isIe9Hack","last","isBrowserhack","important","ratio","part","defaults","useUnstableLocations","analyze","css","options","Date","now","stringifyNode","stringifyNodePlain","trim","loc","substring","maxSpecificity","minSpecificity","totalComments","commentsSize","embeds","embedSize","embedTypes","startParse","ast","parse","parseCustomProperty","positions","onComment","comment","startAnalysis","linesOfCode","totalAtRules","atRuleComplexities","fontfaces","fontfaces_with_loc","layers","imports","medias","mediaBrowserhacks","charsets","supports","supportsBrowserhacks","keyframes","prefixedKeyframes","containers","registeredProperties","totalRules","emptyRules","ruleSizes","selectorsPerRule","declarationsPerRule","uniqueRuleSize","uniqueSelectorsPerRule","uniqueDeclarationsPerRule","keyframeSelectors","uniqueSelectors","Set","prefixedSelectors","specificityA","specificityB","specificityC","uniqueSpecificities","selectorComplexities","uniqueSelectorComplexities","specificities","ids","a11y","combinators","uniqueDeclarations","totalDeclarations","declarationComplexities","importantDeclarations","importantsInKeyframes","importantCustomProperties","properties","propertyHacks","propertyVendorPrefixes","customProperties","propertyComplexities","valueComplexities","vendorPrefixedValues","valueBrowserhacks","zindex","textShadows","boxShadows","fontFamilies","fontSizes","lineHeights","timingFunctions","durations","colors","colorFormats","units","gradients","atRuleName","descriptors","block","descriptor","preludeStr","split","preludeChildren","blockChildren","numSelectors","numDeclarations","atrule","add","specificityObj","calculate","sa","sb","sc","specificity","undefined","compareSpecificity","onMatch","selectorNode","previousLoc","prev","data","getCombinators","combinator","declaration","embed","semicolon","comma","getEmbedType","new_item","font_size","line_height","font_family","Array","from","next","destructure","times","fns","durationFound","child","analyzeAnimation","valueNode","nodeName","hexLength","nodeLen","stringified","toLowerCase","atrulePrelude","propertyLoc","embeddedContent","totalUniqueDeclarations","totalSelectors","specificitiesA","specificitiesB","specificitiesC","totalUniqueSelectors","cssLen","fontFacesCount","atRuleComplexity","selectorComplexity","declarationComplexity","propertyComplexity","valueComplexity","stylesheet","sourceLinesOfCode","comments","types","atrules","fontface","import","media","browserhacks","charset","prefixed","container","layer","rules","empty","sizes","selectors","declarations","id","accessibility","importants","inKeyframes","custom","values","formats","zindexes","animations","prefixes","__meta__","parseTime","analyzeTime"],"mappings":"mHAIA,SAASA,EAAWC,EAAKC,GACvB,OAAOD,EAAID,WAAWE,EACxB,CAQA,SAASC,EAAYC,EAAeC,GAMlC,OAJI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oB,IAAhBE,EAAK7C,OAAc,OAKvB,OAHA6C,EAAKC,QAASC,IACZH,GAAcG,SAEJN,IACd,EAEJ,GAEOG,CACT,OChJaI,EAGZC,YAAYC,GAEXC,KAAKC,IAAMF,CACZ,CAGAG,IAAIC,GACH,IAAIvD,EAAMoD,KAAKC,IAAIpD,OAEnB,IAAK,IAAIuD,EAAQ,EAAGA,EAAQxD,EAAKwD,IAChC,GAAI3D,EAAUuD,KAAKC,IAAIG,GAAQD,GAC9B,SAGF,QACD,QCrBYE,EAAc,IAAIR,EAAW,CAKxC,QACA,QACA,MACA,OACA,OACA,OACA,QACA,gBACA,SACA,SAEA,YACA,eACA,OACA,aACA,QACA,QACA,SACA,iBACA,aACA,QACA,YACA,YACA,aACA,YACA,QACA,iBACA,WACA,UACA,OACA,WACA,WACA,gBACA,WACA,YACA,WACA,YACA,cACA,iBACA,aACA,aACA,UACA,aACA,eACA,gBACA,gBACA,gBACA,gBACA,aACA,WACA,cACA,UACA,UACA,aACA,YACA,cACA,cACA,UACA,YACA,aACA,OACA,YACA,cACA,WACA,UACA,YACA,SACA,QACA,QACA,WACA,gBACA,YACA,eACA,YACA,aACA,YACA,uBACA,YACA,aACA,YACA,YACA,cACA,gBACA,eACA,iBACA,iBACA,iBACA,cACA,OACA,YACA,QACA,UACA,SACA,mBACA,aACA,eACA,eACA,iBACA,kBACA,oBACA,kBACA,kBACA,eACA,YACA,YACA,WACA,cACA,OACA,UACA,QACA,YACA,YACA,SACA,gBACA,YACA,gBACA,gBACA,aACA,YACA,OACA,OACA,OACA,aACA,SACA,YACA,YACA,cACA,SACA,aACA,WACA,WACA,SACA,SACA,UACA,YACA,YACA,YACA,OACA,cACA,YACA,MACA,OACA,UACA,SACA,YACA,SACA,QACA,aACA,gBAGWS,EAAe,IAAIT,EAAW,CAGzC,SACA,aACA,WACA,cACA,aACA,aACA,aACA,eACA,QACA,YACA,YACA,gBACA,eACA,mBACA,OACA,WACA,aAMWU,EAAiB,IAAIV,EAAW,C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,MAAQpE,GAG1B,UAQgB4K,EAAmBtI,EAAG/E,GACpC,OAAI+E,EAAE,KAAO/E,EAAE,GACT+E,EAAE,KAAO/E,EAAE,GACNA,EAAE,GAAK+E,EAAE,GAGX/E,EAAE,GAAK+E,EAAE,GAGX/E,EAAE,GAAK+E,EAAE,EAClB"}
|
|
1
|
+
{"version":3,"file":"analyzer.modern.js","sources":["../src/string-utils.js","../src/css-tree-node-types.js","../src/atrules/atrules.js","../src/vendor-prefix.js","../src/selectors/utils.js","../src/keyword-set.js","../src/values/colors.js","../src/values/destructure-font-shorthand.js","../src/values/values.js","../src/values/animations.js","../src/values/vendor-prefix.js","../src/collection.js","../src/context-collection.js","../src/aggregate-collection.js","../src/properties/property-utils.js","../src/values/browserhacks.js","../src/index.js","../src/stylesheet/stylesheet.js"],"sourcesContent":["/**\n * @param {string} str\n * @param {number} at\n */\nfunction charCodeAt(str, at) {\n return str.charCodeAt(at)\n}\n\n/**\n * Case-insensitive compare two character codes\n * @param {string} referenceCode\n * @param {string} testCode\n * @see https://github.com/csstree/csstree/blob/41f276e8862d8223eeaa01a3d113ab70bb13d2d9/lib/tokenizer/utils.js#L22\n */\nfunction compareChar(referenceCode, testCode) {\n // if uppercase\n if (testCode >= 0x0041 && testCode <= 0x005A) {\n // shifting the 6th bit makes a letter lowercase\n testCode = testCode | 32\n }\n return referenceCode === testCode\n}\n\n/**\n * Case-insensitive string-comparison\n * @example\n * strEquals('test', 'test') // true\n * strEquals('test', 'TEST') // true\n * strEquals('test', 'TesT') // true\n * strEquals('test', 'derp') // false\n *\n * @param {string} base The string to check against\n * @param {string} maybe The test string, possibly containing uppercased characters\n * @returns {boolean} true if the two strings are the same, false otherwise\n */\nexport function strEquals(base, maybe) {\n let len = base.length;\n if (len !== maybe.length) return false\n\n for (let i = 0; i < len; i++) {\n if (compareChar(charCodeAt(base, i), charCodeAt(maybe, i)) === false) {\n return false\n }\n }\n\n return true\n}\n\n/**\n * Case-insensitive testing whether a string ends with a given substring\n *\n * @example\n * endsWith('test', 'my-test') // true\n * endsWith('test', 'est') // false\n *\n * @param {string} base e.g. '-webkit-transform'\n * @param {string} maybe e.g. 'transform'\n * @returns {boolean} true if `test` ends with `base`, false otherwise\n */\nexport function endsWith(base, maybe) {\n let len = maybe.length\n let offset = len - base.length\n\n if (offset < 0) {\n return false\n }\n\n for (let i = len - 1; i >= offset; i--) {\n if (compareChar(charCodeAt(base, i - offset), charCodeAt(maybe, i)) === false) {\n return false\n }\n }\n\n return true\n}\n\n/**\n * Case-insensitive testing whether a string starts with a given substring\n * @param {string} base\n * @param {string} maybe\n * @returns {boolean} true if `test` starts with `base`, false otherwise\n */\nexport function startsWith(base, maybe) {\n let len = base.length\n if (maybe.length < len) return false\n\n for (let i = 0; i < len; i++) {\n if (compareChar(charCodeAt(base, i), charCodeAt(maybe, i)) === false) {\n return false\n }\n }\n\n return true\n}\n","// Atrule\nexport const Atrule = 'Atrule'\nexport const MediaQuery = 'MediaQuery'\nexport const MediaFeature = 'MediaFeature'\n// Rule\nexport const Rule = 'Rule'\n\n// Selector\nexport const Selector = 'Selector'\nexport const TypeSelector = 'TypeSelector'\nexport const PseudoClassSelector = 'PseudoClassSelector'\nexport const AttributeSelector = 'AttributeSelector'\nexport const IdSelector = 'IdSelector'\nexport const ClassSelector = 'ClassSelector'\nexport const PseudoElementSelector = 'PseudoElementSelector'\n\n// Declaration\nexport const Declaration = 'Declaration'\n\n// Values\nexport const Value = 'Value'\nexport const Identifier = 'Identifier'\nexport const Nth = 'Nth'\nexport const Combinator = 'Combinator'\nexport const Nr = 'Number'\nexport const Dimension = 'Dimension'\nexport const Operator = 'Operator'\nexport const Hash = 'Hash'\nexport const Url = 'Url'\nexport const Func = 'Function'\n","import { strEquals, startsWith, endsWith } from '../string-utils.js'\nimport walk from 'css-tree/walker'\nimport {\n Identifier,\n MediaQuery,\n MediaFeature,\n Declaration,\n} from '../css-tree-node-types.js'\n\n/**\n * Check whether node.property === property and node.value === value,\n * but case-insensitive and fast.\n * @param {import('css-tree').Declaration} node\n * @param {string} property - The CSS property to compare with (case-insensitive)\n * @param {string} value - The identifier/keyword value to compare with\n * @returns true if declaratioNode is the given property: value, false otherwise\n */\nfunction isPropertyValue(node, property, value) {\n let firstChild = node.value.children.first\n return strEquals(property, node.property)\n && firstChild.type === Identifier\n && strEquals(value, firstChild.name)\n}\n\n/**\n * Check if an @supports atRule is a browserhack\n * @param {import('css-tree').AtrulePrelude} prelude\n * @returns true if the atrule is a browserhack\n */\nexport function isSupportsBrowserhack(prelude) {\n let returnValue = false\n\n walk(prelude, function (node) {\n if (node.type === Declaration) {\n if (\n isPropertyValue(node, '-webkit-appearance', 'none')\n || isPropertyValue(node, '-moz-appearance', 'meterbar')\n ) {\n returnValue = true\n return this.break\n }\n }\n })\n\n return returnValue\n}\n\n/**\n * Check if a @media atRule is a browserhack\n * @param {import('css-tree').AtrulePrelude} prelude\n * @returns true if the atrule is a browserhack\n */\nexport function isMediaBrowserhack(prelude) {\n let returnValue = false\n\n walk(prelude, function (node) {\n let children = node.children\n let name = node.name\n let value = node.value\n\n if (node.type === MediaQuery\n && children.size === 1\n && children.first.type === Identifier\n ) {\n let n = children.first.name\n // Note: CSSTree adds a trailing space to \\\\9\n if (startsWith('\\\\0', n) || endsWith('\\\\9 ', n)) {\n returnValue = true\n return this.break\n }\n }\n if (node.type === MediaFeature) {\n if (value !== null && value.unit === '\\\\0') {\n returnValue = true\n return this.break\n }\n if (strEquals('-moz-images-in-menus', name)\n || strEquals('min--moz-device-pixel-ratio', name)\n || strEquals('-ms-high-contrast', name)\n ) {\n returnValue = true\n return this.break\n }\n if (strEquals('min-resolution', name)\n && strEquals('.001', value.value)\n && strEquals('dpcm', value.unit)\n ) {\n returnValue = true\n return this.break\n }\n if (strEquals('-webkit-min-device-pixel-ratio', name)) {\n let val = value.value\n if ((strEquals('0', val) || strEquals('10000', val))) {\n returnValue = true\n return this.break\n }\n }\n }\n })\n\n return returnValue\n}","const HYPHENMINUS = 45; // '-'.charCodeAt()\n\n/**\n * @param {string} keyword\n * @returns {boolean}\n */\nfunction hasVendorPrefix(keyword) {\n if (keyword.charCodeAt(0) === HYPHENMINUS && keyword.charCodeAt(1) !== HYPHENMINUS) {\n // String must have a 2nd occurrence of '-', at least at position 3 (offset=2)\n if (keyword.indexOf('-', 2) !== -1) {\n return true\n }\n }\n\n return false\n}\n\nexport {\n hasVendorPrefix\n}","import walk from 'css-tree/walker'\nimport { startsWith, strEquals } from '../string-utils.js'\nimport { hasVendorPrefix } from '../vendor-prefix.js'\nimport {\n PseudoClassSelector,\n PseudoElementSelector,\n TypeSelector,\n Combinator,\n Selector,\n AttributeSelector,\n Nth,\n} from '../css-tree-node-types.js'\n\n/**\n *\n * @param {import('css-tree').SelectorList} selectorListAst\n * @returns {Selector[]} Analyzed selectors in the selectorList\n */\nfunction analyzeList(selectorListAst, cb) {\n let childSelectors = []\n walk(selectorListAst, {\n visit: Selector,\n enter: function (node) {\n childSelectors.push(cb(node))\n }\n })\n\n return childSelectors\n}\n\nfunction isPseudoFunction(name) {\n return (\n strEquals(name, 'not')\n || strEquals(name, 'nth-child')\n || strEquals(name, 'nth-last-child')\n || strEquals(name, 'where')\n || strEquals(name, 'is')\n || strEquals(name, 'has')\n || strEquals(name, 'matches')\n || strEquals(name, '-webkit-any')\n || strEquals(name, '-moz-any')\n )\n}\n\n/** @param {import('css-tree').Selector} selector */\nexport function isAccessibility(selector) {\n let isA11y = false\n\n walk(selector, function (node) {\n if (node.type === AttributeSelector) {\n let name = node.name.name\n if (strEquals('role', name) || startsWith('aria-', name)) {\n isA11y = true\n return this.break\n }\n }\n // Test for [aria-] or [role] inside :is()/:where() and friends\n else if (node.type === PseudoClassSelector) {\n if (isPseudoFunction(node.name)) {\n let list = analyzeList(node, isAccessibility)\n\n if (list.some(b => b === true)) {\n isA11y = true\n return this.skip\n }\n\n return this.skip\n }\n }\n })\n\n return isA11y;\n}\n\n/**\n * @param {import('css-tree').Selector} selector\n * @returns {boolean} Whether the selector contains a vendor prefix\n */\nexport function isPrefixed(selector) {\n let isPrefixed = false\n\n walk(selector, function (node) {\n if (node.type === PseudoElementSelector\n || node.type === TypeSelector\n || node.type === PseudoClassSelector\n ) {\n if (hasVendorPrefix(node.name)) {\n isPrefixed = true\n return this.break\n }\n } else if (node.type === AttributeSelector) {\n if (hasVendorPrefix(node.name.name)) {\n isPrefixed = true\n return this.break\n }\n }\n })\n\n return isPrefixed;\n}\n\n/**\n * Get the Complexity for the AST of a Selector Node\n * @param {import('css-tree').Selector} selector - AST Node for a Selector\n * @return {[number, boolean]} - The numeric complexity of the Selector and whether it's prefixed or not\n */\nexport function getComplexity(selector) {\n let complexity = 0\n\n walk(selector, function (node) {\n if (node.type === Selector || node.type === Nth) return\n\n complexity++\n\n if (node.type === PseudoElementSelector\n || node.type === TypeSelector\n || node.type === PseudoClassSelector\n ) {\n if (hasVendorPrefix(node.name)) {\n complexity++\n }\n }\n\n if (node.type === AttributeSelector) {\n if (node.value) {\n complexity++\n }\n if (hasVendorPrefix(node.name.name)) {\n complexity++\n }\n return this.skip\n }\n\n if (node.type === PseudoClassSelector) {\n if (isPseudoFunction(node.name)) {\n let list = analyzeList(node, getComplexity)\n\n // Bail out for empty/non-existent :nth-child() params\n if (list.length === 0) return\n\n list.forEach((c) => {\n complexity += c\n })\n return this.skip\n }\n }\n })\n\n return complexity\n}\n\n/**\n * Walk a selector node and trigger a callback every time a Combinator was found\n * We need create the `loc` for descendant combinators manually, because CSSTree\n * does not keep track of whitespace for us. We'll assume that the combinator is\n * alwas a single ` ` (space) character, even though there could be newlines or\n * multiple spaces\n * @param {import('css-tree').CssNode} node\n * @param {*} onMatch\n */\nexport function getCombinators(node, onMatch) {\n walk(node, function (\n /** @type {import('css-tree').CssNode} */ selectorNode,\n /** @type {import('css-tree').ListItem} */ item\n ) {\n if (selectorNode.type === Combinator) {\n let loc = selectorNode.loc\n let name = selectorNode.name\n\n // .loc is null when selectorNode.name === ' '\n if (loc === null) {\n let previousLoc = item.prev.data.loc.end\n let start = {\n offset: previousLoc.offset,\n line: previousLoc.line,\n column: previousLoc.column\n }\n\n onMatch({\n name,\n loc: {\n start,\n end: {\n offset: start.offset + 1,\n line: start.line,\n column: start.column + 1\n }\n }\n })\n } else {\n onMatch({\n name,\n loc\n })\n }\n }\n })\n}\n","import { strEquals } from \"./string-utils.js\"\n\n/**\n * @description A Set-like construct to search CSS keywords in a case-insensitive way\n */\nexport class KeywordSet {\n\n\t/** @param {string[]} items */\n\tconstructor(items) {\n\t\t/** @type {string[]} */\n\t\tthis.set = items\n\t}\n\n\t/** @param {string} item */\n\thas(item) {\n\t\tlet len = this.set.length\n\n\t\tfor (let index = 0; index < len; index++) {\n\t\t\tif (strEquals(this.set[index], item)) {\n\t\t\t\treturn true\n\t\t\t}\n\t\t}\n\t\treturn false\n\t}\n}","import { KeywordSet } from \"../keyword-set.js\"\n\nexport const namedColors = new KeywordSet([\n // CSS Named Colors\n // Spec: https://drafts.csswg.org/css-color/#named-colors\n\n // Heuristic: popular names first for quick finding in set.has()\n 'white',\n 'black',\n 'red',\n 'blue',\n 'gray',\n 'grey',\n 'green',\n 'rebeccapurple',\n 'yellow',\n 'orange',\n\n 'aliceblue',\n 'antiquewhite',\n 'aqua',\n 'aquamarine',\n 'azure',\n 'beige',\n 'bisque',\n 'blanchedalmond',\n 'blueviolet',\n 'brown',\n 'burlywood',\n 'cadetblue',\n 'chartreuse',\n 'chocolate',\n 'coral',\n 'cornflowerblue',\n 'cornsilk',\n 'crimson',\n 'cyan',\n 'darkblue',\n 'darkcyan',\n 'darkgoldenrod',\n 'darkgray',\n 'darkgreen',\n 'darkgrey',\n 'darkkhaki',\n 'darkmagenta',\n 'darkolivegreen',\n 'darkorange',\n 'darkorchid',\n 'darkred',\n 'darksalmon',\n 'darkseagreen',\n 'darkslateblue',\n 'darkslategray',\n 'darkslategrey',\n 'darkturquoise',\n 'darkviolet',\n 'deeppink',\n 'deepskyblue',\n 'dimgray',\n 'dimgrey',\n 'dodgerblue',\n 'firebrick',\n 'floralwhite',\n 'forestgreen',\n 'fuchsia',\n 'gainsboro',\n 'ghostwhite',\n 'gold',\n 'goldenrod',\n 'greenyellow',\n 'honeydew',\n 'hotpink',\n 'indianred',\n 'indigo',\n 'ivory',\n 'khaki',\n 'lavender',\n 'lavenderblush',\n 'lawngreen',\n 'lemonchiffon',\n 'lightblue',\n 'lightcoral',\n 'lightcyan',\n 'lightgoldenrodyellow',\n 'lightgray',\n 'lightgreen',\n 'lightgrey',\n 'lightpink',\n 'lightsalmon',\n 'lightseagreen',\n 'lightskyblue',\n 'lightslategray',\n 'lightslategrey',\n 'lightsteelblue',\n 'lightyellow',\n 'lime',\n 'limegreen',\n 'linen',\n 'magenta',\n 'maroon',\n 'mediumaquamarine',\n 'mediumblue',\n 'mediumorchid',\n 'mediumpurple',\n 'mediumseagreen',\n 'mediumslateblue',\n 'mediumspringgreen',\n 'mediumturquoise',\n 'mediumvioletred',\n 'midnightblue',\n 'mintcream',\n 'mistyrose',\n 'moccasin',\n 'navajowhite',\n 'navy',\n 'oldlace',\n 'olive',\n 'olivedrab',\n 'orangered',\n 'orchid',\n 'palegoldenrod',\n 'palegreen',\n 'paleturquoise',\n 'palevioletred',\n 'papayawhip',\n 'peachpuff',\n 'peru',\n 'pink',\n 'plum',\n 'powderblue',\n 'purple',\n 'rosybrown',\n 'royalblue',\n 'saddlebrown',\n 'salmon',\n 'sandybrown',\n 'seagreen',\n 'seashell',\n 'sienna',\n 'silver',\n 'skyblue',\n 'slateblue',\n 'slategray',\n 'slategrey',\n 'snow',\n 'springgreen',\n 'steelblue',\n 'tan',\n 'teal',\n 'thistle',\n 'tomato',\n 'turquoise',\n 'violet',\n 'wheat',\n 'whitesmoke',\n 'yellowgreen',\n])\n\nexport const systemColors = new KeywordSet([\n // CSS System Colors\n // Spec: https://drafts.csswg.org/css-color/#css-system-colors\n 'canvas',\n 'canvastext',\n 'linktext',\n 'visitedtext',\n 'activetext',\n 'buttonface',\n 'buttontext',\n 'buttonborder',\n 'field',\n 'fieldtext',\n 'highlight',\n 'highlighttext',\n 'selecteditem',\n 'selecteditemtext',\n 'mark',\n 'marktext',\n 'graytext',\n\n // TODO: Deprecated CSS System colors\n // Spec: https://drafts.csswg.org/css-color/#deprecated-system-colors\n])\n\nexport const colorFunctions = new KeywordSet([\n 'rgb',\n 'rgba',\n 'hsl',\n 'hsla',\n 'hwb',\n 'lab',\n 'lch',\n 'oklab',\n 'oklch',\n 'color',\n])\n\nexport const colorKeywords = new KeywordSet([\n 'transparent',\n 'currentcolor',\n])\n","import { KeywordSet } from \"../keyword-set.js\"\nimport { Identifier, Nr, Dimension, Operator } from '../css-tree-node-types.js'\n\nconst SYSTEM_FONTS = new KeywordSet([\n\t'caption',\n\t'icon',\n\t'menu',\n\t'message-box',\n\t'small-caption',\n\t'status-bar',\n])\n\nconst SIZE_KEYWORDS = new KeywordSet([\n\t/* <absolute-size> values */\n\t'xx-small',\n\t'x-small',\n\t'small',\n\t'medium',\n\t'large',\n\t'x-large',\n\t'xx-large',\n\t'xxx-large',\n\t/* <relative-size> values */\n\t'smaller',\n\t'larger',\n])\n\nconst COMMA = 44 // ','.charCodeAt(0) === 44\nconst SLASH = 47 // '/'.charCodeAt(0) === 47\n\n/**\n * @param {string} str\n * @param {number} at\n */\nfunction charCodeAt(str, at) {\n\treturn str.charCodeAt(at)\n}\n\nexport function isSystemFont(node) {\n\tlet firstChild = node.children.first\n\tif (firstChild === null) return false\n\treturn firstChild.type === Identifier && SYSTEM_FONTS.has(firstChild.name)\n}\n\n/**\n * @param {import('css-tree').Value} value\n * @param {*} stringifyNode\n */\nexport function destructure(value, stringifyNode) {\n\tlet font_family = Array.from({ length: 2 })\n\tlet font_size\n\tlet line_height\n\n\tvalue.children.forEach(function (node, item) {\n\t\t// any node that comes before the '/' is the font-size\n\t\tif (\n\t\t\titem.next &&\n\t\t\titem.next.data.type === Operator &&\n\t\t\tcharCodeAt(item.next.data.value, 0) === SLASH\n\t\t) {\n\t\t\tfont_size = stringifyNode(node)\n\t\t\treturn\n\t\t}\n\n\t\t// any node that comes after '/' is the line-height\n\t\tif (\n\t\t\titem.prev &&\n\t\t\titem.prev.data.type === Operator &&\n\t\t\tcharCodeAt(item.prev.data.value, 0) === SLASH\n\t\t) {\n\t\t\tline_height = stringifyNode(node)\n\t\t\treturn\n\t\t}\n\n\t\t// any node that's followed by ',' is a font-family\n\t\tif (\n\t\t\titem.next &&\n\t\t\titem.next.data.type === Operator &&\n\t\t\tcharCodeAt(item.next.data.value, 0) === COMMA &&\n\t\t\t!font_family[0]\n\t\t) {\n\t\t\tfont_family[0] = node\n\n\t\t\tif (!font_size && item.prev !== null) {\n\t\t\t\tfont_size = stringifyNode(item.prev.data)\n\t\t\t}\n\n\t\t\treturn\n\t\t}\n\n\t\t// any node that's a number and not previously caught by line-height or font-size is the font-weight\n\t\t// (oblique <angle> will not be caught here, because that's a Dimension, not a Number)\n\t\tif (node.type === Nr) {\n\t\t\treturn\n\t\t}\n\n\t\t// last node always ends the font-family\n\t\tif (item.next === null) {\n\t\t\tfont_family[1] = node\n\n\t\t\t// if, at the last node, we don;t have a size yet, it *must* be the previous node\n\t\t\t// unless `font: menu` (system font), because then there's simply no size\n\t\t\tif (!font_size && !font_family[0] && item.prev) {\n\t\t\t\tfont_size = stringifyNode(item.prev.data)\n\t\t\t}\n\n\t\t\treturn\n\t\t}\n\n\t\t// Any remaining identifiers can be font-size, font-style, font-stretch, font-variant or font-weight\n\t\tif (node.type === Identifier) {\n\t\t\tlet name = node.name\n\t\t\tif (SIZE_KEYWORDS.has(name)) {\n\t\t\t\tfont_size = name\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t})\n\n\treturn {\n\t\tfont_size,\n\t\tline_height,\n\t\tfont_family: (font_family[0] || font_family[1]) ? stringifyNode({\n\t\t\tloc: {\n\t\t\t\tstart: {\n\t\t\t\t\toffset: (font_family[0] || font_family[1]).loc.start.offset\n\t\t\t\t},\n\t\t\t\tend: {\n\t\t\t\t\toffset: font_family[1].loc.end.offset\n\t\t\t\t}\n\t\t\t}\n\t\t}) : null,\n\t}\n}","import { KeywordSet } from \"../keyword-set.js\"\nimport { Identifier } from \"../css-tree-node-types.js\"\n\nconst keywords = new KeywordSet([\n 'auto',\n 'inherit',\n 'initial',\n 'unset',\n 'revert',\n 'revert-layer',\n 'none', // for `text-shadow`, `box-shadow` and `background`\n])\n\n/**\n * @param {import('css-tree').Value} node\n */\nexport function isValueKeyword(node) {\n let children = node.children\n let size = children.size\n\n if (!children) return false\n if (size > 1 || size === 0) return false\n\n let firstChild = children.first\n return firstChild.type === Identifier && keywords.has(firstChild.name)\n}\n","import { KeywordSet } from \"../keyword-set.js\"\nimport {\n Operator,\n Dimension,\n Identifier,\n Func,\n} from '../css-tree-node-types.js'\n\nconst TIMING_KEYWORDS = new KeywordSet([\n 'linear',\n 'ease',\n 'ease-in',\n 'ease-out',\n 'ease-in-out',\n 'step-start',\n 'step-end',\n])\n\nconst TIMING_FUNCTION_VALUES = new KeywordSet([\n 'cubic-bezier',\n 'steps'\n])\n\nexport function analyzeAnimation(children, stringifyNode) {\n let durationFound = false\n let durations = []\n let timingFunctions = []\n\n children.forEach(child => {\n let type = child.type\n let name = child.name\n\n // Right after a ',' we start over again\n if (type === Operator) {\n return durationFound = false\n }\n if (type === Dimension && durationFound === false) {\n durationFound = true\n return durations.push(stringifyNode(child))\n }\n if (type === Identifier && TIMING_KEYWORDS.has(name)) {\n return timingFunctions.push(stringifyNode(child))\n }\n if (type === Func && TIMING_FUNCTION_VALUES.has(name)) {\n return timingFunctions.push(stringifyNode(child))\n }\n })\n\n return [durations, timingFunctions]\n}\n","import { hasVendorPrefix } from '../vendor-prefix.js'\nimport { Func, Identifier } from '../css-tree-node-types.js'\n\n/**\n * @param {import('css-tree').Value} node\n */\nexport function isValuePrefixed(node) {\n let children = node.children\n\n if (!children) {\n return false\n }\n\n let list = children.toArray()\n\n for (let index = 0; index < list.length; index++) {\n let node = list[index]\n let { type, name } = node;\n\n if (type === Identifier && hasVendorPrefix(name)) {\n return true\n }\n\n if (type === Func) {\n if (hasVendorPrefix(name)) {\n return true\n }\n\n if (isValuePrefixed(node)) {\n return true\n }\n }\n }\n\n return false\n}\n","export class Collection {\n\t/** @param {boolean} useLocations */\n\tconstructor(useLocations = false) {\n\t\t/** @type {Map<string, number[]>} */\n\t\tthis._items = new Map()\n\t\tthis._total = 0\n\n\t\tif (useLocations) {\n\t\t\t/** @type {number[]} */\n\t\t\tthis._node_lines = []\n\t\t\t/** @type {number[]} */\n\t\t\tthis._node_columns = []\n\t\t\t/** @type {number[]} */\n\t\t\tthis._node_lengths = []\n\t\t\t/** @type {number[]} */\n\t\t\tthis._node_offsets = []\n\t\t}\n\n\t\t/** @type {boolean} */\n\t\tthis._useLocations = useLocations\n\t}\n\n\t/**\n\t * @param {string} item\n\t * @param {import('css-tree').CssLocation} node_location\n\t */\n\tp(item, node_location) {\n\t\tlet index = this._total\n\n\t\tif (this._useLocations) {\n\t\t\tlet start = node_location.start\n\t\t\tlet start_offset = start.offset\n\n\t\t\tthis._node_lines[index] = start.line\n\t\t\tthis._node_columns[index] = start.column\n\t\t\tthis._node_offsets[index] = start_offset\n\t\t\tthis._node_lengths[index] = node_location.end.offset - start_offset\n\t\t}\n\n\t\tif (this._items.has(item)) {\n\t\t\t/** @type number[] */\n\t\t\tlet list = this._items.get(item)\n\t\t\tlist.push(index)\n\t\t\tthis._total++\n\t\t\treturn\n\t\t}\n\n\t\tthis._items.set(item, [index])\n\t\tthis._total++\n\t}\n\n\tsize() {\n\t\treturn this._total\n\t}\n\n\t/**\n\t * @typedef CssLocation\n\t * @property {number} line\n\t * @property {number} column\n\t * @property {number} offset\n\t * @property {number} length\n\t *\n\t * @returns {{ total: number; totalUnique: number; uniquenessRatio: number; unique: Record<string, number>; __unstable__uniqueWithLocations: Record<string, CssLocation[]>}}\n\t */\n\tc() {\n\t\tlet useLocations = this._useLocations\n\t\tlet uniqueWithLocations = new Map()\n\t\tlet unique = {}\n\t\tlet items = this._items\n\t\tlet size = items.size\n\n\t\titems.forEach((list, key) => {\n\t\t\tif (useLocations) {\n\t\t\t\tlet nodes = list.map(index => ({\n\t\t\t\t\tline: this._node_lines[index],\n\t\t\t\t\tcolumn: this._node_columns[index],\n\t\t\t\t\toffset: this._node_offsets[index],\n\t\t\t\t\tlength: this._node_lengths[index],\n\t\t\t\t}))\n\t\t\t\tuniqueWithLocations.set(key, nodes)\n\t\t\t}\n\t\t\tunique[key] = list.length\n\t\t})\n\n\t\tif (this._useLocations) {\n\t\t\treturn {\n\t\t\t\ttotal: this._total,\n\t\t\t\ttotalUnique: size,\n\t\t\t\tunique,\n\t\t\t\tuniquenessRatio: this._total === 0 ? 0 : size / this._total,\n\t\t\t\t__unstable__uniqueWithLocations: Object.fromEntries(uniqueWithLocations),\n\t\t\t}\n\t\t}\n\n\t\treturn {\n\t\t\ttotal: this._total,\n\t\t\ttotalUnique: size,\n\t\t\tunique,\n\t\t\tuniquenessRatio: this._total === 0 ? 0 : size / this._total,\n\t\t}\n\t}\n}\n","import { Collection } from './collection.js'\n\nclass ContextCollection {\n /** @param {boolean} useLocations */\n constructor(useLocations) {\n this._list = new Collection(useLocations)\n /** @type {Map<string, Collection>} */\n this._contexts = new Map()\n /** @type {boolean} */\n this._useLocations = useLocations\n }\n\n /**\n * Add an item to this _list's context\n * @param {string} item Item to push\n * @param {string} context Context to push Item to\n * @param {import('css-tree').CssLocation} node_location\n */\n push(item, context, node_location) {\n this._list.p(item, node_location)\n\n if (!this._contexts.has(context)) {\n this._contexts.set(context, new Collection(this._useLocations))\n }\n\n this._contexts.get(context).p(item, node_location)\n }\n\n count() {\n /**\n * @type {Map<string, {\n * total: number,\n * totalUnique: number,\n * unique: Record<string, number>,\n * uniquenessRatio: number\n * }>}\n */\n let itemsPerContext = new Map()\n\n for (let [context, value] of this._contexts.entries()) {\n itemsPerContext.set(context, value.c())\n }\n\n return Object.assign(this._list.c(), {\n itemsPerContext: Object.fromEntries(itemsPerContext)\n })\n }\n}\n\nexport {\n ContextCollection\n}","/**\n * Find the mode (most occurring value) in an array of Numbers\n * Takes the mean/average of multiple values if multiple values occur the same amount of times.\n *\n * @see https://github.com/angus-c/just/blob/684af9ca0c7808bc78543ec89379b1fdfce502b1/packages/array-mode/index.js\n * @param {Array} arr - Array to find the mode value for\n * @returns {Number} mode - The `mode` value of `arr`\n */\nfunction Mode(arr) {\n let frequencies = new Map()\n let maxOccurrences = -1\n let maxOccurenceCount = 0\n let sum = 0\n let len = arr.length\n\n for (let i = 0; i < len; i++) {\n let element = arr[i]\n let updatedCount = (frequencies.get(element) || 0) + 1\n frequencies.set(element, updatedCount)\n\n if (updatedCount > maxOccurrences) {\n maxOccurrences = updatedCount\n maxOccurenceCount = 0\n sum = 0\n }\n\n if (updatedCount >= maxOccurrences) {\n maxOccurenceCount++\n sum += element\n }\n }\n\n return sum / maxOccurenceCount\n}\n\n/**\n * Find the middle number in an Array of Numbers\n * Returns the average of 2 numbers if the Array length is an even number\n * @see https://github.com/angus-c/just/blob/684af9ca0c7808bc78543ec89379b1fdfce502b1/packages/array-median/index.js\n * @param {Array} arr - A sorted Array\n * @returns {Number} - The array's Median\n */\nfunction Median(arr) {\n let middle = arr.length / 2\n let lowerMiddleRank = Math.floor(middle)\n\n if (middle !== lowerMiddleRank) {\n return arr[lowerMiddleRank]\n }\n return (arr[lowerMiddleRank] + arr[lowerMiddleRank - 1]) / 2\n}\n\nclass AggregateCollection {\n constructor() {\n /** @type number[] */\n this._items = []\n this._sum = 0\n }\n\n /**\n * Add a new Integer at the end of this AggregateCollection\n * @param {number} item - The item to add\n */\n push(item) {\n this._items.push(item)\n this._sum += item\n }\n\n size() {\n return this._items.length\n }\n\n aggregate() {\n let len = this._items.length\n\n if (len === 0) {\n return {\n min: 0,\n max: 0,\n mean: 0,\n mode: 0,\n median: 0,\n range: 0,\n sum: 0,\n }\n }\n\n // TODO: can we avoid this sort()? It's slow\n /** @type Number[] */\n let sorted = this._items.slice().sort((a, b) => a - b)\n let min = sorted[0]\n let max = sorted[len - 1]\n\n let mode = Mode(sorted)\n let median = Median(sorted)\n let sum = this._sum\n\n return {\n min,\n max,\n mean: sum / len,\n mode,\n median,\n range: max - min,\n sum: sum,\n }\n }\n\n /**\n * @returns {number[]} All _items in this collection\n */\n toArray() {\n return this._items\n }\n}\n\nexport {\n AggregateCollection\n}","import { hasVendorPrefix } from '../vendor-prefix.js'\nimport { endsWith } from '../string-utils.js'\n\n/**\n * @param {string} property\n * @see https://github.com/csstree/csstree/blob/master/lib/utils/names.js#L69\n */\nexport function isHack(property) {\n if (isCustom(property) || hasVendorPrefix(property)) return false\n\n let code = property.charCodeAt(0)\n\n return code === 47 // /\n || code === 95 // _\n || code === 43 // +\n || code === 42 // *\n || code === 38 // &\n || code === 36 // $\n || code === 35 // #\n}\n\nexport function isCustom(property) {\n if (property.length < 3) return false\n // 45 === '-'.charCodeAt(0)\n return property.charCodeAt(0) === 45 && property.charCodeAt(1) === 45\n}\n\n/**\n * A check to verify that a propery is `basename` or a prefixed\n * version of that, but never a custom property that accidentally\n * ends with the same substring.\n *\n * @example\n * isProperty('animation', 'animation') // true\n * isProperty('animation', '-webkit-animation') // true\n * isProperty('animation', '--my-animation') // false\n *\n * @param {string} basename\n * @param {string} property\n * @returns {boolean} True if `property` equals `basename` without prefix\n */\nexport function isProperty(basename, property) {\n if (isCustom(property)) return false\n return endsWith(basename, property)\n}","import { endsWith } from \"../string-utils.js\"\nimport { Identifier } from \"../css-tree-node-types.js\"\n\n/**\n * @param {import('css-tree').Value} node\n */\nexport function isIe9Hack(node) {\n\tlet children = node.children\n\tif (children) {\n\t\tlet last = children.last\n\t\treturn last\n\t\t\t&& last.type === Identifier\n\t\t\t&& endsWith('\\\\9', last.name)\n\t}\n\treturn false\n}\n\n/**\n * @param {import('css-tree').Value} node\n * @param {boolean|string} important - // i.e. `property: value !ie`\n */\nexport function isBrowserhack(node, important) {\n\treturn isIe9Hack(node) || typeof important === 'string'\n}","import parse from 'css-tree/parser'\nimport walk from 'css-tree/walker'\nimport { calculate } from '@bramus/specificity/core'\nimport { isSupportsBrowserhack, isMediaBrowserhack } from './atrules/atrules.js'\nimport { getCombinators, getComplexity, isAccessibility, isPrefixed } from './selectors/utils.js'\nimport { colorFunctions, colorKeywords, namedColors, systemColors } from './values/colors.js'\nimport { destructure, isSystemFont } from './values/destructure-font-shorthand.js'\nimport { isValueKeyword } from './values/values.js'\nimport { analyzeAnimation } from './values/animations.js'\nimport { isValuePrefixed } from './values/vendor-prefix.js'\nimport { ContextCollection } from './context-collection.js'\nimport { Collection } from './collection.js'\nimport { AggregateCollection } from './aggregate-collection.js'\nimport { strEquals, startsWith, endsWith } from './string-utils.js'\nimport { hasVendorPrefix } from './vendor-prefix.js'\nimport { isCustom, isHack, isProperty } from './properties/property-utils.js'\nimport { getEmbedType } from './stylesheet/stylesheet.js'\nimport { isIe9Hack } from './values/browserhacks.js'\nimport {\n Atrule,\n Selector,\n Dimension,\n Url,\n Value,\n Declaration,\n Hash,\n Rule,\n Identifier,\n Func,\n Operator\n} from './css-tree-node-types.js'\n\n/** @typedef {[number, number, number]} Specificity */\n\nfunction ratio(part, total) {\n if (total === 0) return 0\n return part / total\n}\n\nlet defaults = {\n useUnstableLocations: false\n}\n\n/**\n * @typedef Options\n * @property {boolean} useUnstableLocations **WARNING: EXPERIMENTAL!** Use Locations (`{ 'item': [{ line, column, offset, length }] }`) instead of a regular count per occurrence (`{ 'item': 3 }`)\n */\n\n/**\n * Analyze CSS\n * @param {string} css\n * @param {Options} options\n */\nexport function analyze(css, options = {}) {\n let settings = Object.assign({}, defaults, options)\n let useLocations = settings.useUnstableLocations === true\n let start = Date.now()\n\n /**\n * Recreate the authored CSS from a CSSTree node\n * @param {import('css-tree').CssNode} node - Node from CSSTree AST to stringify\n * @returns {string} str - The stringified node\n */\n function stringifyNode(node) {\n return stringifyNodePlain(node).trim()\n }\n\n function stringifyNodePlain(node) {\n let loc = node.loc\n return css.substring(loc.start.offset, loc.end.offset)\n }\n\n // Stylesheet\n let totalComments = 0\n let commentsSize = 0\n let embeds = new Collection(useLocations)\n let embedSize = 0\n let embedTypes = {\n total: 0,\n /** @type {Map<string, { size: number, count: number } & ({ __unstable__uniqueWithLocations?: undefined } | ({ __unstable__uniqueWithLocations: { offset: number, line: number, column: number, length: number }[] })) }>} */\n unique: new Map()\n }\n\n let startParse = Date.now()\n\n let ast = parse(css, {\n parseCustomProperty: true, // To find font-families, colors, etc.\n positions: true, // So we can use stringifyNode()\n /** @param {string} comment */\n onComment: function (comment) {\n totalComments++\n commentsSize += comment.length\n },\n })\n\n let startAnalysis = Date.now()\n let linesOfCode = ast.loc.end.line - ast.loc.start.line + 1\n\n // Atrules\n let totalAtRules = 0\n let atRuleComplexities = new AggregateCollection()\n /** @type {Record<string, string>[]} */\n let fontfaces = []\n let fontfaces_with_loc = new Collection(useLocations)\n let layers = new Collection(useLocations)\n let imports = new Collection(useLocations)\n let medias = new Collection(useLocations)\n let mediaBrowserhacks = new Collection(useLocations)\n let charsets = new Collection(useLocations)\n let supports = new Collection(useLocations)\n let supportsBrowserhacks = new Collection(useLocations)\n let keyframes = new Collection(useLocations)\n let prefixedKeyframes = new Collection(useLocations)\n let containers = new Collection(useLocations)\n let registeredProperties = new Collection(useLocations)\n\n // Rules\n let totalRules = 0\n let emptyRules = 0\n let ruleSizes = new AggregateCollection()\n let selectorsPerRule = new AggregateCollection()\n let declarationsPerRule = new AggregateCollection()\n let uniqueRuleSize = new Collection(useLocations)\n let uniqueSelectorsPerRule = new Collection(useLocations)\n let uniqueDeclarationsPerRule = new Collection(useLocations)\n\n // Selectors\n let keyframeSelectors = new Collection(useLocations)\n let uniqueSelectors = new Set()\n let prefixedSelectors = new Collection(useLocations)\n /** @type {Specificity} */\n let maxSpecificity\n /** @type {Specificity} */\n let minSpecificity\n let specificityA = new AggregateCollection()\n let specificityB = new AggregateCollection()\n let specificityC = new AggregateCollection()\n let uniqueSpecificities = new Collection(useLocations)\n let selectorComplexities = new AggregateCollection()\n let uniqueSelectorComplexities = new Collection(useLocations)\n /** @type {Specificity[]} */\n let specificities = []\n let ids = new Collection(useLocations)\n let a11y = new Collection(useLocations)\n let combinators = new Collection(useLocations)\n\n // Declarations\n let uniqueDeclarations = new Set()\n let totalDeclarations = 0\n let declarationComplexities = new AggregateCollection()\n let importantDeclarations = 0\n let importantsInKeyframes = 0\n let importantCustomProperties = new Collection(useLocations)\n\n // Properties\n let properties = new Collection(useLocations)\n let propertyHacks = new Collection(useLocations)\n let propertyVendorPrefixes = new Collection(useLocations)\n let customProperties = new Collection(useLocations)\n let propertyComplexities = new AggregateCollection()\n\n // Values\n let valueComplexities = new AggregateCollection()\n let vendorPrefixedValues = new Collection(useLocations)\n let valueBrowserhacks = new Collection(useLocations)\n let zindex = new Collection(useLocations)\n let textShadows = new Collection(useLocations)\n let boxShadows = new Collection(useLocations)\n let fontFamilies = new Collection(useLocations)\n let fontSizes = new Collection(useLocations)\n let lineHeights = new Collection(useLocations)\n let timingFunctions = new Collection(useLocations)\n let durations = new Collection(useLocations)\n let colors = new ContextCollection(useLocations)\n let colorFormats = new Collection(useLocations)\n let units = new ContextCollection(useLocations)\n let gradients = new Collection(useLocations)\n\n walk(ast, function (node) {\n switch (node.type) {\n case Atrule: {\n totalAtRules++\n\n let atRuleName = node.name\n\n if (atRuleName === 'font-face') {\n let descriptors = {}\n\n if (useLocations) {\n fontfaces_with_loc.p(node.loc.start.offset, node.loc)\n }\n\n node.block.children.forEach(descriptor => {\n // Ignore 'Raw' nodes in case of CSS syntax errors\n if (descriptor.type === Declaration) {\n descriptors[descriptor.property] = stringifyNode(descriptor.value)\n }\n })\n\n fontfaces.push(descriptors)\n atRuleComplexities.push(1)\n break\n }\n\n let complexity = 1\n\n // All the AtRules in here MUST have a prelude, so we can count their names\n if (node.prelude !== null) {\n let prelude = node.prelude\n let preludeStr = prelude && stringifyNode(node.prelude)\n let loc = prelude.loc\n\n if (atRuleName === 'media') {\n medias.p(preludeStr, loc)\n if (isMediaBrowserhack(prelude)) {\n mediaBrowserhacks.p(preludeStr, loc)\n complexity++\n }\n } else if (atRuleName === 'supports') {\n supports.p(preludeStr, loc)\n // TODO: analyze vendor prefixes in @supports\n // TODO: analyze complexity of @supports 'declaration'\n if (isSupportsBrowserhack(prelude)) {\n supportsBrowserhacks.p(preludeStr, loc)\n complexity++\n }\n } else if (endsWith('keyframes', atRuleName)) {\n let name = '@' + atRuleName + ' ' + preludeStr\n if (hasVendorPrefix(atRuleName)) {\n prefixedKeyframes.p(name, loc)\n complexity++\n }\n keyframes.p(name, loc)\n } else if (atRuleName === 'import') {\n imports.p(preludeStr, loc)\n // TODO: analyze complexity of media queries, layers and supports in @import\n // see https://github.com/projectwallace/css-analyzer/issues/326\n } else if (atRuleName === 'charset') {\n charsets.p(preludeStr, loc)\n } else if (atRuleName === 'container') {\n containers.p(preludeStr, loc)\n // TODO: calculate complexity of container 'declaration'\n } else if (atRuleName === 'layer') {\n preludeStr\n .split(',')\n .forEach(name => layers.p(name.trim(), loc))\n } else if (atRuleName === 'property') {\n registeredProperties.p(preludeStr, loc)\n // TODO: add complexity for descriptors\n }\n } else {\n if (atRuleName === 'layer') {\n layers.p('<anonymous>', node.loc)\n complexity++\n }\n }\n atRuleComplexities.push(complexity)\n break\n }\n case Rule: {\n let prelude = node.prelude\n let block = node.block\n let preludeChildren = prelude.children\n let blockChildren = block.children\n let numSelectors = preludeChildren ? preludeChildren.size : 0\n let numDeclarations = blockChildren ? blockChildren.size : 0\n\n ruleSizes.push(numSelectors + numDeclarations)\n uniqueRuleSize.p(numSelectors + numDeclarations, node.loc)\n selectorsPerRule.push(numSelectors)\n uniqueSelectorsPerRule.p(numSelectors, prelude.loc)\n declarationsPerRule.push(numDeclarations)\n uniqueDeclarationsPerRule.p(numDeclarations, block.loc)\n\n totalRules++\n\n if (numDeclarations === 0) {\n emptyRules++\n }\n break\n }\n case Selector: {\n let selector = stringifyNode(node)\n\n if (this.atrule && endsWith('keyframes', this.atrule.name)) {\n keyframeSelectors.p(selector, node.loc)\n return this.skip\n }\n\n if (isAccessibility(node)) {\n a11y.p(selector, node.loc)\n }\n\n let complexity = getComplexity(node)\n\n if (isPrefixed(node)) {\n prefixedSelectors.p(selector, node.loc)\n }\n\n uniqueSelectors.add(selector)\n selectorComplexities.push(complexity)\n uniqueSelectorComplexities.p(complexity, node.loc)\n\n // #region specificity\n let [{ value: specificityObj }] = calculate(node)\n let sa = specificityObj.a\n let sb = specificityObj.b\n let sc = specificityObj.c\n\n /** @type {Specificity} */\n let specificity = [sa, sb, sc]\n\n uniqueSpecificities.p(sa + ',' + sb + ',' + sc, node.loc)\n\n specificityA.push(sa)\n specificityB.push(sb)\n specificityC.push(sc)\n\n if (maxSpecificity === undefined) {\n maxSpecificity = specificity\n }\n\n if (minSpecificity === undefined) {\n minSpecificity = specificity\n }\n\n if (minSpecificity !== undefined && compareSpecificity(minSpecificity, specificity) < 0) {\n minSpecificity = specificity\n }\n\n if (maxSpecificity !== undefined && compareSpecificity(maxSpecificity, specificity) > 0) {\n maxSpecificity = specificity\n }\n\n specificities.push(specificity)\n // #endregion\n\n if (sa > 0) {\n ids.p(selector, node.loc)\n }\n\n getCombinators(node, function onCombinator(combinator) {\n combinators.p(combinator.name, combinator.loc)\n })\n\n // Avoid deeper walking of selectors to not mess with\n // our specificity calculations in case of a selector\n // with :where() or :is() that contain SelectorLists\n // as children\n return this.skip\n }\n case Dimension: {\n if (!this.declaration) {\n break\n }\n\n /** @type {string} */\n let unit = node.unit\n\n if (endsWith('\\\\9', unit)) {\n units.push(unit.substring(0, unit.length - 2), this.declaration.property, node.loc)\n } else {\n units.push(unit, this.declaration.property, node.loc)\n }\n\n return this.skip\n }\n case Url: {\n if (startsWith('data:', node.value)) {\n let embed = node.value\n let size = embed.length\n let type = getEmbedType(embed)\n\n embedTypes.total++\n embedSize += size\n\n let loc = {\n /** @type {number} */\n line: node.loc.start.line,\n /** @type {number} */\n column: node.loc.start.column,\n /** @type {number} */\n offset: node.loc.start.offset,\n /** @type {number} */\n length: node.loc.end.offset - node.loc.start.offset,\n }\n\n if (embedTypes.unique.has(type)) {\n let item = embedTypes.unique.get(type)\n item.count++\n item.size += size\n embedTypes.unique.set(type, item)\n if (useLocations) {\n item.__unstable__uniqueWithLocations.push(loc)\n }\n } else {\n let item = {\n count: 1,\n size\n }\n if (useLocations) {\n item.__unstable__uniqueWithLocations = [loc]\n }\n embedTypes.unique.set(type, item)\n }\n\n // @deprecated\n embeds.p(embed, node.loc)\n }\n break\n }\n case Value: {\n if (isValueKeyword(node)) {\n valueComplexities.push(1)\n break\n }\n\n let declaration = this.declaration\n let { property, important } = declaration\n let complexity = 1\n\n if (isValuePrefixed(node)) {\n vendorPrefixedValues.p(stringifyNode(node), node.loc)\n complexity++\n }\n\n // i.e. `property: value !ie`\n if (typeof important === 'string') {\n valueBrowserhacks.p(stringifyNodePlain(node) + '!' + important, node.loc)\n complexity++\n }\n\n // i.e. `property: value\\9`\n if (isIe9Hack(node)) {\n valueBrowserhacks.p(stringifyNode(node), node.loc)\n complexity++\n }\n\n let children = node.children\n let loc = node.loc\n\n // TODO: should shorthands be counted towards complexity?\n valueComplexities.push(complexity)\n\n // Process properties first that don't have colors,\n // so we can avoid further walking them;\n if (isProperty('z-index', property)) {\n zindex.p(stringifyNode(node), loc)\n return this.skip\n } else if (isProperty('font', property)) {\n if (isSystemFont(node)) return\n\n let { font_size, line_height, font_family } = destructure(node, stringifyNode)\n\n if (font_family) {\n fontFamilies.p(font_family, loc)\n }\n if (font_size) {\n fontSizes.p(font_size, loc)\n }\n if (line_height) {\n lineHeights.p(line_height, loc)\n }\n\n break\n } else if (isProperty('font-size', property)) {\n if (!isSystemFont(node)) {\n fontSizes.p(stringifyNode(node), loc)\n }\n break\n } else if (isProperty('font-family', property)) {\n if (!isSystemFont(node)) {\n fontFamilies.p(stringifyNode(node), loc)\n }\n break\n } else if (isProperty('line-height', property)) {\n lineHeights.p(stringifyNode(node), loc)\n } else if (isProperty('transition', property) || isProperty('animation', property)) {\n let [times, fns] = analyzeAnimation(children, stringifyNode)\n for (let i = 0; i < times.length; i++) {\n durations.p(times[i], loc)\n }\n for (let i = 0; i < fns.length; i++) {\n timingFunctions.p(fns[i], loc)\n }\n break\n } else if (isProperty('animation-duration', property) || isProperty('transition-duration', property)) {\n if (children && children.size > 1) {\n children.forEach(child => {\n if (child.type !== Operator) {\n durations.p(stringifyNode(child), loc)\n }\n })\n } else {\n durations.p(stringifyNode(node), loc)\n }\n break\n } else if (isProperty('transition-timing-function', property) || isProperty('animation-timing-function', property)) {\n if (children && children.size > 1) {\n children.forEach(child => {\n if (child.type !== Operator) {\n timingFunctions.p(stringifyNode(child), loc)\n }\n })\n } else {\n timingFunctions.p(stringifyNode(node), loc)\n }\n break\n } else if (isProperty('text-shadow', property)) {\n if (!isValueKeyword(node)) {\n textShadows.p(stringifyNode(node), loc)\n }\n // no break here: potentially contains colors\n } else if (isProperty('box-shadow', property)) {\n if (!isValueKeyword(node)) {\n boxShadows.p(stringifyNode(node), loc)\n }\n // no break here: potentially contains colors\n }\n\n walk(node, function (valueNode) {\n let nodeName = valueNode.name\n\n switch (valueNode.type) {\n case Hash: {\n let hexLength = valueNode.value.length\n if (endsWith('\\\\9', valueNode.value)) {\n hexLength = hexLength - 2\n }\n colors.push('#' + valueNode.value, property, loc)\n colorFormats.p(`hex` + hexLength, loc)\n\n return this.skip\n }\n case Identifier: {\n // Bail out if it can't be a color name\n // 20 === 'lightgoldenrodyellow'.length\n // 3 === 'red'.length\n let nodeLen = nodeName.length\n if (nodeLen > 20 || nodeLen < 3) {\n return this.skip\n }\n\n if (namedColors.has(nodeName)) {\n let stringified = stringifyNode(valueNode)\n colors.push(stringified, property, loc)\n colorFormats.p('named', loc)\n return\n }\n\n if (colorKeywords.has(nodeName)) {\n let stringified = stringifyNode(valueNode)\n colors.push(stringified, property, loc)\n colorFormats.p(nodeName.toLowerCase(), loc)\n return\n }\n\n if (systemColors.has(nodeName)) {\n let stringified = stringifyNode(valueNode)\n colors.push(stringified, property, loc)\n colorFormats.p('system', loc)\n return\n }\n return this.skip\n }\n case Func: {\n // Don't walk var() multiple times\n if (strEquals('var', nodeName)) {\n return this.skip\n }\n\n if (colorFunctions.has(nodeName)) {\n colors.push(stringifyNode(valueNode), property, valueNode.loc)\n colorFormats.p(nodeName.toLowerCase(), valueNode.loc)\n return\n }\n\n if (endsWith('gradient', nodeName)) {\n gradients.p(stringifyNode(valueNode), valueNode.loc)\n return\n }\n // No this.skip here intentionally,\n // otherwise we'll miss colors in linear-gradient() etc.\n }\n }\n })\n break\n }\n case Declaration: {\n // Do not process Declarations in atRule preludes\n // because we will handle them manually\n if (this.atrulePrelude !== null) {\n return this.skip\n }\n\n totalDeclarations++\n let complexity = 1\n\n uniqueDeclarations.add(stringifyNode(node))\n\n if (node.important === true) {\n importantDeclarations++\n complexity++\n\n if (this.atrule && endsWith('keyframes', this.atrule.name)) {\n importantsInKeyframes++\n complexity++\n }\n }\n\n declarationComplexities.push(complexity)\n\n let { property, loc: { start } } = node\n let propertyLoc = {\n start: {\n line: start.line,\n column: start.column,\n offset: start.offset\n },\n end: {\n offset: start.offset + property.length\n }\n }\n\n properties.p(property, propertyLoc)\n\n if (hasVendorPrefix(property)) {\n propertyVendorPrefixes.p(property, propertyLoc)\n propertyComplexities.push(2)\n } else if (isHack(property)) {\n propertyHacks.p(property, propertyLoc)\n propertyComplexities.push(2)\n } else if (isCustom(property)) {\n customProperties.p(property, propertyLoc)\n propertyComplexities.push(node.important ? 3 : 2)\n\n if (node.important === true) {\n importantCustomProperties.p(property, propertyLoc)\n }\n } else {\n propertyComplexities.push(1)\n }\n\n break\n }\n }\n })\n\n let embeddedContent = embeds.c()\n delete embeddedContent.__unstable__uniqueWithLocations\n\n let totalUniqueDeclarations = uniqueDeclarations.size\n\n let totalSelectors = selectorComplexities.size()\n let specificitiesA = specificityA.aggregate()\n let specificitiesB = specificityB.aggregate()\n let specificitiesC = specificityC.aggregate()\n let totalUniqueSelectors = uniqueSelectors.size\n let assign = Object.assign\n let cssLen = css.length\n let fontFacesCount = fontfaces.length\n let atRuleComplexity = atRuleComplexities.aggregate()\n let selectorComplexity = selectorComplexities.aggregate()\n let declarationComplexity = declarationComplexities.aggregate()\n let propertyComplexity = propertyComplexities.aggregate()\n let valueComplexity = valueComplexities.aggregate()\n\n return {\n stylesheet: {\n sourceLinesOfCode: totalAtRules + totalSelectors + totalDeclarations + keyframeSelectors.size(),\n linesOfCode,\n size: cssLen,\n complexity: atRuleComplexity.sum + selectorComplexity.sum + declarationComplexity.sum + propertyComplexity.sum + valueComplexity.sum,\n comments: {\n total: totalComments,\n size: commentsSize,\n },\n embeddedContent: assign(embeddedContent, {\n size: {\n total: embedSize,\n ratio: ratio(embedSize, cssLen),\n },\n types: {\n total: embedTypes.total,\n totalUnique: embedTypes.unique.size,\n uniquenessRatio: ratio(embedTypes.unique.size, embedTypes.total),\n unique: Object.fromEntries(embedTypes.unique),\n },\n }),\n },\n atrules: {\n fontface: assign({\n total: fontFacesCount,\n totalUnique: fontFacesCount,\n unique: fontfaces,\n uniquenessRatio: fontFacesCount === 0 ? 0 : 1,\n }, useLocations ? {\n __unstable__uniqueWithLocations: fontfaces_with_loc.c().__unstable__uniqueWithLocations,\n } : {}),\n import: imports.c(),\n media: assign(\n medias.c(),\n {\n browserhacks: mediaBrowserhacks.c(),\n }\n ),\n charset: charsets.c(),\n supports: assign(\n supports.c(),\n {\n browserhacks: supportsBrowserhacks.c(),\n },\n ),\n keyframes: assign(\n keyframes.c(), {\n prefixed: assign(\n prefixedKeyframes.c(), {\n ratio: ratio(prefixedKeyframes.size(), keyframes.size())\n }),\n }),\n container: containers.c(),\n layer: layers.c(),\n property: registeredProperties.c(),\n total: totalAtRules,\n complexity: atRuleComplexity\n },\n rules: {\n total: totalRules,\n empty: {\n total: emptyRules,\n ratio: ratio(emptyRules, totalRules)\n },\n sizes: assign(\n ruleSizes.aggregate(),\n {\n items: ruleSizes.toArray(),\n },\n uniqueRuleSize.c(),\n ),\n selectors: assign(\n selectorsPerRule.aggregate(),\n {\n items: selectorsPerRule.toArray(),\n },\n uniqueSelectorsPerRule.c(),\n ),\n declarations: assign(\n declarationsPerRule.aggregate(),\n {\n items: declarationsPerRule.toArray(),\n },\n uniqueDeclarationsPerRule.c(),\n ),\n },\n selectors: {\n total: totalSelectors,\n totalUnique: totalUniqueSelectors,\n uniquenessRatio: ratio(totalUniqueSelectors, totalSelectors),\n specificity: assign(\n {\n /** @type Specificity */\n min: minSpecificity === undefined ? [0, 0, 0] : minSpecificity,\n /** @type Specificity */\n max: maxSpecificity === undefined ? [0, 0, 0] : maxSpecificity,\n /** @type Specificity */\n sum: [specificitiesA.sum, specificitiesB.sum, specificitiesC.sum],\n /** @type Specificity */\n mean: [specificitiesA.mean, specificitiesB.mean, specificitiesC.mean],\n /** @type Specificity */\n mode: [specificitiesA.mode, specificitiesB.mode, specificitiesC.mode],\n /** @type Specificity */\n median: [specificitiesA.median, specificitiesB.median, specificitiesC.median],\n items: specificities,\n },\n uniqueSpecificities.c(),\n ),\n complexity: assign(\n selectorComplexity,\n uniqueSelectorComplexities.c(),\n {\n items: selectorComplexities.toArray(),\n }\n ),\n id: assign(\n ids.c(), {\n ratio: ratio(ids.size(), totalSelectors),\n }),\n accessibility: assign(\n a11y.c(), {\n ratio: ratio(a11y.size(), totalSelectors),\n }),\n keyframes: keyframeSelectors.c(),\n prefixed: assign(\n prefixedSelectors.c(),\n {\n ratio: ratio(prefixedSelectors.size(), totalSelectors),\n },\n ),\n combinators: combinators.c(),\n },\n declarations: {\n total: totalDeclarations,\n totalUnique: totalUniqueDeclarations,\n uniquenessRatio: ratio(totalUniqueDeclarations, totalDeclarations),\n // @TODO: deprecated, remove in next major version\n unique: {\n total: totalUniqueDeclarations,\n ratio: ratio(totalUniqueDeclarations, totalDeclarations),\n },\n importants: {\n total: importantDeclarations,\n ratio: ratio(importantDeclarations, totalDeclarations),\n inKeyframes: {\n total: importantsInKeyframes,\n ratio: ratio(importantsInKeyframes, importantDeclarations),\n },\n },\n complexity: declarationComplexity,\n },\n properties: assign(\n properties.c(),\n {\n prefixed: assign(\n propertyVendorPrefixes.c(),\n {\n ratio: ratio(propertyVendorPrefixes.size(), properties.size()),\n },\n ),\n custom: assign(\n customProperties.c(),\n {\n ratio: ratio(customProperties.size(), properties.size()),\n importants: assign(\n importantCustomProperties.c(),\n {\n ratio: ratio(importantCustomProperties.size(), customProperties.size()),\n }\n ),\n },\n ),\n browserhacks: assign(\n propertyHacks.c(), {\n ratio: ratio(propertyHacks.size(), properties.size()),\n }),\n complexity: propertyComplexity,\n }),\n values: {\n colors: assign(\n colors.count(),\n {\n formats: colorFormats.c(),\n },\n ),\n gradients: gradients.c(),\n fontFamilies: fontFamilies.c(),\n fontSizes: fontSizes.c(),\n lineHeights: lineHeights.c(),\n zindexes: zindex.c(),\n textShadows: textShadows.c(),\n boxShadows: boxShadows.c(),\n animations: {\n durations: durations.c(),\n timingFunctions: timingFunctions.c(),\n },\n prefixes: vendorPrefixedValues.c(),\n browserhacks: valueBrowserhacks.c(),\n units: units.count(),\n complexity: valueComplexity,\n },\n __meta__: {\n parseTime: startAnalysis - startParse,\n analyzeTime: Date.now() - startAnalysis,\n total: Date.now() - start\n }\n }\n}\n\n/**\n * Compare specificity A to Specificity B\n * @param {Specificity} a - Specificity A\n * @param {Specificity} b - Specificity B\n * @returns {number} sortIndex - 0 when a==b, 1 when a<b, -1 when a>b\n */\nexport function compareSpecificity(a, b) {\n if (a[0] === b[0]) {\n if (a[1] === b[1]) {\n return b[2] - a[2]\n }\n\n return b[1] - a[1]\n }\n\n return b[0] - a[0]\n}\n\nexport {\n getComplexity as selectorComplexity,\n isPrefixed as isSelectorPrefixed,\n isAccessibility as isAccessibilitySelector,\n} from './selectors/utils.js'\n\nexport {\n isSupportsBrowserhack,\n isMediaBrowserhack\n} from './atrules/atrules.js'\n\nexport {\n isBrowserhack as isValueBrowserhack\n} from './values/browserhacks.js'\n\nexport {\n isHack as isPropertyHack,\n} from './properties/property-utils.js'\n\nexport {\n isValuePrefixed\n} from './values/vendor-prefix.js'\n\nexport { hasVendorPrefix } from './vendor-prefix.js'\n","/**\n * @param {string} str\n * @param {number} start\n * @param {number} end\n */\nfunction substring(str, start, end) {\n\treturn str.substring(start, end)\n}\n\n/** @param {string} embed */\nexport function getEmbedType(embed) {\n\t// data:image/gif;base64,R0lG\n\tlet start = 5 // `data:`.length\n\tlet semicolon = embed.indexOf(';')\n\tlet comma = embed.indexOf(',')\n\n\tif (semicolon === -1) {\n\t\treturn substring(embed, start, comma)\n\t}\n\n\tif (comma !== -1 && comma < semicolon) {\n\t\treturn substring(embed, start, comma);\n\t}\n\n\treturn substring(embed, start, semicolon)\n}"],"names":["charCodeAt","str","at","compareChar","referenceCode","testCode","strEquals","base","maybe","len","length","i","endsWith","offset","startsWith","Func","isPropertyValue","node","property","value","firstChild","children","first","type","name","isSupportsBrowserhack","prelude","returnValue","walk","break","isMediaBrowserhack","size","n","unit","val","hasVendorPrefix","keyword","indexOf","analyzeList","selectorListAst","cb","childSelectors","visit","enter","push","isPseudoFunction","isAccessibility","selector","isA11y","some","b","skip","isPrefixed","getComplexity","complexity","list","forEach","c","KeywordSet","constructor","items","this","set","has","item","index","namedColors","systemColors","colorFunctions","colorKeywords","SYSTEM_FONTS","SIZE_KEYWORDS","isSystemFont","keywords","isValueKeyword","TIMING_KEYWORDS","TIMING_FUNCTION_VALUES","isValuePrefixed","toArray","Collection","useLocations","_items","Map","_total","_node_lines","_node_columns","_node_lengths","_node_offsets","_useLocations","p","node_location","start","start_offset","line","column","end","get","uniqueWithLocations","unique","key","nodes","map","total","totalUnique","uniquenessRatio","__unstable__uniqueWithLocations","Object","fromEntries","ContextCollection","_list","_contexts","context","count","itemsPerContext","entries","assign","AggregateCollection","_sum","aggregate","min","max","mean","mode","median","range","sum","sorted","slice","sort","a","arr","frequencies","maxOccurrences","maxOccurenceCount","element","updatedCount","Mode","middle","lowerMiddleRank","Math","floor","Median","isHack","isCustom","code","isProperty","basename","isIe9Hack","last","isBrowserhack","important","ratio","part","defaults","useUnstableLocations","analyze","css","options","Date","now","stringifyNode","stringifyNodePlain","trim","loc","substring","maxSpecificity","minSpecificity","totalComments","commentsSize","embeds","embedSize","embedTypes","startParse","ast","parse","parseCustomProperty","positions","onComment","comment","startAnalysis","linesOfCode","totalAtRules","atRuleComplexities","fontfaces","fontfaces_with_loc","layers","imports","medias","mediaBrowserhacks","charsets","supports","supportsBrowserhacks","keyframes","prefixedKeyframes","containers","registeredProperties","totalRules","emptyRules","ruleSizes","selectorsPerRule","declarationsPerRule","uniqueRuleSize","uniqueSelectorsPerRule","uniqueDeclarationsPerRule","keyframeSelectors","uniqueSelectors","Set","prefixedSelectors","specificityA","specificityB","specificityC","uniqueSpecificities","selectorComplexities","uniqueSelectorComplexities","specificities","ids","a11y","combinators","uniqueDeclarations","totalDeclarations","declarationComplexities","importantDeclarations","importantsInKeyframes","importantCustomProperties","properties","propertyHacks","propertyVendorPrefixes","customProperties","propertyComplexities","valueComplexities","vendorPrefixedValues","valueBrowserhacks","zindex","textShadows","boxShadows","fontFamilies","fontSizes","lineHeights","timingFunctions","durations","colors","colorFormats","units","gradients","atRuleName","descriptors","block","descriptor","preludeStr","split","preludeChildren","blockChildren","numSelectors","numDeclarations","atrule","add","specificityObj","calculate","sa","sb","sc","specificity","undefined","compareSpecificity","onMatch","selectorNode","previousLoc","prev","data","getCombinators","combinator","declaration","embed","semicolon","comma","getEmbedType","font_size","line_height","font_family","Array","from","next","destructure","times","fns","durationFound","child","analyzeAnimation","valueNode","nodeName","hexLength","nodeLen","stringified","toLowerCase","atrulePrelude","propertyLoc","embeddedContent","totalUniqueDeclarations","totalSelectors","specificitiesA","specificitiesB","specificitiesC","totalUniqueSelectors","cssLen","fontFacesCount","atRuleComplexity","selectorComplexity","declarationComplexity","propertyComplexity","valueComplexity","stylesheet","sourceLinesOfCode","comments","types","atrules","fontface","import","media","browserhacks","charset","prefixed","container","layer","rules","empty","sizes","selectors","declarations","id","accessibility","importants","inKeyframes","custom","values","formats","zindexes","animations","prefixes","__meta__","parseTime","analyzeTime"],"mappings":"mHAIA,SAASA,EAAWC,EAAKC,GACvB,OAAOD,EAAID,WAAWE,EACxB,CAQA,SAASC,EAAYC,EAAeC,GAMlC,OAJIA,GAAY,IAAUA,GAAY,KAEpCA,GAAsB,IAEjBD,IAAkBC,CAC3B,UAcgBC,EAAUC,EAAMC,GAC9B,IAAIC,EAAMF,EAAKG,OACf,GAAID,IAAQD,EAAME,OAAQ,SAE1B,IAAK,IAAIC,EAAI,EAAGA,EAAIF,EAAKE,IACvB,IAA+D,IAA3DR,EAAYH,EAAWO,EAAMI,GAAIX,EAAWQ,EAAOG,IACrD,SAIJ,QACF,UAagBC,EAASL,EAAMC,GAC7B,IAAIC,EAAMD,EAAME,OACZG,EAASJ,EAAMF,EAAKG,OAExB,GAAIG,EAAS,EACX,SAGF,IAAK,IAAIF,EAAIF,EAAM,EAAGE,GAAKE,EAAQF,IACjC,IAAwE,IAApER,EAAYH,EAAWO,EAAMI,EAAIE,GAASb,EAAWQ,EAAOG,IAC9D,SAIJ,QACF,UAQgBG,EAAWP,EAAMC,GAC/B,IAAIC,EAAMF,EAAKG,OACf,GAAIF,EAAME,OAASD,EAAK,SAExB,IAAK,IAAIE,EAAI,EAAGA,EAAIF,EAAKE,IACvB,IAA+D,IAA3DR,EAAYH,EAAWO,EAAMI,GAAIX,EAAWQ,EAAOG,IACrD,SAIJ,QACF,OChEaI,EAAO,WCZpB,SAASC,EAAgBC,EAAMC,EAAUC,GACvC,IAAIC,EAAaH,EAAKE,MAAME,SAASC,MACrC,OAAOhB,EAAUY,EAAUD,EAAKC,WDER,eCDnBE,EAAWG,MACXjB,EAAUa,EAAOC,EAAWI,KACnC,UAOgBC,EAAsBC,GACpC,IAAIC,GAAc,EAclB,OAZAC,EAAKF,EAAS,SAAUT,GACtB,GDhBuB,gBCgBnBA,EAAKM,OAELP,EAAgBC,EAAM,qBAAsB,SACzCD,E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EAAKE,OACPmC,IAEEnB,EAAgBlB,EAAKO,KAAKA,OAC5B8B,SAEUH,KAGd,GH3H+B,wBG2H3BlC,EAAKM,MACHsB,EAAiB5B,EAAKO,MAAO,CAC/B,IAAI+B,EAAOjB,EAAYrB,EAAMoC,GAG7B,GAAoB,IAAhBE,EAAK7C,OAAc,OAKvB,OAHA6C,EAAKC,QAASC,IACZH,GAAcG,SAEJN,IACd,EAEJ,GAEOG,CACT,OChJaI,EAGZC,YAAYC,GAEXC,KAAKC,IAAMF,CACZ,CAGAG,IAAIC,GACH,IAAIvD,EAAMoD,KAAKC,IAAIpD,OAEnB,IAAK,IAAIuD,EAAQ,EAAGA,EAAQxD,EAAKwD,IAChC,GAAI3D,EAAUuD,KAAKC,IAAIG,GAAQD,GAC9B,SAGF,QACD,QCrBYE,EAAc,IAAIR,EAAW,CAKxC,QACA,QACA,MACA,OACA,OACA,OACA,QACA,gBACA,SACA,SAEA,YACA,eACA,OACA,aACA,QACA,QACA,SACA,iBACA,aACA,QACA,YACA,YACA,aACA,YACA,QACA,iBACA,WACA,UACA,OACA,WACA,WACA,gBACA,WACA,YACA,WACA,YACA,cACA,iBACA,aACA,aACA,UACA,aACA,eACA,gBACA,gBACA,gBACA,gBACA,aACA,WACA,cACA,UACA,UACA,aACA,YACA,cACA,cACA,UACA,YACA,aACA,OACA,YACA,cACA,WACA,UACA,YACA,SACA,QACA,QACA,WACA,gBACA,YACA,eACA,YACA,aACA,YACA,uBACA,YACA,aACA,YACA,YACA,cACA,gBACA,eACA,iBACA,iBACA,iBACA,cACA,OACA,YACA,QACA,UACA,SACA,mBACA,aACA,eACA,eACA,iBACA,kBACA,oBACA,kBACA,kBACA,eACA,YACA,YACA,WACA,cACA,OACA,UACA,QACA,YACA,YACA,SACA,gBACA,YACA,gBACA,gBACA,aACA,YACA,OACA,OACA,OACA,aACA,SACA,YACA,YACA,cACA,SACA,aACA,WACA,WACA,SACA,SACA,UACA,YACA,YACA,YACA,OACA,cACA,YACA,MAC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