From 3c23084c8f1a71aac9f91492fcc53c20e1e2498d Mon Sep 17 00:00:00 2001 From: paige Date: Mon, 26 Oct 2026 13:23:13 -0600 Subject: [PATCH] first commit --- BA-Daily-Checklist.html | 598 + ServiceMeow-HQ.html | 2601 + UAT-Outreach-Tracker.html | 735 + Web Team ServiceMeow - Roadmap.html | 1261 + build_hub.mjs | 225 + node_modules/.bin/specificity | 1 + node_modules/.bin/tldts | 1 + node_modules/.package-lock.json | 486 + node_modules/@asamuzakjp/css-color/LICENSE | 21 + node_modules/@asamuzakjp/css-color/README.md | 149 + .../dist/esm/converters/convert-color.d.ts | 67 + .../dist/esm/converters/convert-hex.d.ts | 47 + .../dist/esm/converters/convert.d.ts | 101 + .../dist/esm/gradients/gradient-util.d.ts | 56 + .../dist/esm/gradients/gradient.d.ts | 18 + .../dist/esm/gradients/parse-gradient.d.ts | 11 + .../@asamuzakjp/css-color/dist/esm/index.d.ts | 22 + .../@asamuzakjp/css-color/dist/esm/index.js | 3731 ++ .../css-color/dist/esm/matrix/matrix.d.ts | 21 + .../css-color/dist/esm/matrix/transform.d.ts | 122 + .../dist/esm/resolvers/color-mix.d.ts | 166 + .../dist/esm/resolvers/named-color.d.ts | 153 + .../dist/esm/resolvers/parse-color.d.ts | 74 + .../dist/esm/resolvers/relative-color.d.ts | 67 + .../dist/esm/resolvers/resolve-color.d.ts | 33 + .../css-color/dist/esm/resolvers/resolve.d.ts | 18 + .../css-color/dist/esm/typedef.d.ts | 321 + .../css-color/dist/esm/utils/cache.d.ts | 33 + .../css-color/dist/esm/utils/common.d.ts | 21 + .../css-color/dist/esm/utils/constant.d.ts | 69 + .../dist/esm/utils/css-calc-var.d.ts | 131 + .../dist/esm/utils/length-percentage.d.ts | 46 + .../css-color/dist/esm/utils/util.d.ts | 87 + .../@asamuzakjp/css-color/package.json | 75 + .../css-color/src/converters/convert-color.ts | 518 + .../css-color/src/converters/convert-hex.ts | 187 + .../css-color/src/converters/convert.ts | 338 + .../css-color/src/gradients/gradient-util.ts | 325 + .../css-color/src/gradients/gradient.ts | 47 + .../css-color/src/gradients/parse-gradient.ts | 98 + .../@asamuzakjp/css-color/src/index.ts | 34 + .../css-color/src/matrix/matrix.ts | 87 + .../css-color/src/matrix/transform.ts | 557 + .../css-color/src/resolvers/color-mix.ts | 896 + .../css-color/src/resolvers/named-color.ts | 159 + .../css-color/src/resolvers/parse-color.ts | 910 + .../css-color/src/resolvers/relative-color.ts | 673 + .../css-color/src/resolvers/resolve-color.ts | 584 + .../css-color/src/resolvers/resolve.ts | 33 + .../@asamuzakjp/css-color/src/typedef.ts | 393 + .../@asamuzakjp/css-color/src/utils/cache.ts | 121 + .../@asamuzakjp/css-color/src/utils/common.ts | 31 + .../css-color/src/utils/constant.ts | 99 + .../css-color/src/utils/css-calc-var.ts | 1289 + .../css-color/src/utils/length-percentage.ts | 206 + .../@asamuzakjp/css-color/src/utils/util.ts | 581 + node_modules/@asamuzakjp/dom-selector/LICENSE | 21 + .../@asamuzakjp/dom-selector/README.md | 268 + .../@asamuzakjp/dom-selector/package.json | 80 + .../@asamuzakjp/dom-selector/src/index.js | 590 + .../dom-selector/src/js/constant.js | 307 + .../dom-selector/src/js/evaluator.js | 429 + .../@asamuzakjp/dom-selector/src/js/event.js | 146 + .../@asamuzakjp/dom-selector/src/js/finder.js | 1061 + .../@asamuzakjp/dom-selector/src/js/mapper.js | 122 + .../dom-selector/src/js/matcher.js | 807 + .../@asamuzakjp/dom-selector/src/js/nwsapi.js | 1354 + .../@asamuzakjp/dom-selector/src/js/parser.js | 511 + .../dom-selector/src/js/processor.js | 100 + .../dom-selector/src/js/pseudo-class.js | 1625 + .../dom-selector/src/js/selector.js | 330 + .../@asamuzakjp/dom-selector/src/js/shadow.js | 179 + .../dom-selector/src/js/traverser.js | 256 + .../dom-selector/src/js/utility.js | 1132 + .../@asamuzakjp/dom-selector/types/index.d.ts | 54 + .../dom-selector/types/js/constant.d.ts | 94 + .../dom-selector/types/js/evaluator.d.ts | 30 + .../dom-selector/types/js/event.d.ts | 13 + .../dom-selector/types/js/finder.d.ts | 43 + .../dom-selector/types/js/mapper.d.ts | 12 + .../dom-selector/types/js/matcher.d.ts | 12 + .../dom-selector/types/js/nwsapi.d.ts | 64 + .../dom-selector/types/js/parser.d.ts | 20 + .../dom-selector/types/js/processor.d.ts | 19 + .../dom-selector/types/js/pseudo-class.d.ts | 31 + .../dom-selector/types/js/selector.d.ts | 12 + .../dom-selector/types/js/shadow.d.ts | 10 + .../dom-selector/types/js/traverser.d.ts | 12 + .../dom-selector/types/js/utility.d.ts | 33 + node_modules/@bramus/specificity/LICENSE | 19 + node_modules/@bramus/specificity/README.md | 164 + node_modules/@bramus/specificity/bin/cli.js | 14 + .../@bramus/specificity/dist/index.cjs | 8 + .../@bramus/specificity/dist/index.cjs.map | 7 + .../@bramus/specificity/dist/index.js | 8 + .../@bramus/specificity/dist/index.js.map | 7 + node_modules/@bramus/specificity/index.d.ts | 59 + node_modules/@bramus/specificity/package.json | 92 + .../@bramus/specificity/src/core/calculate.js | 272 + .../@bramus/specificity/src/core/index.js | 1 + node_modules/@bramus/specificity/src/index.js | 135 + .../@bramus/specificity/src/util/compare.js | 23 + .../@bramus/specificity/src/util/filter.js | 13 + .../@bramus/specificity/src/util/index.js | 3 + .../@bramus/specificity/src/util/sort.js | 21 + .../@csstools/color-helpers/CHANGELOG.md | 9 + .../@csstools/color-helpers/LICENSE.md | 18 + .../@csstools/color-helpers/README.md | 32 + .../@csstools/color-helpers/dist/index.d.ts | 711 + .../@csstools/color-helpers/dist/index.mjs | 261 + .../@csstools/color-helpers/package.json | 55 + node_modules/@csstools/css-calc/CHANGELOG.md | 9 + node_modules/@csstools/css-calc/LICENSE.md | 20 + node_modules/@csstools/css-calc/README.md | 137 + .../@csstools/css-calc/dist/index.d.ts | 113 + .../@csstools/css-calc/dist/index.mjs | 1 + node_modules/@csstools/css-calc/package.json | 61 + .../@csstools/css-color-parser/CHANGELOG.md | 9 + .../@csstools/css-color-parser/LICENSE.md | 20 + .../@csstools/css-color-parser/README.md | 37 + .../css-color-parser/dist/index.d.ts | 170 + .../@csstools/css-color-parser/dist/index.mjs | 1 + .../@csstools/css-color-parser/package.json | 64 + .../css-parser-algorithms/CHANGELOG.md | 9 + .../css-parser-algorithms/LICENSE.md | 20 + .../@csstools/css-parser-algorithms/README.md | 119 + .../css-parser-algorithms/dist/index.d.ts | 604 + .../css-parser-algorithms/dist/index.mjs | 1 + .../css-parser-algorithms/package.json | 58 + .../CHANGELOG.md | 9 + .../css-syntax-patches-for-csstree/LICENSE.md | 18 + .../css-syntax-patches-for-csstree/README.md | 43 + .../dist/index.d.ts | 5 + .../dist/index.json | 863 + .../package.json | 57 + .../@csstools/css-tokenizer/CHANGELOG.md | 9 + .../@csstools/css-tokenizer/LICENSE.md | 20 + .../@csstools/css-tokenizer/README.md | 111 + .../@csstools/css-tokenizer/dist/index.d.ts | 593 + .../@csstools/css-tokenizer/dist/index.mjs | 1 + .../@csstools/css-tokenizer/package.json | 55 + node_modules/@exodus/bytes/LICENSE | 21 + node_modules/@exodus/bytes/README.md | 833 + node_modules/@exodus/bytes/array.d.ts | 89 + node_modules/@exodus/bytes/array.js | 35 + node_modules/@exodus/bytes/assert.js | 26 + node_modules/@exodus/bytes/base32.d.ts | 112 + node_modules/@exodus/bytes/base32.js | 37 + node_modules/@exodus/bytes/base58.d.ts | 64 + node_modules/@exodus/bytes/base58.js | 219 + node_modules/@exodus/bytes/base58check.d.ts | 135 + node_modules/@exodus/bytes/base58check.js | 18 + .../@exodus/bytes/base58check.node.js | 14 + node_modules/@exodus/bytes/base64.d.ts | 102 + node_modules/@exodus/bytes/base64.js | 185 + node_modules/@exodus/bytes/bech32.d.ts | 76 + node_modules/@exodus/bytes/bech32.js | 257 + node_modules/@exodus/bytes/bigint.d.ts | 49 + node_modules/@exodus/bytes/bigint.js | 14 + node_modules/@exodus/bytes/crc.d.ts | 20 + node_modules/@exodus/bytes/crc.js | 52 + node_modules/@exodus/bytes/crc.node.js | 38 + .../@exodus/bytes/encoding-browser.browser.js | 55 + .../@exodus/bytes/encoding-browser.d.ts | 35 + .../@exodus/bytes/encoding-browser.js | 1 + .../@exodus/bytes/encoding-browser.native.js | 10 + node_modules/@exodus/bytes/encoding-lite.d.ts | 63 + node_modules/@exodus/bytes/encoding-lite.js | 12 + node_modules/@exodus/bytes/encoding.d.ts | 169 + node_modules/@exodus/bytes/encoding.js | 18 + node_modules/@exodus/bytes/fallback/_utils.js | 60 + node_modules/@exodus/bytes/fallback/base32.js | 242 + .../@exodus/bytes/fallback/base58check.js | 52 + node_modules/@exodus/bytes/fallback/base64.js | 191 + node_modules/@exodus/bytes/fallback/crc.js | 18 + .../@exodus/bytes/fallback/encoding.api.js | 38 + .../@exodus/bytes/fallback/encoding.js | 369 + .../@exodus/bytes/fallback/encoding.labels.js | 50 + .../@exodus/bytes/fallback/encoding.util.js | 65 + node_modules/@exodus/bytes/fallback/hex.js | 126 + node_modules/@exodus/bytes/fallback/latin1.js | 152 + .../bytes/fallback/multi-byte.encodings.cjs | 1 + .../bytes/fallback/multi-byte.encodings.json | 546 + .../@exodus/bytes/fallback/multi-byte.js | 962 + .../bytes/fallback/multi-byte.table.js | 118 + .../@exodus/bytes/fallback/percent.js | 31 + .../bytes/fallback/platform.browser.js | 31 + .../@exodus/bytes/fallback/platform.js | 2 + .../@exodus/bytes/fallback/platform.native.js | 122 + .../bytes/fallback/single-byte.encodings.js | 73 + .../@exodus/bytes/fallback/single-byte.js | 110 + node_modules/@exodus/bytes/fallback/utf16.js | 266 + .../bytes/fallback/utf8.auto.browser.js | 2 + .../@exodus/bytes/fallback/utf8.auto.js | 1 + .../bytes/fallback/utf8.auto.native.js | 1 + node_modules/@exodus/bytes/fallback/utf8.js | 270 + node_modules/@exodus/bytes/hex.d.ts | 36 + node_modules/@exodus/bytes/hex.js | 16 + node_modules/@exodus/bytes/hex.node.js | 42 + node_modules/@exodus/bytes/index.d.ts | 43 + node_modules/@exodus/bytes/index.js | 5 + node_modules/@exodus/bytes/multi-byte.d.ts | 64 + node_modules/@exodus/bytes/multi-byte.js | 19 + node_modules/@exodus/bytes/multi-byte.node.js | 29 + node_modules/@exodus/bytes/package.json | 309 + node_modules/@exodus/bytes/single-byte.d.ts | 166 + node_modules/@exodus/bytes/single-byte.js | 135 + .../@exodus/bytes/single-byte.node.js | 127 + node_modules/@exodus/bytes/utf16.browser.js | 8 + node_modules/@exodus/bytes/utf16.d.ts | 92 + node_modules/@exodus/bytes/utf16.js | 1 + node_modules/@exodus/bytes/utf16.native.js | 22 + node_modules/@exodus/bytes/utf16.node.js | 71 + node_modules/@exodus/bytes/utf8.d.ts | 98 + node_modules/@exodus/bytes/utf8.js | 65 + node_modules/@exodus/bytes/utf8.node.js | 67 + node_modules/@exodus/bytes/whatwg.d.ts | 48 + node_modules/@exodus/bytes/whatwg.js | 80 + node_modules/@exodus/bytes/wif.d.ts | 76 + node_modules/@exodus/bytes/wif.js | 41 + node_modules/bidi-js/LICENSE.txt | 22 + node_modules/bidi-js/README.md | 133 + node_modules/bidi-js/dist/bidi.js | 1052 + node_modules/bidi-js/dist/bidi.min.js | 1 + node_modules/bidi-js/dist/bidi.min.mjs | 1 + node_modules/bidi-js/dist/bidi.mjs | 1044 + node_modules/bidi-js/package.json | 40 + node_modules/bidi-js/src/bidi.d.ts | 190 + node_modules/bidi-js/src/brackets.js | 45 + node_modules/bidi-js/src/charTypes.js | 92 + .../bidi-js/src/data/bidiBrackets.data.js | 5 + .../bidi-js/src/data/bidiCharTypes.data.js | 25 + .../bidi-js/src/data/bidiMirroring.data.js | 2 + node_modules/bidi-js/src/embeddingLevels.js | 690 + node_modules/bidi-js/src/index.js | 5 + node_modules/bidi-js/src/mirroring.js | 53 + node_modules/bidi-js/src/reordering.js | 99 + .../bidi-js/src/util/parseCharacterMap.js | 30 + node_modules/css-tree/LICENSE | 19 + node_modules/css-tree/README.md | 192 + .../css-tree/cjs/convertor/create.cjs | 32 + node_modules/css-tree/cjs/convertor/index.cjs | 8 + node_modules/css-tree/cjs/data-patch.cjs | 7 + node_modules/css-tree/cjs/data.cjs | 120 + .../cjs/definition-syntax/SyntaxError.cjs | 16 + .../cjs/definition-syntax/generate.cjs | 139 + .../css-tree/cjs/definition-syntax/index.cjs | 13 + .../css-tree/cjs/definition-syntax/parse.cjs | 596 + .../cjs/definition-syntax/scanner.cjs | 113 + .../css-tree/cjs/definition-syntax/walk.cjs | 57 + .../css-tree/cjs/generator/create.cjs | 107 + node_modules/css-tree/cjs/generator/index.cjs | 8 + .../css-tree/cjs/generator/sourceMap.cjs | 96 + .../css-tree/cjs/generator/token-before.cjs | 169 + node_modules/css-tree/cjs/index.cjs | 65 + node_modules/css-tree/cjs/lexer/Lexer.cjs | 517 + node_modules/css-tree/cjs/lexer/error.cjs | 128 + .../css-tree/cjs/lexer/generic-an-plus-b.cjs | 235 + .../css-tree/cjs/lexer/generic-const.cjs | 12 + .../css-tree/cjs/lexer/generic-urange.cjs | 149 + node_modules/css-tree/cjs/lexer/generic.cjs | 717 + node_modules/css-tree/cjs/lexer/index.cjs | 7 + .../css-tree/cjs/lexer/match-graph.cjs | 530 + node_modules/css-tree/cjs/lexer/match.cjs | 632 + .../css-tree/cjs/lexer/prepare-tokens.cjs | 54 + node_modules/css-tree/cjs/lexer/search.cjs | 65 + node_modules/css-tree/cjs/lexer/structure.cjs | 173 + node_modules/css-tree/cjs/lexer/trace.cjs | 73 + node_modules/css-tree/cjs/lexer/units.cjs | 38 + .../css-tree/cjs/parser/SyntaxError.cjs | 74 + node_modules/css-tree/cjs/parser/create.cjs | 402 + node_modules/css-tree/cjs/parser/index.cjs | 8 + .../css-tree/cjs/parser/parse-selector.cjs | 8 + node_modules/css-tree/cjs/parser/sequence.cjs | 47 + .../css-tree/cjs/syntax/atrule/container.cjs | 32 + .../css-tree/cjs/syntax/atrule/font-face.cjs | 12 + .../css-tree/cjs/syntax/atrule/import.cjs | 101 + .../css-tree/cjs/syntax/atrule/index.cjs | 27 + .../css-tree/cjs/syntax/atrule/layer.cjs | 16 + .../css-tree/cjs/syntax/atrule/media.cjs | 16 + .../css-tree/cjs/syntax/atrule/nest.cjs | 16 + .../css-tree/cjs/syntax/atrule/page.cjs | 16 + .../css-tree/cjs/syntax/atrule/scope.cjs | 16 + .../cjs/syntax/atrule/starting-style.cjs | 12 + .../css-tree/cjs/syntax/atrule/supports.cjs | 16 + .../css-tree/cjs/syntax/config/generator.cjs | 9 + .../css-tree/cjs/syntax/config/lexer.cjs | 14 + .../css-tree/cjs/syntax/config/mix.cjs | 126 + .../cjs/syntax/config/parser-selector.cjs | 19 + .../css-tree/cjs/syntax/config/parser.cjs | 49 + .../css-tree/cjs/syntax/config/walker.cjs | 9 + node_modules/css-tree/cjs/syntax/create.cjs | 58 + .../cjs/syntax/function/expression.cjs | 11 + .../css-tree/cjs/syntax/function/var.cjs | 43 + node_modules/css-tree/cjs/syntax/index.cjs | 14 + .../css-tree/cjs/syntax/node/AnPlusB.cjs | 293 + .../css-tree/cjs/syntax/node/Atrule.cjs | 103 + .../cjs/syntax/node/AtrulePrelude.cjs | 52 + .../cjs/syntax/node/AttributeSelector.cjs | 148 + .../css-tree/cjs/syntax/node/Block.cjs | 96 + .../css-tree/cjs/syntax/node/Brackets.cjs | 38 + node_modules/css-tree/cjs/syntax/node/CDC.cjs | 26 + node_modules/css-tree/cjs/syntax/node/CDO.cjs | 26 + .../cjs/syntax/node/ClassSelector.cjs | 31 + .../css-tree/cjs/syntax/node/Combinator.cjs | 61 + .../css-tree/cjs/syntax/node/Comment.cjs | 40 + .../css-tree/cjs/syntax/node/Condition.cjs | 120 + .../css-tree/cjs/syntax/node/Declaration.cjs | 166 + .../cjs/syntax/node/DeclarationList.cjs | 62 + .../css-tree/cjs/syntax/node/Dimension.cjs | 30 + .../css-tree/cjs/syntax/node/Feature.cjs | 101 + .../cjs/syntax/node/FeatureFunction.cjs | 67 + .../css-tree/cjs/syntax/node/FeatureRange.cjs | 133 + .../css-tree/cjs/syntax/node/Function.cjs | 45 + .../cjs/syntax/node/GeneralEnclosed.cjs | 68 + .../css-tree/cjs/syntax/node/Hash.cjs | 30 + .../css-tree/cjs/syntax/node/IdSelector.cjs | 33 + .../css-tree/cjs/syntax/node/Identifier.cjs | 25 + .../css-tree/cjs/syntax/node/Layer.cjs | 35 + .../css-tree/cjs/syntax/node/LayerList.cjs | 43 + .../css-tree/cjs/syntax/node/MediaQuery.cjs | 100 + .../cjs/syntax/node/MediaQueryList.cjs | 41 + .../cjs/syntax/node/NestingSelector.cjs | 29 + node_modules/css-tree/cjs/syntax/node/Nth.cjs | 54 + .../css-tree/cjs/syntax/node/Number.cjs | 25 + .../css-tree/cjs/syntax/node/Operator.cjs | 28 + .../css-tree/cjs/syntax/node/Parentheses.cjs | 38 + .../css-tree/cjs/syntax/node/Percentage.cjs | 25 + .../cjs/syntax/node/PseudoClassSelector.cjs | 67 + .../cjs/syntax/node/PseudoElementSelector.cjs | 69 + .../css-tree/cjs/syntax/node/Ratio.cjs | 71 + node_modules/css-tree/cjs/syntax/node/Raw.cjs | 48 + .../css-tree/cjs/syntax/node/Rule.cjs | 58 + .../css-tree/cjs/syntax/node/Scope.cjs | 69 + .../css-tree/cjs/syntax/node/Selector.cjs | 38 + .../css-tree/cjs/syntax/node/SelectorList.cjs | 43 + .../css-tree/cjs/syntax/node/String.cjs | 26 + .../css-tree/cjs/syntax/node/StyleSheet.cjs | 83 + .../cjs/syntax/node/SupportsDeclaration.cjs | 38 + .../css-tree/cjs/syntax/node/TypeSelector.cjs | 59 + .../css-tree/cjs/syntax/node/UnicodeRange.cjs | 158 + node_modules/css-tree/cjs/syntax/node/Url.cjs | 54 + .../css-tree/cjs/syntax/node/Value.cjs | 26 + .../css-tree/cjs/syntax/node/WhiteSpace.cjs | 34 + .../cjs/syntax/node/index-generate.cjs | 103 + .../cjs/syntax/node/index-parse-selector.cjs | 39 + .../css-tree/cjs/syntax/node/index-parse.cjs | 103 + .../css-tree/cjs/syntax/node/index.cjs | 103 + .../css-tree/cjs/syntax/pseudo/index.cjs | 60 + .../css-tree/cjs/syntax/pseudo/lang.cjs | 37 + .../cjs/syntax/scope/atrulePrelude.cjs | 9 + .../css-tree/cjs/syntax/scope/default.cjs | 76 + .../css-tree/cjs/syntax/scope/index.cjs | 11 + .../css-tree/cjs/syntax/scope/selector.cjs | 88 + .../css-tree/cjs/syntax/scope/value.cjs | 29 + .../cjs/tokenizer/OffsetToLocation.cjs | 91 + .../css-tree/cjs/tokenizer/TokenStream.cjs | 358 + .../css-tree/cjs/tokenizer/adopt-buffer.cjs | 13 + .../cjs/tokenizer/char-code-definitions.cjs | 236 + node_modules/css-tree/cjs/tokenizer/index.cjs | 554 + node_modules/css-tree/cjs/tokenizer/names.cjs | 32 + node_modules/css-tree/cjs/tokenizer/types.cjs | 57 + node_modules/css-tree/cjs/tokenizer/utils.cjs | 261 + node_modules/css-tree/cjs/utils/List.cjs | 473 + node_modules/css-tree/cjs/utils/clone.cjs | 25 + .../cjs/utils/create-custom-error.cjs | 18 + node_modules/css-tree/cjs/utils/ident.cjs | 102 + node_modules/css-tree/cjs/utils/index.cjs | 20 + node_modules/css-tree/cjs/utils/names.cjs | 113 + node_modules/css-tree/cjs/utils/string.cjs | 99 + node_modules/css-tree/cjs/utils/url.cjs | 108 + node_modules/css-tree/cjs/version.cjs | 5 + node_modules/css-tree/cjs/walker/create.cjs | 291 + node_modules/css-tree/cjs/walker/index.cjs | 8 + node_modules/css-tree/data/patch.json | 853 + node_modules/css-tree/dist/csstree.esm.js | 12 + node_modules/css-tree/dist/csstree.js | 12 + node_modules/css-tree/dist/data.cjs | 1412 + node_modules/css-tree/dist/data.js | 1412 + node_modules/css-tree/dist/version.cjs | 1 + node_modules/css-tree/dist/version.js | 1 + node_modules/css-tree/lib/convertor/create.js | 28 + node_modules/css-tree/lib/convertor/index.js | 4 + node_modules/css-tree/lib/data-patch.js | 6 + node_modules/css-tree/lib/data.js | 118 + .../lib/definition-syntax/SyntaxError.js | 12 + .../lib/definition-syntax/generate.js | 135 + .../css-tree/lib/definition-syntax/index.js | 4 + .../css-tree/lib/definition-syntax/parse.js | 592 + .../css-tree/lib/definition-syntax/scanner.js | 109 + .../css-tree/lib/definition-syntax/walk.js | 53 + node_modules/css-tree/lib/generator/create.js | 102 + node_modules/css-tree/lib/generator/index.js | 4 + .../css-tree/lib/generator/sourceMap.js | 92 + .../css-tree/lib/generator/token-before.js | 180 + node_modules/css-tree/lib/index.js | 30 + node_modules/css-tree/lib/lexer/Lexer.js | 511 + node_modules/css-tree/lib/lexer/error.js | 123 + .../css-tree/lib/lexer/generic-an-plus-b.js | 238 + .../css-tree/lib/lexer/generic-const.js | 8 + .../css-tree/lib/lexer/generic-urange.js | 151 + node_modules/css-tree/lib/lexer/generic.js | 738 + node_modules/css-tree/lib/lexer/index.js | 1 + .../css-tree/lib/lexer/match-graph.js | 527 + node_modules/css-tree/lib/lexer/match.js | 630 + .../css-tree/lib/lexer/prepare-tokens.js | 50 + node_modules/css-tree/lib/lexer/search.js | 61 + node_modules/css-tree/lib/lexer/structure.js | 169 + node_modules/css-tree/lib/lexer/trace.js | 66 + node_modules/css-tree/lib/lexer/units.js | 27 + .../css-tree/lib/parser/SyntaxError.js | 70 + node_modules/css-tree/lib/parser/create.js | 412 + node_modules/css-tree/lib/parser/index.js | 4 + .../css-tree/lib/parser/parse-selector.js | 4 + node_modules/css-tree/lib/parser/sequence.js | 43 + .../css-tree/lib/syntax/atrule/container.js | 28 + .../css-tree/lib/syntax/atrule/font-face.js | 8 + .../css-tree/lib/syntax/atrule/import.js | 104 + .../css-tree/lib/syntax/atrule/index.js | 23 + .../css-tree/lib/syntax/atrule/layer.js | 12 + .../css-tree/lib/syntax/atrule/media.js | 12 + .../css-tree/lib/syntax/atrule/nest.js | 12 + .../css-tree/lib/syntax/atrule/page.js | 12 + .../css-tree/lib/syntax/atrule/scope.js | 12 + .../lib/syntax/atrule/starting-style.js | 8 + .../css-tree/lib/syntax/atrule/supports.js | 12 + .../css-tree/lib/syntax/config/generator.js | 5 + .../css-tree/lib/syntax/config/lexer.js | 10 + .../css-tree/lib/syntax/config/mix.js | 122 + .../lib/syntax/config/parser-selector.js | 15 + .../css-tree/lib/syntax/config/parser.js | 45 + .../css-tree/lib/syntax/config/walker.js | 5 + node_modules/css-tree/lib/syntax/create.js | 55 + .../lib/syntax/function/expression.js | 7 + .../css-tree/lib/syntax/function/var.js | 39 + node_modules/css-tree/lib/syntax/index.js | 10 + .../css-tree/lib/syntax/node/AnPlusB.js | 292 + .../css-tree/lib/syntax/node/Atrule.js | 100 + .../css-tree/lib/syntax/node/AtrulePrelude.js | 47 + .../lib/syntax/node/AttributeSelector.js | 147 + .../css-tree/lib/syntax/node/Block.js | 95 + .../css-tree/lib/syntax/node/Brackets.js | 35 + node_modules/css-tree/lib/syntax/node/CDC.js | 19 + node_modules/css-tree/lib/syntax/node/CDO.js | 19 + .../css-tree/lib/syntax/node/ClassSelector.js | 24 + .../css-tree/lib/syntax/node/Combinator.js | 54 + .../css-tree/lib/syntax/node/Comment.js | 33 + .../css-tree/lib/syntax/node/Condition.js | 123 + .../css-tree/lib/syntax/node/Declaration.js | 165 + .../lib/syntax/node/DeclarationList.js | 62 + .../css-tree/lib/syntax/node/Dimension.js | 23 + .../css-tree/lib/syntax/node/Feature.js | 103 + .../lib/syntax/node/FeatureFunction.js | 63 + .../css-tree/lib/syntax/node/FeatureRange.js | 133 + .../css-tree/lib/syntax/node/Function.js | 41 + .../lib/syntax/node/GeneralEnclosed.js | 66 + node_modules/css-tree/lib/syntax/node/Hash.js | 23 + .../css-tree/lib/syntax/node/IdSelector.js | 26 + .../css-tree/lib/syntax/node/Identifier.js | 18 + .../css-tree/lib/syntax/node/Layer.js | 28 + .../css-tree/lib/syntax/node/LayerList.js | 36 + .../css-tree/lib/syntax/node/MediaQuery.js | 102 + .../lib/syntax/node/MediaQueryList.js | 34 + .../lib/syntax/node/NestingSelector.js | 22 + node_modules/css-tree/lib/syntax/node/Nth.js | 47 + .../css-tree/lib/syntax/node/Number.js | 18 + .../css-tree/lib/syntax/node/Operator.js | 21 + .../css-tree/lib/syntax/node/Parentheses.js | 34 + .../css-tree/lib/syntax/node/Percentage.js | 18 + .../lib/syntax/node/PseudoClassSelector.js | 65 + .../lib/syntax/node/PseudoElementSelector.js | 66 + .../css-tree/lib/syntax/node/Ratio.js | 68 + node_modules/css-tree/lib/syntax/node/Raw.js | 41 + node_modules/css-tree/lib/syntax/node/Rule.js | 51 + .../css-tree/lib/syntax/node/Scope.js | 66 + .../css-tree/lib/syntax/node/Selector.js | 31 + .../css-tree/lib/syntax/node/SelectorList.js | 35 + .../css-tree/lib/syntax/node/String.js | 19 + .../css-tree/lib/syntax/node/StyleSheet.js | 82 + .../lib/syntax/node/SupportsDeclaration.js | 34 + .../css-tree/lib/syntax/node/TypeSelector.js | 52 + .../css-tree/lib/syntax/node/UnicodeRange.js | 156 + node_modules/css-tree/lib/syntax/node/Url.js | 52 + .../css-tree/lib/syntax/node/Value.js | 19 + .../css-tree/lib/syntax/node/WhiteSpace.js | 27 + .../lib/syntax/node/index-generate.js | 49 + .../lib/syntax/node/index-parse-selector.js | 17 + .../css-tree/lib/syntax/node/index-parse.js | 49 + .../css-tree/lib/syntax/node/index.js | 49 + .../css-tree/lib/syntax/pseudo/index.js | 56 + .../css-tree/lib/syntax/pseudo/lang.js | 33 + .../lib/syntax/scope/atrulePrelude.js | 5 + .../css-tree/lib/syntax/scope/default.js | 85 + .../css-tree/lib/syntax/scope/index.js | 3 + .../css-tree/lib/syntax/scope/selector.js | 94 + .../css-tree/lib/syntax/scope/value.js | 25 + .../lib/tokenizer/OffsetToLocation.js | 87 + .../css-tree/lib/tokenizer/TokenStream.js | 366 + .../css-tree/lib/tokenizer/adopt-buffer.js | 9 + .../lib/tokenizer/char-code-definitions.js | 212 + node_modules/css-tree/lib/tokenizer/index.js | 513 + node_modules/css-tree/lib/tokenizer/names.js | 28 + node_modules/css-tree/lib/tokenizer/types.js | 28 + node_modules/css-tree/lib/tokenizer/utils.js | 254 + node_modules/css-tree/lib/utils/List.js | 469 + node_modules/css-tree/lib/utils/clone.js | 21 + .../css-tree/lib/utils/create-custom-error.js | 14 + node_modules/css-tree/lib/utils/ident.js | 101 + node_modules/css-tree/lib/utils/index.js | 6 + node_modules/css-tree/lib/utils/names.js | 106 + node_modules/css-tree/lib/utils/string.js | 99 + node_modules/css-tree/lib/utils/url.js | 108 + node_modules/css-tree/lib/version.js | 5 + node_modules/css-tree/lib/walker/create.js | 287 + node_modules/css-tree/lib/walker/index.js | 4 + node_modules/css-tree/package.json | 126 + node_modules/data-urls/LICENSE.txt | 7 + node_modules/data-urls/README.md | 66 + node_modules/data-urls/lib/parser.js | 69 + node_modules/data-urls/lib/utils.js | 20 + node_modules/data-urls/package.json | 52 + node_modules/decimal.js/LICENCE.md | 23 + node_modules/decimal.js/README.md | 246 + node_modules/decimal.js/decimal.d.ts | 301 + node_modules/decimal.js/decimal.js | 4951 ++ node_modules/decimal.js/decimal.mjs | 4914 ++ node_modules/decimal.js/package.json | 55 + node_modules/entities/LICENSE | 11 + .../entities/dist/decode-codepoint.d.ts | 28 + .../entities/dist/decode-codepoint.d.ts.map | 1 + .../entities/dist/decode-codepoint.js | 61 + .../entities/dist/decode-codepoint.js.map | 1 + node_modules/entities/dist/decode.d.ts | 227 + node_modules/entities/dist/decode.d.ts.map | 1 + node_modules/entities/dist/decode.js | 1132 + node_modules/entities/dist/decode.js.map | 1 + node_modules/entities/dist/encode.d.ts | 26 + node_modules/entities/dist/encode.d.ts.map | 1 + node_modules/entities/dist/encode.js | 295 + node_modules/entities/dist/encode.js.map | 1 + node_modules/entities/dist/escape.d.ts | 60 + node_modules/entities/dist/escape.d.ts.map | 1 + node_modules/entities/dist/escape.js | 172 + node_modules/entities/dist/escape.js.map | 1 + .../dist/generated/decode-data-html.d.ts | 3 + .../dist/generated/decode-data-html.d.ts.map | 1 + .../dist/generated/decode-data-html.js | 5 + .../dist/generated/decode-data-html.js.map | 1 + .../dist/generated/decode-data-xml.d.ts | 3 + .../dist/generated/decode-data-xml.d.ts.map | 1 + .../dist/generated/decode-data-xml.js | 7 + .../dist/generated/decode-data-xml.js.map | 1 + .../entities/dist/generated/encode-html.d.ts | 3 + .../dist/generated/encode-html.d.ts.map | 1 + .../entities/dist/generated/encode-html.js | 3 + .../dist/generated/encode-html.js.map | 1 + node_modules/entities/dist/index.d.ts | 89 + node_modules/entities/dist/index.d.ts.map | 1 + node_modules/entities/dist/index.js | 87 + node_modules/entities/dist/index.js.map | 1 + .../dist/internal/bin-trie-flags.d.ts | 48 + .../dist/internal/bin-trie-flags.d.ts.map | 1 + .../entities/dist/internal/bin-trie-flags.js | 49 + .../dist/internal/bin-trie-flags.js.map | 1 + .../entities/dist/internal/decode-shared.d.ts | 38 + .../dist/internal/decode-shared.d.ts.map | 1 + .../entities/dist/internal/decode-shared.js | 195 + .../dist/internal/decode-shared.js.map | 1 + node_modules/entities/package.json | 83 + node_modules/entities/readme.md | 131 + node_modules/entities/src/decode-codepoint.ts | 69 + node_modules/entities/src/decode.ts | 1368 + node_modules/entities/src/encode.ts | 337 + node_modules/entities/src/escape.ts | 187 + .../src/generated/decode-data-html.ts | 12 + .../entities/src/generated/decode-data-xml.ts | 7 + .../entities/src/generated/encode-html.ts | 3 + node_modules/entities/src/index.ts | 160 + .../entities/src/internal/bin-trie-flags.ts | 47 + .../entities/src/internal/decode-shared.ts | 209 + .../html-encoding-sniffer/LICENSE.txt | 7 + node_modules/html-encoding-sniffer/README.md | 52 + .../lib/html-encoding-sniffer.js | 432 + .../html-encoding-sniffer/package.json | 36 + .../LICENSE-MIT.txt | 20 + .../README.md | 40 + .../is-potential-custom-element-name/index.js | 9 + .../package.json | 35 + node_modules/jsdom/LICENSE.txt | 22 + node_modules/jsdom/README.md | 555 + node_modules/jsdom/lib/api.js | 306 + .../css-property-computed-value-resolvers.js | 14 + .../lib/generated/css-property-definitions.js | 6476 +++ .../lib/generated/css-property-descriptors.js | 1705 + .../lib/generated/css-property-metadata.js | 867 + .../css-property-resolved-value-resolvers.js | 12 + .../jsdom/lib/generated/event-sets.js | 115 + .../lib/generated/idl/AbortController.js | 134 + .../jsdom/lib/generated/idl/AbortSignal.js | 219 + .../jsdom/lib/generated/idl/AbstractRange.js | 139 + .../generated/idl/AddEventListenerOptions.js | 53 + .../lib/generated/idl/AssignedNodesOptions.js | 28 + node_modules/jsdom/lib/generated/idl/Attr.js | 180 + .../jsdom/lib/generated/idl/BarProp.js | 115 + .../lib/generated/idl/BeforeUnloadEvent.js | 129 + .../jsdom/lib/generated/idl/BinaryType.js | 12 + node_modules/jsdom/lib/generated/idl/Blob.js | 231 + .../jsdom/lib/generated/idl/BlobCallback.js | 30 + .../jsdom/lib/generated/idl/BlobEvent.js | 148 + .../jsdom/lib/generated/idl/BlobEventInit.js | 43 + .../lib/generated/idl/BlobPropertyBag.js | 42 + .../jsdom/lib/generated/idl/CDATASection.js | 108 + node_modules/jsdom/lib/generated/idl/CSS.js | 85 + .../lib/generated/idl/CSSConditionRule.js | 118 + .../lib/generated/idl/CSSContainerRule.js | 124 + .../lib/generated/idl/CSSCounterStyleRule.js | 299 + .../lib/generated/idl/CSSFontFaceRule.js | 131 + .../lib/generated/idl/CSSGroupingRule.js | 172 + .../jsdom/lib/generated/idl/CSSImportRule.js | 157 + .../lib/generated/idl/CSSKeyframeRule.js | 148 + .../lib/generated/idl/CSSKeyframesRule.js | 363 + .../lib/generated/idl/CSSLayerBlockRule.js | 118 + .../generated/idl/CSSLayerStatementRule.js | 118 + .../jsdom/lib/generated/idl/CSSMediaRule.js | 137 + .../lib/generated/idl/CSSNamespaceRule.js | 124 + .../generated/idl/CSSNestedDeclarations.js | 131 + .../jsdom/lib/generated/idl/CSSPageRule.js | 148 + .../jsdom/lib/generated/idl/CSSRule.js | 172 + .../jsdom/lib/generated/idl/CSSRuleList.js | 294 + .../jsdom/lib/generated/idl/CSSScopeRule.js | 124 + .../lib/generated/idl/CSSStyleDeclaration.js | 445 + .../lib/generated/idl/CSSStyleProperties.js | 47854 ++++++++++++++++ .../jsdom/lib/generated/idl/CSSStyleRule.js | 148 + .../jsdom/lib/generated/idl/CSSStyleSheet.js | 299 + .../lib/generated/idl/CSSStyleSheetInit.js | 66 + .../lib/generated/idl/CSSSupportsRule.js | 118 + .../lib/generated/idl/CanPlayTypeResult.js | 12 + .../jsdom/lib/generated/idl/CharacterData.js | 379 + .../jsdom/lib/generated/idl/CloseEvent.js | 152 + .../jsdom/lib/generated/idl/CloseEventInit.js | 65 + .../jsdom/lib/generated/idl/Comment.js | 119 + .../lib/generated/idl/CompositionEvent.js | 209 + .../lib/generated/idl/CompositionEventInit.js | 32 + .../jsdom/lib/generated/idl/Crypto.js | 141 + .../generated/idl/CustomElementConstructor.js | 34 + .../generated/idl/CustomElementRegistry.js | 242 + .../jsdom/lib/generated/idl/CustomEvent.js | 196 + .../lib/generated/idl/CustomEventInit.js | 32 + .../jsdom/lib/generated/idl/DOMException.js | 204 + .../lib/generated/idl/DOMImplementation.js | 217 + .../jsdom/lib/generated/idl/DOMParser.js | 137 + .../jsdom/lib/generated/idl/DOMRect.js | 243 + .../jsdom/lib/generated/idl/DOMRectInit.js | 76 + .../lib/generated/idl/DOMRectReadOnly.js | 226 + .../jsdom/lib/generated/idl/DOMStringMap.js | 295 + .../jsdom/lib/generated/idl/DOMTokenList.js | 490 + .../lib/generated/idl/DeviceMotionEvent.js | 158 + .../idl/DeviceMotionEventAcceleration.js | 127 + .../idl/DeviceMotionEventAccelerationInit.js | 61 + .../generated/idl/DeviceMotionEventInit.js | 70 + .../idl/DeviceMotionEventRotationRate.js | 127 + .../idl/DeviceMotionEventRotationRateInit.js | 61 + .../generated/idl/DeviceOrientationEvent.js | 158 + .../idl/DeviceOrientationEventInit.js | 80 + .../jsdom/lib/generated/idl/Document.js | 3149 + .../lib/generated/idl/DocumentFragment.js | 278 + .../lib/generated/idl/DocumentReadyState.js | 12 + .../jsdom/lib/generated/idl/DocumentType.js | 221 + .../jsdom/lib/generated/idl/Element.js | 2826 + .../generated/idl/ElementCreationOptions.js | 26 + .../generated/idl/ElementDefinitionOptions.js | 29 + .../lib/generated/idl/ElementInternals.js | 1637 + .../jsdom/lib/generated/idl/EndingType.js | 12 + .../jsdom/lib/generated/idl/ErrorEvent.js | 164 + .../jsdom/lib/generated/idl/ErrorEventInit.js | 92 + node_modules/jsdom/lib/generated/idl/Event.js | 322 + .../lib/generated/idl/EventHandlerNonNull.js | 36 + .../jsdom/lib/generated/idl/EventInit.js | 58 + .../jsdom/lib/generated/idl/EventListener.js | 35 + .../lib/generated/idl/EventListenerOptions.js | 28 + .../lib/generated/idl/EventModifierInit.js | 221 + .../jsdom/lib/generated/idl/EventTarget.js | 244 + .../jsdom/lib/generated/idl/External.js | 121 + node_modules/jsdom/lib/generated/idl/File.js | 176 + .../jsdom/lib/generated/idl/FileList.js | 294 + .../lib/generated/idl/FilePropertyBag.js | 33 + .../jsdom/lib/generated/idl/FileReader.js | 346 + .../jsdom/lib/generated/idl/FocusEvent.js | 140 + .../jsdom/lib/generated/idl/FocusEventInit.js | 36 + .../jsdom/lib/generated/idl/FormData.js | 439 + .../jsdom/lib/generated/idl/Function.js | 42 + .../lib/generated/idl/GetRootNodeOptions.js | 31 + .../lib/generated/idl/HTMLAnchorElement.js | 753 + .../lib/generated/idl/HTMLAreaElement.js | 612 + .../lib/generated/idl/HTMLAudioElement.js | 110 + .../jsdom/lib/generated/idl/HTMLBRElement.js | 147 + .../lib/generated/idl/HTMLBaseElement.js | 175 + .../lib/generated/idl/HTMLBodyElement.js | 603 + .../lib/generated/idl/HTMLButtonElement.js | 391 + .../lib/generated/idl/HTMLCanvasElement.js | 287 + .../jsdom/lib/generated/idl/HTMLCollection.js | 373 + .../lib/generated/idl/HTMLDListElement.js | 150 + .../lib/generated/idl/HTMLDataElement.js | 147 + .../lib/generated/idl/HTMLDataListElement.js | 122 + .../lib/generated/idl/HTMLDetailsElement.js | 150 + .../lib/generated/idl/HTMLDialogElement.js | 150 + .../lib/generated/idl/HTMLDirectoryElement.js | 150 + .../jsdom/lib/generated/idl/HTMLDivElement.js | 147 + .../jsdom/lib/generated/idl/HTMLElement.js | 2175 + .../lib/generated/idl/HTMLEmbedElement.js | 312 + .../lib/generated/idl/HTMLFieldSetElement.js | 251 + .../lib/generated/idl/HTMLFontElement.js | 206 + .../idl/HTMLFormControlsCollection.js | 355 + .../lib/generated/idl/HTMLFormElement.js | 539 + .../lib/generated/idl/HTMLFrameElement.js | 406 + .../lib/generated/idl/HTMLFrameSetElement.js | 482 + .../jsdom/lib/generated/idl/HTMLHRElement.js | 266 + .../lib/generated/idl/HTMLHeadElement.js | 110 + .../lib/generated/idl/HTMLHeadingElement.js | 147 + .../lib/generated/idl/HTMLHtmlElement.js | 147 + .../lib/generated/idl/HTMLIFrameElement.js | 528 + .../lib/generated/idl/HTMLImageElement.js | 689 + .../lib/generated/idl/HTMLInputElement.js | 1406 + .../jsdom/lib/generated/idl/HTMLLIElement.js | 183 + .../lib/generated/idl/HTMLLabelElement.js | 159 + .../lib/generated/idl/HTMLLegendElement.js | 153 + .../lib/generated/idl/HTMLLinkElement.js | 431 + .../jsdom/lib/generated/idl/HTMLMapElement.js | 155 + .../lib/generated/idl/HTMLMarqueeElement.js | 441 + .../lib/generated/idl/HTMLMediaElement.js | 633 + .../lib/generated/idl/HTMLMenuElement.js | 150 + .../lib/generated/idl/HTMLMetaElement.js | 234 + .../lib/generated/idl/HTMLMeterElement.js | 292 + .../jsdom/lib/generated/idl/HTMLModElement.js | 196 + .../lib/generated/idl/HTMLOListElement.js | 247 + .../lib/generated/idl/HTMLObjectElement.js | 703 + .../lib/generated/idl/HTMLOptGroupElement.js | 179 + .../lib/generated/idl/HTMLOptionElement.js | 295 + .../generated/idl/HTMLOptionsCollection.js | 519 + .../lib/generated/idl/HTMLOutputElement.js | 290 + .../lib/generated/idl/HTMLParagraphElement.js | 147 + .../lib/generated/idl/HTMLParamElement.js | 234 + .../lib/generated/idl/HTMLPictureElement.js | 110 + .../jsdom/lib/generated/idl/HTMLPreElement.js | 154 + .../lib/generated/idl/HTMLProgressElement.js | 197 + .../lib/generated/idl/HTMLQuoteElement.js | 167 + .../lib/generated/idl/HTMLScriptElement.js | 379 + .../lib/generated/idl/HTMLSelectElement.js | 791 + .../lib/generated/idl/HTMLSlotElement.js | 176 + .../lib/generated/idl/HTMLSourceElement.js | 283 + .../lib/generated/idl/HTMLSpanElement.js | 110 + .../lib/generated/idl/HTMLStyleElement.js | 199 + .../generated/idl/HTMLTableCaptionElement.js | 147 + .../lib/generated/idl/HTMLTableCellElement.js | 561 + .../lib/generated/idl/HTMLTableColElement.js | 307 + .../lib/generated/idl/HTMLTableElement.js | 594 + .../lib/generated/idl/HTMLTableRowElement.js | 328 + .../generated/idl/HTMLTableSectionElement.js | 286 + .../lib/generated/idl/HTMLTemplateElement.js | 120 + .../lib/generated/idl/HTMLTextAreaElement.js | 897 + .../lib/generated/idl/HTMLTimeElement.js | 147 + .../lib/generated/idl/HTMLTitleElement.js | 146 + .../lib/generated/idl/HTMLTrackElement.js | 302 + .../lib/generated/idl/HTMLUListElement.js | 179 + .../lib/generated/idl/HTMLUnknownElement.js | 108 + .../lib/generated/idl/HTMLVideoElement.js | 285 + .../lib/generated/idl/HashChangeEvent.js | 146 + .../lib/generated/idl/HashChangeEventInit.js | 50 + .../jsdom/lib/generated/idl/Headers.js | 389 + .../jsdom/lib/generated/idl/History.js | 240 + .../jsdom/lib/generated/idl/InputEvent.js | 152 + .../jsdom/lib/generated/idl/InputEventInit.js | 68 + .../jsdom/lib/generated/idl/KeyboardEvent.js | 359 + .../lib/generated/idl/KeyboardEventInit.js | 116 + .../jsdom/lib/generated/idl/Location.js | 297 + .../jsdom/lib/generated/idl/MediaList.js | 359 + .../jsdom/lib/generated/idl/MessageEvent.js | 279 + .../lib/generated/idl/MessageEventInit.js | 100 + .../jsdom/lib/generated/idl/MimeType.js | 133 + .../jsdom/lib/generated/idl/MimeTypeArray.js | 314 + .../jsdom/lib/generated/idl/MouseEvent.js | 461 + .../jsdom/lib/generated/idl/MouseEventInit.js | 189 + .../lib/generated/idl/MutationCallback.js | 34 + .../lib/generated/idl/MutationObserver.js | 163 + .../lib/generated/idl/MutationObserverInit.js | 121 + .../jsdom/lib/generated/idl/MutationRecord.js | 169 + .../jsdom/lib/generated/idl/NamedNodeMap.js | 520 + .../jsdom/lib/generated/idl/Navigator.js | 215 + node_modules/jsdom/lib/generated/idl/Node.js | 622 + .../jsdom/lib/generated/idl/NodeFilter.js | 75 + .../jsdom/lib/generated/idl/NodeIterator.js | 159 + .../jsdom/lib/generated/idl/NodeList.js | 298 + .../idl/OnBeforeUnloadEventHandlerNonNull.js | 42 + .../idl/OnErrorEventHandlerNonNull.js | 56 + .../lib/generated/idl/PageTransitionEvent.js | 140 + .../generated/idl/PageTransitionEventInit.js | 35 + .../jsdom/lib/generated/idl/Performance.js | 130 + .../jsdom/lib/generated/idl/Plugin.js | 333 + .../jsdom/lib/generated/idl/PluginArray.js | 320 + .../jsdom/lib/generated/idl/PointerEvent.js | 224 + .../lib/generated/idl/PointerEventInit.js | 241 + .../jsdom/lib/generated/idl/PopStateEvent.js | 140 + .../lib/generated/idl/PopStateEventInit.js | 32 + .../generated/idl/ProcessingInstruction.js | 118 + .../jsdom/lib/generated/idl/ProgressEvent.js | 152 + .../lib/generated/idl/ProgressEventInit.js | 65 + .../generated/idl/PromiseRejectionEvent.js | 146 + .../idl/PromiseRejectionEventInit.js | 42 + .../lib/generated/idl/QuotaExceededError.js | 145 + .../idl/QuotaExceededErrorOptions.js | 39 + .../jsdom/lib/generated/idl/RadioNodeList.js | 288 + node_modules/jsdom/lib/generated/idl/Range.js | 542 + .../idl/SVGAnimatedPreserveAspectRatio.js | 125 + .../lib/generated/idl/SVGAnimatedRect.js | 125 + .../lib/generated/idl/SVGAnimatedString.js | 132 + .../generated/idl/SVGBoundingBoxOptions.js | 64 + .../jsdom/lib/generated/idl/SVGDefsElement.js | 108 + .../jsdom/lib/generated/idl/SVGDescElement.js | 108 + .../jsdom/lib/generated/idl/SVGElement.js | 1952 + .../jsdom/lib/generated/idl/SVGGElement.js | 108 + .../lib/generated/idl/SVGGraphicsElement.js | 128 + .../lib/generated/idl/SVGMetadataElement.js | 108 + .../jsdom/lib/generated/idl/SVGNumber.js | 126 + .../generated/idl/SVGPreserveAspectRatio.js | 173 + .../jsdom/lib/generated/idl/SVGRect.js | 177 + .../jsdom/lib/generated/idl/SVGSVGElement.js | 525 + .../jsdom/lib/generated/idl/SVGStringList.js | 461 + .../lib/generated/idl/SVGSwitchElement.js | 108 + .../lib/generated/idl/SVGSymbolElement.js | 135 + .../lib/generated/idl/SVGTitleElement.js | 108 + .../jsdom/lib/generated/idl/Screen.js | 145 + .../jsdom/lib/generated/idl/ScrollBehavior.js | 12 + .../generated/idl/ScrollIntoViewOptions.js | 45 + .../generated/idl/ScrollLogicalPosition.js | 14 + .../jsdom/lib/generated/idl/ScrollOptions.js | 30 + .../lib/generated/idl/ScrollRestoration.js | 12 + .../jsdom/lib/generated/idl/Selection.js | 449 + .../jsdom/lib/generated/idl/SelectionMode.js | 12 + .../jsdom/lib/generated/idl/ShadowRoot.js | 163 + .../jsdom/lib/generated/idl/ShadowRootInit.js | 30 + .../jsdom/lib/generated/idl/ShadowRootMode.js | 12 + .../jsdom/lib/generated/idl/StaticRange.js | 122 + .../lib/generated/idl/StaticRangeInit.js | 72 + .../jsdom/lib/generated/idl/Storage.js | 393 + .../jsdom/lib/generated/idl/StorageEvent.js | 284 + .../lib/generated/idl/StorageEventInit.js | 99 + .../jsdom/lib/generated/idl/StyleSheet.js | 175 + .../jsdom/lib/generated/idl/StyleSheetList.js | 294 + .../jsdom/lib/generated/idl/SubmitEvent.js | 140 + .../lib/generated/idl/SubmitEventInit.js | 36 + .../jsdom/lib/generated/idl/SupportedType.js | 18 + node_modules/jsdom/lib/generated/idl/Text.js | 157 + .../lib/generated/idl/TextDecodeOptions.js | 28 + .../jsdom/lib/generated/idl/TextDecoder.js | 190 + .../lib/generated/idl/TextDecoderOptions.js | 43 + .../jsdom/lib/generated/idl/TextEncoder.js | 163 + .../idl/TextEncoderEncodeIntoResult.js | 42 + .../jsdom/lib/generated/idl/TextTrackKind.js | 12 + .../jsdom/lib/generated/idl/TouchEvent.js | 176 + .../jsdom/lib/generated/idl/TouchEventInit.js | 89 + .../lib/generated/idl/TransitionEvent.js | 152 + .../lib/generated/idl/TransitionEventInit.js | 65 + .../jsdom/lib/generated/idl/TreeWalker.js | 188 + .../jsdom/lib/generated/idl/UIEvent.js | 219 + .../jsdom/lib/generated/idl/UIEventInit.js | 62 + .../jsdom/lib/generated/idl/ValidityState.js | 175 + .../lib/generated/idl/VisibilityState.js | 12 + .../jsdom/lib/generated/idl/VoidFunction.js | 26 + .../jsdom/lib/generated/idl/WebSocket.js | 384 + .../jsdom/lib/generated/idl/WheelEvent.js | 166 + .../jsdom/lib/generated/idl/WheelEventInit.js | 71 + .../jsdom/lib/generated/idl/XMLDocument.js | 279 + .../jsdom/lib/generated/idl/XMLHttpRequest.js | 523 + .../idl/XMLHttpRequestEventTarget.js | 246 + .../idl/XMLHttpRequestResponseType.js | 14 + .../lib/generated/idl/XMLHttpRequestUpload.js | 108 + .../jsdom/lib/generated/idl/XMLSerializer.js | 129 + node_modules/jsdom/lib/generated/idl/utils.js | 423 + .../jsdom/lib/generated/js-globals.json | 332 + .../jsdom/lib/jsdom/browser/Window.js | 946 + .../lib/jsdom/browser/default-stylesheet.css | 415 + .../lib/jsdom/browser/not-implemented.js | 20 + .../jsdom/lib/jsdom/browser/parser/html.js | 208 + .../jsdom/lib/jsdom/browser/parser/index.js | 37 + .../jsdom/lib/jsdom/browser/parser/xml.js | 202 + .../browser/resources/async-resource-queue.js | 114 + .../resources/decompress-interceptor.js | 184 + .../browser/resources/jsdom-dispatcher.js | 785 + .../resources/per-document-resource-loader.js | 124 + .../browser/resources/request-interceptor.js | 196 + .../browser/resources/request-manager.js | 33 + .../jsdom/browser/resources/resource-queue.js | 142 + .../jsdom/browser/resources/stream-handler.js | 104 + node_modules/jsdom/lib/jsdom/level3/xpath.js | 1867 + .../living/aborting/AbortController-impl.js | 17 + .../jsdom/living/aborting/AbortSignal-impl.js | 131 + .../jsdom/lib/jsdom/living/attributes.js | 284 + .../lib/jsdom/living/attributes/Attr-impl.js | 60 + .../living/attributes/NamedNodeMap-impl.js | 78 + .../DefaultConstraintValidation-impl.js | 78 + .../ValidityState-impl.js | 66 + .../lib/jsdom/living/crypto/Crypto-impl.js | 69 + .../jsdom/lib/jsdom/living/css/CSS-impl.js | 225 + .../jsdom/living/css/CSSConditionRule-impl.js | 17 + .../jsdom/living/css/CSSContainerRule-impl.js | 33 + .../living/css/CSSCounterStyleRule-impl.js | 45 + .../jsdom/living/css/CSSFontFaceRule-impl.js | 24 + .../jsdom/living/css/CSSGroupingRule-impl.js | 55 + .../jsdom/living/css/CSSImportRule-impl.js | 51 + .../jsdom/living/css/CSSKeyframeRule-impl.js | 71 + .../jsdom/living/css/CSSKeyframesRule-impl.js | 82 + .../living/css/CSSLayerBlockRule-impl.js | 18 + .../living/css/CSSLayerStatementRule-impl.js | 16 + .../lib/jsdom/living/css/CSSMediaRule-impl.js | 35 + .../jsdom/living/css/CSSNamespaceRule-impl.js | 28 + .../living/css/CSSNestedDeclarations-impl.js | 19 + .../lib/jsdom/living/css/CSSPageRule-impl.js | 86 + .../lib/jsdom/living/css/CSSRule-impl.js | 37 + .../lib/jsdom/living/css/CSSRuleList-impl.js | 219 + .../lib/jsdom/living/css/CSSScopeRule-impl.js | 25 + .../living/css/CSSStyleDeclaration-impl.js | 895 + .../living/css/CSSStyleProperties-impl.js | 27 + .../lib/jsdom/living/css/CSSStyleRule-impl.js | 68 + .../jsdom/living/css/CSSStyleSheet-impl.js | 133 + .../jsdom/living/css/CSSSupportsRule-impl.js | 68 + .../living/css/ElementCSSInlineStyle-impl.js | 15 + .../lib/jsdom/living/css/MediaList-impl.js | 150 + .../lib/jsdom/living/css/StyleSheet-impl.js | 31 + .../jsdom/living/css/StyleSheetList-impl.js | 43 + .../living/css/helpers/computed-style.js | 335 + .../jsdom/living/css/helpers/css-parser.js | 1037 + .../jsdom/living/css/helpers/css-values.js | 902 + .../jsdom/living/css/helpers/font-sizes.js | 191 + .../helpers/generic-property-descriptor.js | 144 + .../jsdom/living/css/helpers/line-widths.js | 52 + .../living/css/helpers/patched-csstree.js | 12 + .../css/helpers/shorthand-properties.js | 1531 + .../jsdom/living/css/helpers/stylesheets.js | 156 + .../jsdom/living/css/helpers/system-colors.js | 157 + .../jsdom/living/css/properties/background.js | 497 + .../css/properties/backgroundAttachment.js | 62 + .../living/css/properties/backgroundClip.js | 62 + .../living/css/properties/backgroundColor.js | 51 + .../living/css/properties/backgroundImage.js | 64 + .../living/css/properties/backgroundOrigin.js | 62 + .../css/properties/backgroundPosition.js | 364 + .../css/properties/backgroundPositionX.js | 44 + .../css/properties/backgroundPositionY.js | 44 + .../living/css/properties/backgroundRepeat.js | 95 + .../living/css/properties/backgroundSize.js | 129 + .../lib/jsdom/living/css/properties/border.js | 118 + .../living/css/properties/borderBottom.js | 106 + .../css/properties/borderBottomColor.js | 49 + .../css/properties/borderBottomStyle.js | 49 + .../css/properties/borderBottomWidth.js | 63 + .../living/css/properties/borderColor.js | 115 + .../jsdom/living/css/properties/borderLeft.js | 106 + .../living/css/properties/borderLeftColor.js | 49 + .../living/css/properties/borderLeftStyle.js | 49 + .../living/css/properties/borderLeftWidth.js | 63 + .../living/css/properties/borderRight.js | 106 + .../living/css/properties/borderRightColor.js | 49 + .../living/css/properties/borderRightStyle.js | 49 + .../living/css/properties/borderRightWidth.js | 63 + .../living/css/properties/borderSpacing.js | 69 + .../living/css/properties/borderStyle.js | 115 + .../jsdom/living/css/properties/borderTop.js | 106 + .../living/css/properties/borderTopColor.js | 49 + .../living/css/properties/borderTopStyle.js | 49 + .../living/css/properties/borderTopWidth.js | 63 + .../living/css/properties/borderWidth.js | 116 + .../lib/jsdom/living/css/properties/bottom.js | 51 + .../lib/jsdom/living/css/properties/clip.js | 80 + .../jsdom/living/css/properties/display.js | 216 + .../lib/jsdom/living/css/properties/flex.js | 188 + .../jsdom/living/css/properties/flexBasis.js | 54 + .../jsdom/living/css/properties/flexGrow.js | 53 + .../jsdom/living/css/properties/flexShrink.js | 53 + .../lib/jsdom/living/css/properties/font.js | 272 + .../jsdom/living/css/properties/fontFamily.js | 105 + .../jsdom/living/css/properties/fontSize.js | 54 + .../jsdom/living/css/properties/fontStyle.js | 72 + .../living/css/properties/fontVariant.js | 67 + .../jsdom/living/css/properties/fontWeight.js | 101 + .../lib/jsdom/living/css/properties/height.js | 52 + .../lib/jsdom/living/css/properties/left.js | 51 + .../jsdom/living/css/properties/lineHeight.js | 53 + .../lib/jsdom/living/css/properties/margin.js | 83 + .../living/css/properties/marginBottom.js | 56 + .../jsdom/living/css/properties/marginLeft.js | 56 + .../living/css/properties/marginRight.js | 56 + .../jsdom/living/css/properties/marginTop.js | 56 + .../jsdom/living/css/properties/opacity.js | 51 + .../jsdom/living/css/properties/padding.js | 84 + .../living/css/properties/paddingBottom.js | 57 + .../living/css/properties/paddingLeft.js | 57 + .../living/css/properties/paddingRight.js | 57 + .../jsdom/living/css/properties/paddingTop.js | 57 + .../lib/jsdom/living/css/properties/right.js | 51 + .../lib/jsdom/living/css/properties/top.js | 51 + .../lib/jsdom/living/css/properties/width.js | 52 + .../CustomElementRegistry-impl.js | 275 + .../custom-elements/ElementInternals-impl.js | 56 + .../DeviceMotionEventAcceleration-impl.js | 7 + .../DeviceMotionEventRotationRate-impl.js | 7 + .../jsdom/lib/jsdom/living/documents.js | 10 + .../jsdom/living/domparsing/DOMParser-impl.js | 57 + .../jsdom/living/domparsing/InnerHTML-impl.js | 30 + .../living/domparsing/XMLSerializer-impl.js | 18 + .../parse5-adapter-serialization.js | 62 + .../jsdom/living/domparsing/serialization.js | 35 + .../jsdom/living/encoding/TextDecoder-impl.js | 25 + .../jsdom/living/encoding/TextEncoder-impl.js | 26 + .../living/events/BeforeUnloadEvent-impl.js | 12 + .../lib/jsdom/living/events/BlobEvent-impl.js | 14 + .../jsdom/living/events/CloseEvent-impl.js | 10 + .../living/events/CompositionEvent-impl.js | 20 + .../jsdom/living/events/CustomEvent-impl.js | 21 + .../living/events/DeviceMotionEvent-impl.js | 49 + .../events/DeviceOrientationEvent-impl.js | 10 + .../jsdom/living/events/ErrorEvent-impl.js | 14 + .../lib/jsdom/living/events/Event-impl.js | 195 + .../living/events/EventModifierMixin-impl.js | 24 + .../jsdom/living/events/EventTarget-impl.js | 487 + .../jsdom/living/events/FocusEvent-impl.js | 9 + .../living/events/HashChangeEvent-impl.js | 14 + .../jsdom/living/events/InputEvent-impl.js | 11 + .../jsdom/living/events/KeyboardEvent-impl.js | 29 + .../jsdom/living/events/MessageEvent-impl.js | 25 + .../jsdom/living/events/MouseEvent-impl.js | 72 + .../living/events/PageTransitionEvent-impl.js | 20 + .../jsdom/living/events/PointerEvent-impl.js | 21 + .../jsdom/living/events/PopStateEvent-impl.js | 9 + .../jsdom/living/events/ProgressEvent-impl.js | 14 + .../events/PromiseRejectionEvent-impl.js | 14 + .../jsdom/living/events/StorageEvent-impl.js | 26 + .../jsdom/living/events/SubmitEvent-impl.js | 13 + .../jsdom/living/events/TouchEvent-impl.js | 14 + .../living/events/TransitionEvent-impl.js | 10 + .../lib/jsdom/living/events/UIEvent-impl.js | 43 + .../jsdom/living/events/WheelEvent-impl.js | 12 + .../lib/jsdom/living/fetch/Headers-impl.js | 173 + .../lib/jsdom/living/fetch/header-list.js | 158 + .../lib/jsdom/living/fetch/header-types.js | 205 + .../lib/jsdom/living/fetch/header-utils.js | 26 + .../lib/jsdom/living/file-api/Blob-impl.js | 125 + .../lib/jsdom/living/file-api/File-impl.js | 12 + .../jsdom/living/file-api/FileList-impl.js | 15 + .../jsdom/living/file-api/FileReader-impl.js | 163 + .../lib/jsdom/living/geometry/DOMRect-impl.js | 39 + .../living/geometry/DOMRectReadOnly-impl.js | 72 + .../lib/jsdom/living/helpers/binary-data.js | 77 + .../lib/jsdom/living/helpers/by-id-cache.js | 66 + .../jsdom/living/helpers/create-element.js | 328 + .../living/helpers/create-event-accessor.js | 212 + .../jsdom/living/helpers/custom-elements.js | 286 + .../jsdom/living/helpers/dates-and-times.js | 276 + .../jsdom/lib/jsdom/living/helpers/details.js | 15 + .../helpers/document-named-properties.js | 17 + .../lib/jsdom/living/helpers/dom-tree.js | 366 + .../lib/jsdom/living/helpers/encoding.js | 60 + .../jsdom/lib/jsdom/living/helpers/events.js | 24 + .../lib/jsdom/living/helpers/focusing.js | 314 + .../lib/jsdom/living/helpers/form-controls.js | 331 + .../jsdom/living/helpers/html-collections.js | 136 + .../jsdom/living/helpers/html-constructor.js | 76 + .../lib/jsdom/living/helpers/is-window.js | 9 + .../living/helpers/iterable-weak-list.js | 34 + .../jsdom/living/helpers/iterable-weak-set.js | 48 + .../jsdom/lib/jsdom/living/helpers/json.js | 7 + .../living/helpers/mutation-observers.js | 232 + .../lib/jsdom/living/helpers/namespaces.js | 16 + .../living/helpers/number-and-date-inputs.js | 201 + .../lib/jsdom/living/helpers/ordered-set.js | 104 + .../living/helpers/page-transition-event.js | 9 + .../living/helpers/runtime-script-errors.js | 75 + .../lib/jsdom/living/helpers/shadow-dom.js | 307 + .../jsdom/lib/jsdom/living/helpers/strings.js | 168 + .../jsdom/living/helpers/svg/basic-types.js | 41 + .../lib/jsdom/living/helpers/svg/render.js | 46 + .../jsdom/lib/jsdom/living/helpers/text.js | 18 + .../lib/jsdom/living/helpers/traversal.js | 59 + .../jsdom/living/helpers/validate-names.js | 119 + .../jsdom/living/helpers/weak-value-map.js | 68 + .../jsdom/living/hr-time/Performance-impl.js | 22 + .../jsdom/lib/jsdom/living/interfaces.js | 275 + .../MutationObserver-impl.js | 103 + .../mutation-observer/MutationRecord-impl.js | 37 + .../jsdom/living/navigator/MimeType-impl.js | 3 + .../living/navigator/MimeTypeArray-impl.js | 21 + .../jsdom/living/navigator/Navigator-impl.js | 29 + .../NavigatorConcurrentHardware-impl.js | 8 + .../living/navigator/NavigatorCookies-impl.js | 7 + .../living/navigator/NavigatorID-impl.js | 37 + .../navigator/NavigatorLanguage-impl.js | 9 + .../living/navigator/NavigatorOnLine-impl.js | 7 + .../living/navigator/NavigatorPlugins-impl.js | 8 + .../lib/jsdom/living/navigator/Plugin-impl.js | 3 + .../living/navigator/PluginArray-impl.js | 23 + .../jsdom/living/node-document-position.js | 10 + .../jsdom/lib/jsdom/living/node-type.js | 16 + node_modules/jsdom/lib/jsdom/living/node.js | 192 + .../jsdom/living/nodes/CDATASection-impl.js | 16 + .../jsdom/living/nodes/CharacterData-impl.js | 121 + .../lib/jsdom/living/nodes/ChildNode-impl.js | 80 + .../lib/jsdom/living/nodes/Comment-impl.js | 19 + .../living/nodes/DOMImplementation-impl.js | 121 + .../jsdom/living/nodes/DOMStringMap-impl.js | 65 + .../jsdom/living/nodes/DOMTokenList-impl.js | 171 + .../lib/jsdom/living/nodes/Document-impl.js | 1183 + .../living/nodes/DocumentFragment-impl.js | 42 + .../living/nodes/DocumentOrShadowRoot-impl.js | 27 + .../jsdom/living/nodes/DocumentType-impl.js | 24 + .../lib/jsdom/living/nodes/Element-impl.js | 554 + .../nodes/ElementContentEditable-impl.js | 7 + .../living/nodes/GlobalEventHandlers-impl.js | 103 + .../living/nodes/HTMLAnchorElement-impl.js | 50 + .../living/nodes/HTMLAreaElement-impl.js | 43 + .../living/nodes/HTMLAudioElement-impl.js | 9 + .../jsdom/living/nodes/HTMLBRElement-impl.js | 9 + .../living/nodes/HTMLBaseElement-impl.js | 43 + .../living/nodes/HTMLBodyElement-impl.js | 12 + .../living/nodes/HTMLButtonElement-impl.js | 79 + .../living/nodes/HTMLCanvasElement-impl.js | 117 + .../jsdom/living/nodes/HTMLCollection-impl.js | 101 + .../living/nodes/HTMLDListElement-impl.js | 9 + .../living/nodes/HTMLDataElement-impl.js | 9 + .../living/nodes/HTMLDataListElement-impl.js | 20 + .../living/nodes/HTMLDetailsElement-impl.js | 35 + .../living/nodes/HTMLDialogElement-impl.js | 9 + .../living/nodes/HTMLDirectoryElement-impl.js | 9 + .../jsdom/living/nodes/HTMLDivElement-impl.js | 9 + .../jsdom/living/nodes/HTMLElement-impl.js | 208 + .../living/nodes/HTMLEmbedElement-impl.js | 8 + .../living/nodes/HTMLFieldSetElement-impl.js | 43 + .../living/nodes/HTMLFontElement-impl.js | 9 + .../nodes/HTMLFormControlsCollection-impl.js | 33 + .../living/nodes/HTMLFormElement-impl.js | 228 + .../living/nodes/HTMLFrameElement-impl.js | 273 + .../living/nodes/HTMLFrameSetElement-impl.js | 12 + .../jsdom/living/nodes/HTMLHRElement-impl.js | 9 + .../living/nodes/HTMLHeadElement-impl.js | 9 + .../living/nodes/HTMLHeadingElement-impl.js | 9 + .../living/nodes/HTMLHtmlElement-impl.js | 9 + .../nodes/HTMLHyperlinkElementUtils-impl.js | 368 + .../living/nodes/HTMLIFrameElement-impl.js | 9 + .../living/nodes/HTMLImageElement-impl.js | 129 + .../living/nodes/HTMLInputElement-impl.js | 1113 + .../jsdom/living/nodes/HTMLLIElement-impl.js | 9 + .../living/nodes/HTMLLabelElement-impl.js | 86 + .../living/nodes/HTMLLegendElement-impl.js | 18 + .../living/nodes/HTMLLinkElement-impl.js | 107 + .../jsdom/living/nodes/HTMLMapElement-impl.js | 13 + .../living/nodes/HTMLMarqueeElement-impl.js | 9 + .../living/nodes/HTMLMediaElement-impl.js | 131 + .../living/nodes/HTMLMenuElement-impl.js | 9 + .../living/nodes/HTMLMetaElement-impl.js | 9 + .../living/nodes/HTMLMeterElement-impl.js | 180 + .../jsdom/living/nodes/HTMLModElement-impl.js | 9 + .../living/nodes/HTMLOListElement-impl.js | 9 + .../living/nodes/HTMLObjectElement-impl.js | 26 + .../living/nodes/HTMLOptGroupElement-impl.js | 9 + .../living/nodes/HTMLOptionElement-impl.js | 194 + .../nodes/HTMLOptionsCollection-impl.js | 110 + .../living/nodes/HTMLOrSVGElement-impl.js | 54 + .../living/nodes/HTMLOutputElement-impl.js | 88 + .../living/nodes/HTMLParagraphElement-impl.js | 9 + .../living/nodes/HTMLParamElement-impl.js | 9 + .../living/nodes/HTMLPictureElement-impl.js | 9 + .../jsdom/living/nodes/HTMLPreElement-impl.js | 9 + .../living/nodes/HTMLProgressElement-impl.js | 72 + .../living/nodes/HTMLQuoteElement-impl.js | 9 + .../living/nodes/HTMLScriptElement-impl.js | 298 + .../living/nodes/HTMLSelectElement-impl.js | 272 + .../living/nodes/HTMLSlotElement-impl.js | 58 + .../living/nodes/HTMLSourceElement-impl.js | 8 + .../living/nodes/HTMLSpanElement-impl.js | 9 + .../living/nodes/HTMLStyleElement-impl.js | 83 + .../nodes/HTMLTableCaptionElement-impl.js | 9 + .../living/nodes/HTMLTableCellElement-impl.js | 40 + .../living/nodes/HTMLTableColElement-impl.js | 9 + .../living/nodes/HTMLTableElement-impl.js | 235 + .../living/nodes/HTMLTableRowElement-impl.js | 87 + .../nodes/HTMLTableSectionElement-impl.js | 61 + .../living/nodes/HTMLTemplateElement-impl.js | 67 + .../living/nodes/HTMLTextAreaElement-impl.js | 255 + .../living/nodes/HTMLTimeElement-impl.js | 9 + .../living/nodes/HTMLTitleElement-impl.js | 18 + .../living/nodes/HTMLTrackElement-impl.js | 13 + .../living/nodes/HTMLUListElement-impl.js | 9 + .../living/nodes/HTMLUnknownElement-impl.js | 9 + .../living/nodes/HTMLVideoElement-impl.js | 17 + .../lib/jsdom/living/nodes/LinkStyle-impl.js | 2 + .../jsdom/lib/jsdom/living/nodes/Node-impl.js | 1297 + .../lib/jsdom/living/nodes/NodeList-impl.js | 47 + .../nodes/NonDocumentTypeChildNode-impl.js | 27 + .../living/nodes/NonElementParentNode-impl.js | 11 + .../lib/jsdom/living/nodes/ParentNode-impl.js | 87 + .../nodes/ProcessingInstruction-impl.js | 22 + .../jsdom/living/nodes/RadioNodeList-impl.js | 49 + .../jsdom/living/nodes/SVGDefsElement-impl.js | 9 + .../jsdom/living/nodes/SVGDescElement-impl.js | 9 + .../lib/jsdom/living/nodes/SVGElement-impl.js | 64 + .../jsdom/living/nodes/SVGGElement-impl.js | 9 + .../living/nodes/SVGGraphicsElement-impl.js | 16 + .../living/nodes/SVGMetadataElement-impl.js | 9 + .../jsdom/living/nodes/SVGSVGElement-impl.js | 39 + .../living/nodes/SVGSwitchElement-impl.js | 9 + .../living/nodes/SVGSymbolElement-impl.js | 9 + .../lib/jsdom/living/nodes/SVGTests-impl.js | 42 + .../living/nodes/SVGTitleElement-impl.js | 9 + .../lib/jsdom/living/nodes/ShadowRoot-impl.js | 40 + .../lib/jsdom/living/nodes/Slotable-impl.js | 48 + .../jsdom/lib/jsdom/living/nodes/Text-impl.js | 94 + .../living/nodes/WindowEventHandlers-impl.js | 14 + .../jsdom/living/nodes/XMLDocument-impl.js | 4 + .../jsdom/living/range/AbstractRange-impl.js | 43 + .../lib/jsdom/living/range/Range-impl.js | 775 + .../jsdom/living/range/StaticRange-impl.js | 39 + .../lib/jsdom/living/range/boundary-point.js | 50 + .../jsdom/living/selection/Selection-impl.js | 351 + .../SVGAnimatedPreserveAspectRatio-impl.js | 24 + .../jsdom/living/svg/SVGAnimatedRect-impl.js | 122 + .../living/svg/SVGAnimatedString-impl.js | 42 + .../jsdom/lib/jsdom/living/svg/SVGListBase.js | 195 + .../lib/jsdom/living/svg/SVGNumber-impl.js | 48 + .../living/svg/SVGPreserveAspectRatio-impl.js | 100 + .../lib/jsdom/living/svg/SVGRect-impl.js | 143 + .../jsdom/living/svg/SVGStringList-impl.js | 16 + .../living/traversal/NodeIterator-impl.js | 127 + .../jsdom/living/traversal/TreeWalker-impl.js | 217 + .../lib/jsdom/living/traversal/helpers.js | 44 + .../jsdom/living/webidl/DOMException-impl.js | 46 + .../living/webidl/QuotaExceededError-impl.js | 33 + .../jsdom/living/websockets/WebSocket-impl.js | 212 + .../jsdom/living/webstorage/Storage-impl.js | 106 + .../lib/jsdom/living/window-properties.js | 299 + .../lib/jsdom/living/window/BarProp-impl.js | 10 + .../lib/jsdom/living/window/External-impl.js | 9 + .../lib/jsdom/living/window/History-impl.js | 148 + .../lib/jsdom/living/window/Location-impl.js | 227 + .../lib/jsdom/living/window/Screen-impl.js | 13 + .../lib/jsdom/living/window/SessionHistory.js | 156 + .../lib/jsdom/living/window/navigation.js | 85 + .../lib/jsdom/living/xhr/FormData-impl.js | 191 + .../jsdom/living/xhr/XMLHttpRequest-impl.js | 1089 + .../xhr/XMLHttpRequestEventTarget-impl.js | 16 + .../living/xhr/XMLHttpRequestUpload-impl.js | 4 + .../jsdom/living/xhr/multipart-form-data.js | 99 + .../lib/jsdom/living/xhr/xhr-sync-worker.js | 57 + .../jsdom/lib/jsdom/living/xhr/xhr-utils.js | 170 + node_modules/jsdom/lib/jsdom/utils.js | 32 + .../jsdom/lib/jsdom/virtual-console.js | 46 + node_modules/jsdom/package.json | 124 + node_modules/lru-cache/LICENSE.md | 55 + node_modules/lru-cache/README.md | 469 + .../diagnostics-channel-browser.d.ts.map | 1 + .../diagnostics-channel-browser.js.map | 1 + .../commonjs/browser/diagnostics-channel.d.ts | 5 + .../commonjs/browser/diagnostics-channel.js | 7 + .../dist/commonjs/browser/index.d.ts | 1400 + .../dist/commonjs/browser/index.d.ts.map | 1 + .../lru-cache/dist/commonjs/browser/index.js | 1733 + .../dist/commonjs/browser/index.js.map | 1 + .../dist/commonjs/browser/index.min.js | 2 + .../dist/commonjs/browser/index.min.js.map | 7 + .../lru-cache/dist/commonjs/browser/perf.d.ts | 12 + .../dist/commonjs/browser/perf.d.ts.map | 1 + .../lru-cache/dist/commonjs/browser/perf.js | 10 + .../dist/commonjs/browser/perf.js.map | 1 + .../commonjs/diagnostics-channel-cjs.cjs.map | 1 + .../diagnostics-channel-cjs.d.cts.map | 1 + .../dist/commonjs/diagnostics-channel.d.ts | 5 + .../dist/commonjs/diagnostics-channel.js | 7 + .../lru-cache/dist/commonjs/index.d.ts | 1400 + .../lru-cache/dist/commonjs/index.d.ts.map | 1 + node_modules/lru-cache/dist/commonjs/index.js | 1733 + .../lru-cache/dist/commonjs/index.js.map | 1 + .../lru-cache/dist/commonjs/index.min.js | 2 + .../lru-cache/dist/commonjs/index.min.js.map | 7 + .../node/diagnostics-channel-node.d.ts.map | 1 + .../node/diagnostics-channel-node.js.map | 1 + .../commonjs/node/diagnostics-channel.d.ts | 5 + .../dist/commonjs/node/diagnostics-channel.js | 9 + .../lru-cache/dist/commonjs/node/index.d.ts | 1400 + .../dist/commonjs/node/index.d.ts.map | 1 + .../lru-cache/dist/commonjs/node/index.js | 1733 + .../lru-cache/dist/commonjs/node/index.js.map | 1 + .../lru-cache/dist/commonjs/node/index.min.js | 2 + .../dist/commonjs/node/index.min.js.map | 7 + .../lru-cache/dist/commonjs/node/perf.d.ts | 12 + .../dist/commonjs/node/perf.d.ts.map | 1 + .../lru-cache/dist/commonjs/node/perf.js | 10 + .../lru-cache/dist/commonjs/node/perf.js.map | 1 + .../lru-cache/dist/commonjs/package.json | 3 + .../lru-cache/dist/commonjs/perf.d.ts | 12 + .../lru-cache/dist/commonjs/perf.d.ts.map | 1 + node_modules/lru-cache/dist/commonjs/perf.js | 10 + .../lru-cache/dist/commonjs/perf.js.map | 1 + .../diagnostics-channel-react-native.d.ts.map | 1 + .../diagnostics-channel-react-native.js.map | 1 + .../react-native/diagnostics-channel.d.ts | 5 + .../react-native/diagnostics-channel.js | 7 + .../dist/commonjs/react-native/index.d.ts | 1400 + .../dist/commonjs/react-native/index.d.ts.map | 1 + .../dist/commonjs/react-native/index.js | 1733 + .../dist/commonjs/react-native/index.js.map | 1 + .../dist/commonjs/react-native/perf.d.ts | 12 + .../dist/commonjs/react-native/perf.d.ts.map | 1 + .../dist/commonjs/react-native/perf.js | 10 + .../dist/commonjs/react-native/perf.js.map | 1 + .../diagnostics-channel-browser.d.ts.map | 1 + .../diagnostics-channel-browser.js.map | 1 + .../dist/esm/browser/diagnostics-channel.d.ts | 5 + .../dist/esm/browser/diagnostics-channel.js | 4 + .../lru-cache/dist/esm/browser/index.d.ts | 1400 + .../lru-cache/dist/esm/browser/index.d.ts.map | 1 + .../lru-cache/dist/esm/browser/index.js | 1729 + .../lru-cache/dist/esm/browser/index.js.map | 1 + .../lru-cache/dist/esm/browser/index.min.js | 2 + .../dist/esm/browser/index.min.js.map | 7 + .../lru-cache/dist/esm/browser/perf.d.ts | 12 + .../lru-cache/dist/esm/browser/perf.d.ts.map | 1 + .../lru-cache/dist/esm/browser/perf.js | 7 + .../lru-cache/dist/esm/browser/perf.js.map | 1 + .../esm/diagnostics-channel-esm.d.mts.map | 1 + .../dist/esm/diagnostics-channel-esm.mjs.map | 1 + .../dist/esm/diagnostics-channel.d.ts | 5 + .../lru-cache/dist/esm/diagnostics-channel.js | 19 + node_modules/lru-cache/dist/esm/index.d.ts | 1400 + .../lru-cache/dist/esm/index.d.ts.map | 1 + node_modules/lru-cache/dist/esm/index.js | 1729 + node_modules/lru-cache/dist/esm/index.js.map | 1 + node_modules/lru-cache/dist/esm/index.min.js | 2 + .../lru-cache/dist/esm/index.min.js.map | 7 + .../node/diagnostics-channel-node.d.ts.map | 1 + .../esm/node/diagnostics-channel-node.js.map | 1 + .../dist/esm/node/diagnostics-channel.d.ts | 5 + .../dist/esm/node/diagnostics-channel.js | 6 + .../lru-cache/dist/esm/node/index.d.ts | 1400 + .../lru-cache/dist/esm/node/index.d.ts.map | 1 + node_modules/lru-cache/dist/esm/node/index.js | 1729 + .../lru-cache/dist/esm/node/index.js.map | 1 + .../lru-cache/dist/esm/node/index.min.js | 2 + .../lru-cache/dist/esm/node/index.min.js.map | 7 + .../lru-cache/dist/esm/node/perf.d.ts | 12 + .../lru-cache/dist/esm/node/perf.d.ts.map | 1 + node_modules/lru-cache/dist/esm/node/perf.js | 7 + .../lru-cache/dist/esm/node/perf.js.map | 1 + node_modules/lru-cache/dist/esm/package.json | 3 + node_modules/lru-cache/dist/esm/perf.d.ts | 12 + node_modules/lru-cache/dist/esm/perf.d.ts.map | 1 + node_modules/lru-cache/dist/esm/perf.js | 7 + node_modules/lru-cache/dist/esm/perf.js.map | 1 + .../diagnostics-channel-react-native.d.ts.map | 1 + .../diagnostics-channel-react-native.js.map | 1 + .../esm/react-native/diagnostics-channel.d.ts | 5 + .../esm/react-native/diagnostics-channel.js | 4 + .../dist/esm/react-native/index.d.ts | 1400 + .../dist/esm/react-native/index.d.ts.map | 1 + .../lru-cache/dist/esm/react-native/index.js | 1729 + .../dist/esm/react-native/index.js.map | 1 + .../lru-cache/dist/esm/react-native/perf.d.ts | 12 + .../dist/esm/react-native/perf.d.ts.map | 1 + .../lru-cache/dist/esm/react-native/perf.js | 7 + .../dist/esm/react-native/perf.js.map | 1 + node_modules/lru-cache/package.json | 180 + node_modules/mdn-data/LICENSE | 116 + node_modules/mdn-data/README.md | 59 + node_modules/mdn-data/api/index.js | 3 + node_modules/mdn-data/api/inheritance.json | 2681 + .../mdn-data/api/inheritance.schema.json | 31 + node_modules/mdn-data/css/at-rules.json | 581 + .../mdn-data/css/at-rules.schema.json | 137 + node_modules/mdn-data/css/definitions.json | 82 + node_modules/mdn-data/css/functions.json | 839 + .../mdn-data/css/functions.schema.json | 45 + node_modules/mdn-data/css/index.js | 9 + node_modules/mdn-data/css/properties.json | 11881 ++++ .../mdn-data/css/properties.schema.json | 472 + node_modules/mdn-data/css/selectors.json | 1134 + .../mdn-data/css/selectors.schema.json | 37 + node_modules/mdn-data/css/syntaxes.json | 1136 + .../mdn-data/css/syntaxes.schema.json | 15 + node_modules/mdn-data/css/types.json | 286 + node_modules/mdn-data/css/types.schema.json | 33 + node_modules/mdn-data/css/units.json | 184 + node_modules/mdn-data/css/units.schema.json | 29 + node_modules/mdn-data/index.js | 5 + node_modules/mdn-data/l10n/css.json | 2183 + node_modules/mdn-data/l10n/index.js | 3 + node_modules/mdn-data/package.json | 38 + node_modules/parse5/LICENSE | 19 + node_modules/parse5/README.md | 38 + node_modules/parse5/dist/common/doctype.d.ts | 4 + node_modules/parse5/dist/common/doctype.js | 114 + .../parse5/dist/common/error-codes.d.ts | 67 + .../parse5/dist/common/error-codes.js | 63 + .../parse5/dist/common/foreign-content.d.ts | 9 + .../parse5/dist/common/foreign-content.js | 228 + node_modules/parse5/dist/common/html.d.ts | 289 + node_modules/parse5/dist/common/html.js | 523 + node_modules/parse5/dist/common/token.d.ts | 84 + node_modules/parse5/dist/common/token.js | 20 + node_modules/parse5/dist/common/unicode.d.ts | 42 + node_modules/parse5/dist/common/unicode.js | 62 + node_modules/parse5/dist/index.d.ts | 71 + node_modules/parse5/dist/index.js | 42 + .../dist/parser/formatting-element-list.d.ts | 36 + .../dist/parser/formatting-element-list.js | 110 + node_modules/parse5/dist/parser/index.d.ts | 221 + node_modules/parse5/dist/parser/index.js | 3245 ++ .../dist/parser/open-element-stack.d.ts | 53 + .../parse5/dist/parser/open-element-stack.js | 324 + .../parse5/dist/serializer/index.d.ts | 60 + node_modules/parse5/dist/serializer/index.js | 168 + node_modules/parse5/dist/tokenizer/index.d.ts | 247 + node_modules/parse5/dist/tokenizer/index.js | 2712 + .../parse5/dist/tokenizer/preprocessor.d.ts | 36 + .../parse5/dist/tokenizer/preprocessor.js | 196 + .../parse5/dist/tree-adapters/default.d.ts | 84 + .../parse5/dist/tree-adapters/default.js | 173 + .../parse5/dist/tree-adapters/interface.d.ts | 255 + .../parse5/dist/tree-adapters/interface.js | 1 + node_modules/parse5/package.json | 53 + node_modules/punycode/LICENSE-MIT.txt | 20 + node_modules/punycode/README.md | 148 + node_modules/punycode/package.json | 58 + node_modules/punycode/punycode.es6.js | 444 + node_modules/punycode/punycode.js | 443 + node_modules/require-from-string/index.js | 34 + node_modules/require-from-string/license | 21 + node_modules/require-from-string/package.json | 28 + node_modules/require-from-string/readme.md | 56 + node_modules/saxes/README.md | 323 + node_modules/saxes/package.json | 71 + node_modules/saxes/saxes.d.ts | 635 + node_modules/saxes/saxes.js | 2053 + node_modules/saxes/saxes.js.map | 1 + node_modules/source-map-js/LICENSE | 28 + node_modules/source-map-js/README.md | 765 + node_modules/source-map-js/lib/array-set.js | 121 + node_modules/source-map-js/lib/base64-vlq.js | 140 + node_modules/source-map-js/lib/base64.js | 67 + .../source-map-js/lib/binary-search.js | 111 + .../source-map-js/lib/mapping-list.js | 79 + node_modules/source-map-js/lib/quick-sort.js | 141 + .../lib/source-map-consumer.d.ts | 1 + .../source-map-js/lib/source-map-consumer.js | 1236 + .../lib/source-map-generator.d.ts | 1 + .../source-map-js/lib/source-map-generator.js | 446 + .../source-map-js/lib/source-node.d.ts | 1 + node_modules/source-map-js/lib/source-node.js | 420 + node_modules/source-map-js/lib/util.js | 594 + node_modules/source-map-js/package.json | 71 + node_modules/source-map-js/source-map.d.ts | 104 + node_modules/source-map-js/source-map.js | 8 + node_modules/tldts-core/LICENSE | 13 + node_modules/tldts-core/README.md | 3 + node_modules/tldts-core/dist/cjs/index.js | 960 + node_modules/tldts-core/dist/cjs/index.js.map | 1 + .../dist/cjs/src/domain-without-suffix.js | 15 + .../dist/cjs/src/domain-without-suffix.js.map | 1 + .../tldts-core/dist/cjs/src/domain.js | 83 + .../tldts-core/dist/cjs/src/domain.js.map | 1 + .../dist/cjs/src/extract-hostname.js | 442 + .../dist/cjs/src/extract-hostname.js.map | 1 + .../tldts-core/dist/cjs/src/factory.js | 164 + .../tldts-core/dist/cjs/src/factory.js.map | 1 + node_modules/tldts-core/dist/cjs/src/is-ip.js | 72 + .../tldts-core/dist/cjs/src/is-ip.js.map | 1 + .../tldts-core/dist/cjs/src/is-special-use.js | 65 + .../dist/cjs/src/is-special-use.js.map | 1 + .../tldts-core/dist/cjs/src/is-valid.js | 82 + .../tldts-core/dist/cjs/src/is-valid.js.map | 1 + .../dist/cjs/src/lookup/fast-path.js | 69 + .../dist/cjs/src/lookup/fast-path.js.map | 1 + .../dist/cjs/src/lookup/interface.js | 3 + .../dist/cjs/src/lookup/interface.js.map | 1 + .../tldts-core/dist/cjs/src/options.js | 23 + .../tldts-core/dist/cjs/src/options.js.map | 1 + .../tldts-core/dist/cjs/src/subdomain.js | 14 + .../tldts-core/dist/cjs/src/subdomain.js.map | 1 + .../tldts-core/dist/cjs/tsconfig.tsbuildinfo | 1 + node_modules/tldts-core/dist/es6/index.js | 4 + node_modules/tldts-core/dist/es6/index.js.map | 1 + .../dist/es6/src/domain-without-suffix.js | 12 + .../dist/es6/src/domain-without-suffix.js.map | 1 + .../tldts-core/dist/es6/src/domain.js | 80 + .../tldts-core/dist/es6/src/domain.js.map | 1 + .../dist/es6/src/extract-hostname.js | 438 + .../dist/es6/src/extract-hostname.js.map | 1 + .../tldts-core/dist/es6/src/factory.js | 123 + .../tldts-core/dist/es6/src/factory.js.map | 1 + node_modules/tldts-core/dist/es6/src/is-ip.js | 69 + .../tldts-core/dist/es6/src/is-ip.js.map | 1 + .../tldts-core/dist/es6/src/is-special-use.js | 62 + .../dist/es6/src/is-special-use.js.map | 1 + .../tldts-core/dist/es6/src/is-valid.js | 79 + .../tldts-core/dist/es6/src/is-valid.js.map | 1 + .../dist/es6/src/lookup/fast-path.js | 66 + .../dist/es6/src/lookup/fast-path.js.map | 1 + .../dist/es6/src/lookup/interface.js | 2 + .../dist/es6/src/lookup/interface.js.map | 1 + .../tldts-core/dist/es6/src/options.js | 20 + .../tldts-core/dist/es6/src/options.js.map | 1 + .../tldts-core/dist/es6/src/subdomain.js | 11 + .../tldts-core/dist/es6/src/subdomain.js.map | 1 + .../dist/es6/tsconfig.bundle.tsbuildinfo | 1 + node_modules/tldts-core/dist/types/index.d.ts | 4 + .../dist/types/src/domain-without-suffix.d.ts | 6 + .../tldts-core/dist/types/src/domain.d.ts | 5 + .../dist/types/src/extract-hostname.d.ts | 17 + .../tldts-core/dist/types/src/factory.d.ts | 29 + .../tldts-core/dist/types/src/is-ip.d.ts | 6 + .../dist/types/src/is-special-use.d.ts | 5 + .../tldts-core/dist/types/src/is-valid.d.ts | 15 + .../dist/types/src/lookup/fast-path.d.ts | 2 + .../dist/types/src/lookup/interface.d.ts | 9 + .../tldts-core/dist/types/src/options.d.ts | 11 + .../tldts-core/dist/types/src/subdomain.d.ts | 4 + node_modules/tldts-core/index.ts | 10 + node_modules/tldts-core/package.json | 67 + .../tldts-core/src/domain-without-suffix.ts | 14 + node_modules/tldts-core/src/domain.ts | 100 + .../tldts-core/src/extract-hostname.ts | 478 + node_modules/tldts-core/src/factory.ts | 199 + node_modules/tldts-core/src/is-ip.ts | 83 + node_modules/tldts-core/src/is-special-use.ts | 65 + node_modules/tldts-core/src/is-valid.ts | 91 + .../tldts-core/src/lookup/fast-path.ts | 80 + .../tldts-core/src/lookup/interface.ts | 10 + node_modules/tldts-core/src/options.ts | 45 + node_modules/tldts-core/src/subdomain.ts | 11 + node_modules/tldts/LICENSE | 13 + node_modules/tldts/README.md | 368 + node_modules/tldts/bin/cli.js | 21 + node_modules/tldts/dist/cjs/index.js | 1175 + node_modules/tldts/dist/cjs/index.js.map | 1 + node_modules/tldts/dist/cjs/src/data/trie.js | 12 + .../tldts/dist/cjs/src/data/trie.js.map | 1 + .../tldts/dist/cjs/src/suffix-trie.js | 170 + .../tldts/dist/cjs/src/suffix-trie.js.map | 1 + .../tldts/dist/cjs/tsconfig.tsbuildinfo | 1 + node_modules/tldts/dist/es6/index.js | 41 + node_modules/tldts/dist/es6/index.js.map | 1 + node_modules/tldts/dist/es6/src/data/trie.js | 9 + .../tldts/dist/es6/src/data/trie.js.map | 1 + .../tldts/dist/es6/src/suffix-trie.js | 167 + .../tldts/dist/es6/src/suffix-trie.js.map | 1 + .../dist/es6/tsconfig.bundle.tsbuildinfo | 1 + node_modules/tldts/dist/index.cjs.min.js | 2 + node_modules/tldts/dist/index.cjs.min.js.map | 1 + node_modules/tldts/dist/index.esm.min.js | 2 + node_modules/tldts/dist/index.esm.min.js.map | 1 + node_modules/tldts/dist/index.umd.min.js | 2 + node_modules/tldts/dist/index.umd.min.js.map | 1 + node_modules/tldts/dist/types/index.d.ts | 8 + .../tldts/dist/types/src/data/trie.d.ts | 7 + .../tldts/dist/types/src/suffix-trie.d.ts | 5 + node_modules/tldts/index.ts | 74 + node_modules/tldts/package.json | 88 + node_modules/tldts/src/data/trie.ts | 8 + node_modules/tldts/src/suffix-trie.ts | 207 + node_modules/tough-cookie/LICENSE | 12 + node_modules/tough-cookie/README.md | 195 + node_modules/tough-cookie/dist/index.cjs | 2288 + node_modules/tough-cookie/dist/index.cjs.map | 1 + node_modules/tough-cookie/dist/index.d.cts | 1806 + node_modules/tough-cookie/dist/index.d.ts | 1806 + node_modules/tough-cookie/dist/index.js | 2243 + node_modules/tough-cookie/dist/index.js.map | 1 + node_modules/tough-cookie/package.json | 148 + node_modules/tr46/LICENSE.md | 21 + node_modules/tr46/README.md | 76 + node_modules/tr46/index.js | 344 + node_modules/tr46/lib/mappingTable.json | 1 + node_modules/tr46/lib/regexes.js | 29 + node_modules/tr46/lib/statusMapping.js | 9 + node_modules/tr46/package.json | 48 + node_modules/undici/LICENSE | 21 + node_modules/undici/README.md | 828 + node_modules/undici/docs/docs/api/Agent.md | 291 + .../undici/docs/docs/api/BalancedPool.md | 297 + .../undici/docs/docs/api/CacheStorage.md | 188 + .../undici/docs/docs/api/CacheStore.md | 375 + node_modules/undici/docs/docs/api/Client.md | 533 + .../undici/docs/docs/api/ClientStats.md | 93 + .../undici/docs/docs/api/Connector.md | 198 + .../undici/docs/docs/api/ContentType.md | 97 + node_modules/undici/docs/docs/api/Cookies.md | 179 + node_modules/undici/docs/docs/api/Debug.md | 78 + .../docs/docs/api/DiagnosticsChannel.md | 518 + .../undici/docs/docs/api/Dispatcher.md | 839 + .../undici/docs/docs/api/EnvHttpProxyAgent.md | 171 + node_modules/undici/docs/docs/api/Errors.md | 624 + .../undici/docs/docs/api/EventSource.md | 358 + node_modules/undici/docs/docs/api/Fetch.md | 721 + .../docs/docs/api/GlobalInstallation.md | 121 + .../undici/docs/docs/api/H2CClient.md | 386 + .../undici/docs/docs/api/Interceptors.md | 426 + .../undici/docs/docs/api/MockAgent.md | 622 + .../undici/docs/docs/api/MockCallHistory.md | 371 + .../docs/docs/api/MockCallHistoryLog.md | 206 + .../undici/docs/docs/api/MockClient.md | 199 + .../undici/docs/docs/api/MockErrors.md | 63 + node_modules/undici/docs/docs/api/MockPool.md | 618 + node_modules/undici/docs/docs/api/Pool.md | 278 + .../undici/docs/docs/api/PoolStats.md | 141 + .../undici/docs/docs/api/ProxyAgent.md | 248 + .../undici/docs/docs/api/RedirectHandler.md | 279 + .../undici/docs/docs/api/RetryAgent.md | 136 + .../undici/docs/docs/api/RetryHandler.md | 200 + .../undici/docs/docs/api/RoundRobinPool.md | 239 + .../undici/docs/docs/api/SnapshotAgent.md | 361 + .../undici/docs/docs/api/Socks5ProxyAgent.md | 256 + node_modules/undici/docs/docs/api/Util.md | 82 + .../undici/docs/docs/api/WebSocket.md | 536 + .../undici/docs/docs/api/api-lifecycle.md | 159 + .../docs/best-practices/client-certificate.md | 66 + .../docs/docs/best-practices/crawling.md | 60 + .../best-practices/migrating-from-v7-to-v8.md | 233 + .../docs/best-practices/mocking-request.md | 192 + .../undici/docs/docs/best-practices/proxy.md | 129 + .../best-practices/undici-vs-builtin-fetch.md | 226 + .../docs/docs/best-practices/writing-tests.md | 65 + .../undici/docs/docs/getting-started.md | 281 + node_modules/undici/docs/docs/index.md | 793 + node_modules/undici/docs/docs/site.json | 125 + node_modules/undici/docs/docs/type-map.json | 79 + node_modules/undici/index-fetch.js | 65 + node_modules/undici/index.d.ts | 3 + node_modules/undici/index.js | 236 + node_modules/undici/lib/api/abort-signal.js | 59 + node_modules/undici/lib/api/api-connect.js | 112 + node_modules/undici/lib/api/api-pipeline.js | 265 + node_modules/undici/lib/api/api-request.js | 244 + node_modules/undici/lib/api/api-stream.js | 270 + node_modules/undici/lib/api/api-upgrade.js | 121 + node_modules/undici/lib/api/index.js | 7 + node_modules/undici/lib/api/readable.js | 615 + .../undici/lib/cache/memory-cache-store.js | 314 + .../undici/lib/cache/sqlite-cache-store.js | 547 + node_modules/undici/lib/core/connect.js | 198 + node_modules/undici/lib/core/constants.js | 131 + node_modules/undici/lib/core/diagnostics.js | 227 + node_modules/undici/lib/core/errors.js | 534 + node_modules/undici/lib/core/request.js | 582 + node_modules/undici/lib/core/socks5-client.js | 422 + node_modules/undici/lib/core/socks5-utils.js | 212 + node_modules/undici/lib/core/symbols.js | 80 + node_modules/undici/lib/core/tree.js | 160 + node_modules/undici/lib/core/util.js | 1035 + node_modules/undici/lib/dispatcher/agent.js | 177 + .../undici/lib/dispatcher/balanced-pool.js | 217 + .../undici/lib/dispatcher/client-h1.js | 1846 + .../undici/lib/dispatcher/client-h2.js | 1861 + node_modules/undici/lib/dispatcher/client.js | 749 + .../undici/lib/dispatcher/dispatcher-base.js | 198 + .../undici/lib/dispatcher/dispatcher.js | 58 + .../lib/dispatcher/dispatcher1-wrapper.js | 127 + .../lib/dispatcher/env-http-proxy-agent.js | 190 + .../undici/lib/dispatcher/fixed-queue.js | 135 + .../undici/lib/dispatcher/h2c-client.js | 51 + .../undici/lib/dispatcher/parser-h1.js | 1064 + .../undici/lib/dispatcher/pool-base.js | 330 + node_modules/undici/lib/dispatcher/pool.js | 229 + .../undici/lib/dispatcher/proxy-agent.js | 418 + .../undici/lib/dispatcher/retry-agent.js | 48 + .../undici/lib/dispatcher/round-robin-pool.js | 169 + .../lib/dispatcher/socks5-proxy-agent.js | 350 + node_modules/undici/lib/encoding/index.js | 33 + node_modules/undici/lib/global.js | 82 + .../undici/lib/handler/cache-handler.js | 898 + .../lib/handler/cache-revalidation-handler.js | 134 + .../undici/lib/handler/decorator-handler.js | 72 + .../lib/handler/deduplication-handler.js | 496 + .../undici/lib/handler/redirect-handler.js | 249 + .../undici/lib/handler/retry-handler.js | 686 + node_modules/undici/lib/interceptor/cache.js | 682 + .../undici/lib/interceptor/decompress.js | 564 + .../undici/lib/interceptor/deduplicate.js | 118 + node_modules/undici/lib/interceptor/dns.js | 593 + node_modules/undici/lib/interceptor/dump.js | 99 + .../undici/lib/interceptor/redirect.js | 21 + .../undici/lib/interceptor/response-error.js | 139 + node_modules/undici/lib/interceptor/retry.js | 19 + node_modules/undici/lib/llhttp/constants.d.ts | 195 + node_modules/undici/lib/llhttp/constants.js | 531 + node_modules/undici/lib/llhttp/llhttp-wasm.js | 15 + .../undici/lib/llhttp/llhttp_simd-wasm.js | 15 + node_modules/undici/lib/llhttp/utils.d.ts | 2 + node_modules/undici/lib/llhttp/utils.js | 12 + node_modules/undici/lib/milo/LICENSE.md | 7 + node_modules/undici/lib/milo/no-simd.js | 1002 + node_modules/undici/lib/milo/simd.js | 1002 + node_modules/undici/lib/mock/mock-agent.js | 255 + .../undici/lib/mock/mock-call-history.js | 248 + node_modules/undici/lib/mock/mock-client.js | 68 + node_modules/undici/lib/mock/mock-errors.js | 29 + .../undici/lib/mock/mock-interceptor.js | 227 + node_modules/undici/lib/mock/mock-pool.js | 68 + node_modules/undici/lib/mock/mock-symbols.js | 32 + node_modules/undici/lib/mock/mock-utils.js | 720 + .../mock/pending-interceptors-formatter.js | 43 + .../undici/lib/mock/snapshot-agent.js | 371 + .../undici/lib/mock/snapshot-recorder.js | 624 + .../undici/lib/mock/snapshot-utils.js | 159 + node_modules/undici/lib/util/cache.js | 764 + node_modules/undici/lib/util/date.js | 670 + .../undici/lib/util/runtime-features.js | 93 + node_modules/undici/lib/util/stats.js | 32 + node_modules/undici/lib/util/timers.js | 425 + node_modules/undici/lib/web/cache/cache.js | 871 + .../undici/lib/web/cache/cachestorage.js | 158 + node_modules/undici/lib/web/cache/util.js | 45 + .../undici/lib/web/cookies/constants.js | 12 + node_modules/undici/lib/web/cookies/index.js | 211 + node_modules/undici/lib/web/cookies/parse.js | 318 + node_modules/undici/lib/web/cookies/util.js | 371 + .../lib/web/eventsource/eventsource-stream.js | 553 + .../undici/lib/web/eventsource/eventsource.js | 547 + .../undici/lib/web/eventsource/util.js | 60 + node_modules/undici/lib/web/fetch/LICENSE | 21 + node_modules/undici/lib/web/fetch/body.js | 563 + .../undici/lib/web/fetch/constants.js | 131 + node_modules/undici/lib/web/fetch/data-url.js | 596 + .../undici/lib/web/fetch/formdata-parser.js | 594 + node_modules/undici/lib/web/fetch/formdata.js | 272 + node_modules/undici/lib/web/fetch/global.js | 40 + node_modules/undici/lib/web/fetch/headers.js | 722 + node_modules/undici/lib/web/fetch/index.js | 2457 + node_modules/undici/lib/web/fetch/request.js | 1139 + node_modules/undici/lib/web/fetch/response.js | 638 + node_modules/undici/lib/web/fetch/util.js | 1530 + node_modules/undici/lib/web/infra/index.js | 244 + .../lib/web/subresource-integrity/Readme.md | 9 + .../subresource-integrity.js | 307 + node_modules/undici/lib/web/webidl/index.js | 992 + .../undici/lib/web/websocket/connection.js | 350 + .../undici/lib/web/websocket/constants.js | 126 + .../undici/lib/web/websocket/events.js | 348 + .../undici/lib/web/websocket/frame.js | 127 + .../lib/web/websocket/permessage-deflate.js | 105 + .../undici/lib/web/websocket/receiver.js | 517 + .../undici/lib/web/websocket/sender.js | 109 + .../web/websocket/stream/websocketerror.js | 107 + .../web/websocket/stream/websocketstream.js | 511 + node_modules/undici/lib/web/websocket/util.js | 347 + .../undici/lib/web/websocket/websocket.js | 783 + node_modules/undici/package.json | 154 + node_modules/undici/scripts/strip-comments.js | 10 + node_modules/undici/types/README.md | 6 + node_modules/undici/types/agent.d.ts | 30 + node_modules/undici/types/api.d.ts | 43 + node_modules/undici/types/balanced-pool.d.ts | 30 + .../undici/types/cache-interceptor.d.ts | 189 + node_modules/undici/types/cache.d.ts | 36 + node_modules/undici/types/client-stats.d.ts | 15 + node_modules/undici/types/client.d.ts | 186 + node_modules/undici/types/connector.d.ts | 37 + node_modules/undici/types/content-type.d.ts | 21 + node_modules/undici/types/cookies.d.ts | 30 + .../undici/types/diagnostics-channel.d.ts | 75 + node_modules/undici/types/dispatcher.d.ts | 253 + .../undici/types/dispatcher1-wrapper.d.ts | 7 + .../undici/types/env-http-proxy-agent.d.ts | 22 + node_modules/undici/types/errors.d.ts | 202 + node_modules/undici/types/eventsource.d.ts | 66 + node_modules/undici/types/fetch.d.ts | 235 + node_modules/undici/types/formdata.d.ts | 108 + .../undici/types/global-dispatcher.d.ts | 9 + node_modules/undici/types/global-origin.d.ts | 7 + node_modules/undici/types/h2c-client.d.ts | 73 + node_modules/undici/types/handlers.d.ts | 16 + node_modules/undici/types/header.d.ts | 165 + node_modules/undici/types/index.d.ts | 93 + node_modules/undici/types/interceptors.d.ts | 87 + node_modules/undici/types/mock-agent.d.ts | 69 + .../undici/types/mock-call-history.d.ts | 111 + node_modules/undici/types/mock-client.d.ts | 27 + node_modules/undici/types/mock-errors.d.ts | 12 + .../undici/types/mock-interceptor.d.ts | 98 + node_modules/undici/types/mock-pool.d.ts | 27 + node_modules/undici/types/patch.d.ts | 29 + node_modules/undici/types/pool-stats.d.ts | 19 + node_modules/undici/types/pool.d.ts | 39 + node_modules/undici/types/proxy-agent.d.ts | 36 + node_modules/undici/types/readable.d.ts | 68 + node_modules/undici/types/retry-agent.d.ts | 8 + node_modules/undici/types/retry-handler.d.ts | 125 + .../undici/types/round-robin-pool.d.ts | 39 + node_modules/undici/types/snapshot-agent.d.ts | 113 + .../undici/types/socks5-proxy-agent.d.ts | 27 + node_modules/undici/types/util.d.ts | 18 + node_modules/undici/types/utility.d.ts | 7 + node_modules/undici/types/webidl.d.ts | 352 + node_modules/undici/types/websocket.d.ts | 188 + node_modules/w3c-xmlserializer/LICENSE.md | 25 + node_modules/w3c-xmlserializer/README.md | 41 + .../w3c-xmlserializer/lib/attributes.js | 127 + .../w3c-xmlserializer/lib/constants.js | 46 + .../w3c-xmlserializer/lib/serialize.js | 360 + node_modules/w3c-xmlserializer/package.json | 37 + node_modules/webidl-conversions/LICENSE.md | 12 + node_modules/webidl-conversions/README.md | 99 + node_modules/webidl-conversions/lib/index.js | 436 + node_modules/webidl-conversions/package.json | 34 + node_modules/whatwg-mimetype/LICENSE.txt | 7 + node_modules/whatwg-mimetype/README.md | 132 + node_modules/whatwg-mimetype/lib/index.js | 4 + .../lib/mime-type-parameters.js | 70 + node_modules/whatwg-mimetype/lib/mime-type.js | 127 + node_modules/whatwg-mimetype/lib/parser.js | 105 + .../whatwg-mimetype/lib/serializer.js | 25 + node_modules/whatwg-mimetype/lib/sniff.js | 751 + node_modules/whatwg-mimetype/lib/utils.js | 60 + node_modules/whatwg-mimetype/package.json | 44 + node_modules/whatwg-url/LICENSE.txt | 21 + node_modules/whatwg-url/README.md | 117 + node_modules/whatwg-url/index.js | 30 + node_modules/whatwg-url/lib/Function.js | 42 + node_modules/whatwg-url/lib/URL-impl.js | 234 + node_modules/whatwg-url/lib/URL.js | 395 + .../whatwg-url/lib/URLSearchParams-impl.js | 135 + .../whatwg-url/lib/URLSearchParams.js | 450 + node_modules/whatwg-url/lib/VoidFunction.js | 26 + node_modules/whatwg-url/lib/encoding.js | 16 + node_modules/whatwg-url/lib/infra.js | 36 + .../whatwg-url/lib/percent-encoding.js | 147 + .../whatwg-url/lib/url-miscellaneous.js | 221 + .../whatwg-url/lib/url-state-machine.js | 1230 + .../whatwg-url/lib/url-string-validator.js | 438 + node_modules/whatwg-url/lib/urlencoded.js | 89 + node_modules/whatwg-url/lib/utils.js | 423 + node_modules/whatwg-url/package.json | 57 + node_modules/whatwg-url/webidl2js-wrapper.js | 7 + node_modules/xml-name-validator/LICENSE.txt | 176 + node_modules/xml-name-validator/README.md | 35 + .../lib/xml-name-validator.js | 9 + node_modules/xml-name-validator/package.json | 30 + node_modules/xmlchars/LICENSE | 18 + node_modules/xmlchars/README.md | 33 + node_modules/xmlchars/package.json | 51 + node_modules/xmlchars/xml/1.0/ed4.d.ts | 31 + node_modules/xmlchars/xml/1.0/ed4.js | 44 + node_modules/xmlchars/xml/1.0/ed4.js.map | 1 + node_modules/xmlchars/xml/1.0/ed5.d.ts | 51 + node_modules/xmlchars/xml/1.0/ed5.js | 105 + node_modules/xmlchars/xml/1.0/ed5.js.map | 1 + node_modules/xmlchars/xml/1.1/ed2.d.ts | 73 + node_modules/xmlchars/xml/1.1/ed2.js | 145 + node_modules/xmlchars/xml/1.1/ed2.js.map | 1 + node_modules/xmlchars/xmlchars.d.ts | 170 + node_modules/xmlchars/xmlchars.js | 191 + node_modules/xmlchars/xmlchars.js.map | 1 + node_modules/xmlchars/xmlns/1.0/ed3.d.ts | 28 + node_modules/xmlchars/xmlns/1.0/ed3.js | 65 + node_modules/xmlchars/xmlns/1.0/ed3.js.map | 1 + oct13_export.csv | 3187 + roadmap-data.json | 357 + smoke_test.js | 137 + uat-outreach-statuses-2026-10-19.json | 130 + uat_new_section.js | 261 + wa_section.js | 106 + 1865 files changed, 415595 insertions(+) create mode 100644 BA-Daily-Checklist.html create mode 100644 ServiceMeow-HQ.html create mode 100644 UAT-Outreach-Tracker.html create mode 100644 Web Team ServiceMeow - Roadmap.html create mode 100644 build_hub.mjs create mode 120000 node_modules/.bin/specificity create mode 120000 node_modules/.bin/tldts create mode 100644 node_modules/.package-lock.json create mode 100644 node_modules/@asamuzakjp/css-color/LICENSE create mode 100644 node_modules/@asamuzakjp/css-color/README.md create mode 100644 node_modules/@asamuzakjp/css-color/dist/esm/converters/convert-color.d.ts create mode 100644 node_modules/@asamuzakjp/css-color/dist/esm/converters/convert-hex.d.ts create mode 100644 node_modules/@asamuzakjp/css-color/dist/esm/converters/convert.d.ts create mode 100644 node_modules/@asamuzakjp/css-color/dist/esm/gradients/gradient-util.d.ts create mode 100644 node_modules/@asamuzakjp/css-color/dist/esm/gradients/gradient.d.ts create mode 100644 node_modules/@asamuzakjp/css-color/dist/esm/gradients/parse-gradient.d.ts create mode 100644 node_modules/@asamuzakjp/css-color/dist/esm/index.d.ts create mode 100644 node_modules/@asamuzakjp/css-color/dist/esm/index.js create mode 100644 node_modules/@asamuzakjp/css-color/dist/esm/matrix/matrix.d.ts create mode 100644 node_modules/@asamuzakjp/css-color/dist/esm/matrix/transform.d.ts create mode 100644 node_modules/@asamuzakjp/css-color/dist/esm/resolvers/color-mix.d.ts create mode 100644 node_modules/@asamuzakjp/css-color/dist/esm/resolvers/named-color.d.ts create mode 100644 node_modules/@asamuzakjp/css-color/dist/esm/resolvers/parse-color.d.ts create mode 100644 node_modules/@asamuzakjp/css-color/dist/esm/resolvers/relative-color.d.ts create mode 100644 node_modules/@asamuzakjp/css-color/dist/esm/resolvers/resolve-color.d.ts create mode 100644 node_modules/@asamuzakjp/css-color/dist/esm/resolvers/resolve.d.ts create mode 100644 node_modules/@asamuzakjp/css-color/dist/esm/typedef.d.ts create mode 100644 node_modules/@asamuzakjp/css-color/dist/esm/utils/cache.d.ts create mode 100644 node_modules/@asamuzakjp/css-color/dist/esm/utils/common.d.ts create mode 100644 node_modules/@asamuzakjp/css-color/dist/esm/utils/constant.d.ts create mode 100644 node_modules/@asamuzakjp/css-color/dist/esm/utils/css-calc-var.d.ts create mode 100644 node_modules/@asamuzakjp/css-color/dist/esm/utils/length-percentage.d.ts create mode 100644 node_modules/@asamuzakjp/css-color/dist/esm/utils/util.d.ts create mode 100644 node_modules/@asamuzakjp/css-color/package.json create mode 100644 node_modules/@asamuzakjp/css-color/src/converters/convert-color.ts create mode 100644 node_modules/@asamuzakjp/css-color/src/converters/convert-hex.ts create mode 100644 node_modules/@asamuzakjp/css-color/src/converters/convert.ts create mode 100644 node_modules/@asamuzakjp/css-color/src/gradients/gradient-util.ts create mode 100644 node_modules/@asamuzakjp/css-color/src/gradients/gradient.ts create mode 100644 node_modules/@asamuzakjp/css-color/src/gradients/parse-gradient.ts create mode 100644 node_modules/@asamuzakjp/css-color/src/index.ts create mode 100644 node_modules/@asamuzakjp/css-color/src/matrix/matrix.ts create mode 100644 node_modules/@asamuzakjp/css-color/src/matrix/transform.ts create mode 100644 node_modules/@asamuzakjp/css-color/src/resolvers/color-mix.ts create mode 100644 node_modules/@asamuzakjp/css-color/src/resolvers/named-color.ts create mode 100644 node_modules/@asamuzakjp/css-color/src/resolvers/parse-color.ts create mode 100644 node_modules/@asamuzakjp/css-color/src/resolvers/relative-color.ts create mode 100644 node_modules/@asamuzakjp/css-color/src/resolvers/resolve-color.ts create mode 100644 node_modules/@asamuzakjp/css-color/src/resolvers/resolve.ts create mode 100644 node_modules/@asamuzakjp/css-color/src/typedef.ts create mode 100644 node_modules/@asamuzakjp/css-color/src/utils/cache.ts create mode 100644 node_modules/@asamuzakjp/css-color/src/utils/common.ts create mode 100644 node_modules/@asamuzakjp/css-color/src/utils/constant.ts create mode 100644 node_modules/@asamuzakjp/css-color/src/utils/css-calc-var.ts create mode 100644 node_modules/@asamuzakjp/css-color/src/utils/length-percentage.ts create mode 100644 node_modules/@asamuzakjp/css-color/src/utils/util.ts create mode 100644 node_modules/@asamuzakjp/dom-selector/LICENSE create mode 100644 node_modules/@asamuzakjp/dom-selector/README.md create mode 100644 node_modules/@asamuzakjp/dom-selector/package.json create mode 100644 node_modules/@asamuzakjp/dom-selector/src/index.js create mode 100644 node_modules/@asamuzakjp/dom-selector/src/js/constant.js create mode 100644 node_modules/@asamuzakjp/dom-selector/src/js/evaluator.js create mode 100644 node_modules/@asamuzakjp/dom-selector/src/js/event.js create mode 100644 node_modules/@asamuzakjp/dom-selector/src/js/finder.js create mode 100644 node_modules/@asamuzakjp/dom-selector/src/js/mapper.js create mode 100644 node_modules/@asamuzakjp/dom-selector/src/js/matcher.js create mode 100644 node_modules/@asamuzakjp/dom-selector/src/js/nwsapi.js create mode 100644 node_modules/@asamuzakjp/dom-selector/src/js/parser.js create mode 100644 node_modules/@asamuzakjp/dom-selector/src/js/processor.js create mode 100644 node_modules/@asamuzakjp/dom-selector/src/js/pseudo-class.js create mode 100644 node_modules/@asamuzakjp/dom-selector/src/js/selector.js create mode 100644 node_modules/@asamuzakjp/dom-selector/src/js/shadow.js create mode 100644 node_modules/@asamuzakjp/dom-selector/src/js/traverser.js create mode 100644 node_modules/@asamuzakjp/dom-selector/src/js/utility.js create mode 100644 node_modules/@asamuzakjp/dom-selector/types/index.d.ts create mode 100644 node_modules/@asamuzakjp/dom-selector/types/js/constant.d.ts create mode 100644 node_modules/@asamuzakjp/dom-selector/types/js/evaluator.d.ts create mode 100644 node_modules/@asamuzakjp/dom-selector/types/js/event.d.ts create mode 100644 node_modules/@asamuzakjp/dom-selector/types/js/finder.d.ts create mode 100644 node_modules/@asamuzakjp/dom-selector/types/js/mapper.d.ts create mode 100644 node_modules/@asamuzakjp/dom-selector/types/js/matcher.d.ts create mode 100644 node_modules/@asamuzakjp/dom-selector/types/js/nwsapi.d.ts create mode 100644 node_modules/@asamuzakjp/dom-selector/types/js/parser.d.ts create mode 100644 node_modules/@asamuzakjp/dom-selector/types/js/processor.d.ts create mode 100644 node_modules/@asamuzakjp/dom-selector/types/js/pseudo-class.d.ts create mode 100644 node_modules/@asamuzakjp/dom-selector/types/js/selector.d.ts create mode 100644 node_modules/@asamuzakjp/dom-selector/types/js/shadow.d.ts create mode 100644 node_modules/@asamuzakjp/dom-selector/types/js/traverser.d.ts create mode 100644 node_modules/@asamuzakjp/dom-selector/types/js/utility.d.ts create mode 100644 node_modules/@bramus/specificity/LICENSE create mode 100644 node_modules/@bramus/specificity/README.md create mode 100755 node_modules/@bramus/specificity/bin/cli.js create mode 100644 node_modules/@bramus/specificity/dist/index.cjs create mode 100644 node_modules/@bramus/specificity/dist/index.cjs.map create mode 100644 node_modules/@bramus/specificity/dist/index.js create mode 100644 node_modules/@bramus/specificity/dist/index.js.map create mode 100644 node_modules/@bramus/specificity/index.d.ts create mode 100644 node_modules/@bramus/specificity/package.json create mode 100644 node_modules/@bramus/specificity/src/core/calculate.js create mode 100644 node_modules/@bramus/specificity/src/core/index.js create mode 100644 node_modules/@bramus/specificity/src/index.js create mode 100644 node_modules/@bramus/specificity/src/util/compare.js create mode 100644 node_modules/@bramus/specificity/src/util/filter.js create mode 100644 node_modules/@bramus/specificity/src/util/index.js create mode 100644 node_modules/@bramus/specificity/src/util/sort.js create mode 100644 node_modules/@csstools/color-helpers/CHANGELOG.md create mode 100644 node_modules/@csstools/color-helpers/LICENSE.md create mode 100644 node_modules/@csstools/color-helpers/README.md create mode 100644 node_modules/@csstools/color-helpers/dist/index.d.ts create mode 100644 node_modules/@csstools/color-helpers/dist/index.mjs create mode 100644 node_modules/@csstools/color-helpers/package.json create mode 100644 node_modules/@csstools/css-calc/CHANGELOG.md create mode 100644 node_modules/@csstools/css-calc/LICENSE.md create mode 100644 node_modules/@csstools/css-calc/README.md create mode 100644 node_modules/@csstools/css-calc/dist/index.d.ts create mode 100644 node_modules/@csstools/css-calc/dist/index.mjs create mode 100644 node_modules/@csstools/css-calc/package.json create mode 100644 node_modules/@csstools/css-color-parser/CHANGELOG.md create mode 100644 node_modules/@csstools/css-color-parser/LICENSE.md create mode 100644 node_modules/@csstools/css-color-parser/README.md create mode 100644 node_modules/@csstools/css-color-parser/dist/index.d.ts create mode 100644 node_modules/@csstools/css-color-parser/dist/index.mjs create mode 100644 node_modules/@csstools/css-color-parser/package.json create mode 100644 node_modules/@csstools/css-parser-algorithms/CHANGELOG.md create mode 100644 node_modules/@csstools/css-parser-algorithms/LICENSE.md create mode 100644 node_modules/@csstools/css-parser-algorithms/README.md create mode 100644 node_modules/@csstools/css-parser-algorithms/dist/index.d.ts create mode 100644 node_modules/@csstools/css-parser-algorithms/dist/index.mjs create mode 100644 node_modules/@csstools/css-parser-algorithms/package.json create mode 100644 node_modules/@csstools/css-syntax-patches-for-csstree/CHANGELOG.md create mode 100644 node_modules/@csstools/css-syntax-patches-for-csstree/LICENSE.md create mode 100644 node_modules/@csstools/css-syntax-patches-for-csstree/README.md create mode 100644 node_modules/@csstools/css-syntax-patches-for-csstree/dist/index.d.ts create mode 100644 node_modules/@csstools/css-syntax-patches-for-csstree/dist/index.json create mode 100644 node_modules/@csstools/css-syntax-patches-for-csstree/package.json create mode 100644 node_modules/@csstools/css-tokenizer/CHANGELOG.md create mode 100644 node_modules/@csstools/css-tokenizer/LICENSE.md create mode 100644 node_modules/@csstools/css-tokenizer/README.md create mode 100644 node_modules/@csstools/css-tokenizer/dist/index.d.ts create mode 100644 node_modules/@csstools/css-tokenizer/dist/index.mjs create mode 100644 node_modules/@csstools/css-tokenizer/package.json create mode 100644 node_modules/@exodus/bytes/LICENSE create mode 100644 node_modules/@exodus/bytes/README.md create mode 100644 node_modules/@exodus/bytes/array.d.ts create mode 100644 node_modules/@exodus/bytes/array.js create mode 100644 node_modules/@exodus/bytes/assert.js create mode 100644 node_modules/@exodus/bytes/base32.d.ts create mode 100644 node_modules/@exodus/bytes/base32.js create mode 100644 node_modules/@exodus/bytes/base58.d.ts create mode 100644 node_modules/@exodus/bytes/base58.js create mode 100644 node_modules/@exodus/bytes/base58check.d.ts create mode 100644 node_modules/@exodus/bytes/base58check.js create mode 100644 node_modules/@exodus/bytes/base58check.node.js create mode 100644 node_modules/@exodus/bytes/base64.d.ts create mode 100644 node_modules/@exodus/bytes/base64.js create mode 100644 node_modules/@exodus/bytes/bech32.d.ts create mode 100644 node_modules/@exodus/bytes/bech32.js create mode 100644 node_modules/@exodus/bytes/bigint.d.ts create mode 100644 node_modules/@exodus/bytes/bigint.js create mode 100644 node_modules/@exodus/bytes/crc.d.ts create mode 100644 node_modules/@exodus/bytes/crc.js create mode 100644 node_modules/@exodus/bytes/crc.node.js create mode 100644 node_modules/@exodus/bytes/encoding-browser.browser.js create mode 100644 node_modules/@exodus/bytes/encoding-browser.d.ts create mode 100644 node_modules/@exodus/bytes/encoding-browser.js create mode 100644 node_modules/@exodus/bytes/encoding-browser.native.js create mode 100644 node_modules/@exodus/bytes/encoding-lite.d.ts create mode 100644 node_modules/@exodus/bytes/encoding-lite.js create mode 100644 node_modules/@exodus/bytes/encoding.d.ts create mode 100644 node_modules/@exodus/bytes/encoding.js create mode 100644 node_modules/@exodus/bytes/fallback/_utils.js create mode 100644 node_modules/@exodus/bytes/fallback/base32.js create mode 100644 node_modules/@exodus/bytes/fallback/base58check.js create mode 100644 node_modules/@exodus/bytes/fallback/base64.js create mode 100644 node_modules/@exodus/bytes/fallback/crc.js create mode 100644 node_modules/@exodus/bytes/fallback/encoding.api.js create mode 100644 node_modules/@exodus/bytes/fallback/encoding.js create mode 100644 node_modules/@exodus/bytes/fallback/encoding.labels.js create mode 100644 node_modules/@exodus/bytes/fallback/encoding.util.js create mode 100644 node_modules/@exodus/bytes/fallback/hex.js create mode 100644 node_modules/@exodus/bytes/fallback/latin1.js create mode 100644 node_modules/@exodus/bytes/fallback/multi-byte.encodings.cjs create mode 100644 node_modules/@exodus/bytes/fallback/multi-byte.encodings.json create mode 100644 node_modules/@exodus/bytes/fallback/multi-byte.js create mode 100644 node_modules/@exodus/bytes/fallback/multi-byte.table.js create mode 100644 node_modules/@exodus/bytes/fallback/percent.js create mode 100644 node_modules/@exodus/bytes/fallback/platform.browser.js create mode 100644 node_modules/@exodus/bytes/fallback/platform.js create mode 100644 node_modules/@exodus/bytes/fallback/platform.native.js create mode 100644 node_modules/@exodus/bytes/fallback/single-byte.encodings.js create mode 100644 node_modules/@exodus/bytes/fallback/single-byte.js create mode 100644 node_modules/@exodus/bytes/fallback/utf16.js create mode 100644 node_modules/@exodus/bytes/fallback/utf8.auto.browser.js create mode 100644 node_modules/@exodus/bytes/fallback/utf8.auto.js create mode 100644 node_modules/@exodus/bytes/fallback/utf8.auto.native.js create mode 100644 node_modules/@exodus/bytes/fallback/utf8.js create mode 100644 node_modules/@exodus/bytes/hex.d.ts create mode 100644 node_modules/@exodus/bytes/hex.js create mode 100644 node_modules/@exodus/bytes/hex.node.js create mode 100644 node_modules/@exodus/bytes/index.d.ts create mode 100644 node_modules/@exodus/bytes/index.js create mode 100644 node_modules/@exodus/bytes/multi-byte.d.ts create mode 100644 node_modules/@exodus/bytes/multi-byte.js create mode 100644 node_modules/@exodus/bytes/multi-byte.node.js create mode 100644 node_modules/@exodus/bytes/package.json create mode 100644 node_modules/@exodus/bytes/single-byte.d.ts create mode 100644 node_modules/@exodus/bytes/single-byte.js create mode 100644 node_modules/@exodus/bytes/single-byte.node.js create mode 100644 node_modules/@exodus/bytes/utf16.browser.js create mode 100644 node_modules/@exodus/bytes/utf16.d.ts create mode 100644 node_modules/@exodus/bytes/utf16.js create mode 100644 node_modules/@exodus/bytes/utf16.native.js create mode 100644 node_modules/@exodus/bytes/utf16.node.js create mode 100644 node_modules/@exodus/bytes/utf8.d.ts create mode 100644 node_modules/@exodus/bytes/utf8.js create mode 100644 node_modules/@exodus/bytes/utf8.node.js create mode 100644 node_modules/@exodus/bytes/whatwg.d.ts create mode 100644 node_modules/@exodus/bytes/whatwg.js create mode 100644 node_modules/@exodus/bytes/wif.d.ts create mode 100644 node_modules/@exodus/bytes/wif.js create mode 100644 node_modules/bidi-js/LICENSE.txt create mode 100644 node_modules/bidi-js/README.md create mode 100644 node_modules/bidi-js/dist/bidi.js create mode 100644 node_modules/bidi-js/dist/bidi.min.js create mode 100644 node_modules/bidi-js/dist/bidi.min.mjs create mode 100644 node_modules/bidi-js/dist/bidi.mjs create mode 100644 node_modules/bidi-js/package.json create mode 100644 node_modules/bidi-js/src/bidi.d.ts create mode 100644 node_modules/bidi-js/src/brackets.js create mode 100644 node_modules/bidi-js/src/charTypes.js create mode 100644 node_modules/bidi-js/src/data/bidiBrackets.data.js create mode 100644 node_modules/bidi-js/src/data/bidiCharTypes.data.js create mode 100644 node_modules/bidi-js/src/data/bidiMirroring.data.js create mode 100644 node_modules/bidi-js/src/embeddingLevels.js create mode 100644 node_modules/bidi-js/src/index.js create mode 100644 node_modules/bidi-js/src/mirroring.js create mode 100644 node_modules/bidi-js/src/reordering.js create mode 100644 node_modules/bidi-js/src/util/parseCharacterMap.js create mode 100644 node_modules/css-tree/LICENSE create mode 100644 node_modules/css-tree/README.md create mode 100644 node_modules/css-tree/cjs/convertor/create.cjs create mode 100644 node_modules/css-tree/cjs/convertor/index.cjs create mode 100644 node_modules/css-tree/cjs/data-patch.cjs create mode 100644 node_modules/css-tree/cjs/data.cjs create mode 100644 node_modules/css-tree/cjs/definition-syntax/SyntaxError.cjs create mode 100644 node_modules/css-tree/cjs/definition-syntax/generate.cjs create mode 100644 node_modules/css-tree/cjs/definition-syntax/index.cjs create mode 100644 node_modules/css-tree/cjs/definition-syntax/parse.cjs create mode 100644 node_modules/css-tree/cjs/definition-syntax/scanner.cjs create mode 100644 node_modules/css-tree/cjs/definition-syntax/walk.cjs create mode 100644 node_modules/css-tree/cjs/generator/create.cjs create mode 100644 node_modules/css-tree/cjs/generator/index.cjs create mode 100644 node_modules/css-tree/cjs/generator/sourceMap.cjs create mode 100644 node_modules/css-tree/cjs/generator/token-before.cjs create mode 100644 node_modules/css-tree/cjs/index.cjs create mode 100644 node_modules/css-tree/cjs/lexer/Lexer.cjs create mode 100644 node_modules/css-tree/cjs/lexer/error.cjs create mode 100644 node_modules/css-tree/cjs/lexer/generic-an-plus-b.cjs create mode 100644 node_modules/css-tree/cjs/lexer/generic-const.cjs create mode 100644 node_modules/css-tree/cjs/lexer/generic-urange.cjs create mode 100644 node_modules/css-tree/cjs/lexer/generic.cjs create mode 100644 node_modules/css-tree/cjs/lexer/index.cjs create mode 100644 node_modules/css-tree/cjs/lexer/match-graph.cjs create mode 100644 node_modules/css-tree/cjs/lexer/match.cjs create mode 100644 node_modules/css-tree/cjs/lexer/prepare-tokens.cjs create mode 100644 node_modules/css-tree/cjs/lexer/search.cjs create mode 100644 node_modules/css-tree/cjs/lexer/structure.cjs create mode 100644 node_modules/css-tree/cjs/lexer/trace.cjs create mode 100644 node_modules/css-tree/cjs/lexer/units.cjs create mode 100644 node_modules/css-tree/cjs/parser/SyntaxError.cjs create mode 100644 node_modules/css-tree/cjs/parser/create.cjs create mode 100644 node_modules/css-tree/cjs/parser/index.cjs create mode 100644 node_modules/css-tree/cjs/parser/parse-selector.cjs create mode 100644 node_modules/css-tree/cjs/parser/sequence.cjs create mode 100644 node_modules/css-tree/cjs/syntax/atrule/container.cjs create mode 100644 node_modules/css-tree/cjs/syntax/atrule/font-face.cjs create mode 100644 node_modules/css-tree/cjs/syntax/atrule/import.cjs create mode 100644 node_modules/css-tree/cjs/syntax/atrule/index.cjs create mode 100644 node_modules/css-tree/cjs/syntax/atrule/layer.cjs create mode 100644 node_modules/css-tree/cjs/syntax/atrule/media.cjs create mode 100644 node_modules/css-tree/cjs/syntax/atrule/nest.cjs create mode 100644 node_modules/css-tree/cjs/syntax/atrule/page.cjs create mode 100644 node_modules/css-tree/cjs/syntax/atrule/scope.cjs create mode 100644 node_modules/css-tree/cjs/syntax/atrule/starting-style.cjs create mode 100644 node_modules/css-tree/cjs/syntax/atrule/supports.cjs create mode 100644 node_modules/css-tree/cjs/syntax/config/generator.cjs create mode 100644 node_modules/css-tree/cjs/syntax/config/lexer.cjs create mode 100644 node_modules/css-tree/cjs/syntax/config/mix.cjs create mode 100644 node_modules/css-tree/cjs/syntax/config/parser-selector.cjs create mode 100644 node_modules/css-tree/cjs/syntax/config/parser.cjs create mode 100644 node_modules/css-tree/cjs/syntax/config/walker.cjs create mode 100644 node_modules/css-tree/cjs/syntax/create.cjs create mode 100644 node_modules/css-tree/cjs/syntax/function/expression.cjs create mode 100644 node_modules/css-tree/cjs/syntax/function/var.cjs create mode 100644 node_modules/css-tree/cjs/syntax/index.cjs create mode 100644 node_modules/css-tree/cjs/syntax/node/AnPlusB.cjs create mode 100644 node_modules/css-tree/cjs/syntax/node/Atrule.cjs create mode 100644 node_modules/css-tree/cjs/syntax/node/AtrulePrelude.cjs create mode 100644 node_modules/css-tree/cjs/syntax/node/AttributeSelector.cjs create mode 100644 node_modules/css-tree/cjs/syntax/node/Block.cjs create mode 100644 node_modules/css-tree/cjs/syntax/node/Brackets.cjs create mode 100644 node_modules/css-tree/cjs/syntax/node/CDC.cjs create mode 100644 node_modules/css-tree/cjs/syntax/node/CDO.cjs create mode 100644 node_modules/css-tree/cjs/syntax/node/ClassSelector.cjs create mode 100644 node_modules/css-tree/cjs/syntax/node/Combinator.cjs create mode 100644 node_modules/css-tree/cjs/syntax/node/Comment.cjs create mode 100644 node_modules/css-tree/cjs/syntax/node/Condition.cjs create mode 100644 node_modules/css-tree/cjs/syntax/node/Declaration.cjs create mode 100644 node_modules/css-tree/cjs/syntax/node/DeclarationList.cjs create mode 100644 node_modules/css-tree/cjs/syntax/node/Dimension.cjs create mode 100644 node_modules/css-tree/cjs/syntax/node/Feature.cjs create mode 100644 node_modules/css-tree/cjs/syntax/node/FeatureFunction.cjs create mode 100644 node_modules/css-tree/cjs/syntax/node/FeatureRange.cjs create mode 100644 node_modules/css-tree/cjs/syntax/node/Function.cjs create mode 100644 node_modules/css-tree/cjs/syntax/node/GeneralEnclosed.cjs create mode 100644 node_modules/css-tree/cjs/syntax/node/Hash.cjs create mode 100644 node_modules/css-tree/cjs/syntax/node/IdSelector.cjs create mode 100644 node_modules/css-tree/cjs/syntax/node/Identifier.cjs create mode 100644 node_modules/css-tree/cjs/syntax/node/Layer.cjs create mode 100644 node_modules/css-tree/cjs/syntax/node/LayerList.cjs create mode 100644 node_modules/css-tree/cjs/syntax/node/MediaQuery.cjs create mode 100644 node_modules/css-tree/cjs/syntax/node/MediaQueryList.cjs create mode 100644 node_modules/css-tree/cjs/syntax/node/NestingSelector.cjs create mode 100644 node_modules/css-tree/cjs/syntax/node/Nth.cjs create mode 100644 node_modules/css-tree/cjs/syntax/node/Number.cjs create mode 100644 node_modules/css-tree/cjs/syntax/node/Operator.cjs create mode 100644 node_modules/css-tree/cjs/syntax/node/Parentheses.cjs create mode 100644 node_modules/css-tree/cjs/syntax/node/Percentage.cjs create mode 100644 node_modules/css-tree/cjs/syntax/node/PseudoClassSelector.cjs create mode 100644 node_modules/css-tree/cjs/syntax/node/PseudoElementSelector.cjs create mode 100644 node_modules/css-tree/cjs/syntax/node/Ratio.cjs create mode 100644 node_modules/css-tree/cjs/syntax/node/Raw.cjs create mode 100644 node_modules/css-tree/cjs/syntax/node/Rule.cjs create mode 100644 node_modules/css-tree/cjs/syntax/node/Scope.cjs create mode 100644 node_modules/css-tree/cjs/syntax/node/Selector.cjs create mode 100644 node_modules/css-tree/cjs/syntax/node/SelectorList.cjs create mode 100644 node_modules/css-tree/cjs/syntax/node/String.cjs create mode 100644 node_modules/css-tree/cjs/syntax/node/StyleSheet.cjs create mode 100644 node_modules/css-tree/cjs/syntax/node/SupportsDeclaration.cjs create mode 100644 node_modules/css-tree/cjs/syntax/node/TypeSelector.cjs create mode 100644 node_modules/css-tree/cjs/syntax/node/UnicodeRange.cjs create mode 100644 node_modules/css-tree/cjs/syntax/node/Url.cjs create mode 100644 node_modules/css-tree/cjs/syntax/node/Value.cjs create mode 100644 node_modules/css-tree/cjs/syntax/node/WhiteSpace.cjs create mode 100644 node_modules/css-tree/cjs/syntax/node/index-generate.cjs create mode 100644 node_modules/css-tree/cjs/syntax/node/index-parse-selector.cjs create mode 100644 node_modules/css-tree/cjs/syntax/node/index-parse.cjs create mode 100644 node_modules/css-tree/cjs/syntax/node/index.cjs create mode 100644 node_modules/css-tree/cjs/syntax/pseudo/index.cjs create mode 100644 node_modules/css-tree/cjs/syntax/pseudo/lang.cjs create mode 100644 node_modules/css-tree/cjs/syntax/scope/atrulePrelude.cjs create mode 100644 node_modules/css-tree/cjs/syntax/scope/default.cjs create mode 100644 node_modules/css-tree/cjs/syntax/scope/index.cjs create mode 100644 node_modules/css-tree/cjs/syntax/scope/selector.cjs create mode 100644 node_modules/css-tree/cjs/syntax/scope/value.cjs create mode 100644 node_modules/css-tree/cjs/tokenizer/OffsetToLocation.cjs create mode 100644 node_modules/css-tree/cjs/tokenizer/TokenStream.cjs create mode 100644 node_modules/css-tree/cjs/tokenizer/adopt-buffer.cjs create mode 100644 node_modules/css-tree/cjs/tokenizer/char-code-definitions.cjs create mode 100644 node_modules/css-tree/cjs/tokenizer/index.cjs create mode 100644 node_modules/css-tree/cjs/tokenizer/names.cjs create mode 100644 node_modules/css-tree/cjs/tokenizer/types.cjs create mode 100644 node_modules/css-tree/cjs/tokenizer/utils.cjs create mode 100644 node_modules/css-tree/cjs/utils/List.cjs create mode 100644 node_modules/css-tree/cjs/utils/clone.cjs create mode 100644 node_modules/css-tree/cjs/utils/create-custom-error.cjs create mode 100644 node_modules/css-tree/cjs/utils/ident.cjs create mode 100644 node_modules/css-tree/cjs/utils/index.cjs create mode 100644 node_modules/css-tree/cjs/utils/names.cjs create mode 100644 node_modules/css-tree/cjs/utils/string.cjs create mode 100644 node_modules/css-tree/cjs/utils/url.cjs create mode 100644 node_modules/css-tree/cjs/version.cjs create mode 100644 node_modules/css-tree/cjs/walker/create.cjs create mode 100644 node_modules/css-tree/cjs/walker/index.cjs create mode 100644 node_modules/css-tree/data/patch.json create mode 100644 node_modules/css-tree/dist/csstree.esm.js create mode 100644 node_modules/css-tree/dist/csstree.js create mode 100644 node_modules/css-tree/dist/data.cjs create mode 100644 node_modules/css-tree/dist/data.js create mode 100644 node_modules/css-tree/dist/version.cjs create mode 100644 node_modules/css-tree/dist/version.js create mode 100644 node_modules/css-tree/lib/convertor/create.js create mode 100644 node_modules/css-tree/lib/convertor/index.js create mode 100644 node_modules/css-tree/lib/data-patch.js create mode 100755 node_modules/css-tree/lib/data.js create mode 100644 node_modules/css-tree/lib/definition-syntax/SyntaxError.js create mode 100644 node_modules/css-tree/lib/definition-syntax/generate.js create mode 100644 node_modules/css-tree/lib/definition-syntax/index.js create mode 100644 node_modules/css-tree/lib/definition-syntax/parse.js create mode 100644 node_modules/css-tree/lib/definition-syntax/scanner.js create mode 100644 node_modules/css-tree/lib/definition-syntax/walk.js create mode 100644 node_modules/css-tree/lib/generator/create.js create mode 100644 node_modules/css-tree/lib/generator/index.js create mode 100644 node_modules/css-tree/lib/generator/sourceMap.js create mode 100644 node_modules/css-tree/lib/generator/token-before.js create mode 100644 node_modules/css-tree/lib/index.js create mode 100644 node_modules/css-tree/lib/lexer/Lexer.js create mode 100644 node_modules/css-tree/lib/lexer/error.js create mode 100644 node_modules/css-tree/lib/lexer/generic-an-plus-b.js create mode 100644 node_modules/css-tree/lib/lexer/generic-const.js create mode 100644 node_modules/css-tree/lib/lexer/generic-urange.js create mode 100644 node_modules/css-tree/lib/lexer/generic.js create mode 100644 node_modules/css-tree/lib/lexer/index.js create mode 100644 node_modules/css-tree/lib/lexer/match-graph.js create mode 100644 node_modules/css-tree/lib/lexer/match.js create mode 100644 node_modules/css-tree/lib/lexer/prepare-tokens.js create mode 100644 node_modules/css-tree/lib/lexer/search.js create mode 100644 node_modules/css-tree/lib/lexer/structure.js create mode 100644 node_modules/css-tree/lib/lexer/trace.js create mode 100644 node_modules/css-tree/lib/lexer/units.js create mode 100644 node_modules/css-tree/lib/parser/SyntaxError.js create mode 100644 node_modules/css-tree/lib/parser/create.js create mode 100644 node_modules/css-tree/lib/parser/index.js create mode 100644 node_modules/css-tree/lib/parser/parse-selector.js create mode 100644 node_modules/css-tree/lib/parser/sequence.js create mode 100644 node_modules/css-tree/lib/syntax/atrule/container.js create mode 100644 node_modules/css-tree/lib/syntax/atrule/font-face.js create mode 100644 node_modules/css-tree/lib/syntax/atrule/import.js create mode 100644 node_modules/css-tree/lib/syntax/atrule/index.js create mode 100644 node_modules/css-tree/lib/syntax/atrule/layer.js create mode 100644 node_modules/css-tree/lib/syntax/atrule/media.js create mode 100644 node_modules/css-tree/lib/syntax/atrule/nest.js create mode 100644 node_modules/css-tree/lib/syntax/atrule/page.js create mode 100644 node_modules/css-tree/lib/syntax/atrule/scope.js create mode 100644 node_modules/css-tree/lib/syntax/atrule/starting-style.js create mode 100644 node_modules/css-tree/lib/syntax/atrule/supports.js create mode 100644 node_modules/css-tree/lib/syntax/config/generator.js create mode 100644 node_modules/css-tree/lib/syntax/config/lexer.js create mode 100644 node_modules/css-tree/lib/syntax/config/mix.js create mode 100644 node_modules/css-tree/lib/syntax/config/parser-selector.js create mode 100644 node_modules/css-tree/lib/syntax/config/parser.js create mode 100644 node_modules/css-tree/lib/syntax/config/walker.js create mode 100644 node_modules/css-tree/lib/syntax/create.js create mode 100644 node_modules/css-tree/lib/syntax/function/expression.js create mode 100644 node_modules/css-tree/lib/syntax/function/var.js create mode 100644 node_modules/css-tree/lib/syntax/index.js create mode 100644 node_modules/css-tree/lib/syntax/node/AnPlusB.js create mode 100644 node_modules/css-tree/lib/syntax/node/Atrule.js create mode 100644 node_modules/css-tree/lib/syntax/node/AtrulePrelude.js create mode 100644 node_modules/css-tree/lib/syntax/node/AttributeSelector.js create mode 100644 node_modules/css-tree/lib/syntax/node/Block.js create mode 100644 node_modules/css-tree/lib/syntax/node/Brackets.js create mode 100644 node_modules/css-tree/lib/syntax/node/CDC.js create mode 100644 node_modules/css-tree/lib/syntax/node/CDO.js create mode 100644 node_modules/css-tree/lib/syntax/node/ClassSelector.js create mode 100644 node_modules/css-tree/lib/syntax/node/Combinator.js create mode 100644 node_modules/css-tree/lib/syntax/node/Comment.js create mode 100644 node_modules/css-tree/lib/syntax/node/Condition.js create mode 100644 node_modules/css-tree/lib/syntax/node/Declaration.js create mode 100644 node_modules/css-tree/lib/syntax/node/DeclarationList.js create mode 100644 node_modules/css-tree/lib/syntax/node/Dimension.js create mode 100644 node_modules/css-tree/lib/syntax/node/Feature.js create mode 100644 node_modules/css-tree/lib/syntax/node/FeatureFunction.js create mode 100644 node_modules/css-tree/lib/syntax/node/FeatureRange.js create mode 100644 node_modules/css-tree/lib/syntax/node/Function.js create mode 100644 node_modules/css-tree/lib/syntax/node/GeneralEnclosed.js create mode 100644 node_modules/css-tree/lib/syntax/node/Hash.js create mode 100644 node_modules/css-tree/lib/syntax/node/IdSelector.js create mode 100644 node_modules/css-tree/lib/syntax/node/Identifier.js create mode 100644 node_modules/css-tree/lib/syntax/node/Layer.js create mode 100644 node_modules/css-tree/lib/syntax/node/LayerList.js create mode 100644 node_modules/css-tree/lib/syntax/node/MediaQuery.js create mode 100644 node_modules/css-tree/lib/syntax/node/MediaQueryList.js create mode 100644 node_modules/css-tree/lib/syntax/node/NestingSelector.js create mode 100644 node_modules/css-tree/lib/syntax/node/Nth.js create mode 100644 node_modules/css-tree/lib/syntax/node/Number.js create mode 100644 node_modules/css-tree/lib/syntax/node/Operator.js create mode 100644 node_modules/css-tree/lib/syntax/node/Parentheses.js create mode 100644 node_modules/css-tree/lib/syntax/node/Percentage.js create mode 100644 node_modules/css-tree/lib/syntax/node/PseudoClassSelector.js create mode 100644 node_modules/css-tree/lib/syntax/node/PseudoElementSelector.js create mode 100644 node_modules/css-tree/lib/syntax/node/Ratio.js create mode 100644 node_modules/css-tree/lib/syntax/node/Raw.js create mode 100644 node_modules/css-tree/lib/syntax/node/Rule.js create mode 100644 node_modules/css-tree/lib/syntax/node/Scope.js create mode 100644 node_modules/css-tree/lib/syntax/node/Selector.js create mode 100644 node_modules/css-tree/lib/syntax/node/SelectorList.js create mode 100644 node_modules/css-tree/lib/syntax/node/String.js create mode 100644 node_modules/css-tree/lib/syntax/node/StyleSheet.js create mode 100644 node_modules/css-tree/lib/syntax/node/SupportsDeclaration.js create mode 100644 node_modules/css-tree/lib/syntax/node/TypeSelector.js create mode 100644 node_modules/css-tree/lib/syntax/node/UnicodeRange.js create mode 100644 node_modules/css-tree/lib/syntax/node/Url.js create mode 100644 node_modules/css-tree/lib/syntax/node/Value.js create mode 100644 node_modules/css-tree/lib/syntax/node/WhiteSpace.js create mode 100644 node_modules/css-tree/lib/syntax/node/index-generate.js create mode 100644 node_modules/css-tree/lib/syntax/node/index-parse-selector.js create mode 100644 node_modules/css-tree/lib/syntax/node/index-parse.js create mode 100644 node_modules/css-tree/lib/syntax/node/index.js create mode 100644 node_modules/css-tree/lib/syntax/pseudo/index.js create mode 100644 node_modules/css-tree/lib/syntax/pseudo/lang.js create mode 100644 node_modules/css-tree/lib/syntax/scope/atrulePrelude.js create mode 100644 node_modules/css-tree/lib/syntax/scope/default.js create mode 100644 node_modules/css-tree/lib/syntax/scope/index.js create mode 100644 node_modules/css-tree/lib/syntax/scope/selector.js create mode 100644 node_modules/css-tree/lib/syntax/scope/value.js create mode 100644 node_modules/css-tree/lib/tokenizer/OffsetToLocation.js create mode 100644 node_modules/css-tree/lib/tokenizer/TokenStream.js create mode 100644 node_modules/css-tree/lib/tokenizer/adopt-buffer.js create mode 100644 node_modules/css-tree/lib/tokenizer/char-code-definitions.js create mode 100644 node_modules/css-tree/lib/tokenizer/index.js create mode 100644 node_modules/css-tree/lib/tokenizer/names.js create mode 100644 node_modules/css-tree/lib/tokenizer/types.js create mode 100644 node_modules/css-tree/lib/tokenizer/utils.js create mode 100644 node_modules/css-tree/lib/utils/List.js create mode 100644 node_modules/css-tree/lib/utils/clone.js create mode 100644 node_modules/css-tree/lib/utils/create-custom-error.js create mode 100644 node_modules/css-tree/lib/utils/ident.js create mode 100644 node_modules/css-tree/lib/utils/index.js create mode 100644 node_modules/css-tree/lib/utils/names.js create mode 100644 node_modules/css-tree/lib/utils/string.js create mode 100644 node_modules/css-tree/lib/utils/url.js create mode 100644 node_modules/css-tree/lib/version.js create mode 100644 node_modules/css-tree/lib/walker/create.js create mode 100644 node_modules/css-tree/lib/walker/index.js create mode 100644 node_modules/css-tree/package.json create mode 100644 node_modules/data-urls/LICENSE.txt create mode 100644 node_modules/data-urls/README.md create mode 100644 node_modules/data-urls/lib/parser.js create mode 100644 node_modules/data-urls/lib/utils.js create mode 100644 node_modules/data-urls/package.json create mode 100644 node_modules/decimal.js/LICENCE.md create mode 100644 node_modules/decimal.js/README.md create mode 100644 node_modules/decimal.js/decimal.d.ts create mode 100644 node_modules/decimal.js/decimal.js create mode 100644 node_modules/decimal.js/decimal.mjs create mode 100644 node_modules/decimal.js/package.json create mode 100644 node_modules/entities/LICENSE create mode 100644 node_modules/entities/dist/decode-codepoint.d.ts create mode 100644 node_modules/entities/dist/decode-codepoint.d.ts.map create mode 100644 node_modules/entities/dist/decode-codepoint.js create mode 100644 node_modules/entities/dist/decode-codepoint.js.map create mode 100644 node_modules/entities/dist/decode.d.ts create mode 100644 node_modules/entities/dist/decode.d.ts.map create mode 100644 node_modules/entities/dist/decode.js create mode 100644 node_modules/entities/dist/decode.js.map create mode 100644 node_modules/entities/dist/encode.d.ts create mode 100644 node_modules/entities/dist/encode.d.ts.map create mode 100644 node_modules/entities/dist/encode.js create mode 100644 node_modules/entities/dist/encode.js.map create mode 100644 node_modules/entities/dist/escape.d.ts create mode 100644 node_modules/entities/dist/escape.d.ts.map create mode 100644 node_modules/entities/dist/escape.js create mode 100644 node_modules/entities/dist/escape.js.map create mode 100644 node_modules/entities/dist/generated/decode-data-html.d.ts create mode 100644 node_modules/entities/dist/generated/decode-data-html.d.ts.map create mode 100644 node_modules/entities/dist/generated/decode-data-html.js create mode 100644 node_modules/entities/dist/generated/decode-data-html.js.map create mode 100644 node_modules/entities/dist/generated/decode-data-xml.d.ts create mode 100644 node_modules/entities/dist/generated/decode-data-xml.d.ts.map create mode 100644 node_modules/entities/dist/generated/decode-data-xml.js create mode 100644 node_modules/entities/dist/generated/decode-data-xml.js.map create mode 100644 node_modules/entities/dist/generated/encode-html.d.ts create mode 100644 node_modules/entities/dist/generated/encode-html.d.ts.map create mode 100644 node_modules/entities/dist/generated/encode-html.js create mode 100644 node_modules/entities/dist/generated/encode-html.js.map create mode 100644 node_modules/entities/dist/index.d.ts create mode 100644 node_modules/entities/dist/index.d.ts.map create mode 100644 node_modules/entities/dist/index.js create mode 100644 node_modules/entities/dist/index.js.map create mode 100644 node_modules/entities/dist/internal/bin-trie-flags.d.ts create mode 100644 node_modules/entities/dist/internal/bin-trie-flags.d.ts.map create mode 100644 node_modules/entities/dist/internal/bin-trie-flags.js create mode 100644 node_modules/entities/dist/internal/bin-trie-flags.js.map create mode 100644 node_modules/entities/dist/internal/decode-shared.d.ts create mode 100644 node_modules/entities/dist/internal/decode-shared.d.ts.map create mode 100644 node_modules/entities/dist/internal/decode-shared.js create mode 100644 node_modules/entities/dist/internal/decode-shared.js.map create mode 100644 node_modules/entities/package.json create mode 100644 node_modules/entities/readme.md create mode 100644 node_modules/entities/src/decode-codepoint.ts create mode 100644 node_modules/entities/src/decode.ts create mode 100644 node_modules/entities/src/encode.ts create mode 100644 node_modules/entities/src/escape.ts create mode 100644 node_modules/entities/src/generated/decode-data-html.ts create mode 100644 node_modules/entities/src/generated/decode-data-xml.ts create mode 100644 node_modules/entities/src/generated/encode-html.ts create mode 100644 node_modules/entities/src/index.ts create mode 100644 node_modules/entities/src/internal/bin-trie-flags.ts create mode 100644 node_modules/entities/src/internal/decode-shared.ts create mode 100644 node_modules/html-encoding-sniffer/LICENSE.txt create mode 100644 node_modules/html-encoding-sniffer/README.md create mode 100644 node_modules/html-encoding-sniffer/lib/html-encoding-sniffer.js create mode 100644 node_modules/html-encoding-sniffer/package.json create mode 100644 node_modules/is-potential-custom-element-name/LICENSE-MIT.txt create mode 100644 node_modules/is-potential-custom-element-name/README.md create mode 100755 node_modules/is-potential-custom-element-name/index.js create mode 100644 node_modules/is-potential-custom-element-name/package.json create mode 100644 node_modules/jsdom/LICENSE.txt create mode 100644 node_modules/jsdom/README.md create mode 100644 node_modules/jsdom/lib/api.js create mode 100644 node_modules/jsdom/lib/generated/css-property-computed-value-resolvers.js create mode 100644 node_modules/jsdom/lib/generated/css-property-definitions.js create mode 100644 node_modules/jsdom/lib/generated/css-property-descriptors.js create mode 100644 node_modules/jsdom/lib/generated/css-property-metadata.js create mode 100644 node_modules/jsdom/lib/generated/css-property-resolved-value-resolvers.js create mode 100644 node_modules/jsdom/lib/generated/event-sets.js create mode 100644 node_modules/jsdom/lib/generated/idl/AbortController.js create mode 100644 node_modules/jsdom/lib/generated/idl/AbortSignal.js create mode 100644 node_modules/jsdom/lib/generated/idl/AbstractRange.js create mode 100644 node_modules/jsdom/lib/generated/idl/AddEventListenerOptions.js create mode 100644 node_modules/jsdom/lib/generated/idl/AssignedNodesOptions.js create mode 100644 node_modules/jsdom/lib/generated/idl/Attr.js create mode 100644 node_modules/jsdom/lib/generated/idl/BarProp.js create mode 100644 node_modules/jsdom/lib/generated/idl/BeforeUnloadEvent.js create mode 100644 node_modules/jsdom/lib/generated/idl/BinaryType.js create mode 100644 node_modules/jsdom/lib/generated/idl/Blob.js create mode 100644 node_modules/jsdom/lib/generated/idl/BlobCallback.js create mode 100644 node_modules/jsdom/lib/generated/idl/BlobEvent.js create mode 100644 node_modules/jsdom/lib/generated/idl/BlobEventInit.js create mode 100644 node_modules/jsdom/lib/generated/idl/BlobPropertyBag.js create mode 100644 node_modules/jsdom/lib/generated/idl/CDATASection.js create mode 100644 node_modules/jsdom/lib/generated/idl/CSS.js create mode 100644 node_modules/jsdom/lib/generated/idl/CSSConditionRule.js create mode 100644 node_modules/jsdom/lib/generated/idl/CSSContainerRule.js create mode 100644 node_modules/jsdom/lib/generated/idl/CSSCounterStyleRule.js create mode 100644 node_modules/jsdom/lib/generated/idl/CSSFontFaceRule.js create mode 100644 node_modules/jsdom/lib/generated/idl/CSSGroupingRule.js create mode 100644 node_modules/jsdom/lib/generated/idl/CSSImportRule.js create mode 100644 node_modules/jsdom/lib/generated/idl/CSSKeyframeRule.js create mode 100644 node_modules/jsdom/lib/generated/idl/CSSKeyframesRule.js create mode 100644 node_modules/jsdom/lib/generated/idl/CSSLayerBlockRule.js create mode 100644 node_modules/jsdom/lib/generated/idl/CSSLayerStatementRule.js create mode 100644 node_modules/jsdom/lib/generated/idl/CSSMediaRule.js create mode 100644 node_modules/jsdom/lib/generated/idl/CSSNamespaceRule.js create mode 100644 node_modules/jsdom/lib/generated/idl/CSSNestedDeclarations.js create mode 100644 node_modules/jsdom/lib/generated/idl/CSSPageRule.js create mode 100644 node_modules/jsdom/lib/generated/idl/CSSRule.js create mode 100644 node_modules/jsdom/lib/generated/idl/CSSRuleList.js create mode 100644 node_modules/jsdom/lib/generated/idl/CSSScopeRule.js create mode 100644 node_modules/jsdom/lib/generated/idl/CSSStyleDeclaration.js create mode 100644 node_modules/jsdom/lib/generated/idl/CSSStyleProperties.js create mode 100644 node_modules/jsdom/lib/generated/idl/CSSStyleRule.js create mode 100644 node_modules/jsdom/lib/generated/idl/CSSStyleSheet.js create mode 100644 node_modules/jsdom/lib/generated/idl/CSSStyleSheetInit.js create mode 100644 node_modules/jsdom/lib/generated/idl/CSSSupportsRule.js create mode 100644 node_modules/jsdom/lib/generated/idl/CanPlayTypeResult.js create mode 100644 node_modules/jsdom/lib/generated/idl/CharacterData.js create mode 100644 node_modules/jsdom/lib/generated/idl/CloseEvent.js create mode 100644 node_modules/jsdom/lib/generated/idl/CloseEventInit.js create mode 100644 node_modules/jsdom/lib/generated/idl/Comment.js create mode 100644 node_modules/jsdom/lib/generated/idl/CompositionEvent.js create mode 100644 node_modules/jsdom/lib/generated/idl/CompositionEventInit.js create mode 100644 node_modules/jsdom/lib/generated/idl/Crypto.js create mode 100644 node_modules/jsdom/lib/generated/idl/CustomElementConstructor.js create mode 100644 node_modules/jsdom/lib/generated/idl/CustomElementRegistry.js create mode 100644 node_modules/jsdom/lib/generated/idl/CustomEvent.js create mode 100644 node_modules/jsdom/lib/generated/idl/CustomEventInit.js create mode 100644 node_modules/jsdom/lib/generated/idl/DOMException.js create mode 100644 node_modules/jsdom/lib/generated/idl/DOMImplementation.js create mode 100644 node_modules/jsdom/lib/generated/idl/DOMParser.js create mode 100644 node_modules/jsdom/lib/generated/idl/DOMRect.js create mode 100644 node_modules/jsdom/lib/generated/idl/DOMRectInit.js create mode 100644 node_modules/jsdom/lib/generated/idl/DOMRectReadOnly.js create mode 100644 node_modules/jsdom/lib/generated/idl/DOMStringMap.js create mode 100644 node_modules/jsdom/lib/generated/idl/DOMTokenList.js create mode 100644 node_modules/jsdom/lib/generated/idl/DeviceMotionEvent.js create mode 100644 node_modules/jsdom/lib/generated/idl/DeviceMotionEventAcceleration.js create mode 100644 node_modules/jsdom/lib/generated/idl/DeviceMotionEventAccelerationInit.js create mode 100644 node_modules/jsdom/lib/generated/idl/DeviceMotionEventInit.js create mode 100644 node_modules/jsdom/lib/generated/idl/DeviceMotionEventRotationRate.js create mode 100644 node_modules/jsdom/lib/generated/idl/DeviceMotionEventRotationRateInit.js create mode 100644 node_modules/jsdom/lib/generated/idl/DeviceOrientationEvent.js create mode 100644 node_modules/jsdom/lib/generated/idl/DeviceOrientationEventInit.js create mode 100644 node_modules/jsdom/lib/generated/idl/Document.js create mode 100644 node_modules/jsdom/lib/generated/idl/DocumentFragment.js create mode 100644 node_modules/jsdom/lib/generated/idl/DocumentReadyState.js create mode 100644 node_modules/jsdom/lib/generated/idl/DocumentType.js create mode 100644 node_modules/jsdom/lib/generated/idl/Element.js create mode 100644 node_modules/jsdom/lib/generated/idl/ElementCreationOptions.js create mode 100644 node_modules/jsdom/lib/generated/idl/ElementDefinitionOptions.js create mode 100644 node_modules/jsdom/lib/generated/idl/ElementInternals.js create mode 100644 node_modules/jsdom/lib/generated/idl/EndingType.js create mode 100644 node_modules/jsdom/lib/generated/idl/ErrorEvent.js create mode 100644 node_modules/jsdom/lib/generated/idl/ErrorEventInit.js create mode 100644 node_modules/jsdom/lib/generated/idl/Event.js create mode 100644 node_modules/jsdom/lib/generated/idl/EventHandlerNonNull.js create mode 100644 node_modules/jsdom/lib/generated/idl/EventInit.js create mode 100644 node_modules/jsdom/lib/generated/idl/EventListener.js create mode 100644 node_modules/jsdom/lib/generated/idl/EventListenerOptions.js create mode 100644 node_modules/jsdom/lib/generated/idl/EventModifierInit.js create mode 100644 node_modules/jsdom/lib/generated/idl/EventTarget.js create mode 100644 node_modules/jsdom/lib/generated/idl/External.js create mode 100644 node_modules/jsdom/lib/generated/idl/File.js create mode 100644 node_modules/jsdom/lib/generated/idl/FileList.js create mode 100644 node_modules/jsdom/lib/generated/idl/FilePropertyBag.js create mode 100644 node_modules/jsdom/lib/generated/idl/FileReader.js create mode 100644 node_modules/jsdom/lib/generated/idl/FocusEvent.js create mode 100644 node_modules/jsdom/lib/generated/idl/FocusEventInit.js create mode 100644 node_modules/jsdom/lib/generated/idl/FormData.js create mode 100644 node_modules/jsdom/lib/generated/idl/Function.js create mode 100644 node_modules/jsdom/lib/generated/idl/GetRootNodeOptions.js create mode 100644 node_modules/jsdom/lib/generated/idl/HTMLAnchorElement.js create mode 100644 node_modules/jsdom/lib/generated/idl/HTMLAreaElement.js create mode 100644 node_modules/jsdom/lib/generated/idl/HTMLAudioElement.js create mode 100644 node_modules/jsdom/lib/generated/idl/HTMLBRElement.js create mode 100644 node_modules/jsdom/lib/generated/idl/HTMLBaseElement.js create mode 100644 node_modules/jsdom/lib/generated/idl/HTMLBodyElement.js create mode 100644 node_modules/jsdom/lib/generated/idl/HTMLButtonElement.js create mode 100644 node_modules/jsdom/lib/generated/idl/HTMLCanvasElement.js create mode 100644 node_modules/jsdom/lib/generated/idl/HTMLCollection.js create mode 100644 node_modules/jsdom/lib/generated/idl/HTMLDListElement.js create mode 100644 node_modules/jsdom/lib/generated/idl/HTMLDataElement.js create mode 100644 node_modules/jsdom/lib/generated/idl/HTMLDataListElement.js create mode 100644 node_modules/jsdom/lib/generated/idl/HTMLDetailsElement.js create mode 100644 node_modules/jsdom/lib/generated/idl/HTMLDialogElement.js create mode 100644 node_modules/jsdom/lib/generated/idl/HTMLDirectoryElement.js create mode 100644 node_modules/jsdom/lib/generated/idl/HTMLDivElement.js create mode 100644 node_modules/jsdom/lib/generated/idl/HTMLElement.js create mode 100644 node_modules/jsdom/lib/generated/idl/HTMLEmbedElement.js create mode 100644 node_modules/jsdom/lib/generated/idl/HTMLFieldSetElement.js create mode 100644 node_modules/jsdom/lib/generated/idl/HTMLFontElement.js create mode 100644 node_modules/jsdom/lib/generated/idl/HTMLFormControlsCollection.js create mode 100644 node_modules/jsdom/lib/generated/idl/HTMLFormElement.js create mode 100644 node_modules/jsdom/lib/generated/idl/HTMLFrameElement.js create mode 100644 node_modules/jsdom/lib/generated/idl/HTMLFrameSetElement.js create mode 100644 node_modules/jsdom/lib/generated/idl/HTMLHRElement.js create mode 100644 node_modules/jsdom/lib/generated/idl/HTMLHeadElement.js create mode 100644 node_modules/jsdom/lib/generated/idl/HTMLHeadingElement.js create mode 100644 node_modules/jsdom/lib/generated/idl/HTMLHtmlElement.js create mode 100644 node_modules/jsdom/lib/generated/idl/HTMLIFrameElement.js create mode 100644 node_modules/jsdom/lib/generated/idl/HTMLImageElement.js create mode 100644 node_modules/jsdom/lib/generated/idl/HTMLInputElement.js create mode 100644 node_modules/jsdom/lib/generated/idl/HTMLLIElement.js create mode 100644 node_modules/jsdom/lib/generated/idl/HTMLLabelElement.js create mode 100644 node_modules/jsdom/lib/generated/idl/HTMLLegendElement.js create mode 100644 node_modules/jsdom/lib/generated/idl/HTMLLinkElement.js create mode 100644 node_modules/jsdom/lib/generated/idl/HTMLMapElement.js create mode 100644 node_modules/jsdom/lib/generated/idl/HTMLMarqueeElement.js create mode 100644 node_modules/jsdom/lib/generated/idl/HTMLMediaElement.js create mode 100644 node_modules/jsdom/lib/generated/idl/HTMLMenuElement.js create mode 100644 node_modules/jsdom/lib/generated/idl/HTMLMetaElement.js create mode 100644 node_modules/jsdom/lib/generated/idl/HTMLMeterElement.js create mode 100644 node_modules/jsdom/lib/generated/idl/HTMLModElement.js create mode 100644 node_modules/jsdom/lib/generated/idl/HTMLOListElement.js create mode 100644 node_modules/jsdom/lib/generated/idl/HTMLObjectElement.js create mode 100644 node_modules/jsdom/lib/generated/idl/HTMLOptGroupElement.js create mode 100644 node_modules/jsdom/lib/generated/idl/HTMLOptionElement.js create mode 100644 node_modules/jsdom/lib/generated/idl/HTMLOptionsCollection.js create mode 100644 node_modules/jsdom/lib/generated/idl/HTMLOutputElement.js create mode 100644 node_modules/jsdom/lib/generated/idl/HTMLParagraphElement.js create mode 100644 node_modules/jsdom/lib/generated/idl/HTMLParamElement.js create mode 100644 node_modules/jsdom/lib/generated/idl/HTMLPictureElement.js create mode 100644 node_modules/jsdom/lib/generated/idl/HTMLPreElement.js create mode 100644 node_modules/jsdom/lib/generated/idl/HTMLProgressElement.js create mode 100644 node_modules/jsdom/lib/generated/idl/HTMLQuoteElement.js create mode 100644 node_modules/jsdom/lib/generated/idl/HTMLScriptElement.js create mode 100644 node_modules/jsdom/lib/generated/idl/HTMLSelectElement.js create mode 100644 node_modules/jsdom/lib/generated/idl/HTMLSlotElement.js create mode 100644 node_modules/jsdom/lib/generated/idl/HTMLSourceElement.js create mode 100644 node_modules/jsdom/lib/generated/idl/HTMLSpanElement.js create mode 100644 node_modules/jsdom/lib/generated/idl/HTMLStyleElement.js create mode 100644 node_modules/jsdom/lib/generated/idl/HTMLTableCaptionElement.js create mode 100644 node_modules/jsdom/lib/generated/idl/HTMLTableCellElement.js create mode 100644 node_modules/jsdom/lib/generated/idl/HTMLTableColElement.js create mode 100644 node_modules/jsdom/lib/generated/idl/HTMLTableElement.js create mode 100644 node_modules/jsdom/lib/generated/idl/HTMLTableRowElement.js create mode 100644 node_modules/jsdom/lib/generated/idl/HTMLTableSectionElement.js create mode 100644 node_modules/jsdom/lib/generated/idl/HTMLTemplateElement.js create mode 100644 node_modules/jsdom/lib/generated/idl/HTMLTextAreaElement.js create mode 100644 node_modules/jsdom/lib/generated/idl/HTMLTimeElement.js create mode 100644 node_modules/jsdom/lib/generated/idl/HTMLTitleElement.js create mode 100644 node_modules/jsdom/lib/generated/idl/HTMLTrackElement.js create mode 100644 node_modules/jsdom/lib/generated/idl/HTMLUListElement.js create mode 100644 node_modules/jsdom/lib/generated/idl/HTMLUnknownElement.js create mode 100644 node_modules/jsdom/lib/generated/idl/HTMLVideoElement.js create mode 100644 node_modules/jsdom/lib/generated/idl/HashChangeEvent.js create mode 100644 node_modules/jsdom/lib/generated/idl/HashChangeEventInit.js create mode 100644 node_modules/jsdom/lib/generated/idl/Headers.js create mode 100644 node_modules/jsdom/lib/generated/idl/History.js create mode 100644 node_modules/jsdom/lib/generated/idl/InputEvent.js create mode 100644 node_modules/jsdom/lib/generated/idl/InputEventInit.js create mode 100644 node_modules/jsdom/lib/generated/idl/KeyboardEvent.js create mode 100644 node_modules/jsdom/lib/generated/idl/KeyboardEventInit.js create mode 100644 node_modules/jsdom/lib/generated/idl/Location.js create mode 100644 node_modules/jsdom/lib/generated/idl/MediaList.js create mode 100644 node_modules/jsdom/lib/generated/idl/MessageEvent.js create mode 100644 node_modules/jsdom/lib/generated/idl/MessageEventInit.js create mode 100644 node_modules/jsdom/lib/generated/idl/MimeType.js create mode 100644 node_modules/jsdom/lib/generated/idl/MimeTypeArray.js create mode 100644 node_modules/jsdom/lib/generated/idl/MouseEvent.js create mode 100644 node_modules/jsdom/lib/generated/idl/MouseEventInit.js create mode 100644 node_modules/jsdom/lib/generated/idl/MutationCallback.js create mode 100644 node_modules/jsdom/lib/generated/idl/MutationObserver.js create mode 100644 node_modules/jsdom/lib/generated/idl/MutationObserverInit.js create mode 100644 node_modules/jsdom/lib/generated/idl/MutationRecord.js create mode 100644 node_modules/jsdom/lib/generated/idl/NamedNodeMap.js create mode 100644 node_modules/jsdom/lib/generated/idl/Navigator.js create mode 100644 node_modules/jsdom/lib/generated/idl/Node.js create mode 100644 node_modules/jsdom/lib/generated/idl/NodeFilter.js create mode 100644 node_modules/jsdom/lib/generated/idl/NodeIterator.js create mode 100644 node_modules/jsdom/lib/generated/idl/NodeList.js create mode 100644 node_modules/jsdom/lib/generated/idl/OnBeforeUnloadEventHandlerNonNull.js create mode 100644 node_modules/jsdom/lib/generated/idl/OnErrorEventHandlerNonNull.js create mode 100644 node_modules/jsdom/lib/generated/idl/PageTransitionEvent.js create mode 100644 node_modules/jsdom/lib/generated/idl/PageTransitionEventInit.js create mode 100644 node_modules/jsdom/lib/generated/idl/Performance.js create mode 100644 node_modules/jsdom/lib/generated/idl/Plugin.js create mode 100644 node_modules/jsdom/lib/generated/idl/PluginArray.js create mode 100644 node_modules/jsdom/lib/generated/idl/PointerEvent.js create mode 100644 node_modules/jsdom/lib/generated/idl/PointerEventInit.js create mode 100644 node_modules/jsdom/lib/generated/idl/PopStateEvent.js create mode 100644 node_modules/jsdom/lib/generated/idl/PopStateEventInit.js create mode 100644 node_modules/jsdom/lib/generated/idl/ProcessingInstruction.js create mode 100644 node_modules/jsdom/lib/generated/idl/ProgressEvent.js create mode 100644 node_modules/jsdom/lib/generated/idl/ProgressEventInit.js create mode 100644 node_modules/jsdom/lib/generated/idl/PromiseRejectionEvent.js create mode 100644 node_modules/jsdom/lib/generated/idl/PromiseRejectionEventInit.js create mode 100644 node_modules/jsdom/lib/generated/idl/QuotaExceededError.js create mode 100644 node_modules/jsdom/lib/generated/idl/QuotaExceededErrorOptions.js create mode 100644 node_modules/jsdom/lib/generated/idl/RadioNodeList.js create mode 100644 node_modules/jsdom/lib/generated/idl/Range.js create mode 100644 node_modules/jsdom/lib/generated/idl/SVGAnimatedPreserveAspectRatio.js create mode 100644 node_modules/jsdom/lib/generated/idl/SVGAnimatedRect.js create mode 100644 node_modules/jsdom/lib/generated/idl/SVGAnimatedString.js create mode 100644 node_modules/jsdom/lib/generated/idl/SVGBoundingBoxOptions.js create mode 100644 node_modules/jsdom/lib/generated/idl/SVGDefsElement.js create mode 100644 node_modules/jsdom/lib/generated/idl/SVGDescElement.js create mode 100644 node_modules/jsdom/lib/generated/idl/SVGElement.js create mode 100644 node_modules/jsdom/lib/generated/idl/SVGGElement.js create mode 100644 node_modules/jsdom/lib/generated/idl/SVGGraphicsElement.js create mode 100644 node_modules/jsdom/lib/generated/idl/SVGMetadataElement.js create mode 100644 node_modules/jsdom/lib/generated/idl/SVGNumber.js create mode 100644 node_modules/jsdom/lib/generated/idl/SVGPreserveAspectRatio.js create mode 100644 node_modules/jsdom/lib/generated/idl/SVGRect.js create mode 100644 node_modules/jsdom/lib/generated/idl/SVGSVGElement.js create mode 100644 node_modules/jsdom/lib/generated/idl/SVGStringList.js create mode 100644 node_modules/jsdom/lib/generated/idl/SVGSwitchElement.js create mode 100644 node_modules/jsdom/lib/generated/idl/SVGSymbolElement.js create mode 100644 node_modules/jsdom/lib/generated/idl/SVGTitleElement.js create mode 100644 node_modules/jsdom/lib/generated/idl/Screen.js create mode 100644 node_modules/jsdom/lib/generated/idl/ScrollBehavior.js create mode 100644 node_modules/jsdom/lib/generated/idl/ScrollIntoViewOptions.js create mode 100644 node_modules/jsdom/lib/generated/idl/ScrollLogicalPosition.js create mode 100644 node_modules/jsdom/lib/generated/idl/ScrollOptions.js create mode 100644 node_modules/jsdom/lib/generated/idl/ScrollRestoration.js create mode 100644 node_modules/jsdom/lib/generated/idl/Selection.js create mode 100644 node_modules/jsdom/lib/generated/idl/SelectionMode.js create mode 100644 node_modules/jsdom/lib/generated/idl/ShadowRoot.js create mode 100644 node_modules/jsdom/lib/generated/idl/ShadowRootInit.js create mode 100644 node_modules/jsdom/lib/generated/idl/ShadowRootMode.js create mode 100644 node_modules/jsdom/lib/generated/idl/StaticRange.js create mode 100644 node_modules/jsdom/lib/generated/idl/StaticRangeInit.js create mode 100644 node_modules/jsdom/lib/generated/idl/Storage.js create mode 100644 node_modules/jsdom/lib/generated/idl/StorageEvent.js create mode 100644 node_modules/jsdom/lib/generated/idl/StorageEventInit.js create mode 100644 node_modules/jsdom/lib/generated/idl/StyleSheet.js create mode 100644 node_modules/jsdom/lib/generated/idl/StyleSheetList.js create mode 100644 node_modules/jsdom/lib/generated/idl/SubmitEvent.js create mode 100644 node_modules/jsdom/lib/generated/idl/SubmitEventInit.js create mode 100644 node_modules/jsdom/lib/generated/idl/SupportedType.js create mode 100644 node_modules/jsdom/lib/generated/idl/Text.js create mode 100644 node_modules/jsdom/lib/generated/idl/TextDecodeOptions.js create mode 100644 node_modules/jsdom/lib/generated/idl/TextDecoder.js create mode 100644 node_modules/jsdom/lib/generated/idl/TextDecoderOptions.js create mode 100644 node_modules/jsdom/lib/generated/idl/TextEncoder.js create mode 100644 node_modules/jsdom/lib/generated/idl/TextEncoderEncodeIntoResult.js create mode 100644 node_modules/jsdom/lib/generated/idl/TextTrackKind.js create mode 100644 node_modules/jsdom/lib/generated/idl/TouchEvent.js create mode 100644 node_modules/jsdom/lib/generated/idl/TouchEventInit.js create mode 100644 node_modules/jsdom/lib/generated/idl/TransitionEvent.js create mode 100644 node_modules/jsdom/lib/generated/idl/TransitionEventInit.js create mode 100644 node_modules/jsdom/lib/generated/idl/TreeWalker.js create mode 100644 node_modules/jsdom/lib/generated/idl/UIEvent.js create mode 100644 node_modules/jsdom/lib/generated/idl/UIEventInit.js create mode 100644 node_modules/jsdom/lib/generated/idl/ValidityState.js create mode 100644 node_modules/jsdom/lib/generated/idl/VisibilityState.js create mode 100644 node_modules/jsdom/lib/generated/idl/VoidFunction.js create mode 100644 node_modules/jsdom/lib/generated/idl/WebSocket.js create mode 100644 node_modules/jsdom/lib/generated/idl/WheelEvent.js create mode 100644 node_modules/jsdom/lib/generated/idl/WheelEventInit.js create mode 100644 node_modules/jsdom/lib/generated/idl/XMLDocument.js create mode 100644 node_modules/jsdom/lib/generated/idl/XMLHttpRequest.js create mode 100644 node_modules/jsdom/lib/generated/idl/XMLHttpRequestEventTarget.js create mode 100644 node_modules/jsdom/lib/generated/idl/XMLHttpRequestResponseType.js create mode 100644 node_modules/jsdom/lib/generated/idl/XMLHttpRequestUpload.js create mode 100644 node_modules/jsdom/lib/generated/idl/XMLSerializer.js create mode 100644 node_modules/jsdom/lib/generated/idl/utils.js create mode 100644 node_modules/jsdom/lib/generated/js-globals.json create mode 100644 node_modules/jsdom/lib/jsdom/browser/Window.js create mode 100644 node_modules/jsdom/lib/jsdom/browser/default-stylesheet.css create mode 100644 node_modules/jsdom/lib/jsdom/browser/not-implemented.js create mode 100644 node_modules/jsdom/lib/jsdom/browser/parser/html.js create mode 100644 node_modules/jsdom/lib/jsdom/browser/parser/index.js create mode 100644 node_modules/jsdom/lib/jsdom/browser/parser/xml.js create mode 100644 node_modules/jsdom/lib/jsdom/browser/resources/async-resource-queue.js create mode 100644 node_modules/jsdom/lib/jsdom/browser/resources/decompress-interceptor.js create mode 100644 node_modules/jsdom/lib/jsdom/browser/resources/jsdom-dispatcher.js create mode 100644 node_modules/jsdom/lib/jsdom/browser/resources/per-document-resource-loader.js create mode 100644 node_modules/jsdom/lib/jsdom/browser/resources/request-interceptor.js create mode 100644 node_modules/jsdom/lib/jsdom/browser/resources/request-manager.js create mode 100644 node_modules/jsdom/lib/jsdom/browser/resources/resource-queue.js create mode 100644 node_modules/jsdom/lib/jsdom/browser/resources/stream-handler.js create mode 100644 node_modules/jsdom/lib/jsdom/level3/xpath.js create mode 100644 node_modules/jsdom/lib/jsdom/living/aborting/AbortController-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/aborting/AbortSignal-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/attributes.js create mode 100644 node_modules/jsdom/lib/jsdom/living/attributes/Attr-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/attributes/NamedNodeMap-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/constraint-validation/DefaultConstraintValidation-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/constraint-validation/ValidityState-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/crypto/Crypto-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/css/CSS-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/css/CSSConditionRule-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/css/CSSContainerRule-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/css/CSSCounterStyleRule-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/css/CSSFontFaceRule-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/css/CSSGroupingRule-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/css/CSSImportRule-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/css/CSSKeyframeRule-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/css/CSSKeyframesRule-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/css/CSSLayerBlockRule-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/css/CSSLayerStatementRule-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/css/CSSMediaRule-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/css/CSSNamespaceRule-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/css/CSSNestedDeclarations-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/css/CSSPageRule-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/css/CSSRule-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/css/CSSRuleList-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/css/CSSScopeRule-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/css/CSSStyleDeclaration-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/css/CSSStyleProperties-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/css/CSSStyleRule-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/css/CSSStyleSheet-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/css/CSSSupportsRule-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/css/ElementCSSInlineStyle-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/css/MediaList-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/css/StyleSheet-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/css/StyleSheetList-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/css/helpers/computed-style.js create mode 100644 node_modules/jsdom/lib/jsdom/living/css/helpers/css-parser.js create mode 100644 node_modules/jsdom/lib/jsdom/living/css/helpers/css-values.js create mode 100644 node_modules/jsdom/lib/jsdom/living/css/helpers/font-sizes.js create mode 100644 node_modules/jsdom/lib/jsdom/living/css/helpers/generic-property-descriptor.js create mode 100644 node_modules/jsdom/lib/jsdom/living/css/helpers/line-widths.js create mode 100644 node_modules/jsdom/lib/jsdom/living/css/helpers/patched-csstree.js create mode 100644 node_modules/jsdom/lib/jsdom/living/css/helpers/shorthand-properties.js create mode 100644 node_modules/jsdom/lib/jsdom/living/css/helpers/stylesheets.js create mode 100644 node_modules/jsdom/lib/jsdom/living/css/helpers/system-colors.js create mode 100644 node_modules/jsdom/lib/jsdom/living/css/properties/background.js create mode 100644 node_modules/jsdom/lib/jsdom/living/css/properties/backgroundAttachment.js create mode 100644 node_modules/jsdom/lib/jsdom/living/css/properties/backgroundClip.js create mode 100644 node_modules/jsdom/lib/jsdom/living/css/properties/backgroundColor.js create mode 100644 node_modules/jsdom/lib/jsdom/living/css/properties/backgroundImage.js create mode 100644 node_modules/jsdom/lib/jsdom/living/css/properties/backgroundOrigin.js create mode 100644 node_modules/jsdom/lib/jsdom/living/css/properties/backgroundPosition.js create mode 100644 node_modules/jsdom/lib/jsdom/living/css/properties/backgroundPositionX.js create mode 100644 node_modules/jsdom/lib/jsdom/living/css/properties/backgroundPositionY.js create mode 100644 node_modules/jsdom/lib/jsdom/living/css/properties/backgroundRepeat.js create mode 100644 node_modules/jsdom/lib/jsdom/living/css/properties/backgroundSize.js create mode 100644 node_modules/jsdom/lib/jsdom/living/css/properties/border.js create mode 100644 node_modules/jsdom/lib/jsdom/living/css/properties/borderBottom.js create mode 100644 node_modules/jsdom/lib/jsdom/living/css/properties/borderBottomColor.js create mode 100644 node_modules/jsdom/lib/jsdom/living/css/properties/borderBottomStyle.js create mode 100644 node_modules/jsdom/lib/jsdom/living/css/properties/borderBottomWidth.js create mode 100644 node_modules/jsdom/lib/jsdom/living/css/properties/borderColor.js create mode 100644 node_modules/jsdom/lib/jsdom/living/css/properties/borderLeft.js create mode 100644 node_modules/jsdom/lib/jsdom/living/css/properties/borderLeftColor.js create mode 100644 node_modules/jsdom/lib/jsdom/living/css/properties/borderLeftStyle.js create mode 100644 node_modules/jsdom/lib/jsdom/living/css/properties/borderLeftWidth.js create mode 100644 node_modules/jsdom/lib/jsdom/living/css/properties/borderRight.js create mode 100644 node_modules/jsdom/lib/jsdom/living/css/properties/borderRightColor.js create mode 100644 node_modules/jsdom/lib/jsdom/living/css/properties/borderRightStyle.js create mode 100644 node_modules/jsdom/lib/jsdom/living/css/properties/borderRightWidth.js create mode 100644 node_modules/jsdom/lib/jsdom/living/css/properties/borderSpacing.js create mode 100644 node_modules/jsdom/lib/jsdom/living/css/properties/borderStyle.js create mode 100644 node_modules/jsdom/lib/jsdom/living/css/properties/borderTop.js create mode 100644 node_modules/jsdom/lib/jsdom/living/css/properties/borderTopColor.js create mode 100644 node_modules/jsdom/lib/jsdom/living/css/properties/borderTopStyle.js create mode 100644 node_modules/jsdom/lib/jsdom/living/css/properties/borderTopWidth.js create mode 100644 node_modules/jsdom/lib/jsdom/living/css/properties/borderWidth.js create mode 100644 node_modules/jsdom/lib/jsdom/living/css/properties/bottom.js create mode 100644 node_modules/jsdom/lib/jsdom/living/css/properties/clip.js create mode 100644 node_modules/jsdom/lib/jsdom/living/css/properties/display.js create mode 100644 node_modules/jsdom/lib/jsdom/living/css/properties/flex.js create mode 100644 node_modules/jsdom/lib/jsdom/living/css/properties/flexBasis.js create mode 100644 node_modules/jsdom/lib/jsdom/living/css/properties/flexGrow.js create mode 100644 node_modules/jsdom/lib/jsdom/living/css/properties/flexShrink.js create mode 100644 node_modules/jsdom/lib/jsdom/living/css/properties/font.js create mode 100644 node_modules/jsdom/lib/jsdom/living/css/properties/fontFamily.js create mode 100644 node_modules/jsdom/lib/jsdom/living/css/properties/fontSize.js create mode 100644 node_modules/jsdom/lib/jsdom/living/css/properties/fontStyle.js create mode 100644 node_modules/jsdom/lib/jsdom/living/css/properties/fontVariant.js create mode 100644 node_modules/jsdom/lib/jsdom/living/css/properties/fontWeight.js create mode 100644 node_modules/jsdom/lib/jsdom/living/css/properties/height.js create mode 100644 node_modules/jsdom/lib/jsdom/living/css/properties/left.js create mode 100644 node_modules/jsdom/lib/jsdom/living/css/properties/lineHeight.js create mode 100644 node_modules/jsdom/lib/jsdom/living/css/properties/margin.js create mode 100644 node_modules/jsdom/lib/jsdom/living/css/properties/marginBottom.js create mode 100644 node_modules/jsdom/lib/jsdom/living/css/properties/marginLeft.js create mode 100644 node_modules/jsdom/lib/jsdom/living/css/properties/marginRight.js create mode 100644 node_modules/jsdom/lib/jsdom/living/css/properties/marginTop.js create mode 100644 node_modules/jsdom/lib/jsdom/living/css/properties/opacity.js create mode 100644 node_modules/jsdom/lib/jsdom/living/css/properties/padding.js create mode 100644 node_modules/jsdom/lib/jsdom/living/css/properties/paddingBottom.js create mode 100644 node_modules/jsdom/lib/jsdom/living/css/properties/paddingLeft.js create mode 100644 node_modules/jsdom/lib/jsdom/living/css/properties/paddingRight.js create mode 100644 node_modules/jsdom/lib/jsdom/living/css/properties/paddingTop.js create mode 100644 node_modules/jsdom/lib/jsdom/living/css/properties/right.js create mode 100644 node_modules/jsdom/lib/jsdom/living/css/properties/top.js create mode 100644 node_modules/jsdom/lib/jsdom/living/css/properties/width.js create mode 100644 node_modules/jsdom/lib/jsdom/living/custom-elements/CustomElementRegistry-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/custom-elements/ElementInternals-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/deviceorientation/DeviceMotionEventAcceleration-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/deviceorientation/DeviceMotionEventRotationRate-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/documents.js create mode 100644 node_modules/jsdom/lib/jsdom/living/domparsing/DOMParser-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/domparsing/InnerHTML-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/domparsing/XMLSerializer-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/domparsing/parse5-adapter-serialization.js create mode 100644 node_modules/jsdom/lib/jsdom/living/domparsing/serialization.js create mode 100644 node_modules/jsdom/lib/jsdom/living/encoding/TextDecoder-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/encoding/TextEncoder-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/events/BeforeUnloadEvent-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/events/BlobEvent-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/events/CloseEvent-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/events/CompositionEvent-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/events/CustomEvent-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/events/DeviceMotionEvent-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/events/DeviceOrientationEvent-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/events/ErrorEvent-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/events/Event-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/events/EventModifierMixin-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/events/FocusEvent-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/events/HashChangeEvent-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/events/InputEvent-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/events/KeyboardEvent-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/events/MessageEvent-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/events/MouseEvent-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/events/PageTransitionEvent-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/events/PointerEvent-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/events/PopStateEvent-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/events/ProgressEvent-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/events/PromiseRejectionEvent-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/events/StorageEvent-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/events/SubmitEvent-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/events/TouchEvent-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/events/TransitionEvent-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/events/UIEvent-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/events/WheelEvent-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/fetch/Headers-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/fetch/header-list.js create mode 100644 node_modules/jsdom/lib/jsdom/living/fetch/header-types.js create mode 100644 node_modules/jsdom/lib/jsdom/living/fetch/header-utils.js create mode 100644 node_modules/jsdom/lib/jsdom/living/file-api/Blob-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/file-api/File-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/file-api/FileList-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/file-api/FileReader-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/geometry/DOMRect-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/geometry/DOMRectReadOnly-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/helpers/binary-data.js create mode 100644 node_modules/jsdom/lib/jsdom/living/helpers/by-id-cache.js create mode 100644 node_modules/jsdom/lib/jsdom/living/helpers/create-element.js create mode 100644 node_modules/jsdom/lib/jsdom/living/helpers/create-event-accessor.js create mode 100644 node_modules/jsdom/lib/jsdom/living/helpers/custom-elements.js create mode 100644 node_modules/jsdom/lib/jsdom/living/helpers/dates-and-times.js create mode 100644 node_modules/jsdom/lib/jsdom/living/helpers/details.js create mode 100644 node_modules/jsdom/lib/jsdom/living/helpers/document-named-properties.js create mode 100644 node_modules/jsdom/lib/jsdom/living/helpers/dom-tree.js create mode 100644 node_modules/jsdom/lib/jsdom/living/helpers/encoding.js create mode 100644 node_modules/jsdom/lib/jsdom/living/helpers/events.js create mode 100644 node_modules/jsdom/lib/jsdom/living/helpers/focusing.js create mode 100644 node_modules/jsdom/lib/jsdom/living/helpers/form-controls.js create mode 100644 node_modules/jsdom/lib/jsdom/living/helpers/html-collections.js create mode 100644 node_modules/jsdom/lib/jsdom/living/helpers/html-constructor.js create mode 100644 node_modules/jsdom/lib/jsdom/living/helpers/is-window.js create mode 100644 node_modules/jsdom/lib/jsdom/living/helpers/iterable-weak-list.js create mode 100644 node_modules/jsdom/lib/jsdom/living/helpers/iterable-weak-set.js create mode 100644 node_modules/jsdom/lib/jsdom/living/helpers/json.js create mode 100644 node_modules/jsdom/lib/jsdom/living/helpers/mutation-observers.js create mode 100644 node_modules/jsdom/lib/jsdom/living/helpers/namespaces.js create mode 100644 node_modules/jsdom/lib/jsdom/living/helpers/number-and-date-inputs.js create mode 100644 node_modules/jsdom/lib/jsdom/living/helpers/ordered-set.js create mode 100644 node_modules/jsdom/lib/jsdom/living/helpers/page-transition-event.js create mode 100644 node_modules/jsdom/lib/jsdom/living/helpers/runtime-script-errors.js create mode 100644 node_modules/jsdom/lib/jsdom/living/helpers/shadow-dom.js create mode 100644 node_modules/jsdom/lib/jsdom/living/helpers/strings.js create mode 100644 node_modules/jsdom/lib/jsdom/living/helpers/svg/basic-types.js create mode 100644 node_modules/jsdom/lib/jsdom/living/helpers/svg/render.js create mode 100644 node_modules/jsdom/lib/jsdom/living/helpers/text.js create mode 100644 node_modules/jsdom/lib/jsdom/living/helpers/traversal.js create mode 100644 node_modules/jsdom/lib/jsdom/living/helpers/validate-names.js create mode 100644 node_modules/jsdom/lib/jsdom/living/helpers/weak-value-map.js create mode 100644 node_modules/jsdom/lib/jsdom/living/hr-time/Performance-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/interfaces.js create mode 100644 node_modules/jsdom/lib/jsdom/living/mutation-observer/MutationObserver-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/mutation-observer/MutationRecord-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/navigator/MimeType-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/navigator/MimeTypeArray-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/navigator/Navigator-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/navigator/NavigatorConcurrentHardware-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/navigator/NavigatorCookies-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/navigator/NavigatorID-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/navigator/NavigatorLanguage-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/navigator/NavigatorOnLine-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/navigator/NavigatorPlugins-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/navigator/Plugin-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/navigator/PluginArray-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/node-document-position.js create mode 100644 node_modules/jsdom/lib/jsdom/living/node-type.js create mode 100644 node_modules/jsdom/lib/jsdom/living/node.js create mode 100644 node_modules/jsdom/lib/jsdom/living/nodes/CDATASection-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/nodes/CharacterData-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/nodes/ChildNode-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/nodes/Comment-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/nodes/DOMImplementation-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/nodes/DOMStringMap-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/nodes/DOMTokenList-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/nodes/Document-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/nodes/DocumentFragment-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/nodes/DocumentOrShadowRoot-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/nodes/DocumentType-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/nodes/Element-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/nodes/ElementContentEditable-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/nodes/GlobalEventHandlers-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/nodes/HTMLAnchorElement-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/nodes/HTMLAreaElement-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/nodes/HTMLAudioElement-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/nodes/HTMLBRElement-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/nodes/HTMLBaseElement-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/nodes/HTMLBodyElement-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/nodes/HTMLButtonElement-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/nodes/HTMLCanvasElement-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/nodes/HTMLCollection-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/nodes/HTMLDListElement-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/nodes/HTMLDataElement-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/nodes/HTMLDataListElement-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/nodes/HTMLDetailsElement-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/nodes/HTMLDialogElement-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/nodes/HTMLDirectoryElement-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/nodes/HTMLDivElement-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/nodes/HTMLElement-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/nodes/HTMLEmbedElement-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/nodes/HTMLFieldSetElement-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/nodes/HTMLFontElement-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/nodes/HTMLFormControlsCollection-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/nodes/HTMLFormElement-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/nodes/HTMLFrameElement-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/nodes/HTMLFrameSetElement-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/nodes/HTMLHRElement-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/nodes/HTMLHeadElement-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/nodes/HTMLHeadingElement-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/nodes/HTMLHtmlElement-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/nodes/HTMLHyperlinkElementUtils-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/nodes/HTMLIFrameElement-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/nodes/HTMLImageElement-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/nodes/HTMLInputElement-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/nodes/HTMLLIElement-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/nodes/HTMLLabelElement-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/nodes/HTMLLegendElement-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/nodes/HTMLLinkElement-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/nodes/HTMLMapElement-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/nodes/HTMLMarqueeElement-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/nodes/HTMLMediaElement-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/nodes/HTMLMenuElement-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/nodes/HTMLMetaElement-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/nodes/HTMLMeterElement-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/nodes/HTMLModElement-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/nodes/HTMLOListElement-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/nodes/HTMLObjectElement-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/nodes/HTMLOptGroupElement-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/nodes/HTMLOptionElement-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/nodes/HTMLOptionsCollection-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/nodes/HTMLOrSVGElement-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/nodes/HTMLOutputElement-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/nodes/HTMLParagraphElement-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/nodes/HTMLParamElement-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/nodes/HTMLPictureElement-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/nodes/HTMLPreElement-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/nodes/HTMLProgressElement-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/nodes/HTMLQuoteElement-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/nodes/HTMLScriptElement-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/nodes/HTMLSelectElement-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/nodes/HTMLSlotElement-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/nodes/HTMLSourceElement-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/nodes/HTMLSpanElement-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/nodes/HTMLStyleElement-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/nodes/HTMLTableCaptionElement-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/nodes/HTMLTableCellElement-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/nodes/HTMLTableColElement-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/nodes/HTMLTableElement-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/nodes/HTMLTableRowElement-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/nodes/HTMLTableSectionElement-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/nodes/HTMLTemplateElement-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/nodes/HTMLTextAreaElement-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/nodes/HTMLTimeElement-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/nodes/HTMLTitleElement-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/nodes/HTMLTrackElement-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/nodes/HTMLUListElement-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/nodes/HTMLUnknownElement-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/nodes/HTMLVideoElement-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/nodes/LinkStyle-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/nodes/Node-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/nodes/NodeList-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/nodes/NonDocumentTypeChildNode-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/nodes/NonElementParentNode-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/nodes/ParentNode-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/nodes/ProcessingInstruction-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/nodes/RadioNodeList-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/nodes/SVGDefsElement-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/nodes/SVGDescElement-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/nodes/SVGElement-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/nodes/SVGGElement-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/nodes/SVGGraphicsElement-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/nodes/SVGMetadataElement-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/nodes/SVGSVGElement-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/nodes/SVGSwitchElement-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/nodes/SVGSymbolElement-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/nodes/SVGTests-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/nodes/SVGTitleElement-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/nodes/ShadowRoot-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/nodes/Slotable-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/nodes/Text-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/nodes/WindowEventHandlers-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/nodes/XMLDocument-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/range/AbstractRange-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/range/Range-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/range/StaticRange-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/range/boundary-point.js create mode 100644 node_modules/jsdom/lib/jsdom/living/selection/Selection-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/svg/SVGAnimatedPreserveAspectRatio-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/svg/SVGAnimatedRect-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/svg/SVGAnimatedString-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/svg/SVGListBase.js create mode 100644 node_modules/jsdom/lib/jsdom/living/svg/SVGNumber-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/svg/SVGPreserveAspectRatio-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/svg/SVGRect-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/svg/SVGStringList-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/traversal/NodeIterator-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/traversal/TreeWalker-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/traversal/helpers.js create mode 100644 node_modules/jsdom/lib/jsdom/living/webidl/DOMException-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/webidl/QuotaExceededError-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/websockets/WebSocket-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/webstorage/Storage-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/window-properties.js create mode 100644 node_modules/jsdom/lib/jsdom/living/window/BarProp-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/window/External-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/window/History-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/window/Location-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/window/Screen-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/window/SessionHistory.js create mode 100644 node_modules/jsdom/lib/jsdom/living/window/navigation.js create mode 100644 node_modules/jsdom/lib/jsdom/living/xhr/FormData-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/xhr/XMLHttpRequest-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/xhr/XMLHttpRequestEventTarget-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/xhr/XMLHttpRequestUpload-impl.js create mode 100644 node_modules/jsdom/lib/jsdom/living/xhr/multipart-form-data.js create mode 100644 node_modules/jsdom/lib/jsdom/living/xhr/xhr-sync-worker.js create mode 100644 node_modules/jsdom/lib/jsdom/living/xhr/xhr-utils.js create mode 100644 node_modules/jsdom/lib/jsdom/utils.js create mode 100644 node_modules/jsdom/lib/jsdom/virtual-console.js create mode 100644 node_modules/jsdom/package.json create mode 100644 node_modules/lru-cache/LICENSE.md create mode 100644 node_modules/lru-cache/README.md create mode 100644 node_modules/lru-cache/dist/commonjs/browser/diagnostics-channel-browser.d.ts.map create mode 100644 node_modules/lru-cache/dist/commonjs/browser/diagnostics-channel-browser.js.map create mode 100644 node_modules/lru-cache/dist/commonjs/browser/diagnostics-channel.d.ts create mode 100644 node_modules/lru-cache/dist/commonjs/browser/diagnostics-channel.js create mode 100644 node_modules/lru-cache/dist/commonjs/browser/index.d.ts create mode 100644 node_modules/lru-cache/dist/commonjs/browser/index.d.ts.map create mode 100644 node_modules/lru-cache/dist/commonjs/browser/index.js create mode 100644 node_modules/lru-cache/dist/commonjs/browser/index.js.map create mode 100644 node_modules/lru-cache/dist/commonjs/browser/index.min.js create mode 100644 node_modules/lru-cache/dist/commonjs/browser/index.min.js.map create mode 100644 node_modules/lru-cache/dist/commonjs/browser/perf.d.ts create mode 100644 node_modules/lru-cache/dist/commonjs/browser/perf.d.ts.map create mode 100644 node_modules/lru-cache/dist/commonjs/browser/perf.js create mode 100644 node_modules/lru-cache/dist/commonjs/browser/perf.js.map create mode 100644 node_modules/lru-cache/dist/commonjs/diagnostics-channel-cjs.cjs.map create mode 100644 node_modules/lru-cache/dist/commonjs/diagnostics-channel-cjs.d.cts.map create mode 100644 node_modules/lru-cache/dist/commonjs/diagnostics-channel.d.ts create mode 100644 node_modules/lru-cache/dist/commonjs/diagnostics-channel.js create mode 100644 node_modules/lru-cache/dist/commonjs/index.d.ts create mode 100644 node_modules/lru-cache/dist/commonjs/index.d.ts.map create mode 100644 node_modules/lru-cache/dist/commonjs/index.js create mode 100644 node_modules/lru-cache/dist/commonjs/index.js.map create mode 100644 node_modules/lru-cache/dist/commonjs/index.min.js create mode 100644 node_modules/lru-cache/dist/commonjs/index.min.js.map create mode 100644 node_modules/lru-cache/dist/commonjs/node/diagnostics-channel-node.d.ts.map create mode 100644 node_modules/lru-cache/dist/commonjs/node/diagnostics-channel-node.js.map create mode 100644 node_modules/lru-cache/dist/commonjs/node/diagnostics-channel.d.ts create mode 100644 node_modules/lru-cache/dist/commonjs/node/diagnostics-channel.js create mode 100644 node_modules/lru-cache/dist/commonjs/node/index.d.ts create mode 100644 node_modules/lru-cache/dist/commonjs/node/index.d.ts.map create mode 100644 node_modules/lru-cache/dist/commonjs/node/index.js create mode 100644 node_modules/lru-cache/dist/commonjs/node/index.js.map create mode 100644 node_modules/lru-cache/dist/commonjs/node/index.min.js create mode 100644 node_modules/lru-cache/dist/commonjs/node/index.min.js.map create mode 100644 node_modules/lru-cache/dist/commonjs/node/perf.d.ts create mode 100644 node_modules/lru-cache/dist/commonjs/node/perf.d.ts.map create mode 100644 node_modules/lru-cache/dist/commonjs/node/perf.js create mode 100644 node_modules/lru-cache/dist/commonjs/node/perf.js.map create mode 100644 node_modules/lru-cache/dist/commonjs/package.json create mode 100644 node_modules/lru-cache/dist/commonjs/perf.d.ts create mode 100644 node_modules/lru-cache/dist/commonjs/perf.d.ts.map create mode 100644 node_modules/lru-cache/dist/commonjs/perf.js create mode 100644 node_modules/lru-cache/dist/commonjs/perf.js.map create mode 100644 node_modules/lru-cache/dist/commonjs/react-native/diagnostics-channel-react-native.d.ts.map create mode 100644 node_modules/lru-cache/dist/commonjs/react-native/diagnostics-channel-react-native.js.map create mode 100644 node_modules/lru-cache/dist/commonjs/react-native/diagnostics-channel.d.ts create mode 100644 node_modules/lru-cache/dist/commonjs/react-native/diagnostics-channel.js create mode 100644 node_modules/lru-cache/dist/commonjs/react-native/index.d.ts create mode 100644 node_modules/lru-cache/dist/commonjs/react-native/index.d.ts.map create mode 100644 node_modules/lru-cache/dist/commonjs/react-native/index.js create mode 100644 node_modules/lru-cache/dist/commonjs/react-native/index.js.map create mode 100644 node_modules/lru-cache/dist/commonjs/react-native/perf.d.ts create mode 100644 node_modules/lru-cache/dist/commonjs/react-native/perf.d.ts.map create mode 100644 node_modules/lru-cache/dist/commonjs/react-native/perf.js create mode 100644 node_modules/lru-cache/dist/commonjs/react-native/perf.js.map create mode 100644 node_modules/lru-cache/dist/esm/browser/diagnostics-channel-browser.d.ts.map create mode 100644 node_modules/lru-cache/dist/esm/browser/diagnostics-channel-browser.js.map create mode 100644 node_modules/lru-cache/dist/esm/browser/diagnostics-channel.d.ts create mode 100644 node_modules/lru-cache/dist/esm/browser/diagnostics-channel.js create mode 100644 node_modules/lru-cache/dist/esm/browser/index.d.ts create mode 100644 node_modules/lru-cache/dist/esm/browser/index.d.ts.map create mode 100644 node_modules/lru-cache/dist/esm/browser/index.js create mode 100644 node_modules/lru-cache/dist/esm/browser/index.js.map create mode 100644 node_modules/lru-cache/dist/esm/browser/index.min.js create mode 100644 node_modules/lru-cache/dist/esm/browser/index.min.js.map create mode 100644 node_modules/lru-cache/dist/esm/browser/perf.d.ts create mode 100644 node_modules/lru-cache/dist/esm/browser/perf.d.ts.map create mode 100644 node_modules/lru-cache/dist/esm/browser/perf.js create mode 100644 node_modules/lru-cache/dist/esm/browser/perf.js.map create mode 100644 node_modules/lru-cache/dist/esm/diagnostics-channel-esm.d.mts.map create mode 100644 node_modules/lru-cache/dist/esm/diagnostics-channel-esm.mjs.map create mode 100644 node_modules/lru-cache/dist/esm/diagnostics-channel.d.ts create mode 100644 node_modules/lru-cache/dist/esm/diagnostics-channel.js create mode 100644 node_modules/lru-cache/dist/esm/index.d.ts create mode 100644 node_modules/lru-cache/dist/esm/index.d.ts.map create mode 100644 node_modules/lru-cache/dist/esm/index.js create mode 100644 node_modules/lru-cache/dist/esm/index.js.map create mode 100644 node_modules/lru-cache/dist/esm/index.min.js create mode 100644 node_modules/lru-cache/dist/esm/index.min.js.map create mode 100644 node_modules/lru-cache/dist/esm/node/diagnostics-channel-node.d.ts.map create mode 100644 node_modules/lru-cache/dist/esm/node/diagnostics-channel-node.js.map create mode 100644 node_modules/lru-cache/dist/esm/node/diagnostics-channel.d.ts create mode 100644 node_modules/lru-cache/dist/esm/node/diagnostics-channel.js create mode 100644 node_modules/lru-cache/dist/esm/node/index.d.ts create mode 100644 node_modules/lru-cache/dist/esm/node/index.d.ts.map create mode 100644 node_modules/lru-cache/dist/esm/node/index.js create mode 100644 node_modules/lru-cache/dist/esm/node/index.js.map create mode 100644 node_modules/lru-cache/dist/esm/node/index.min.js create mode 100644 node_modules/lru-cache/dist/esm/node/index.min.js.map create mode 100644 node_modules/lru-cache/dist/esm/node/perf.d.ts create mode 100644 node_modules/lru-cache/dist/esm/node/perf.d.ts.map create mode 100644 node_modules/lru-cache/dist/esm/node/perf.js create mode 100644 node_modules/lru-cache/dist/esm/node/perf.js.map create mode 100644 node_modules/lru-cache/dist/esm/package.json create mode 100644 node_modules/lru-cache/dist/esm/perf.d.ts create mode 100644 node_modules/lru-cache/dist/esm/perf.d.ts.map create mode 100644 node_modules/lru-cache/dist/esm/perf.js create mode 100644 node_modules/lru-cache/dist/esm/perf.js.map create mode 100644 node_modules/lru-cache/dist/esm/react-native/diagnostics-channel-react-native.d.ts.map create mode 100644 node_modules/lru-cache/dist/esm/react-native/diagnostics-channel-react-native.js.map create mode 100644 node_modules/lru-cache/dist/esm/react-native/diagnostics-channel.d.ts create mode 100644 node_modules/lru-cache/dist/esm/react-native/diagnostics-channel.js create mode 100644 node_modules/lru-cache/dist/esm/react-native/index.d.ts create mode 100644 node_modules/lru-cache/dist/esm/react-native/index.d.ts.map create mode 100644 node_modules/lru-cache/dist/esm/react-native/index.js create mode 100644 node_modules/lru-cache/dist/esm/react-native/index.js.map create mode 100644 node_modules/lru-cache/dist/esm/react-native/perf.d.ts create mode 100644 node_modules/lru-cache/dist/esm/react-native/perf.d.ts.map create mode 100644 node_modules/lru-cache/dist/esm/react-native/perf.js create mode 100644 node_modules/lru-cache/dist/esm/react-native/perf.js.map create mode 100644 node_modules/lru-cache/package.json create mode 100644 node_modules/mdn-data/LICENSE create mode 100644 node_modules/mdn-data/README.md create mode 100644 node_modules/mdn-data/api/index.js create mode 100644 node_modules/mdn-data/api/inheritance.json create mode 100644 node_modules/mdn-data/api/inheritance.schema.json create mode 100644 node_modules/mdn-data/css/at-rules.json create mode 100644 node_modules/mdn-data/css/at-rules.schema.json create mode 100644 node_modules/mdn-data/css/definitions.json create mode 100644 node_modules/mdn-data/css/functions.json create mode 100644 node_modules/mdn-data/css/functions.schema.json create mode 100644 node_modules/mdn-data/css/index.js create mode 100644 node_modules/mdn-data/css/properties.json create mode 100644 node_modules/mdn-data/css/properties.schema.json create mode 100644 node_modules/mdn-data/css/selectors.json create mode 100644 node_modules/mdn-data/css/selectors.schema.json create mode 100644 node_modules/mdn-data/css/syntaxes.json create mode 100644 node_modules/mdn-data/css/syntaxes.schema.json create mode 100644 node_modules/mdn-data/css/types.json create mode 100644 node_modules/mdn-data/css/types.schema.json create mode 100644 node_modules/mdn-data/css/units.json create mode 100644 node_modules/mdn-data/css/units.schema.json create mode 100644 node_modules/mdn-data/index.js create mode 100644 node_modules/mdn-data/l10n/css.json create mode 100644 node_modules/mdn-data/l10n/index.js create mode 100644 node_modules/mdn-data/package.json create mode 100644 node_modules/parse5/LICENSE create mode 100644 node_modules/parse5/README.md create mode 100644 node_modules/parse5/dist/common/doctype.d.ts create mode 100644 node_modules/parse5/dist/common/doctype.js create mode 100644 node_modules/parse5/dist/common/error-codes.d.ts create mode 100644 node_modules/parse5/dist/common/error-codes.js create mode 100644 node_modules/parse5/dist/common/foreign-content.d.ts create mode 100644 node_modules/parse5/dist/common/foreign-content.js create mode 100644 node_modules/parse5/dist/common/html.d.ts create mode 100644 node_modules/parse5/dist/common/html.js create mode 100644 node_modules/parse5/dist/common/token.d.ts create mode 100644 node_modules/parse5/dist/common/token.js create mode 100644 node_modules/parse5/dist/common/unicode.d.ts create mode 100644 node_modules/parse5/dist/common/unicode.js create mode 100644 node_modules/parse5/dist/index.d.ts create mode 100644 node_modules/parse5/dist/index.js create mode 100644 node_modules/parse5/dist/parser/formatting-element-list.d.ts create mode 100644 node_modules/parse5/dist/parser/formatting-element-list.js create mode 100644 node_modules/parse5/dist/parser/index.d.ts create mode 100644 node_modules/parse5/dist/parser/index.js create mode 100644 node_modules/parse5/dist/parser/open-element-stack.d.ts create mode 100644 node_modules/parse5/dist/parser/open-element-stack.js create mode 100644 node_modules/parse5/dist/serializer/index.d.ts create mode 100644 node_modules/parse5/dist/serializer/index.js create mode 100644 node_modules/parse5/dist/tokenizer/index.d.ts create mode 100644 node_modules/parse5/dist/tokenizer/index.js create mode 100644 node_modules/parse5/dist/tokenizer/preprocessor.d.ts create mode 100644 node_modules/parse5/dist/tokenizer/preprocessor.js create mode 100644 node_modules/parse5/dist/tree-adapters/default.d.ts create mode 100644 node_modules/parse5/dist/tree-adapters/default.js create mode 100644 node_modules/parse5/dist/tree-adapters/interface.d.ts create mode 100644 node_modules/parse5/dist/tree-adapters/interface.js create mode 100644 node_modules/parse5/package.json create mode 100644 node_modules/punycode/LICENSE-MIT.txt create mode 100644 node_modules/punycode/README.md create mode 100644 node_modules/punycode/package.json create mode 100644 node_modules/punycode/punycode.es6.js create mode 100644 node_modules/punycode/punycode.js create mode 100644 node_modules/require-from-string/index.js create mode 100644 node_modules/require-from-string/license create mode 100644 node_modules/require-from-string/package.json create mode 100644 node_modules/require-from-string/readme.md create mode 100644 node_modules/saxes/README.md create mode 100644 node_modules/saxes/package.json create mode 100644 node_modules/saxes/saxes.d.ts create mode 100644 node_modules/saxes/saxes.js create mode 100644 node_modules/saxes/saxes.js.map create mode 100644 node_modules/source-map-js/LICENSE create mode 100644 node_modules/source-map-js/README.md create mode 100644 node_modules/source-map-js/lib/array-set.js create mode 100644 node_modules/source-map-js/lib/base64-vlq.js create mode 100644 node_modules/source-map-js/lib/base64.js create mode 100644 node_modules/source-map-js/lib/binary-search.js create mode 100644 node_modules/source-map-js/lib/mapping-list.js create mode 100644 node_modules/source-map-js/lib/quick-sort.js create mode 100644 node_modules/source-map-js/lib/source-map-consumer.d.ts create mode 100644 node_modules/source-map-js/lib/source-map-consumer.js create mode 100644 node_modules/source-map-js/lib/source-map-generator.d.ts create mode 100644 node_modules/source-map-js/lib/source-map-generator.js create mode 100644 node_modules/source-map-js/lib/source-node.d.ts create mode 100644 node_modules/source-map-js/lib/source-node.js create mode 100644 node_modules/source-map-js/lib/util.js create mode 100644 node_modules/source-map-js/package.json create mode 100644 node_modules/source-map-js/source-map.d.ts create mode 100644 node_modules/source-map-js/source-map.js create mode 100644 node_modules/tldts-core/LICENSE create mode 100644 node_modules/tldts-core/README.md create mode 100644 node_modules/tldts-core/dist/cjs/index.js create mode 100644 node_modules/tldts-core/dist/cjs/index.js.map create mode 100644 node_modules/tldts-core/dist/cjs/src/domain-without-suffix.js create mode 100644 node_modules/tldts-core/dist/cjs/src/domain-without-suffix.js.map create mode 100644 node_modules/tldts-core/dist/cjs/src/domain.js create mode 100644 node_modules/tldts-core/dist/cjs/src/domain.js.map create mode 100644 node_modules/tldts-core/dist/cjs/src/extract-hostname.js create mode 100644 node_modules/tldts-core/dist/cjs/src/extract-hostname.js.map create mode 100644 node_modules/tldts-core/dist/cjs/src/factory.js create mode 100644 node_modules/tldts-core/dist/cjs/src/factory.js.map create mode 100644 node_modules/tldts-core/dist/cjs/src/is-ip.js create mode 100644 node_modules/tldts-core/dist/cjs/src/is-ip.js.map create mode 100644 node_modules/tldts-core/dist/cjs/src/is-special-use.js create mode 100644 node_modules/tldts-core/dist/cjs/src/is-special-use.js.map create mode 100644 node_modules/tldts-core/dist/cjs/src/is-valid.js create mode 100644 node_modules/tldts-core/dist/cjs/src/is-valid.js.map create mode 100644 node_modules/tldts-core/dist/cjs/src/lookup/fast-path.js create mode 100644 node_modules/tldts-core/dist/cjs/src/lookup/fast-path.js.map create mode 100644 node_modules/tldts-core/dist/cjs/src/lookup/interface.js create mode 100644 node_modules/tldts-core/dist/cjs/src/lookup/interface.js.map create mode 100644 node_modules/tldts-core/dist/cjs/src/options.js create mode 100644 node_modules/tldts-core/dist/cjs/src/options.js.map create mode 100644 node_modules/tldts-core/dist/cjs/src/subdomain.js create mode 100644 node_modules/tldts-core/dist/cjs/src/subdomain.js.map create mode 100644 node_modules/tldts-core/dist/cjs/tsconfig.tsbuildinfo create mode 100644 node_modules/tldts-core/dist/es6/index.js create mode 100644 node_modules/tldts-core/dist/es6/index.js.map create mode 100644 node_modules/tldts-core/dist/es6/src/domain-without-suffix.js create mode 100644 node_modules/tldts-core/dist/es6/src/domain-without-suffix.js.map create mode 100644 node_modules/tldts-core/dist/es6/src/domain.js create mode 100644 node_modules/tldts-core/dist/es6/src/domain.js.map create mode 100644 node_modules/tldts-core/dist/es6/src/extract-hostname.js create mode 100644 node_modules/tldts-core/dist/es6/src/extract-hostname.js.map create mode 100644 node_modules/tldts-core/dist/es6/src/factory.js create mode 100644 node_modules/tldts-core/dist/es6/src/factory.js.map create mode 100644 node_modules/tldts-core/dist/es6/src/is-ip.js create mode 100644 node_modules/tldts-core/dist/es6/src/is-ip.js.map create mode 100644 node_modules/tldts-core/dist/es6/src/is-special-use.js create mode 100644 node_modules/tldts-core/dist/es6/src/is-special-use.js.map create mode 100644 node_modules/tldts-core/dist/es6/src/is-valid.js create mode 100644 node_modules/tldts-core/dist/es6/src/is-valid.js.map create mode 100644 node_modules/tldts-core/dist/es6/src/lookup/fast-path.js create mode 100644 node_modules/tldts-core/dist/es6/src/lookup/fast-path.js.map create mode 100644 node_modules/tldts-core/dist/es6/src/lookup/interface.js create mode 100644 node_modules/tldts-core/dist/es6/src/lookup/interface.js.map create mode 100644 node_modules/tldts-core/dist/es6/src/options.js create mode 100644 node_modules/tldts-core/dist/es6/src/options.js.map create mode 100644 node_modules/tldts-core/dist/es6/src/subdomain.js create mode 100644 node_modules/tldts-core/dist/es6/src/subdomain.js.map create mode 100644 node_modules/tldts-core/dist/es6/tsconfig.bundle.tsbuildinfo create mode 100644 node_modules/tldts-core/dist/types/index.d.ts create mode 100644 node_modules/tldts-core/dist/types/src/domain-without-suffix.d.ts create mode 100644 node_modules/tldts-core/dist/types/src/domain.d.ts create mode 100644 node_modules/tldts-core/dist/types/src/extract-hostname.d.ts create mode 100644 node_modules/tldts-core/dist/types/src/factory.d.ts create mode 100644 node_modules/tldts-core/dist/types/src/is-ip.d.ts create mode 100644 node_modules/tldts-core/dist/types/src/is-special-use.d.ts create mode 100644 node_modules/tldts-core/dist/types/src/is-valid.d.ts create mode 100644 node_modules/tldts-core/dist/types/src/lookup/fast-path.d.ts create mode 100644 node_modules/tldts-core/dist/types/src/lookup/interface.d.ts create mode 100644 node_modules/tldts-core/dist/types/src/options.d.ts create mode 100644 node_modules/tldts-core/dist/types/src/subdomain.d.ts create mode 100644 node_modules/tldts-core/index.ts create mode 100644 node_modules/tldts-core/package.json create mode 100644 node_modules/tldts-core/src/domain-without-suffix.ts create mode 100644 node_modules/tldts-core/src/domain.ts create mode 100644 node_modules/tldts-core/src/extract-hostname.ts create mode 100644 node_modules/tldts-core/src/factory.ts create mode 100644 node_modules/tldts-core/src/is-ip.ts create mode 100644 node_modules/tldts-core/src/is-special-use.ts create mode 100644 node_modules/tldts-core/src/is-valid.ts create mode 100644 node_modules/tldts-core/src/lookup/fast-path.ts create mode 100644 node_modules/tldts-core/src/lookup/interface.ts create mode 100644 node_modules/tldts-core/src/options.ts create mode 100644 node_modules/tldts-core/src/subdomain.ts create mode 100644 node_modules/tldts/LICENSE create mode 100644 node_modules/tldts/README.md create mode 100755 node_modules/tldts/bin/cli.js create mode 100644 node_modules/tldts/dist/cjs/index.js create mode 100644 node_modules/tldts/dist/cjs/index.js.map create mode 100644 node_modules/tldts/dist/cjs/src/data/trie.js create mode 100644 node_modules/tldts/dist/cjs/src/data/trie.js.map create mode 100644 node_modules/tldts/dist/cjs/src/suffix-trie.js create mode 100644 node_modules/tldts/dist/cjs/src/suffix-trie.js.map create mode 100644 node_modules/tldts/dist/cjs/tsconfig.tsbuildinfo create mode 100644 node_modules/tldts/dist/es6/index.js create mode 100644 node_modules/tldts/dist/es6/index.js.map create mode 100644 node_modules/tldts/dist/es6/src/data/trie.js create mode 100644 node_modules/tldts/dist/es6/src/data/trie.js.map create mode 100644 node_modules/tldts/dist/es6/src/suffix-trie.js create mode 100644 node_modules/tldts/dist/es6/src/suffix-trie.js.map create mode 100644 node_modules/tldts/dist/es6/tsconfig.bundle.tsbuildinfo create mode 100644 node_modules/tldts/dist/index.cjs.min.js create mode 100644 node_modules/tldts/dist/index.cjs.min.js.map create mode 100644 node_modules/tldts/dist/index.esm.min.js create mode 100644 node_modules/tldts/dist/index.esm.min.js.map create mode 100644 node_modules/tldts/dist/index.umd.min.js create mode 100644 node_modules/tldts/dist/index.umd.min.js.map create mode 100644 node_modules/tldts/dist/types/index.d.ts create mode 100644 node_modules/tldts/dist/types/src/data/trie.d.ts create mode 100644 node_modules/tldts/dist/types/src/suffix-trie.d.ts create mode 100644 node_modules/tldts/index.ts create mode 100644 node_modules/tldts/package.json create mode 100644 node_modules/tldts/src/data/trie.ts create mode 100644 node_modules/tldts/src/suffix-trie.ts create mode 100644 node_modules/tough-cookie/LICENSE create mode 100644 node_modules/tough-cookie/README.md create mode 100644 node_modules/tough-cookie/dist/index.cjs create mode 100644 node_modules/tough-cookie/dist/index.cjs.map create mode 100644 node_modules/tough-cookie/dist/index.d.cts create mode 100644 node_modules/tough-cookie/dist/index.d.ts create mode 100644 node_modules/tough-cookie/dist/index.js create mode 100644 node_modules/tough-cookie/dist/index.js.map create mode 100644 node_modules/tough-cookie/package.json create mode 100644 node_modules/tr46/LICENSE.md create mode 100644 node_modules/tr46/README.md create mode 100644 node_modules/tr46/index.js create mode 100644 node_modules/tr46/lib/mappingTable.json create mode 100644 node_modules/tr46/lib/regexes.js create mode 100644 node_modules/tr46/lib/statusMapping.js create mode 100644 node_modules/tr46/package.json create mode 100644 node_modules/undici/LICENSE create mode 100644 node_modules/undici/README.md create mode 100644 node_modules/undici/docs/docs/api/Agent.md create mode 100644 node_modules/undici/docs/docs/api/BalancedPool.md create mode 100644 node_modules/undici/docs/docs/api/CacheStorage.md create mode 100644 node_modules/undici/docs/docs/api/CacheStore.md create mode 100644 node_modules/undici/docs/docs/api/Client.md create mode 100644 node_modules/undici/docs/docs/api/ClientStats.md create mode 100644 node_modules/undici/docs/docs/api/Connector.md create mode 100644 node_modules/undici/docs/docs/api/ContentType.md create mode 100644 node_modules/undici/docs/docs/api/Cookies.md create mode 100644 node_modules/undici/docs/docs/api/Debug.md create mode 100644 node_modules/undici/docs/docs/api/DiagnosticsChannel.md create mode 100644 node_modules/undici/docs/docs/api/Dispatcher.md create mode 100644 node_modules/undici/docs/docs/api/EnvHttpProxyAgent.md create mode 100644 node_modules/undici/docs/docs/api/Errors.md create mode 100644 node_modules/undici/docs/docs/api/EventSource.md create mode 100644 node_modules/undici/docs/docs/api/Fetch.md create mode 100644 node_modules/undici/docs/docs/api/GlobalInstallation.md create mode 100644 node_modules/undici/docs/docs/api/H2CClient.md create mode 100644 node_modules/undici/docs/docs/api/Interceptors.md create mode 100644 node_modules/undici/docs/docs/api/MockAgent.md create mode 100644 node_modules/undici/docs/docs/api/MockCallHistory.md create mode 100644 node_modules/undici/docs/docs/api/MockCallHistoryLog.md create mode 100644 node_modules/undici/docs/docs/api/MockClient.md create mode 100644 node_modules/undici/docs/docs/api/MockErrors.md create mode 100644 node_modules/undici/docs/docs/api/MockPool.md create mode 100644 node_modules/undici/docs/docs/api/Pool.md create mode 100644 node_modules/undici/docs/docs/api/PoolStats.md create mode 100644 node_modules/undici/docs/docs/api/ProxyAgent.md create mode 100644 node_modules/undici/docs/docs/api/RedirectHandler.md create mode 100644 node_modules/undici/docs/docs/api/RetryAgent.md create mode 100644 node_modules/undici/docs/docs/api/RetryHandler.md create mode 100644 node_modules/undici/docs/docs/api/RoundRobinPool.md create mode 100644 node_modules/undici/docs/docs/api/SnapshotAgent.md create mode 100644 node_modules/undici/docs/docs/api/Socks5ProxyAgent.md create mode 100644 node_modules/undici/docs/docs/api/Util.md create mode 100644 node_modules/undici/docs/docs/api/WebSocket.md create mode 100644 node_modules/undici/docs/docs/api/api-lifecycle.md create mode 100644 node_modules/undici/docs/docs/best-practices/client-certificate.md create mode 100644 node_modules/undici/docs/docs/best-practices/crawling.md create mode 100644 node_modules/undici/docs/docs/best-practices/migrating-from-v7-to-v8.md create mode 100644 node_modules/undici/docs/docs/best-practices/mocking-request.md create mode 100644 node_modules/undici/docs/docs/best-practices/proxy.md create mode 100644 node_modules/undici/docs/docs/best-practices/undici-vs-builtin-fetch.md create mode 100644 node_modules/undici/docs/docs/best-practices/writing-tests.md create mode 100644 node_modules/undici/docs/docs/getting-started.md create mode 100644 node_modules/undici/docs/docs/index.md create mode 100644 node_modules/undici/docs/docs/site.json create mode 100644 node_modules/undici/docs/docs/type-map.json create mode 100644 node_modules/undici/index-fetch.js create mode 100644 node_modules/undici/index.d.ts create mode 100644 node_modules/undici/index.js create mode 100644 node_modules/undici/lib/api/abort-signal.js create mode 100644 node_modules/undici/lib/api/api-connect.js create mode 100644 node_modules/undici/lib/api/api-pipeline.js create mode 100644 node_modules/undici/lib/api/api-request.js create mode 100644 node_modules/undici/lib/api/api-stream.js create mode 100644 node_modules/undici/lib/api/api-upgrade.js create mode 100644 node_modules/undici/lib/api/index.js create mode 100644 node_modules/undici/lib/api/readable.js create mode 100644 node_modules/undici/lib/cache/memory-cache-store.js create mode 100644 node_modules/undici/lib/cache/sqlite-cache-store.js create mode 100644 node_modules/undici/lib/core/connect.js create mode 100644 node_modules/undici/lib/core/constants.js create mode 100644 node_modules/undici/lib/core/diagnostics.js create mode 100644 node_modules/undici/lib/core/errors.js create mode 100644 node_modules/undici/lib/core/request.js create mode 100644 node_modules/undici/lib/core/socks5-client.js create mode 100644 node_modules/undici/lib/core/socks5-utils.js create mode 100644 node_modules/undici/lib/core/symbols.js create mode 100644 node_modules/undici/lib/core/tree.js create mode 100644 node_modules/undici/lib/core/util.js create mode 100644 node_modules/undici/lib/dispatcher/agent.js create mode 100644 node_modules/undici/lib/dispatcher/balanced-pool.js create mode 100644 node_modules/undici/lib/dispatcher/client-h1.js create mode 100644 node_modules/undici/lib/dispatcher/client-h2.js create mode 100644 node_modules/undici/lib/dispatcher/client.js create mode 100644 node_modules/undici/lib/dispatcher/dispatcher-base.js create mode 100644 node_modules/undici/lib/dispatcher/dispatcher.js create mode 100644 node_modules/undici/lib/dispatcher/dispatcher1-wrapper.js create mode 100644 node_modules/undici/lib/dispatcher/env-http-proxy-agent.js create mode 100644 node_modules/undici/lib/dispatcher/fixed-queue.js create mode 100644 node_modules/undici/lib/dispatcher/h2c-client.js create mode 100644 node_modules/undici/lib/dispatcher/parser-h1.js create mode 100644 node_modules/undici/lib/dispatcher/pool-base.js create mode 100644 node_modules/undici/lib/dispatcher/pool.js create mode 100644 node_modules/undici/lib/dispatcher/proxy-agent.js create mode 100644 node_modules/undici/lib/dispatcher/retry-agent.js create mode 100644 node_modules/undici/lib/dispatcher/round-robin-pool.js create mode 100644 node_modules/undici/lib/dispatcher/socks5-proxy-agent.js create mode 100644 node_modules/undici/lib/encoding/index.js create mode 100644 node_modules/undici/lib/global.js create mode 100644 node_modules/undici/lib/handler/cache-handler.js create mode 100644 node_modules/undici/lib/handler/cache-revalidation-handler.js create mode 100644 node_modules/undici/lib/handler/decorator-handler.js create mode 100644 node_modules/undici/lib/handler/deduplication-handler.js create mode 100644 node_modules/undici/lib/handler/redirect-handler.js create mode 100644 node_modules/undici/lib/handler/retry-handler.js create mode 100644 node_modules/undici/lib/interceptor/cache.js create mode 100644 node_modules/undici/lib/interceptor/decompress.js create mode 100644 node_modules/undici/lib/interceptor/deduplicate.js create mode 100644 node_modules/undici/lib/interceptor/dns.js create mode 100644 node_modules/undici/lib/interceptor/dump.js create mode 100644 node_modules/undici/lib/interceptor/redirect.js create mode 100644 node_modules/undici/lib/interceptor/response-error.js create mode 100644 node_modules/undici/lib/interceptor/retry.js create mode 100644 node_modules/undici/lib/llhttp/constants.d.ts create mode 100644 node_modules/undici/lib/llhttp/constants.js create mode 100644 node_modules/undici/lib/llhttp/llhttp-wasm.js create mode 100644 node_modules/undici/lib/llhttp/llhttp_simd-wasm.js create mode 100644 node_modules/undici/lib/llhttp/utils.d.ts create mode 100644 node_modules/undici/lib/llhttp/utils.js create mode 100644 node_modules/undici/lib/milo/LICENSE.md create mode 100644 node_modules/undici/lib/milo/no-simd.js create mode 100644 node_modules/undici/lib/milo/simd.js create mode 100644 node_modules/undici/lib/mock/mock-agent.js create mode 100644 node_modules/undici/lib/mock/mock-call-history.js create mode 100644 node_modules/undici/lib/mock/mock-client.js create mode 100644 node_modules/undici/lib/mock/mock-errors.js create mode 100644 node_modules/undici/lib/mock/mock-interceptor.js create mode 100644 node_modules/undici/lib/mock/mock-pool.js create mode 100644 node_modules/undici/lib/mock/mock-symbols.js create mode 100644 node_modules/undici/lib/mock/mock-utils.js create mode 100644 node_modules/undici/lib/mock/pending-interceptors-formatter.js create mode 100644 node_modules/undici/lib/mock/snapshot-agent.js create mode 100644 node_modules/undici/lib/mock/snapshot-recorder.js create mode 100644 node_modules/undici/lib/mock/snapshot-utils.js create mode 100644 node_modules/undici/lib/util/cache.js create mode 100644 node_modules/undici/lib/util/date.js create mode 100644 node_modules/undici/lib/util/runtime-features.js create mode 100644 node_modules/undici/lib/util/stats.js create mode 100644 node_modules/undici/lib/util/timers.js create mode 100644 node_modules/undici/lib/web/cache/cache.js create mode 100644 node_modules/undici/lib/web/cache/cachestorage.js create mode 100644 node_modules/undici/lib/web/cache/util.js create mode 100644 node_modules/undici/lib/web/cookies/constants.js create mode 100644 node_modules/undici/lib/web/cookies/index.js create mode 100644 node_modules/undici/lib/web/cookies/parse.js create mode 100644 node_modules/undici/lib/web/cookies/util.js create mode 100644 node_modules/undici/lib/web/eventsource/eventsource-stream.js create mode 100644 node_modules/undici/lib/web/eventsource/eventsource.js create mode 100644 node_modules/undici/lib/web/eventsource/util.js create mode 100644 node_modules/undici/lib/web/fetch/LICENSE create mode 100644 node_modules/undici/lib/web/fetch/body.js create mode 100644 node_modules/undici/lib/web/fetch/constants.js create mode 100644 node_modules/undici/lib/web/fetch/data-url.js create mode 100644 node_modules/undici/lib/web/fetch/formdata-parser.js create mode 100644 node_modules/undici/lib/web/fetch/formdata.js create mode 100644 node_modules/undici/lib/web/fetch/global.js create mode 100644 node_modules/undici/lib/web/fetch/headers.js create mode 100644 node_modules/undici/lib/web/fetch/index.js create mode 100644 node_modules/undici/lib/web/fetch/request.js create mode 100644 node_modules/undici/lib/web/fetch/response.js create mode 100644 node_modules/undici/lib/web/fetch/util.js create mode 100644 node_modules/undici/lib/web/infra/index.js create mode 100644 node_modules/undici/lib/web/subresource-integrity/Readme.md create mode 100644 node_modules/undici/lib/web/subresource-integrity/subresource-integrity.js create mode 100644 node_modules/undici/lib/web/webidl/index.js create mode 100644 node_modules/undici/lib/web/websocket/connection.js create mode 100644 node_modules/undici/lib/web/websocket/constants.js create mode 100644 node_modules/undici/lib/web/websocket/events.js create mode 100644 node_modules/undici/lib/web/websocket/frame.js create mode 100644 node_modules/undici/lib/web/websocket/permessage-deflate.js create mode 100644 node_modules/undici/lib/web/websocket/receiver.js create mode 100644 node_modules/undici/lib/web/websocket/sender.js create mode 100644 node_modules/undici/lib/web/websocket/stream/websocketerror.js create mode 100644 node_modules/undici/lib/web/websocket/stream/websocketstream.js create mode 100644 node_modules/undici/lib/web/websocket/util.js create mode 100644 node_modules/undici/lib/web/websocket/websocket.js create mode 100644 node_modules/undici/package.json create mode 100644 node_modules/undici/scripts/strip-comments.js create mode 100644 node_modules/undici/types/README.md create mode 100644 node_modules/undici/types/agent.d.ts create mode 100644 node_modules/undici/types/api.d.ts create mode 100644 node_modules/undici/types/balanced-pool.d.ts create mode 100644 node_modules/undici/types/cache-interceptor.d.ts create mode 100644 node_modules/undici/types/cache.d.ts create mode 100644 node_modules/undici/types/client-stats.d.ts create mode 100644 node_modules/undici/types/client.d.ts create mode 100644 node_modules/undici/types/connector.d.ts create mode 100644 node_modules/undici/types/content-type.d.ts create mode 100644 node_modules/undici/types/cookies.d.ts create mode 100644 node_modules/undici/types/diagnostics-channel.d.ts create mode 100644 node_modules/undici/types/dispatcher.d.ts create mode 100644 node_modules/undici/types/dispatcher1-wrapper.d.ts create mode 100644 node_modules/undici/types/env-http-proxy-agent.d.ts create mode 100644 node_modules/undici/types/errors.d.ts create mode 100644 node_modules/undici/types/eventsource.d.ts create mode 100644 node_modules/undici/types/fetch.d.ts create mode 100644 node_modules/undici/types/formdata.d.ts create mode 100644 node_modules/undici/types/global-dispatcher.d.ts create mode 100644 node_modules/undici/types/global-origin.d.ts create mode 100644 node_modules/undici/types/h2c-client.d.ts create mode 100644 node_modules/undici/types/handlers.d.ts create mode 100644 node_modules/undici/types/header.d.ts create mode 100644 node_modules/undici/types/index.d.ts create mode 100644 node_modules/undici/types/interceptors.d.ts create mode 100644 node_modules/undici/types/mock-agent.d.ts create mode 100644 node_modules/undici/types/mock-call-history.d.ts create mode 100644 node_modules/undici/types/mock-client.d.ts create mode 100644 node_modules/undici/types/mock-errors.d.ts create mode 100644 node_modules/undici/types/mock-interceptor.d.ts create mode 100644 node_modules/undici/types/mock-pool.d.ts create mode 100644 node_modules/undici/types/patch.d.ts create mode 100644 node_modules/undici/types/pool-stats.d.ts create mode 100644 node_modules/undici/types/pool.d.ts create mode 100644 node_modules/undici/types/proxy-agent.d.ts create mode 100644 node_modules/undici/types/readable.d.ts create mode 100644 node_modules/undici/types/retry-agent.d.ts create mode 100644 node_modules/undici/types/retry-handler.d.ts create mode 100644 node_modules/undici/types/round-robin-pool.d.ts create mode 100644 node_modules/undici/types/snapshot-agent.d.ts create mode 100644 node_modules/undici/types/socks5-proxy-agent.d.ts create mode 100644 node_modules/undici/types/util.d.ts create mode 100644 node_modules/undici/types/utility.d.ts create mode 100644 node_modules/undici/types/webidl.d.ts create mode 100644 node_modules/undici/types/websocket.d.ts create mode 100644 node_modules/w3c-xmlserializer/LICENSE.md create mode 100644 node_modules/w3c-xmlserializer/README.md create mode 100644 node_modules/w3c-xmlserializer/lib/attributes.js create mode 100644 node_modules/w3c-xmlserializer/lib/constants.js create mode 100644 node_modules/w3c-xmlserializer/lib/serialize.js create mode 100644 node_modules/w3c-xmlserializer/package.json create mode 100644 node_modules/webidl-conversions/LICENSE.md create mode 100644 node_modules/webidl-conversions/README.md create mode 100644 node_modules/webidl-conversions/lib/index.js create mode 100644 node_modules/webidl-conversions/package.json create mode 100644 node_modules/whatwg-mimetype/LICENSE.txt create mode 100644 node_modules/whatwg-mimetype/README.md create mode 100644 node_modules/whatwg-mimetype/lib/index.js create mode 100644 node_modules/whatwg-mimetype/lib/mime-type-parameters.js create mode 100644 node_modules/whatwg-mimetype/lib/mime-type.js create mode 100644 node_modules/whatwg-mimetype/lib/parser.js create mode 100644 node_modules/whatwg-mimetype/lib/serializer.js create mode 100644 node_modules/whatwg-mimetype/lib/sniff.js create mode 100644 node_modules/whatwg-mimetype/lib/utils.js create mode 100644 node_modules/whatwg-mimetype/package.json create mode 100644 node_modules/whatwg-url/LICENSE.txt create mode 100644 node_modules/whatwg-url/README.md create mode 100644 node_modules/whatwg-url/index.js create mode 100644 node_modules/whatwg-url/lib/Function.js create mode 100644 node_modules/whatwg-url/lib/URL-impl.js create mode 100644 node_modules/whatwg-url/lib/URL.js create mode 100644 node_modules/whatwg-url/lib/URLSearchParams-impl.js create mode 100644 node_modules/whatwg-url/lib/URLSearchParams.js create mode 100644 node_modules/whatwg-url/lib/VoidFunction.js create mode 100644 node_modules/whatwg-url/lib/encoding.js create mode 100644 node_modules/whatwg-url/lib/infra.js create mode 100644 node_modules/whatwg-url/lib/percent-encoding.js create mode 100644 node_modules/whatwg-url/lib/url-miscellaneous.js create mode 100644 node_modules/whatwg-url/lib/url-state-machine.js create mode 100644 node_modules/whatwg-url/lib/url-string-validator.js create mode 100644 node_modules/whatwg-url/lib/urlencoded.js create mode 100644 node_modules/whatwg-url/lib/utils.js create mode 100644 node_modules/whatwg-url/package.json create mode 100644 node_modules/whatwg-url/webidl2js-wrapper.js create mode 100644 node_modules/xml-name-validator/LICENSE.txt create mode 100644 node_modules/xml-name-validator/README.md create mode 100644 node_modules/xml-name-validator/lib/xml-name-validator.js create mode 100644 node_modules/xml-name-validator/package.json create mode 100644 node_modules/xmlchars/LICENSE create mode 100644 node_modules/xmlchars/README.md create mode 100644 node_modules/xmlchars/package.json create mode 100644 node_modules/xmlchars/xml/1.0/ed4.d.ts create mode 100644 node_modules/xmlchars/xml/1.0/ed4.js create mode 100644 node_modules/xmlchars/xml/1.0/ed4.js.map create mode 100644 node_modules/xmlchars/xml/1.0/ed5.d.ts create mode 100644 node_modules/xmlchars/xml/1.0/ed5.js create mode 100644 node_modules/xmlchars/xml/1.0/ed5.js.map create mode 100644 node_modules/xmlchars/xml/1.1/ed2.d.ts create mode 100644 node_modules/xmlchars/xml/1.1/ed2.js create mode 100644 node_modules/xmlchars/xml/1.1/ed2.js.map create mode 100644 node_modules/xmlchars/xmlchars.d.ts create mode 100644 node_modules/xmlchars/xmlchars.js create mode 100644 node_modules/xmlchars/xmlchars.js.map create mode 100644 node_modules/xmlchars/xmlns/1.0/ed3.d.ts create mode 100644 node_modules/xmlchars/xmlns/1.0/ed3.js create mode 100644 node_modules/xmlchars/xmlns/1.0/ed3.js.map create mode 100644 oct13_export.csv create mode 100644 roadmap-data.json create mode 100644 smoke_test.js create mode 100644 uat-outreach-statuses-2026-10-19.json create mode 100644 uat_new_section.js create mode 100644 wa_section.js diff --git a/BA-Daily-Checklist.html b/BA-Daily-Checklist.html new file mode 100644 index 0000000..e508783 --- /dev/null +++ b/BA-Daily-Checklist.html @@ -0,0 +1,598 @@ + + + + + +BA Daily Checklist + + + +
+
+
+

📋 BA Daily Checklist

+
+
+ +
+ +
+
0 of 0 done
+
🎉 All done — great work today!
+ +
+

☀️ Morning

+
Start-of-day check. Monday tasks appear automatically.
+
+
+ +
+

🌤️ Midday check

+
Re-run the same checks. Already done in the morning and nothing new? Just check it off to skip.
+
+
+ +
+

🌇 Afternoon check

+
Final pass before end of day. Anything not needed today — check it off.
+
+
+ +
+

🗺️ Roadmap / Gantt

+
+ + + + +
+
+ No roadmap loaded yet.
+ Click 📁 Load / replace CSV and pick a CSV file. Expected columns (in this order, or with headers): + task, start, end and optionally status (planned / in progress / done / blocked) and notes. + Dates can be like 2025-03-10, 3/10/2025, or Mar 10, 2025. +
+ +
+ +
+

Additional items

+
+ + +
+
+
+ +
Progress is saved locally in your browser and resets automatically each day.
+
+ + + + diff --git a/ServiceMeow-HQ.html b/ServiceMeow-HQ.html new file mode 100644 index 0000000..34f9a85 --- /dev/null +++ b/ServiceMeow-HQ.html @@ -0,0 +1,2601 @@ + + + + + +ServiceMeow HQ — Roadmap + UAT Launches + + + + +
+
ServiceMeow HQ
+
+
+ + + +
+
+ + +
+ +
+ + +
+ + +
+ + +
+
+
+

My Daily Tasks

+
Your tasks for today — resets each day. Didn't get to one? Hover it and hit → to push it to tomorrow.
+
+ +
+
+
+ + +
+
+
+ + +
+
+
+

Impacts & Flags

+
Things that come up and impact the roadmap or your tasks. Click a flag to edit it and add the tasks to resolve it. Persists until you resolve/remove it.
+
+
+
+
+ + + + +
+
+ + +
+
+
+

Roadmap Tasks

+
Web27 Roadmap (updated) — progress saves in this browser · click a section to expand / collapse · click a week badge to move / update a task
+
+
+ + +
+
+
+
+
+ +
+ + +
+ + +
+
+
+

Due This Week

+
+
Click a bubble to mark it in progress / complete / delayed, or move it to a different week
+
+
+
+ +
Your flags (open) · click a flag to edit it
+
+ +
Up Next (following weeks) · click a bubble to update
+
+
+ + +
+
+
+

Roadmap Timeline

+
WK 1–33 · amber column = current week · drag a bubble or a task row to another week to move it · click for a note
+
+
+ + + + + +
+
+
+
+
+ +
+ +
+ + + + + + + + + + + + +
+ + +
+ +
+ +
+
+
+

UAT Outreach Tracker

+
Stories to reach out about for UAT testing
+ +
+
+ + + + + + + + +
+
+ +
Drag & drop your weekly export CSV here, or use the "Load weekly CSV" button above.
+ +
+
+ +
+
+
0Not reached out
+
0Reached out
+
0Waiting on response
+
0Approved
+
0On hold
+
+
+
+
+ +
+ + +
+ +
+ +
Click the code-freeze banner (top) or a site's launch card to mark that launch's code FROZEN (blue) or unfrozen (orange) — the status sticks in this browser. Click any launch date to set an out-of-cadence launch date (leave blank to restore the cadence date; the freeze follows 4 days earlier). Use − on any ticket to set it aside under "Not needing test yet" (bring it back with ↩). Statuses and field edits are saved in this browser per ticket ID — they carry over when you load next week's export. Click a State / Tester / Dev field to edit it in place (Enter saves, Esc cancels). The day's CSV upload is remembered in this browser until the next day. Use Backup/Restore to move or safeguard your data.
+
+ + +
+ + +
+
+ +
+
+ + + + + + + + diff --git a/UAT-Outreach-Tracker.html b/UAT-Outreach-Tracker.html new file mode 100644 index 0000000..6708d3d --- /dev/null +++ b/UAT-Outreach-Tracker.html @@ -0,0 +1,735 @@ + + + + + +UAT Outreach Tracker + + + +
+
+
+

UAT Outreach Tracker

+
Stories to reach out about for UAT testing
+
+
+ + + + + + + + +
+
+ +
📂 Drag & drop your weekly export CSV here, or use the "📂 Load weekly CSV" button above.
+ +
+
+
0Not reached out
+
0Reached out
+
0Waiting on response
+
0Approved
+
0On hold
+
+
+
+
+ +
+ + +
+ +
+ +
Statuses and field edits are saved in this browser per ticket ID — they carry over when you load next week's export. Click a State / Tester / Dev field to edit it in place (Enter saves, Esc cancels). Use Backup/Restore to move or safeguard your data.
+
+ + + + diff --git a/Web Team ServiceMeow - Roadmap.html b/Web Team ServiceMeow - Roadmap.html new file mode 100644 index 0000000..c57c41d --- /dev/null +++ b/Web Team ServiceMeow - Roadmap.html @@ -0,0 +1,1261 @@ + + + + + +ServiceMeow — Daily & Roadmap + + + +
+ + +
+ + +
+ + +
+
+
+

📋 My Daily Tasks

+
Your tasks for today — resets each day. Didn't get to one? Hover it and hit → to push it to tomorrow.
+
+ +
+
+
+ + +
+
+
+ + +
+
+
+

🚩 Impacts & Flags

+
Things that come up and impact the roadmap or your tasks. 💡 Click a flag to edit it and add the tasks to resolve it. Persists until you resolve/remove it.
+
+
+
+
+ + + + +
+
+ + +
+
+
+

✅ Roadmap Tasks

+
Web27 Roadmap (updated) — progress saves in this browser · click a section to expand / collapse · click a week badge to move / update a task
+
+
+ + +
+
+
+
+
+ +
+ + +
+ + +
+
+
+

🎯 Due This Week

+
+
💡 Click a bubble to mark it in progress / complete / delayed, or move it to a different week
+
+
+
+ +
🚩 Your flags (open) · click a flag to edit it
+
+ +
📅 Up Next (following weeks) · click a bubble to update
+
+
+ + +
+
+
+

🗺️ Roadmap Timeline

+
WK 1–33 · amber column = current week · 💡 drag a bubble or a task row to another week to move it · click for a note
+
+
+ + + + + +
+
+
+
+
+ +
+ +
+ + + + + + + + + + + + +
+ + + + diff --git a/build_hub.mjs b/build_hub.mjs new file mode 100644 index 0000000..1702bf7 --- /dev/null +++ b/build_hub.mjs @@ -0,0 +1,225 @@ +import fs from "fs"; +const BASE = "/Users/paige.petrone/messingaround"; +const rm = fs.readFileSync(`${BASE}/Web Team ServiceMeow - Roadmap.html`, "utf8"); +const ut = fs.readFileSync(`${BASE}/UAT-Outreach-Tracker.html`, "utf8"); +const newMid = fs.readFileSync(`${BASE}/uat_new_section.js`, "utf8"); + +const extract = html => { + const style = html.match(/ + + +${tabHtml} + +
+${R.body} +
+ +
+${ub} +
+ +${waHtml} + + + + + + + +`; +fs.writeFileSync(`${BASE}/ServiceMeow-HQ.html`, out); +console.log("wrote ServiceMeow-HQ.html", out.length, "bytes"); diff --git a/node_modules/.bin/specificity b/node_modules/.bin/specificity new file mode 120000 index 0000000..ee9d3af --- /dev/null +++ b/node_modules/.bin/specificity @@ -0,0 +1 @@ +../@bramus/specificity/bin/cli.js \ No newline at end of file diff --git a/node_modules/.bin/tldts b/node_modules/.bin/tldts new file mode 120000 index 0000000..8500124 --- /dev/null +++ b/node_modules/.bin/tldts @@ -0,0 +1 @@ +../tldts/bin/cli.js \ No newline at end of file diff --git a/node_modules/.package-lock.json b/node_modules/.package-lock.json new file mode 100644 index 0000000..dd64522 --- /dev/null +++ b/node_modules/.package-lock.json @@ -0,0 +1,486 @@ +{ + "lockfileVersion": 3, + "requires": true, + "packages": { + "node_modules/@asamuzakjp/css-color": { + "version": "7.1.5", + "resolved": "https://registry.npmjs.org/@asamuzakjp/css-color/-/css-color-7.1.5.tgz", + "integrity": "sha512-jCpAvj8apa7SKHZYogk0rbXB3Kb0hLFrpkWF+Ap+vBA5rirItnpv9NKyAyEuDuFizvl0qwnj6JWR70RGJ0rOlw==", + "license": "MIT", + "dependencies": { + "@csstools/css-calc": "^3.4.3", + "@csstools/css-color-parser": "^4.2.6", + "@csstools/css-parser-algorithms": "^4.0.2", + "@csstools/css-tokenizer": "^4.0.2", + "lru-cache": "^11.5.3" + }, + "engines": { + "node": "^22.22.2 || ^24.15.0 || >=26.0.0" + } + }, + "node_modules/@asamuzakjp/dom-selector": { + "version": "9.2.4", + "resolved": "https://registry.npmjs.org/@asamuzakjp/dom-selector/-/dom-selector-9.2.4.tgz", + "integrity": "sha512-YnVzxDxLaqL0t7Q4wfcgHZjg55Wm6y5EaO7Bhu3q9J7wq/8iw3PhsnWiOQhYekx4VexnbkgWpTT6n+QIV7kczw==", + "license": "MIT", + "dependencies": { + "bidi-js": "^1.1.0", + "css-tree": "^3.2.1", + "is-potential-custom-element-name": "^1.0.1", + "lru-cache": "^11.5.3" + }, + "engines": { + "node": "^22.22.2 || ^24.15.0 || >=26.0.0" + } + }, + "node_modules/@bramus/specificity": { + "version": "2.4.3", + "resolved": "https://registry.npmjs.org/@bramus/specificity/-/specificity-2.4.3.tgz", + "integrity": "sha512-0GEz8qJWokkUVYQYRukmkSHIFNoBH8QTreeHrAFbvz1XFYc3Y+puhMs8PQ5x8GNugiC2l5jvDBXKLbBIByeSBw==", + "license": "MIT", + "dependencies": { + "css-tree": "^3.2.1" + }, + "bin": { + "specificity": "bin/cli.js" + } + }, + "node_modules/@csstools/color-helpers": { + "version": "6.1.2", + "resolved": "https://registry.npmjs.org/@csstools/color-helpers/-/color-helpers-6.1.2.tgz", + "integrity": "sha512-grhRy3OKmniaAEKXMjua5z/EODX0MSqBGjunw8+j/3HQjOnahs2AGhvEOIYVUWcU6ScApbhLhVrQTX8XqrMrow==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/csstools" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/csstools" + } + ], + "license": "MIT-0", + "engines": { + "node": ">=20.19.0" + } + }, + "node_modules/@csstools/css-calc": { + "version": "3.4.3", + "resolved": "https://registry.npmjs.org/@csstools/css-calc/-/css-calc-3.4.3.tgz", + "integrity": "sha512-iex20d8CHVkyvg6B7UKV7uHnI2Bqo9g+EFfT9E0y+GvTvhZ/DwONJ+9aKb1dlqm0ZiGsL5RXjp0fCoJYnkeDjA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/csstools" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/csstools" + } + ], + "license": "MIT", + "engines": { + "node": ">=20.19.0" + }, + "peerDependencies": { + "@csstools/css-parser-algorithms": "^4.0.2", + "@csstools/css-tokenizer": "^4.0.2" + } + }, + "node_modules/@csstools/css-color-parser": { + "version": "4.2.6", + "resolved": "https://registry.npmjs.org/@csstools/css-color-parser/-/css-color-parser-4.2.6.tgz", + "integrity": "sha512-iiPQ3iRWwnJkeEn6RIu6SJPr7hYrLz6XZ9s/QZl+2/LI5KQVjpl2fdmDSZKuD4xP6GMmMPgHFFXg6k1Wkz0Trg==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/csstools" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/csstools" + } + ], + "license": "MIT", + "dependencies": { + "@csstools/color-helpers": "^6.1.2", + "@csstools/css-calc": "^3.4.3" + }, + "engines": { + "node": ">=20.19.0" + }, + "peerDependencies": { + "@csstools/css-parser-algorithms": "^4.0.2", + "@csstools/css-tokenizer": "^4.0.2" + } + }, + "node_modules/@csstools/css-parser-algorithms": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/@csstools/css-parser-algorithms/-/css-parser-algorithms-4.0.2.tgz", + "integrity": "sha512-40cSKyMvK+tq4qz6Awrlye2WGuOKt3FwPgtGg6KTfbHOWNw+Rk1rzbAtZnZ6IBhsY491HLRnDXwoyBAijmmILA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/csstools" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/csstools" + } + ], + "license": "MIT", + "engines": { + "node": ">=20.19.0" + }, + "peerDependencies": { + "@csstools/css-tokenizer": "^4.0.2" + } + }, + "node_modules/@csstools/css-syntax-patches-for-csstree": { + "version": "1.1.15", + "resolved": "https://registry.npmjs.org/@csstools/css-syntax-patches-for-csstree/-/css-syntax-patches-for-csstree-1.1.15.tgz", + "integrity": "sha512-J0u7HkVl2nzSlhsiTOp4AmwcUQ3D+mGEEKfBy/7To5/y7F2OHwyLrXfrhR0SMgr4p5Lo+eaMVSeai24zUcBIxA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/csstools" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/csstools" + } + ], + "license": "MIT-0", + "peerDependencies": { + "css-tree": "^3.2.1" + }, + "peerDependenciesMeta": { + "css-tree": { + "optional": true + } + } + }, + "node_modules/@csstools/css-tokenizer": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/@csstools/css-tokenizer/-/css-tokenizer-4.0.2.tgz", + "integrity": "sha512-OoKoR0f76dCY666JlcbhmVTs2drYj1GUXZTYTcbUgJjh9Nv41aFfZ21bPQTERm5+L5cBDo466NltB2lplS5GBw==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/csstools" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/csstools" + } + ], + "license": "MIT", + "engines": { + "node": ">=20.19.0" + } + }, + "node_modules/@exodus/bytes": { + "version": "1.16.0", + "resolved": "https://registry.npmjs.org/@exodus/bytes/-/bytes-1.16.0.tgz", + "integrity": "sha512-IcpW84uEn3N7ETtNZMlxKhfl6Pec8rUNGOTBtWbK1FKhJxIFAptZyVrvVRVBimAJxJCgc3PxepxkdWWG4DVzfA==", + "license": "MIT", + "engines": { + "node": "^20.19.0 || ^22.12.0 || >=24.0.0" + }, + "peerDependencies": { + "@noble/hashes": "^1.8.0 || ^2.0.0" + }, + "peerDependenciesMeta": { + "@noble/hashes": { + "optional": true + } + } + }, + "node_modules/bidi-js": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/bidi-js/-/bidi-js-1.1.0.tgz", + "integrity": "sha512-fX1Onk0tdVPC7obPWB5EbJ1z7NVhLq4m2xZLq2YXBkxzMXIGRpNMU88n0EPgWseKl12J7zXs7qrDxPK4sRs2fg==", + "license": "MIT", + "dependencies": { + "require-from-string": "^2.0.2" + } + }, + "node_modules/css-tree": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/css-tree/-/css-tree-3.2.1.tgz", + "integrity": "sha512-X7sjQzceUhu1u7Y/ylrRZFU2FS6LRiFVp6rKLPg23y3x3c3DOKAwuXGDp+PAGjh6CSnCjYeAul8pcT8bAl+lSA==", + "license": "MIT", + "dependencies": { + "mdn-data": "2.27.1", + "source-map-js": "^1.2.1" + }, + "engines": { + "node": "^10 || ^12.20.0 || ^14.13.0 || >=15.0.0" + } + }, + "node_modules/data-urls": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/data-urls/-/data-urls-8.0.0.tgz", + "integrity": "sha512-JQUCCK+/CAGbGGx618PlFZMXH81Jtj7t73CHv9dd/zVWvxgGT2zLFRjnKb+Ng46GIwcy+f7f88qd4duqllK+WQ==", + "license": "MIT", + "dependencies": { + "whatwg-mimetype": "^5.0.0", + "whatwg-url": "^17.1.2" + }, + "engines": { + "node": "^22.14.0 || >=24.0.0" + } + }, + "node_modules/decimal.js": { + "version": "10.6.0", + "resolved": "https://registry.npmjs.org/decimal.js/-/decimal.js-10.6.0.tgz", + "integrity": "sha512-YpgQiITW3JXGntzdUmyUR1V812Hn8T1YVXhCu+wO3OpS4eU9l4YdD3qjyiKdV6mvV29zapkMeD390UVEf2lkUg==", + "license": "MIT" + }, + "node_modules/entities": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/entities/-/entities-8.1.0.tgz", + "integrity": "sha512-kxL7msIffSuh9aaFAMD7rxAIuTRMAHMeBtgHW2yUdWw732ZNh4MehkF2gdjvtdmikkaIP9bFDDJOPlsvm7avrA==", + "license": "BSD-2-Clause", + "engines": { + "node": ">=20.19.0" + }, + "funding": { + "url": "https://github.com/fb55/entities?sponsor=1" + } + }, + "node_modules/html-encoding-sniffer": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/html-encoding-sniffer/-/html-encoding-sniffer-7.0.0.tgz", + "integrity": "sha512-UikN5yr7xsCDAq87Or5or0PAlD3HJJOKVzM05az588WnpDJ4Ux7a2A53Qi6gofGg2/EtvF/H4hCi/TXfCW4Y6w==", + "license": "MIT", + "dependencies": { + "@exodus/bytes": "^1.15.1" + }, + "engines": { + "node": "^22.13.0 || >=24.0.0" + } + }, + "node_modules/is-potential-custom-element-name": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-potential-custom-element-name/-/is-potential-custom-element-name-1.0.1.tgz", + "integrity": "sha512-bCYeRA2rVibKZd+s2625gGnGF/t7DSqDs4dP7CrLA1m7jKWz6pps0LpYLJN8Q64HtmPKJ1hrN3nzPNKFEKOUiQ==", + "license": "MIT" + }, + "node_modules/jsdom": { + "version": "30.1.2", + "resolved": "https://registry.npmjs.org/jsdom/-/jsdom-30.1.2.tgz", + "integrity": "sha512-0FFE/jE1rppmVfUrJUgxqXjcwolZYIGtAgj1pTussMhNZxIxi7W/PvfWaMNroGi2B36X1IKHbexpZ9DhkoOPiQ==", + "license": "MIT", + "dependencies": { + "@asamuzakjp/css-color": "^7.1.3", + "@asamuzakjp/dom-selector": "^9.2.4", + "@bramus/specificity": "^2.4.2", + "@csstools/css-syntax-patches-for-csstree": "^1.1.15", + "@exodus/bytes": "^1.16.0", + "css-tree": "^3.2.1", + "data-urls": "^8.0.0", + "decimal.js": "^10.6.0", + "html-encoding-sniffer": "^7.0.0", + "is-potential-custom-element-name": "^1.0.1", + "lru-cache": "^11.5.3", + "parse5": "^8.0.1", + "saxes": "^6.0.0", + "tough-cookie": "^6.0.2", + "undici": "^8.11.2", + "w3c-xmlserializer": "^6.0.0", + "webidl-conversions": "^8.0.1", + "whatwg-mimetype": "^5.0.0", + "whatwg-url": "^17.2.0", + "xml-name-validator": "^5.0.0" + }, + "engines": { + "node": "^22.22.2 || ^24.15.0 || >=26.0.0" + }, + "peerDependencies": { + "canvas": "^3.2.3" + }, + "peerDependenciesMeta": { + "canvas": { + "optional": true + } + } + }, + "node_modules/lru-cache": { + "version": "11.5.3", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-11.5.3.tgz", + "integrity": "sha512-U4N8FgzmWxc8k1VH8Kr6lQg18U7Fjvby6wXHVRX/ZZ7IwWbRMgrRbP0Wrb5q5NVinryp4SQampHKdvtecItxUg==", + "license": "BlueOak-1.0.0", + "engines": { + "node": "20 || >=22" + } + }, + "node_modules/mdn-data": { + "version": "2.27.1", + "resolved": "https://registry.npmjs.org/mdn-data/-/mdn-data-2.27.1.tgz", + "integrity": "sha512-9Yubnt3e8A0OKwxYSXyhLymGW4sCufcLG6VdiDdUGVkPhpqLxlvP5vl1983gQjJl3tqbrM731mjaZaP68AgosQ==", + "license": "CC0-1.0" + }, + "node_modules/parse5": { + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/parse5/-/parse5-8.0.1.tgz", + "integrity": "sha512-z1e/HMG90obSGeidlli3hj7cbocou0/wa5HacvI3ASx34PecNjNQeaHNo5WIZpWofN9kgkqV1q5YvXe3F0FoPw==", + "license": "MIT", + "dependencies": { + "entities": "^8.0.0" + }, + "funding": { + "url": "https://github.com/inikulin/parse5?sponsor=1" + } + }, + "node_modules/punycode": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz", + "integrity": "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==", + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/require-from-string": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/require-from-string/-/require-from-string-2.0.2.tgz", + "integrity": "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/saxes": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/saxes/-/saxes-6.0.0.tgz", + "integrity": "sha512-xAg7SOnEhrm5zI3puOOKyy1OMcMlIJZYNJY7xLBwSze0UjhPLnWfj2GF2EpT0jmzaJKIWKHLsaSSajf35bcYnA==", + "license": "ISC", + "dependencies": { + "xmlchars": "^2.2.0" + }, + "engines": { + "node": ">=v12.22.7" + } + }, + "node_modules/source-map-js": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.2.tgz", + "integrity": "sha512-KGj/8Y43x35aZVDtt+J4mK1hoLGHULMYfSkODJNQjNDC3oW1PqPoxMwo0pLUsWM/UEGzON/NxeHywEfNXNP3Vw==", + "license": "BSD-3-Clause", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/tldts": { + "version": "7.4.18", + "resolved": "https://registry.npmjs.org/tldts/-/tldts-7.4.18.tgz", + "integrity": "sha512-somxA8xKAUzlAxl0TX/jMSYIbRNFIVGnI96pVGJPeMc5BsHmfVXn6mOJT6U++ELnl04eGfzpfcEuZe8WiASkXg==", + "license": "MIT", + "dependencies": { + "tldts-core": "^7.4.18" + }, + "bin": { + "tldts": "bin/cli.js" + } + }, + "node_modules/tldts-core": { + "version": "7.4.18", + "resolved": "https://registry.npmjs.org/tldts-core/-/tldts-core-7.4.18.tgz", + "integrity": "sha512-KI2PKvCmvQI/xD6ypPqkU0i7oxNXR/O58RLRaHR4svsgVUQ2JE/XC8BtMbG6PSehD27I8sZJRcC1ASnCy6lp3g==", + "license": "MIT" + }, + "node_modules/tough-cookie": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-6.0.2.tgz", + "integrity": "sha512-exgYmnmL/sJpR3upZfXG5PoatXQii55xAiXGXzY+sROLZ/Y+SLcp9PgJNI9Vz37HpQ74WvDcLT8eqm+kV3FzrA==", + "license": "BSD-3-Clause", + "dependencies": { + "tldts": "^7.0.5" + }, + "engines": { + "node": ">=16" + } + }, + "node_modules/tr46": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/tr46/-/tr46-7.0.0.tgz", + "integrity": "sha512-BcDSDW+SIGWVOns1Zm6Yg91q9AEj7eaID0QDY9oIqJD1A8dscNwMcl9Sms2DeuWCNov1X0/oXanHGYQBSLwZsg==", + "license": "MIT", + "dependencies": { + "punycode": "^2.3.1" + }, + "engines": { + "node": "^22.14.0 || >=24.0.0" + } + }, + "node_modules/undici": { + "version": "8.12.1", + "resolved": "https://registry.npmjs.org/undici/-/undici-8.12.1.tgz", + "integrity": "sha512-usz3OVQBeh1LxNn0DzU0voLXMgn5CU/WUdpBsY6Ti5afNao+vTkmn4H/NxoXolc10cOqe2+YIG0Hspq2rsl64w==", + "license": "MIT", + "engines": { + "node": ">=22.19.0" + } + }, + "node_modules/w3c-xmlserializer": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/w3c-xmlserializer/-/w3c-xmlserializer-6.0.0.tgz", + "integrity": "sha512-4Nsy8K5Tr6SPDH9jhKJOHf7ChDrc1zufZTVSF7x72hwuEXBqxqk9G6cK+K2NRUtB3iELRJqjXb4JPDMBjMTl2Q==", + "license": "MIT", + "dependencies": { + "xml-name-validator": "^5.0.0" + }, + "engines": { + "node": "^22.22.2 || ^24.15.0 || >=26.0.0" + } + }, + "node_modules/webidl-conversions": { + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-8.0.1.tgz", + "integrity": "sha512-BMhLD/Sw+GbJC21C/UgyaZX41nPt8bUTg+jWyDeg7e7YN4xOM05YPSIXceACnXVtqyEw/LMClUQMtMZ+PGGpqQ==", + "license": "BSD-2-Clause", + "engines": { + "node": ">=20" + } + }, + "node_modules/whatwg-mimetype": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/whatwg-mimetype/-/whatwg-mimetype-5.0.0.tgz", + "integrity": "sha512-sXcNcHOC51uPGF0P/D4NVtrkjSU2fNsm9iog4ZvZJsL3rjoDAzXZhkm2MWt1y+PUdggKAYVoMAIYcs78wJ51Cw==", + "license": "MIT", + "engines": { + "node": ">=20" + } + }, + "node_modules/whatwg-url": { + "version": "17.3.0", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-17.3.0.tgz", + "integrity": "sha512-KwOAJrpf+GTgBvcBQJcP38sMF0DsQKdwtG+TxM2pW44P6E5k0hDbWrDmyuJDIF0Uef0aQq0ZoJs+5oI+k8ddhg==", + "license": "MIT", + "dependencies": { + "@exodus/bytes": "^1.16.0", + "tr46": "^7.0.0", + "webidl-conversions": "^8.0.1" + }, + "engines": { + "node": "^22.14.0 || >=24.0.0" + } + }, + "node_modules/xml-name-validator": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/xml-name-validator/-/xml-name-validator-5.0.0.tgz", + "integrity": "sha512-EvGK8EJ3DhaHfbRlETOWAS5pO9MZITeauHKJyb8wyajUfQUenkIg2MvLDTZ4T/TgIcm3HU0TFBgWWboAZ30UHg==", + "license": "Apache-2.0", + "engines": { + "node": ">=18" + } + }, + "node_modules/xmlchars": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/xmlchars/-/xmlchars-2.2.0.tgz", + "integrity": "sha512-JZnDKK8B0RCDw84FNdDAIpZK+JuJw+s7Lz8nksI7SIuU3UXJJslUthsi+uWBUYOwPFwW7W7PRLRfUKpxjtjFCw==", + "license": "MIT" + } + } +} diff --git a/node_modules/@asamuzakjp/css-color/LICENSE b/node_modules/@asamuzakjp/css-color/LICENSE new file mode 100644 index 0000000..0004c52 --- /dev/null +++ b/node_modules/@asamuzakjp/css-color/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2024 asamuzaK (Kazz) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/node_modules/@asamuzakjp/css-color/README.md b/node_modules/@asamuzakjp/css-color/README.md new file mode 100644 index 0000000..81bb135 --- /dev/null +++ b/node_modules/@asamuzakjp/css-color/README.md @@ -0,0 +1,149 @@ +# CSS color + +[![build](https://github.com/asamuzaK/cssColor/actions/workflows/node.js.yml/badge.svg)](https://github.com/asamuzaK/cssColor/actions/workflows/node.js.yml) +[![CodeQL](https://github.com/asamuzaK/cssColor/actions/workflows/github-code-scanning/codeql/badge.svg)](https://github.com/asamuzaK/cssColor/actions/workflows/github-code-scanning/codeql) +[![npm (scoped)](https://img.shields.io/npm/v/@asamuzakjp/css-color)](https://www.npmjs.com/package/@asamuzakjp/css-color) + +A robust and modern library to resolve, parse, and convert CSS colors. +Supports the latest CSS Color Module Level 4 & 5 specifications. + +## Features + +- **Modern CSS Color Support:** Accurately resolves `color-mix()`, `color()`, modern color spaces (`oklch`, `oklab`, `lch`, `lab`, `hwb`, etc.), and relative colors (`lab(from red l a b)`, `color(from red xyz-d50 x y z)`). +- **Deep Resolution:** Deeply resolves `var()` and `calc()` functions embedded within color values. +- **Gradient Resolution & Parsing:** Supports resolving, parsing, and validation for `linear-gradient`, `radial-gradient`, and `conic-gradient`. +- **Comprehensive Color Conversion:** Highly accurate converters between HEX, HSL, HWB, LAB, LCH, Oklab, Oklch, RGB, and XYZ color spaces. +- **Bonus Utilities:** Includes convenient functions to validate colors or gradients, extract CSS variables, and safely split CSS values. +- **Used in jsdom:** Adopted as the CSS color parser and resolver for `jsdom`. +- **Pure ESM with TypeScript Ready:** Native ESM (`type: "module"`) with comprehensive TypeScript definitions. + +## Install + +```console +npm i @asamuzakjp/css-color +``` + +## Quick Start + +```javascript +import { + convert, + resolve, + resolveGradient, + utils +} from '@asamuzakjp/css-color'; +``` + +### Samples + +1. Resolve complex modern CSS colors: + +```javascript +const resolvedMix = resolve( + 'color-mix(in oklab, lch(67.5345 42.5 258.2), color(srgb 0 0.5 0))' +); +// => 'oklab(0.620754 -0.0931934 -0.00374881)' +``` + +2. Resolve with Custom Properties and calc(): + +```javascript +const resolvedVar = resolve('hsl(calc(var(--base-hue) * 3) 100% 50% / .5)', { + customProperty: { '--base-hue': '210deg' } +}); +// => 'rgba(128, 0, 255, 0.5)' +``` + +3. Resolve gradients: + +```javascript +const resolvedGradient = resolveGradient( + 'linear-gradient(to right, red, blue)' +); +// => 'linear-gradient(to right, rgb(255 0 0), rgb(0 0 255))' +``` + +4. Convert between color spaces: + +```javascript +const hex = convert.colorToHex('lab(46.2775% -47.5621 48.5837)'); +// => '#008000' +``` + +5. Validate colors and gradients: + +```javascript +const isColor = utils.isColor('light-dark(red, blue)'); +// => true + +const isGradient = utils.isGradient( + 'conic-gradient(from 0.5turn at 50% 50%, red, blue)' +); +// => true +``` + +## API Reference + +### `resolve(color, opt?)` + +Resolves a CSS color string into its computed or specified value. System colors are not supported. + +- **`color`** ``: The CSS color value to resolve. +- **`opt`** `` _(optional)_: + - `opt.currentColor`: Color to use for the `currentcolor` keyword. + - `opt.customProperty`: Object containing `--` prefixed keys and their values, or a `callback(propertyName)` function to dynamically resolve CSS variables. + - `opt.dimension`: Object mapping units (e.g., `em`, `rem`, `vw`) to pixel numbers, or a `callback(unit)` function for dynamic length resolution. + - `opt.format`: Output format. Options: `computedValue` (default), `specifiedValue`, `hex`, `hexAlpha`. + - `opt.colorScheme`: `normal` (default), `light`, or `dark` (useful for `light-dark()` resolution). + +### `resolveGradient(gradient, opt?)` + +Resolves a CSS gradient string (e.g., `linear-gradient`, `radial-gradient`, `conic-gradient`) into its resolved form. + +- **`gradient`** ``: The CSS gradient string to resolve. +- **`opt`** `` _(optional)_: Same options as `resolve`. + +### `convert` + +A collection of color conversion utilities. + + +| Function | Returns | Options | Description | +| :-------------- | :-------------- | :-------------- | :-------------- | +| `convert.colorToHex(value, opt?)` | `string \| null` | `opt.alpha` ``
_(+ see `resolve` options)_ | Returns `#rrggbb` or `#rrggbbaa` (if `opt.alpha` is true). | +| `convert.colorToHsl(value, opt?)` | `number[]` | _See `resolve` options_ | Converts to HSL channels: `[h, s, l, alpha]` | +| `convert.colorToHwb(value, opt?)` | `number[]` | _See `resolve` options_ | Converts to HWB channels: `[h, w, b, alpha]` | +| `convert.colorToLab(value, opt?)` | `number[]` | _See `resolve` options_ | Converts to CIE LAB channels: `[l, a, b, alpha]` | +| `convert.colorToLch(value, opt?)` | `number[]` | _See `resolve` options_ | Converts to CIE LCH channels: `[l, c, h, alpha]` | +| `convert.colorToOklab(value, opt?)` | `number[]` | _See `resolve` options_ | Converts to Oklab channels: `[l, a, b, alpha]` | +| `convert.colorToOklch(value, opt?)` | `number[]` | _See `resolve` options_ | Converts to Oklch channels: `[l, c, h, alpha]` | +| `convert.colorToRgb(value, opt?)` | `number[]` | _See `resolve` options_ | Converts to sRGB channels: `[r, g, b, alpha]` | +| `convert.colorToXyz(value, opt?)` | `number[]` | _See `resolve` options_ | Converts to CIE XYZ channels (defaults to D65): `[x, y, z, alpha]` | +| `convert.colorToXyzD50(value, opt?)` | `number[]` | _See `resolve` options_ | Converts to CIE XYZ channels with D50 white point. | + +### `utils` + +Helpful internal tools exposed for advanced usage, parsing, and validation. + + +| Function | Returns | Options (`opt`) | Description | +| :-------------- | :-------------- | :-------------- | :-------------- | +| `utils.cssCalc(value, opt?)` | `string` | `opt.dimension`
_(+ see `resolve` options)_ | Resolves CSS `calc()` expressions. | +| `utils.cssVar(value, opt?)` | `string` | `opt.customProperty`
_(+ see `resolve` options)_ | Resolves CSS `var()` expressions. | +| `utils.extractDashedIdent(value)` | `string[]` | _None_ | Extracts custom property names (dashed-ident tokens) from a value. | +| `utils.isColor(value, opt?)` | `boolean` | _See `resolve` options_ | Returns `true` if the string is a valid CSS color. | +| `utils.isGradient(value, opt?)` | `boolean` | _See `resolve` options_ | Returns `true` if the string is a valid CSS gradient. | +| `utils.resolveGradient(value, opt?)` | `string` | _See `resolve` options_ | **Deprecated:** Use `resolveGradient` directly instead. | +| `utils.resolveLengthInPixels(value, unit, opt?)` | `number` | `opt.dimension`
_(+ see `resolve` options)_ | Converts an absolute or relative CSS length to pixels. | +| `utils.splitValue(value, opt?)` | `string[]` | `opt.delimiter` ``
`opt.preserveComment` `` | Safely splits a CSS value by a specified delimiter (` `, `,`, `/`). | + +## Acknowledgments + +The following resources have been of great help in the development of this library: + +- [csstools/postcss-plugins](https://github.com/csstools/postcss-plugins) +- [lru-cache](https://github.com/isaacs/node-lru-cache) + +--- + +Copyright (c) 2024 [asamuzaK (Kazz)](https://github.com/asamuzaK/) diff --git a/node_modules/@asamuzakjp/css-color/dist/esm/converters/convert-color.d.ts b/node_modules/@asamuzakjp/css-color/dist/esm/converters/convert-color.d.ts new file mode 100644 index 0000000..710f9f6 --- /dev/null +++ b/node_modules/@asamuzakjp/css-color/dist/esm/converters/convert-color.d.ts @@ -0,0 +1,67 @@ +/** + * color + */ +import { ColorChannels, ColorChannelsWithPowerless, LinearRgbOptions, Options } from '../typedef'; +/** + * convert color value to linear rgb + * @param value - CSS color value + * @param opt - options + * @returns ColorChannels | null - [r, g, b, alpha] r|g|b|alpha: 0..1 + */ +export declare const convertColorToLinearRgb: (value: string, opt?: LinearRgbOptions) => ColorChannels | null; +/** + * convert color value to rgb + * @param value - CSS color value + * @param opt - options + * @returns ColorChannels | null - [r, g, b, alpha] r|g|b: 0..255 alpha: 0..1 + */ +export declare const convertColorToRgb: (value: string, opt?: Options) => ColorChannels | null; +/** + * convert color value to xyz + * @param value - CSS color value + * @param opt - options + * @returns ColorChannels | null - [x, y, z, alpha] + */ +export declare const convertColorToXyz: (value: string, opt?: Options) => ColorChannels | null; +/** + * convert color value to hsl + * @param value - CSS color value + * @param opt - options + * @returns ColorChannels | null - [h, s, l, alpha], hue may be powerless + */ +export declare const convertColorToHsl: (value: string, opt?: Options) => ColorChannels | ColorChannelsWithPowerless | null; +/** + * convert color value to hwb + * @param value - CSS color value + * @param opt - options + * @returns ColorChannels | null - [h, w, b, alpha], hue may be powerless + */ +export declare const convertColorToHwb: (value: string, opt?: Options) => ColorChannels | [number | string, number, number, number] | null; +/** + * convert color value to lab + * @param value - CSS color value + * @param opt - options + * @returns ColorChannels | null - [l, a, b, alpha] + */ +export declare const convertColorToLab: (value: string, opt?: Options) => ColorChannels | null; +/** + * convert color value to lch + * @param value - CSS color value + * @param opt - options + * @returns ColorChannels | null - [l, c, h, alpha], hue may be powerless + */ +export declare const convertColorToLch: (value: string, opt?: Options) => ColorChannels | [number, number, number | string, number] | null; +/** + * convert color value to oklab + * @param value - CSS color value + * @param opt - options + * @returns ColorChannels | null - [l, a, b, alpha] + */ +export declare const convertColorToOklab: (value: string, opt?: Options) => ColorChannels | null; +/** + * convert color value to oklch + * @param value - CSS color value + * @param opt - options + * @returns ColorChannels | null - [l, c, h, alpha], hue may be powerless + */ +export declare const convertColorToOklch: (value: string, opt?: Options) => ColorChannels | [number, number, number | string, number] | null; diff --git a/node_modules/@asamuzakjp/css-color/dist/esm/converters/convert-hex.d.ts b/node_modules/@asamuzakjp/css-color/dist/esm/converters/convert-hex.d.ts new file mode 100644 index 0000000..4499f40 --- /dev/null +++ b/node_modules/@asamuzakjp/css-color/dist/esm/converters/convert-hex.d.ts @@ -0,0 +1,47 @@ +/** + * convert-hex + */ +import { ColorChannels } from '../typedef'; +/** + * convert rgb to hex color + * @param rgb - [r, g, b, alpha] r|g|b: 0..255 alpha: 0..1 + * @returns hex color + */ +export declare const convertRgbToHex: (rgb: ColorChannels) => string; +/** + * convert linear rgb to hex color + * @param rgb - [r, g, b, alpha] r|g|b|alpha: 0..1 + * @param [skip] - skip validate + * @returns hex color + */ +export declare const convertLinearRgbToHex: (rgb: ColorChannels, skip?: boolean) => string; +/** + * convert xyz to hex color + * @param xyz - [x, y, z, alpha] + * @returns hex color + */ +export declare const convertXyzToHex: (xyz: ColorChannels) => string; +/** + * convert xyz D50 to hex color + * @param xyz - [x, y, z, alpha] + * @returns hex color + */ +export declare const convertXyzD50ToHex: (xyz: ColorChannels) => string; +/** + * convert hex color to rgb + * @param value - hex color value + * @returns ColorChannels - [r, g, b, alpha] r|g|b: 0..255 alpha: 0..1 + */ +export declare const convertHexToRgb: (value: string) => ColorChannels; +/** + * convert hex color to linear rgb + * @param value - hex color value + * @returns ColorChannels - [r, g, b, alpha] r|g|b|alpha: 0..1 + */ +export declare const convertHexToLinearRgb: (value: string) => ColorChannels; +/** + * convert hex color to xyz + * @param value - hex color value + * @returns ColorChannels - [x, y, z, alpha] + */ +export declare const convertHexToXyz: (value: string) => ColorChannels; diff --git a/node_modules/@asamuzakjp/css-color/dist/esm/converters/convert.d.ts b/node_modules/@asamuzakjp/css-color/dist/esm/converters/convert.d.ts new file mode 100644 index 0000000..5a69a52 --- /dev/null +++ b/node_modules/@asamuzakjp/css-color/dist/esm/converters/convert.d.ts @@ -0,0 +1,101 @@ +/** + * convert + */ +import { ColorChannels, Options } from '../typedef'; +/** + * pre process + * @param value - CSS color value + * @param opt - options + * @returns value + */ +export declare const preProcess: (value: string, opt: Options) => string | null; +/** + * convert number to hex string + * @param value - numeric value + * @returns hex string: 00..ff + */ +export declare const numberToHex: (value: number) => string; +/** + * convert color to hex + * @param value - CSS color value + * @param [opt] - options + * @param [opt.alpha] - enable alpha channel + * @returns #rrggbb | #rrggbbaa | null + */ +export declare const colorToHex: (value: string, opt?: Options) => string | null; +/** + * convert color to hsl + * @param value - CSS color value + * @param [opt] - options + * @returns ColorChannels - [h, s, l, alpha] + */ +export declare const colorToHsl: (value: string, opt?: Options) => ColorChannels; +/** + * convert color to hwb + * @param value - CSS color value + * @param [opt] - options + * @returns ColorChannels - [h, w, b, alpha] + */ +export declare const colorToHwb: (value: string, opt?: Options) => ColorChannels; +/** + * convert color to lab + * @param value - CSS color value + * @param [opt] - options + * @returns ColorChannels - [l, a, b, alpha] + */ +export declare const colorToLab: (value: string, opt?: Options) => ColorChannels; +/** + * convert color to lch + * @param value - CSS color value + * @param [opt] - options + * @returns ColorChannels - [l, c, h, alpha] + */ +export declare const colorToLch: (value: string, opt?: Options) => ColorChannels; +/** + * convert color to oklab + * @param value - CSS color value + * @param [opt] - options + * @returns ColorChannels - [l, a, b, alpha] + */ +export declare const colorToOklab: (value: string, opt?: Options) => ColorChannels; +/** + * convert color to oklch + * @param value - CSS color value + * @param [opt] - options + * @returns ColorChannels - [l, c, h, alpha] + */ +export declare const colorToOklch: (value: string, opt?: Options) => ColorChannels; +/** + * convert color to rgb + * @param value - CSS color value + * @param [opt] - options + * @returns ColorChannels - [r, g, b, alpha] + */ +export declare const colorToRgb: (value: string, opt?: Options) => ColorChannels; +/** + * convert color to xyz + * @param value - CSS color value + * @param [opt] - options + * @returns ColorChannels - [x, y, z, alpha] + */ +export declare const colorToXyz: (value: string, opt?: Options) => ColorChannels; +/** + * convert color to xyz-d50 + * @param value - CSS color value + * @param [opt] - options + * @returns ColorChannels - [x, y, z, alpha] + */ +export declare const colorToXyzD50: (value: string, opt?: Options) => ColorChannels; +export declare const convert: { + colorToHex: (value: string, opt?: Options) => string | null; + colorToHsl: (value: string, opt?: Options) => ColorChannels; + colorToHwb: (value: string, opt?: Options) => ColorChannels; + colorToLab: (value: string, opt?: Options) => ColorChannels; + colorToLch: (value: string, opt?: Options) => ColorChannels; + colorToOklab: (value: string, opt?: Options) => ColorChannels; + colorToOklch: (value: string, opt?: Options) => ColorChannels; + colorToRgb: (value: string, opt?: Options) => ColorChannels; + colorToXyz: (value: string, opt?: Options) => ColorChannels; + colorToXyzD50: (value: string, opt?: Options) => ColorChannels; + numberToHex: (value: number) => string; +}; diff --git a/node_modules/@asamuzakjp/css-color/dist/esm/gradients/gradient-util.d.ts b/node_modules/@asamuzakjp/css-color/dist/esm/gradients/gradient-util.d.ts new file mode 100644 index 0000000..d5e9bb5 --- /dev/null +++ b/node_modules/@asamuzakjp/css-color/dist/esm/gradients/gradient-util.d.ts @@ -0,0 +1,56 @@ +/** + * gradient-util + */ +import { Options, ValidateGradientLine, ValidateColorStops } from '../typedef'; +/** + * get gradient type + * @param value - gradient value + * @returns gradient type + */ +export declare const getGradientType: (value: string) => string; +/** + * validate linear-gradient line + * @param value - line value + * @returns result + */ +export declare const validateLinearGradientLine: (value: string) => ValidateGradientLine; +/** + * validate radial-gradient line + * @param value - line value + * @returns result + */ +export declare const validateRadialGradientLine: (value: string) => ValidateGradientLine; +/** + * validate conic-gradient line + * @param value - line value + * @returns result + */ +export declare const validateConicGradientLine: (value: string) => ValidateGradientLine; +/** + * validate gradient line + * @param value - gradient line value + * @param type - gradient type + * @returns result + */ +export declare const validateGradientLine: (value: string, type: string) => ValidateGradientLine; +/** + * Split a color stop into its original component values. + * @param value - color stop or transition hint + * @returns color and position components, retaining comments inside functions + */ +export declare const splitColorStop: (value: string) => string[]; +/** + * Validate a position in a gradient color stop or transition hint. + * @param value - original position component + * @param isConic - whether the gradient uses angle-percentage positions + * @returns whether the position is valid in this gradient context + */ +export declare const isValidPosition: (value: string, isConic: boolean) => boolean; +/** + * validate color stop list + * @param list - color stop list + * @param type - gradient type + * @param [opt] - options + * @returns validated result + */ +export declare const validateColorStopList: (list: string[], type: string, opt?: Options) => ValidateColorStops; diff --git a/node_modules/@asamuzakjp/css-color/dist/esm/gradients/gradient.d.ts b/node_modules/@asamuzakjp/css-color/dist/esm/gradients/gradient.d.ts new file mode 100644 index 0000000..c426cbb --- /dev/null +++ b/node_modules/@asamuzakjp/css-color/dist/esm/gradients/gradient.d.ts @@ -0,0 +1,18 @@ +/** + * gradient + */ +import { Options } from '../typedef'; +/** + * resolve CSS gradient + * @param value - CSS value + * @param [opt] - options + * @returns result + */ +export declare const resolveGradient: (value: string, opt?: Options) => string; +/** + * is CSS gradient + * @param value - CSS value + * @param [opt] - options + * @returns result + */ +export declare const isGradient: (value: string, opt?: Options) => boolean; diff --git a/node_modules/@asamuzakjp/css-color/dist/esm/gradients/parse-gradient.d.ts b/node_modules/@asamuzakjp/css-color/dist/esm/gradients/parse-gradient.d.ts new file mode 100644 index 0000000..5ec181d --- /dev/null +++ b/node_modules/@asamuzakjp/css-color/dist/esm/gradients/parse-gradient.d.ts @@ -0,0 +1,11 @@ +/** + * gradient + */ +import { Gradient, Options } from '../typedef'; +/** + * parse CSS gradient + * @param value - gradient value + * @param [opt] - options + * @returns parsed result + */ +export declare const parseGradient: (value: string, opt?: Options) => Gradient | null; diff --git a/node_modules/@asamuzakjp/css-color/dist/esm/index.d.ts b/node_modules/@asamuzakjp/css-color/dist/esm/index.d.ts new file mode 100644 index 0000000..fa0408d --- /dev/null +++ b/node_modules/@asamuzakjp/css-color/dist/esm/index.d.ts @@ -0,0 +1,22 @@ +/*! + * CSS color - Resolve, parse, convert CSS color. + * @license MIT + * @copyright asamuzaK (Kazz) + * @see {@link https://github.com/asamuzaK/cssColor/blob/main/LICENSE} + */ +export { convert } from './converters/convert'; +export { resolveGradient } from './gradients/gradient'; +export { resolve } from './resolvers/resolve'; +export declare const utils: { + cssCalc: (value: string, opt?: import("./typedef").Options) => string; + cssVar: (value: string, opt?: import("./typedef").Options) => string; + extractDashedIdent: (value: string) => string[]; + isColor: (value: unknown, opt?: import("./typedef").Options) => boolean; + isGradient: (value: string, opt?: import("./typedef").Options) => boolean; + /** + * @deprecated Use `resolveGradient` directly instead. + */ + resolveGradient: (value: string, opt?: import("./typedef").Options) => string; + resolveLengthInPixels: (value: number | string, unit: string | undefined, opt?: import("./typedef").Options) => number; + splitValue: (value: string, opt?: import("./typedef").Options) => string[]; +}; diff --git a/node_modules/@asamuzakjp/css-color/dist/esm/index.js b/node_modules/@asamuzakjp/css-color/dist/esm/index.js new file mode 100644 index 0000000..9c74c5f --- /dev/null +++ b/node_modules/@asamuzakjp/css-color/dist/esm/index.js @@ -0,0 +1,3731 @@ +import { TokenType as e, tokenize as t } from "@csstools/css-tokenizer"; +import { LRUCache as n } from "lru-cache"; +import { calc as r } from "@csstools/css-calc"; +import { SyntaxFlag as i, color as a } from "@csstools/css-color-parser"; +import { isCommentNode as o, isWhitespaceNode as s, parseComponentValue as c, parseListOfComponentValues as l } from "@csstools/css-parser-algorithms"; +//#region src/utils/cache.ts +var u = 4096, d = class { + #e; + constructor(e) { + this.#e = e; + } + get item() { + return this.#e; + } +}, f = new n({ max: u }), p = (e, t) => { + e && (t instanceof d ? f.set(e, t) : f.set(e, new d(t))); +}, m = (e) => { + if (!e) return !1; + let t = f.get(e); + return t !== void 0 && t; +}, h = (e) => { + let t = Object.keys(e); + if (t.length === 0) return ""; + t.sort(); + let n = ""; + for (let r of t) n += `${r}:${JSON.stringify(e[r])};`; + return n; +}, g = (e, t = {}) => { + if (!e || t.customProperty && typeof t.customProperty.callback == "function" || t.dimension && typeof t.dimension.callback == "function") return ""; + let n = e.namespace || "", r = e.name || "", i = e.value || ""; + if (!n && !r && !i) return ""; + let a = `${n}:${r}:${i}`, o = []; + for (let [e, n] of Object.entries(t)) e !== "customProperty" && e !== "dimension" && o.push(`${e}_${n}`); + let s = t.customProperty ? h(t.customProperty) : "", c = t.dimension ? h(t.dimension) : ""; + return `${a}:${o.sort().join("|")}:${s}:${c}`; +}, _ = (e) => typeof e == "string" || e instanceof String, v = (e) => _(e) || typeof e == "number", y = "(?:0|[1-9]\\d*)", b = "clamp|max|min|exp|hypot|log|pow|sqrt|abs|sign|mod|rem|round|a?(?:cos|sin|tan)|atan2", x = `calc|${b}`, S = `var|${x}`, C = "deg|g?rad|turn", w = "[cm]m|[dls]?v(?:[bhiw]|max|min)|in|p[ctx]|q|r?(?:[cl]h|cap|e[mx]|ic)", T = `[+-]?(?:${y}(?:\\.\\d*)?|\\.\\d+)(?:e-?${y})?`, E = `\\+?(?:${y}(?:\\.\\d*)?|\\.\\d+)(?:e-?${y})?`, D = "none", O = `${T}%`, k = `^(?:${x})\\(|(?<=[*\\/\\s\\(])(?:${x})\\(`, A = `^(?:${b})\\($`, j = "^var\\(|(?<=[*\\/\\s\\(])var\\(", ee = `^(?:${S})\\(`, M = `(?:\\s*\\/\\s*(?:${T}|${O}|${D}))?`, te = `(?:\\s*,\\s*(?:${T}|${O}))?`, ne = "(?:ok)?l(?:ab|ch)|color|hsla?|hwb|rgba?", re = "[a-z]+|#[\\da-f]{3}|#[\\da-f]{4}|#[\\da-f]{6}|#[\\da-f]{8}", ie = "(?:ok)?lch|hsl|hwb", ae = "(?:de|in)creasing|longer|shorter", oe = `${T}(?:${C})?`, se = `(?:${T}(?:${C})?|${D})`, ce = `(?:${T}|${O}|${D})`, le = `(?:${ie})(?:\\s(?:${ae})\\shue)?`; +`${ie}${ae}`; +var ue = "(?:ok)?lab", de = "(?:ok)?lch", fe = "(?:a98|prophoto)-rgb|display-p3|rec2020|srgb(?:-linear)?", pe = "xyz(?:-d(?:50|65))?", me = `${ue}|${fe}|${pe}`, he = `${le}|${me}`, ge = `(?:${ne})\\(\\s*from\\s+`, _e = `(${ne})\\(\\s*from\\s+`, ve = "var(", ye = `(?:${fe}|${pe})(?:\\s+${ce}){3}${M}`, be = "^light-dark\\(", xe = `^${ge}|(?<=[\\s])${ge}`, Se = `${se}(?:\\s+${ce}){2}${M}`, Ce = `${oe}(?:\\s*,\\s*${O}){2}${te}`, we = `(?:${ce}\\s+){2}${se}${M}`, Te = `${ce}(?:\\s+${ce}){2}${M}`, Ee = `(?:${T}(?:\\s*,\\s*${T}){2}|${O}(?:\\s*,\\s*${O}){2})${te}`, De = `${re}|hsla?\\(\\s*${Ce}\\s*\\)|rgba?\\(\\s*${Ee}\\s*\\)|(?:hsla?|hwb)\\(\\s*${Se}\\s*\\)|(?:(?:ok)?lab|rgba?)\\(\\s*${Te}\\s*\\)|(?:ok)?lch\\(\\s*${we}\\s*\\)|color\\(\\s*${ye}\\s*\\)`, Oe = `(?:${De})(?:\\s+${O})?`, ke = `color-mix\\(\\s*in\\s+(?:${he})\\s*,\\s*${Oe}\\s*,\\s*${Oe}\\s*\\)`; +`${he}${Oe}${Oe}`; +var N = "computedValue", P = "mixValue", Ae = "specifiedValue", je = .5, Me = 24389 / 27, Ne = 12.92, F = .055, Pe = 1024, Fe = 2.4, Ie = .001, Le = "util", { CloseParen: Re, Comma: ze, Comment: Be, Delim: Ve, EOF: He, Function: Ue, OpenParen: We, Whitespace: Ge } = e, Ke = RegExp(`^(${T})(${C})?$`), qe = /^,$/, Je = /--[\w-]+/g, Ye = /^\/$/, Xe = /^\s+$/, Ze = /* @__PURE__ */ new Map([ + ["xx-small", 9 / 16], + ["x-small", 5 / 8], + ["small", 13 / 16], + ["medium", 1], + ["large", 9 / 8], + ["x-large", 3 / 2], + ["xx-large", 2], + ["xxx-large", 3] +]), Qe = /* @__PURE__ */ new Map([["smaller", 1 / 1.2], ["larger", 1.2]]), $e = /* @__PURE__ */ new Map([ + ["cm", 96 / 2.54], + ["mm", 96 / 25.4], + ["q", 96 / 101.6], + ["in", 96], + ["pc", 16], + ["pt", 96 / 72], + ["px", 1] +]), et = /* @__PURE__ */ new Map([ + ["rcap", 1], + ["rch", .5], + ["rem", 1], + ["rex", .5], + ["ric", 1], + ["rlh", 1.2] +]), tt = (e = {}) => { + let { maxLength: t } = e; + return Number.isInteger(t) && t > 0 && t < 1024 ? t : Pe; +}, I = (e, n = {}) => { + if (!_(e)) throw TypeError(`${e} is not a string.`); + let r = { ...n }, i = e.trim(), a = tt(r); + if (!i || i.length > a) return []; + let { delimiter: o = " ", preserveComment: s = !1 } = r, c = g({ + namespace: Le, + name: "splitValue", + value: i + }, { + delimiter: o, + preserveComment: s + }), l = m(c); + if (l) return [...l.item]; + let u; + switch (o) { + case ",": + u = qe; + break; + case "/": + u = Ye; + break; + default: u = Xe; + } + let d = t({ css: i }), f = 0, h = "", v = []; + for (let [e, t] of d) switch (e) { + case ze: + case Ve: + f === 0 && u.test(t) ? (v.push(h.trim()), h = "") : h += t; + break; + case Be: + s && (o === "," || o === "/") && (h += t); + break; + case Ue: + case We: + h += t, f++; + break; + case Re: + h += t, f--; + break; + case Ge: + u.test(t) ? f === 0 ? h &&= (v.push(h.trim()), "") : h += " " : h.endsWith(" ") || (h += " "); + break; + default: e === He ? (v.push(h.trim()), h = "") : h += t; + } + return p(c, v), [...v]; +}, nt = (e) => { + if (!_(e)) throw TypeError(`${e} is not a string.`); + let t = e.trim(); + if (!t) return []; + let n = g({ + namespace: Le, + name: "extractDashedIdent", + value: t + }), r = m(n); + if (r) return [...r.item]; + let i = t.match(Je), a = i ? [...new Set(i)] : []; + return p(n, a), [...a]; +}, L = (e, t = 0) => { + if (!Number.isFinite(e)) throw TypeError(`${e} is not a finite number.`); + if (!Number.isFinite(t)) throw TypeError(`${t} is not a finite number.`); + if (t < 0 || t > 16) throw RangeError(`${t} is not between 0 and 16.`); + if (t === 0) return Math.round(e); + let n = t === 16 ? 6 : t < 10 ? 4 : 5; + return parseFloat(e.toPrecision(n)); +}, rt = (e, t, n = "shorter") => { + if (!Number.isFinite(e)) throw TypeError(`${e} is not a finite number.`); + if (!Number.isFinite(t)) throw TypeError(`${t} is not a finite number.`); + let r = e, i = t; + switch (n) { + case "decreasing": + i > r && (r += 360); + break; + case "increasing": + i < r && (i += 360); + break; + case "longer": + i > r && i < r + 180 ? r += 360 : i > r - 180 && i <= r && (i += 360); + break; + default: i > r + 180 ? r += 360 : i < r - 180 && (i += 360); + } + return [r, i]; +}, it = (e, t, n = {}) => { + let { dimension: r = {} } = n, { callback: i, em: a, rem: o, vh: s, vw: c } = r; + if (_(e)) { + let t = e.toLowerCase().trim(), r = tt(n); + if (t.length > r) return NaN; + let i = Ze.get(t); + if (i !== void 0 && typeof o == "number") return i * o; + let s = Qe.get(t); + return s !== void 0 && typeof a == "number" ? s * a : NaN; + } + if (Number.isFinite(e) && t) { + let n = t.toLowerCase(); + if (Object.hasOwn(r, n)) { + let t = r[n]; + return typeof t == "number" ? e * t : NaN; + } + if (typeof i == "function") { + let t = i(n); + return typeof t == "number" ? e * t : NaN; + } + let l = $e.get(n); + if (l !== void 0) return e * l; + let u = et.get(n); + if (u !== void 0 && typeof o == "number") return e * u * o; + let d = et.get(`r${n}`); + if (d !== void 0 && typeof a == "number") return e * d * a; + switch (n) { + case "vb": return typeof s == "number" ? e * s : NaN; + case "vi": return typeof c == "number" ? e * c : NaN; + case "vmax": return typeof s == "number" && typeof c == "number" ? e * Math.max(s, c) : NaN; + case "vmin": return typeof s == "number" && typeof c == "number" ? e * Math.min(s, c) : NaN; + } + } + return NaN; +}, at = (e) => { + if (_(e)) e = e.trim(); + else throw TypeError(`${e} is not a string.`); + let t = 360 / (Math.PI * 2); + if (!Ke.test(e)) throw SyntaxError(`Invalid property value: ${e}`); + let [, n, r] = e.match(Ke), i; + switch (r) { + case "grad": + i = parseFloat(n) * .9; + break; + case "rad": + i = parseFloat(n) * t; + break; + case "turn": + i = parseFloat(n) * 360; + break; + default: i = parseFloat(n); + } + return i %= 360, i < 0 ? i += 360 : Object.is(i, -0) && (i = 0), i; +}, ot = (e) => { + if (!Number.isFinite(e)) throw TypeError(`${e} is not a number.`); + if (e = Math.round(e), e < 0 || e > 255) throw RangeError(`${e} is not between 0 and 255.`); + let t = e.toString(16); + return t.length === 1 && (t = `0${t}`), t; +}, R = (e = "") => { + if (_(e)) { + if (e = e.trim(), !e) e = "1"; + else if (e === "none") e = "0"; + else { + let t; + if (t = e.endsWith("%") ? parseFloat(e) / 100 : parseFloat(e), !Number.isFinite(t)) throw TypeError(`${t} is not a finite number.`); + e = t < .001 ? "0" : t > 1 ? "1" : t.toFixed(3); + } + } else e = "1"; + return parseFloat(e); +}, st = (e) => { + if (_(e)) { + if (e === "") throw SyntaxError("Invalid property value: (empty string)"); + e = e.trim(); + } else throw TypeError(`${e} is not a string.`); + let t = parseInt(e, 16); + if (t <= 0) return 0; + if (t >= 255) return 1; + let n = /* @__PURE__ */ new Map(); + for (let e = 1; e < 100; e++) n.set(Math.round(e * 255 / 100), e); + return t = n.has(t) ? n.get(t) / 100 : Math.round(t / 255 / Ie) * Ie, parseFloat(t.toFixed(3)); +}, ct = (e, t, n = !1) => { + if (t === "specifiedValue") return p(e, ""), ""; + if (n) return p(e, null), null; + let r = [ + "rgb", + 0, + 0, + 0, + 0 + ]; + return p(e, r), r; +}, z = (e, t = !1) => { + switch (e) { + case "hsl": + case "hwb": + case P: return null; + case Ae: return ""; + default: return t ? null : [ + "rgb", + 0, + 0, + 0, + 0 + ]; + } +}, lt = [ + .3457 / .3585, + 1, + .2958 / .3585 +], ut = [ + [ + .955473421488075, + -.02309845494876471, + .06325924320057072 + ], + [ + -.0283697093338637, + 1.0099953980813041, + .021041441191917323 + ], + [ + .012314014864481998, + -.020507649298898964, + 1.330365926242124 + ] +], B = [ + [ + 1.0479297925449969, + .022946870601609652, + -.05019226628920524 + ], + [ + .02962780877005599, + .9904344267538799, + -.017073799063418826 + ], + [ + -.009243040646204504, + .015055191490298152, + .7518742814281371 + ] +], dt = [ + [ + 506752 / 1228815, + 87881 / 245763, + 12673 / 70218 + ], + [ + 87098 / 409605, + 175762 / 245763, + 12673 / 175545 + ], + [ + 7918 / 409605, + 87881 / 737289, + 1001167 / 1053270 + ] +], ft = [ + [ + 12831 / 3959, + -329 / 214, + -1974 / 3959 + ], + [ + -851781 / 878810, + 1648619 / 878810, + 36519 / 878810 + ], + [ + 705 / 12673, + -2585 / 12673, + 705 / 667 + ] +], pt = [ + [ + .819022437996703, + .3619062600528904, + -.1288737815209879 + ], + [ + .0329836539323885, + .9292868615863434, + .0361446663506424 + ], + [ + .0481771893596242, + .2642395317527308, + .6335478284694309 + ] +], mt = [ + [ + 1.2268798758459243, + -.5578149944602171, + .2813910456659647 + ], + [ + -.0405757452148008, + 1.112286803280317, + -.0717110580655164 + ], + [ + -.0763729366746601, + -.4214933324022432, + 1.5869240198367816 + ] +], ht = [ + [ + 1, + .3963377773761749, + .2158037573099136 + ], + [ + 1, + -.1055613458156586, + -.0638541728258133 + ], + [ + 1, + -.0894841775298119, + -1.2914855480194092 + ] +], gt = [ + [ + .210454268309314, + .7936177747023054, + -.0040720430116193 + ], + [ + 1.9779985324311684, + -2.42859224204858, + .450593709617411 + ], + [ + .0259040424655478, + .7827717124575296, + -.8086757549230774 + ] +], _t = [ + [ + 608311 / 1250200, + 189793 / 714400, + 198249 / 1000160 + ], + [ + 35783 / 156275, + 247089 / 357200, + 198249 / 2500400 + ], + [ + 0, + 32229 / 714400, + 5220557 / 5000800 + ] +], vt = [ + [ + 63426534 / 99577255, + 20160776 / 139408157, + 47086771 / 278816314 + ], + [ + 26158966 / 99577255, + 472592308 / 697040785, + 8267143 / 139408157 + ], + [ + 0, + 19567812 / 697040785, + 295819943 / 278816314 + ] +], yt = [ + [ + 573536 / 994567, + 263643 / 1420810, + 187206 / 994567 + ], + [ + 591459 / 1989134, + 6239551 / 9945670, + 374412 / 4972835 + ], + [ + 53769 / 1989134, + 351524 / 4972835, + 4929758 / 4972835 + ] +], bt = [ + [ + .7977666449006423, + .13518129740053308, + .0313477341283922 + ], + [ + .2880748288194013, + .711835234241873, + 8993693872564e-17 + ], + [ + 0, + 0, + .8251046025104602 + ] +], V = (e, t = {}) => { + if (!Array.isArray(e)) throw TypeError(`${e} is not an array.`); + let { alpha: n = !1, minLength: r = 3, maxLength: i = 4, minRange: a = 0, maxRange: o = 1, validateRange: s = !0 } = t; + if (!Number.isFinite(r)) throw TypeError(`${r} is not a number.`); + if (!Number.isFinite(i)) throw TypeError(`${i} is not a number.`); + if (!Number.isFinite(a)) throw TypeError(`${a} is not a number.`); + if (!Number.isFinite(o)) throw TypeError(`${o} is not a number.`); + let c = e.length; + if (c < r || c > i) throw Error(`Unexpected array length ${c}.`); + let l = 0; + for (; l < c;) { + let t = e[l]; + if (!Number.isFinite(t)) throw TypeError(`${t} is not a number.`); + if (l < 3 && s && (t < a || t > o)) throw RangeError(`${t} is not between ${a} and ${o}.`); + if (l === 3 && (t < 0 || t > 1)) throw RangeError(`${t} is not between 0 and 1.`); + l++; + } + return n && c === 3 && e.push(1), e; +}, xt = (e, t, n = !1) => { + if (!Array.isArray(e)) throw TypeError(`${e} is not an array.`); + if (e.length !== 4) throw Error(`Unexpected array length ${e.length}.`); + if (!Array.isArray(t)) throw TypeError(`${t} is not an array.`); + if (t.length !== 4) throw Error(`Unexpected array length ${t.length}.`); + let r = 0; + for (; r < 4;) e[r] === "none" && t[r] === "none" ? (e[r] = 0, t[r] = 0) : e[r] === "none" ? e[r] = t[r] : t[r] === "none" && (t[r] = e[r]), r++; + return n ? [e, t] : [V(e, { + minLength: 4, + validateRange: !1 + }), V(t, { + minLength: 4, + validateRange: !1 + })]; +}, H = (e, t, n = !1) => { + if (!Array.isArray(e)) throw TypeError(`${e} is not an array.`); + if (e.length !== 3) throw Error(`Unexpected array length ${e.length}.`); + if (!n) for (let t of e) t = V(t, { + maxLength: 3, + validateRange: !1 + }); + let [[r, i, a], [o, s, c], [l, u, d]] = e, f, p, m; + return n ? [f, p, m] = t : [f, p, m] = V(t, { + maxLength: 3, + validateRange: !1 + }), [ + r * f + i * p + a * m, + o * f + s * p + c * m, + l * f + u * p + d * m + ]; +}, St = (e, t = !1) => { + let n, r, i; + t ? [n, r, i] = e : [n, r, i] = V(e, { + maxLength: 3, + maxRange: 255 + }); + let a = n / 255, o = r / 255, s = i / 255, c = .04045; + return a > c ? a = ((a + F) / (1 + F)) ** +Fe : a /= Ne, o > c ? o = ((o + F) / (1 + F)) ** +Fe : o /= Ne, s > c ? s = ((s + F) / (1 + F)) ** +Fe : s /= Ne, [ + a, + o, + s + ]; +}, Ct = (e, t = !1) => (t || (e = V(e, { + maxLength: 3, + maxRange: 255 +})), e = St(e, !0), H(dt, e, !0)), wt = (e, t = !1) => { + let [n, r, i] = V(e, { maxLength: 3 }), a = 809 / 258400; + return n > a ? n = n ** (1 / Fe) * (1 + F) - F : n *= Ne, n *= 255, r > a ? r = r ** (1 / Fe) * (1 + F) - F : r *= Ne, r *= 255, i > a ? i = i ** (1 / Fe) * (1 + F) - F : i *= Ne, i *= 255, [ + t ? Math.round(n) : n, + t ? Math.round(r) : r, + t ? Math.round(i) : i + ]; +}, Tt = (e, t = !1) => { + t || (e = V(e, { + maxLength: 3, + validateRange: !1 + })); + let [n, r, i] = H(ft, e, !0); + return [n, r, i] = wt([ + Math.min(Math.max(n, 0), 1), + Math.min(Math.max(r, 0), 1), + Math.min(Math.max(i, 0), 1) + ], !0), [ + n, + r, + i + ]; +}, Et = (e, t = !1) => { + let [n, r, i] = Tt(e, t), a = n / 255, o = r / 255, s = i / 255, c = Math.max(a, o, s), l = Math.min(a, o, s), u = c - l, d = (c + l) * je * 100, f, p; + if (Math.round(d) === 0 || Math.round(d) === 100) f = 0, p = 0; + else if (p = u / (1 - Math.abs(c + l - 1)) * 100, p === 0) f = 0; + else { + switch (c) { + case a: + f = (o - s) / u; + break; + case o: + f = (s - a) / u + 2; + break; + case s: + default: f = (a - o) / u + 4; + } + f = f * 60 % 360, f < 0 && (f += 360); + } + return [ + f, + p, + d + ]; +}, Dt = (e, t = !1) => { + let [n, r, i] = Tt(e, t), a = Math.min(n, r, i) / 255, o = 1 - Math.max(n, r, i) / 255, s; + return a + o === 1 ? s = 0 : [s] = Et(e), [ + s, + a * 100, + o * 100 + ]; +}, Ot = (e, t = !1) => { + t || (e = V(e, { + maxLength: 3, + validateRange: !1 + })); + let [n, r, i] = H(gt, H(pt, e, !0).map((e) => Math.cbrt(e)), !0); + n = Math.min(Math.max(n, 0), 1); + let a = Math.round(parseFloat(n.toFixed(4)) * 100); + return (a === 0 || a === 100) && (r = 0, i = 0), [ + n, + r, + i + ]; +}, kt = (e, t = !1) => { + let [n, r, i] = Ot(e, t), a, o, s = Math.round(parseFloat(n.toFixed(4)) * 100); + return s === 0 || s === 100 ? (a = 0, o = 0) : (a = Math.max(Math.sqrt(r ** 2 + i ** 2), 0), parseFloat(a.toFixed(4)) === 0 ? o = 0 : (o = Math.atan2(i, r) * 180 / Math.PI, o < 0 && (o += 360))), [ + n, + a, + o + ]; +}, At = (e, t = !1) => (t || (e = V(e, { + maxLength: 3, + validateRange: !1 +})), Tt(H(ut, e, !0), !0)), jt = (e, t = !1) => { + t || (e = V(e, { + maxLength: 3, + validateRange: !1 + })); + let [n, r, i] = e.map((e, t) => e / lt[t]).map((e) => e > .008856451679035631 ? Math.cbrt(e) : (Me * e + 16) / 116), a = Math.min(Math.max(116 * r - 16, 0), 100), o, s; + return a === 0 || a === 100 ? (o = 0, s = 0) : (o = (n - r) * 500, s = (r - i) * 200), [ + a, + o, + s + ]; +}, Mt = (e, t = !1) => { + let [n, r, i] = jt(e, t), a, o; + return n === 0 || n === 100 ? (a = 0, o = 0) : (a = Math.max(Math.sqrt(r ** 2 + i ** 2), 0), o = Math.atan2(i, r) * 180 / Math.PI, o < 0 && (o += 360)), [ + n, + a, + o + ]; +}, Nt = (e) => { + let [t, n, r, i] = V(e, { + alpha: !0, + maxRange: 255 + }), a = ot(t), o = ot(n), s = ot(r), c = ot(i * 255); + return c === "ff" ? `#${a}${o}${s}` : `#${a}${o}${s}${c}`; +}, Pt = (e) => { + if (_(e)) e = e.toLowerCase().trim(); + else throw TypeError(`${e} is not a string.`); + if (!(/^#[\da-f]{6}$/.test(e) || /^#[\da-f]{3}$/.test(e) || /^#[\da-f]{8}$/.test(e) || /^#[\da-f]{4}$/.test(e))) throw SyntaxError(`Invalid property value: ${e}`); + let t = []; + if (/^#[\da-f]{3}$/.test(e)) { + let [, n, r, i] = e.match(/^#([\da-f])([\da-f])([\da-f])$/); + t.push(parseInt(`${n}${n}`, 16), parseInt(`${r}${r}`, 16), parseInt(`${i}${i}`, 16), 1); + } else if (/^#[\da-f]{4}$/.test(e)) { + let [, n, r, i, a] = e.match(/^#([\da-f])([\da-f])([\da-f])([\da-f])$/); + t.push(parseInt(`${n}${n}`, 16), parseInt(`${r}${r}`, 16), parseInt(`${i}${i}`, 16), st(`${a}${a}`)); + } else if (/^#[\da-f]{8}$/.test(e)) { + let [, n, r, i, a] = e.match(/^#([\da-f]{2})([\da-f]{2})([\da-f]{2})([\da-f]{2})$/); + t.push(parseInt(n, 16), parseInt(r, 16), parseInt(i, 16), st(a)); + } else { + let [, n, r, i] = e.match(/^#([\da-f]{2})([\da-f]{2})([\da-f]{2})$/); + t.push(parseInt(n, 16), parseInt(r, 16), parseInt(i, 16), 1); + } + return t; +}, Ft = (e) => { + let [t, n, r, i] = Pt(e), [a, o, s] = St([ + t, + n, + r + ], !0); + return [ + a, + o, + s, + i + ]; +}, It = (e) => { + let [t, n, r, i] = Ft(e), [a, o, s] = H(dt, [ + t, + n, + r + ], !0); + return [ + a, + o, + s, + i + ]; +}, { CloseParen: Lt, Comment: Rt, Dimension: zt, EOF: Bt, Function: Vt, Ident: Ht, OpenParen: Ut, Whitespace: Wt } = e, Gt = "css-calc-var", Kt = new RegExp(k), qt = RegExp(`^calc\\((${T})\\)$`), Jt = new RegExp(A), Yt = new RegExp(j), Xt = new RegExp(ee), Zt = /\s[*+/-]\s/, Qt = /\($/, $t = RegExp(`^(${T})(${C}|${w})$`), en = RegExp(`^(${T})(${C}|${w}|%)$`), tn = RegExp(`^(${T})%$`), nn = /^(?:inherit|initial|revert(?:-layer)?|unset)$/, rn = class { + #e; + #t; + #n; + #r; + #i; + #a; + #o; + #s; + #c; + #l; + #u; + #d; + #f; + #p; + #m; + #h; + #g; + constructor() { + this.#e = !1, this.#t = [], this.#n = [], this.#r = !1, this.#i = [], this.#a = [], this.#o = !1, this.#s = [], this.#c = [], this.#l = [], this.#u = [], this.#d = !1, this.#f = [], this.#p = [], this.#m = [], this.#h = [], this.#g = { toCanonicalUnits: !0 }; + } + get hasNum() { + return this.#e; + } + set hasNum(e) { + this.#e = !!e; + } + get numSum() { + return this.#t; + } + get numMul() { + return this.#n; + } + get hasPct() { + return this.#r; + } + set hasPct(e) { + this.#r = !!e; + } + get pctSum() { + return this.#i; + } + get pctMul() { + return this.#a; + } + get hasDim() { + return this.#o; + } + set hasDim(e) { + this.#o = !!e; + } + get dimSum() { + return this.#s; + } + get dimSub() { + return this.#c; + } + get dimMul() { + return this.#l; + } + get dimDiv() { + return this.#u; + } + get hasEtc() { + return this.#d; + } + set hasEtc(e) { + this.#d = !!e; + } + get etcSum() { + return this.#f; + } + get etcSub() { + return this.#p; + } + get etcMul() { + return this.#m; + } + get etcDiv() { + return this.#h; + } + clear() { + this.#e = !1, this.#t.length = 0, this.#n.length = 0, this.#r = !1, this.#i.length = 0, this.#a.length = 0, this.#o = !1, this.#s.length = 0, this.#c.length = 0, this.#l.length = 0, this.#u.length = 0, this.#d = !1, this.#f.length = 0, this.#p.length = 0, this.#m.length = 0, this.#h.length = 0; + } + sort(e = []) { + let t = [...e]; + return t.length > 1 && t.sort((e, t) => { + let n; + if (en.test(e) && en.test(t)) { + let [, r, i] = e.match(en), [, a, o] = t.match(en); + n = i === o ? Number(r) === Number(a) ? 0 : Number(r) > Number(a) ? 1 : -1 : i > o ? 1 : -1; + } else n = e === t ? 0 : e > t ? 1 : -1; + return n; + }), t; + } + multiply() { + let e = [], t; + if (this.#e) { + t = 1; + for (let e of this.#n) if (t *= e, t === 0 || !Number.isFinite(t) || Number.isNaN(t)) break; + !this.#r && !this.#o && !this.hasEtc && (Number.isFinite(t) && (t = L(t, 16)), e.push(t)); + } + if (this.#r) { + typeof t != "number" && (t = 1); + for (let e of this.#a) if (t *= e, t === 0 || !Number.isFinite(t) || Number.isNaN(t)) break; + Number.isFinite(t) && (t = `${L(t, 16)}%`), !this.#o && !this.hasEtc && e.push(t); + } + if (this.#o) { + let n = "", i = "", a = ""; + this.#l.length && (this.#l.length === 1 ? [i] = this.#l : i = `${this.sort(this.#l).join(" * ")}`), this.#u.length && (this.#u.length === 1 ? [a] = this.#u : a = `${this.sort(this.#u).join(" * ")}`), Number.isFinite(t) ? (n = i ? a ? a.includes("*") ? r(`calc(${t} * ${i} / (${a}))`, this.#g) : r(`calc(${t} * ${i} / ${a})`, this.#g) : r(`calc(${t} * ${i})`, this.#g) : a.includes("*") ? r(`calc(${t} / (${a}))`, this.#g) : r(`calc(${t} / ${a})`, this.#g), e.push(n.replace(/^calc/, ""))) : (!e.length && t !== void 0 && e.push(t), i ? (n = a ? a.includes("*") ? r(`calc(${i} / (${a}))`, this.#g) : r(`calc(${i} / ${a})`, this.#g) : r(`calc(${i})`, this.#g), e.length ? e.push("*", n.replace(/^calc/, "")) : e.push(n.replace(/^calc/, ""))) : (n = r(`calc(${a})`, this.#g), e.length ? e.push("/", n.replace(/^calc/, "")) : e.push("1", "/", n.replace(/^calc/, "")))); + } + if (this.#d) { + if (this.#m.length) { + !e.length && t !== void 0 && e.push(t); + let n = this.sort(this.#m).join(" * "); + e.length ? e.push(`* ${n}`) : e.push(`${n}`); + } + if (this.#h.length) { + let t = this.sort(this.#h).join(" * "); + t.includes("*") ? e.length ? e.push(`/ (${t})`) : e.push(`1 / (${t})`) : e.length ? e.push(`/ ${t}`) : e.push(`1 / ${t}`); + } + } + return e.length ? e.join(" ") : ""; + } + sum() { + let e = []; + if (this.#e) { + let t = 0; + for (let e of this.#t) if (t += e, !Number.isFinite(t) || Number.isNaN(t)) break; + e.push(t); + } + if (this.#r) { + let t = 0; + for (let e of this.#i) if (t += e, !Number.isFinite(t)) break; + Number.isFinite(t) && (t = `${t}%`), e.length ? e.push(`+ ${t}`) : e.push(t); + } + if (this.#o) { + let t, n, i; + this.#s.length && (n = this.sort(this.#s).join(" + ")), this.#c.length && (i = this.sort(this.#c).join(" + ")), t = n ? i ? i.includes("-") ? r(`calc(${n} - (${i}))`, this.#g) : r(`calc(${n} - ${i})`, this.#g) : r(`calc(${n})`, this.#g) : r(`calc(-1 * (${i}))`, this.#g), e.length ? e.push("+", t.replace(/^calc/, "")) : e.push(t.replace(/^calc/, "")); + } + if (this.#d) { + if (this.#f.length) { + let t = this.sort(this.#f).map((e) => { + let t; + return t = Zt.test(e) && !e.startsWith("(") && !e.endsWith(")") ? `(${e})` : e, t; + }).join(" + "); + e.length ? this.#f.length > 1 ? e.push(`+ (${t})`) : e.push(`+ ${t}`) : e.push(`${t}`); + } + if (this.#p.length) { + let t = this.sort(this.#p).map((e) => { + let t; + return t = Zt.test(e) && !e.startsWith("(") && !e.endsWith(")") ? `(${e})` : e, t; + }).join(" + "); + e.length ? this.#p.length > 1 ? e.push(`- (${t})`) : e.push(`- ${t}`) : this.#p.length > 1 ? e.push(`-1 * (${t})`) : e.push(`-1 * ${t}`); + } + } + return e.length ? e.join(" ") : ""; + } +}, an = (e = [], t = !1) => { + if (e.length < 3) throw Error(`Unexpected array length ${e.length}.`); + let n = e.shift(); + if (!_(n) || !n.endsWith("(")) throw Error(`Unexpected token ${n}.`); + let r = e.pop(); + if (r !== ")") throw Error(`Unexpected token ${r}.`); + if (e.length === 1) { + let [t] = e; + if (!v(t)) throw Error(`Unexpected token ${t}.`); + return `${n}${t}${r}`; + } + let i = [], a = new rn(), o = "", s = !1; + for (let t of e) { + if (!v(t)) throw Error(`Unexpected token ${t}.`); + if (t === "*" || t === "/") o = t; + else if (t === "+" || t === "-") { + let e = a.multiply(); + e && i.push(e, t), s = !0, a.clear(), o = ""; + } else { + let e = Number(t), n = `${t}`; + switch (o) { + case "/": + if (Number.isFinite(e)) a.hasNum = !0, a.numMul.push(1 / e); + else if (tn.test(n)) { + let [, e] = n.match(tn); + a.hasPct = !0, a.pctMul.push(1e4 / Number(e)); + } else $t.test(n) ? (a.hasDim = !0, a.dimDiv.push(n)) : (a.hasEtc = !0, a.etcDiv.push(n)); + break; + default: if (Number.isFinite(e)) a.hasNum = !0, a.numMul.push(e); + else if (tn.test(n)) { + let [, e] = n.match(tn); + a.hasPct = !0, a.pctMul.push(Number(e)); + } else $t.test(n) ? (a.hasDim = !0, a.dimMul.push(n)) : (a.hasEtc = !0, a.etcMul.push(n)); + } + } + } + let c = a.multiply(); + c && i.push(c); + let l = ""; + if (t && s) { + let e = []; + a.clear(), o = ""; + for (let e of i) if (e === "+" || e === "-") o = e; + else { + let t = Number(e), n = `${e}`; + switch (o) { + case "-": + if (Number.isFinite(t)) a.hasNum = !0, a.numSum.push(-1 * t); + else if (tn.test(n)) { + let [, e] = n.match(tn); + a.hasPct = !0, a.pctSum.push(-1 * Number(e)); + } else $t.test(n) ? (a.hasDim = !0, a.dimSub.push(n)) : (a.hasEtc = !0, a.etcSub.push(n)); + break; + default: if (Number.isFinite(t)) a.hasNum = !0, a.numSum.push(t); + else if (tn.test(n)) { + let [, e] = n.match(tn); + a.hasPct = !0, a.pctSum.push(Number(e)); + } else $t.test(n) ? (a.hasDim = !0, a.dimSum.push(n)) : (a.hasEtc = !0, a.etcSum.push(n)); + } + } + let t = a.sum(); + e.push(t), a.clear(), o = "", l = e.join(" ").replace(/\+\s-/g, "- "); + } else l = i.join(" ").replace(/\+\s-/g, "- "); + return l.startsWith("(") && l.endsWith(")") && l.lastIndexOf("(") === 0 && l.indexOf(")") === l.length - 1 && (l = l.substring(1, l.length - 1)), `${n}${l}${r}`; +}, on = (e) => { + let n = t({ css: e }), r = [], i = "", a = "", o = 0; + for (let e of n) { + let [t, n] = e; + if (t === Ut || t === Vt ? o++ : t === Lt && o--, o === 0 && (n === "+" || n === "-")) { + i.trim() && r.push((a === "-" ? "-" : "") + i.trim()), i = "", a = n; + continue; + } + i += n; + } + i.trim() && r.push((a === "-" ? "-" : "") + i.trim()), r.sort((e, t) => { + let n = /^(-?(?:\d+(?:\.\d+)?|\.\d+))([a-z%]*)$/i, r = e.match(n), i = t.match(n); + if (r && i) { + let e = Number(r[1]), t = Number(i[1]), n = r[2], a = i[2]; + return n === a ? e - t : n > a ? 1 : -1; + } + return e === t ? 0 : e > t ? 1 : -1; + }); + let s = r[0]; + if (s === void 0) return e; + let c = s; + for (let e of r.slice(1)) e.startsWith("-") ? c += " - " + e.substring(1) : c += " + " + e; + return c; +}, sn = (e, t) => { + let n = e[0], i = _(n) && Jt.test(n), a = []; + for (let t of e) Array.isArray(t) ? a.push(sn(t, i)) : a.push(t); + let o = a.includes(","), s = a[0] ?? "", c = _(s) && Jt.test(s); + if (o && c && a.at(-1) === ")") { + let e = a.shift(), t = a.pop(), n = [], r = []; + for (let e of a) e === "," ? (n.push(r), r = []) : r.push(e); + return r.length && n.push(r), `${e}${n.map((e) => { + if (e.length >= 3) { + let t = an([ + "calc(", + ...e, + ")" + ], !0); + return on(t.substring(5, t.length - 1)); + } + if (e.length === 1) { + let t = e[0]; + if (_(t) && t.startsWith("calc(") && t.endsWith(")")) return on(t.substring(5, t.length - 1)); + } + return e.join(""); + }).join(", ")}${t}`; + } + if (t) { + if (!o) { + if (a.length >= 3) return an(a, !0); + let e = a[0] ?? ""; + return e.endsWith("(") ? a.join("") : /^[a-z-]+\(/.test(e) ? e : `calc(${e})`; + } + return a.join("").replace(/,\s*/g, ", "); + } + if (a.length >= 3 && !o) { + let e = an(a, !1); + return Xt.test(e) && (e = r(e, { toCanonicalUnits: !0 })), e; + } + return a.join("").replace(/,\s*/g, ", "); +}, cn = (e, n = {}) => { + if (!_(e)) throw TypeError(`${e} is not a string.`); + let { format: r = "" } = n; + if (!Xt.test(e) || r !== "specifiedValue") return e; + e = e.toLowerCase().trim(); + let i = g({ + namespace: Gt, + name: "serializeCalc", + value: e + }, n), a = m(i); + if (a !== !1) return a.item; + let o = t({ css: e }).map((e) => { + let [t, n] = e, r = ""; + return t !== Wt && t !== Rt && (r = n), r; + }).filter((e) => e), s = [[]]; + for (let e of o) if (Qt.test(e)) { + let t = [e]; + s.at(-1).push(t), s.push(t); + } else e === ")" ? s.length > 1 ? s.pop().push(e) : s[0].push(e) : s.at(-1).push(e); + let c = "", l = s[0]; + return c = l.length === 1 && Array.isArray(l[0]) ? sn(l[0], !0) : sn(l, !0), p(i, c), c; +}, ln = (e, t = {}) => { + if (!Array.isArray(e)) throw TypeError(`${e} is not an array.`); + let [, , , , n = {}] = e, { unit: r, value: i } = n; + if (r === "px") return `${i}${r}`; + let a = it(Number(i), r, t); + return Number.isFinite(a) ? `${L(a, 16)}px` : null; +}, un = (e, t = {}) => { + if (!Array.isArray(e)) throw TypeError(`${e} is not an array.`); + let { format: n = "" } = t, r = /* @__PURE__ */ new Set(), i = 0, a = []; + for (let o of e) { + if (!Array.isArray(o)) throw TypeError(`${o} is not an array.`); + let [e = "", s = ""] = o; + switch (e) { + case zt: + if (n === "specifiedValue" && !r.has(i)) a.push(s); + else { + let e = ln(o, t); + _(e) ? a.push(e) : a.push(s); + } + break; + case Vt: + case Ut: + a.push(s), i++, Jt.test(s) && r.add(i); + break; + case Lt: + a.length && a.at(-1) === " " ? a.splice(-1, 1, s) : a.push(s), r.has(i) && r.delete(i), i--; + break; + case Wt: + if (a.length) { + let e = a.at(-1); + _(e) && !e.endsWith("(") && e !== " " && a.push(s); + } + break; + default: e !== Rt && e !== Bt && a.push(s); + } + } + return a; +}, dn = (e, n = {}) => { + if (!_(e)) throw TypeError(`${e} is not a string.`); + let i = { ...n }, a = tt(i); + if (e.length > a) return ""; + let { format: o } = i; + if (Yt.test(e)) { + if (o === "specifiedValue") return e; + { + let t = mn(e, i); + return _(t) ? t : ""; + } + } + if (!Kt.test(e)) return e; + e = e.toLowerCase().trim(); + let s = g({ + namespace: Gt, + name: "cssCalc", + value: e + }, i), c = m(s); + if (c !== !1) return c.item; + let l = un(t({ css: e }), i), u = r(l.join(""), { toCanonicalUnits: !0 }); + if (Xt.test(e)) { + if (en.test(u)) { + let [, e, t] = u.match(en); + u = `${L(Number(e), 16)}${t}`; + } + u && !Xt.test(u) && o === "specifiedValue" && (u = `calc(${u})`); + } + if (o === "specifiedValue") { + if (/\s[-+*/]\s/.test(u) && !u.includes("NaN")) u = cn(u, i); + else if (qt.test(u)) { + let [, e] = u.match(qt); + u = `calc(${L(Number(e), 16)})`; + } + } + return p(s, u), u; +}; +function fn(e, t = {}) { + if (!Array.isArray(e)) throw TypeError(`${e} is not an array.`); + let { customProperty: n = {} } = t, r = []; + for (; e.length;) { + let i = e.shift(); + if (!i) break; + if (!Array.isArray(i)) throw TypeError(`${i} is not an array.`); + let [a, o] = i; + if (a === Lt) break; + if (o === "var(") { + let [, n] = fn(e, t); + n && r.push(n); + } else if (o && a === Ht) { + if (o.startsWith("--")) { + let e; + if (n[o]) { + let t = n[o]; + e = typeof t == "function" ? t(o) : t; + } else typeof n.callback == "function" && (e = n.callback(o)); + e && r.push(e); + } else r.push(o); + } + } + let i = !1; + r.length > 1 && (i = Zr(r.at(-1))); + let a = ""; + for (let e of r) { + if (e = e.trim(), Yt.test(e)) { + let n = mn(e, t); + _(n) && (!i || Zr(n)) && (a = n); + } else Kt.test(e) ? (e = dn(e, t), (!i || Zr(e)) && (a = e)) : e && !nn.test(e) && (!i || Zr(e)) && (a = e); + if (a) break; + } + return [e, a]; +} +function pn(e, t = {}) { + let n = []; + for (; e.length;) { + let r = e.shift(); + if (!r) break; + let [i = "", a = ""] = r; + if (a === "var(") { + let [, r] = fn(e, t); + if (!r) return null; + n.push(r); + } else switch (i) { + case Lt: + n.length && n.at(-1) === " " ? n[n.length - 1] = a : n.push(a); + break; + case Wt: + if (n.length) { + let e = n.at(-1); + _(e) && !e.endsWith("(") && e !== " " && n.push(a); + } + break; + default: i !== Rt && i !== Bt && n.push(a); + } + } + return n; +} +function mn(e, n = {}) { + if (!_(e)) throw TypeError(`${e} is not a string.`); + let r = tt(n); + if (e.length > r) return null; + if (!Yt.test(e) || n.format === "specifiedValue") return e; + e = e.trim(); + let i = g({ + namespace: Gt, + name: "resolveVar", + value: e + }, n), a = m(i); + if (a !== !1) return a.item; + let o = pn(t({ css: e }), n); + if (Array.isArray(o)) { + let e = o.join(""); + return e.length > r ? (p(i, null), null) : (Kt.test(e) && (e = dn(e, n)), p(i, e), e); + } + return p(i, null), null; +} +var hn = (e, t = {}) => { + let n = mn(e, { ...t }); + return _(n) ? n : ""; +}, gn = { + aliceblue: [ + 240, + 248, + 255 + ], + antiquewhite: [ + 250, + 235, + 215 + ], + aqua: [ + 0, + 255, + 255 + ], + aquamarine: [ + 127, + 255, + 212 + ], + azure: [ + 240, + 255, + 255 + ], + beige: [ + 245, + 245, + 220 + ], + bisque: [ + 255, + 228, + 196 + ], + black: [ + 0, + 0, + 0 + ], + blanchedalmond: [ + 255, + 235, + 205 + ], + blue: [ + 0, + 0, + 255 + ], + blueviolet: [ + 138, + 43, + 226 + ], + brown: [ + 165, + 42, + 42 + ], + burlywood: [ + 222, + 184, + 135 + ], + cadetblue: [ + 95, + 158, + 160 + ], + chartreuse: [ + 127, + 255, + 0 + ], + chocolate: [ + 210, + 105, + 30 + ], + coral: [ + 255, + 127, + 80 + ], + cornflowerblue: [ + 100, + 149, + 237 + ], + cornsilk: [ + 255, + 248, + 220 + ], + crimson: [ + 220, + 20, + 60 + ], + cyan: [ + 0, + 255, + 255 + ], + darkblue: [ + 0, + 0, + 139 + ], + darkcyan: [ + 0, + 139, + 139 + ], + darkgoldenrod: [ + 184, + 134, + 11 + ], + darkgray: [ + 169, + 169, + 169 + ], + darkgreen: [ + 0, + 100, + 0 + ], + darkgrey: [ + 169, + 169, + 169 + ], + darkkhaki: [ + 189, + 183, + 107 + ], + darkmagenta: [ + 139, + 0, + 139 + ], + darkolivegreen: [ + 85, + 107, + 47 + ], + darkorange: [ + 255, + 140, + 0 + ], + darkorchid: [ + 153, + 50, + 204 + ], + darkred: [ + 139, + 0, + 0 + ], + darksalmon: [ + 233, + 150, + 122 + ], + darkseagreen: [ + 143, + 188, + 143 + ], + darkslateblue: [ + 72, + 61, + 139 + ], + darkslategray: [ + 47, + 79, + 79 + ], + darkslategrey: [ + 47, + 79, + 79 + ], + darkturquoise: [ + 0, + 206, + 209 + ], + darkviolet: [ + 148, + 0, + 211 + ], + deeppink: [ + 255, + 20, + 147 + ], + deepskyblue: [ + 0, + 191, + 255 + ], + dimgray: [ + 105, + 105, + 105 + ], + dimgrey: [ + 105, + 105, + 105 + ], + dodgerblue: [ + 30, + 144, + 255 + ], + firebrick: [ + 178, + 34, + 34 + ], + floralwhite: [ + 255, + 250, + 240 + ], + forestgreen: [ + 34, + 139, + 34 + ], + fuchsia: [ + 255, + 0, + 255 + ], + gainsboro: [ + 220, + 220, + 220 + ], + ghostwhite: [ + 248, + 248, + 255 + ], + gold: [ + 255, + 215, + 0 + ], + goldenrod: [ + 218, + 165, + 32 + ], + gray: [ + 128, + 128, + 128 + ], + green: [ + 0, + 128, + 0 + ], + greenyellow: [ + 173, + 255, + 47 + ], + grey: [ + 128, + 128, + 128 + ], + honeydew: [ + 240, + 255, + 240 + ], + hotpink: [ + 255, + 105, + 180 + ], + indianred: [ + 205, + 92, + 92 + ], + indigo: [ + 75, + 0, + 130 + ], + ivory: [ + 255, + 255, + 240 + ], + khaki: [ + 240, + 230, + 140 + ], + lavender: [ + 230, + 230, + 250 + ], + lavenderblush: [ + 255, + 240, + 245 + ], + lawngreen: [ + 124, + 252, + 0 + ], + lemonchiffon: [ + 255, + 250, + 205 + ], + lightblue: [ + 173, + 216, + 230 + ], + lightcoral: [ + 240, + 128, + 128 + ], + lightcyan: [ + 224, + 255, + 255 + ], + lightgoldenrodyellow: [ + 250, + 250, + 210 + ], + lightgray: [ + 211, + 211, + 211 + ], + lightgreen: [ + 144, + 238, + 144 + ], + lightgrey: [ + 211, + 211, + 211 + ], + lightpink: [ + 255, + 182, + 193 + ], + lightsalmon: [ + 255, + 160, + 122 + ], + lightseagreen: [ + 32, + 178, + 170 + ], + lightskyblue: [ + 135, + 206, + 250 + ], + lightslategray: [ + 119, + 136, + 153 + ], + lightslategrey: [ + 119, + 136, + 153 + ], + lightsteelblue: [ + 176, + 196, + 222 + ], + lightyellow: [ + 255, + 255, + 224 + ], + lime: [ + 0, + 255, + 0 + ], + limegreen: [ + 50, + 205, + 50 + ], + linen: [ + 250, + 240, + 230 + ], + magenta: [ + 255, + 0, + 255 + ], + maroon: [ + 128, + 0, + 0 + ], + mediumaquamarine: [ + 102, + 205, + 170 + ], + mediumblue: [ + 0, + 0, + 205 + ], + mediumorchid: [ + 186, + 85, + 211 + ], + mediumpurple: [ + 147, + 112, + 219 + ], + mediumseagreen: [ + 60, + 179, + 113 + ], + mediumslateblue: [ + 123, + 104, + 238 + ], + mediumspringgreen: [ + 0, + 250, + 154 + ], + mediumturquoise: [ + 72, + 209, + 204 + ], + mediumvioletred: [ + 199, + 21, + 133 + ], + midnightblue: [ + 25, + 25, + 112 + ], + mintcream: [ + 245, + 255, + 250 + ], + mistyrose: [ + 255, + 228, + 225 + ], + moccasin: [ + 255, + 228, + 181 + ], + navajowhite: [ + 255, + 222, + 173 + ], + navy: [ + 0, + 0, + 128 + ], + oldlace: [ + 253, + 245, + 230 + ], + olive: [ + 128, + 128, + 0 + ], + olivedrab: [ + 107, + 142, + 35 + ], + orange: [ + 255, + 165, + 0 + ], + orangered: [ + 255, + 69, + 0 + ], + orchid: [ + 218, + 112, + 214 + ], + palegoldenrod: [ + 238, + 232, + 170 + ], + palegreen: [ + 152, + 251, + 152 + ], + paleturquoise: [ + 175, + 238, + 238 + ], + palevioletred: [ + 219, + 112, + 147 + ], + papayawhip: [ + 255, + 239, + 213 + ], + peachpuff: [ + 255, + 218, + 185 + ], + peru: [ + 205, + 133, + 63 + ], + pink: [ + 255, + 192, + 203 + ], + plum: [ + 221, + 160, + 221 + ], + powderblue: [ + 176, + 224, + 230 + ], + purple: [ + 128, + 0, + 128 + ], + rebeccapurple: [ + 102, + 51, + 153 + ], + red: [ + 255, + 0, + 0 + ], + rosybrown: [ + 188, + 143, + 143 + ], + royalblue: [ + 65, + 105, + 225 + ], + saddlebrown: [ + 139, + 69, + 19 + ], + salmon: [ + 250, + 128, + 114 + ], + sandybrown: [ + 244, + 164, + 96 + ], + seagreen: [ + 46, + 139, + 87 + ], + seashell: [ + 255, + 245, + 238 + ], + sienna: [ + 160, + 82, + 45 + ], + silver: [ + 192, + 192, + 192 + ], + skyblue: [ + 135, + 206, + 235 + ], + slateblue: [ + 106, + 90, + 205 + ], + slategray: [ + 112, + 128, + 144 + ], + slategrey: [ + 112, + 128, + 144 + ], + snow: [ + 255, + 250, + 250 + ], + springgreen: [ + 0, + 255, + 127 + ], + steelblue: [ + 70, + 130, + 180 + ], + tan: [ + 210, + 180, + 140 + ], + teal: [ + 0, + 128, + 128 + ], + thistle: [ + 216, + 191, + 216 + ], + tomato: [ + 255, + 99, + 71 + ], + turquoise: [ + 64, + 224, + 208 + ], + violet: [ + 238, + 130, + 238 + ], + wheat: [ + 245, + 222, + 179 + ], + white: [ + 255, + 255, + 255 + ], + whitesmoke: [ + 245, + 245, + 245 + ], + yellow: [ + 255, + 255, + 0 + ], + yellowgreen: [ + 154, + 205, + 50 + ] +}, _n = RegExp(`^(?:${De})$`), vn = /^currentColor$/i, yn = RegExp(`^color\\(\\s*(${ye})\\s*\\)$`), bn = RegExp(`^hsla?\\(\\s*(${Se}|${Ce})\\s*\\)$`), xn = RegExp(`^hwb\\(\\s*(${Se})\\s*\\)$`), Sn = RegExp(`^lab\\(\\s*(${Te})\\s*\\)$`), Cn = RegExp(`^lch\\(\\s*(${we})\\s*\\)$`), wn = RegExp(`^oklab\\(\\s*(${Te})\\s*\\)$`), Tn = RegExp(`^oklch\\(\\s*(${we})\\s*\\)$`), U = /^(?:specifi|comput)edValue$/, En = RegExp(`^rgba?\\(\\s*(${Te}|${Ee})\\s*\\)$`), Dn = (e, t = {}) => { + if (_(e)) e = e.toLowerCase().trim(); + else throw TypeError(`${e} is not a string.`); + let { format: n = "", nullable: r = !1 } = t; + if (!En.test(e)) { + let e = z(n, r); + return e === null ? null : (_(e), e); + } + let [, i] = e.match(En), [a, o, s, c = ""] = i.match(/[^\s,/]+/g), l, u, d; + a === "none" ? l = 0 : (l = a.endsWith("%") ? parseFloat(a) * 255 / 100 : parseFloat(a), l = Math.min(Math.max(L(l, 8), 0), 255)), o === "none" ? u = 0 : (u = o.endsWith("%") ? parseFloat(o) * 255 / 100 : parseFloat(o), u = Math.min(Math.max(L(u, 8), 0), 255)), s === "none" ? d = 0 : (d = s.endsWith("%") ? parseFloat(s) * 255 / 100 : parseFloat(s), d = Math.min(Math.max(L(d, 8), 0), 255)); + let f = R(c); + return [ + "rgb", + l, + u, + d, + n === "mixValue" && c === "none" ? D : f + ]; +}, On = (e, t = {}) => { + if (_(e)) e = e.trim(); + else throw TypeError(`${e} is not a string.`); + let { format: n = "", nullable: r = !1 } = t; + if (!bn.test(e)) { + let e = z(n, r); + return e === null ? null : (_(e), e); + } + let [, i] = e.match(bn), [a, o, s, c = ""] = i.match(/[^\s,/]+/g), l, u, d; + l = a === "none" ? 0 : at(a), u = o === "none" ? 0 : Math.min(Math.max(parseFloat(o), 0), 100), d = s === "none" ? 0 : Math.min(Math.max(parseFloat(s), 0), 100); + let f = R(c); + if (n === "hsl") return [ + n, + a === "none" ? a : l, + o === "none" ? o : u, + s === "none" ? s : d, + c === "none" ? c : f + ]; + l = l / 360 * 12, d /= 100; + let p = u / 100 * Math.min(d, 1 - d), m = l % 12, h = (8 + l) % 12, g = (4 + l) % 12, v = d - p * Math.max(-1, Math.min(m - 3, 9 - m, 1)), y = d - p * Math.max(-1, Math.min(h - 3, 9 - h, 1)), b = d - p * Math.max(-1, Math.min(g - 3, 9 - g, 1)); + return [ + "rgb", + Math.min(Math.max(L(v * 255, 8), 0), 255), + Math.min(Math.max(L(y * 255, 8), 0), 255), + Math.min(Math.max(L(b * 255, 8), 0), 255), + f + ]; +}, kn = (e, t = {}) => { + if (_(e)) e = e.trim(); + else throw TypeError(`${e} is not a string.`); + let { format: n = "", nullable: r = !1 } = t; + if (!xn.test(e)) { + let e = z(n, r); + return e === null ? null : (_(e), e); + } + let [, i] = e.match(xn), [a, o, s, c = ""] = i.match(/[^\s,/]+/g), l, u, d; + l = a === "none" ? 0 : at(a), u = o === "none" ? 0 : Math.min(Math.max(parseFloat(o), 0), 100) / 100, d = s === "none" ? 0 : Math.min(Math.max(parseFloat(s), 0), 100) / 100; + let f = R(c); + if (n === "hwb") return [ + n, + a === "none" ? a : l, + o === "none" ? o : u * 100, + s === "none" ? s : d * 100, + c === "none" ? c : f + ]; + if (u + d >= 1) { + let e = L(u / (u + d) * 255, 8); + return [ + "rgb", + e, + e, + e, + f + ]; + } + let p = (1 - u - d) / 255, [, m, h, g] = On(`hsl(${l} 100 50)`); + return m = L((m * p + u) * 255, 8), h = L((h * p + u) * 255, 8), g = L((g * p + u) * 255, 8), [ + "rgb", + Math.min(Math.max(m, 0), 255), + Math.min(Math.max(h, 0), 255), + Math.min(Math.max(g, 0), 255), + f + ]; +}, An = (e, t = {}) => { + if (_(e)) e = e.trim(); + else throw TypeError(`${e} is not a string.`); + let { format: n = "", nullable: r = !1 } = t; + if (!Sn.test(e)) { + let e = z(n, r); + return e === null ? null : (_(e), e); + } + let i = 1.25, [, a] = e.match(Sn), [o, s, c, l = ""] = a.match(/[^\s,/]+/g), u, d, f; + o === "none" ? u = 0 : (o.endsWith("%") ? (u = parseFloat(o), u > 100 && (u = 100)) : u = parseFloat(o), u < 0 && (u = 0)), d = s === "none" ? 0 : s.endsWith("%") ? parseFloat(s) * i : parseFloat(s), f = c === "none" ? 0 : c.endsWith("%") ? parseFloat(c) * i : parseFloat(c); + let p = R(l); + if (U.test(n)) return [ + "lab", + o === "none" ? o : L(u, 16), + s === "none" ? s : L(d, 16), + c === "none" ? c : L(f, 16), + l === "none" ? l : p + ]; + let m = (u + 16) / 116, h = d / 500 + m, g = m - f / 200, v = m ** 3, y = h ** 3, b = g ** 3, [x, S, C] = [ + y > .008856451679035631 ? y : (h * 116 - 16) / Me, + u > 8 ? v : u / Me, + b > .008856451679035631 ? b : (g * 116 - 16) / Me + ].map((e, t) => e * lt[t]); + return [ + "xyz-d50", + L(x, 16), + L(S, 16), + L(C, 16), + p + ]; +}, jn = (e, t = {}) => { + if (_(e)) e = e.trim(); + else throw TypeError(`${e} is not a string.`); + let { format: n = "", nullable: r = !1 } = t; + if (!Cn.test(e)) { + let e = z(n, r); + return e === null ? null : (_(e), e); + } + let [, i] = e.match(Cn), [a, o, s, c = ""] = i.match(/[^\s,/]+/g), l, u, d; + a === "none" ? l = 0 : (l = parseFloat(a), l < 0 && (l = 0)), u = o === "none" ? 0 : o.endsWith("%") ? parseFloat(o) * 1.5 : parseFloat(o), d = s === "none" ? 0 : at(s); + let f = R(c); + if (U.test(n)) return [ + "lch", + a === "none" ? a : L(l, 16), + o === "none" ? o : L(u, 16), + s === "none" ? s : L(d, 16), + c === "none" ? c : f + ]; + let p = u * Math.cos(d * Math.PI / 180), m = u * Math.sin(d * Math.PI / 180), [, h, g, v] = An(`lab(${l} ${p} ${m})`); + return [ + "xyz-d50", + L(h, 16), + L(g, 16), + L(v, 16), + f + ]; +}, Mn = (e, t = {}) => { + if (_(e)) e = e.trim(); + else throw TypeError(`${e} is not a string.`); + let { format: n = "", nullable: r = !1 } = t; + if (!wn.test(e)) { + let e = z(n, r); + return e === null ? null : (_(e), e); + } + let i = .4, [, a] = e.match(wn), [o, s, c, l = ""] = a.match(/[^\s,/]+/g), u, d, f; + o === "none" ? u = 0 : (u = o.endsWith("%") ? parseFloat(o) / 100 : parseFloat(o), u < 0 && (u = 0)), d = s === "none" ? 0 : s.endsWith("%") ? parseFloat(s) * i / 100 : parseFloat(s), f = c === "none" ? 0 : c.endsWith("%") ? parseFloat(c) * i / 100 : parseFloat(c); + let p = R(l); + if (U.test(n)) return [ + "oklab", + o === "none" ? o : L(u, 16), + s === "none" ? s : L(d, 16), + c === "none" ? c : L(f, 16), + l === "none" ? l : p + ]; + let [m, h, g] = H(mt, H(ht, [ + u, + d, + f + ]).map((e) => e ** 3), !0); + return [ + "xyz-d65", + L(m, 16), + L(h, 16), + L(g, 16), + p + ]; +}, Nn = (e, t = {}) => { + if (_(e)) e = e.trim(); + else throw TypeError(`${e} is not a string.`); + let { format: n = "", nullable: r = !1 } = t; + if (!Tn.test(e)) { + let e = z(n, r); + return e === null ? null : (_(e), e); + } + let [, i] = e.match(Tn), [a, o, s, c = ""] = i.match(/[^\s,/]+/g), l, u, d; + a === "none" ? l = 0 : (l = a.endsWith("%") ? parseFloat(a) / 100 : parseFloat(a), l < 0 && (l = 0)), o === "none" ? u = 0 : (u = o.endsWith("%") ? parseFloat(o) * .4 / 100 : parseFloat(o), u < 0 && (u = 0)), d = s === "none" ? 0 : at(s); + let f = R(c); + if (U.test(n)) return [ + "oklch", + a === "none" ? a : L(l, 16), + o === "none" ? o : L(u, 16), + s === "none" ? s : L(d, 16), + c === "none" ? c : f + ]; + let p = u * Math.cos(d * Math.PI / 180), m = u * Math.sin(d * Math.PI / 180), [h, g, v] = H(mt, H(ht, [ + l, + p, + m + ]).map((e) => e ** 3), !0); + return [ + "xyz-d65", + L(h, 16), + L(g, 16), + L(v, 16), + f + ]; +}, W = (e, t = {}) => { + if (_(e)) e = e.trim(); + else throw TypeError(`${e} is not a string.`); + let { colorSpace: n = "", d50: r = !1, format: i = "", nullable: a = !1 } = t; + if (!yn.test(e)) { + let e = z(i, a); + return e === null ? null : (_(e), e); + } + let [, o] = e.match(yn), [s, c, l, u, d = ""] = o.match(/[^\s,/]+/g), f, p, m; + s === "xyz" && (s = "xyz-d65"), f = c === "none" ? 0 : c.endsWith("%") ? parseFloat(c) / 100 : parseFloat(c), p = l === "none" ? 0 : l.endsWith("%") ? parseFloat(l) / 100 : parseFloat(l), m = u === "none" ? 0 : u.endsWith("%") ? parseFloat(u) / 100 : parseFloat(u); + let h = R(d); + if (U.test(i) || i === "mixValue" && s === n) return [ + s, + c === "none" ? c : L(f, 10), + l === "none" ? l : L(p, 10), + u === "none" ? u : L(m, 10), + d === "none" ? d : h + ]; + let g = 0, v = 0, y = 0; + if (s === "srgb-linear") [g, v, y] = H(dt, [ + f, + p, + m + ]), r && ([g, v, y] = H(B, [ + g, + v, + y + ], !0)); + else if (s === "display-p3") { + let e = St([ + f * 255, + p * 255, + m * 255 + ]); + [g, v, y] = H(_t, e), r && ([g, v, y] = H(B, [ + g, + v, + y + ], !0)); + } else if (s === "rec2020") { + let e = 1.09929682680944, t = .45, n = [ + f, + p, + m + ].map((n) => { + let r; + return r = n < .018053968510807 * t * 10 ? n / (t * 10) : ((n + e - 1) / e) ** (1 / t), r; + }); + [g, v, y] = H(vt, n), r && ([g, v, y] = H(B, [ + g, + v, + y + ], !0)); + } else if (s === "a98-rgb") { + let e = [ + f, + p, + m + ].map((e) => e ** 2.19921875); + [g, v, y] = H(yt, e), r && ([g, v, y] = H(B, [ + g, + v, + y + ], !0)); + } else if (s === "prophoto-rgb") { + let e = [ + f, + p, + m + ].map((e) => { + let t; + return t = e > 1 / 32 ? e ** 1.8 : e / 16, t; + }); + [g, v, y] = H(bt, e), r || ([g, v, y] = H(ut, [ + g, + v, + y + ], !0)); + } else /^xyz(?:-d(?:50|65))?$/.test(s) ? ([g, v, y] = [ + f, + p, + m + ], s === "xyz-d50" ? r || ([g, v, y] = H(ut, [ + g, + v, + y + ])) : r && ([g, v, y] = H(B, [ + g, + v, + y + ], !0))) : ([g, v, y] = Ct([ + f * 255, + p * 255, + m * 255 + ]), r && ([g, v, y] = H(B, [ + g, + v, + y + ], !0))); + return [ + r ? "xyz-d50" : "xyz-d65", + L(g, 16), + L(v, 16), + L(y, 16), + i === "mixValue" && d === "none" ? d : h + ]; +}, G = (e, t = {}) => { + if (_(e)) e = e.toLowerCase().trim(); + else throw TypeError(`${e} is not a string.`); + let { d50: n = !1, format: r = "", nullable: i = !1 } = t; + if (!_n.test(e)) { + let e = z(r, i); + return e === null ? null : (_(e), e); + } + let a = 0, o = 0, s = 0, c = 0; + if (vn.test(e)) { + if (r === "computedValue") return [ + "rgb", + 0, + 0, + 0, + 0 + ]; + if (r === "specifiedValue") return e; + } else if (/^[a-z]+$/.test(e)) { + if (Object.hasOwn(gn, e)) { + if (r === "specifiedValue") return e; + let [t, i, l] = gn[e]; + if (c = 1, r === "computedValue") return [ + "rgb", + t, + i, + l, + c + ]; + [a, o, s] = Ct([ + t, + i, + l + ], !0), n && ([a, o, s] = H(B, [ + a, + o, + s + ], !0)); + } else switch (r) { + case N: return i && e !== "transparent" ? null : [ + "rgb", + 0, + 0, + 0, + 0 + ]; + case Ae: return e === "transparent" ? e : ""; + case P: return e === "transparent" ? [ + "rgb", + 0, + 0, + 0, + 0 + ] : null; + } + } else if (e[0] === "#") { + if (U.test(r)) return ["rgb", ...Pt(e)]; + [a, o, s, c] = It(e), n && ([a, o, s] = H(B, [ + a, + o, + s + ], !0)); + } else if (e.startsWith("lab")) { + if (U.test(r)) return An(e, t); + [, a, o, s, c] = An(e), n || ([a, o, s] = H(ut, [ + a, + o, + s + ], !0)); + } else if (e.startsWith("lch")) { + if (U.test(r)) return jn(e, t); + [, a, o, s, c] = jn(e), n || ([a, o, s] = H(ut, [ + a, + o, + s + ], !0)); + } else if (e.startsWith("oklab")) { + if (U.test(r)) return Mn(e, t); + [, a, o, s, c] = Mn(e), n && ([a, o, s] = H(B, [ + a, + o, + s + ], !0)); + } else if (e.startsWith("oklch")) { + if (U.test(r)) return Nn(e, t); + [, a, o, s, c] = Nn(e), n && ([a, o, s] = H(B, [ + a, + o, + s + ], !0)); + } else { + let i, l, u; + if (e.startsWith("hsl") ? [, i, l, u, c] = On(e) : e.startsWith("hwb") ? [, i, l, u, c] = kn(e) : [, i, l, u, c] = Dn(e, t), U.test(r)) return [ + "rgb", + Math.round(i), + Math.round(l), + Math.round(u), + c + ]; + [a, o, s] = Ct([ + i, + l, + u + ]), n && ([a, o, s] = H(B, [ + a, + o, + s + ], !0)); + } + return [ + n ? "xyz-d50" : "xyz-d65", + L(a, 16), + L(o, 16), + L(s, 16), + c + ]; +}, Pn = RegExp(`^color\\(\\s*(${ye})\\s*\\)$`), Fn = RegExp(`^hsla?\\(\\s*(${Se}|${Ce})\\s*\\)$`), In = RegExp(`^hwb\\(\\s*(${Se})\\s*\\)$`), Ln = RegExp(`^lab\\(\\s*(${Te})\\s*\\)$`), Rn = RegExp(`^lch\\(\\s*(${we})\\s*\\)$`), zn = RegExp(`^oklab\\(\\s*(${Te})\\s*\\)$`), Bn = RegExp(`^oklch\\(\\s*(${we})\\s*\\)$`), Vn = (e, t = {}) => { + if (_(e)) e = e.trim(); + else throw TypeError(`${e} is not a string.`); + let { colorSpace: n = "", format: r = "" } = t, i = "", a, o, s, c, l, u, d; + if (r === "mixValue") { + let r; + if (r = e.startsWith("color(") ? W(e, t) : G(e, t), r === null) return null; + if ([i, l, u, d, c] = r, i === n) return [ + l, + u, + d, + c + ]; + [a, o, s] = H(ft, [ + l, + u, + d + ], !0); + } else if (e.startsWith("color(")) { + let [, t] = e.match(Pn), [n] = t.match(/[^\s,/]+/g); + n === "srgb-linear" ? [, a, o, s, c] = q(e, { format: N }) : ([, l, u, d, c] = W(e), [a, o, s] = H(ft, [ + l, + u, + d + ], !0)); + } else [, l, u, d, c] = G(e), [a, o, s] = H(ft, [ + l, + u, + d + ], !0); + return [ + Math.min(Math.max(a, 0), 1), + Math.min(Math.max(o, 0), 1), + Math.min(Math.max(s, 0), 1), + c + ]; +}, Hn = (e, t = {}) => { + if (_(e)) e = e.trim(); + else throw TypeError(`${e} is not a string.`); + let { format: n = "" } = t, r, i, a, o; + if (n === "mixValue") { + let n; + if (n = e.startsWith("color(") ? q(e, t) : Xr(e, t), n === null) return null; + [, r, i, a, o] = n; + } else if (e.startsWith("color(")) { + let [, t] = e.match(Pn), [n] = t.match(/[^\s,/]+/g); + n === "srgb" ? ([, r, i, a, o] = q(e, { format: N }), r *= 255, i *= 255, a *= 255) : [, r, i, a, o] = q(e); + } else /^(?:ok)?l(?:ab|ch)/.test(e) ? ([r, i, a, o] = Vn(e), [r, i, a] = wt([ + r, + i, + a + ])) : [, r, i, a, o] = Xr(e, { format: N }); + return [ + r, + i, + a, + o + ]; +}, Un = (e, t = {}) => { + if (_(e)) e = e.trim(); + else throw TypeError(`${e} is not a string.`); + let { d50: n = !1, format: r = "" } = t, i, a, o, s; + if (r === "mixValue") { + let n; + if (n = e.startsWith("color(") ? W(e, t) : G(e, t), n === null) return null; + [, i, a, o, s] = n; + } else if (e.startsWith("color(")) { + let [, r] = e.match(Pn), [c] = r.match(/[^\s,/]+/g); + n ? c === "xyz-d50" ? [, i, a, o, s] = q(e, { format: N }) : [, i, a, o, s] = W(e, t) : /^xyz(?:-d65)?$/.test(c) ? [, i, a, o, s] = q(e, { format: N }) : [, i, a, o, s] = W(e); + } else [, i, a, o, s] = G(e, t); + return [ + i, + a, + o, + s + ]; +}, Wn = (e, t = {}) => { + if (_(e)) e = e.trim(); + else throw TypeError(`${e} is not a string.`); + let { format: n = "" } = t, r, i, a, o; + if (Fn.test(e)) return [, r, i, a, o] = On(e, { format: "hsl" }), n === "hsl" ? [ + Math.round(r), + Math.round(i), + Math.round(a), + o + ] : [ + r, + i, + a, + o + ]; + let s, c, l; + if (n === "mixValue") { + let n; + if (n = e.startsWith("color(") ? W(e, t) : G(e, t), n === null) return null; + [, s, c, l, o] = n; + } else e.startsWith("color(") ? [, s, c, l, o] = W(e) : [, s, c, l, o] = G(e); + return [r, i, a] = Et([ + s, + c, + l + ], !0), n === "hsl" ? [ + Math.round(r), + Math.round(i), + Math.round(a), + o + ] : [ + n === "mixValue" && i === 0 ? D : r, + i, + a, + o + ]; +}, Gn = (e, t = {}) => { + if (_(e)) e = e.trim(); + else throw TypeError(`${e} is not a string.`); + let { format: n = "" } = t, r, i, a, o; + if (In.test(e)) return [, r, i, a, o] = kn(e, { format: "hwb" }), n === "hwb" ? [ + Math.round(r), + Math.round(i), + Math.round(a), + o + ] : [ + r, + i, + a, + o + ]; + let s, c, l; + if (n === "mixValue") { + let n; + if (n = e.startsWith("color(") ? W(e, t) : G(e, t), n === null) return null; + [, s, c, l, o] = n; + } else e.startsWith("color(") ? [, s, c, l, o] = W(e) : [, s, c, l, o] = G(e); + return [r, i, a] = Dt([ + s, + c, + l + ], !0), n === "hwb" ? [ + Math.round(r), + Math.round(i), + Math.round(a), + o + ] : [ + n === "mixValue" && i + a >= 100 ? D : r, + i, + a, + o + ]; +}, Kn = (e, t = {}) => { + if (_(e)) e = e.trim(); + else throw TypeError(`${e} is not a string.`); + let { format: n = "" } = t, r, i, a, o; + if (Ln.test(e)) return [, r, i, a, o] = An(e, { format: N }), [ + r, + i, + a, + o + ]; + let s, c, l; + if (n === "mixValue") { + let n, r = { + ...t, + d50: !0 + }; + if (n = e.startsWith("color(") ? W(e, r) : G(e, r), n === null) return null; + [, s, c, l, o] = n; + } else e.startsWith("color(") ? [, s, c, l, o] = W(e, { d50: !0 }) : [, s, c, l, o] = G(e, { d50: !0 }); + return [r, i, a] = jt([ + s, + c, + l + ], !0), [ + r, + i, + a, + o + ]; +}, qn = (e, t = {}) => { + if (_(e)) e = e.trim(); + else throw TypeError(`${e} is not a string.`); + let { format: n = "" } = t, r, i, a, o; + if (Rn.test(e)) return [, r, i, a, o] = jn(e, { format: N }), [ + r, + i, + a, + o + ]; + let s, c, l; + if (n === "mixValue") { + let n, r = { + ...t, + d50: !0 + }; + if (n = e.startsWith("color(") ? W(e, r) : G(e, r), n === null) return null; + [, s, c, l, o] = n; + } else e.startsWith("color(") ? [, s, c, l, o] = W(e, { d50: !0 }) : [, s, c, l, o] = G(e, { d50: !0 }); + return [r, i, a] = Mt([ + s, + c, + l + ], !0), [ + r, + i, + n === "mixValue" && i === 0 ? D : a, + o + ]; +}, Jn = (e, t = {}) => { + if (_(e)) e = e.trim(); + else throw TypeError(`${e} is not a string.`); + let { format: n = "" } = t, r, i, a, o; + if (zn.test(e)) return [, r, i, a, o] = Mn(e, { format: N }), [ + r, + i, + a, + o + ]; + let s, c, l; + if (n === "mixValue") { + let n; + if (n = e.startsWith("color(") ? W(e, t) : G(e, t), n === null) return null; + [, s, c, l, o] = n; + } else e.startsWith("color(") ? [, s, c, l, o] = W(e) : [, s, c, l, o] = G(e); + return [r, i, a] = Ot([ + s, + c, + l + ], !0), [ + r, + i, + a, + o + ]; +}, Yn = (e, t = {}) => { + if (_(e)) e = e.trim(); + else throw TypeError(`${e} is not a string.`); + let { format: n = "" } = t, r, i, a, o; + if (Bn.test(e)) return [, r, i, a, o] = Nn(e, { format: N }), [ + r, + i, + a, + o + ]; + let s, c, l; + if (n === "mixValue") { + let n; + if (n = e.startsWith("color(") ? W(e, t) : G(e, t), n === null) return null; + [, s, c, l, o] = n; + } else e.startsWith("color(") ? [, s, c, l, o] = W(e) : [, s, c, l, o] = G(e); + return [r, i, a] = kt([ + s, + c, + l + ], !0), [ + r, + i, + n === "mixValue" && i === 0 ? D : a, + o + ]; +}, Xn = "color-mix", Zn = (e) => { + let t = I(e).filter(Boolean); + if (t[0] !== "in" || t.length < 2) return null; + let n = t.indexOf("hue"); + return t.length > 2 && n > -1 ? { + colorSpace: t[1], + hueArc: t.slice(2, n).join(" ") + } : { + colorSpace: t.slice(1).join(" "), + hueArc: "" + }; +}, Qn = (e) => { + let t = I(e).filter(Boolean), n = "", r = ""; + if (t.length === 1) n = t[0]; + else { + let e = (e) => e.endsWith("%") || e.startsWith("calc(") || e === "none"; + e(t[t.length - 1]) ? (r = t.pop(), n = t.join(" ")) : (e(t[0]) && (r = t.shift()), n = t.join(" ")); + } + return { + color: n, + pct: r + }; +}, $n = (e, t, n) => { + let r = e; + for (; _(r) && (r.startsWith("color-mix(") || r.startsWith("var(") || r.startsWith("light-dark("));) { + let e = n(r, { + ...t, + format: t.format === "specifiedValue" ? t.format : N + }); + if (!e) break; + if (Array.isArray(e)) { + let [t, n, i, a, o] = e; + r = o === 1 || o === void 0 ? t === "rgb" ? `${t}(${n}, ${i}, ${a})` : `${t}(${n} ${i} ${a})` : t === "rgb" ? `${t}a(${n}, ${i}, ${a}, ${o})` : `${t}(${n} ${i} ${a} / ${o})`; + break; + } + if (typeof e == "string") { + if (e === r) break; + r = e; + } else break; + } + return r; +}, er = (e, t) => { + let n, r, i; + if (e && t) { + let a = parseFloat(e) / 100, o = parseFloat(t) / 100; + if (Number.isNaN(a) || Number.isNaN(o) || a < 0 || a > 1 || o < 0 || o > 1 || a === 0 && o === 0) return null; + let s = a + o; + n = a / s, r = o / s, i = s < 1 ? s : 1; + } else { + if (e) { + let t = parseFloat(e); + if (Number.isNaN(t) || t < 0 || t > 100) return null; + n = t / 100, r = (100 - t) / 100; + } else if (t) { + let e = parseFloat(t); + if (Number.isNaN(e) || e < 0 || e > 100) return null; + r = e / 100, n = (100 - e) / 100; + } else n = je, r = je; + i = 1; + } + return { + pA: n, + pB: r, + m: i + }; +}, tr = (e, t) => { + if (!_(e)) return ""; + if (e.startsWith("color-mix(") || e.startsWith("light-dark(")) return e; + if (e.startsWith("color(")) { + let [n, r, i, a, o] = W(e, t); + return o === 1 ? `color(${n} ${r} ${i} ${a})` : `color(${n} ${r} ${i} ${a} / ${o})`; + } + let n = G(e, t); + if (Array.isArray(n)) { + let [e, t, r, i, a] = n; + return a === 1 ? e === "rgb" ? `${e}(${t}, ${r}, ${i})` : `${e}(${t} ${r} ${i})` : e === "rgb" ? `${e}a(${t}, ${r}, ${i}, ${a})` : `${e}(${t} ${r} ${i} / ${a})`; + } + return !_(n) || !n ? "" : n; +}, nr = (e, t, n, r, i, a, o) => { + let s = tr(n, o), c = tr(i, o); + if (!s || !c) return ""; + if (r && a) s += ` ${parseFloat(r)}%`, c += ` ${parseFloat(a)}%`; + else if (r) { + let e = parseFloat(r); + e !== 50 && (s += ` ${e}%`); + } else if (a) { + let e = 100 - parseFloat(a); + e !== 50 && (s += ` ${e}%`); + } + return t ? `color-mix(in ${e} ${t} hue, ${s}, ${c})` : `color-mix(in ${e}, ${s}, ${c})`; +}, rr = (e, t, n, r, i, a) => { + let o = n * i, s = r * a, c = o + s, l; + return l = c === 0 ? [ + e[0] * i + t[0] * a, + e[1] * i + t[1] * a, + e[2] * i + t[2] * a + ] : [ + (e[0] * o + t[0] * s) / c, + (e[1] * o + t[1] * s) / c, + (e[2] * o + t[2] * s) / c + ], { + comps: l, + alpha: c + }; +}, ir = (e, t, n, r, i, a, o) => { + let [s, c, l, u] = n, [d, f, p] = t; + if (a === "computedValue") return [ + e, + s ? D : L(d, 16), + c ? D : L(f, 16), + l ? D : L(p, 16), + u ? D : r * i + ]; + let [m, h, g] = o ?? t; + return [ + "rgb", + Math.round(m), + Math.round(h), + Math.round(g), + parseFloat((r * i).toFixed(3)) + ]; +}, K = (e, t, n) => Array.isArray(e) ? e : e === "currentcolor" ? [ + D, + D, + D, + D +] : t(e, n), ar = (e, t, n, r, i, a, o) => { + let s = e === "srgb" ? Hn : Vn, c = K(t, s, { + colorSpace: e, + format: P + }), l = K(n, s, { + colorSpace: e, + format: P + }); + if (!c || !l) return null; + let [u, d, f, p] = c, [m, h, g, _] = l, v = [ + u === "none" && m === "none", + d === "none" && h === "none", + f === "none" && g === "none", + p === "none" && _ === "none" + ], [[y, b, x, S], [C, w, T, E]] = xt(c, l, !0), { comps: D, alpha: O } = rr([ + y, + b, + x + ], [ + C, + w, + T + ], S, E, r, i); + return ir(e, D, v, O, o, a, [ + D[0] * 255, + D[1] * 255, + D[2] * 255 + ]); +}, or = (e, t, n, r, i, a, o) => { + let s = e === "xyz-d50", c = { + colorSpace: e, + d50: s, + format: P + }, l = K(t, Un, c), u = K(n, Un, c); + if (!l || !u) return null; + let [d, f, p, m] = l, [h, g, _, v] = u, y = [ + d === "none" && h === "none", + f === "none" && g === "none", + p === "none" && _ === "none", + m === "none" && v === "none" + ], [[b, x, S, C], [w, T, E, D]] = xt(l, u, !0), { comps: O, alpha: k } = rr([ + b, + x, + S + ], [ + w, + T, + E + ], C, D, r, i); + return ir(e, O, y, k, o, a, s ? At(O, !0) : Tt(O, !0)); +}, sr = (e, t, n, r, i, a, o, s) => { + let c = e === "hsl" ? Wn : Gn, l = { + colorSpace: e, + format: P + }, u = K(n, c, l), d = K(r, c, l); + if (!u || !d) return null; + let [, , , f] = u, [, , , p] = d, m = [ + !1, + !1, + !1, + f === "none" && p === "none" + ], [[h, g, _, v], [y, b, x, S]] = xt(u, d, !0); + t && ([h, y] = rt(h, y, t)); + let C = v * i, w = S * a, T = C + w, E = (h * i + y * a) % 360, D, O; + T === 0 ? (D = g * i + b * a, O = _ * i + x * a) : (D = (g * C + b * w) / T, O = (_ * C + x * w) / T); + let [k, A, j] = Hn(`${e}(${E} ${D} ${O})`), ee = [ + k / 255, + A / 255, + j / 255 + ]; + return ir(o === "computedValue" ? "srgb" : e, ee, m, T, s, o, [ + k, + A, + j + ]); +}, cr = (e, t, n, r, i, a, o, s) => { + let c = e === "lch" ? qn : Yn, l = { + colorSpace: e, + format: P + }, u = K(n, c, l), d = K(r, c, l); + if (!u || !d) return null; + let [f, p, m, h] = u, [g, _, v, y] = d, b = [ + f === "none" && g === "none", + p === "none" && _ === "none", + m === "none" && v === "none", + h === "none" && y === "none" + ], [[x, S, C, w], [T, E, D, O]] = xt(u, d, !0); + t && ([C, D] = rt(C, D, t)); + let k = w * i, A = O * a, j = k + A, ee = (C * i + D * a) % 360, M, te; + j === 0 ? (M = x * i + T * a, te = S * i + E * a) : (M = (x * k + T * A) / j, te = (S * k + E * A) / j); + let ne; + if (o !== "computedValue") { + let [, t, n, r] = Xr(`${e}(${M} ${te} ${ee})`); + ne = [ + t, + n, + r + ]; + } + return ir(e, [ + M, + te, + ee + ], b, j, s, o, ne); +}, lr = (e, t, n, r, i, a, o) => { + let s = e === "lab" ? Kn : Jn, c = { + colorSpace: e, + format: P + }, l = K(t, s, c), u = K(n, s, c); + if (!l || !u) return null; + let [d, f, p, m] = l, [h, g, _, v] = u, y = [ + d === "none" && h === "none", + f === "none" && g === "none", + p === "none" && _ === "none", + m === "none" && v === "none" + ], [[b, x, S, C], [w, T, E, D]] = xt(l, u, !0), { comps: O, alpha: k } = rr([ + b, + x, + S + ], [ + w, + T, + E + ], C, D, r, i), A; + if (a !== "computedValue") { + let [, t, n, r] = Xr(`${e}(${O[0]} ${O[1]} ${O[2]})`); + A = [ + t, + n, + r + ]; + } + return ir(e, O, y, k, o, a, A); +}, ur = (e, t, n, r, i, a, o, s, c, l) => { + let u = null; + return /^srgb(?:-linear)?$/.test(e) ? u = ar(e, n, r, i, a, s, o) : /^xyz(?:-d65|-d50)?$/.test(e) ? u = or(e, n, r, i, a, s, o) : /^h(?:sl|wb)$/.test(e) ? u = sr(e, t, n, r, i, a, s, o) : /^(?:ok)?lch$/.test(e) ? u = cr(e, t, n, r, i, a, s, o) : /^(?:ok)?lab$/.test(e) && (u = lr(e, n, r, i, a, s, o)), u === null ? ct(l, s, c) : u; +}, dr = (e, t = {}, n = () => null) => { + if (!_(e)) throw TypeError(`${e} is not a string.`); + e = e.toLowerCase().trim(); + let { format: r = "", nullable: i = !1 } = t, a = g({ + namespace: Xn, + name: "resolveColorMix", + value: e + }, t), o = m(a); + if (o !== !1) { + let { item: e } = o; + return Array.isArray(e) ? [...e] : _(e) ? e : null; + } + if (!e.startsWith("color-mix(") || !e.endsWith(")")) return ct(a, r, i); + let s = I(e.slice(10, -1).trim(), { delimiter: "," }).map((e) => e.trim()); + if (s.length !== 3) return ct(a, r, i); + let c = Zn(s[0]); + if (!c) return ct(a, r, i); + let { colorSpace: l, hueArc: u } = c, { color: d, pct: f } = Qn(s[1]), { color: h, pct: v } = Qn(s[2]); + d = $n(d, t, n), h = $n(h, t, n); + let y = er(f, v); + if (!y) return ct(a, r, i); + let { pA: b, pB: x, m: S } = y; + if (l === "xyz" && (l = "xyz-d65"), r === "specifiedValue") { + let e = nr(l, u, d, f, h, v, t); + return e ? (p(a, e), e) : ct(a, r, i); + } + let C = ur(l, u, d, h, b, x, S, r, i, a); + return C && p(a, C), C; +}, fr = "relative-color", { CloseParen: pr, Comment: mr, Delim: hr, Dimension: gr, EOF: _r, Function: vr, Ident: yr, Number: br, OpenParen: xr, Percentage: Sr, Whitespace: Cr } = e, { HasNoneKeywords: wr } = i, Tr = /* @__PURE__ */ new Map([ + ["color", [ + "r", + "g", + "b", + "alpha" + ]], + ["hsl", [ + "h", + "s", + "l", + "alpha" + ]], + ["hsla", [ + "h", + "s", + "l", + "alpha" + ]], + ["hwb", [ + "h", + "w", + "b", + "alpha" + ]], + ["lab", [ + "l", + "a", + "b", + "alpha" + ]], + ["lch", [ + "l", + "c", + "h", + "alpha" + ]], + ["oklab", [ + "l", + "a", + "b", + "alpha" + ]], + ["oklch", [ + "l", + "c", + "h", + "alpha" + ]], + ["rgb", [ + "r", + "g", + "b", + "alpha" + ]], + ["rgba", [ + "r", + "g", + "b", + "alpha" + ]] +]), Er = RegExp(`^${ge}(${De}|${ke})\\s+`), Dr = /(?:hsla?|hwb)$/, Or = RegExp(`^(?:${ue}|${de})$`), kr = /^(?:abs|sig?n|cos|tan)\(/, Ar = new RegExp(A), jr = new RegExp(ge), Mr = RegExp(`^${_e}`), Nr = RegExp(`^${ge}`), Pr = new RegExp(j); +function Fr(e, t = {}) { + if (!Array.isArray(e)) throw TypeError(`${e} is not an array.`); + let { colorSpace: n = "", format: r = "" } = t, i = Tr.get(n); + if (!i) return null; + let a = /* @__PURE__ */ new Set(), o = [ + [], + [], + [], + [] + ], s = 0, c = 0, l = "", u = !1; + for (let n of e) { + if (!Array.isArray(n)) throw TypeError(`${n} is not an array.`); + let [e, r, , , d] = n, f = o[s]; + if (Array.isArray(f)) switch (e) { + case hr: + if (l) { + if ((r === "+" || r === "-") && u && !kr.test(l)) return null; + u = !1, f.push(r); + } + break; + case gr: { + if (!l || !kr.test(l)) return null; + let e = ln(n, t); + _(e) ? f.push(e) : f.push(r); + break; + } + case vr: + f.push(r), l = r, c++, Ar.test(r) && a.add(c); + break; + case yr: + if (!i.includes(r)) return null; + f.push(r), l || s++; + break; + case br: + f.push(Number(d?.value)), l || s++; + break; + case xr: + f.push(r), c++; + break; + case pr: + l && (f.at(-1) === " " ? f[f.length - 1] = r : f.push(r), a.has(c) && a.delete(c), c--, c === 0 && (l = "", s++)); + break; + case Sr: + if (!l) return null; + if (!kr.test(l)) { + let e; + for (let t = f.length - 1; t >= 0; t--) if (f[t] !== " ") { + e = f[t]; + break; + } + if (e === "+" || e === "-") return null; + u = e !== "*" && e !== "/"; + } + f.push(Number(d?.value) / 100); + break; + case Cr: + if (f.length && l) { + let e = f.at(-1); + (typeof e == "number" || _(e) && !e.endsWith("(") && e !== " ") && f.push(r); + } + break; + default: e !== mr && e !== _r && l && f.push(r); + } + } + let d = []; + for (let e of o) if (e.length === 1) { + let [t] = e; + v(t) && d.push(t); + } else if (e.length) { + let t = cn(e.join(""), { format: r }); + d.push(t); + } + return d; +} +function Ir(e, n = {}, r = () => null) { + let { colorScheme: i = "normal", currentColor: a = "", format: o = "" } = n; + if (_(e)) { + if (e = e.toLowerCase().trim(), !e) return null; + if (!Nr.test(e)) return e; + } else return null; + let s = g({ + namespace: fr, + name: "extractOriginColor", + value: e + }, n), c = m(s); + if (c !== !1) return c.item; + if (/currentcolor/.test(e)) { + if (a) e = e.replace(/currentcolor/g, a); + else return p(s, null), null; + } + let [, l] = e.match(Mr), u = { + ...n, + colorSpace: l + }; + if (e.includes("light-dark(")) { + let [, t] = I(e.replace(RegExp(`^${l}\\(`), "").replace(/\)$/, "")), n = r(t, { + colorScheme: i, + format: Ae + }); + if (!n) return p(s, null), null; + if (o === "specifiedValue") e = e.replace(t, n); + else { + let i = r(n, u); + if (_(i)) e = e.replace(t, i); + else return p(s, null), null; + } + } + if (Er.test(e)) { + let [, n] = e.match(Er), [, i] = e.split(n); + if (/^[a-z]+$/.test(n)) { + if (!/^transparent$/.test(n) && !Object.hasOwn(gn, n)) return p(s, null), null; + } else if (o === "specifiedValue") { + let t = r(n, u); + e = e.replace(n, t); + } + if (o === "specifiedValue") { + let n = Fr(t({ css: i }), u); + if (n === null) return p(s, null), null; + let [r, a, o, c] = n, l = ""; + l = v(c) ? ` ${r} ${a} ${o} / ${c})` : ` ${n.join(" ")})`, i !== l && (e = e.replace(i, l)); + } + } else { + let [, n] = e.split(Nr), i = t({ css: n }), a = [], o = 0, c = 0; + for (let [e, t] of i) { + switch (c++, e) { + case vr: + case xr: + a.push(t), o++; + break; + case pr: + a.at(-1) === " " ? a[a.length - 1] = t : a.push(t), o--; + break; + case Cr: { + let e = a.at(-1); + _(e) && !e.endsWith("(") && e !== " " && a.push(t); + break; + } + default: e !== mr && e !== _r && a.push(t); + } + if (o === 0) break; + } + let l = Lr(a.join("").trim(), u, r); + if (l === null) return p(s, null), null; + let d = Fr(i.slice(c), u); + if (d === null) return p(s, null), null; + let [f, m, h, g] = d, y = ""; + y = v(g) ? ` ${f} ${m} ${h} / ${g})` : ` ${d.join(" ")})`, e = e.replace(n, `${l}${y}`); + } + return p(s, e), e; +} +function Lr(e, n = {}, r = () => null) { + let i = { ...n }, { format: o = "" } = i; + if (_(e)) { + if (Pr.test(e)) { + if (o !== "specifiedValue") throw SyntaxError(`Unexpected token ${ve} found.`); + return e; + } + if (!jr.test(e)) return e; + e = e.toLowerCase().trim(); + } else throw TypeError(`${e} is not a string.`); + let s = g({ + namespace: fr, + name: "resolveRelativeColor", + value: e + }, i), l = m(s); + if (l !== !1) return l.item; + let u = Ir(e, i, r); + if (u === null) return p(s, null), null; + if (e = u, o === "specifiedValue") return e.startsWith("rgba(") ? e = e.replace("rgba(", "rgb(") : e.startsWith("hsla(") && (e = e.replace("hsla(", "hsl(")), e; + let d = t({ css: e }), f = c(d), h = a(f); + if (!h) return p(s, null), null; + let { alpha: v, channels: y, colorNotation: b, syntaxFlags: x } = h, S; + S = Number.isNaN(Number(v)) ? x instanceof Set && x.has(wr) ? D : 0 : L(Number(v), 8); + let C, w, T; + [C, w, T] = y; + let E; + if (Or.test(b)) { + let e = x instanceof Set && x.has(wr); + C = Number.isNaN(C) ? e ? D : 0 : L(C, 16), w = Number.isNaN(w) ? e ? D : 0 : L(w, 16), T = Number.isNaN(T) ? e ? D : 0 : L(T, 16), E = S === 1 ? `${b}(${C} ${w} ${T})` : `${b}(${C} ${w} ${T} / ${S})`; + } else if (Dr.test(b)) { + Number.isNaN(C) && (C = 0), Number.isNaN(w) && (w = 0), Number.isNaN(T) && (T = 0); + let [e, t, n] = Hn(`${b}(${C} ${w} ${T} / ${S})`); + e = L(e / 255, 10), t = L(t / 255, 10), n = L(n / 255, 10), E = S === 1 ? `color(srgb ${e} ${t} ${n})` : `color(srgb ${e} ${t} ${n} / ${S})`; + } else { + let e = b === "rgb" ? "srgb" : b, t = x instanceof Set && x.has(wr); + C = Number.isNaN(C) ? t ? D : 0 : L(C, 10), w = Number.isNaN(w) ? t ? D : 0 : L(w, 10), T = Number.isNaN(T) ? t ? D : 0 : L(T, 10), E = S === 1 ? `color(${e} ${C} ${w} ${T})` : `color(${e} ${C} ${w} ${T} / ${S})`; + } + return p(s, E), E; +} +//#endregion +//#region src/resolvers/resolve-color.ts +var Rr = "resolve-color", zr = "rgba(0, 0, 0, 0)", Br = RegExp(`^(?:${De})$`), Vr = RegExp(`^color\\(\\s*(${ye})\\s*\\)$`), Hr = /^currentColor$/i, Ur = new RegExp(k), Wr = /^(?:(?:ok)?l(?:ab|ch)|color(?:-mix)?|hsla?|hwb|rgba?|var)\(/, Gr = new RegExp(be), Kr = new RegExp(xe), qr = new RegExp(j), Jr = new RegExp(ke), Yr = /^(?:specifi|comput)edValue$/, Xr = (e, t = {}) => { + if (_(e)) e = e.toLowerCase().trim(); + else throw TypeError(`${e} is not a string.`); + let { colorSpace: n = "", format: r = "", nullable: i = !1 } = t, a = g({ + namespace: Rr, + name: "resolveColorValue", + value: e + }, t), o = m(a); + if (o !== !1) { + let { item: e } = o; + return Array.isArray(e) ? [...e] : e; + } + if (!Br.test(e)) { + let e = z(r, i); + return e === null ? (p(a, null), null) : (p(a, e), _(e), e); + } + let s = "", c = 0, l = 0, u = 0, d = 0; + if (Hr.test(e)) { + if (r === "specifiedValue") return p(a, e), e; + } else if (/^[a-z]+$/.test(e)) { + if (Object.hasOwn(gn, e)) { + if (r === "specifiedValue") return p(a, e), e; + [c, l, u] = gn[e], d = 1; + } else switch (r) { + case Ae: return e === "transparent" ? (p(a, e), e) : (p(a, ""), ""); + case P: + if (e === "transparent") { + let e = [ + "rgb", + 0, + 0, + 0, + 0 + ]; + return p(a, e), [...e]; + } + return p(a, null), null; + case N: + default: { + if (i && e !== "transparent") return p(a, null), null; + let t = [ + "rgb", + 0, + 0, + 0, + 0 + ]; + return p(a, t), [...t]; + } + } + } else if (e[0] === "#") [c, l, u, d] = Pt(e); + else if (e.startsWith("hsl")) [, c, l, u, d] = On(e, t); + else if (e.startsWith("hwb")) [, c, l, u, d] = kn(e, t); + else if (/^l(?:ab|ch)/.test(e)) { + let n, i, o; + if (e.startsWith("lab") ? [s, n, i, o, d] = An(e, t) : [s, n, i, o, d] = jn(e, t), Yr.test(r)) { + let e = [ + s, + n, + i, + o, + d + ]; + return p(a, e), [...e]; + } + [c, l, u] = At([ + n, + i, + o + ]); + } else if (/^okl(?:ab|ch)/.test(e)) { + let n, i, o; + if (e.startsWith("oklab") ? [s, n, i, o, d] = Mn(e, t) : [s, n, i, o, d] = Nn(e, t), Yr.test(r)) { + let e = [ + s, + n, + i, + o, + d + ]; + return p(a, e), [...e]; + } + [c, l, u] = Tt([ + n, + i, + o + ]); + } else [, c, l, u, d] = Dn(e, t); + if (r === "mixValue" && n === "srgb") { + let e = [ + "srgb", + c / 255, + l / 255, + u / 255, + d + ]; + return p(a, e), [...e]; + } + let f = [ + "rgb", + Math.round(c), + Math.round(l), + Math.round(u), + d + ]; + return p(a, f), [...f]; +}, q = (e, t = {}) => { + if (_(e)) e = e.toLowerCase().trim(); + else throw TypeError(`${e} is not a string.`); + let { colorSpace: n = "", format: r = "", nullable: i = !1 } = t, a = g({ + namespace: Rr, + name: "resolveColorFunc", + value: e + }, t), o = m(a); + if (o !== !1) { + let { item: e } = o; + return Array.isArray(e) ? [...e] : e; + } + if (!Vr.test(e)) { + let e = z(r, i); + return e === null ? (p(a, null), null) : (p(a, e), _(e), e); + } + let [s, c, l, u, d] = W(e, t); + if (Yr.test(r) || r === "mixValue" && s === n) { + let e = [ + s, + c, + l, + u, + d + ]; + return p(a, e), [...e]; + } + let f = parseFloat(`${c}`), h = parseFloat(`${l}`), v = parseFloat(`${u}`), y = R(`${d}`), [b, x, S] = Tt([ + f, + h, + v + ], !0), C = [ + "rgb", + b, + x, + S, + y + ]; + return p(a, C), [...C]; +}, J = (e, t = {}) => { + if (!_(e)) throw TypeError(`${e} is not a string.`); + e = e.trim(); + let { colorScheme: n = "normal", currentColor: r = "", format: i = N, nullable: a = !1 } = t, o = g({ + namespace: Rr, + name: "resolve", + value: e + }, t), s = m(o); + if (s !== !1) return s.item; + if (qr.test(e)) { + if (i === "specifiedValue") return p(o, e), e; + let n = mn(e, t); + if (n === null) { + let e = i === "hex" || i === "hexAlpha" || a ? null : zr; + return p(o, e), e; + } + e = n; + } + if (t.format !== i && (t.format = i), e = e.toLowerCase(), Gr.test(e) && e.endsWith(")")) { + let [r = "", a = ""] = I(e.replace(Gr, "").replace(/\)$/, ""), { delimiter: "," }); + if (r && a) { + if (i === "specifiedValue") { + let e = J(r, t), n = J(a, t), i = e && n ? `light-dark(${e}, ${n})` : ""; + return p(o, i), i; + } + let e = J(n === "dark" ? a : r, t); + return p(o, e), e; + } + let s; + return s = i === "specifiedValue" ? "" : i === "hex" || i === "hexAlpha" ? null : zr, p(o, s), s; + } + if (Kr.test(e)) { + let n = Lr(e, t, J); + if (i === "computedValue") { + let e = n === null && !a ? zr : n; + return p(o, e), e; + } + if (i === "specifiedValue") { + let e = n === null ? "" : n; + return p(o, e), e; + } + e = n === null ? "" : n; + } + Ur.test(e) && (e = dn(e, t)); + let c = "", l = NaN, u = NaN, d = NaN, f = NaN; + if (e === "transparent") { + let t; + switch (i) { + case Ae: + t = e; + break; + case "hex": + t = null; + break; + case "hexAlpha": + t = "#00000000"; + break; + default: t = zr; + } + return p(o, t), t; + } + if (e === "currentcolor") { + if (i === "specifiedValue") return p(o, e), e; + if (r) { + let e; + if (e = r.startsWith("color-mix(") ? dr(r, t, J) : r.startsWith("color(") ? q(r, t) : Xr(r, t), e === null) return p(o, null), null; + [c, l, u, d, f] = e; + } else { + let t = i === "computedValue" ? zr : e; + if (i === "computedValue") return p(o, t), t; + } + } else if (i === "specifiedValue") { + let n = ""; + if (e.startsWith("color-mix(")) { + let r = dr(e, t, J); + _(r) && r && (n = r); + } else if (e.startsWith("color(")) { + let r = q(e, t); + if (Array.isArray(r)) { + let [e, t, i, a, o] = r; + n = o === 1 ? `color(${e} ${t} ${i} ${a})` : `color(${e} ${t} ${i} ${a} / ${o})`; + } + } else { + let r = Xr(e, t); + if (Array.isArray(r)) { + let [e, t, i, a, o] = r; + n = e === "rgb" ? o === 1 ? `${e}(${t}, ${i}, ${a})` : `${e}a(${t}, ${i}, ${a}, ${o})` : o === 1 ? `${e}(${t} ${i} ${a})` : `${e}(${t} ${i} ${a} / ${o})`; + } else r && (n = r); + } + return p(o, n), n; + } else if (e.startsWith("color-mix(")) { + r && (e = e.replace(/currentcolor/g, r)), e = e.replace(/transparent/g, zr); + let n = dr(e, t, J); + if (n === null) return p(o, null), null; + [c, l, u, d, f] = n; + } else if (e.startsWith("color(")) { + let n = q(e, t); + if (n === null) return p(o, null), null; + [c, l, u, d, f] = n; + } else if (e) { + let n = Xr(e, t); + if (n === null) return p(o, null), null; + [c, l, u, d, f] = n; + } + let h = ""; + switch (i) { + case "hex": + case "hexAlpha": + h = Number.isNaN(l) || Number.isNaN(u) || Number.isNaN(d) || Number.isNaN(f) || i === "hex" && f === 0 ? null : Nt([ + l, + u, + d, + i === "hex" ? 1 : f + ]); + break; + default: h = c === "rgb" ? f === 1 ? `${c}(${l}, ${u}, ${d})` : `${c}a(${l}, ${u}, ${d}, ${f})` : [ + "lab", + "lch", + "oklab", + "oklch" + ].includes(c) ? f === 1 ? `${c}(${l} ${u} ${d})` : `${c}(${l} ${u} ${d} / ${f})` : f === 1 ? `color(${c} ${l} ${u} ${d})` : `color(${c} ${l} ${u} ${d} / ${f})`; + } + return p(o, h), h; +}, Zr = (e, t = {}) => { + if (!_(e)) return !1; + let n = e.toLowerCase().trim(); + return n ? /^[a-z]+$/.test(n) ? n === "currentcolor" || n === "transparent" || Object.hasOwn(gn, n) : Br.test(n) || Jr.test(n) ? !0 : Wr.test(n) ? !!J(n, { + ...t, + nullable: !0 + }) : !1 : !1; +}, Qr = RegExp(`^(?:${w})$`, "i"), $r = /^(?:calc|min|max|clamp)\(/i, ei = /^(?:e|pi|-?infinity|NaN)$/i, ti = (t) => { + for (; t.tokens[t.index][0] === e.Whitespace || t.tokens[t.index][0] === e.Comment;) t.index++; +}, ni = (t, n, r) => { + for (let i = n; i >= 0 && i < t.length; i += r) { + if (t[i][0] === e.Whitespace) return !0; + if (t[i][0] !== e.Comment) break; + } + return !1; +}, ri = (t) => { + let n = ai(t); + if (n === null) return null; + for (ti(t); t.tokens[t.index][0] === e.Delim && (t.tokens[t.index][1] === "*" || t.tokens[t.index][1] === "/");) { + let e = t.tokens[t.index++][1], r = ai(t); + if (r === null || (e === "*" ? n !== 0 && r !== 0 : r !== 0)) return null; + n += r, ti(t); + } + return n; +}, ii = (t) => { + let n = ri(t); + if (n === null) return null; + for (; t.tokens[t.index][0] === e.Delim && (t.tokens[t.index][1] === "+" || t.tokens[t.index][1] === "-");) if (!ni(t.tokens, t.index - 1, -1) || !ni(t.tokens, t.index + 1, 1) || (t.index++, ri(t) !== n)) return null; + return n; +}; +function ai(t) { + if (ti(t), t.tokens[t.index][0] === e.EOF) return null; + let n = t.tokens[t.index++]; + switch (n[0]) { + case e.Number: return 0; + case e.Percentage: return 1; + case e.Dimension: return Qr.test(n[4].unit) ? 1 : null; + case e.Ident: return ei.test(n[4].value) ? 0 : null; + case e.OpenParen: + case e.Function: { + let r = n[0] === e.Function ? n[4].value.toLowerCase() : "calc"; + if (![ + "calc", + "min", + "max", + "clamp" + ].includes(r)) return null; + let i = ii(t); + if (i === null) return null; + let a = 1; + for (; t.tokens[t.index][0] === e.Comma;) { + if (t.index++, ii(t) !== i) return null; + a++; + } + return t.tokens[t.index][0] !== e.CloseParen || r === "calc" && a !== 1 || r === "clamp" && a !== 3 ? null : (t.index++, i); + } + default: return null; + } +} +var oi = (n) => { + if (!_(n) || !$r.test(n)) return !1; + let r = [], i = { + tokens: t({ css: n }, { onParseError: r.push.bind(r) }), + index: 0 + }, a = ai(i); + return ti(i), r.length === 0 && a === 1 && i.tokens[i.index][0] === e.EOF; +}, { Function: si } = e, ci = `${T}(?:${C})`, li = `${ci}|${O}`, Y = `${`${T}(?:${w})|0`}|${O}`, ui = `${E}(?:${w}|%)|0`, di = `${E}(?:${w})|0`, X = "center", fi = "left|right", pi = "top|bottom", Z = "start|end", mi = `${fi}|x-(?:${Z})`, hi = `${pi}|y-(?:${Z})`, gi = `block-(?:${Z})`, _i = `inline-(?:${Z})`, vi = `${X}|${mi}|${hi}|${gi}|${_i}|${Y}`, yi = [ + `(?:${X}|${mi})\\s+(?:${X}|${hi})`, + `(?:${X}|${hi})\\s+(?:${X}|${mi})`, + `(?:${X}|${mi}|${Y})\\s+(?:${X}|${hi}|${Y})`, + `(?:${X}|${gi})\\s+(?:${X}|${_i})`, + `(?:${X}|${_i})\\s+(?:${X}|${gi})`, + `(?:${X}|${Z})\\s+(?:${X}|${Z})` +].join("|"), bi = [ + `(?:${mi})\\s+(?:${Y})\\s+(?:${hi})\\s+(?:${Y})`, + `(?:${hi})\\s+(?:${Y})\\s+(?:${mi})\\s+(?:${Y})`, + `(?:${gi})\\s+(?:${Y})\\s+(?:${hi})\\s+(?:${Y})`, + `(?:${_i})\\s+(?:${Y})\\s+(?:${gi})\\s+(?:${Y})`, + `(?:${Z})\\s+(?:${Y})\\s+(?:${Z})\\s+(?:${Y})` +].join("|"), xi = "(?:clos|farth)est-(?:corner|side)", Si = [ + `${xi}(?:\\s+${xi})?`, + `${di}`, + `(?:${ui})\\s+(?:${ui})` +].join("|"), Ci = "circle|ellipse", wi = `from\\s+${ci}`, Q = `at\\s+(?:${vi}|${yi}|${bi})`, Ti = `to\\s+(?:(?:${fi})(?:\\s(?:${pi}))?|(?:${pi})(?:\\s(?:${fi}))?)`, $ = `in\\s+(?:${me}|${le})`, Ei = [`(?:${ci}|${Ti})(?:\\s+${$})?`, `${$}(?:\\s+(?:${ci}|${Ti}))?`].join("|"), Di = [ + `(?:${Ci})(?:\\s+(?:${Si}))?(?:\\s+${Q})?(?:\\s+${$})?`, + `(?:${Si})(?:\\s+(?:${Ci}))?(?:\\s+${Q})?(?:\\s+${$})?`, + `${Q}(?:\\s+${$})?`, + `${$}(?:\\s+${Ci})(?:\\s+(?:${Si}))?(?:\\s+${Q})?`, + `${$}(?:\\s+${Si})(?:\\s+(?:${Ci}))?(?:\\s+${Q})?`, + `${$}(?:\\s+${Q})?` +].join("|"), Oi = [ + `${wi}(?:\\s+${Q})?(?:\\s+${$})?`, + `${Q}(?:\\s+${$})?`, + `${$}(?:\\s+${wi})?(?:\\s+${Q})?` +].join("|"), ki = [ + /ellipse/, + /farthest-corner/, + /at\s+center/ +], Ai = [/at\s+center/], ji = { + format: Ae, + nullable: !0 +}, Mi = /^(?:repeating-)?conic-gradient$/, Ni = /^(?:repeating-)?linear-gradient$/, Pi = /^(?:repeating-)?radial-gradient$/, Fi = /^(?:repeating-)?(?:conic|linear|radial)-gradient$/i, Ii = RegExp(`^(?:${li})$`), Li = RegExp(`^(?:${Y})$`), Ri = RegExp(`^(?:${Oi})$`), zi = RegExp(`^(?:${Ei})$`), Bi = RegExp(`^(?:${Di})$`), Vi = /^to\s+bottom$/i, Hi = (e) => { + if (_(e)) { + let n = e.trim(); + if (n) { + let [e] = t({ css: n }); + if (e && e[0] === si) { + let t = e[1].slice(0, -1).toLowerCase(); + if (Fi.test(t)) return t; + } + } + } + return ""; +}, Ui = (e) => { + if (!zi.test(e)) return { + line: e, + valid: !1 + }; + let t = e.replace(/\s+/g, " ").trim(); + return Vi.test(t) ? { + line: "", + valid: !0 + } : { + line: t.replace(/^to\sbottom\s/i, "").replace(/\sto\sbottom$/i, "").trim(), + valid: !0 + }; +}, Wi = (e) => { + if (!Bi.test(e)) return { + line: e, + valid: !1 + }; + let t = e; + for (let e of ki) t = t.replace(e, ""); + return t = t.replace(/\s{2,}/g, " ").trim(), { + line: t, + valid: !0 + }; +}, Gi = (e) => { + if (!Ri.test(e)) return { + line: e, + valid: !1 + }; + let t = e; + for (let e of Ai) t = t.replace(e, ""); + return t = t.replace(/\s{2,}/g, " ").trim(), { + line: t, + valid: !0 + }; +}, Ki = (e, t) => { + if (_(e) && _(t)) { + let n = e.trim(), r = t.trim(); + if (Ni.test(r)) return Ui(n); + if (Pi.test(r)) return Wi(n); + if (Mi.test(r)) return Gi(n); + } + return { + line: e, + valid: !1 + }; +}, qi = (e) => { + let n = l(t({ css: e })), r = []; + for (let e of n) !o(e) && !s(e) && r.push(e.toString()); + return r; +}, Ji = (e, t) => (t ? Ii : Li).test(e) || !t && oi(e), Yi = (e, t, n = {}) => { + if (Array.isArray(e) && e.length > 1) { + let r = Mi.test(t), i = [], a = ""; + for (let [t, o] of e.entries()) { + if (!_(o)) return { + colorStops: e, + valid: !1 + }; + let s = qi(o), [c, ...l] = s; + if (!c || s.length > 3) return { + colorStops: e, + valid: !1 + }; + if (s.length === 1 && Ji(c, r)) { + if (t === 0 || a === "hint") return { + colorStops: e, + valid: !1 + }; + a = "hint"; + let r = oi(c) ? dn(c, n) : c; + i.push(r); + } else { + let t = []; + for (let i of l) { + if (!Ji(i, r)) return { + colorStops: e, + valid: !1 + }; + let a = oi(i) ? dn(i, n) : i; + t.push(a); + } + let o = I(c).join(" "); + if (Zr(o, ji)) { + let r = J(o, n); + if (!r || !Zr(r, ji)) return { + colorStops: e, + valid: !1 + }; + a = "color"; + let s = t.length > 0 ? `${r} ${t.join(" ")}` : r; + i.push(s); + } else return { + colorStops: e, + valid: !1 + }; + } + } + return a === "color" ? { + valid: !0, + colorStops: i + } : { + colorStops: e, + valid: !1 + }; + } + return { + colorStops: e, + valid: !1 + }; +}, Xi = "gradient", Zi = { + format: Ae, + nullable: !0 +}, Qi = /^(?:repeating-)?(?:conic|linear|radial)-gradient\(/, $i = (e, t = {}) => { + if (!_(e)) return null; + let n = e.trim(), r = g({ + namespace: Xi, + name: "parseGradient", + value: n + }, t), i = m(r); + if (i !== !1) return i.item; + let a = Hi(n), o = n.replace(Qi, "").replace(/\)$/, ""); + if (a && o) { + let [e, ...i] = I(o, { + delimiter: ",", + preserveComment: !0 + }); + if (!e) return p(r, null), null; + let [s] = qi(e); + if (s && Zr(I(s).join(" "), Zi)) { + i.unshift(e); + let { colorStops: o, valid: s } = Yi(i, a, t); + if (s) { + let e = { + value: n, + type: a, + colorStopList: o + }; + return p(r, e), e; + } + } else if (i.length > 1) { + let { line: o, valid: s } = Ki(I(e).join(" "), a), { colorStops: c, valid: l } = Yi(i, a, t); + if (s && l) { + let e = { + value: n, + type: a, + gradientLine: o, + colorStopList: c + }; + return p(r, e), e; + } + } + } + return p(r, null), null; +}, ea = (e, t = {}) => { + let n = { ...t }, r = tt(n); + if (e && e.length <= r) { + let t = $i(e, n); + if (t) { + let { type: e, gradientLine: n, colorStopList: r } = t; + return n ? `${e}(${n}, ${r.join(", ")})` : `${e}(${r.join(", ")})`; + } + } + return n.format === "specifiedValue" ? "" : "none"; +}, ta = (e, t = {}) => !!$i(e, { ...t }), na = (e, t = {}) => J(e, { ...t }), ra = (e, t = {}) => !!Zr(e, { + ...t, + nullable: !0 +}), ia = "convert", aa = new RegExp(k), oa = new RegExp(xe), sa = new RegExp(j), ca = (e, t) => { + if (!_(e)) return null; + e = e.trim(); + let n = tt(t); + if (!e || e.length > n) return null; + let r = g({ + namespace: ia, + name: "preProcess", + value: e + }, t), i = m(r); + if (i !== !1) return i.item; + let a = e; + if (sa.test(e)) { + let n = mn(e, t); + if (_(n)) a = n; + else return p(r, null), null; + } + if (oa.test(a)) { + let e = Lr(a, t); + if (_(e)) a = e; + else return p(r, null), null; + } else aa.test(a) && (a = dn(a, t)); + if (a.startsWith("color-mix")) { + let e = J(a, { + ...t, + format: N, + nullable: !0 + }); + a = typeof e == "string" ? e : null; + } + return !a || a.length > n ? (p(r, null), null) : (p(r, a), a); +}, la = (e, t, n) => (r, i = {}) => { + if (!_(r)) throw TypeError(`${r} is not a string.`); + let a = { ...i }, o = ca(r, a); + if (o === null) return [ + 0, + 0, + 0, + 0 + ]; + let s = o.toLowerCase(), c = g({ + namespace: ia, + name: e, + value: s + }, a), l = m(c); + if (l !== !1) return [...l.item]; + let u = n(s, { + ...a, + format: t + }); + return p(c, u), [...u]; +}, ua = (e) => ot(e), da = (e, t = {}) => { + if (!_(e)) throw TypeError(`${e} is not a string.`); + let n = { ...t }, r = ca(e, n); + if (r === null) return null; + let i = r.toLowerCase(), a = g({ + namespace: ia, + name: "colorToHex", + value: i + }, n), o = m(a); + if (o !== !1) return o.item; + let s = J(i, { + ...n, + nullable: !0, + format: n.alpha ? "hexAlpha" : "hex" + }); + return _(s) ? (p(a, s), s) : (p(a, null), null); +}, fa = la("colorToHsl", "hsl", Wn), pa = la("colorToHwb", "hwb", Gn), ma = la("colorToLab", "lab", Kn), ha = la("colorToLch", "lch", qn), ga = la("colorToOklab", "oklab", Jn), _a = la("colorToOklch", "oklch", Yn), va = la("colorToRgb", "rgb", Hn), ya = (e, t = {}) => { + if (!_(e)) throw TypeError(`${e} is not a string.`); + let n = { ...t }, r = ca(e, n); + if (r === null) return [ + 0, + 0, + 0, + 0 + ]; + let i = r.toLowerCase(), a = g({ + namespace: ia, + name: "colorToXyz", + value: i + }, n), o = m(a); + if (o !== !1) return [...o.item]; + let s; + s = i.startsWith("color(") ? W(i, n) : G(i, n); + let [, ...c] = s; + return p(a, c), [...c]; +}, ba = { + colorToHex: da, + colorToHsl: fa, + colorToHwb: pa, + colorToLab: ma, + colorToLch: ha, + colorToOklab: ga, + colorToOklch: _a, + colorToRgb: va, + colorToXyz: ya, + colorToXyzD50: (e, t = {}) => ya(e, { + ...t, + d50: !0 + }), + numberToHex: ua +}, xa = { + cssCalc: dn, + cssVar: hn, + extractDashedIdent: nt, + isColor: ra, + isGradient: ta, + resolveGradient: ea, + resolveLengthInPixels: it, + splitValue: I +}; +//#endregion +export { ba as convert, na as resolve, ea as resolveGradient, xa as utils }; diff --git a/node_modules/@asamuzakjp/css-color/dist/esm/matrix/matrix.d.ts b/node_modules/@asamuzakjp/css-color/dist/esm/matrix/matrix.d.ts new file mode 100644 index 0000000..d919abd --- /dev/null +++ b/node_modules/@asamuzakjp/css-color/dist/esm/matrix/matrix.d.ts @@ -0,0 +1,21 @@ +/** + * matrix + */ +import { ReadonlyColorMatrix, ReadonlyTriColorChannels } from '../typedef'; +/** + * conversion matrices + * @see https://drafts.csswg.org/css-color-4/#color-conversion-code + */ +export declare const D50: ReadonlyTriColorChannels; +export declare const MATRIX_D50_TO_D65: ReadonlyColorMatrix; +export declare const MATRIX_D65_TO_D50: ReadonlyColorMatrix; +export declare const MATRIX_L_RGB_TO_XYZ: ReadonlyColorMatrix; +export declare const MATRIX_XYZ_TO_L_RGB: ReadonlyColorMatrix; +export declare const MATRIX_XYZ_TO_LMS: ReadonlyColorMatrix; +export declare const MATRIX_LMS_TO_XYZ: ReadonlyColorMatrix; +export declare const MATRIX_OKLAB_TO_LMS: ReadonlyColorMatrix; +export declare const MATRIX_LMS_TO_OKLAB: ReadonlyColorMatrix; +export declare const MATRIX_P3_TO_XYZ: ReadonlyColorMatrix; +export declare const MATRIX_REC2020_TO_XYZ: ReadonlyColorMatrix; +export declare const MATRIX_A98_TO_XYZ: ReadonlyColorMatrix; +export declare const MATRIX_PROPHOTO_TO_XYZ_D50: ReadonlyColorMatrix; diff --git a/node_modules/@asamuzakjp/css-color/dist/esm/matrix/transform.d.ts b/node_modules/@asamuzakjp/css-color/dist/esm/matrix/transform.d.ts new file mode 100644 index 0000000..bf140fa --- /dev/null +++ b/node_modules/@asamuzakjp/css-color/dist/esm/matrix/transform.d.ts @@ -0,0 +1,122 @@ +/** + * transform + */ +import { ColorChannels, NumStrColorChannels, ReadonlyColorMatrix, TriColorChannels, ValidateColorComponentsOptions } from '../typedef'; +/** + * validate color components + * @param arr - color components + * @param opt - options + * @param opt.alpha - alpha channel + * @param opt.minLength - min length + * @param opt.maxLength - max length + * @param opt.minRange - min range + * @param opt.maxRange - max range + * @param opt.validateRange - validate range + * @returns result - validated color components + */ +export declare const validateColorComponents: (arr: ColorChannels | TriColorChannels, opt?: ValidateColorComponentsOptions) => ColorChannels | TriColorChannels; +/** + * normalize color components + * @param colorA - color components [v1, v2, v3, v4] + * @param colorB - color components [v1, v2, v3, v4] + * @param [skip] - skip validate + * @returns result - [colorA, colorB] + */ +export declare const normalizeColorComponents: (colorA: NumStrColorChannels, colorB: NumStrColorChannels, skip?: boolean) => [ColorChannels, ColorChannels]; +/** + * transform matrix + * @param mtx - 3 * 3 matrix + * @param vct - vector + * @param [skip] - skip validate + * @returns TriColorChannels - [p1, p2, p3] + */ +export declare const transformMatrix: (mtx: ReadonlyColorMatrix, vct: TriColorChannels, skip?: boolean) => TriColorChannels; +/** + * transform rgb to linear rgb + * @param rgb - [r, g, b] r|g|b: 0..255 + * @param [skip] - skip validate + * @returns TriColorChannels - [r, g, b] r|g|b: 0..1 + */ +export declare const transformRgbToLinearRgb: (rgb: TriColorChannels, skip?: boolean) => TriColorChannels; +/** + * transform rgb to xyz + * @param rgb - [r, g, b] r|g|b: 0..255 + * @param [skip] - skip validate + * @returns TriColorChannels - [x, y, z] + */ +export declare const transformRgbToXyz: (rgb: TriColorChannels, skip?: boolean) => TriColorChannels; +/** + * transform rgb to xyz-d50 + * @param rgb - [r, g, b] r|g|b: 0..255 alpha: 0..1 + * @returns TriColorChannels - [x, y, z] + */ +export declare const transformRgbToXyzD50: (rgb: TriColorChannels) => TriColorChannels; +/** + * transform linear rgb to rgb + * @param rgb - [r, g, b] r|g|b: 0..1 + * @param [round] - round result + * @returns TriColorChannels - [r, g, b] r|g|b: 0..255 + */ +export declare const transformLinearRgbToRgb: (rgb: TriColorChannels, round?: boolean) => TriColorChannels; +/** + * transform xyz to rgb + * @param xyz - [x, y, z] + * @param [skip] - skip validate + * @returns TriColorChannels - [r, g, b] r|g|b: 0..255 + */ +export declare const transformXyzToRgb: (xyz: TriColorChannels, skip?: boolean) => TriColorChannels; +/** + * transform xyz to xyz-d50 + * @param xyz - [x, y, z] + * @returns TriColorChannels - [x, y, z] + */ +export declare const transformXyzToXyzD50: (xyz: TriColorChannels) => TriColorChannels; +/** + * transform xyz to hsl + * @param xyz - [x, y, z] + * @param [skip] - skip validate + * @returns TriColorChannels - [h, s, l] + */ +export declare const transformXyzToHsl: (xyz: TriColorChannels, skip?: boolean) => TriColorChannels; +/** + * transform xyz to hwb + * @param xyz - [x, y, z] + * @param [skip] - skip validate + * @returns TriColorChannels - [h, w, b] + */ +export declare const transformXyzToHwb: (xyz: TriColorChannels, skip?: boolean) => TriColorChannels; +/** + * transform xyz to oklab + * @param xyz - [x, y, z] + * @param [skip] - skip validate + * @returns TriColorChannels - [l, a, b] + */ +export declare const transformXyzToOklab: (xyz: TriColorChannels, skip?: boolean) => TriColorChannels; +/** + * transform xyz to oklch + * @param xyz - [x, y, z] + * @param [skip] - skip validate + * @returns TriColorChannels - [l, c, h] + */ +export declare const transformXyzToOklch: (xyz: TriColorChannels, skip?: boolean) => TriColorChannels; +/** + * transform xyz D50 to rgb + * @param xyz - [x, y, z] + * @param [skip] - skip validate + * @returns TriColorChannels - [r, g, b] r|g|b: 0..255 + */ +export declare const transformXyzD50ToRgb: (xyz: TriColorChannels, skip?: boolean) => TriColorChannels; +/** + * transform xyz-d50 to lab + * @param xyz - [x, y, z] + * @param [skip] - skip validate + * @returns TriColorChannels - [l, a, b] + */ +export declare const transformXyzD50ToLab: (xyz: TriColorChannels, skip?: boolean) => TriColorChannels; +/** + * transform xyz-d50 to lch + * @param xyz - [x, y, z] + * @param [skip] - skip validate + * @returns TriColorChannels - [l, c, h] + */ +export declare const transformXyzD50ToLch: (xyz: TriColorChannels, skip?: boolean) => TriColorChannels; diff --git a/node_modules/@asamuzakjp/css-color/dist/esm/resolvers/color-mix.d.ts b/node_modules/@asamuzakjp/css-color/dist/esm/resolvers/color-mix.d.ts new file mode 100644 index 0000000..159ee05 --- /dev/null +++ b/node_modules/@asamuzakjp/css-color/dist/esm/resolvers/color-mix.d.ts @@ -0,0 +1,166 @@ +/** + * color-mix + */ +import { ChannelNoneFlags, ColorAndPct, ColorFormat, ColorResolverFn, ColorSpace, ColorSpaceParseResult, InterpolatedComponents, NormalizedPercentages, NumStrColorChannels, Options, SpecifiedColorChannels, TriColorChannels } from '../typedef'; +/** + * parse color space + * @param arg - color space argument string + * @returns object containing colorSpace and hueArc, or null if invalid + */ +export declare const parseColorSpace: (arg: string) => ColorSpaceParseResult | null; +/** + * parse color and percentage + * @param arg - color and percentage argument string + * @returns object containing color string and percentage string + */ +export declare const parseColorAndPct: (arg: string) => ColorAndPct; +/** + * resolve if nested function + * @param colorStr - color string + * @param opt - options + * @param resolver - resolver function + * @returns resolved color string or original string + */ +export declare const resolveIfNested: (colorStr: string, opt: Options, resolver: ColorResolverFn) => string; +/** + * normalize percentages + * @param pctA - percentage for color A + * @param pctB - percentage for color B + * @returns object containing normalized percentages and multiplier, or null if invalid + */ +export declare const normalizePercentages: (pctA: string, pctB: string) => NormalizedPercentages | null; +/** + * process color + * @param colorStr - color string + * @param opt - options + * @returns specified color string + */ +export declare const processColor: (colorStr: string, opt: Options) => string; +/** + * build specified color mix + * @param colorSpace - color space + * @param hueArc - hue interpolation method + * @param colorA - first color + * @param pctA - percentage for first color + * @param colorB - second color + * @param pctB - percentage for second color + * @param opt - options + * @returns specified value string for color-mix() + */ +export declare const buildSpecifiedColorMix: (colorSpace: string, hueArc: string, colorA: string, pctA: string, colorB: string, pctB: string, opt: Options) => string; +/** + * Perform alpha-weighted interpolation for color components. + * @param compA - color components for color A + * @param compB - color components for color B + * @param alphaA - alpha channel value for color A + * @param alphaB - alpha channel value for color B + * @param pA - normalized ratio for first color + * @param pB - normalized ratio for second color + * @returns object containing interpolated components and combined alpha + */ +export declare const interpolateComponents: (compA: TriColorChannels, compB: TriColorChannels, alphaA: number, alphaB: number, pA: number, pB: number) => InterpolatedComponents; +/** + * Format computed color into specified or computed channel array. + * @param colorSpace - target color space + * @param comps - 3-channel color components + * @param nones - boolean flags indicating if channels are 'none' + * @param alpha - calculated alpha channel value + * @param m - multiplier factor + * @param format - output format option + * @param rgbOverride - optional pre-calculated RGB channels + * @returns specified color channels array + */ +export declare const formatMixedColor: (colorSpace: ColorSpace, comps: TriColorChannels, nones: ChannelNoneFlags, alpha: number, m: number, format: ColorFormat, rgbOverride?: TriColorChannels) => SpecifiedColorChannels; +/** + * Fetch raw channels or fallback for currentcolor + * @param color - color input string + * @param convertFn - conversion function + * @param opt - conversion options + * @returns color channel values or null if invalid + */ +export declare const getRawChannels: (color: string | NumStrColorChannels, convertFn: (c: string, opt: any) => any, opt: any) => NumStrColorChannels | null; +/** + * Mix colors in srgb or srgb-linear space. + * @param colorSpace - color space name ('srgb' | 'srgb-linear') + * @param colorA - first color string + * @param colorB - second color string + * @param pA - ratio for first color + * @param pB - ratio for second color + * @param format - output format + * @param m - multiplier factor + * @returns mixed color channels or null + */ +export declare const mixSrgbSpace: (colorSpace: ColorSpace, colorA: string, colorB: string, pA: number, pB: number, format: ColorFormat, m: number) => SpecifiedColorChannels | null; +/** + * Mix colors in xyz, xyz-d50, or xyz-d65 space. + * @param colorSpace - color space name + * @param colorA - first color string + * @param colorB - second color string + * @param pA - ratio for first color + * @param pB - ratio for second color + * @param format - output format + * @param m - multiplier factor + * @returns mixed color channels or null + */ +export declare const mixXyzSpace: (colorSpace: string, colorA: string, colorB: string, pA: number, pB: number, format: string, m: number) => SpecifiedColorChannels | null; +/** + * Mix colors in hsl or hwb space. + * @param colorSpace - color space name ('hsl' | 'hwb') + * @param hueArc - hue interpolation method + * @param colorA - first color string + * @param colorB - second color string + * @param pA - ratio for first color + * @param pB - ratio for second color + * @param format - output format + * @param m - multiplier factor + * @returns mixed color channels or null + */ +export declare const mixHslHwbSpace: (colorSpace: string, hueArc: string, colorA: string, colorB: string, pA: number, pB: number, format: string, m: number) => SpecifiedColorChannels | null; +/** + * Mix colors in lch or oklch space. + * @param colorSpace - color space name ('lch' | 'oklch') + * @param hueArc - hue interpolation method + * @param colorA - first color string + * @param colorB - second color string + * @param pA - ratio for first color + * @param pB - ratio for second color + * @param format - output format + * @param m - multiplier factor + * @returns mixed color channels or null + */ +export declare const mixLchSpace: (colorSpace: string, hueArc: string, colorA: string, colorB: string, pA: number, pB: number, format: string, m: number) => SpecifiedColorChannels | null; +/** + * Mix colors in lab or oklab space. + * @param colorSpace - color space name ('lab' | 'oklab') + * @param colorA - first color string + * @param colorB - second color string + * @param pA - ratio for first color + * @param pB - ratio for second color + * @param format - output format + * @param m - multiplier factor + * @returns mixed color channels or null + */ +export declare const mixLabSpace: (colorSpace: string, colorA: string, colorB: string, pA: number, pB: number, format: string, m: number) => SpecifiedColorChannels | null; +/** + * compute mixed color + * @param colorSpace - color space + * @param hueArc - hue interpolation method + * @param colorA - first color + * @param colorB - second color + * @param pA - normalized ratio for first color + * @param pB - normalized ratio for second color + * @param m - multiplier + * @param format - output format + * @param nullable - is nullable + * @param cacheKey - cache key + * @returns computed color channels or null + */ +export declare const computeMixedColor: (colorSpace: string, hueArc: string, colorA: string, colorB: string, pA: number, pB: number, m: number, format: string, nullable: boolean, cacheKey: string) => SpecifiedColorChannels | null; +/** + * resolve color-mix() + * @param value - color-mix color value + * @param opt - options + * @param resolver - resolver function + * @returns resolved color - [cs, v1, v2, v3, alpha], '(empty)', null + */ +export declare const resolveColorMix: (value: string, opt?: Options, resolver?: ColorResolverFn) => SpecifiedColorChannels | string | null; diff --git a/node_modules/@asamuzakjp/css-color/dist/esm/resolvers/named-color.d.ts b/node_modules/@asamuzakjp/css-color/dist/esm/resolvers/named-color.d.ts new file mode 100644 index 0000000..5bda134 --- /dev/null +++ b/node_modules/@asamuzakjp/css-color/dist/esm/resolvers/named-color.d.ts @@ -0,0 +1,153 @@ +/** + * named colors + */ +export declare const NAMED_COLORS: { + readonly aliceblue: readonly [240, 248, 255]; + readonly antiquewhite: readonly [250, 235, 215]; + readonly aqua: readonly [0, 255, 255]; + readonly aquamarine: readonly [127, 255, 212]; + readonly azure: readonly [240, 255, 255]; + readonly beige: readonly [245, 245, 220]; + readonly bisque: readonly [255, 228, 196]; + readonly black: readonly [0, 0, 0]; + readonly blanchedalmond: readonly [255, 235, 205]; + readonly blue: readonly [0, 0, 255]; + readonly blueviolet: readonly [138, 43, 226]; + readonly brown: readonly [165, 42, 42]; + readonly burlywood: readonly [222, 184, 135]; + readonly cadetblue: readonly [95, 158, 160]; + readonly chartreuse: readonly [127, 255, 0]; + readonly chocolate: readonly [210, 105, 30]; + readonly coral: readonly [255, 127, 80]; + readonly cornflowerblue: readonly [100, 149, 237]; + readonly cornsilk: readonly [255, 248, 220]; + readonly crimson: readonly [220, 20, 60]; + readonly cyan: readonly [0, 255, 255]; + readonly darkblue: readonly [0, 0, 139]; + readonly darkcyan: readonly [0, 139, 139]; + readonly darkgoldenrod: readonly [184, 134, 11]; + readonly darkgray: readonly [169, 169, 169]; + readonly darkgreen: readonly [0, 100, 0]; + readonly darkgrey: readonly [169, 169, 169]; + readonly darkkhaki: readonly [189, 183, 107]; + readonly darkmagenta: readonly [139, 0, 139]; + readonly darkolivegreen: readonly [85, 107, 47]; + readonly darkorange: readonly [255, 140, 0]; + readonly darkorchid: readonly [153, 50, 204]; + readonly darkred: readonly [139, 0, 0]; + readonly darksalmon: readonly [233, 150, 122]; + readonly darkseagreen: readonly [143, 188, 143]; + readonly darkslateblue: readonly [72, 61, 139]; + readonly darkslategray: readonly [47, 79, 79]; + readonly darkslategrey: readonly [47, 79, 79]; + readonly darkturquoise: readonly [0, 206, 209]; + readonly darkviolet: readonly [148, 0, 211]; + readonly deeppink: readonly [255, 20, 147]; + readonly deepskyblue: readonly [0, 191, 255]; + readonly dimgray: readonly [105, 105, 105]; + readonly dimgrey: readonly [105, 105, 105]; + readonly dodgerblue: readonly [30, 144, 255]; + readonly firebrick: readonly [178, 34, 34]; + readonly floralwhite: readonly [255, 250, 240]; + readonly forestgreen: readonly [34, 139, 34]; + readonly fuchsia: readonly [255, 0, 255]; + readonly gainsboro: readonly [220, 220, 220]; + readonly ghostwhite: readonly [248, 248, 255]; + readonly gold: readonly [255, 215, 0]; + readonly goldenrod: readonly [218, 165, 32]; + readonly gray: readonly [128, 128, 128]; + readonly green: readonly [0, 128, 0]; + readonly greenyellow: readonly [173, 255, 47]; + readonly grey: readonly [128, 128, 128]; + readonly honeydew: readonly [240, 255, 240]; + readonly hotpink: readonly [255, 105, 180]; + readonly indianred: readonly [205, 92, 92]; + readonly indigo: readonly [75, 0, 130]; + readonly ivory: readonly [255, 255, 240]; + readonly khaki: readonly [240, 230, 140]; + readonly lavender: readonly [230, 230, 250]; + readonly lavenderblush: readonly [255, 240, 245]; + readonly lawngreen: readonly [124, 252, 0]; + readonly lemonchiffon: readonly [255, 250, 205]; + readonly lightblue: readonly [173, 216, 230]; + readonly lightcoral: readonly [240, 128, 128]; + readonly lightcyan: readonly [224, 255, 255]; + readonly lightgoldenrodyellow: readonly [250, 250, 210]; + readonly lightgray: readonly [211, 211, 211]; + readonly lightgreen: readonly [144, 238, 144]; + readonly lightgrey: readonly [211, 211, 211]; + readonly lightpink: readonly [255, 182, 193]; + readonly lightsalmon: readonly [255, 160, 122]; + readonly lightseagreen: readonly [32, 178, 170]; + readonly lightskyblue: readonly [135, 206, 250]; + readonly lightslategray: readonly [119, 136, 153]; + readonly lightslategrey: readonly [119, 136, 153]; + readonly lightsteelblue: readonly [176, 196, 222]; + readonly lightyellow: readonly [255, 255, 224]; + readonly lime: readonly [0, 255, 0]; + readonly limegreen: readonly [50, 205, 50]; + readonly linen: readonly [250, 240, 230]; + readonly magenta: readonly [255, 0, 255]; + readonly maroon: readonly [128, 0, 0]; + readonly mediumaquamarine: readonly [102, 205, 170]; + readonly mediumblue: readonly [0, 0, 205]; + readonly mediumorchid: readonly [186, 85, 211]; + readonly mediumpurple: readonly [147, 112, 219]; + readonly mediumseagreen: readonly [60, 179, 113]; + readonly mediumslateblue: readonly [123, 104, 238]; + readonly mediumspringgreen: readonly [0, 250, 154]; + readonly mediumturquoise: readonly [72, 209, 204]; + readonly mediumvioletred: readonly [199, 21, 133]; + readonly midnightblue: readonly [25, 25, 112]; + readonly mintcream: readonly [245, 255, 250]; + readonly mistyrose: readonly [255, 228, 225]; + readonly moccasin: readonly [255, 228, 181]; + readonly navajowhite: readonly [255, 222, 173]; + readonly navy: readonly [0, 0, 128]; + readonly oldlace: readonly [253, 245, 230]; + readonly olive: readonly [128, 128, 0]; + readonly olivedrab: readonly [107, 142, 35]; + readonly orange: readonly [255, 165, 0]; + readonly orangered: readonly [255, 69, 0]; + readonly orchid: readonly [218, 112, 214]; + readonly palegoldenrod: readonly [238, 232, 170]; + readonly palegreen: readonly [152, 251, 152]; + readonly paleturquoise: readonly [175, 238, 238]; + readonly palevioletred: readonly [219, 112, 147]; + readonly papayawhip: readonly [255, 239, 213]; + readonly peachpuff: readonly [255, 218, 185]; + readonly peru: readonly [205, 133, 63]; + readonly pink: readonly [255, 192, 203]; + readonly plum: readonly [221, 160, 221]; + readonly powderblue: readonly [176, 224, 230]; + readonly purple: readonly [128, 0, 128]; + readonly rebeccapurple: readonly [102, 51, 153]; + readonly red: readonly [255, 0, 0]; + readonly rosybrown: readonly [188, 143, 143]; + readonly royalblue: readonly [65, 105, 225]; + readonly saddlebrown: readonly [139, 69, 19]; + readonly salmon: readonly [250, 128, 114]; + readonly sandybrown: readonly [244, 164, 96]; + readonly seagreen: readonly [46, 139, 87]; + readonly seashell: readonly [255, 245, 238]; + readonly sienna: readonly [160, 82, 45]; + readonly silver: readonly [192, 192, 192]; + readonly skyblue: readonly [135, 206, 235]; + readonly slateblue: readonly [106, 90, 205]; + readonly slategray: readonly [112, 128, 144]; + readonly slategrey: readonly [112, 128, 144]; + readonly snow: readonly [255, 250, 250]; + readonly springgreen: readonly [0, 255, 127]; + readonly steelblue: readonly [70, 130, 180]; + readonly tan: readonly [210, 180, 140]; + readonly teal: readonly [0, 128, 128]; + readonly thistle: readonly [216, 191, 216]; + readonly tomato: readonly [255, 99, 71]; + readonly turquoise: readonly [64, 224, 208]; + readonly violet: readonly [238, 130, 238]; + readonly wheat: readonly [245, 222, 179]; + readonly white: readonly [255, 255, 255]; + readonly whitesmoke: readonly [245, 245, 245]; + readonly yellow: readonly [255, 255, 0]; + readonly yellowgreen: readonly [154, 205, 50]; +}; diff --git a/node_modules/@asamuzakjp/css-color/dist/esm/resolvers/parse-color.d.ts b/node_modules/@asamuzakjp/css-color/dist/esm/resolvers/parse-color.d.ts new file mode 100644 index 0000000..805cac4 --- /dev/null +++ b/node_modules/@asamuzakjp/css-color/dist/esm/resolvers/parse-color.d.ts @@ -0,0 +1,74 @@ +/** + * parse + */ +import { Options, SpecifiedColorChannels } from '../typedef'; +/** + * parse rgb() + * @param value - rgb color value + * @param opt - options + * @returns parsed color - ['rgb', r, g, b, alpha], '(empty)', null + */ +export declare const parseRgb: (value: string, opt?: Options) => SpecifiedColorChannels | string | null; +/** + * parse hsl() + * @param value - hsl color value + * @param opt - options + * @returns parsed color - ['rgb', r, g, b, alpha], '(empty)', null + */ +export declare const parseHsl: (value: string, opt?: Options) => SpecifiedColorChannels | string | null; +/** + * parse hwb() + * @param value - hwb color value + * @param opt - options + * @returns parsed color - ['rgb', r, g, b, alpha], '(empty)', null + */ +export declare const parseHwb: (value: string, opt?: Options) => SpecifiedColorChannels | string | null; +/** + * parse lab() + * @param value - lab color value + * @param opt - options + * @returns parsed color + * - [xyz-d50, x, y, z, alpha], ['lab', l, a, b, alpha], '(empty)', null + */ +export declare const parseLab: (value: string, opt?: Options) => SpecifiedColorChannels | string | null; +/** + * parse lch() + * @param value - lch color value + * @param opt - options + * @returns parsed color + * - ['xyz-d50', x, y, z, alpha], ['lch', l, c, h, alpha], '(empty)', null + */ +export declare const parseLch: (value: string, opt?: Options) => SpecifiedColorChannels | string | null; +/** + * parse oklab() + * @param value - oklab color value + * @param opt - options + * @returns parsed color + * - ['xyz-d65', x, y, z, alpha], ['oklab', l, a, b, alpha], '(empty)', null + */ +export declare const parseOklab: (value: string, opt?: Options) => SpecifiedColorChannels | string | null; +/** + * parse oklch() + * @param value - oklch color value + * @param opt - options + * @returns parsed color + * - ['xyz-d65', x, y, z, alpha], ['oklch', l, c, h, alpha], '(empty)', null + */ +export declare const parseOklch: (value: string, opt?: Options) => SpecifiedColorChannels | string | null; +/** + * parse color() + * @param value - color function value + * @param opt - options + * @returns parsed color + * - ['xyz-(d50|d65)', x, y, z, alpha], [cs, r, g, b, alpha], '(empty)', null + */ +export declare const parseColorFunc: (value: string, opt?: Options) => SpecifiedColorChannels | string | null; +/** + * parse color value + * @param value - CSS color value + * @param opt - options + * @returns parsed color + * - ['xyz-(d50|d65)', x, y, z, alpha], ['rgb', r, g, b, alpha] + * - value, '(empty)', null + */ +export declare const parseColorValue: (value: string, opt?: Options) => SpecifiedColorChannels | string | null; diff --git a/node_modules/@asamuzakjp/css-color/dist/esm/resolvers/relative-color.d.ts b/node_modules/@asamuzakjp/css-color/dist/esm/resolvers/relative-color.d.ts new file mode 100644 index 0000000..f7cdb7e --- /dev/null +++ b/node_modules/@asamuzakjp/css-color/dist/esm/resolvers/relative-color.d.ts @@ -0,0 +1,67 @@ +/** + * relative-color + */ +import { CSSToken } from '@csstools/css-tokenizer'; +import { ColorChannels, Options, StringColorChannels } from '../typedef'; +/** + * NumberOrStringColorChannels - color channel + */ +type NumberOrStringColorChannels = ColorChannels & StringColorChannels; +/** + * resolve relative color channels + * @param tokens - tokens + * @param [opt] - options + * @param [opt.currentColor] + * - color to use for `currentcolor` keyword + * - if omitted, it will be treated as a missing color + * i.e. `rgb(none none none / none)` + * @param [opt.customProperty] + * - custom properties + * - pair of `--` prefixed property name and value, + * e.g. `customProperty: { '--some-color': '#0000ff' }` + * - and/or `callback` function to get the value of the custom property, + * e.g. `customProperty: { callback: someDeclaration.getPropertyValue }` + * @param [opt.dimension] + * - dimension, convert relative length to pixels + * - pair of unit and it's value as a number in pixels, + * e.g. `dimension: { em: 12, rem: 16, vw: 10.26 }` + * - and/or `callback` function to get the value as a number in pixels, + * e.g. `dimension: { callback: convertUnitToPixel }` + * @param [opt.format] + * - output format, one of below + * - `computedValue` (default), [computed value][139] of the color + * - `specifiedValue`, [specified value][140] of the color + * - `hex`, hex color notation, i.e. `rrggbb` + * - `hexAlpha`, hex color notation with alpha channel, i.e. `#rrggbbaa` + * @returns + * - one of rgba?(), #rrggbb(aa)?, color-name, '(empty-string)', + * color(color-space r g b / alpha), color(color-space x y z / alpha), + * lab(l a b / alpha), lch(l c h / alpha), oklab(l a b / alpha), + * oklch(l c h / alpha), null + * - in `computedValue`, values are numbers, however `rgb()` values are + * integers + * - in `specifiedValue`, returns `empty string` for unknown and/or invalid + * color + * - in `hex`, returns `null` for `transparent`, and also returns `null` if + * any of `r`, `g`, `b`, `alpha` is not a number + * - in `hexAlpha`, returns `#00000000` for `transparent`, + * however returns `null` if any of `r`, `g`, `b`, `alpha` is not a number + */ +export declare function resolveColorChannels(tokens: CSSToken[], opt?: Options): NumberOrStringColorChannels | null; +/** + * extract origin color + * @param value - CSS color value + * @param opt - options + * @param resolver - resolver function + * @returns origin color value + */ +export declare function extractOriginColor(value: string, opt?: Options, resolver?: (v: string, o?: Options) => string | null): string | null; +/** + * resolve relative color + * @param value - CSS relative color value + * @param opt - options + * @param resolver - resolver function + * @returns resolved value + */ +export declare function resolveRelativeColor(value: string, opt?: Options, resolver?: (v: string, o?: Options) => string | null): string | null; +export {}; diff --git a/node_modules/@asamuzakjp/css-color/dist/esm/resolvers/resolve-color.d.ts b/node_modules/@asamuzakjp/css-color/dist/esm/resolvers/resolve-color.d.ts new file mode 100644 index 0000000..51d8553 --- /dev/null +++ b/node_modules/@asamuzakjp/css-color/dist/esm/resolvers/resolve-color.d.ts @@ -0,0 +1,33 @@ +/** + * resolve-color + */ +import { Options, SpecifiedColorChannels } from '../typedef'; +/** + * resolve color value + * @param value - CSS color value + * @param opt - options + * @returns resolved color + * - [cs, v1, v2, v3, alpha], value, '(empty)', null + */ +export declare const resolveColorValue: (value: string, opt?: Options) => SpecifiedColorChannels | string | null; +/** + * resolve color() + * @param value - color function value + * @param opt - options + * @returns resolved color - [cs, v1, v2, v3, alpha], '(empty)', null + */ +export declare const resolveColorFunc: (value: string, opt?: Options) => SpecifiedColorChannels | string | null; +/** + * resolve color + * @param value - CSS color value + * @param opt - options + * @returns resolved color + */ +export declare const resolveColor: (value: string, opt?: Options) => string | null; +/** + * is valid color + * @param value - CSS value + * @param opt - options + * @returns result + */ +export declare const isValidColor: (value: unknown, opt?: Options) => boolean; diff --git a/node_modules/@asamuzakjp/css-color/dist/esm/resolvers/resolve.d.ts b/node_modules/@asamuzakjp/css-color/dist/esm/resolvers/resolve.d.ts new file mode 100644 index 0000000..c417ad7 --- /dev/null +++ b/node_modules/@asamuzakjp/css-color/dist/esm/resolvers/resolve.d.ts @@ -0,0 +1,18 @@ +/** + * resolve + */ +import { Options } from '../typedef'; +/** + * resolve CSS color + * @param value - CSS color value. system colors are not supported + * @param opt - options + * @returns resolved value + */ +export declare const resolve: (value: string, opt?: Options) => string | null; +/** + * is color + * @param value - CSS value + * @param opt - options + * @returns result + */ +export declare const isColor: (value: unknown, opt?: Options) => boolean; diff --git a/node_modules/@asamuzakjp/css-color/dist/esm/typedef.d.ts b/node_modules/@asamuzakjp/css-color/dist/esm/typedef.d.ts new file mode 100644 index 0000000..322ed43 --- /dev/null +++ b/node_modules/@asamuzakjp/css-color/dist/esm/typedef.d.ts @@ -0,0 +1,321 @@ +/** + * typedef + */ +import { CSSToken } from '@csstools/css-tokenizer'; +/** + * Supported CSS gradient function types. + */ +export type GradientType = 'linear-gradient' | 'repeating-linear-gradient' | 'radial-gradient' | 'repeating-radial-gradient' | 'conic-gradient' | 'repeating-conic-gradient'; +/** + * Known CSS color spaces. + */ +type KnownColorSpace = 'srgb' | 'srgb-linear' | 'display-p3' | 'a98-rgb' | 'prophoto-rgb' | 'rec2020' | 'xyz' | 'xyz-d50' | 'xyz-d65'; +/** + * Supported CSS color space string or custom space. + */ +export type ColorSpace = KnownColorSpace | (string & {}); +/** + * Known CSS color output and input formats. + */ +type KnownColorFormat = 'hex' | 'hexAlpha' | 'rgb' | 'hsl' | 'hwb' | 'lab' | 'lch' | 'oklab' | 'oklch' | 'computed' | 'specified' | 'mix'; +/** + * Color format option or custom string. + */ +export type ColorFormat = KnownColorFormat | (string & {}); +/** + * Hue interpolation methods for color spaces with hue. + */ +export type HueArc = 'shorter' | 'longer' | 'increasing' | 'decreasing'; +/** + * Flags indicating missing or powerless channels [c1, c2, c3, alpha]. + */ +export type ChannelNoneFlags = [ + c1: boolean, + c2: boolean, + c3: boolean, + alpha: boolean +]; +/** + * AST node representation for the calc() parser. + */ +export type CalcASTNode = string | CalcASTNode[]; +/** + * Calculation token stream, including its terminal EOF token, and cursor. + */ +export interface CalculationState { + tokens: CSSToken[]; + index: number; +} +/** + * Custom property resolver value or callback function. + */ +type CustomPropertyResolver = string | ((key: string) => string | undefined); +/** + * Dimension resolver value or callback function. + */ +type DimensionResolver = number | ((key: string) => number | undefined); +/** + * CSS dimension unit resolution map. + */ +interface DimensionMap { + [key: string]: DimensionResolver | undefined; + /** Custom dimension unit resolver callback. */ + callback?: (key: string) => number | undefined; + /** Font size of the element in pixels. */ + em?: number; + /** Root element font size in pixels. */ + rem?: number; + /** Viewport height in pixels. */ + vh?: number; + /** Viewport width in pixels. */ + vw?: number; +} +/** + * Custom property lookup map or callback handler. + */ +interface CustomPropertyMap { + [key: string]: CustomPropertyResolver | undefined; + /** Custom property resolver callback function. */ + callback?: (key: string) => string | undefined; +} +/** + * Parsing and resolution options. + */ +export interface Options { + /** Force alpha channel output. */ + alpha?: boolean; + /** Preferred color scheme context. */ + colorScheme?: string; + /** Target color space for output. */ + colorSpace?: ColorSpace; + /** Value used for `currentColor` keyword. */ + currentColor?: string; + /** Custom property resolvers. */ + customProperty?: CustomPropertyMap; + /** Adapt XYZ coordinates to D50 illuminant. */ + d50?: boolean; + /** Channel values delimiter string or list. */ + delimiter?: string | readonly string[]; + /** Dimension resolution settings. */ + dimension?: DimensionMap; + /** Output color format. */ + format?: ColorFormat; + /** Maximum length limit for parsed string. */ + maxLength?: number; + /** Return null instead of throwing on invalid input. */ + nullable?: boolean; + /** Retain comments during parsing. */ + preserveComment?: boolean; +} +/** + * Three-element color channel tuple [x, y, z]. + */ +export type TriColorChannels = [x: number, y: number, z: number]; +/** + * Readonly three-element color channel tuple [x, y, z]. + */ +export type ReadonlyTriColorChannels = readonly [ + x: number, + y: number, + z: number +]; +/** + * 3x3 color conversion matrix tuple. + */ +export type ReadonlyColorMatrix = readonly [ + r1: ReadonlyTriColorChannels, + r2: ReadonlyTriColorChannels, + r3: ReadonlyTriColorChannels +]; +/** + * Four-element color channel numeric tuple [x, y, z, alpha]. + */ +export type ColorChannels = [x: number, y: number, z: number, alpha: number]; +/** + * Four-element color channel string tuple [x, y, z, alpha]. + */ +export type StringColorChannels = [ + x: string, + y: string, + z: string, + alpha: string | undefined +]; +/** + * Four-element color channel numeric/string tuple [x, y, z, alpha]. + */ +export type NumStrColorChannels = [ + x: number | string, + y: number | string, + z: number | string, + alpha: number | string +]; +/** + * Color channel tuple with missing/powerless string tags. + */ +export type ColorChannelsWithPowerless = [ + x: number | string, + y: number | string, + z: number | string, + alpha: number +]; +/** + * Color space name and three channel strings with alpha. + */ +export type StringColorSpacedChannels = [ + cs: string, + x: string, + y: string, + z: string, + alpha: string | undefined +]; +/** + * Resolved computed color channel representation. + */ +export type ComputedColorChannels = [ + cs: string, + x: number, + y: number, + z: number, + alpha: number +]; +/** + * Resolved specified color channel representation. + */ +export type SpecifiedColorChannels = [ + cs: string, + x: number | string, + y: number | string, + z: number | string, + alpha: number | string +]; +/** + * RegExp match result tuple with 3 capture groups. + */ +export type MatchedRegExp3 = [ + match: string, + gr1: string, + gr2: string, + gr3: string +]; +/** + * RegExp match result tuple with 4 capture groups. + */ +export type MatchedRegExp4 = [ + match: string, + gr1: string, + gr2: string, + gr3: string, + gr4: string +]; +/** + * Standard matched RegExp tuple alias. + */ +export type MatchedRegExp = MatchedRegExp4; +/** + * Component validation configuration. + */ +export interface ValidateColorComponentsOptions { + /** Validate alpha channel presence. */ + alpha?: boolean; + /** Minimum number of components. */ + minLength?: number; + /** Maximum number of components. */ + maxLength?: number; + /** Minimum allowed component value. */ + minRange?: number; + /** Maximum allowed component value. */ + maxRange?: number; + /** Whether to enforce component value range check. */ + validateRange?: boolean; +} +/** + * Options for linear RGB conversion. + */ +export interface LinearRgbOptions { + /** Target color space for conversion. */ + colorSpace?: ColorSpace; + /** Output color format. */ + format?: ColorFormat; +} +/** + * Function type for converting color string to channel values. + */ +export type ColorConvertFn = (value: string, opt?: Options) => ColorChannels | ColorChannelsWithPowerless | null; +/** + * Function type for resolving CSS color expressions. + */ +export type ColorResolverFn = (value: string, opt?: Options) => SpecifiedColorChannels | string | null; +/** + * Parsed CSS gradient object structure. + */ +export interface Gradient { + /** Raw gradient CSS string value. */ + value: string; + /** Type of gradient expression. */ + type: GradientType; + /** Parsed gradient line parameter. */ + gradientLine?: string; + /** List of color stops. */ + colorStopList: ColorStopList; +} +/** + * Color stops validation result. + */ +export interface ValidateColorStops { + /** Extracted color stop strings. */ + colorStops: string[]; + /** Flag indicating stop list validity. */ + valid: boolean; +} +/** + * Gradient line validation result. + */ +export interface ValidateGradientLine { + /** Extracted gradient line string. */ + line: string; + /** Flag indicating line syntax validity. */ + valid: boolean; +} +/** + * Tuple representing a minimum of two color stops. + */ +export type ColorStopList = [string, string, ...string[]]; +/** + * Parsed color space parameter for color-mix(). + */ +export interface ColorSpaceParseResult { + /** Color space name. */ + colorSpace: ColorSpace; + /** Interpolation hue method. */ + hueArc: HueArc | string; +} +/** + * Color and percentage pair for color-mix(). + */ +export interface ColorAndPct { + /** Raw color string. */ + color: string; + /** Raw percentage string. */ + pct: string; +} +/** + * Normalized percentage values for color mixing. + */ +export interface NormalizedPercentages { + /** First color percentage weight (0 to 1). */ + pA: number; + /** Second color percentage weight (0 to 1). */ + pB: number; + /** Multiplier factor for un-normalized sums. */ + m: number; +} +/** + * Interpolated channels and alpha output. + */ +export interface InterpolatedComponents { + /** Three-element color component values. */ + comps: TriColorChannels; + /** Resulting alpha transparency. */ + alpha: number; +} +export {}; diff --git a/node_modules/@asamuzakjp/css-color/dist/esm/utils/cache.d.ts b/node_modules/@asamuzakjp/css-color/dist/esm/utils/cache.d.ts new file mode 100644 index 0000000..8165536 --- /dev/null +++ b/node_modules/@asamuzakjp/css-color/dist/esm/utils/cache.d.ts @@ -0,0 +1,33 @@ +/** + * cache + */ +import { LRUCache } from 'lru-cache'; +import { Options } from '../typedef'; +/** + * CacheItem + */ +export declare class CacheItem { + #private; + constructor(item: T); + get item(): T; +} +export declare const lruCache: LRUCache, unknown>; +/** + * set cache + * @param key - cache key + * @param value - value to cache + */ +export declare const setCache: (key: string, value: T | CacheItem) => void; +/** + * get cache + * @param key - cache key + * @returns cached item or false otherwise + */ +export declare const getCache: (key: string) => CacheItem | false; +/** + * create cache key + * @param keyData - key data + * @param [opt] - options + * @returns cache key + */ +export declare const createCacheKey: (keyData: Record, opt?: Options) => string; diff --git a/node_modules/@asamuzakjp/css-color/dist/esm/utils/common.d.ts b/node_modules/@asamuzakjp/css-color/dist/esm/utils/common.d.ts new file mode 100644 index 0000000..7b7d5d9 --- /dev/null +++ b/node_modules/@asamuzakjp/css-color/dist/esm/utils/common.d.ts @@ -0,0 +1,21 @@ +/** + * common + */ +/** + * get type + * @param o - object to check + * @returns type of object + */ +export declare const getType: (o: unknown) => string; +/** + * is string + * @param o - object to check + * @returns result + */ +export declare const isString: (o: unknown) => o is string; +/** + * is string or number + * @param o - object to check + * @returns result + */ +export declare const isStringOrNumber: (o: unknown) => o is string | number; diff --git a/node_modules/@asamuzakjp/css-color/dist/esm/utils/constant.d.ts b/node_modules/@asamuzakjp/css-color/dist/esm/utils/constant.d.ts new file mode 100644 index 0000000..3531640 --- /dev/null +++ b/node_modules/@asamuzakjp/css-color/dist/esm/utils/constant.d.ts @@ -0,0 +1,69 @@ +/** + * constant + */ +export declare const ANGLE = "deg|g?rad|turn"; +export declare const LENGTH = "[cm]m|[dls]?v(?:[bhiw]|max|min)|in|p[ctx]|q|r?(?:[cl]h|cap|e[mx]|ic)"; +export declare const NUM = "[+-]?(?:(?:0|[1-9]\\d*)(?:\\.\\d*)?|\\.\\d+)(?:e-?(?:0|[1-9]\\d*))?"; +export declare const NUM_POSITIVE = "\\+?(?:(?:0|[1-9]\\d*)(?:\\.\\d*)?|\\.\\d+)(?:e-?(?:0|[1-9]\\d*))?"; +export declare const NONE = "none"; +export declare const PCT = "[+-]?(?:(?:0|[1-9]\\d*)(?:\\.\\d*)?|\\.\\d+)(?:e-?(?:0|[1-9]\\d*))?%"; +export declare const SYN_FN_CALC = "^(?:calc|clamp|max|min|exp|hypot|log|pow|sqrt|abs|sign|mod|rem|round|a?(?:cos|sin|tan)|atan2)\\(|(?<=[*\\/\\s\\(])(?:calc|clamp|max|min|exp|hypot|log|pow|sqrt|abs|sign|mod|rem|round|a?(?:cos|sin|tan)|atan2)\\("; +export declare const SYN_FN_MATH_START = "^(?:clamp|max|min|exp|hypot|log|pow|sqrt|abs|sign|mod|rem|round|a?(?:cos|sin|tan)|atan2)\\($"; +export declare const SYN_FN_VAR = "^var\\(|(?<=[*\\/\\s\\(])var\\("; +export declare const SYN_FN_VAR_START = "^(?:var|calc|clamp|max|min|exp|hypot|log|pow|sqrt|abs|sign|mod|rem|round|a?(?:cos|sin|tan)|atan2)\\("; +export declare const CS_HUE = "(?:(?:ok)?lch|hsl|hwb)(?:\\s(?:(?:de|in)creasing|longer|shorter)\\shue)?"; +export declare const CS_HUE_CAPT = "((?:ok)?lch|hsl|hwb)(?:\\s((?:de|in)creasing|longer|shorter)\\shue)?"; +export declare const CS_LAB = "(?:ok)?lab"; +export declare const CS_LCH = "(?:ok)?lch"; +export declare const CS_SRGB = "srgb(?:-linear)?"; +export declare const CS_RGB = "(?:a98|prophoto)-rgb|display-p3|rec2020|srgb(?:-linear)?"; +export declare const CS_XYZ = "xyz(?:-d(?:50|65))?"; +export declare const CS_RECT = "(?:ok)?lab|(?:a98|prophoto)-rgb|display-p3|rec2020|srgb(?:-linear)?|xyz(?:-d(?:50|65))?"; +export declare const CS_MIX = "(?:(?:ok)?lch|hsl|hwb)(?:\\s(?:(?:de|in)creasing|longer|shorter)\\shue)?|(?:ok)?lab|(?:a98|prophoto)-rgb|display-p3|rec2020|srgb(?:-linear)?|xyz(?:-d(?:50|65))?"; +export declare const FN_COLOR = "color("; +export declare const FN_LIGHT_DARK = "light-dark("; +export declare const FN_MIX = "color-mix("; +export declare const FN_REL = "(?:(?:ok)?l(?:ab|ch)|color|hsla?|hwb|rgba?)\\(\\s*from\\s+"; +export declare const FN_REL_CAPT = "((?:ok)?l(?:ab|ch)|color|hsla?|hwb|rgba?)\\(\\s*from\\s+"; +export declare const FN_VAR = "var("; +export declare const SYN_FN_COLOR = "(?:(?:a98|prophoto)-rgb|display-p3|rec2020|srgb(?:-linear)?|xyz(?:-d(?:50|65))?)(?:\\s+(?:[+-]?(?:(?:0|[1-9]\\d*)(?:\\.\\d*)?|\\.\\d+)(?:e-?(?:0|[1-9]\\d*))?|[+-]?(?:(?:0|[1-9]\\d*)(?:\\.\\d*)?|\\.\\d+)(?:e-?(?:0|[1-9]\\d*))?%|none)){3}(?:\\s*\\/\\s*(?:[+-]?(?:(?:0|[1-9]\\d*)(?:\\.\\d*)?|\\.\\d+)(?:e-?(?:0|[1-9]\\d*))?|[+-]?(?:(?:0|[1-9]\\d*)(?:\\.\\d*)?|\\.\\d+)(?:e-?(?:0|[1-9]\\d*))?%|none))?"; +export declare const SYN_FN_LIGHT_DARK = "^light-dark\\("; +export declare const SYN_FN_REL = "^(?:(?:ok)?l(?:ab|ch)|color|hsla?|hwb|rgba?)\\(\\s*from\\s+|(?<=[\\s])(?:(?:ok)?l(?:ab|ch)|color|hsla?|hwb|rgba?)\\(\\s*from\\s+"; +export declare const SYN_HSL = "(?:[+-]?(?:(?:0|[1-9]\\d*)(?:\\.\\d*)?|\\.\\d+)(?:e-?(?:0|[1-9]\\d*))?(?:deg|g?rad|turn)?|none)(?:\\s+(?:[+-]?(?:(?:0|[1-9]\\d*)(?:\\.\\d*)?|\\.\\d+)(?:e-?(?:0|[1-9]\\d*))?|[+-]?(?:(?:0|[1-9]\\d*)(?:\\.\\d*)?|\\.\\d+)(?:e-?(?:0|[1-9]\\d*))?%|none)){2}(?:\\s*\\/\\s*(?:[+-]?(?:(?:0|[1-9]\\d*)(?:\\.\\d*)?|\\.\\d+)(?:e-?(?:0|[1-9]\\d*))?|[+-]?(?:(?:0|[1-9]\\d*)(?:\\.\\d*)?|\\.\\d+)(?:e-?(?:0|[1-9]\\d*))?%|none))?"; +export declare const SYN_HSL_LV3 = "[+-]?(?:(?:0|[1-9]\\d*)(?:\\.\\d*)?|\\.\\d+)(?:e-?(?:0|[1-9]\\d*))?(?:deg|g?rad|turn)?(?:\\s*,\\s*[+-]?(?:(?:0|[1-9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none)(?:\\s*\\/\\s*(?:[+-]?(?:(?:0|[1-9]\\d*)(?:\\.\\d*)?|\\.\\d+)(?:e-?(?:0|[1-9]\\d*))?|[+-]?(?:(?:0|[1-9]\\d*)(?:\\.\\d*)?|\\.\\d+)(?:e-?(?:0|[1-9]\\d*))?%|none))?\\s*\\)|color\\(\\s*(?:(?:a98|prophoto)-rgb|display-p3|rec2020|srgb(?:-linear)?|xyz(?:-d(?:50|65))?)(?:\\s+(?:[+-]?(?:(?:0|[1-9]\\d*)(?:\\.\\d*)?|\\.\\d+)(?:e-?(?:0|[1-9]\\d*))?|[+-]?(?:(?:0|[1-9]\\d*)(?:\\.\\d*)?|\\.\\d+)(?:e-?(?:0|[1-9]\\d*))?%|none)){3}(?:\\s*\\/\\s*(?:[+-]?(?:(?:0|[1-9]\\d*)(?:\\.\\d*)?|\\.\\d+)(?:e-?(?:0|[1-9]\\d*))?|[+-]?(?:(?:0|[1-9]\\d*)(?:\\.\\d*)?|\\.\\d+)(?:e-?(?:0|[1-9]\\d*))?%|none))?\\s*\\))(?:\\s+[+-]?(?:(?:0|[1-9]\\d*)(?:\\.\\d*)?|\\.\\d+)(?:e-?(?:0|[1-9]\\d*))?%)?"; +export declare const SYN_MIX = "color-mix\\(\\s*in\\s+(?:(?:(?:ok)?lch|hsl|hwb)(?:\\s(?:(?:de|in)creasing|longer|shorter)\\shue)?|(?:ok)?lab|(?:a98|prophoto)-rgb|display-p3|rec2020|srgb(?:-linear)?|xyz(?:-d(?:50|65))?)\\s*,\\s*(?:[a-z]+|#[\\da-f]{3}|#[\\da-f]{4}|#[\\da-f]{6}|#[\\da-f]{8}|hsla?\\(\\s*[+-]?(?:(?:0|[1-9]\\d*)(?:\\.\\d*)?|\\.\\d+)(?:e-?(?:0|[1-9]\\d*))?(?:deg|g?rad|turn)?(?:\\s*,\\s*[+-]?(?:(?:0|[1-9]\\d*)(?:\\.\\d*)?|\\.\\d+)(?:e-?(?:0|[1-9]\\d*))?%){2}(?:\\s*,\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*)(?:\\.\\d*)?|\\.\\d+)(?:e-?(?:0|[1-9]\\d*))?%|none))?\\s*\\)|(?:ok)?lch\\(\\s*(?:(?:[+-]?(?:(?:0|[1-9]\\d*)(?:\\.\\d*)?|\\.\\d+)(?:e-?(?:0|[1-9]\\d*))?|[+-]?(?:(?:0|[1-9]\\d*)(?:\\.\\d*)?|\\.\\d+)(?:e-?(?:0|[1-9]\\d*))?%|none)\\s+){2}(?:[+-]?(?:(?:0|[1-9]\\d*)(?:\\.\\d*)?|\\.\\d+)(?:e-?(?:0|[1-9]\\d*))?(?:deg|g?rad|turn)?|none)(?:\\s*\\/\\s*(?:[+-]?(?:(?:0|[1-9]\\d*)(?:\\.\\d*)?|\\.\\d+)(?:e-?(?:0|[1-9]\\d*))?|[+-]?(?:(?:0|[1-9]\\d*)(?:\\.\\d*)?|\\.\\d+)(?:e-?(?:0|[1-9]\\d*))?%|none))?\\s*\\)|color\\(\\s*(?:(?:a98|prophoto)-rgb|display-p3|rec2020|srgb(?:-linear)?|xyz(?:-d(?:50|65))?)(?:\\s+(?:[+-]?(?:(?:0|[1-9]\\d*)(?:\\.\\d*)?|\\.\\d+)(?:e-?(?:0|[1-9]\\d*))?|[+-]?(?:(?:0|[1-9]\\d*)(?:\\.\\d*)?|\\.\\d+)(?:e-?(?:0|[1-9]\\d*))?%|none)){3}(?:\\s*\\/\\s*(?:[+-]?(?:(?:0|[1-9]\\d*)(?:\\.\\d*)?|\\.\\d+)(?:e-?(?:0|[1-9]\\d*))?|[+-]?(?:(?:0|[1-9]\\d*)(?:\\.\\d*)?|\\.\\d+)(?:e-?(?:0|[1-9]\\d*))?%|none))?\\s*\\))(?:\\s+[+-]?(?:(?:0|[1-9]\\d*)(?:\\.\\d*)?|\\.\\d+)(?:e-?(?:0|[1-9]\\d*))?%)?\\s*\\)"; +export declare const SYN_MIX_CAPT = "color-mix\\(\\s*in\\s+((?:(?:ok)?lch|hsl|hwb)(?:\\s(?:(?:de|in)creasing|longer|shorter)\\shue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?:[+-]?(?:(?:0|[1-9]\\d*)(?:\\.\\d*)?|\\.\\d+)(?:e-?(?:0|[1-9]\\d*))?|[+-]?(?:(?:0|[1-9]\\d*)(?:\\.\\d*)?|\\.\\d+)(?:e-?(?:0|[1-9]\\d*))?%|none))?\\s*\\))(?:\\s+[+-]?(?:(?:0|[1-9]\\d*)(?:\\.\\d*)?|\\.\\d+)(?:e-?(?:0|[1-9]\\d*))?%)?)\\s*\\)"; +export declare const VAL_COMP: "computedValue"; +export declare const VAL_MIX: "mixValue"; +export declare const VAL_SPEC: "specifiedValue"; +export type SpecialValueFormat = typeof VAL_COMP | typeof VAL_MIX | typeof VAL_SPEC; +export declare const DEC = 10; +export declare const DEG = 360; +export declare const DEG_HALF = 180; +export declare const DOZ = 12; +export declare const DUO = 2; +export declare const HALF = 0.5; +export declare const HEX = 16; +export declare const LAB_A = 500; +export declare const LAB_B = 200; +export declare const LAB_EPSILON: number; +export declare const LAB_KAPPA: number; +export declare const LAB_L = 116; +export declare const LINEAR_COEF = 12.92; +export declare const LINEAR_OFFSET = 0.055; +export declare const MAX_LENGTH = 1024; +export declare const MAX_PCT = 100; +export declare const MAX_RGB = 255; +export declare const OCT = 8; +export declare const POW_CUBE = 3; +export declare const POW_LINEAR = 2.4; +export declare const POW_SQR = 2; +export declare const PPTH = 0.001; +export declare const QUAD = 4; +export declare const SEXA = 60; +export declare const TRIA = 3; diff --git a/node_modules/@asamuzakjp/css-color/dist/esm/utils/css-calc-var.d.ts b/node_modules/@asamuzakjp/css-color/dist/esm/utils/css-calc-var.d.ts new file mode 100644 index 0000000..8b1dfa8 --- /dev/null +++ b/node_modules/@asamuzakjp/css-color/dist/esm/utils/css-calc-var.d.ts @@ -0,0 +1,131 @@ +/** + * css-calc-var + */ +import { CSSToken } from '@csstools/css-tokenizer'; +import { CalcASTNode, Options } from '../typedef'; +/** + * Calclator + */ +export declare class Calculator { + #private; + /** + * constructor + */ + constructor(); + get hasNum(): boolean; + set hasNum(value: boolean); + get numSum(): number[]; + get numMul(): number[]; + get hasPct(): boolean; + set hasPct(value: boolean); + get pctSum(): number[]; + get pctMul(): number[]; + get hasDim(): boolean; + set hasDim(value: boolean); + get dimSum(): string[]; + get dimSub(): string[]; + get dimMul(): string[]; + get dimDiv(): string[]; + get hasEtc(): boolean; + set hasEtc(value: boolean); + get etcSum(): string[]; + get etcSub(): string[]; + get etcMul(): string[]; + get etcDiv(): string[]; + /** + * clear values + */ + clear(): void; + /** + * sort values + * @param values - values + * @returns sorted values + */ + sort(values?: string[]): string[]; + /** + * multiply values + * @returns resolved value + */ + multiply(): string; + /** + * sum values + * @returns resolved value + */ + sum(): string; +} +/** + * sort calc values + * @param values - values to sort + * @param [finalize] - finalize values + * @returns sorted values + */ +export declare const sortCalcValues: (values?: (number | string)[], finalize?: boolean) => string; +/** + * sort math function terms + * @param expr - unwrapped calc expression + * @returns sorted expression + */ +export declare const sortMathFnTerms: (expr: string) => string; +/** + * resolve AST node + * @param node - AST node + * @param isRoot - is root node + * @returns resolved value + */ +export declare const resolveNode: (node: CalcASTNode[], isRoot: boolean) => string; +/** + * serialize calc + * @param value - CSS value + * @param [opt] - options + * @returns serialized value + */ +export declare const serializeCalc: (value: string, opt?: Options) => string; +/** + * resolve dimension + * @param token - CSS token + * @param [opt] - options + * @returns resolved value + */ +export declare const resolveDimension: (token: CSSToken, opt?: Options) => string | null; +/** + * parse CSS calc() tokens + * @param tokens - CSS tokens + * @param [opt] - options + * @returns parsed tokens + */ +export declare const parseCalcTokens: (tokens: CSSToken[], opt?: Options) => string[]; +/** + * CSS calc() + * @param value - CSS value including calc() + * @param [opt] - options + * @returns resolved value + */ +export declare const cssCalc: (value: string, opt?: Options) => string; +/** + * resolve custom property + * @param tokens - CSS tokens + * @param [opt] - options + * @returns result - [tokens, resolvedValue] + */ +export declare function resolveCustomProperty(tokens: CSSToken[], opt?: Options): [CSSToken[], string]; +/** + * parse CSS var() tokens + * @param tokens - CSS tokens + * @param [opt] - options + * @returns parsed tokens + */ +export declare function parseVarTokens(tokens: CSSToken[], opt?: Options): string[] | null; +/** + * resolve CSS var() + * @param value - CSS value including var() + * @param [opt] - options + * @returns resolved value + */ +export declare function resolveVar(value: string, opt?: Options): string | null; +/** + * CSS var() + * @param value - CSS value including var() + * @param [opt] - options + * @returns resolved value + */ +export declare const cssVar: (value: string, opt?: Options) => string; diff --git a/node_modules/@asamuzakjp/css-color/dist/esm/utils/length-percentage.d.ts b/node_modules/@asamuzakjp/css-color/dist/esm/utils/length-percentage.d.ts new file mode 100644 index 0000000..5e9462c --- /dev/null +++ b/node_modules/@asamuzakjp/css-color/dist/esm/utils/length-percentage.d.ts @@ -0,0 +1,46 @@ +/** + * length-percentage + */ +import { CSSToken } from '@csstools/css-tokenizer'; +import { CalculationState } from '../typedef'; +/** + * Advance past whitespace and comments in a calculation. + * @param state - token stream and cursor + */ +export declare const skipCalculationWhitespace: (state: CalculationState) => void; +/** + * Check for actual whitespace, ignoring adjacent comments. + * @param tokens - token stream + * @param start - first token to check + * @param step - direction to scan + * @returns whether whitespace occurs before another non-comment token + */ +export declare const hasCalculationWhitespace: (tokens: CSSToken[], start: number, step: 1 | -1) => boolean; +/** + * Parse multiplication and division of calculation operands. + * Multiplication requires a number on one side, division a number divisor. + * This subset intentionally excludes CSS Values Level 4 typed arithmetic. + * @param state - token stream and cursor + * @returns calculation type or null on failure + */ +export declare const parseCalculationProduct: (state: CalculationState) => number | null; +/** + * Parse addition and subtraction, requiring matching operand types. + * @param state - token stream and cursor + * @returns calculation type or null on failure + */ +export declare const parseCalculationSum: (state: CalculationState) => number | null; +/** + * Parse a scalar, length, percentage, parenthesized sum or math function. + * Percentages receive the length percent hint in this context. + * @param state - token stream and cursor + * @returns calculation type or null on failure + */ +export declare function parseCalculationValue(state: CalculationState): number | null; +/** + * Validate a calculation in a length-percentage context. Types are represented + * as 0 for numbers and 1 for lengths/percentages, with scalar products only. + * @param value - calculation + * @returns whether the calculation has type length-percentage + */ +export declare const isLengthPercentageCalculation: (value: unknown) => boolean; diff --git a/node_modules/@asamuzakjp/css-color/dist/esm/utils/util.d.ts b/node_modules/@asamuzakjp/css-color/dist/esm/utils/util.d.ts new file mode 100644 index 0000000..26172bb --- /dev/null +++ b/node_modules/@asamuzakjp/css-color/dist/esm/utils/util.d.ts @@ -0,0 +1,87 @@ +/** + * util + */ +import { HueArc, Options, SpecifiedColorChannels } from '../typedef'; +/** + * get max length + * @param [opt] - options + * @returns max length + */ +export declare const getMaxLength: (opt?: Options) => number; +/** + * split value + * NOTE: comments are stripped, it can be preserved if, in the options param, + * `delimiter` is either ',' or '/' and with `preserveComment` set to `true` + * @param value - CSS value + * @param [opt] - options + * @returns array of values + */ +export declare const splitValue: (value: string, opt?: Options) => string[]; +/** + * extract dashed-ident tokens + * @param value - CSS value + * @returns array of dashed-ident tokens + */ +export declare const extractDashedIdent: (value: string) => string[]; +/** + * round to specified precision + * @param value - numeric value + * @param bit - minimum bits + * @returns rounded value + */ +export declare const roundToPrecision: (value: number, bit?: number) => number; +/** + * interpolate hue + * @param hueA - hue value + * @param hueB - hue value + * @param arc - shorter | longer | increasing | decreasing + * @returns result - [hueA, hueB] + */ +export declare const interpolateHue: (hueA: number, hueB: number, arc?: HueArc | string) => [number, number]; +/** + * resolve length in pixels + * @param value - value + * @param unit - unit + * @param [opt] - options + * @returns pixelated value + */ +export declare const resolveLengthInPixels: (value: number | string, unit: string | undefined, opt?: Options) => number; +/** + * angle to deg + * @param angle - angle + * @returns deg: 0..360 + */ +export declare const angleToDeg: (angle: string) => number; +/** + * number to hex string + * @param value - numeric value + * @returns hex string + */ +export declare const numberToHexString: (value: number) => string; +/** + * parse alpha + * @param [alpha] - alpha value + * @returns alpha: 0..1 + */ +export declare const parseAlpha: (alpha?: string) => number; +/** + * parse hex alpha + * @param value - alpha value in hex string + * @returns alpha: 0..1 + */ +export declare const parseHexAlpha: (value: string) => number; +/** + * cache invalid color value + * @param cacheKey - cache key + * @param format - format + * @param nullable - is nullable + * @returns cached value + */ +export declare const cacheInvalidColorValue: (cacheKey: string, format: string, nullable?: boolean) => SpecifiedColorChannels | string | null; +/** + * resolve invalid color value + * @param format - output format + * @param nullable - is nullable + * @returns resolved value + */ +export declare const resolveInvalidColorValue: (format: string, nullable?: boolean) => SpecifiedColorChannels | string | null; diff --git a/node_modules/@asamuzakjp/css-color/package.json b/node_modules/@asamuzakjp/css-color/package.json new file mode 100644 index 0000000..0dc422e --- /dev/null +++ b/node_modules/@asamuzakjp/css-color/package.json @@ -0,0 +1,75 @@ +{ + "name": "@asamuzakjp/css-color", + "description": "CSS color - Resolve and convert CSS colors.", + "author": "asamuzaK", + "license": "MIT", + "repository": { + "type": "git", + "url": "git+https://github.com/asamuzaK/cssColor.git" + }, + "homepage": "https://github.com/asamuzaK/cssColor#readme", + "bugs": { + "url": "https://github.com/asamuzaK/cssColor/issues" + }, + "files": [ + "dist", + "src" + ], + "type": "module", + "types": "./dist/esm/index.d.ts", + "exports": { + ".": { + "types": "./dist/esm/index.d.ts", + "default": "./dist/esm/index.js" + }, + "./package.json": "./package.json" + }, + "dependencies": { + "@csstools/css-calc": "^3.4.3", + "@csstools/css-color-parser": "^4.2.6", + "@csstools/css-parser-algorithms": "^4.0.2", + "@csstools/css-tokenizer": "^4.0.2", + "lru-cache": "^11.5.3" + }, + "devDependencies": { + "@types/node": "^26.6.5", + "@vitest/coverage-istanbul": "^5.0.3", + "esbuild": "^0.28.2", + "eslint": "^10.12.0", + "eslint-config-prettier": "^10.1.8", + "eslint-plugin-jsdoc": "^65.2.4", + "eslint-plugin-prettier": "^5.5.6", + "eslint-plugin-regexp": "^3.3.1", + "globals": "^17.13.0", + "knip": "^6.41.0", + "mitata": "^1.0.34", + "neostandard": "^0.14.0", + "prettier": "^3.9.10", + "prettier-plugin-brace-style": "^0.10.3", + "publint": "^0.3.25", + "rimraf": "^6.1.3", + "tsx": "^4.23.15", + "typescript": "^6.0.3", + "vite": "^8.3.4", + "vitest": "^5.0.3" + }, + "allowScripts": { + "esbuild@0.28.2": true + }, + "scripts": { + "bench:color": "npx tsx --expose-gc ./benchmark/bench-color.ts", + "build": "npm run clean && npm run test && npm run knip && vite build && npm run publint", + "clean": "rimraf ./coverage ./dist", + "clone": "node ./scripts/clone-txt.js", + "knip": "knip", + "lint": "eslint . --fix", + "publint": "publint --strict", + "test": "npm run lint && npm run test:types && npm run test:unit", + "test:types": "tsc", + "test:unit": "vitest" + }, + "engines": { + "node": "^22.22.2 || ^24.15.0 || >=26.0.0" + }, + "version": "7.1.5" +} diff --git a/node_modules/@asamuzakjp/css-color/src/converters/convert-color.ts b/node_modules/@asamuzakjp/css-color/src/converters/convert-color.ts new file mode 100644 index 0000000..506c744 --- /dev/null +++ b/node_modules/@asamuzakjp/css-color/src/converters/convert-color.ts @@ -0,0 +1,518 @@ +/** + * color + */ + +import { + transformMatrix, + transformLinearRgbToRgb, + transformXyzD50ToLab, + transformXyzD50ToLch, + transformXyzToHsl, + transformXyzToHwb, + transformXyzToOklab, + transformXyzToOklch +} from '../matrix/transform'; +import { + parseColorFunc, + parseColorValue, + parseHsl, + parseHwb, + parseLab, + parseLch, + parseOklab, + parseOklch +} from '../resolvers/parse-color'; +import { + resolveColorFunc, + resolveColorValue +} from '../resolvers/resolve-color'; +import { + ColorChannels, + ColorChannelsWithPowerless, + ComputedColorChannels, + LinearRgbOptions, + MatchedRegExp, + Options, + StringColorSpacedChannels, + TriColorChannels +} from '../typedef'; +import { isString } from '../utils/common'; + +/* constants */ +import { MATRIX_XYZ_TO_L_RGB } from '../matrix/matrix'; +import { + FN_COLOR, + MAX_RGB, + NONE, + SYN_FN_COLOR, + SYN_HSL, + SYN_HSL_LV3, + SYN_LCH, + SYN_MOD, + VAL_COMP, + VAL_MIX +} from '../utils/constant'; + +/* regexp */ +const REG_FN_COLOR = new RegExp(`^color\\(\\s*(${SYN_FN_COLOR})\\s*\\)$`); +const REG_HSL = new RegExp(`^hsla?\\(\\s*(${SYN_HSL}|${SYN_HSL_LV3})\\s*\\)$`); +const REG_HWB = new RegExp(`^hwb\\(\\s*(${SYN_HSL})\\s*\\)$`); +const REG_LAB = new RegExp(`^lab\\(\\s*(${SYN_MOD})\\s*\\)$`); +const REG_LCH = new RegExp(`^lch\\(\\s*(${SYN_LCH})\\s*\\)$`); +const REG_OKLAB = new RegExp(`^oklab\\(\\s*(${SYN_MOD})\\s*\\)$`); +const REG_OKLCH = new RegExp(`^oklch\\(\\s*(${SYN_LCH})\\s*\\)$`); + +/** + * convert color value to linear rgb + * @param value - CSS color value + * @param opt - options + * @returns ColorChannels | null - [r, g, b, alpha] r|g|b|alpha: 0..1 + */ +export const convertColorToLinearRgb = ( + value: string, + opt: LinearRgbOptions = {} +): ColorChannels | null => { + if (isString(value)) { + value = value.trim(); + } else { + throw new TypeError(`${value} is not a string.`); + } + const { colorSpace = '', format = '' } = opt; + let cs = ''; + let r, g, b, alpha, x, y, z; + if (format === VAL_MIX) { + let xyz; + if (value.startsWith(FN_COLOR)) { + xyz = parseColorFunc(value, opt); + } else { + xyz = parseColorValue(value, opt); + } + if (xyz === null) { + return null; + } + [cs, x, y, z, alpha] = xyz as ComputedColorChannels; + if (cs === colorSpace) { + return [x, y, z, alpha]; + } + [r, g, b] = transformMatrix(MATRIX_XYZ_TO_L_RGB, [x, y, z], true); + } else if (value.startsWith(FN_COLOR)) { + const [, val] = value.match(REG_FN_COLOR) as MatchedRegExp; + const [cs] = val.match(/[^\s,/]+/g) as StringColorSpacedChannels; + if (cs === 'srgb-linear') { + [, r, g, b, alpha] = resolveColorFunc(value, { + format: VAL_COMP + }) as ComputedColorChannels; + } else { + [, x, y, z, alpha] = parseColorFunc(value) as ComputedColorChannels; + [r, g, b] = transformMatrix(MATRIX_XYZ_TO_L_RGB, [x, y, z], true); + } + } else { + [, x, y, z, alpha] = parseColorValue(value) as ComputedColorChannels; + [r, g, b] = transformMatrix(MATRIX_XYZ_TO_L_RGB, [x, y, z], true); + } + return [ + Math.min(Math.max(r, 0), 1), + Math.min(Math.max(g, 0), 1), + Math.min(Math.max(b, 0), 1), + alpha + ]; +}; + +/** + * convert color value to rgb + * @param value - CSS color value + * @param opt - options + * @returns ColorChannels | null - [r, g, b, alpha] r|g|b: 0..255 alpha: 0..1 + */ +export const convertColorToRgb = ( + value: string, + opt: Options = {} +): ColorChannels | null => { + if (isString(value)) { + value = value.trim(); + } else { + throw new TypeError(`${value} is not a string.`); + } + const { format = '' } = opt; + let r, g, b, alpha; + if (format === VAL_MIX) { + let rgb; + if (value.startsWith(FN_COLOR)) { + rgb = resolveColorFunc(value, opt); + } else { + rgb = resolveColorValue(value, opt); + } + if (rgb === null) { + return null; + } + [, r, g, b, alpha] = rgb as ComputedColorChannels; + } else if (value.startsWith(FN_COLOR)) { + const [, val] = value.match(REG_FN_COLOR) as MatchedRegExp; + const [cs] = val.match(/[^\s,/]+/g) as StringColorSpacedChannels; + if (cs === 'srgb') { + [, r, g, b, alpha] = resolveColorFunc(value, { + format: VAL_COMP + }) as ComputedColorChannels; + r *= MAX_RGB; + g *= MAX_RGB; + b *= MAX_RGB; + } else { + [, r, g, b, alpha] = resolveColorFunc(value) as ComputedColorChannels; + } + } else if (/^(?:ok)?l(?:ab|ch)/.test(value)) { + [r, g, b, alpha] = convertColorToLinearRgb(value) as ColorChannels; + [r, g, b] = transformLinearRgbToRgb([r, g, b]); + } else { + [, r, g, b, alpha] = resolveColorValue(value, { + format: VAL_COMP + }) as ComputedColorChannels; + } + return [r, g, b, alpha]; +}; + +/** + * convert color value to xyz + * @param value - CSS color value + * @param opt - options + * @returns ColorChannels | null - [x, y, z, alpha] + */ +export const convertColorToXyz = ( + value: string, + opt: Options = {} +): ColorChannels | null => { + if (isString(value)) { + value = value.trim(); + } else { + throw new TypeError(`${value} is not a string.`); + } + const { d50 = false, format = '' } = opt; + let x, y, z, alpha; + if (format === VAL_MIX) { + let xyz; + if (value.startsWith(FN_COLOR)) { + xyz = parseColorFunc(value, opt); + } else { + xyz = parseColorValue(value, opt); + } + if (xyz === null) { + return null; + } + [, x, y, z, alpha] = xyz as ComputedColorChannels; + } else if (value.startsWith(FN_COLOR)) { + const [, val] = value.match(REG_FN_COLOR) as MatchedRegExp; + const [cs] = val.match(/[^\s,/]+/g) as StringColorSpacedChannels; + if (d50) { + if (cs === 'xyz-d50') { + [, x, y, z, alpha] = resolveColorFunc(value, { + format: VAL_COMP + }) as ComputedColorChannels; + } else { + [, x, y, z, alpha] = parseColorFunc( + value, + opt + ) as ComputedColorChannels; + } + } else if (/^xyz(?:-d65)?$/.test(cs)) { + [, x, y, z, alpha] = resolveColorFunc(value, { + format: VAL_COMP + }) as ComputedColorChannels; + } else { + [, x, y, z, alpha] = parseColorFunc(value) as ComputedColorChannels; + } + } else { + [, x, y, z, alpha] = parseColorValue(value, opt) as ComputedColorChannels; + } + return [x, y, z, alpha]; +}; + +/** + * convert color value to hsl + * @param value - CSS color value + * @param opt - options + * @returns ColorChannels | null - [h, s, l, alpha], hue may be powerless + */ +export const convertColorToHsl = ( + value: string, + opt: Options = {} +): ColorChannels | ColorChannelsWithPowerless | null => { + if (isString(value)) { + value = value.trim(); + } else { + throw new TypeError(`${value} is not a string.`); + } + const { format = '' } = opt; + let h, s, l, alpha; + if (REG_HSL.test(value)) { + [, h, s, l, alpha] = parseHsl(value, { + format: 'hsl' + }) as ComputedColorChannels; + if (format === 'hsl') { + return [Math.round(h), Math.round(s), Math.round(l), alpha]; + } + return [h, s, l, alpha]; + } + let x, y, z; + if (format === VAL_MIX) { + let xyz; + if (value.startsWith(FN_COLOR)) { + xyz = parseColorFunc(value, opt); + } else { + xyz = parseColorValue(value, opt); + } + if (xyz === null) { + return null; + } + [, x, y, z, alpha] = xyz as ComputedColorChannels; + } else if (value.startsWith(FN_COLOR)) { + [, x, y, z, alpha] = parseColorFunc(value) as ComputedColorChannels; + } else { + [, x, y, z, alpha] = parseColorValue(value) as ComputedColorChannels; + } + [h, s, l] = transformXyzToHsl([x, y, z], true) as TriColorChannels; + if (format === 'hsl') { + return [Math.round(h), Math.round(s), Math.round(l), alpha]; + } + return [format === VAL_MIX && s === 0 ? NONE : h, s, l, alpha]; +}; + +/** + * convert color value to hwb + * @param value - CSS color value + * @param opt - options + * @returns ColorChannels | null - [h, w, b, alpha], hue may be powerless + */ +export const convertColorToHwb = ( + value: string, + opt: Options = {} +): ColorChannels | [number | string, number, number, number] | null => { + if (isString(value)) { + value = value.trim(); + } else { + throw new TypeError(`${value} is not a string.`); + } + const { format = '' } = opt; + let h, w, b, alpha; + if (REG_HWB.test(value)) { + [, h, w, b, alpha] = parseHwb(value, { + format: 'hwb' + }) as ComputedColorChannels; + if (format === 'hwb') { + return [Math.round(h), Math.round(w), Math.round(b), alpha]; + } + return [h, w, b, alpha]; + } + let x, y, z; + if (format === VAL_MIX) { + let xyz; + if (value.startsWith(FN_COLOR)) { + xyz = parseColorFunc(value, opt); + } else { + xyz = parseColorValue(value, opt); + } + if (xyz === null) { + return null; + } + [, x, y, z, alpha] = xyz as ComputedColorChannels; + } else if (value.startsWith(FN_COLOR)) { + [, x, y, z, alpha] = parseColorFunc(value) as ComputedColorChannels; + } else { + [, x, y, z, alpha] = parseColorValue(value) as ComputedColorChannels; + } + [h, w, b] = transformXyzToHwb([x, y, z], true) as TriColorChannels; + if (format === 'hwb') { + return [Math.round(h), Math.round(w), Math.round(b), alpha]; + } + return [format === VAL_MIX && w + b >= 100 ? NONE : h, w, b, alpha]; +}; + +/** + * convert color value to lab + * @param value - CSS color value + * @param opt - options + * @returns ColorChannels | null - [l, a, b, alpha] + */ +export const convertColorToLab = ( + value: string, + opt: Options = {} +): ColorChannels | null => { + if (isString(value)) { + value = value.trim(); + } else { + throw new TypeError(`${value} is not a string.`); + } + const { format = '' } = opt; + let l, a, b, alpha; + if (REG_LAB.test(value)) { + [, l, a, b, alpha] = parseLab(value, { + format: VAL_COMP + }) as ComputedColorChannels; + return [l, a, b, alpha]; + } + let x, y, z; + if (format === VAL_MIX) { + let xyz; + const options = { + ...opt, + d50: true + }; + if (value.startsWith(FN_COLOR)) { + xyz = parseColorFunc(value, options); + } else { + xyz = parseColorValue(value, options); + } + if (xyz === null) { + return null; + } + [, x, y, z, alpha] = xyz as ComputedColorChannels; + } else if (value.startsWith(FN_COLOR)) { + [, x, y, z, alpha] = parseColorFunc(value, { + d50: true + }) as ComputedColorChannels; + } else { + [, x, y, z, alpha] = parseColorValue(value, { + d50: true + }) as ComputedColorChannels; + } + [l, a, b] = transformXyzD50ToLab([x, y, z], true); + return [l, a, b, alpha]; +}; + +/** + * convert color value to lch + * @param value - CSS color value + * @param opt - options + * @returns ColorChannels | null - [l, c, h, alpha], hue may be powerless + */ +export const convertColorToLch = ( + value: string, + opt: Options = {} +): ColorChannels | [number, number, number | string, number] | null => { + if (isString(value)) { + value = value.trim(); + } else { + throw new TypeError(`${value} is not a string.`); + } + const { format = '' } = opt; + let l, c, h, alpha; + if (REG_LCH.test(value)) { + [, l, c, h, alpha] = parseLch(value, { + format: VAL_COMP + }) as ComputedColorChannels; + return [l, c, h, alpha]; + } + let x, y, z; + if (format === VAL_MIX) { + let xyz; + const options = { + ...opt, + d50: true + }; + if (value.startsWith(FN_COLOR)) { + xyz = parseColorFunc(value, options); + } else { + xyz = parseColorValue(value, options); + } + if (xyz === null) { + return null; + } + [, x, y, z, alpha] = xyz as ComputedColorChannels; + } else if (value.startsWith(FN_COLOR)) { + [, x, y, z, alpha] = parseColorFunc(value, { + d50: true + }) as ComputedColorChannels; + } else { + [, x, y, z, alpha] = parseColorValue(value, { + d50: true + }) as ComputedColorChannels; + } + [l, c, h] = transformXyzD50ToLch([x, y, z], true); + return [l, c, format === VAL_MIX && c === 0 ? NONE : h, alpha]; +}; + +/** + * convert color value to oklab + * @param value - CSS color value + * @param opt - options + * @returns ColorChannels | null - [l, a, b, alpha] + */ +export const convertColorToOklab = ( + value: string, + opt: Options = {} +): ColorChannels | null => { + if (isString(value)) { + value = value.trim(); + } else { + throw new TypeError(`${value} is not a string.`); + } + const { format = '' } = opt; + let l, a, b, alpha; + if (REG_OKLAB.test(value)) { + [, l, a, b, alpha] = parseOklab(value, { + format: VAL_COMP + }) as ComputedColorChannels; + return [l, a, b, alpha]; + } + let x, y, z; + if (format === VAL_MIX) { + let xyz; + if (value.startsWith(FN_COLOR)) { + xyz = parseColorFunc(value, opt); + } else { + xyz = parseColorValue(value, opt); + } + if (xyz === null) { + return null; + } + [, x, y, z, alpha] = xyz as ComputedColorChannels; + } else if (value.startsWith(FN_COLOR)) { + [, x, y, z, alpha] = parseColorFunc(value) as ComputedColorChannels; + } else { + [, x, y, z, alpha] = parseColorValue(value) as ComputedColorChannels; + } + [l, a, b] = transformXyzToOklab([x, y, z], true); + return [l, a, b, alpha]; +}; + +/** + * convert color value to oklch + * @param value - CSS color value + * @param opt - options + * @returns ColorChannels | null - [l, c, h, alpha], hue may be powerless + */ +export const convertColorToOklch = ( + value: string, + opt: Options = {} +): ColorChannels | [number, number, number | string, number] | null => { + if (isString(value)) { + value = value.trim(); + } else { + throw new TypeError(`${value} is not a string.`); + } + const { format = '' } = opt; + let l, c, h, alpha; + if (REG_OKLCH.test(value)) { + [, l, c, h, alpha] = parseOklch(value, { + format: VAL_COMP + }) as ComputedColorChannels; + return [l, c, h, alpha]; + } + let x, y, z; + if (format === VAL_MIX) { + let xyz; + if (value.startsWith(FN_COLOR)) { + xyz = parseColorFunc(value, opt); + } else { + xyz = parseColorValue(value, opt); + } + if (xyz === null) { + return null; + } + [, x, y, z, alpha] = xyz as ComputedColorChannels; + } else if (value.startsWith(FN_COLOR)) { + [, x, y, z, alpha] = parseColorFunc(value) as ComputedColorChannels; + } else { + [, x, y, z, alpha] = parseColorValue(value) as ComputedColorChannels; + } + [l, c, h] = transformXyzToOklch([x, y, z], true) as TriColorChannels; + return [l, c, format === VAL_MIX && c === 0 ? NONE : h, alpha]; +}; diff --git a/node_modules/@asamuzakjp/css-color/src/converters/convert-hex.ts b/node_modules/@asamuzakjp/css-color/src/converters/convert-hex.ts new file mode 100644 index 0000000..a77d76d --- /dev/null +++ b/node_modules/@asamuzakjp/css-color/src/converters/convert-hex.ts @@ -0,0 +1,187 @@ +/** + * convert-hex + */ + +import { + transformMatrix, + validateColorComponents, + transformLinearRgbToRgb, + transformRgbToLinearRgb +} from '../matrix/transform'; +import { ColorChannels, MatchedRegExp3, MatchedRegExp4 } from '../typedef'; +import { isString } from '../utils/common'; +import { numberToHexString, parseHexAlpha } from '../utils/util'; + +/* constants */ +import { + MATRIX_D50_TO_D65, + MATRIX_L_RGB_TO_XYZ, + MATRIX_XYZ_TO_L_RGB +} from '../matrix/matrix'; +import { HEX, QUAD, MAX_RGB } from '../utils/constant'; + +/** + * convert rgb to hex color + * @param rgb - [r, g, b, alpha] r|g|b: 0..255 alpha: 0..1 + * @returns hex color + */ +export const convertRgbToHex = (rgb: ColorChannels): string => { + const [r, g, b, alpha] = validateColorComponents(rgb, { + alpha: true, + maxRange: MAX_RGB + }) as ColorChannels; + const rr = numberToHexString(r); + const gg = numberToHexString(g); + const bb = numberToHexString(b); + const aa = numberToHexString(alpha * MAX_RGB); + return aa === 'ff' ? `#${rr}${gg}${bb}` : `#${rr}${gg}${bb}${aa}`; +}; + +/** + * convert linear rgb to hex color + * @param rgb - [r, g, b, alpha] r|g|b|alpha: 0..1 + * @param [skip] - skip validate + * @returns hex color + */ +export const convertLinearRgbToHex = ( + rgb: ColorChannels, + skip: boolean = false +): string => { + let r: number, g: number, b: number, alpha: number; + if (skip) { + [r, g, b, alpha] = rgb; + } else { + [r, g, b, alpha] = validateColorComponents(rgb, { + minLength: QUAD + }) as ColorChannels; + } + [r, g, b] = transformLinearRgbToRgb([r, g, b], true); + const rr = numberToHexString(r); + const gg = numberToHexString(g); + const bb = numberToHexString(b); + const aa = numberToHexString(alpha * MAX_RGB); + return aa === 'ff' ? `#${rr}${gg}${bb}` : `#${rr}${gg}${bb}${aa}`; +}; + +/** + * convert xyz to hex color + * @param xyz - [x, y, z, alpha] + * @returns hex color + */ +export const convertXyzToHex = (xyz: ColorChannels): string => { + const [x, y, z, alpha] = validateColorComponents(xyz, { + minLength: QUAD, + validateRange: false + }) as ColorChannels; + const [r, g, b] = transformMatrix(MATRIX_XYZ_TO_L_RGB, [x, y, z], true); + return convertLinearRgbToHex( + [ + Math.min(Math.max(r, 0), 1), + Math.min(Math.max(g, 0), 1), + Math.min(Math.max(b, 0), 1), + alpha + ], + true + ); +}; + +/** + * convert xyz D50 to hex color + * @param xyz - [x, y, z, alpha] + * @returns hex color + */ +export const convertXyzD50ToHex = (xyz: ColorChannels): string => { + const [x, y, z, alpha] = validateColorComponents(xyz, { + minLength: QUAD, + validateRange: false + }) as ColorChannels; + const xyzD65 = transformMatrix(MATRIX_D50_TO_D65, [x, y, z], true); + const [r, g, b] = transformMatrix(MATRIX_XYZ_TO_L_RGB, xyzD65, true); + return convertLinearRgbToHex([ + Math.min(Math.max(r, 0), 1), + Math.min(Math.max(g, 0), 1), + Math.min(Math.max(b, 0), 1), + alpha + ]); +}; + +/** + * convert hex color to rgb + * @param value - hex color value + * @returns ColorChannels - [r, g, b, alpha] r|g|b: 0..255 alpha: 0..1 + */ +export const convertHexToRgb = (value: string): ColorChannels => { + if (isString(value)) { + value = value.toLowerCase().trim(); + } else { + throw new TypeError(`${value} is not a string.`); + } + if (!( + /^#[\da-f]{6}$/.test(value) || + /^#[\da-f]{3}$/.test(value) || + /^#[\da-f]{8}$/.test(value) || + /^#[\da-f]{4}$/.test(value) + )) { + throw new SyntaxError(`Invalid property value: ${value}`); + } + const arr: number[] = []; + if (/^#[\da-f]{3}$/.test(value)) { + const [, r, g, b] = value.match( + /^#([\da-f])([\da-f])([\da-f])$/ + ) as MatchedRegExp3; + arr.push( + parseInt(`${r}${r}`, HEX), + parseInt(`${g}${g}`, HEX), + parseInt(`${b}${b}`, HEX), + 1 + ); + } else if (/^#[\da-f]{4}$/.test(value)) { + const [, r, g, b, alpha] = value.match( + /^#([\da-f])([\da-f])([\da-f])([\da-f])$/ + ) as MatchedRegExp4; + arr.push( + parseInt(`${r}${r}`, HEX), + parseInt(`${g}${g}`, HEX), + parseInt(`${b}${b}`, HEX), + parseHexAlpha(`${alpha}${alpha}`) + ); + } else if (/^#[\da-f]{8}$/.test(value)) { + const [, r, g, b, alpha] = value.match( + /^#([\da-f]{2})([\da-f]{2})([\da-f]{2})([\da-f]{2})$/ + ) as MatchedRegExp4; + arr.push( + parseInt(r, HEX), + parseInt(g, HEX), + parseInt(b, HEX), + parseHexAlpha(alpha) + ); + } else { + const [, r, g, b] = value.match( + /^#([\da-f]{2})([\da-f]{2})([\da-f]{2})$/ + ) as MatchedRegExp3; + arr.push(parseInt(r, HEX), parseInt(g, HEX), parseInt(b, HEX), 1); + } + return arr as ColorChannels; +}; + +/** + * convert hex color to linear rgb + * @param value - hex color value + * @returns ColorChannels - [r, g, b, alpha] r|g|b|alpha: 0..1 + */ +export const convertHexToLinearRgb = (value: string): ColorChannels => { + const [rr, gg, bb, alpha] = convertHexToRgb(value); + const [r, g, b] = transformRgbToLinearRgb([rr, gg, bb], true); + return [r, g, b, alpha]; +}; + +/** + * convert hex color to xyz + * @param value - hex color value + * @returns ColorChannels - [x, y, z, alpha] + */ +export const convertHexToXyz = (value: string): ColorChannels => { + const [r, g, b, alpha] = convertHexToLinearRgb(value); + const [x, y, z] = transformMatrix(MATRIX_L_RGB_TO_XYZ, [r, g, b], true); + return [x, y, z, alpha]; +}; diff --git a/node_modules/@asamuzakjp/css-color/src/converters/convert.ts b/node_modules/@asamuzakjp/css-color/src/converters/convert.ts new file mode 100644 index 0000000..427ed84 --- /dev/null +++ b/node_modules/@asamuzakjp/css-color/src/converters/convert.ts @@ -0,0 +1,338 @@ +/** + * convert + */ + +import { parseColorFunc, parseColorValue } from '../resolvers/parse-color'; +import { resolveRelativeColor } from '../resolvers/relative-color'; +import { resolveColor } from '../resolvers/resolve-color'; +import { + ColorChannels, + ColorConvertFn, + ComputedColorChannels, + Options +} from '../typedef'; +import { createCacheKey, getCache, setCache } from '../utils/cache'; +import { isString } from '../utils/common'; +import { cssCalc, resolveVar } from '../utils/css-calc-var'; +import { getMaxLength, numberToHexString } from '../utils/util'; +import { + convertColorToHsl, + convertColorToHwb, + convertColorToLab, + convertColorToLch, + convertColorToOklab, + convertColorToOklch, + convertColorToRgb +} from './convert-color'; + +/* constants */ +import { + SYN_FN_CALC, + SYN_FN_REL, + SYN_FN_VAR, + VAL_COMP +} from '../utils/constant'; +const NAMESPACE = 'convert'; + +/* regexp */ +const REG_FN_CALC = new RegExp(SYN_FN_CALC); +const REG_FN_REL = new RegExp(SYN_FN_REL); +const REG_FN_VAR = new RegExp(SYN_FN_VAR); + +/** + * pre process + * @param value - CSS color value + * @param opt - options + * @returns value + */ +export const preProcess = (value: string, opt: Options): string | null => { + if (!isString(value)) { + return null; + } + value = value.trim(); + const maxLength = getMaxLength(opt); + if (!value || value.length > maxLength) { + return null; + } + const cacheKey: string = createCacheKey( + { namespace: NAMESPACE, name: 'preProcess', value }, + opt + ); + const cachedResult = getCache(cacheKey); + if (cachedResult !== false) { + return cachedResult.item as string | null; + } + let res: string | null = value; + if (REG_FN_VAR.test(value)) { + const resolved = resolveVar(value, opt); + if (isString(resolved)) { + res = resolved; + } else { + setCache(cacheKey, null); + return null; + } + } + if (REG_FN_REL.test(res)) { + const resolved = resolveRelativeColor(res, opt); + if (isString(resolved)) { + res = resolved; + } else { + setCache(cacheKey, null); + return null; + } + } else if (REG_FN_CALC.test(res)) { + res = cssCalc(res, opt); + } + if (res.startsWith('color-mix')) { + const resolvedColorMix = resolveColor(res, { + ...opt, + format: VAL_COMP, + nullable: true + }); + res = typeof resolvedColorMix === 'string' ? resolvedColorMix : null; + } + if (!res || res.length > maxLength) { + setCache(cacheKey, null); + return null; + } + setCache(cacheKey, res); + return res; +}; + +/** + * converter factory to reduce boilerplate + * @param name - function name for cache + * @param format - color format + * @param convertFn - conversion function + * @returns color converter function + */ +const createColorConverter = ( + name: string, + format: string, + convertFn: ColorConvertFn +) => { + return (value: string, opt: Options = {}): ColorChannels => { + if (!isString(value)) { + throw new TypeError(`${value} is not a string.`); + } + const options = { + ...opt + }; + const resolved = preProcess(value, options); + if (resolved === null) { + return [0, 0, 0, 0]; + } + const val = resolved.toLowerCase(); + const cacheKey = createCacheKey( + { namespace: NAMESPACE, name, value: val }, + options + ); + const cached = getCache(cacheKey); + if (cached !== false) { + return [...(cached.item as ColorChannels)] as ColorChannels; + } + const result = convertFn(val, { ...options, format }) as ColorChannels; + setCache(cacheKey, result); + return [...result]; + }; +}; + +/** + * convert number to hex string + * @param value - numeric value + * @returns hex string: 00..ff + */ +export const numberToHex = (value: number): string => numberToHexString(value); + +/** + * convert color to hex + * @param value - CSS color value + * @param [opt] - options + * @param [opt.alpha] - enable alpha channel + * @returns #rrggbb | #rrggbbaa | null + */ +export const colorToHex = (value: string, opt: Options = {}): string | null => { + if (!isString(value)) { + throw new TypeError(`${value} is not a string.`); + } + const options = { + ...opt + }; + const resolved = preProcess(value, options); + if (resolved === null) { + return null; + } + const val = resolved.toLowerCase(); + const cacheKey = createCacheKey( + { namespace: NAMESPACE, name: 'colorToHex', value: val }, + options + ); + const cached = getCache(cacheKey); + if (cached !== false) { + return cached.item as string | null; + } + const hex = resolveColor(val, { + ...options, + nullable: true, + format: options.alpha ? 'hexAlpha' : 'hex' + }); + if (isString(hex)) { + setCache(cacheKey, hex); + return hex; + } + setCache(cacheKey, null); + return null; +}; + +/** + * convert color to hsl + * @param value - CSS color value + * @param [opt] - options + * @returns ColorChannels - [h, s, l, alpha] + */ +export const colorToHsl = createColorConverter( + 'colorToHsl', + 'hsl', + convertColorToHsl +); + +/** + * convert color to hwb + * @param value - CSS color value + * @param [opt] - options + * @returns ColorChannels - [h, w, b, alpha] + */ +export const colorToHwb = createColorConverter( + 'colorToHwb', + 'hwb', + convertColorToHwb +); + +/** + * convert color to lab + * @param value - CSS color value + * @param [opt] - options + * @returns ColorChannels - [l, a, b, alpha] + */ +export const colorToLab = createColorConverter( + 'colorToLab', + 'lab', + convertColorToLab +); + +/** + * convert color to lch + * @param value - CSS color value + * @param [opt] - options + * @returns ColorChannels - [l, c, h, alpha] + */ +export const colorToLch = createColorConverter( + 'colorToLch', + 'lch', + convertColorToLch +); + +/** + * convert color to oklab + * @param value - CSS color value + * @param [opt] - options + * @returns ColorChannels - [l, a, b, alpha] + */ +export const colorToOklab = createColorConverter( + 'colorToOklab', + 'oklab', + convertColorToOklab +); + +/** + * convert color to oklch + * @param value - CSS color value + * @param [opt] - options + * @returns ColorChannels - [l, c, h, alpha] + */ +export const colorToOklch = createColorConverter( + 'colorToOklch', + 'oklch', + convertColorToOklch +); + +/** + * convert color to rgb + * @param value - CSS color value + * @param [opt] - options + * @returns ColorChannels - [r, g, b, alpha] + */ +export const colorToRgb = createColorConverter( + 'colorToRgb', + 'rgb', + convertColorToRgb +); + +/** + * convert color to xyz + * @param value - CSS color value + * @param [opt] - options + * @returns ColorChannels - [x, y, z, alpha] + */ +export const colorToXyz = (value: string, opt: Options = {}): ColorChannels => { + if (!isString(value)) { + throw new TypeError(`${value} is not a string.`); + } + const options = { + ...opt + }; + const resolved = preProcess(value, options); + if (resolved === null) { + return [0, 0, 0, 0]; + } + const val = resolved.toLowerCase(); + const cacheKey = createCacheKey( + { namespace: NAMESPACE, name: 'colorToXyz', value: val }, + options + ); + const cached = getCache(cacheKey); + if (cached !== false) { + return [...(cached.item as ColorChannels)] as ColorChannels; + } + let parsed; + if (val.startsWith('color(')) { + parsed = parseColorFunc(val, options); + } else { + parsed = parseColorValue(val, options); + } + const [, ...xyz] = parsed as ComputedColorChannels; + setCache(cacheKey, xyz); + return [...xyz] as ColorChannels; +}; + +/** + * convert color to xyz-d50 + * @param value - CSS color value + * @param [opt] - options + * @returns ColorChannels - [x, y, z, alpha] + */ +export const colorToXyzD50 = ( + value: string, + opt: Options = {} +): ColorChannels => { + const options = { + ...opt, + d50: true + }; + return colorToXyz(value, options); +}; + +/* convert */ +export const convert = { + colorToHex, + colorToHsl, + colorToHwb, + colorToLab, + colorToLch, + colorToOklab, + colorToOklch, + colorToRgb, + colorToXyz, + colorToXyzD50, + numberToHex +}; diff --git a/node_modules/@asamuzakjp/css-color/src/gradients/gradient-util.ts b/node_modules/@asamuzakjp/css-color/src/gradients/gradient-util.ts new file mode 100644 index 0000000..3313a65 --- /dev/null +++ b/node_modules/@asamuzakjp/css-color/src/gradients/gradient-util.ts @@ -0,0 +1,325 @@ +/** + * gradient-util + */ + +import { + isCommentNode, + isWhitespaceNode, + parseListOfComponentValues +} from '@csstools/css-parser-algorithms'; +import { TokenType, tokenize } from '@csstools/css-tokenizer'; +import { isValidColor, resolveColor } from '../resolvers/resolve-color'; +import { Options, ValidateGradientLine, ValidateColorStops } from '../typedef'; +import { isString } from '../utils/common'; +import { cssCalc } from '../utils/css-calc-var'; +import { isLengthPercentageCalculation } from '../utils/length-percentage'; +import { splitValue } from '../utils/util'; + +/* constants */ +import { + ANGLE, + CS_HUE, + CS_RECT, + LENGTH, + NUM, + NUM_POSITIVE, + PCT, + VAL_SPEC +} from '../utils/constant'; +const { Function: FUNC } = TokenType; +const DIM_ANGLE = `${NUM}(?:${ANGLE})`; +const DIM_ANGLE_PCT = `${DIM_ANGLE}|${PCT}`; +const DIM_LEN = `${NUM}(?:${LENGTH})|0`; +const DIM_LEN_PCT = `${DIM_LEN}|${PCT}`; +const DIM_LEN_PCT_POSI = `${NUM_POSITIVE}(?:${LENGTH}|%)|0`; +const DIM_LEN_POSI = `${NUM_POSITIVE}(?:${LENGTH})|0`; +const CTR = 'center'; +const L_R = 'left|right'; +const T_B = 'top|bottom'; +const S_E = 'start|end'; +const AXIS_X = `${L_R}|x-(?:${S_E})`; +const AXIS_Y = `${T_B}|y-(?:${S_E})`; +const BLOCK = `block-(?:${S_E})`; +const INLINE = `inline-(?:${S_E})`; +const POS_1 = `${CTR}|${AXIS_X}|${AXIS_Y}|${BLOCK}|${INLINE}|${DIM_LEN_PCT}`; +const POS_2 = [ + `(?:${CTR}|${AXIS_X})\\s+(?:${CTR}|${AXIS_Y})`, + `(?:${CTR}|${AXIS_Y})\\s+(?:${CTR}|${AXIS_X})`, + `(?:${CTR}|${AXIS_X}|${DIM_LEN_PCT})\\s+(?:${CTR}|${AXIS_Y}|${DIM_LEN_PCT})`, + `(?:${CTR}|${BLOCK})\\s+(?:${CTR}|${INLINE})`, + `(?:${CTR}|${INLINE})\\s+(?:${CTR}|${BLOCK})`, + `(?:${CTR}|${S_E})\\s+(?:${CTR}|${S_E})` +].join('|'); +const POS_4 = [ + `(?:${AXIS_X})\\s+(?:${DIM_LEN_PCT})\\s+(?:${AXIS_Y})\\s+(?:${DIM_LEN_PCT})`, + `(?:${AXIS_Y})\\s+(?:${DIM_LEN_PCT})\\s+(?:${AXIS_X})\\s+(?:${DIM_LEN_PCT})`, + `(?:${BLOCK})\\s+(?:${DIM_LEN_PCT})\\s+(?:${AXIS_Y})\\s+(?:${DIM_LEN_PCT})`, + `(?:${INLINE})\\s+(?:${DIM_LEN_PCT})\\s+(?:${BLOCK})\\s+(?:${DIM_LEN_PCT})`, + `(?:${S_E})\\s+(?:${DIM_LEN_PCT})\\s+(?:${S_E})\\s+(?:${DIM_LEN_PCT})` +].join('|'); +const RAD_EXTENT = '(?:clos|farth)est-(?:corner|side)'; +const RAD_SIZE = [ + `${RAD_EXTENT}(?:\\s+${RAD_EXTENT})?`, + `${DIM_LEN_POSI}`, + `(?:${DIM_LEN_PCT_POSI})\\s+(?:${DIM_LEN_PCT_POSI})` +].join('|'); +const RAD_SHAPE = 'circle|ellipse'; +const FROM_ANGLE = `from\\s+${DIM_ANGLE}`; +const AT_POSITION = `at\\s+(?:${POS_1}|${POS_2}|${POS_4})`; +const TO_SIDE_CORNER = `to\\s+(?:(?:${L_R})(?:\\s(?:${T_B}))?|(?:${T_B})(?:\\s(?:${L_R}))?)`; +const IN_COLOR_SPACE = `in\\s+(?:${CS_RECT}|${CS_HUE})`; +const LINE_SYNTAX_LINEAR = [ + `(?:${DIM_ANGLE}|${TO_SIDE_CORNER})(?:\\s+${IN_COLOR_SPACE})?`, + `${IN_COLOR_SPACE}(?:\\s+(?:${DIM_ANGLE}|${TO_SIDE_CORNER}))?` +].join('|'); +const LINE_SYNTAX_RADIAL = [ + `(?:${RAD_SHAPE})(?:\\s+(?:${RAD_SIZE}))?(?:\\s+${AT_POSITION})?(?:\\s+${IN_COLOR_SPACE})?`, + `(?:${RAD_SIZE})(?:\\s+(?:${RAD_SHAPE}))?(?:\\s+${AT_POSITION})?(?:\\s+${IN_COLOR_SPACE})?`, + `${AT_POSITION}(?:\\s+${IN_COLOR_SPACE})?`, + `${IN_COLOR_SPACE}(?:\\s+${RAD_SHAPE})(?:\\s+(?:${RAD_SIZE}))?(?:\\s+${AT_POSITION})?`, + `${IN_COLOR_SPACE}(?:\\s+${RAD_SIZE})(?:\\s+(?:${RAD_SHAPE}))?(?:\\s+${AT_POSITION})?`, + `${IN_COLOR_SPACE}(?:\\s+${AT_POSITION})?` +].join('|'); +const LINE_SYNTAX_CONIC = [ + `${FROM_ANGLE}(?:\\s+${AT_POSITION})?(?:\\s+${IN_COLOR_SPACE})?`, + `${AT_POSITION}(?:\\s+${IN_COLOR_SPACE})?`, + `${IN_COLOR_SPACE}(?:\\s+${FROM_ANGLE})?(?:\\s+${AT_POSITION})?` +].join('|'); +const DEFAULT_RADIAL = [/ellipse/, /farthest-corner/, /at\s+center/]; +const DEFAULT_CONIC = [/at\s+center/]; +const COLOR_OPT = { + format: VAL_SPEC, + nullable: true +}; + +/* regexp */ +const IS_CONIC = /^(?:repeating-)?conic-gradient$/; +const IS_LINEAR = /^(?:repeating-)?linear-gradient$/; +const IS_RADIAL = /^(?:repeating-)?radial-gradient$/; +const IS_GRADIENT_FN = /^(?:repeating-)?(?:conic|linear|radial)-gradient$/i; +const REG_COLOR_HINT_CONIC = new RegExp(`^(?:${DIM_ANGLE_PCT})$`); +const REG_COLOR_HINT_NON_CONIC = new RegExp(`^(?:${DIM_LEN_PCT})$`); +const REG_LINE_CONIC = new RegExp(`^(?:${LINE_SYNTAX_CONIC})$`); +const REG_LINE_LINEAR = new RegExp(`^(?:${LINE_SYNTAX_LINEAR})$`); +const REG_LINE_RADIAL = new RegExp(`^(?:${LINE_SYNTAX_RADIAL})$`); +const REG_TO_BOTTOM = /^to\s+bottom$/i; + +/** + * get gradient type + * @param value - gradient value + * @returns gradient type + */ +export const getGradientType = (value: string): string => { + if (isString(value)) { + const trimmed = value.trim(); + if (trimmed) { + const tokens = tokenize({ css: trimmed }); + const [firstToken] = tokens; + if (firstToken && firstToken[0] === FUNC) { + const fnName = firstToken[1].slice(0, -1).toLowerCase(); + if (IS_GRADIENT_FN.test(fnName)) { + return fnName; + } + } + } + } + return ''; +}; + +/** + * validate linear-gradient line + * @param value - line value + * @returns result + */ +export const validateLinearGradientLine = ( + value: string +): ValidateGradientLine => { + const valid = REG_LINE_LINEAR.test(value); + if (!valid) { + return { line: value, valid: false }; + } + const normalized = value.replace(/\s+/g, ' ').trim(); + if (REG_TO_BOTTOM.test(normalized)) { + return { line: '', valid: true }; + } + const line = normalized + .replace(/^to\sbottom\s/i, '') + .replace(/\sto\sbottom$/i, '') + .trim(); + return { line, valid: true }; +}; + +/** + * validate radial-gradient line + * @param value - line value + * @returns result + */ +export const validateRadialGradientLine = ( + value: string +): ValidateGradientLine => { + const valid = REG_LINE_RADIAL.test(value); + if (!valid) { + return { line: value, valid: false }; + } + let line = value; + for (const defaultValue of DEFAULT_RADIAL) { + line = line.replace(defaultValue, ''); + } + line = line.replace(/\s{2,}/g, ' ').trim(); + return { line, valid: true }; +}; + +/** + * validate conic-gradient line + * @param value - line value + * @returns result + */ +export const validateConicGradientLine = ( + value: string +): ValidateGradientLine => { + const valid = REG_LINE_CONIC.test(value); + if (!valid) { + return { line: value, valid: false }; + } + let line = value; + for (const defaultValue of DEFAULT_CONIC) { + line = line.replace(defaultValue, ''); + } + line = line.replace(/\s{2,}/g, ' ').trim(); + return { line, valid: true }; +}; + +/** + * validate gradient line + * @param value - gradient line value + * @param type - gradient type + * @returns result + */ +export const validateGradientLine = ( + value: string, + type: string +): ValidateGradientLine => { + if (isString(value) && isString(type)) { + const trimmedValue = value.trim(); + const trimmedType = type.trim(); + if (IS_LINEAR.test(trimmedType)) { + return validateLinearGradientLine(trimmedValue); + } + if (IS_RADIAL.test(trimmedType)) { + return validateRadialGradientLine(trimmedValue); + } + if (IS_CONIC.test(trimmedType)) { + return validateConicGradientLine(trimmedValue); + } + } + return { line: value, valid: false }; +}; + +/** + * Split a color stop into its original component values. + * @param value - color stop or transition hint + * @returns color and position components, retaining comments inside functions + */ +export const splitColorStop = (value: string): string[] => { + const components = parseListOfComponentValues(tokenize({ css: value })); + const parts: string[] = []; + for (const component of components) { + if (!isCommentNode(component) && !isWhitespaceNode(component)) { + parts.push(component.toString()); + } + } + return parts; +}; + +/** + * Validate a position in a gradient color stop or transition hint. + * @param value - original position component + * @param isConic - whether the gradient uses angle-percentage positions + * @returns whether the position is valid in this gradient context + */ +export const isValidPosition = (value: string, isConic: boolean): boolean => { + const regColorHint = isConic + ? REG_COLOR_HINT_CONIC + : REG_COLOR_HINT_NON_CONIC; + return ( + regColorHint.test(value) || + (!isConic && isLengthPercentageCalculation(value)) + ); +}; + +/** + * validate color stop list + * @param list - color stop list + * @param type - gradient type + * @param [opt] - options + * @returns validated result + */ +export const validateColorStopList = ( + list: string[], + type: string, + opt: Options = {} +): ValidateColorStops => { + if (Array.isArray(list) && list.length > 1) { + const isConic = IS_CONIC.test(type); + const valueList: string[] = []; + // State tracker: 'color' or 'hint' + let prevType = ''; + // for (let i = 0; i < list.length; i++) から entries() に変更 + for (const [i, item] of list.entries()) { + if (!isString(item)) { + return { colorStops: list, valid: false }; + } + const parts = splitColorStop(item); + const [firstPart, ...posParts] = parts; + if (!firstPart || parts.length > 3) { + return { colorStops: list, valid: false }; + } + if (parts.length === 1 && isValidPosition(firstPart, isConic)) { + // Color hint + if (i === 0 || prevType === 'hint') { + return { colorStops: list, valid: false }; + } + prevType = 'hint'; + // Resolve calc() expressions and clean up comments + const resolvedHint = isLengthPercentageCalculation(firstPart) + ? cssCalc(firstPart, opt) + : firstPart; + valueList.push(resolvedHint); + } else { + // Color stop (1 color + 0 to 2 stop positions) + const resolvedPosParts: string[] = []; + for (const position of posParts) { + if (!isValidPosition(position, isConic)) { + return { colorStops: list, valid: false }; + } + // Resolve calc() expressions and clean up comments + const resolvedPosition = isLengthPercentageCalculation(position) + ? cssCalc(position, opt) + : position; + resolvedPosParts.push(resolvedPosition); + } + const color = splitValue(firstPart).join(' '); + if (isValidColor(color, COLOR_OPT)) { + const resolvedColor = resolveColor(color, opt); + if (!resolvedColor || !isValidColor(resolvedColor, COLOR_OPT)) { + return { colorStops: list, valid: false }; + } + prevType = 'color'; + const resolvedItem = + resolvedPosParts.length > 0 + ? `${resolvedColor} ${resolvedPosParts.join(' ')}` + : resolvedColor; + valueList.push(resolvedItem); + } else { + return { colorStops: list, valid: false }; + } + } + } + // The last item must be a color, not a hint + if (prevType !== 'color') { + return { colorStops: list, valid: false }; + } + return { valid: true, colorStops: valueList }; + } + return { colorStops: list, valid: false }; +}; diff --git a/node_modules/@asamuzakjp/css-color/src/gradients/gradient.ts b/node_modules/@asamuzakjp/css-color/src/gradients/gradient.ts new file mode 100644 index 0000000..1875fbc --- /dev/null +++ b/node_modules/@asamuzakjp/css-color/src/gradients/gradient.ts @@ -0,0 +1,47 @@ +/** + * gradient + */ + +import { Options } from '../typedef'; +import { getMaxLength } from '../utils/util'; +import { parseGradient } from './parse-gradient'; + +/* constants */ +import { VAL_SPEC } from '../utils/constant'; + +/** + * resolve CSS gradient + * @param value - CSS value + * @param [opt] - options + * @returns result + */ +export const resolveGradient = (value: string, opt: Options = {}): string => { + const options = { + ...opt + }; + const maxLength = getMaxLength(options); + if (value && value.length <= maxLength) { + const gradient = parseGradient(value, options); + if (gradient) { + const { type, gradientLine, colorStopList } = gradient; + if (gradientLine) { + return `${type}(${gradientLine}, ${colorStopList.join(', ')})`; + } + return `${type}(${colorStopList.join(', ')})`; + } + } + return options.format === VAL_SPEC ? '' : 'none'; +}; + +/** + * is CSS gradient + * @param value - CSS value + * @param [opt] - options + * @returns result + */ +export const isGradient = (value: string, opt: Options = {}): boolean => { + const options = { + ...opt + }; + return !!parseGradient(value, options); +}; diff --git a/node_modules/@asamuzakjp/css-color/src/gradients/parse-gradient.ts b/node_modules/@asamuzakjp/css-color/src/gradients/parse-gradient.ts new file mode 100644 index 0000000..e2b812a --- /dev/null +++ b/node_modules/@asamuzakjp/css-color/src/gradients/parse-gradient.ts @@ -0,0 +1,98 @@ +/** + * gradient + */ + +import { isValidColor } from '../resolvers/resolve-color'; +import { ColorStopList, Gradient, GradientType, Options } from '../typedef'; +import { createCacheKey, getCache, setCache } from '../utils/cache'; +import { isString } from '../utils/common'; +import { splitValue } from '../utils/util'; +import { + getGradientType, + splitColorStop, + validateColorStopList, + validateGradientLine +} from './gradient-util'; + +/* constants */ +import { VAL_SPEC } from '../utils/constant'; +const NAMESPACE = 'gradient'; +const COLOR_OPT = { + format: VAL_SPEC, + nullable: true +}; + +/* regexp */ +const REG_GRAD = /^(?:repeating-)?(?:conic|linear|radial)-gradient\(/; + +/** + * parse CSS gradient + * @param value - gradient value + * @param [opt] - options + * @returns parsed result + */ +export const parseGradient = ( + value: string, + opt: Options = {} +): Gradient | null => { + if (!isString(value)) { + return null; + } + const trimmedValue = value.trim(); + const cacheKey: string = createCacheKey( + { namespace: NAMESPACE, name: 'parseGradient', value: trimmedValue }, + opt + ); + const cachedResult = getCache(cacheKey); + if (cachedResult !== false) { + return cachedResult.item as Gradient | null; + } + const type = getGradientType(trimmedValue); + const gradValue = trimmedValue.replace(REG_GRAD, '').replace(/\)$/, ''); + if (type && gradValue) { + const [lineOrColorStop, ...itemList] = splitValue(gradValue, { + delimiter: ',', + preserveComment: true + }); + if (!lineOrColorStop) { + setCache(cacheKey, null); + return null; + } + const [firstPart] = splitColorStop(lineOrColorStop); + if (firstPart && isValidColor(splitValue(firstPart).join(' '), COLOR_OPT)) { + itemList.unshift(lineOrColorStop); + const { colorStops, valid } = validateColorStopList(itemList, type, opt); + if (valid) { + const res: Gradient = { + value: trimmedValue, + type: type as GradientType, + colorStopList: colorStops as ColorStopList + }; + setCache(cacheKey, res); + return res; + } + } else if (itemList.length > 1) { + const { line: gradientLine, valid: validLine } = validateGradientLine( + splitValue(lineOrColorStop).join(' '), + type + ); + const { colorStops, valid: validColorStops } = validateColorStopList( + itemList, + type, + opt + ); + if (validLine && validColorStops) { + const res: Gradient = { + value: trimmedValue, + type: type as GradientType, + gradientLine, + colorStopList: colorStops as ColorStopList + }; + setCache(cacheKey, res); + return res; + } + } + } + setCache(cacheKey, null); + return null; +}; diff --git a/node_modules/@asamuzakjp/css-color/src/index.ts b/node_modules/@asamuzakjp/css-color/src/index.ts new file mode 100644 index 0000000..ac386f0 --- /dev/null +++ b/node_modules/@asamuzakjp/css-color/src/index.ts @@ -0,0 +1,34 @@ +/*! + * CSS color - Resolve, parse, convert CSS color. + * @license MIT + * @copyright asamuzaK (Kazz) + * @see {@link https://github.com/asamuzaK/cssColor/blob/main/LICENSE} + */ + +import { isGradient, resolveGradient } from './gradients/gradient'; +import { isColor } from './resolvers/resolve'; +import { cssCalc, cssVar } from './utils/css-calc-var'; +import { + extractDashedIdent, + resolveLengthInPixels, + splitValue +} from './utils/util'; + +export { convert } from './converters/convert'; +export { resolveGradient } from './gradients/gradient'; +export { resolve } from './resolvers/resolve'; + +/* utils */ +export const utils = { + cssCalc, + cssVar, + extractDashedIdent, + isColor, + isGradient, + /** + * @deprecated Use `resolveGradient` directly instead. + */ + resolveGradient, + resolveLengthInPixels, + splitValue +}; diff --git a/node_modules/@asamuzakjp/css-color/src/matrix/matrix.ts b/node_modules/@asamuzakjp/css-color/src/matrix/matrix.ts new file mode 100644 index 0000000..025ffdc --- /dev/null +++ b/node_modules/@asamuzakjp/css-color/src/matrix/matrix.ts @@ -0,0 +1,87 @@ +/** + * matrix + */ + +import { ReadonlyColorMatrix, ReadonlyTriColorChannels } from '../typedef'; + +/** + * conversion matrices + * @see https://drafts.csswg.org/css-color-4/#color-conversion-code + */ +export const D50: ReadonlyTriColorChannels = [ + 0.3457 / 0.3585, + 1.0, + (1.0 - 0.3457 - 0.3585) / 0.3585 +] as const; + +export const MATRIX_D50_TO_D65: ReadonlyColorMatrix = [ + [0.955473421488075, -0.02309845494876471, 0.06325924320057072], + [-0.0283697093338637, 1.0099953980813041, 0.021041441191917323], + [0.012314014864481998, -0.020507649298898964, 1.330365926242124] +] as const; + +export const MATRIX_D65_TO_D50: ReadonlyColorMatrix = [ + [1.0479297925449969, 0.022946870601609652, -0.05019226628920524], + [0.02962780877005599, 0.9904344267538799, -0.017073799063418826], + [-0.009243040646204504, 0.015055191490298152, 0.7518742814281371] +] as const; + +export const MATRIX_L_RGB_TO_XYZ: ReadonlyColorMatrix = [ + [506752 / 1228815, 87881 / 245763, 12673 / 70218], + [87098 / 409605, 175762 / 245763, 12673 / 175545], + [7918 / 409605, 87881 / 737289, 1001167 / 1053270] +] as const; + +export const MATRIX_XYZ_TO_L_RGB: ReadonlyColorMatrix = [ + [12831 / 3959, -329 / 214, -1974 / 3959], + [-851781 / 878810, 1648619 / 878810, 36519 / 878810], + [705 / 12673, -2585 / 12673, 705 / 667] +] as const; + +export const MATRIX_XYZ_TO_LMS: ReadonlyColorMatrix = [ + [0.819022437996703, 0.3619062600528904, -0.1288737815209879], + [0.0329836539323885, 0.9292868615863434, 0.0361446663506424], + [0.0481771893596242, 0.2642395317527308, 0.6335478284694309] +] as const; + +export const MATRIX_LMS_TO_XYZ: ReadonlyColorMatrix = [ + [1.2268798758459243, -0.5578149944602171, 0.2813910456659647], + [-0.0405757452148008, 1.112286803280317, -0.0717110580655164], + [-0.0763729366746601, -0.4214933324022432, 1.5869240198367816] +] as const; + +export const MATRIX_OKLAB_TO_LMS: ReadonlyColorMatrix = [ + [1.0, 0.3963377773761749, 0.2158037573099136], + [1.0, -0.1055613458156586, -0.0638541728258133], + [1.0, -0.0894841775298119, -1.2914855480194092] +] as const; + +export const MATRIX_LMS_TO_OKLAB: ReadonlyColorMatrix = [ + [0.210454268309314, 0.7936177747023054, -0.0040720430116193], + [1.9779985324311684, -2.4285922420485799, 0.450593709617411], + [0.0259040424655478, 0.7827717124575296, -0.8086757549230774] +] as const; + +export const MATRIX_P3_TO_XYZ: ReadonlyColorMatrix = [ + [608311 / 1250200, 189793 / 714400, 198249 / 1000160], + [35783 / 156275, 247089 / 357200, 198249 / 2500400], + [0 / 1, 32229 / 714400, 5220557 / 5000800] +] as const; + +export const MATRIX_REC2020_TO_XYZ: ReadonlyColorMatrix = [ + [63426534 / 99577255, 20160776 / 139408157, 47086771 / 278816314], + [26158966 / 99577255, 472592308 / 697040785, 8267143 / 139408157], + [0 / 1, 19567812 / 697040785, 295819943 / 278816314] +] as const; + +export const MATRIX_A98_TO_XYZ: ReadonlyColorMatrix = [ + [573536 / 994567, 263643 / 1420810, 187206 / 994567], + [591459 / 1989134, 6239551 / 9945670, 374412 / 4972835], + [53769 / 1989134, 351524 / 4972835, 4929758 / 4972835] +] as const; + +export const MATRIX_PROPHOTO_TO_XYZ_D50: ReadonlyColorMatrix = [ + [0.7977666449006423, 0.13518129740053308, 0.0313477341283922], + [0.2880748288194013, 0.711835234241873, 0.00008993693872564], + [0.0, 0.0, 0.8251046025104602] +] as const; diff --git a/node_modules/@asamuzakjp/css-color/src/matrix/transform.ts b/node_modules/@asamuzakjp/css-color/src/matrix/transform.ts new file mode 100644 index 0000000..ab6ea93 --- /dev/null +++ b/node_modules/@asamuzakjp/css-color/src/matrix/transform.ts @@ -0,0 +1,557 @@ +/** + * transform + */ + +import { + ColorChannels, + NumStrColorChannels, + ReadonlyColorMatrix, + TriColorChannels, + ValidateColorComponentsOptions +} from '../typedef'; + +/* constants */ +import { + DEG, + DEG_HALF, + DUO, + HALF, + HEX, + LAB_A, + LAB_B, + LAB_EPSILON, + LAB_KAPPA, + LAB_L, + LINEAR_COEF, + LINEAR_OFFSET, + MAX_PCT, + MAX_RGB, + NONE, + POW_LINEAR, + POW_SQR, + QUAD, + SEXA, + TRIA +} from '../utils/constant'; +import { + D50, + MATRIX_D50_TO_D65, + MATRIX_D65_TO_D50, + MATRIX_LMS_TO_OKLAB, + MATRIX_L_RGB_TO_XYZ, + MATRIX_XYZ_TO_LMS, + MATRIX_XYZ_TO_L_RGB +} from './matrix'; + +/** + * validate color components + * @param arr - color components + * @param opt - options + * @param opt.alpha - alpha channel + * @param opt.minLength - min length + * @param opt.maxLength - max length + * @param opt.minRange - min range + * @param opt.maxRange - max range + * @param opt.validateRange - validate range + * @returns result - validated color components + */ +export const validateColorComponents = ( + arr: ColorChannels | TriColorChannels, + opt: ValidateColorComponentsOptions = {} +): ColorChannels | TriColorChannels => { + if (!Array.isArray(arr)) { + throw new TypeError(`${arr} is not an array.`); + } + const { + alpha = false, + minLength = TRIA, + maxLength = QUAD, + minRange = 0, + maxRange = 1, + validateRange = true + } = opt; + if (!Number.isFinite(minLength)) { + throw new TypeError(`${minLength} is not a number.`); + } + if (!Number.isFinite(maxLength)) { + throw new TypeError(`${maxLength} is not a number.`); + } + if (!Number.isFinite(minRange)) { + throw new TypeError(`${minRange} is not a number.`); + } + if (!Number.isFinite(maxRange)) { + throw new TypeError(`${maxRange} is not a number.`); + } + const l = arr.length; + if (l < minLength || l > maxLength) { + throw new Error(`Unexpected array length ${l}.`); + } + let i = 0; + while (i < l) { + const v = arr[i] as number; + if (!Number.isFinite(v)) { + throw new TypeError(`${v} is not a number.`); + } else if (i < TRIA && validateRange && (v < minRange || v > maxRange)) { + throw new RangeError(`${v} is not between ${minRange} and ${maxRange}.`); + } else if (i === TRIA && (v < 0 || v > 1)) { + throw new RangeError(`${v} is not between 0 and 1.`); + } + i++; + } + if (alpha && l === TRIA) { + arr.push(1); + } + return arr; +}; + +/** + * normalize color components + * @param colorA - color components [v1, v2, v3, v4] + * @param colorB - color components [v1, v2, v3, v4] + * @param [skip] - skip validate + * @returns result - [colorA, colorB] + */ +export const normalizeColorComponents = ( + colorA: NumStrColorChannels, + colorB: NumStrColorChannels, + skip: boolean = false +): [ColorChannels, ColorChannels] => { + if (!Array.isArray(colorA)) { + throw new TypeError(`${colorA} is not an array.`); + } else if (colorA.length !== QUAD) { + throw new Error(`Unexpected array length ${colorA.length}.`); + } + if (!Array.isArray(colorB)) { + throw new TypeError(`${colorB} is not an array.`); + } else if (colorB.length !== QUAD) { + throw new Error(`Unexpected array length ${colorB.length}.`); + } + let i = 0; + while (i < QUAD) { + if (colorA[i] === NONE && colorB[i] === NONE) { + colorA[i] = 0; + colorB[i] = 0; + } else if (colorA[i] === NONE) { + colorA[i] = colorB[i] as number; + } else if (colorB[i] === NONE) { + colorB[i] = colorA[i] as number; + } + i++; + } + if (skip) { + return [colorA as ColorChannels, colorB as ColorChannels]; + } + const validatedColorA = validateColorComponents(colorA as ColorChannels, { + minLength: QUAD, + validateRange: false + }); + const validatedColorB = validateColorComponents(colorB as ColorChannels, { + minLength: QUAD, + validateRange: false + }); + return [validatedColorA as ColorChannels, validatedColorB as ColorChannels]; +}; + +/** + * transform matrix + * @param mtx - 3 * 3 matrix + * @param vct - vector + * @param [skip] - skip validate + * @returns TriColorChannels - [p1, p2, p3] + */ +export const transformMatrix = ( + mtx: ReadonlyColorMatrix, + vct: TriColorChannels, + skip: boolean = false +): TriColorChannels => { + if (!Array.isArray(mtx)) { + throw new TypeError(`${mtx} is not an array.`); + } else if (mtx.length !== TRIA) { + throw new Error(`Unexpected array length ${mtx.length}.`); + } else if (!skip) { + for (let i of mtx) { + i = validateColorComponents(i as TriColorChannels, { + maxLength: TRIA, + validateRange: false + }) as TriColorChannels; + } + } + const [[r1c1, r1c2, r1c3], [r2c1, r2c2, r2c3], [r3c1, r3c2, r3c3]] = mtx; + let v1, v2, v3; + if (skip) { + [v1, v2, v3] = vct; + } else { + [v1, v2, v3] = validateColorComponents(vct, { + maxLength: TRIA, + validateRange: false + }); + } + const p1 = r1c1 * v1 + r1c2 * v2 + r1c3 * v3; + const p2 = r2c1 * v1 + r2c2 * v2 + r2c3 * v3; + const p3 = r3c1 * v1 + r3c2 * v2 + r3c3 * v3; + return [p1, p2, p3]; +}; + +/** + * transform rgb to linear rgb + * @param rgb - [r, g, b] r|g|b: 0..255 + * @param [skip] - skip validate + * @returns TriColorChannels - [r, g, b] r|g|b: 0..1 + */ +export const transformRgbToLinearRgb = ( + rgb: TriColorChannels, + skip: boolean = false +): TriColorChannels => { + let rr, gg, bb; + if (skip) { + [rr, gg, bb] = rgb; + } else { + [rr, gg, bb] = validateColorComponents(rgb, { + maxLength: TRIA, + maxRange: MAX_RGB + }); + } + let r = rr / MAX_RGB; + let g = gg / MAX_RGB; + let b = bb / MAX_RGB; + const COND_POW = 0.04045; + if (r > COND_POW) { + r = Math.pow((r + LINEAR_OFFSET) / (1 + LINEAR_OFFSET), POW_LINEAR); + } else { + r /= LINEAR_COEF; + } + if (g > COND_POW) { + g = Math.pow((g + LINEAR_OFFSET) / (1 + LINEAR_OFFSET), POW_LINEAR); + } else { + g /= LINEAR_COEF; + } + if (b > COND_POW) { + b = Math.pow((b + LINEAR_OFFSET) / (1 + LINEAR_OFFSET), POW_LINEAR); + } else { + b /= LINEAR_COEF; + } + return [r, g, b]; +}; + +/** + * transform rgb to xyz + * @param rgb - [r, g, b] r|g|b: 0..255 + * @param [skip] - skip validate + * @returns TriColorChannels - [x, y, z] + */ +export const transformRgbToXyz = ( + rgb: TriColorChannels, + skip: boolean = false +): TriColorChannels => { + if (!skip) { + rgb = validateColorComponents(rgb, { + maxLength: TRIA, + maxRange: MAX_RGB + }) as TriColorChannels; + } + rgb = transformRgbToLinearRgb(rgb, true); + const xyz = transformMatrix(MATRIX_L_RGB_TO_XYZ, rgb, true); + return xyz; +}; + +/** + * transform rgb to xyz-d50 + * @param rgb - [r, g, b] r|g|b: 0..255 alpha: 0..1 + * @returns TriColorChannels - [x, y, z] + */ +export const transformRgbToXyzD50 = ( + rgb: TriColorChannels +): TriColorChannels => { + let xyz = transformRgbToXyz(rgb); + xyz = transformMatrix(MATRIX_D65_TO_D50, xyz, true); + return xyz; +}; + +/** + * transform linear rgb to rgb + * @param rgb - [r, g, b] r|g|b: 0..1 + * @param [round] - round result + * @returns TriColorChannels - [r, g, b] r|g|b: 0..255 + */ +export const transformLinearRgbToRgb = ( + rgb: TriColorChannels, + round: boolean = false +): TriColorChannels => { + let [r, g, b] = validateColorComponents(rgb, { + maxLength: TRIA + }); + const COND_POW = 809 / 258400; + if (r > COND_POW) { + r = Math.pow(r, 1 / POW_LINEAR) * (1 + LINEAR_OFFSET) - LINEAR_OFFSET; + } else { + r *= LINEAR_COEF; + } + r *= MAX_RGB; + if (g > COND_POW) { + g = Math.pow(g, 1 / POW_LINEAR) * (1 + LINEAR_OFFSET) - LINEAR_OFFSET; + } else { + g *= LINEAR_COEF; + } + g *= MAX_RGB; + if (b > COND_POW) { + b = Math.pow(b, 1 / POW_LINEAR) * (1 + LINEAR_OFFSET) - LINEAR_OFFSET; + } else { + b *= LINEAR_COEF; + } + b *= MAX_RGB; + return [ + round ? Math.round(r) : r, + round ? Math.round(g) : g, + round ? Math.round(b) : b + ]; +}; + +/** + * transform xyz to rgb + * @param xyz - [x, y, z] + * @param [skip] - skip validate + * @returns TriColorChannels - [r, g, b] r|g|b: 0..255 + */ +export const transformXyzToRgb = ( + xyz: TriColorChannels, + skip: boolean = false +): TriColorChannels => { + if (!skip) { + xyz = validateColorComponents(xyz, { + maxLength: TRIA, + validateRange: false + }) as TriColorChannels; + } + let [r, g, b] = transformMatrix(MATRIX_XYZ_TO_L_RGB, xyz, true); + [r, g, b] = transformLinearRgbToRgb( + [ + Math.min(Math.max(r, 0), 1), + Math.min(Math.max(g, 0), 1), + Math.min(Math.max(b, 0), 1) + ], + true + ); + return [r, g, b]; +}; + +/** + * transform xyz to xyz-d50 + * @param xyz - [x, y, z] + * @returns TriColorChannels - [x, y, z] + */ +export const transformXyzToXyzD50 = ( + xyz: TriColorChannels +): TriColorChannels => { + xyz = validateColorComponents(xyz, { + maxLength: TRIA, + validateRange: false + }) as TriColorChannels; + xyz = transformMatrix(MATRIX_D65_TO_D50, xyz, true); + return xyz; +}; + +/** + * transform xyz to hsl + * @param xyz - [x, y, z] + * @param [skip] - skip validate + * @returns TriColorChannels - [h, s, l] + */ +export const transformXyzToHsl = ( + xyz: TriColorChannels, + skip: boolean = false +): TriColorChannels => { + const [rr, gg, bb] = transformXyzToRgb(xyz, skip); + const r = rr / MAX_RGB; + const g = gg / MAX_RGB; + const b = bb / MAX_RGB; + const max = Math.max(r, g, b); + const min = Math.min(r, g, b); + const d = max - min; + const l = (max + min) * HALF * MAX_PCT; + let h, s; + if (Math.round(l) === 0 || Math.round(l) === MAX_PCT) { + h = 0; + s = 0; + } else { + s = (d / (1 - Math.abs(max + min - 1))) * MAX_PCT; + if (s === 0) { + h = 0; + } else { + switch (max) { + case r: + h = (g - b) / d; + break; + case g: + h = (b - r) / d + DUO; + break; + case b: + default: + h = (r - g) / d + QUAD; + break; + } + h = (h * SEXA) % DEG; + if (h < 0) { + h += DEG; + } + } + } + return [h, s, l]; +}; + +/** + * transform xyz to hwb + * @param xyz - [x, y, z] + * @param [skip] - skip validate + * @returns TriColorChannels - [h, w, b] + */ +export const transformXyzToHwb = ( + xyz: TriColorChannels, + skip: boolean = false +): TriColorChannels => { + const [r, g, b] = transformXyzToRgb(xyz, skip); + const wh = Math.min(r, g, b) / MAX_RGB; + const bk = 1 - Math.max(r, g, b) / MAX_RGB; + let h; + if (wh + bk === 1) { + h = 0; + } else { + [h] = transformXyzToHsl(xyz); + } + return [h, wh * MAX_PCT, bk * MAX_PCT]; +}; + +/** + * transform xyz to oklab + * @param xyz - [x, y, z] + * @param [skip] - skip validate + * @returns TriColorChannels - [l, a, b] + */ +export const transformXyzToOklab = ( + xyz: TriColorChannels, + skip: boolean = false +): TriColorChannels => { + if (!skip) { + xyz = validateColorComponents(xyz, { + maxLength: TRIA, + validateRange: false + }) as TriColorChannels; + } + const lms = transformMatrix(MATRIX_XYZ_TO_LMS, xyz, true); + const xyzLms = lms.map((c: number) => Math.cbrt(c)) as TriColorChannels; + let [l, a, b] = transformMatrix(MATRIX_LMS_TO_OKLAB, xyzLms, true); + l = Math.min(Math.max(l, 0), 1); + const lPct = Math.round(parseFloat(l.toFixed(QUAD)) * MAX_PCT); + if (lPct === 0 || lPct === MAX_PCT) { + a = 0; + b = 0; + } + return [l, a, b]; +}; + +/** + * transform xyz to oklch + * @param xyz - [x, y, z] + * @param [skip] - skip validate + * @returns TriColorChannels - [l, c, h] + */ +export const transformXyzToOklch = ( + xyz: TriColorChannels, + skip: boolean = false +): TriColorChannels => { + const [l, a, b] = transformXyzToOklab(xyz, skip); + let c, h; + const lPct = Math.round(parseFloat(l.toFixed(QUAD)) * MAX_PCT); + if (lPct === 0 || lPct === MAX_PCT) { + c = 0; + h = 0; + } else { + c = Math.max(Math.sqrt(Math.pow(a, POW_SQR) + Math.pow(b, POW_SQR)), 0); + if (parseFloat(c.toFixed(QUAD)) === 0) { + h = 0; + } else { + h = (Math.atan2(b, a) * DEG_HALF) / Math.PI; + if (h < 0) { + h += DEG; + } + } + } + return [l, c, h]; +}; + +/** + * transform xyz D50 to rgb + * @param xyz - [x, y, z] + * @param [skip] - skip validate + * @returns TriColorChannels - [r, g, b] r|g|b: 0..255 + */ +export const transformXyzD50ToRgb = ( + xyz: TriColorChannels, + skip: boolean = false +): TriColorChannels => { + if (!skip) { + xyz = validateColorComponents(xyz, { + maxLength: TRIA, + validateRange: false + }) as TriColorChannels; + } + const xyzD65 = transformMatrix(MATRIX_D50_TO_D65, xyz, true); + const rgb = transformXyzToRgb(xyzD65, true); + return rgb; +}; + +/** + * transform xyz-d50 to lab + * @param xyz - [x, y, z] + * @param [skip] - skip validate + * @returns TriColorChannels - [l, a, b] + */ +export const transformXyzD50ToLab = ( + xyz: TriColorChannels, + skip: boolean = false +): TriColorChannels => { + if (!skip) { + xyz = validateColorComponents(xyz, { + maxLength: TRIA, + validateRange: false + }) as TriColorChannels; + } + const xyzD50 = xyz.map((val: number, i: number) => val / (D50[i] as number)); + const [f0, f1, f2] = xyzD50.map((val: number) => + val > LAB_EPSILON ? Math.cbrt(val) : (LAB_KAPPA * val + 16) / LAB_L + ) as TriColorChannels; + const l = Math.min(Math.max(LAB_L * f1 - HEX, 0), MAX_PCT); + let a, b; + if (l === 0 || l === MAX_PCT) { + a = 0; + b = 0; + } else { + a = (f0 - f1) * LAB_A; + b = (f1 - f2) * LAB_B; + } + return [l, a, b]; +}; + +/** + * transform xyz-d50 to lch + * @param xyz - [x, y, z] + * @param [skip] - skip validate + * @returns TriColorChannels - [l, c, h] + */ +export const transformXyzD50ToLch = ( + xyz: TriColorChannels, + skip: boolean = false +): TriColorChannels => { + const [l, a, b] = transformXyzD50ToLab(xyz, skip); + let c, h; + if (l === 0 || l === MAX_PCT) { + c = 0; + h = 0; + } else { + c = Math.max(Math.sqrt(Math.pow(a, POW_SQR) + Math.pow(b, POW_SQR)), 0); + h = (Math.atan2(b, a) * DEG_HALF) / Math.PI; + if (h < 0) { + h += DEG; + } + } + return [l, c, h]; +}; diff --git a/node_modules/@asamuzakjp/css-color/src/resolvers/color-mix.ts b/node_modules/@asamuzakjp/css-color/src/resolvers/color-mix.ts new file mode 100644 index 0000000..3e00cd8 --- /dev/null +++ b/node_modules/@asamuzakjp/css-color/src/resolvers/color-mix.ts @@ -0,0 +1,896 @@ +/** + * color-mix + */ + +import { + convertColorToHsl, + convertColorToHwb, + convertColorToLab, + convertColorToLch, + convertColorToLinearRgb, + convertColorToOklab, + convertColorToOklch, + convertColorToRgb, + convertColorToXyz +} from '../converters/convert-color'; +import { + ChannelNoneFlags, + ColorAndPct, + ColorChannels, + ColorFormat, + ColorResolverFn, + ColorSpace, + ColorSpaceParseResult, + ComputedColorChannels, + InterpolatedComponents, + NormalizedPercentages, + NumStrColorChannels, + Options, + SpecifiedColorChannels, + TriColorChannels +} from '../typedef'; +import { + normalizeColorComponents, + transformXyzD50ToRgb, + transformXyzToRgb +} from '../matrix/transform'; +import { parseColorFunc, parseColorValue } from '../resolvers/parse-color'; +import { resolveColorValue } from '../resolvers/resolve-color'; +import { createCacheKey, getCache, setCache } from '../utils/cache'; +import { isString } from '../utils/common'; +import { + cacheInvalidColorValue, + interpolateHue, + roundToPrecision, + splitValue +} from '../utils/util'; + +/* constants */ +import { + DEG, + FN_COLOR, + FN_LIGHT_DARK, + FN_MIX, + HALF, + HEX, + MAX_PCT, + MAX_RGB, + NONE, + VAL_COMP, + VAL_MIX, + VAL_SPEC +} from '../utils/constant'; +const NAMESPACE = 'color-mix'; + +/** + * parse color space + * @param arg - color space argument string + * @returns object containing colorSpace and hueArc, or null if invalid + */ +export const parseColorSpace = (arg: string): ColorSpaceParseResult | null => { + const csTokens = splitValue(arg).filter(Boolean); + if (csTokens[0] !== 'in' || csTokens.length < 2) { + return null; + } + const hueIndex = csTokens.indexOf('hue'); + if (csTokens.length > 2 && hueIndex > -1) { + return { + colorSpace: csTokens[1] as string, + hueArc: csTokens.slice(2, hueIndex).join(' ') + }; + } + return { + colorSpace: csTokens.slice(1).join(' '), + hueArc: '' + }; +}; + +/** + * parse color and percentage + * @param arg - color and percentage argument string + * @returns object containing color string and percentage string + */ +export const parseColorAndPct = (arg: string): ColorAndPct => { + const tokens = splitValue(arg).filter(Boolean); + let color = ''; + let pct = ''; + if (tokens.length === 1) { + color = tokens[0] as string; + } else { + const isPct = (t: string) => { + return t.endsWith('%') || t.startsWith('calc(') || t === 'none'; + }; + if (isPct(tokens[tokens.length - 1] as string)) { + pct = tokens.pop() as string; + color = tokens.join(' '); + } else if (isPct(tokens[0] as string)) { + pct = tokens.shift() as string; + color = tokens.join(' '); + } else { + color = tokens.join(' '); + } + } + return { color, pct }; +}; + +/** + * resolve if nested function + * @param colorStr - color string + * @param opt - options + * @param resolver - resolver function + * @returns resolved color string or original string + */ +export const resolveIfNested = ( + colorStr: string, + opt: Options, + resolver: ColorResolverFn +): string => { + let current = colorStr; + while ( + isString(current) && + (current.startsWith('color-mix(') || + current.startsWith('var(') || + current.startsWith('light-dark(')) + ) { + const resolved = resolver(current, { + ...opt, + format: opt.format === VAL_SPEC ? opt.format : VAL_COMP + }); + if (!resolved) { + break; + } + if (Array.isArray(resolved)) { + const [cs, v1, v2, v3, v4] = resolved; + if (v4 === 1 || v4 === undefined) { + current = + cs === 'rgb' + ? `${cs}(${v1}, ${v2}, ${v3})` + : `${cs}(${v1} ${v2} ${v3})`; + } else { + current = + cs === 'rgb' + ? `${cs}a(${v1}, ${v2}, ${v3}, ${v4})` + : `${cs}(${v1} ${v2} ${v3} / ${v4})`; + } + break; + } + if (typeof resolved === 'string') { + if (resolved === current) { + break; + } + current = resolved; + } else { + break; + } + } + return current; +}; + +/** + * normalize percentages + * @param pctA - percentage for color A + * @param pctB - percentage for color B + * @returns object containing normalized percentages and multiplier, or null if invalid + */ +export const normalizePercentages = ( + pctA: string, + pctB: string +): NormalizedPercentages | null => { + let pA, pB, m; + if (pctA && pctB) { + const p1 = parseFloat(pctA) / MAX_PCT; + const p2 = parseFloat(pctB) / MAX_PCT; + if ( + Number.isNaN(p1) || + Number.isNaN(p2) || + p1 < 0 || + p1 > 1 || + p2 < 0 || + p2 > 1 || + (p1 === 0 && p2 === 0) + ) { + return null; + } + const factor = p1 + p2; + pA = p1 / factor; + pB = p2 / factor; + m = factor < 1 ? factor : 1; + } else { + if (pctA) { + const numA = parseFloat(pctA); + if (Number.isNaN(numA) || numA < 0 || numA > MAX_PCT) { + return null; + } + pA = numA / MAX_PCT; + pB = (MAX_PCT - numA) / MAX_PCT; + } else if (pctB) { + const numB = parseFloat(pctB); + if (Number.isNaN(numB) || numB < 0 || numB > MAX_PCT) { + return null; + } + pB = numB / MAX_PCT; + pA = (MAX_PCT - numB) / MAX_PCT; + } else { + pA = HALF; + pB = HALF; + } + m = 1; + } + return { pA, pB, m }; +}; + +/** + * process color + * @param colorStr - color string + * @param opt - options + * @returns specified color string + */ +export const processColor = (colorStr: string, opt: Options): string => { + if (!isString(colorStr)) { + return ''; + } + if (colorStr.startsWith(FN_MIX) || colorStr.startsWith(FN_LIGHT_DARK)) { + return colorStr; + } + if (colorStr.startsWith(FN_COLOR)) { + const [cs, v1, v2, v3, v4] = parseColorFunc( + colorStr, + opt + ) as SpecifiedColorChannels; + if (v4 === 1) { + return `color(${cs} ${v1} ${v2} ${v3})`; + } else { + return `color(${cs} ${v1} ${v2} ${v3} / ${v4})`; + } + } + const val = parseColorValue(colorStr, opt); + if (Array.isArray(val)) { + const [cs, v1, v2, v3, v4] = val; + if (v4 === 1) { + if (cs === 'rgb') { + return `${cs}(${v1}, ${v2}, ${v3})`; + } + return `${cs}(${v1} ${v2} ${v3})`; + } else { + if (cs === 'rgb') { + return `${cs}a(${v1}, ${v2}, ${v3}, ${v4})`; + } + return `${cs}(${v1} ${v2} ${v3} / ${v4})`; + } + } + if (!isString(val) || !val) { + return ''; + } + return val as string; +}; + +/** + * build specified color mix + * @param colorSpace - color space + * @param hueArc - hue interpolation method + * @param colorA - first color + * @param pctA - percentage for first color + * @param colorB - second color + * @param pctB - percentage for second color + * @param opt - options + * @returns specified value string for color-mix() + */ +export const buildSpecifiedColorMix = ( + colorSpace: string, + hueArc: string, + colorA: string, + pctA: string, + colorB: string, + pctB: string, + opt: Options +): string => { + let valueA = processColor(colorA, opt); + let valueB = processColor(colorB, opt); + if (!valueA || !valueB) { + return ''; + } + if (pctA && pctB) { + valueA += ` ${parseFloat(pctA)}%`; + valueB += ` ${parseFloat(pctB)}%`; + } else if (pctA) { + const numPctA = parseFloat(pctA); + if (numPctA !== MAX_PCT * HALF) { + valueA += ` ${numPctA}%`; + } + } else if (pctB) { + const numPctA = MAX_PCT - parseFloat(pctB); + if (numPctA !== MAX_PCT * HALF) { + valueA += ` ${numPctA}%`; + } + } + if (hueArc) { + return `color-mix(in ${colorSpace} ${hueArc} hue, ${valueA}, ${valueB})`; + } + return `color-mix(in ${colorSpace}, ${valueA}, ${valueB})`; +}; + +/** + * Perform alpha-weighted interpolation for color components. + * @param compA - color components for color A + * @param compB - color components for color B + * @param alphaA - alpha channel value for color A + * @param alphaB - alpha channel value for color B + * @param pA - normalized ratio for first color + * @param pB - normalized ratio for second color + * @returns object containing interpolated components and combined alpha + */ +export const interpolateComponents = ( + compA: TriColorChannels, + compB: TriColorChannels, + alphaA: number, + alphaB: number, + pA: number, + pB: number +): InterpolatedComponents => { + const factorA = alphaA * pA; + const factorB = alphaB * pB; + const alpha = factorA + factorB; + let comps: TriColorChannels; + if (alpha === 0) { + comps = [ + compA[0] * pA + compB[0] * pB, + compA[1] * pA + compB[1] * pB, + compA[2] * pA + compB[2] * pB + ]; + } else { + comps = [ + (compA[0] * factorA + compB[0] * factorB) / alpha, + (compA[1] * factorA + compB[1] * factorB) / alpha, + (compA[2] * factorA + compB[2] * factorB) / alpha + ]; + } + return { comps, alpha }; +}; + +/** + * Format computed color into specified or computed channel array. + * @param colorSpace - target color space + * @param comps - 3-channel color components + * @param nones - boolean flags indicating if channels are 'none' + * @param alpha - calculated alpha channel value + * @param m - multiplier factor + * @param format - output format option + * @param rgbOverride - optional pre-calculated RGB channels + * @returns specified color channels array + */ +export const formatMixedColor = ( + colorSpace: ColorSpace, + comps: TriColorChannels, + nones: ChannelNoneFlags, + alpha: number, + m: number, + format: ColorFormat, + rgbOverride?: TriColorChannels +): SpecifiedColorChannels => { + const [c1None, c2None, c3None, alphaNone] = nones; + const [c1, c2, c3] = comps; + if (format === VAL_COMP) { + return [ + colorSpace, + c1None ? NONE : roundToPrecision(c1, HEX), + c2None ? NONE : roundToPrecision(c2, HEX), + c3None ? NONE : roundToPrecision(c3, HEX), + alphaNone ? NONE : alpha * m + ]; + } + const [r, g, b] = rgbOverride ?? comps; + return [ + 'rgb', + Math.round(r), + Math.round(g), + Math.round(b), + parseFloat((alpha * m).toFixed(3)) + ]; +}; + +/** + * Fetch raw channels or fallback for currentcolor + * @param color - color input string + * @param convertFn - conversion function + * @param opt - conversion options + * @returns color channel values or null if invalid + */ +export const getRawChannels = ( + color: string | NumStrColorChannels, + convertFn: (c: string, opt: any) => any, + opt: any +): NumStrColorChannels | null => { + if (Array.isArray(color)) { + return color as NumStrColorChannels; + } + if (color === 'currentcolor') { + return [NONE, NONE, NONE, NONE]; + } + return convertFn(color, opt); +}; + +/** + * Mix colors in srgb or srgb-linear space. + * @param colorSpace - color space name ('srgb' | 'srgb-linear') + * @param colorA - first color string + * @param colorB - second color string + * @param pA - ratio for first color + * @param pB - ratio for second color + * @param format - output format + * @param m - multiplier factor + * @returns mixed color channels or null + */ +export const mixSrgbSpace = ( + colorSpace: ColorSpace, + colorA: string, + colorB: string, + pA: number, + pB: number, + format: ColorFormat, + m: number +): SpecifiedColorChannels | null => { + const convertFn = + colorSpace === 'srgb' ? convertColorToRgb : convertColorToLinearRgb; + const rgbA = getRawChannels(colorA, convertFn, { + colorSpace, + format: VAL_MIX + }); + const rgbB = getRawChannels(colorB, convertFn, { + colorSpace, + format: VAL_MIX + }); + if (!rgbA || !rgbB) { + return null; + } + const [rrA, ggA, bbA, aaA] = rgbA; + const [rrB, ggB, bbB, aaB] = rgbB; + const nones: [boolean, boolean, boolean, boolean] = [ + rrA === NONE && rrB === NONE, + ggA === NONE && ggB === NONE, + bbA === NONE && bbB === NONE, + aaA === NONE && aaB === NONE + ]; + const [[rA, gA, bA, alphaA], [rB, gB, bB, alphaB]] = normalizeColorComponents( + rgbA, + rgbB, + true + ); + const { comps, alpha } = interpolateComponents( + [rA, gA, bA], + [rB, gB, bB], + alphaA, + alphaB, + pA, + pB + ); + const rgbOverride: [number, number, number] = [ + comps[0] * MAX_RGB, + comps[1] * MAX_RGB, + comps[2] * MAX_RGB + ]; + return formatMixedColor( + colorSpace, + comps, + nones, + alpha, + m, + format, + rgbOverride + ); +}; + +/** + * Mix colors in xyz, xyz-d50, or xyz-d65 space. + * @param colorSpace - color space name + * @param colorA - first color string + * @param colorB - second color string + * @param pA - ratio for first color + * @param pB - ratio for second color + * @param format - output format + * @param m - multiplier factor + * @returns mixed color channels or null + */ +export const mixXyzSpace = ( + colorSpace: string, + colorA: string, + colorB: string, + pA: number, + pB: number, + format: string, + m: number +): SpecifiedColorChannels | null => { + const isD50 = colorSpace === 'xyz-d50'; + const opt = { colorSpace, d50: isD50, format: VAL_MIX }; + const xyzA = getRawChannels(colorA, convertColorToXyz, opt); + const xyzB = getRawChannels(colorB, convertColorToXyz, opt); + if (!xyzA || !xyzB) { + return null; + } + const [xxA, yyA, zzA, aaA] = xyzA; + const [xxB, yyB, zzB, aaB] = xyzB; + const nones: [boolean, boolean, boolean, boolean] = [ + xxA === NONE && xxB === NONE, + yyA === NONE && yyB === NONE, + zzA === NONE && zzB === NONE, + aaA === NONE && aaB === NONE + ]; + const [[xA, yA, zA, alphaA], [xB, yB, zB, alphaB]] = normalizeColorComponents( + xyzA, + xyzB, + true + ); + const { comps, alpha } = interpolateComponents( + [xA, yA, zA], + [xB, yB, zB], + alphaA, + alphaB, + pA, + pB + ); + const rgb = isD50 + ? transformXyzD50ToRgb(comps, true) + : transformXyzToRgb(comps, true); + return formatMixedColor(colorSpace, comps, nones, alpha, m, format, rgb); +}; + +/** + * Mix colors in hsl or hwb space. + * @param colorSpace - color space name ('hsl' | 'hwb') + * @param hueArc - hue interpolation method + * @param colorA - first color string + * @param colorB - second color string + * @param pA - ratio for first color + * @param pB - ratio for second color + * @param format - output format + * @param m - multiplier factor + * @returns mixed color channels or null + */ +export const mixHslHwbSpace = ( + colorSpace: string, + hueArc: string, + colorA: string, + colorB: string, + pA: number, + pB: number, + format: string, + m: number +): SpecifiedColorChannels | null => { + const convertFn = + colorSpace === 'hsl' ? convertColorToHsl : convertColorToHwb; + const opt = { colorSpace, format: VAL_MIX }; + const hslA = getRawChannels(colorA, convertFn, opt); + const hslB = getRawChannels(colorB, convertFn, opt); + if (!hslA || !hslB) { + return null; + } + const [, , , aaA] = hslA; + const [, , , aaB] = hslB; + const nones: [boolean, boolean, boolean, boolean] = [ + false, + false, + false, + aaA === NONE && aaB === NONE + ]; + let [[hA, sA, lA, alphaA], [hB, sB, lB, alphaB]] = normalizeColorComponents( + hslA, + hslB, + true + ); + if (hueArc) { + [hA, hB] = interpolateHue(hA, hB, hueArc); + } + const factorA = alphaA * pA; + const factorB = alphaB * pB; + const alpha = factorA + factorB; + const h = (hA * pA + hB * pB) % DEG; + let s: number, l: number; + if (alpha === 0) { + s = sA * pA + sB * pB; + l = lA * pA + lB * pB; + } else { + s = (sA * factorA + sB * factorB) / alpha; + l = (lA * factorA + lB * factorB) / alpha; + } + const [r, g, b] = convertColorToRgb( + `${colorSpace}(${h} ${s} ${l})` + ) as ColorChannels; + const compsForValComp: TriColorChannels = [ + r / MAX_RGB, + g / MAX_RGB, + b / MAX_RGB + ]; + const targetSpace = format === VAL_COMP ? 'srgb' : colorSpace; + return formatMixedColor( + targetSpace, + compsForValComp, + nones, + alpha, + m, + format, + [r, g, b] + ); +}; + +/** + * Mix colors in lch or oklch space. + * @param colorSpace - color space name ('lch' | 'oklch') + * @param hueArc - hue interpolation method + * @param colorA - first color string + * @param colorB - second color string + * @param pA - ratio for first color + * @param pB - ratio for second color + * @param format - output format + * @param m - multiplier factor + * @returns mixed color channels or null + */ +export const mixLchSpace = ( + colorSpace: string, + hueArc: string, + colorA: string, + colorB: string, + pA: number, + pB: number, + format: string, + m: number +): SpecifiedColorChannels | null => { + const convertFn = + colorSpace === 'lch' ? convertColorToLch : convertColorToOklch; + const opt = { colorSpace, format: VAL_MIX }; + const lchA = getRawChannels(colorA, convertFn, opt); + const lchB = getRawChannels(colorB, convertFn, opt); + if (!lchA || !lchB) { + return null; + } + const [llA, ccA, hhA, aaA] = lchA; + const [llB, ccB, hhB, aaB] = lchB; + const nones: [boolean, boolean, boolean, boolean] = [ + llA === NONE && llB === NONE, + ccA === NONE && ccB === NONE, + hhA === NONE && hhB === NONE, + aaA === NONE && aaB === NONE + ]; + let [[lA, cA, hA, alphaA], [lB, cB, hB, alphaB]] = normalizeColorComponents( + lchA, + lchB, + true + ); + if (hueArc) { + [hA, hB] = interpolateHue(hA, hB, hueArc); + } + const factorA = alphaA * pA; + const factorB = alphaB * pB; + const alpha = factorA + factorB; + const h = (hA * pA + hB * pB) % DEG; + let l: number, c: number; + if (alpha === 0) { + l = lA * pA + lB * pB; + c = cA * pA + cB * pB; + } else { + l = (lA * factorA + lB * factorB) / alpha; + c = (cA * factorA + cB * factorB) / alpha; + } + let rgbOverride: [number, number, number] | undefined; + if (format !== VAL_COMP) { + const [, r, g, b] = resolveColorValue( + `${colorSpace}(${l} ${c} ${h})` + ) as ComputedColorChannels; + rgbOverride = [r, g, b]; + } + return formatMixedColor( + colorSpace, + [l, c, h], + nones, + alpha, + m, + format, + rgbOverride + ); +}; + +/** + * Mix colors in lab or oklab space. + * @param colorSpace - color space name ('lab' | 'oklab') + * @param colorA - first color string + * @param colorB - second color string + * @param pA - ratio for first color + * @param pB - ratio for second color + * @param format - output format + * @param m - multiplier factor + * @returns mixed color channels or null + */ +export const mixLabSpace = ( + colorSpace: string, + colorA: string, + colorB: string, + pA: number, + pB: number, + format: string, + m: number +): SpecifiedColorChannels | null => { + const convertFn = + colorSpace === 'lab' ? convertColorToLab : convertColorToOklab; + const opt = { colorSpace, format: VAL_MIX }; + const labA = getRawChannels(colorA, convertFn, opt); + const labB = getRawChannels(colorB, convertFn, opt); + if (!labA || !labB) { + return null; + } + const [llA, aaA, bbA, alA] = labA; + const [llB, aaB, bbB, alB] = labB; + const nones: [boolean, boolean, boolean, boolean] = [ + llA === NONE && llB === NONE, + aaA === NONE && aaB === NONE, + bbA === NONE && bbB === NONE, + alA === NONE && alB === NONE + ]; + const [[lA, aA, bA, alphaA], [lB, aB, bB, alphaB]] = normalizeColorComponents( + labA, + labB, + true + ); + const { comps, alpha } = interpolateComponents( + [lA, aA, bA], + [lB, aB, bB], + alphaA, + alphaB, + pA, + pB + ); + let rgbOverride: [number, number, number] | undefined; + if (format !== VAL_COMP) { + const [, r, g, b] = resolveColorValue( + `${colorSpace}(${comps[0]} ${comps[1]} ${comps[2]})` + ) as ComputedColorChannels; + rgbOverride = [r, g, b]; + } + return formatMixedColor( + colorSpace, + comps, + nones, + alpha, + m, + format, + rgbOverride + ); +}; + +/** + * compute mixed color + * @param colorSpace - color space + * @param hueArc - hue interpolation method + * @param colorA - first color + * @param colorB - second color + * @param pA - normalized ratio for first color + * @param pB - normalized ratio for second color + * @param m - multiplier + * @param format - output format + * @param nullable - is nullable + * @param cacheKey - cache key + * @returns computed color channels or null + */ +export const computeMixedColor = ( + colorSpace: string, + hueArc: string, + colorA: string, + colorB: string, + pA: number, + pB: number, + m: number, + format: string, + nullable: boolean, + cacheKey: string +): SpecifiedColorChannels | null => { + let res: SpecifiedColorChannels | null = null; + if (/^srgb(?:-linear)?$/.test(colorSpace)) { + res = mixSrgbSpace(colorSpace, colorA, colorB, pA, pB, format, m); + } else if (/^xyz(?:-d65|-d50)?$/.test(colorSpace)) { + res = mixXyzSpace(colorSpace, colorA, colorB, pA, pB, format, m); + } else if (/^h(?:sl|wb)$/.test(colorSpace)) { + res = mixHslHwbSpace(colorSpace, hueArc, colorA, colorB, pA, pB, format, m); + } else if (/^(?:ok)?lch$/.test(colorSpace)) { + res = mixLchSpace(colorSpace, hueArc, colorA, colorB, pA, pB, format, m); + } else if (/^(?:ok)?lab$/.test(colorSpace)) { + res = mixLabSpace(colorSpace, colorA, colorB, pA, pB, format, m); + } + if (res === null) { + return cacheInvalidColorValue(cacheKey, format, nullable) as null; + } + return res; +}; + +/** + * resolve color-mix() + * @param value - color-mix color value + * @param opt - options + * @param resolver - resolver function + * @returns resolved color - [cs, v1, v2, v3, alpha], '(empty)', null + */ +export const resolveColorMix = ( + value: string, + opt: Options = {}, + resolver: ColorResolverFn = () => null +): SpecifiedColorChannels | string | null => { + if (!isString(value)) { + throw new TypeError(`${value} is not a string.`); + } + value = value.toLowerCase().trim(); + const { format = '', nullable = false } = opt; + const cacheKey: string = createCacheKey( + { namespace: NAMESPACE, name: 'resolveColorMix', value }, + opt + ); + const cachedResult = getCache(cacheKey); + if (cachedResult !== false) { + const { item } = cachedResult; + if (Array.isArray(item)) { + return [...item] as SpecifiedColorChannels; + } + if (isString(item)) { + return item; + } + return null; + } + if (!value.startsWith('color-mix(') || !value.endsWith(')')) { + return cacheInvalidColorValue(cacheKey, format, nullable); + } + const innerContent = value.slice(10, -1).trim(); + const args = splitValue(innerContent, { delimiter: ',' }).map(s => s.trim()); + if (args.length !== 3) { + return cacheInvalidColorValue(cacheKey, format, nullable); + } + // 1. Parse Color Space + const csResult = parseColorSpace(args[0] as string); + if (!csResult) { + return cacheInvalidColorValue(cacheKey, format, nullable); + } + let { colorSpace, hueArc } = csResult; + // 2. Extract Color and Percentages + let { color: colorA, pct: pctA } = parseColorAndPct(args[1] as string); + let { color: colorB, pct: pctB } = parseColorAndPct(args[2] as string); + // 3. Resolve Nested Functions + colorA = resolveIfNested(colorA, opt, resolver); + colorB = resolveIfNested(colorB, opt, resolver); + // 4. Normalize Percentages + const pResult = normalizePercentages(pctA, pctB); + if (!pResult) { + return cacheInvalidColorValue(cacheKey, format, nullable); + } + const { pA, pB, m } = pResult; + if (colorSpace === 'xyz') { + colorSpace = 'xyz-d65'; + } + // 5. Format & Return + if (format === VAL_SPEC) { + const specifiedRes = buildSpecifiedColorMix( + colorSpace, + hueArc, + colorA, + pctA, + colorB, + pctB, + opt + ); + if (!specifiedRes) { + const invalidRes = cacheInvalidColorValue(cacheKey, format, nullable); + return invalidRes; + } + setCache(cacheKey, specifiedRes); + return specifiedRes; + } + const computedRes = computeMixedColor( + colorSpace, + hueArc, + colorA, + colorB, + pA, + pB, + m, + format, + nullable, + cacheKey + ); + if (computedRes) { + setCache(cacheKey, computedRes); + } + return computedRes; +}; diff --git a/node_modules/@asamuzakjp/css-color/src/resolvers/named-color.ts b/node_modules/@asamuzakjp/css-color/src/resolvers/named-color.ts new file mode 100644 index 0000000..2f6e0b7 --- /dev/null +++ b/node_modules/@asamuzakjp/css-color/src/resolvers/named-color.ts @@ -0,0 +1,159 @@ +/** + * named-color + */ +import type { ReadonlyTriColorChannels } from '../typedef'; +/** + * named colors + */ +export const NAMED_COLORS = { + aliceblue: [0xf0, 0xf8, 0xff], + antiquewhite: [0xfa, 0xeb, 0xd7], + aqua: [0x00, 0xff, 0xff], + aquamarine: [0x7f, 0xff, 0xd4], + azure: [0xf0, 0xff, 0xff], + beige: [0xf5, 0xf5, 0xdc], + bisque: [0xff, 0xe4, 0xc4], + black: [0x00, 0x00, 0x00], + blanchedalmond: [0xff, 0xeb, 0xcd], + blue: [0x00, 0x00, 0xff], + blueviolet: [0x8a, 0x2b, 0xe2], + brown: [0xa5, 0x2a, 0x2a], + burlywood: [0xde, 0xb8, 0x87], + cadetblue: [0x5f, 0x9e, 0xa0], + chartreuse: [0x7f, 0xff, 0x00], + chocolate: [0xd2, 0x69, 0x1e], + coral: [0xff, 0x7f, 0x50], + cornflowerblue: [0x64, 0x95, 0xed], + cornsilk: [0xff, 0xf8, 0xdc], + crimson: [0xdc, 0x14, 0x3c], + cyan: [0x00, 0xff, 0xff], + darkblue: [0x00, 0x00, 0x8b], + darkcyan: [0x00, 0x8b, 0x8b], + darkgoldenrod: [0xb8, 0x86, 0x0b], + darkgray: [0xa9, 0xa9, 0xa9], + darkgreen: [0x00, 0x64, 0x00], + darkgrey: [0xa9, 0xa9, 0xa9], + darkkhaki: [0xbd, 0xb7, 0x6b], + darkmagenta: [0x8b, 0x00, 0x8b], + darkolivegreen: [0x55, 0x6b, 0x2f], + darkorange: [0xff, 0x8c, 0x00], + darkorchid: [0x99, 0x32, 0xcc], + darkred: [0x8b, 0x00, 0x00], + darksalmon: [0xe9, 0x96, 0x7a], + darkseagreen: [0x8f, 0xbc, 0x8f], + darkslateblue: [0x48, 0x3d, 0x8b], + darkslategray: [0x2f, 0x4f, 0x4f], + darkslategrey: [0x2f, 0x4f, 0x4f], + darkturquoise: [0x00, 0xce, 0xd1], + darkviolet: [0x94, 0x00, 0xd3], + deeppink: [0xff, 0x14, 0x93], + deepskyblue: [0x00, 0xbf, 0xff], + dimgray: [0x69, 0x69, 0x69], + dimgrey: [0x69, 0x69, 0x69], + dodgerblue: [0x1e, 0x90, 0xff], + firebrick: [0xb2, 0x22, 0x22], + floralwhite: [0xff, 0xfa, 0xf0], + forestgreen: [0x22, 0x8b, 0x22], + fuchsia: [0xff, 0x00, 0xff], + gainsboro: [0xdc, 0xdc, 0xdc], + ghostwhite: [0xf8, 0xf8, 0xff], + gold: [0xff, 0xd7, 0x00], + goldenrod: [0xda, 0xa5, 0x20], + gray: [0x80, 0x80, 0x80], + green: [0x00, 0x80, 0x00], + greenyellow: [0xad, 0xff, 0x2f], + grey: [0x80, 0x80, 0x80], + honeydew: [0xf0, 0xff, 0xf0], + hotpink: [0xff, 0x69, 0xb4], + indianred: [0xcd, 0x5c, 0x5c], + indigo: [0x4b, 0x00, 0x82], + ivory: [0xff, 0xff, 0xf0], + khaki: [0xf0, 0xe6, 0x8c], + lavender: [0xe6, 0xe6, 0xfa], + lavenderblush: [0xff, 0xf0, 0xf5], + lawngreen: [0x7c, 0xfc, 0x00], + lemonchiffon: [0xff, 0xfa, 0xcd], + lightblue: [0xad, 0xd8, 0xe6], + lightcoral: [0xf0, 0x80, 0x80], + lightcyan: [0xe0, 0xff, 0xff], + lightgoldenrodyellow: [0xfa, 0xfa, 0xd2], + lightgray: [0xd3, 0xd3, 0xd3], + lightgreen: [0x90, 0xee, 0x90], + lightgrey: [0xd3, 0xd3, 0xd3], + lightpink: [0xff, 0xb6, 0xc1], + lightsalmon: [0xff, 0xa0, 0x7a], + lightseagreen: [0x20, 0xb2, 0xaa], + lightskyblue: [0x87, 0xce, 0xfa], + lightslategray: [0x77, 0x88, 0x99], + lightslategrey: [0x77, 0x88, 0x99], + lightsteelblue: [0xb0, 0xc4, 0xde], + lightyellow: [0xff, 0xff, 0xe0], + lime: [0x00, 0xff, 0x00], + limegreen: [0x32, 0xcd, 0x32], + linen: [0xfa, 0xf0, 0xe6], + magenta: [0xff, 0x00, 0xff], + maroon: [0x80, 0x00, 0x00], + mediumaquamarine: [0x66, 0xcd, 0xaa], + mediumblue: [0x00, 0x00, 0xcd], + mediumorchid: [0xba, 0x55, 0xd3], + mediumpurple: [0x93, 0x70, 0xdb], + mediumseagreen: [0x3c, 0xb3, 0x71], + mediumslateblue: [0x7b, 0x68, 0xee], + mediumspringgreen: [0x00, 0xfa, 0x9a], + mediumturquoise: [0x48, 0xd1, 0xcc], + mediumvioletred: [0xc7, 0x15, 0x85], + midnightblue: [0x19, 0x19, 0x70], + mintcream: [0xf5, 0xff, 0xfa], + mistyrose: [0xff, 0xe4, 0xe1], + moccasin: [0xff, 0xe4, 0xb5], + navajowhite: [0xff, 0xde, 0xad], + navy: [0x00, 0x00, 0x80], + oldlace: [0xfd, 0xf5, 0xe6], + olive: [0x80, 0x80, 0x00], + olivedrab: [0x6b, 0x8e, 0x23], + orange: [0xff, 0xa5, 0x00], + orangered: [0xff, 0x45, 0x00], + orchid: [0xda, 0x70, 0xd6], + palegoldenrod: [0xee, 0xe8, 0xaa], + palegreen: [0x98, 0xfb, 0x98], + paleturquoise: [0xaf, 0xee, 0xee], + palevioletred: [0xdb, 0x70, 0x93], + papayawhip: [0xff, 0xef, 0xd5], + peachpuff: [0xff, 0xda, 0xb9], + peru: [0xcd, 0x85, 0x3f], + pink: [0xff, 0xc0, 0xcb], + plum: [0xdd, 0xa0, 0xdd], + powderblue: [0xb0, 0xe0, 0xe6], + purple: [0x80, 0x00, 0x80], + rebeccapurple: [0x66, 0x33, 0x99], + red: [0xff, 0x00, 0x00], + rosybrown: [0xbc, 0x8f, 0x8f], + royalblue: [0x41, 0x69, 0xe1], + saddlebrown: [0x8b, 0x45, 0x13], + salmon: [0xfa, 0x80, 0x72], + sandybrown: [0xf4, 0xa4, 0x60], + seagreen: [0x2e, 0x8b, 0x57], + seashell: [0xff, 0xf5, 0xee], + sienna: [0xa0, 0x52, 0x2d], + silver: [0xc0, 0xc0, 0xc0], + skyblue: [0x87, 0xce, 0xeb], + slateblue: [0x6a, 0x5a, 0xcd], + slategray: [0x70, 0x80, 0x90], + slategrey: [0x70, 0x80, 0x90], + snow: [0xff, 0xfa, 0xfa], + springgreen: [0x00, 0xff, 0x7f], + steelblue: [0x46, 0x82, 0xb4], + tan: [0xd2, 0xb4, 0x8c], + teal: [0x00, 0x80, 0x80], + thistle: [0xd8, 0xbf, 0xd8], + tomato: [0xff, 0x63, 0x47], + turquoise: [0x40, 0xe0, 0xd0], + violet: [0xee, 0x82, 0xee], + wheat: [0xf5, 0xde, 0xb3], + white: [0xff, 0xff, 0xff], + whitesmoke: [0xf5, 0xf5, 0xf5], + yellow: [0xff, 0xff, 0x00], + yellowgreen: [0x9a, 0xcd, 0x32] +} as const satisfies { + [key: string]: ReadonlyTriColorChannels; +}; diff --git a/node_modules/@asamuzakjp/css-color/src/resolvers/parse-color.ts b/node_modules/@asamuzakjp/css-color/src/resolvers/parse-color.ts new file mode 100644 index 0000000..36127d6 --- /dev/null +++ b/node_modules/@asamuzakjp/css-color/src/resolvers/parse-color.ts @@ -0,0 +1,910 @@ +/** + * parse + */ + +import { convertHexToRgb, convertHexToXyz } from '../converters/convert-hex'; +import { + transformMatrix, + transformRgbToLinearRgb, + transformRgbToXyz +} from '../matrix/transform'; +import { + ComputedColorChannels, + Options, + MatchedRegExp, + SpecifiedColorChannels, + StringColorChannels, + StringColorSpacedChannels, + TriColorChannels +} from '../typedef'; +import { isString } from '../utils/common'; +import { + angleToDeg, + parseAlpha, + resolveInvalidColorValue, + roundToPrecision +} from '../utils/util'; + +/* constants */ +import { + D50, + MATRIX_A98_TO_XYZ, + MATRIX_D50_TO_D65, + MATRIX_D65_TO_D50, + MATRIX_LMS_TO_XYZ, + MATRIX_L_RGB_TO_XYZ, + MATRIX_OKLAB_TO_LMS, + MATRIX_P3_TO_XYZ, + MATRIX_PROPHOTO_TO_XYZ_D50, + MATRIX_REC2020_TO_XYZ +} from '../matrix/matrix'; +import { + DEC, + DEG, + DEG_HALF, + DOZ, + DUO, + HEX, + LAB_A, + LAB_B, + LAB_EPSILON, + LAB_KAPPA, + LAB_L, + MAX_PCT, + MAX_RGB, + NONE, + OCT, + POW_CUBE, + POW_SQR, + SYN_COLOR_TYPE, + SYN_FN_COLOR, + SYN_HSL, + SYN_HSL_LV3, + SYN_LCH, + SYN_MOD, + SYN_RGB_LV3, + TRIA, + VAL_COMP, + VAL_MIX, + VAL_SPEC +} from '../utils/constant'; +import { NAMED_COLORS } from './named-color'; + +/* regexp */ +const REG_COLOR = new RegExp(`^(?:${SYN_COLOR_TYPE})$`); +const REG_CURRENT = /^currentColor$/i; +const REG_FN_COLOR = new RegExp(`^color\\(\\s*(${SYN_FN_COLOR})\\s*\\)$`); +const REG_HSL = new RegExp(`^hsla?\\(\\s*(${SYN_HSL}|${SYN_HSL_LV3})\\s*\\)$`); +const REG_HWB = new RegExp(`^hwb\\(\\s*(${SYN_HSL})\\s*\\)$`); +const REG_LAB = new RegExp(`^lab\\(\\s*(${SYN_MOD})\\s*\\)$`); +const REG_LCH = new RegExp(`^lch\\(\\s*(${SYN_LCH})\\s*\\)$`); +const REG_OKLAB = new RegExp(`^oklab\\(\\s*(${SYN_MOD})\\s*\\)$`); +const REG_OKLCH = new RegExp(`^oklch\\(\\s*(${SYN_LCH})\\s*\\)$`); +const REG_SPEC = /^(?:specifi|comput)edValue$/; +const REG_PARSE_RGB = new RegExp( + `^rgba?\\(\\s*(${SYN_MOD}|${SYN_RGB_LV3})\\s*\\)$` +); + +/** + * parse rgb() + * @param value - rgb color value + * @param opt - options + * @returns parsed color - ['rgb', r, g, b, alpha], '(empty)', null + */ +export const parseRgb = ( + value: string, + opt: Options = {} +): SpecifiedColorChannels | string | null => { + if (isString(value)) { + value = value.toLowerCase().trim(); + } else { + throw new TypeError(`${value} is not a string.`); + } + const { format = '', nullable = false } = opt; + if (!REG_PARSE_RGB.test(value)) { + const res = resolveInvalidColorValue(format, nullable); + if (res === null) { + return null; + } else if (isString(res)) { + return res as string; + } + return res as SpecifiedColorChannels; + } + const [, val] = value.match(REG_PARSE_RGB) as MatchedRegExp; + const [v1, v2, v3, v4 = ''] = val.match(/[^\s,/]+/g) as StringColorChannels; + let r, g, b; + if (v1 === NONE) { + r = 0; + } else { + if (v1.endsWith('%')) { + r = (parseFloat(v1) * MAX_RGB) / MAX_PCT; + } else { + r = parseFloat(v1); + } + r = Math.min(Math.max(roundToPrecision(r, OCT), 0), MAX_RGB); + } + if (v2 === NONE) { + g = 0; + } else { + if (v2.endsWith('%')) { + g = (parseFloat(v2) * MAX_RGB) / MAX_PCT; + } else { + g = parseFloat(v2); + } + g = Math.min(Math.max(roundToPrecision(g, OCT), 0), MAX_RGB); + } + if (v3 === NONE) { + b = 0; + } else { + if (v3.endsWith('%')) { + b = (parseFloat(v3) * MAX_RGB) / MAX_PCT; + } else { + b = parseFloat(v3); + } + b = Math.min(Math.max(roundToPrecision(b, OCT), 0), MAX_RGB); + } + const alpha = parseAlpha(v4); + return ['rgb', r, g, b, format === VAL_MIX && v4 === NONE ? NONE : alpha]; +}; + +/** + * parse hsl() + * @param value - hsl color value + * @param opt - options + * @returns parsed color - ['rgb', r, g, b, alpha], '(empty)', null + */ +export const parseHsl = ( + value: string, + opt: Options = {} +): SpecifiedColorChannels | string | null => { + if (isString(value)) { + value = value.trim(); + } else { + throw new TypeError(`${value} is not a string.`); + } + const { format = '', nullable = false } = opt; + if (!REG_HSL.test(value)) { + const res = resolveInvalidColorValue(format, nullable); + if (res === null) { + return null; + } else if (isString(res)) { + return res as string; + } + return res as SpecifiedColorChannels; + } + const [, val] = value.match(REG_HSL) as MatchedRegExp; + const [v1, v2, v3, v4 = ''] = val.match(/[^\s,/]+/g) as StringColorChannels; + let h, s, l; + if (v1 === NONE) { + h = 0; + } else { + h = angleToDeg(v1); + } + if (v2 === NONE) { + s = 0; + } else { + s = Math.min(Math.max(parseFloat(v2), 0), MAX_PCT); + } + if (v3 === NONE) { + l = 0; + } else { + l = Math.min(Math.max(parseFloat(v3), 0), MAX_PCT); + } + const alpha = parseAlpha(v4); + if (format === 'hsl') { + return [ + format, + v1 === NONE ? v1 : h, + v2 === NONE ? v2 : s, + v3 === NONE ? v3 : l, + v4 === NONE ? v4 : alpha + ]; + } + h = (h / DEG) * DOZ; + l /= MAX_PCT; + const sa = (s / MAX_PCT) * Math.min(l, 1 - l); + const rk = h % DOZ; + const gk = (8 + h) % DOZ; + const bk = (4 + h) % DOZ; + const r = l - sa * Math.max(-1, Math.min(rk - TRIA, TRIA ** POW_SQR - rk, 1)); + const g = l - sa * Math.max(-1, Math.min(gk - TRIA, TRIA ** POW_SQR - gk, 1)); + const b = l - sa * Math.max(-1, Math.min(bk - TRIA, TRIA ** POW_SQR - bk, 1)); + return [ + 'rgb', + Math.min(Math.max(roundToPrecision(r * MAX_RGB, OCT), 0), MAX_RGB), + Math.min(Math.max(roundToPrecision(g * MAX_RGB, OCT), 0), MAX_RGB), + Math.min(Math.max(roundToPrecision(b * MAX_RGB, OCT), 0), MAX_RGB), + alpha + ]; +}; + +/** + * parse hwb() + * @param value - hwb color value + * @param opt - options + * @returns parsed color - ['rgb', r, g, b, alpha], '(empty)', null + */ +export const parseHwb = ( + value: string, + opt: Options = {} +): SpecifiedColorChannels | string | null => { + if (isString(value)) { + value = value.trim(); + } else { + throw new TypeError(`${value} is not a string.`); + } + const { format = '', nullable = false } = opt; + if (!REG_HWB.test(value)) { + const res = resolveInvalidColorValue(format, nullable); + if (res === null) { + return null; + } else if (isString(res)) { + return res as string; + } + return res as SpecifiedColorChannels; + } + const [, val] = value.match(REG_HWB) as MatchedRegExp; + const [v1, v2, v3, v4 = ''] = val.match(/[^\s,/]+/g) as StringColorChannels; + let h, wh, bk; + if (v1 === NONE) { + h = 0; + } else { + h = angleToDeg(v1); + } + if (v2 === NONE) { + wh = 0; + } else { + wh = Math.min(Math.max(parseFloat(v2), 0), MAX_PCT) / MAX_PCT; + } + if (v3 === NONE) { + bk = 0; + } else { + bk = Math.min(Math.max(parseFloat(v3), 0), MAX_PCT) / MAX_PCT; + } + const alpha = parseAlpha(v4); + if (format === 'hwb') { + return [ + format, + v1 === NONE ? v1 : h, + v2 === NONE ? v2 : wh * MAX_PCT, + v3 === NONE ? v3 : bk * MAX_PCT, + v4 === NONE ? v4 : alpha + ]; + } + if (wh + bk >= 1) { + const v = roundToPrecision((wh / (wh + bk)) * MAX_RGB, OCT); + return ['rgb', v, v, v, alpha]; + } + const factor = (1 - wh - bk) / MAX_RGB; + let [, r, g, b] = parseHsl(`hsl(${h} 100 50)`) as ComputedColorChannels; + r = roundToPrecision((r * factor + wh) * MAX_RGB, OCT); + g = roundToPrecision((g * factor + wh) * MAX_RGB, OCT); + b = roundToPrecision((b * factor + wh) * MAX_RGB, OCT); + return [ + 'rgb', + Math.min(Math.max(r, 0), MAX_RGB), + Math.min(Math.max(g, 0), MAX_RGB), + Math.min(Math.max(b, 0), MAX_RGB), + alpha + ]; +}; + +/** + * parse lab() + * @param value - lab color value + * @param opt - options + * @returns parsed color + * - [xyz-d50, x, y, z, alpha], ['lab', l, a, b, alpha], '(empty)', null + */ +export const parseLab = ( + value: string, + opt: Options = {} +): SpecifiedColorChannels | string | null => { + if (isString(value)) { + value = value.trim(); + } else { + throw new TypeError(`${value} is not a string.`); + } + const { format = '', nullable = false } = opt; + if (!REG_LAB.test(value)) { + const res = resolveInvalidColorValue(format, nullable); + if (res === null) { + return null; + } else if (isString(res)) { + return res as string; + } + return res as SpecifiedColorChannels; + } + const COEF_PCT = 1.25; + const COND_POW = 8; + const [, val] = value.match(REG_LAB) as MatchedRegExp; + const [v1, v2, v3, v4 = ''] = val.match(/[^\s,/]+/g) as StringColorChannels; + let l, a, b; + if (v1 === NONE) { + l = 0; + } else { + if (v1.endsWith('%')) { + l = parseFloat(v1); + if (l > MAX_PCT) { + l = MAX_PCT; + } + } else { + l = parseFloat(v1); + } + if (l < 0) { + l = 0; + } + } + if (v2 === NONE) { + a = 0; + } else { + a = v2.endsWith('%') ? parseFloat(v2) * COEF_PCT : parseFloat(v2); + } + if (v3 === NONE) { + b = 0; + } else { + b = v3.endsWith('%') ? parseFloat(v3) * COEF_PCT : parseFloat(v3); + } + const alpha = parseAlpha(v4); + if (REG_SPEC.test(format)) { + return [ + 'lab', + v1 === NONE ? v1 : roundToPrecision(l, HEX), + v2 === NONE ? v2 : roundToPrecision(a, HEX), + v3 === NONE ? v3 : roundToPrecision(b, HEX), + v4 === NONE ? v4 : alpha + ]; + } + const fl = (l + HEX) / LAB_L; + const fa = a / LAB_A + fl; + const fb = fl - b / LAB_B; + const powFl = Math.pow(fl, POW_CUBE); + const powFa = Math.pow(fa, POW_CUBE); + const powFb = Math.pow(fb, POW_CUBE); + const xyz = [ + powFa > LAB_EPSILON ? powFa : (fa * LAB_L - HEX) / LAB_KAPPA, + l > COND_POW ? powFl : l / LAB_KAPPA, + powFb > LAB_EPSILON ? powFb : (fb * LAB_L - HEX) / LAB_KAPPA + ]; + const [x, y, z] = xyz.map( + (val, i) => val * (D50[i] as number) + ) as TriColorChannels; + return [ + 'xyz-d50', + roundToPrecision(x, HEX), + roundToPrecision(y, HEX), + roundToPrecision(z, HEX), + alpha + ]; +}; + +/** + * parse lch() + * @param value - lch color value + * @param opt - options + * @returns parsed color + * - ['xyz-d50', x, y, z, alpha], ['lch', l, c, h, alpha], '(empty)', null + */ +export const parseLch = ( + value: string, + opt: Options = {} +): SpecifiedColorChannels | string | null => { + if (isString(value)) { + value = value.trim(); + } else { + throw new TypeError(`${value} is not a string.`); + } + const { format = '', nullable = false } = opt; + if (!REG_LCH.test(value)) { + const res = resolveInvalidColorValue(format, nullable); + if (res === null) { + return null; + } else if (isString(res)) { + return res as string; + } + return res as SpecifiedColorChannels; + } + const COEF_PCT = 1.5; + const [, val] = value.match(REG_LCH) as MatchedRegExp; + const [v1, v2, v3, v4 = ''] = val.match(/[^\s,/]+/g) as StringColorChannels; + let l, c, h; + if (v1 === NONE) { + l = 0; + } else { + l = parseFloat(v1); + if (l < 0) { + l = 0; + } + } + if (v2 === NONE) { + c = 0; + } else { + c = v2.endsWith('%') ? parseFloat(v2) * COEF_PCT : parseFloat(v2); + } + if (v3 === NONE) { + h = 0; + } else { + h = angleToDeg(v3); + } + const alpha = parseAlpha(v4); + if (REG_SPEC.test(format)) { + return [ + 'lch', + v1 === NONE ? v1 : roundToPrecision(l, HEX), + v2 === NONE ? v2 : roundToPrecision(c, HEX), + v3 === NONE ? v3 : roundToPrecision(h, HEX), + v4 === NONE ? v4 : alpha + ]; + } + const a = c * Math.cos((h * Math.PI) / DEG_HALF); + const b = c * Math.sin((h * Math.PI) / DEG_HALF); + const [, x, y, z] = parseLab(`lab(${l} ${a} ${b})`) as ComputedColorChannels; + return [ + 'xyz-d50', + roundToPrecision(x, HEX), + roundToPrecision(y, HEX), + roundToPrecision(z, HEX), + alpha as number + ]; +}; + +/** + * parse oklab() + * @param value - oklab color value + * @param opt - options + * @returns parsed color + * - ['xyz-d65', x, y, z, alpha], ['oklab', l, a, b, alpha], '(empty)', null + */ +export const parseOklab = ( + value: string, + opt: Options = {} +): SpecifiedColorChannels | string | null => { + if (isString(value)) { + value = value.trim(); + } else { + throw new TypeError(`${value} is not a string.`); + } + const { format = '', nullable = false } = opt; + if (!REG_OKLAB.test(value)) { + const res = resolveInvalidColorValue(format, nullable); + if (res === null) { + return null; + } else if (isString(res)) { + return res as string; + } + return res as SpecifiedColorChannels; + } + const COEF_PCT = 0.4; + const [, val] = value.match(REG_OKLAB) as MatchedRegExp; + const [v1, v2, v3, v4 = ''] = val.match(/[^\s,/]+/g) as StringColorChannels; + let l, a, b; + if (v1 === NONE) { + l = 0; + } else { + l = v1.endsWith('%') ? parseFloat(v1) / MAX_PCT : parseFloat(v1); + if (l < 0) { + l = 0; + } + } + if (v2 === NONE) { + a = 0; + } else if (v2.endsWith('%')) { + a = (parseFloat(v2) * COEF_PCT) / MAX_PCT; + } else { + a = parseFloat(v2); + } + if (v3 === NONE) { + b = 0; + } else if (v3.endsWith('%')) { + b = (parseFloat(v3) * COEF_PCT) / MAX_PCT; + } else { + b = parseFloat(v3); + } + const alpha = parseAlpha(v4); + if (REG_SPEC.test(format)) { + return [ + 'oklab', + v1 === NONE ? v1 : roundToPrecision(l, HEX), + v2 === NONE ? v2 : roundToPrecision(a, HEX), + v3 === NONE ? v3 : roundToPrecision(b, HEX), + v4 === NONE ? v4 : alpha + ]; + } + const lms = transformMatrix(MATRIX_OKLAB_TO_LMS, [l, a, b]); + const xyzLms = lms.map((c: number) => + Math.pow(c, POW_CUBE) + ) as TriColorChannels; + const [x, y, z] = transformMatrix(MATRIX_LMS_TO_XYZ, xyzLms, true); + return [ + 'xyz-d65', + roundToPrecision(x, HEX), + roundToPrecision(y, HEX), + roundToPrecision(z, HEX), + alpha as number + ]; +}; + +/** + * parse oklch() + * @param value - oklch color value + * @param opt - options + * @returns parsed color + * - ['xyz-d65', x, y, z, alpha], ['oklch', l, c, h, alpha], '(empty)', null + */ +export const parseOklch = ( + value: string, + opt: Options = {} +): SpecifiedColorChannels | string | null => { + if (isString(value)) { + value = value.trim(); + } else { + throw new TypeError(`${value} is not a string.`); + } + const { format = '', nullable = false } = opt; + if (!REG_OKLCH.test(value)) { + const res = resolveInvalidColorValue(format, nullable); + if (res === null) { + return null; + } else if (isString(res)) { + return res as string; + } + return res as SpecifiedColorChannels; + } + const COEF_PCT = 0.4; + const [, val] = value.match(REG_OKLCH) as MatchedRegExp; + const [v1, v2, v3, v4 = ''] = val.match(/[^\s,/]+/g) as StringColorChannels; + let l, c, h; + if (v1 === NONE) { + l = 0; + } else { + l = v1.endsWith('%') ? parseFloat(v1) / MAX_PCT : parseFloat(v1); + if (l < 0) { + l = 0; + } + } + if (v2 === NONE) { + c = 0; + } else { + if (v2.endsWith('%')) { + c = (parseFloat(v2) * COEF_PCT) / MAX_PCT; + } else { + c = parseFloat(v2); + } + if (c < 0) { + c = 0; + } + } + if (v3 === NONE) { + h = 0; + } else { + h = angleToDeg(v3); + } + const alpha = parseAlpha(v4); + if (REG_SPEC.test(format)) { + return [ + 'oklch', + v1 === NONE ? v1 : roundToPrecision(l, HEX), + v2 === NONE ? v2 : roundToPrecision(c, HEX), + v3 === NONE ? v3 : roundToPrecision(h, HEX), + v4 === NONE ? v4 : alpha + ]; + } + const a = c * Math.cos((h * Math.PI) / DEG_HALF); + const b = c * Math.sin((h * Math.PI) / DEG_HALF); + const lms = transformMatrix(MATRIX_OKLAB_TO_LMS, [l, a, b]); + const xyzLms = lms.map((cc: number) => + Math.pow(cc, POW_CUBE) + ) as TriColorChannels; + const [x, y, z] = transformMatrix(MATRIX_LMS_TO_XYZ, xyzLms, true); + return [ + 'xyz-d65', + roundToPrecision(x, HEX), + roundToPrecision(y, HEX), + roundToPrecision(z, HEX), + alpha + ]; +}; + +/** + * parse color() + * @param value - color function value + * @param opt - options + * @returns parsed color + * - ['xyz-(d50|d65)', x, y, z, alpha], [cs, r, g, b, alpha], '(empty)', null + */ +export const parseColorFunc = ( + value: string, + opt: Options = {} +): SpecifiedColorChannels | string | null => { + if (isString(value)) { + value = value.trim(); + } else { + throw new TypeError(`${value} is not a string.`); + } + const { colorSpace = '', d50 = false, format = '', nullable = false } = opt; + if (!REG_FN_COLOR.test(value)) { + const res = resolveInvalidColorValue(format, nullable); + if (res === null) { + return null; + } else if (isString(res)) { + return res as string; + } + return res as SpecifiedColorChannels; + } + const [, val] = value.match(REG_FN_COLOR) as MatchedRegExp; + let [cs, v1, v2, v3, v4 = ''] = val.match( + /[^\s,/]+/g + ) as StringColorSpacedChannels; + let r, g, b; + if (cs === 'xyz') { + cs = 'xyz-d65'; + } + if (v1 === NONE) { + r = 0; + } else { + r = v1.endsWith('%') ? parseFloat(v1) / MAX_PCT : parseFloat(v1); + } + if (v2 === NONE) { + g = 0; + } else { + g = v2.endsWith('%') ? parseFloat(v2) / MAX_PCT : parseFloat(v2); + } + if (v3 === NONE) { + b = 0; + } else { + b = v3.endsWith('%') ? parseFloat(v3) / MAX_PCT : parseFloat(v3); + } + const alpha = parseAlpha(v4); + if (REG_SPEC.test(format) || (format === VAL_MIX && cs === colorSpace)) { + return [ + cs, + v1 === NONE ? v1 : roundToPrecision(r, DEC), + v2 === NONE ? v2 : roundToPrecision(g, DEC), + v3 === NONE ? v3 : roundToPrecision(b, DEC), + v4 === NONE ? v4 : alpha + ]; + } + let x = 0; + let y = 0; + let z = 0; + // srgb-linear + if (cs === 'srgb-linear') { + [x, y, z] = transformMatrix(MATRIX_L_RGB_TO_XYZ, [r, g, b]); + if (d50) { + [x, y, z] = transformMatrix(MATRIX_D65_TO_D50, [x, y, z], true); + } + // display-p3 + } else if (cs === 'display-p3') { + const linearRgb = transformRgbToLinearRgb([ + r * MAX_RGB, + g * MAX_RGB, + b * MAX_RGB + ]); + [x, y, z] = transformMatrix(MATRIX_P3_TO_XYZ, linearRgb); + if (d50) { + [x, y, z] = transformMatrix(MATRIX_D65_TO_D50, [x, y, z], true); + } + // rec2020 + } else if (cs === 'rec2020') { + const ALPHA = 1.09929682680944; + const BETA = 0.018053968510807; + const REC_COEF = 0.45; + const rgb = [r, g, b].map(c => { + let cl; + if (c < BETA * REC_COEF * DEC) { + cl = c / (REC_COEF * DEC); + } else { + cl = Math.pow((c + ALPHA - 1) / ALPHA, 1 / REC_COEF); + } + return cl; + }) as TriColorChannels; + [x, y, z] = transformMatrix(MATRIX_REC2020_TO_XYZ, rgb); + if (d50) { + [x, y, z] = transformMatrix(MATRIX_D65_TO_D50, [x, y, z], true); + } + // a98-rgb + } else if (cs === 'a98-rgb') { + const POW_A98 = 563 / 256; + const rgb = [r, g, b].map(c => { + const cl = Math.pow(c, POW_A98); + return cl; + }) as TriColorChannels; + [x, y, z] = transformMatrix(MATRIX_A98_TO_XYZ, rgb); + if (d50) { + [x, y, z] = transformMatrix(MATRIX_D65_TO_D50, [x, y, z], true); + } + // prophoto-rgb + } else if (cs === 'prophoto-rgb') { + const POW_PROPHOTO = 1.8; + const rgb = [r, g, b].map(c => { + let cl; + if (c > 1 / (HEX * DUO)) { + cl = Math.pow(c, POW_PROPHOTO); + } else { + cl = c / HEX; + } + return cl; + }) as TriColorChannels; + [x, y, z] = transformMatrix(MATRIX_PROPHOTO_TO_XYZ_D50, rgb); + if (!d50) { + [x, y, z] = transformMatrix(MATRIX_D50_TO_D65, [x, y, z], true); + } + // xyz, xyz-d50, xyz-d65 + } else if (/^xyz(?:-d(?:50|65))?$/.test(cs)) { + [x, y, z] = [r, g, b]; + if (cs === 'xyz-d50') { + if (!d50) { + [x, y, z] = transformMatrix(MATRIX_D50_TO_D65, [x, y, z]); + } + } else if (d50) { + [x, y, z] = transformMatrix(MATRIX_D65_TO_D50, [x, y, z], true); + } + // srgb + } else { + [x, y, z] = transformRgbToXyz([r * MAX_RGB, g * MAX_RGB, b * MAX_RGB]); + if (d50) { + [x, y, z] = transformMatrix(MATRIX_D65_TO_D50, [x, y, z], true); + } + } + return [ + d50 ? 'xyz-d50' : 'xyz-d65', + roundToPrecision(x, HEX), + roundToPrecision(y, HEX), + roundToPrecision(z, HEX), + format === VAL_MIX && v4 === NONE ? v4 : alpha + ]; +}; + +/** + * parse color value + * @param value - CSS color value + * @param opt - options + * @returns parsed color + * - ['xyz-(d50|d65)', x, y, z, alpha], ['rgb', r, g, b, alpha] + * - value, '(empty)', null + */ +export const parseColorValue = ( + value: string, + opt: Options = {} +): SpecifiedColorChannels | string | null => { + if (isString(value)) { + value = value.toLowerCase().trim(); + } else { + throw new TypeError(`${value} is not a string.`); + } + const { d50 = false, format = '', nullable = false } = opt; + if (!REG_COLOR.test(value)) { + const res = resolveInvalidColorValue(format, nullable); + if (res === null) { + return null; + } else if (isString(res)) { + return res as string; + } + return res as SpecifiedColorChannels; + } + let x = 0; + let y = 0; + let z = 0; + let alpha = 0; + // complement currentcolor as a missing color + if (REG_CURRENT.test(value)) { + if (format === VAL_COMP) { + return ['rgb', 0, 0, 0, 0]; + } + if (format === VAL_SPEC) { + return value; + } + // named-color + } else if (/^[a-z]+$/.test(value)) { + if (Object.hasOwn(NAMED_COLORS, value)) { + if (format === VAL_SPEC) { + return value; + } + const [r, g, b] = NAMED_COLORS[ + value as keyof typeof NAMED_COLORS + ] as TriColorChannels; + alpha = 1; + if (format === VAL_COMP) { + return ['rgb', r, g, b, alpha]; + } + [x, y, z] = transformRgbToXyz([r, g, b], true); + if (d50) { + [x, y, z] = transformMatrix(MATRIX_D65_TO_D50, [x, y, z], true); + } + } else { + switch (format) { + case VAL_COMP: { + if (nullable && value !== 'transparent') { + return null; + } + return ['rgb', 0, 0, 0, 0]; + } + case VAL_SPEC: { + if (value === 'transparent') { + return value; + } + return ''; + } + case VAL_MIX: { + if (value === 'transparent') { + return ['rgb', 0, 0, 0, 0]; + } + return null; + } + default: + } + } + // hex-color + } else if (value[0] === '#') { + if (REG_SPEC.test(format)) { + const rgb = convertHexToRgb(value); + return ['rgb', ...rgb]; + } + [x, y, z, alpha] = convertHexToXyz(value); + if (d50) { + [x, y, z] = transformMatrix(MATRIX_D65_TO_D50, [x, y, z], true); + } + // lab() + } else if (value.startsWith('lab')) { + if (REG_SPEC.test(format)) { + return parseLab(value, opt); + } + [, x, y, z, alpha] = parseLab(value) as ComputedColorChannels; + if (!d50) { + [x, y, z] = transformMatrix(MATRIX_D50_TO_D65, [x, y, z], true); + } + // lch() + } else if (value.startsWith('lch')) { + if (REG_SPEC.test(format)) { + return parseLch(value, opt); + } + [, x, y, z, alpha] = parseLch(value) as ComputedColorChannels; + if (!d50) { + [x, y, z] = transformMatrix(MATRIX_D50_TO_D65, [x, y, z], true); + } + // oklab() + } else if (value.startsWith('oklab')) { + if (REG_SPEC.test(format)) { + return parseOklab(value, opt); + } + [, x, y, z, alpha] = parseOklab(value) as ComputedColorChannels; + if (d50) { + [x, y, z] = transformMatrix(MATRIX_D65_TO_D50, [x, y, z], true); + } + // oklch() + } else if (value.startsWith('oklch')) { + if (REG_SPEC.test(format)) { + return parseOklch(value, opt); + } + [, x, y, z, alpha] = parseOklch(value) as ComputedColorChannels; + if (d50) { + [x, y, z] = transformMatrix(MATRIX_D65_TO_D50, [x, y, z], true); + } + } else { + let r, g, b; + // hsl() + if (value.startsWith('hsl')) { + [, r, g, b, alpha] = parseHsl(value) as ComputedColorChannels; + // hwb() + } else if (value.startsWith('hwb')) { + [, r, g, b, alpha] = parseHwb(value) as ComputedColorChannels; + // rgb() + } else { + [, r, g, b, alpha] = parseRgb(value, opt) as ComputedColorChannels; + } + if (REG_SPEC.test(format)) { + return ['rgb', Math.round(r), Math.round(g), Math.round(b), alpha]; + } + [x, y, z] = transformRgbToXyz([r, g, b]); + if (d50) { + [x, y, z] = transformMatrix(MATRIX_D65_TO_D50, [x, y, z], true); + } + } + return [ + d50 ? 'xyz-d50' : 'xyz-d65', + roundToPrecision(x, HEX), + roundToPrecision(y, HEX), + roundToPrecision(z, HEX), + alpha + ]; +}; diff --git a/node_modules/@asamuzakjp/css-color/src/resolvers/relative-color.ts b/node_modules/@asamuzakjp/css-color/src/resolvers/relative-color.ts new file mode 100644 index 0000000..d28cece --- /dev/null +++ b/node_modules/@asamuzakjp/css-color/src/resolvers/relative-color.ts @@ -0,0 +1,673 @@ +/** + * relative-color + */ + +import { SyntaxFlag, color as colorParser } from '@csstools/css-color-parser'; +import { + ComponentValue, + parseComponentValue +} from '@csstools/css-parser-algorithms'; +import { CSSToken, TokenType, tokenize } from '@csstools/css-tokenizer'; +import { convertColorToRgb } from '../converters/convert-color'; +import { + ColorChannels, + MatchedRegExp, + Options, + StringColorChannels +} from '../typedef'; +import { createCacheKey, getCache, setCache } from '../utils/cache'; +import { isString, isStringOrNumber } from '../utils/common'; +import { resolveDimension, serializeCalc } from '../utils/css-calc-var'; +import { roundToPrecision, splitValue } from '../utils/util'; + +/* constants */ +import { + CS_LAB, + CS_LCH, + DEC, + FN_LIGHT_DARK, + FN_REL, + FN_REL_CAPT, + FN_VAR, + HEX, + MAX_PCT, + MAX_RGB, + NONE, + OCT, + SYN_COLOR_TYPE, + SYN_FN_MATH_START, + SYN_FN_VAR, + SYN_MIX, + VAL_SPEC +} from '../utils/constant'; +import { NAMED_COLORS } from './named-color'; +const NAMESPACE = 'relative-color'; +const { + CloseParen: PAREN_CLOSE, + Comment: COMMENT, + Delim: DELIM, + Dimension: DIM, + EOF, + Function: FUNC, + Ident: IDENT, + Number: NUM, + OpenParen: PAREN_OPEN, + Percentage: PCT, + Whitespace: W_SPACE +} = TokenType; +const { HasNoneKeywords: KEY_NONE } = SyntaxFlag; + +/* color channels */ +const colorChannels = new Map([ + ['color', ['r', 'g', 'b', 'alpha']], + ['hsl', ['h', 's', 'l', 'alpha']], + ['hsla', ['h', 's', 'l', 'alpha']], + ['hwb', ['h', 'w', 'b', 'alpha']], + ['lab', ['l', 'a', 'b', 'alpha']], + ['lch', ['l', 'c', 'h', 'alpha']], + ['oklab', ['l', 'a', 'b', 'alpha']], + ['oklch', ['l', 'c', 'h', 'alpha']], + ['rgb', ['r', 'g', 'b', 'alpha']], + ['rgba', ['r', 'g', 'b', 'alpha']] +]); + +/* type definitions */ +/** + * NumberOrStringColorChannels - color channel + */ +type NumberOrStringColorChannels = ColorChannels & StringColorChannels; + +/* regexp */ +const REG_COLOR_CAPT = new RegExp( + `^${FN_REL}(${SYN_COLOR_TYPE}|${SYN_MIX})\\s+` +); +const REG_CS_HSL = /(?:hsla?|hwb)$/; +const REG_CS_CIE = new RegExp(`^(?:${CS_LAB}|${CS_LCH})$`); +const REG_FN_CALC_SUM = /^(?:abs|sig?n|cos|tan)\(/; +const REG_FN_MATH_START = new RegExp(SYN_FN_MATH_START); +const REG_FN_REL = new RegExp(FN_REL); +const REG_FN_REL_CAPT = new RegExp(`^${FN_REL_CAPT}`); +const REG_FN_REL_START = new RegExp(`^${FN_REL}`); +const REG_FN_VAR = new RegExp(SYN_FN_VAR); + +/** + * resolve relative color channels + * @param tokens - tokens + * @param [opt] - options + * @param [opt.currentColor] + * - color to use for `currentcolor` keyword + * - if omitted, it will be treated as a missing color + * i.e. `rgb(none none none / none)` + * @param [opt.customProperty] + * - custom properties + * - pair of `--` prefixed property name and value, + * e.g. `customProperty: { '--some-color': '#0000ff' }` + * - and/or `callback` function to get the value of the custom property, + * e.g. `customProperty: { callback: someDeclaration.getPropertyValue }` + * @param [opt.dimension] + * - dimension, convert relative length to pixels + * - pair of unit and it's value as a number in pixels, + * e.g. `dimension: { em: 12, rem: 16, vw: 10.26 }` + * - and/or `callback` function to get the value as a number in pixels, + * e.g. `dimension: { callback: convertUnitToPixel }` + * @param [opt.format] + * - output format, one of below + * - `computedValue` (default), [computed value][139] of the color + * - `specifiedValue`, [specified value][140] of the color + * - `hex`, hex color notation, i.e. `rrggbb` + * - `hexAlpha`, hex color notation with alpha channel, i.e. `#rrggbbaa` + * @returns + * - one of rgba?(), #rrggbb(aa)?, color-name, '(empty-string)', + * color(color-space r g b / alpha), color(color-space x y z / alpha), + * lab(l a b / alpha), lch(l c h / alpha), oklab(l a b / alpha), + * oklch(l c h / alpha), null + * - in `computedValue`, values are numbers, however `rgb()` values are + * integers + * - in `specifiedValue`, returns `empty string` for unknown and/or invalid + * color + * - in `hex`, returns `null` for `transparent`, and also returns `null` if + * any of `r`, `g`, `b`, `alpha` is not a number + * - in `hexAlpha`, returns `#00000000` for `transparent`, + * however returns `null` if any of `r`, `g`, `b`, `alpha` is not a number + */ +export function resolveColorChannels( + tokens: CSSToken[], + opt: Options = {} +): NumberOrStringColorChannels | null { + if (!Array.isArray(tokens)) { + throw new TypeError(`${tokens} is not an array.`); + } + const { colorSpace = '', format = '' } = opt; + const colorChannel = colorChannels.get(colorSpace); + // invalid color channel + if (!colorChannel) { + return null; + } + const mathFunc = new Set(); + const channels: [ + (number | string)[], + (number | string)[], + (number | string)[], + (number | string)[] + ] = [[], [], [], []]; + let i = 0; + let nest = 0; + let func = ''; + let precededPct = false; + for (const token of tokens) { + if (!Array.isArray(token)) { + throw new TypeError(`${token} is not an array.`); + } + const [type, value, , , detail] = token as [ + TokenType, + string, + number, + number, + { value: string | number } | undefined + ]; + const channel = channels[i]; + if (Array.isArray(channel)) { + switch (type) { + case DELIM: { + if (func) { + if ( + (value === '+' || value === '-') && + precededPct && + !REG_FN_CALC_SUM.test(func) + ) { + return null; + } + precededPct = false; + channel.push(value); + } + break; + } + case DIM: { + if (!func || !REG_FN_CALC_SUM.test(func)) { + return null; + } + const resolvedValue = resolveDimension(token, opt); + if (isString(resolvedValue)) { + channel.push(resolvedValue); + } else { + channel.push(value); + } + break; + } + case FUNC: { + channel.push(value); + func = value; + nest++; + if (REG_FN_MATH_START.test(value)) { + mathFunc.add(nest); + } + break; + } + case IDENT: { + // invalid channel key + if (!colorChannel.includes(value)) { + return null; + } + channel.push(value); + if (!func) { + i++; + } + break; + } + case NUM: { + channel.push(Number(detail?.value)); + if (!func) { + i++; + } + break; + } + case PAREN_OPEN: { + channel.push(value); + nest++; + break; + } + case PAREN_CLOSE: { + if (func) { + const lastValue = channel.at(-1); + if (lastValue === ' ') { + channel[channel.length - 1] = value; + } else { + channel.push(value); + } + if (mathFunc.has(nest)) { + mathFunc.delete(nest); + } + nest--; + if (nest === 0) { + func = ''; + i++; + } + } + break; + } + case PCT: { + if (!func) { + return null; + } else if (!REG_FN_CALC_SUM.test(func)) { + let lastValue: string | number | undefined; + for (let j = channel.length - 1; j >= 0; j--) { + if (channel[j] !== ' ') { + lastValue = channel[j]; + break; + } + } + if (lastValue === '+' || lastValue === '-') { + return null; + } else if (lastValue === '*' || lastValue === '/') { + precededPct = false; + } else { + precededPct = true; + } + } + channel.push(Number(detail?.value) / MAX_PCT); + break; + } + case W_SPACE: { + if (channel.length && func) { + const lastValue = channel.at(-1); + if (typeof lastValue === 'number') { + channel.push(value); + } else if ( + isString(lastValue) && + !lastValue.endsWith('(') && + lastValue !== ' ' + ) { + channel.push(value); + } + } + break; + } + default: { + if (type !== COMMENT && type !== EOF && func) { + channel.push(value); + } + } + } + } + } + const channelValues = []; + for (const channel of channels) { + if (channel.length === 1) { + const [resolvedValue] = channel; + if (isStringOrNumber(resolvedValue)) { + channelValues.push(resolvedValue); + } + } else if (channel.length) { + const resolvedValue = serializeCalc(channel.join(''), { + format + }); + channelValues.push(resolvedValue); + } + } + return channelValues as NumberOrStringColorChannels; +} + +/** + * extract origin color + * @param value - CSS color value + * @param opt - options + * @param resolver - resolver function + * @returns origin color value + */ +export function extractOriginColor( + value: string, + opt: Options = {}, + resolver: (v: string, o?: Options) => string | null = () => null +): string | null { + const { colorScheme = 'normal', currentColor = '', format = '' } = opt; + if (isString(value)) { + value = value.toLowerCase().trim(); + if (!value) { + return null; + } + if (!REG_FN_REL_START.test(value)) { + return value; + } + } else { + return null; + } + const cacheKey: string = createCacheKey( + { + namespace: NAMESPACE, + name: 'extractOriginColor', + value + }, + opt + ); + const cachedResult = getCache(cacheKey); + if (cachedResult !== false) { + return cachedResult.item as string | null; + } + if (/currentcolor/.test(value)) { + if (currentColor) { + value = value.replace(/currentcolor/g, currentColor); + } else { + setCache(cacheKey, null); + return null; + } + } + const matchRelFunc = value.match(REG_FN_REL_CAPT); + const [, colorSpace] = matchRelFunc as MatchedRegExp; + const options = { + ...opt, + colorSpace + }; + if (value.includes(FN_LIGHT_DARK)) { + const colorParts = value + .replace(new RegExp(`^${colorSpace}\\(`), '') + .replace(/\)$/, ''); + const matchedColorParts = splitValue(colorParts); + const [, originColor] = matchedColorParts as MatchedRegExp; + const specifiedOriginColor = resolver(originColor, { + colorScheme, + format: VAL_SPEC + }) as string; + if (!specifiedOriginColor) { + setCache(cacheKey, null); + return null; + } + if (format === VAL_SPEC) { + value = value.replace(originColor, specifiedOriginColor); + } else { + const resolvedOriginColor = resolver(specifiedOriginColor, options); + if (isString(resolvedOriginColor)) { + value = value.replace(originColor, resolvedOriginColor); + } else { + setCache(cacheKey, null); + return null; + } + } + } + if (REG_COLOR_CAPT.test(value)) { + const [, originColor] = value.match(REG_COLOR_CAPT) as MatchedRegExp; + const [, restValue] = value.split(originColor) as MatchedRegExp; + if (/^[a-z]+$/.test(originColor)) { + if ( + !/^transparent$/.test(originColor) && + !Object.hasOwn(NAMED_COLORS, originColor) + ) { + setCache(cacheKey, null); + return null; + } + } else if (format === VAL_SPEC) { + const resolvedOriginColor = resolver(originColor, options) as string; + value = value.replace(originColor, resolvedOriginColor); + } + if (format === VAL_SPEC) { + const tokens = tokenize({ css: restValue }); + const channelValues = resolveColorChannels(tokens, options); + if (channelValues === null) { + setCache(cacheKey, null); + return null; + } + const [v1, v2, v3, v4] = channelValues; + let channelValue = ''; + if (isStringOrNumber(v4)) { + channelValue = ` ${v1} ${v2} ${v3} / ${v4})`; + } else { + channelValue = ` ${channelValues.join(' ')})`; + } + if (restValue !== channelValue) { + value = value.replace(restValue, channelValue); + } + } + } else { + // nested relative color + const [, restValue] = value.split(REG_FN_REL_START) as MatchedRegExp; + const tokens = tokenize({ css: restValue }); + const originColor: string[] = []; + let nest = 0; + let tokenIndex = 0; + for (const [type, tokenValue] of tokens) { + tokenIndex++; + switch (type) { + case FUNC: + case PAREN_OPEN: { + originColor.push(tokenValue); + nest++; + break; + } + case PAREN_CLOSE: { + const lastValue = originColor.at(-1); + if (lastValue === ' ') { + originColor[originColor.length - 1] = tokenValue; + } else { + originColor.push(tokenValue); + } + nest--; + break; + } + case W_SPACE: { + const lastValue = originColor.at(-1); + if ( + isString(lastValue) && + !lastValue.endsWith('(') && + lastValue !== ' ' + ) { + originColor.push(tokenValue); + } + break; + } + default: { + if (type !== COMMENT && type !== EOF) { + originColor.push(tokenValue); + } + } + } + if (nest === 0) { + break; + } + } + const resolvedOriginColor = resolveRelativeColor( + originColor.join('').trim(), + options, + resolver + ); + if (resolvedOriginColor === null) { + setCache(cacheKey, null); + return null; + } + const channelValues = resolveColorChannels( + tokens.slice(tokenIndex), + options + ); + if (channelValues === null) { + setCache(cacheKey, null); + return null; + } + const [v1, v2, v3, v4] = channelValues; + let channelValue = ''; + if (isStringOrNumber(v4)) { + channelValue = ` ${v1} ${v2} ${v3} / ${v4})`; + } else { + channelValue = ` ${channelValues.join(' ')})`; + } + value = value.replace(restValue, `${resolvedOriginColor}${channelValue}`); + } + setCache(cacheKey, value); + return value; +} + +/** + * resolve relative color + * @param value - CSS relative color value + * @param opt - options + * @param resolver - resolver function + * @returns resolved value + */ +export function resolveRelativeColor( + value: string, + opt: Options = {}, + resolver: (v: string, o?: Options) => string | null = () => null +): string | null { + const options = { + ...opt + }; + const { format = '' } = options; + if (isString(value)) { + if (REG_FN_VAR.test(value)) { + // var() must be resolved before resolveRelativeColor() + if (format !== VAL_SPEC) { + throw new SyntaxError(`Unexpected token ${FN_VAR} found.`); + } + return value; + } else if (!REG_FN_REL.test(value)) { + return value; + } + value = value.toLowerCase().trim(); + } else { + throw new TypeError(`${value} is not a string.`); + } + const cacheKey: string = createCacheKey( + { + namespace: NAMESPACE, + name: 'resolveRelativeColor', + value + }, + options + ); + const cachedResult = getCache(cacheKey); + if (cachedResult !== false) { + return cachedResult.item as string | null; + } + const originColor = extractOriginColor(value, options, resolver); + if (originColor === null) { + setCache(cacheKey, null); + return null; + } + value = originColor; + if (format === VAL_SPEC) { + if (value.startsWith('rgba(')) { + value = value.replace('rgba(', 'rgb('); + } else if (value.startsWith('hsla(')) { + value = value.replace('hsla(', 'hsl('); + } + return value; + } + const tokens = tokenize({ css: value }); + const components = parseComponentValue(tokens) as ComponentValue; + const parsedComponents = colorParser(components); + if (!parsedComponents) { + setCache(cacheKey, null); + return null; + } + const { + alpha: alphaComponent, + channels: channelsComponent, + colorNotation, + syntaxFlags + } = parsedComponents; + let alpha: number | string; + if (Number.isNaN(Number(alphaComponent))) { + if (syntaxFlags instanceof Set && syntaxFlags.has(KEY_NONE)) { + alpha = NONE; + } else { + alpha = 0; + } + } else { + alpha = roundToPrecision(Number(alphaComponent), OCT); + } + let v1: number | string; + let v2: number | string; + let v3: number | string; + [v1, v2, v3] = channelsComponent; + let resolvedValue; + if (REG_CS_CIE.test(colorNotation)) { + const hasNone = syntaxFlags instanceof Set && syntaxFlags.has(KEY_NONE); + if (Number.isNaN(v1)) { + if (hasNone) { + v1 = NONE; + } else { + v1 = 0; + } + } else { + v1 = roundToPrecision(v1, HEX); + } + if (Number.isNaN(v2)) { + if (hasNone) { + v2 = NONE; + } else { + v2 = 0; + } + } else { + v2 = roundToPrecision(v2, HEX); + } + if (Number.isNaN(v3)) { + if (hasNone) { + v3 = NONE; + } else { + v3 = 0; + } + } else { + v3 = roundToPrecision(v3, HEX); + } + if (alpha === 1) { + resolvedValue = `${colorNotation}(${v1} ${v2} ${v3})`; + } else { + resolvedValue = `${colorNotation}(${v1} ${v2} ${v3} / ${alpha})`; + } + } else if (REG_CS_HSL.test(colorNotation)) { + if (Number.isNaN(v1)) { + v1 = 0; + } + if (Number.isNaN(v2)) { + v2 = 0; + } + if (Number.isNaN(v3)) { + v3 = 0; + } + let [r, g, b] = convertColorToRgb( + `${colorNotation}(${v1} ${v2} ${v3} / ${alpha})` + ) as ColorChannels; + r = roundToPrecision(r / MAX_RGB, DEC); + g = roundToPrecision(g / MAX_RGB, DEC); + b = roundToPrecision(b / MAX_RGB, DEC); + if (alpha === 1) { + resolvedValue = `color(srgb ${r} ${g} ${b})`; + } else { + resolvedValue = `color(srgb ${r} ${g} ${b} / ${alpha})`; + } + } else { + const cs = colorNotation === 'rgb' ? 'srgb' : colorNotation; + const hasNone = syntaxFlags instanceof Set && syntaxFlags.has(KEY_NONE); + if (Number.isNaN(v1)) { + if (hasNone) { + v1 = NONE; + } else { + v1 = 0; + } + } else { + v1 = roundToPrecision(v1, DEC); + } + if (Number.isNaN(v2)) { + if (hasNone) { + v2 = NONE; + } else { + v2 = 0; + } + } else { + v2 = roundToPrecision(v2, DEC); + } + if (Number.isNaN(v3)) { + if (hasNone) { + v3 = NONE; + } else { + v3 = 0; + } + } else { + v3 = roundToPrecision(v3, DEC); + } + if (alpha === 1) { + resolvedValue = `color(${cs} ${v1} ${v2} ${v3})`; + } else { + resolvedValue = `color(${cs} ${v1} ${v2} ${v3} / ${alpha})`; + } + } + setCache(cacheKey, resolvedValue); + return resolvedValue; +} diff --git a/node_modules/@asamuzakjp/css-color/src/resolvers/resolve-color.ts b/node_modules/@asamuzakjp/css-color/src/resolvers/resolve-color.ts new file mode 100644 index 0000000..335459e --- /dev/null +++ b/node_modules/@asamuzakjp/css-color/src/resolvers/resolve-color.ts @@ -0,0 +1,584 @@ +/** + * resolve-color + */ + +import { convertHexToRgb, convertRgbToHex } from '../converters/convert-hex'; +import { transformXyzD50ToRgb, transformXyzToRgb } from '../matrix/transform'; +import { + ComputedColorChannels, + Options, + SpecifiedColorChannels, + TriColorChannels +} from '../typedef'; +import { createCacheKey, getCache, setCache } from '../utils/cache'; +import { isString } from '../utils/common'; +import { cssCalc, resolveVar } from '../utils/css-calc-var'; +import { + parseAlpha, + resolveInvalidColorValue, + splitValue +} from '../utils/util'; +import { resolveColorMix } from './color-mix'; +import { + parseColorFunc, + parseHsl, + parseHwb, + parseLab, + parseLch, + parseOklab, + parseOklch, + parseRgb +} from './parse-color'; +import { resolveRelativeColor } from './relative-color'; + +/* constants */ +import { + FN_COLOR, + FN_MIX, + MAX_RGB, + SYN_COLOR_TYPE, + SYN_FN_CALC, + SYN_FN_COLOR, + SYN_FN_LIGHT_DARK, + SYN_FN_REL, + SYN_FN_VAR, + SYN_MIX, + VAL_COMP, + VAL_MIX, + VAL_SPEC +} from '../utils/constant'; +import { NAMED_COLORS } from './named-color'; +const NAMESPACE = 'resolve-color'; +const RGB_TRANSPARENT = 'rgba(0, 0, 0, 0)'; + +/* regexp */ +const REG_COLOR = new RegExp(`^(?:${SYN_COLOR_TYPE})$`); +const REG_COLOR_FUNC = new RegExp(`^color\\(\\s*(${SYN_FN_COLOR})\\s*\\)$`); +const REG_CURRENT = /^currentColor$/i; +const REG_FN_CALC = new RegExp(SYN_FN_CALC); +const REG_FN_COLOR = + /^(?:(?:ok)?l(?:ab|ch)|color(?:-mix)?|hsla?|hwb|rgba?|var)\(/; +const REG_FN_LIGHT_DARK = new RegExp(SYN_FN_LIGHT_DARK); +const REG_FN_REL = new RegExp(SYN_FN_REL); +const REG_FN_VAR = new RegExp(SYN_FN_VAR); +const REG_MIX = new RegExp(SYN_MIX); +const REG_SPEC = /^(?:specifi|comput)edValue$/; + +/** + * resolve color value + * @param value - CSS color value + * @param opt - options + * @returns resolved color + * - [cs, v1, v2, v3, alpha], value, '(empty)', null + */ +export const resolveColorValue = ( + value: string, + opt: Options = {} +): SpecifiedColorChannels | string | null => { + if (isString(value)) { + value = value.toLowerCase().trim(); + } else { + throw new TypeError(`${value} is not a string.`); + } + const { colorSpace = '', format = '', nullable = false } = opt; + const cacheKey: string = createCacheKey( + { + namespace: NAMESPACE, + name: 'resolveColorValue', + value + }, + opt + ); + const cachedResult = getCache(cacheKey); + if (cachedResult !== false) { + const { item } = cachedResult; + if (Array.isArray(item)) { + return [...item] as SpecifiedColorChannels; + } + return item as string | null; + } + if (!REG_COLOR.test(value)) { + const res = resolveInvalidColorValue(format, nullable); + if (res === null) { + setCache(cacheKey, null); + return null; + } + setCache(cacheKey, res); + if (isString(res)) { + return res as string; + } + return res as SpecifiedColorChannels; + } + let cs = ''; + let r = 0; + let g = 0; + let b = 0; + let alpha = 0; + // complement currentcolor as a missing color + if (REG_CURRENT.test(value)) { + if (format === VAL_SPEC) { + setCache(cacheKey, value); + return value; + } + // named-color + } else if (/^[a-z]+$/.test(value)) { + if (Object.hasOwn(NAMED_COLORS, value)) { + if (format === VAL_SPEC) { + setCache(cacheKey, value); + return value; + } + [r, g, b] = NAMED_COLORS[ + value as keyof typeof NAMED_COLORS + ] as TriColorChannels; + alpha = 1; + } else { + switch (format) { + case VAL_SPEC: { + if (value === 'transparent') { + setCache(cacheKey, value); + return value; + } + const res = ''; + setCache(cacheKey, res); + return res; + } + case VAL_MIX: { + if (value === 'transparent') { + const res: SpecifiedColorChannels = ['rgb', 0, 0, 0, 0]; + setCache(cacheKey, res); + return [...res]; + } + setCache(cacheKey, null); + return null; + } + case VAL_COMP: + default: { + if (nullable && value !== 'transparent') { + setCache(cacheKey, null); + return null; + } + const res: SpecifiedColorChannels = ['rgb', 0, 0, 0, 0]; + setCache(cacheKey, res); + return [...res]; + } + } + } + // hex-color + } else if (value[0] === '#') { + [r, g, b, alpha] = convertHexToRgb(value); + // hsl() + } else if (value.startsWith('hsl')) { + [, r, g, b, alpha] = parseHsl(value, opt) as ComputedColorChannels; + // hwb() + } else if (value.startsWith('hwb')) { + [, r, g, b, alpha] = parseHwb(value, opt) as ComputedColorChannels; + // lab(), lch() + } else if (/^l(?:ab|ch)/.test(value)) { + let x, y, z; + if (value.startsWith('lab')) { + [cs, x, y, z, alpha] = parseLab(value, opt) as ComputedColorChannels; + } else { + [cs, x, y, z, alpha] = parseLch(value, opt) as ComputedColorChannels; + } + if (REG_SPEC.test(format)) { + const res: SpecifiedColorChannels = [cs, x, y, z, alpha]; + setCache(cacheKey, res); + return [...res]; + } + [r, g, b] = transformXyzD50ToRgb([x, y, z]); + // oklab(), oklch() + } else if (/^okl(?:ab|ch)/.test(value)) { + let x, y, z; + if (value.startsWith('oklab')) { + [cs, x, y, z, alpha] = parseOklab(value, opt) as ComputedColorChannels; + } else { + [cs, x, y, z, alpha] = parseOklch(value, opt) as ComputedColorChannels; + } + if (REG_SPEC.test(format)) { + const res: SpecifiedColorChannels = [cs, x, y, z, alpha]; + setCache(cacheKey, res); + return [...res]; + } + [r, g, b] = transformXyzToRgb([x, y, z]); + // rgb() + } else { + [, r, g, b, alpha] = parseRgb(value, opt) as ComputedColorChannels; + } + if (format === VAL_MIX && colorSpace === 'srgb') { + const res: SpecifiedColorChannels = [ + 'srgb', + r / MAX_RGB, + g / MAX_RGB, + b / MAX_RGB, + alpha + ]; + setCache(cacheKey, res); + return [...res]; + } + const res: SpecifiedColorChannels = [ + 'rgb', + Math.round(r), + Math.round(g), + Math.round(b), + alpha + ]; + setCache(cacheKey, res); + return [...res]; +}; + +/** + * resolve color() + * @param value - color function value + * @param opt - options + * @returns resolved color - [cs, v1, v2, v3, alpha], '(empty)', null + */ +export const resolveColorFunc = ( + value: string, + opt: Options = {} +): SpecifiedColorChannels | string | null => { + if (isString(value)) { + value = value.toLowerCase().trim(); + } else { + throw new TypeError(`${value} is not a string.`); + } + const { colorSpace = '', format = '', nullable = false } = opt; + const cacheKey: string = createCacheKey( + { + namespace: NAMESPACE, + name: 'resolveColorFunc', + value + }, + opt + ); + const cachedResult = getCache(cacheKey); + if (cachedResult !== false) { + const { item } = cachedResult; + if (Array.isArray(item)) { + return [...item] as SpecifiedColorChannels; + } + return item as string | null; + } + if (!REG_COLOR_FUNC.test(value)) { + const res = resolveInvalidColorValue(format, nullable); + if (res === null) { + setCache(cacheKey, null); + return null; + } + setCache(cacheKey, res); + if (isString(res)) { + return res as string; + } + return res as SpecifiedColorChannels; + } + const [cs, v1, v2, v3, v4] = parseColorFunc( + value, + opt + ) as SpecifiedColorChannels; + if (REG_SPEC.test(format) || (format === VAL_MIX && cs === colorSpace)) { + const res: SpecifiedColorChannels = [cs, v1, v2, v3, v4]; + setCache(cacheKey, res); + return [...res]; + } + const x = parseFloat(`${v1}`); + const y = parseFloat(`${v2}`); + const z = parseFloat(`${v3}`); + const alpha = parseAlpha(`${v4}`); + const [r, g, b] = transformXyzToRgb([x, y, z], true); + const res: SpecifiedColorChannels = ['rgb', r, g, b, alpha]; + setCache(cacheKey, res); + return [...res]; +}; + +/** + * resolve color + * @param value - CSS color value + * @param opt - options + * @returns resolved color + */ +export const resolveColor = ( + value: string, + opt: Options = {} +): string | null => { + if (!isString(value)) { + throw new TypeError(`${value} is not a string.`); + } + value = value.trim(); + const { + colorScheme = 'normal', + currentColor = '', + format = VAL_COMP, + nullable = false + } = opt; + const cacheKey: string = createCacheKey( + { namespace: NAMESPACE, name: 'resolve', value }, + opt + ); + const cachedResult = getCache(cacheKey); + if (cachedResult !== false) { + return cachedResult.item as string | null; + } + // 1. var() resolution + if (REG_FN_VAR.test(value)) { + if (format === VAL_SPEC) { + setCache(cacheKey, value); + return value; + } + const resolvedVar = resolveVar(value, opt); + if (resolvedVar === null) { + const res = + format === 'hex' || format === 'hexAlpha' || nullable + ? null + : RGB_TRANSPARENT; + setCache(cacheKey, res); + return res; + } + value = resolvedVar; + } + if (opt.format !== format) { + opt.format = format; + } + value = value.toLowerCase(); + // 2. light-dark() resolution + if (REG_FN_LIGHT_DARK.test(value) && value.endsWith(')')) { + const colorParts = value.replace(REG_FN_LIGHT_DARK, '').replace(/\)$/, ''); + const [light = '', dark = ''] = splitValue(colorParts, { delimiter: ',' }); + if (light && dark) { + if (format === VAL_SPEC) { + const lightColor = resolveColor(light, opt); + const darkColor = resolveColor(dark, opt); + const res = + lightColor && darkColor + ? `light-dark(${lightColor}, ${darkColor})` + : ''; + setCache(cacheKey, res); + return res; + } + const chosen = colorScheme === 'dark' ? dark : light; + const resolved = resolveColor(chosen, opt); + setCache(cacheKey, resolved); + return resolved; + } + // fallback for invalid light-dark + let invalidRes; + if (format === VAL_SPEC) { + invalidRes = ''; + } else if (format === 'hex' || format === 'hexAlpha') { + invalidRes = null; + } else { + invalidRes = RGB_TRANSPARENT; + } + setCache(cacheKey, invalidRes); + return invalidRes; + } + // 3. Relative Color resolution + if (REG_FN_REL.test(value)) { + const resolvedRel = resolveRelativeColor(value, opt, resolveColor); + if (format === VAL_COMP) { + const res = + resolvedRel === null && !nullable ? RGB_TRANSPARENT : resolvedRel; + setCache(cacheKey, res); + return res; + } + if (format === VAL_SPEC) { + const res = resolvedRel === null ? '' : resolvedRel; + setCache(cacheKey, res); + return res; + } + value = resolvedRel === null ? '' : resolvedRel; + } + // 4. calc() resolution + if (REG_FN_CALC.test(value)) { + value = cssCalc(value, opt); + } + // 5. Keyword & Color-space resolution + let cs = ''; + let r = NaN; + let g = NaN; + let b = NaN; + let alpha = NaN; + if (value === 'transparent') { + let res: string | null; + switch (format) { + case VAL_SPEC: { + res = value; + break; + } + case 'hex': { + res = null; + break; + } + case 'hexAlpha': { + res = '#00000000'; + break; + } + default: { + res = RGB_TRANSPARENT; + } + } + setCache(cacheKey, res); + return res; + } + if (value === 'currentcolor') { + if (format === VAL_SPEC) { + setCache(cacheKey, value); + return value; + } + if (currentColor) { + let resolvedCurrent; + if (currentColor.startsWith(FN_MIX)) { + resolvedCurrent = resolveColorMix(currentColor, opt, resolveColor); + } else if (currentColor.startsWith(FN_COLOR)) { + resolvedCurrent = resolveColorFunc(currentColor, opt); + } else { + resolvedCurrent = resolveColorValue(currentColor, opt); + } + if (resolvedCurrent === null) { + setCache(cacheKey, null); + return null; + } + [cs, r, g, b, alpha] = resolvedCurrent as ComputedColorChannels; + } else { + // value is handled below if not VAL_COMP + const res = format === VAL_COMP ? RGB_TRANSPARENT : value; + if (format === VAL_COMP) { + setCache(cacheKey, res); + return res; + } + } + } else if (format === VAL_SPEC) { + let res = ''; + if (value.startsWith(FN_MIX)) { + const mixRes = resolveColorMix(value, opt, resolveColor); + if (isString(mixRes) && mixRes) { + res = mixRes; + } + } else if (value.startsWith(FN_COLOR)) { + const funcRes = resolveColorFunc(value, opt); + if (Array.isArray(funcRes)) { + const [scs, rr, gg, bb, aa] = funcRes as SpecifiedColorChannels; + res = + aa === 1 + ? `color(${scs} ${rr} ${gg} ${bb})` + : `color(${scs} ${rr} ${gg} ${bb} / ${aa})`; + } + } else { + const rgb = resolveColorValue(value, opt); + if (Array.isArray(rgb)) { + const [scs, rr, gg, bb, aa] = rgb as SpecifiedColorChannels; + if (scs === 'rgb') { + res = + aa === 1 + ? `${scs}(${rr}, ${gg}, ${bb})` + : `${scs}a(${rr}, ${gg}, ${bb}, ${aa})`; + } else { + res = + aa === 1 + ? `${scs}(${rr} ${gg} ${bb})` + : `${scs}(${rr} ${gg} ${bb} / ${aa})`; + } + } else if (rgb) { + res = rgb; + } + } + setCache(cacheKey, res); + return res; + } else if (value.startsWith(FN_MIX)) { + if (currentColor) { + value = value.replace(/currentcolor/g, currentColor); + } + value = value.replace(/transparent/g, RGB_TRANSPARENT); + const resolvedMix = resolveColorMix(value, opt, resolveColor); + if (resolvedMix === null) { + setCache(cacheKey, null); + return null; + } + [cs, r, g, b, alpha] = resolvedMix as ComputedColorChannels; + } else if (value.startsWith(FN_COLOR)) { + const resolvedFunc = resolveColorFunc(value, opt); + if (resolvedFunc === null) { + setCache(cacheKey, null); + return null; + } + [cs, r, g, b, alpha] = resolvedFunc as ComputedColorChannels; + } else if (value) { + const resolvedVal = resolveColorValue(value, opt); + if (resolvedVal === null) { + setCache(cacheKey, null); + return null; + } + [cs, r, g, b, alpha] = resolvedVal as ComputedColorChannels; + } + // 6. Format Finalization + let finalRes: string | null = ''; + switch (format) { + case 'hex': + case 'hexAlpha': { + if ( + Number.isNaN(r) || + Number.isNaN(g) || + Number.isNaN(b) || + Number.isNaN(alpha) || + (format === 'hex' && alpha === 0) + ) { + finalRes = null; + } else { + finalRes = convertRgbToHex([r, g, b, format === 'hex' ? 1 : alpha]); + } + break; + } + default: { + if (cs === 'rgb') { + finalRes = + alpha === 1 + ? `${cs}(${r}, ${g}, ${b})` + : `${cs}a(${r}, ${g}, ${b}, ${alpha})`; + } else if (['lab', 'lch', 'oklab', 'oklch'].includes(cs)) { + finalRes = + alpha === 1 + ? `${cs}(${r} ${g} ${b})` + : `${cs}(${r} ${g} ${b} / ${alpha})`; + } else { + finalRes = + alpha === 1 + ? `color(${cs} ${r} ${g} ${b})` + : `color(${cs} ${r} ${g} ${b} / ${alpha})`; + } + } + } + setCache(cacheKey, finalRes); + return finalRes; +}; + +/** + * is valid color + * @param value - CSS value + * @param opt - options + * @returns result + */ +export const isValidColor = (value: unknown, opt: Options = {}): boolean => { + if (!isString(value)) { + return false; + } + const color = value.toLowerCase().trim(); + if (!color) { + return false; + } + if (/^[a-z]+$/.test(color)) { + return ( + color === 'currentcolor' || + color === 'transparent' || + Object.hasOwn(NAMED_COLORS, color) + ); + } + if (REG_COLOR.test(color) || REG_MIX.test(color)) { + return true; + } + if (REG_FN_COLOR.test(color)) { + const options = { + ...opt, + nullable: true + }; + return !!resolveColor(color, options); + } + return false; +}; diff --git a/node_modules/@asamuzakjp/css-color/src/resolvers/resolve.ts b/node_modules/@asamuzakjp/css-color/src/resolvers/resolve.ts new file mode 100644 index 0000000..6cfaee2 --- /dev/null +++ b/node_modules/@asamuzakjp/css-color/src/resolvers/resolve.ts @@ -0,0 +1,33 @@ +/** + * resolve + */ + +import { Options } from '../typedef'; +import { isValidColor, resolveColor } from './resolve-color'; + +/** + * resolve CSS color + * @param value - CSS color value. system colors are not supported + * @param opt - options + * @returns resolved value + */ +export const resolve = (value: string, opt: Options = {}): string | null => { + const options = { + ...opt + }; + return resolveColor(value, options); +}; + +/** + * is color + * @param value - CSS value + * @param opt - options + * @returns result + */ +export const isColor = (value: unknown, opt: Options = {}): boolean => { + const options = { + ...opt, + nullable: true + }; + return !!isValidColor(value, options); +}; diff --git a/node_modules/@asamuzakjp/css-color/src/typedef.ts b/node_modules/@asamuzakjp/css-color/src/typedef.ts new file mode 100644 index 0000000..bd3c840 --- /dev/null +++ b/node_modules/@asamuzakjp/css-color/src/typedef.ts @@ -0,0 +1,393 @@ +/** + * typedef + */ + +import { CSSToken } from '@csstools/css-tokenizer'; + +/** + * Supported CSS gradient function types. + */ +export type GradientType = + | 'linear-gradient' + | 'repeating-linear-gradient' + | 'radial-gradient' + | 'repeating-radial-gradient' + | 'conic-gradient' + | 'repeating-conic-gradient'; + +/** + * Known CSS color spaces. + */ +type KnownColorSpace = + | 'srgb' + | 'srgb-linear' + | 'display-p3' + | 'a98-rgb' + | 'prophoto-rgb' + | 'rec2020' + | 'xyz' + | 'xyz-d50' + | 'xyz-d65'; + +/** + * Supported CSS color space string or custom space. + */ +export type ColorSpace = KnownColorSpace | (string & {}); + +/** + * Known CSS color output and input formats. + */ +type KnownColorFormat = + | 'hex' + | 'hexAlpha' + | 'rgb' + | 'hsl' + | 'hwb' + | 'lab' + | 'lch' + | 'oklab' + | 'oklch' + | 'computed' + | 'specified' + | 'mix'; + +/** + * Color format option or custom string. + */ +export type ColorFormat = KnownColorFormat | (string & {}); + +/** + * Hue interpolation methods for color spaces with hue. + */ +export type HueArc = 'shorter' | 'longer' | 'increasing' | 'decreasing'; + +/** + * Flags indicating missing or powerless channels [c1, c2, c3, alpha]. + */ +export type ChannelNoneFlags = [ + c1: boolean, + c2: boolean, + c3: boolean, + alpha: boolean +]; + +/** + * AST node representation for the calc() parser. + */ +export type CalcASTNode = string | CalcASTNode[]; + +/** + * Calculation token stream, including its terminal EOF token, and cursor. + */ +export interface CalculationState { + tokens: CSSToken[]; + index: number; +} + +/** + * Custom property resolver value or callback function. + */ +type CustomPropertyResolver = string | ((key: string) => string | undefined); + +/** + * Dimension resolver value or callback function. + */ +type DimensionResolver = number | ((key: string) => number | undefined); + +/** + * CSS dimension unit resolution map. + */ +interface DimensionMap { + [key: string]: DimensionResolver | undefined; + /** Custom dimension unit resolver callback. */ + callback?: (key: string) => number | undefined; + /** Font size of the element in pixels. */ + em?: number; + /** Root element font size in pixels. */ + rem?: number; + /** Viewport height in pixels. */ + vh?: number; + /** Viewport width in pixels. */ + vw?: number; +} + +/** + * Custom property lookup map or callback handler. + */ +interface CustomPropertyMap { + [key: string]: CustomPropertyResolver | undefined; + /** Custom property resolver callback function. */ + callback?: (key: string) => string | undefined; +} + +/** + * Parsing and resolution options. + */ +export interface Options { + /** Force alpha channel output. */ + alpha?: boolean; + /** Preferred color scheme context. */ + colorScheme?: string; + /** Target color space for output. */ + colorSpace?: ColorSpace; + /** Value used for `currentColor` keyword. */ + currentColor?: string; + /** Custom property resolvers. */ + customProperty?: CustomPropertyMap; + /** Adapt XYZ coordinates to D50 illuminant. */ + d50?: boolean; + /** Channel values delimiter string or list. */ + delimiter?: string | readonly string[]; + /** Dimension resolution settings. */ + dimension?: DimensionMap; + /** Output color format. */ + format?: ColorFormat; + /** Maximum length limit for parsed string. */ + maxLength?: number; + /** Return null instead of throwing on invalid input. */ + nullable?: boolean; + /** Retain comments during parsing. */ + preserveComment?: boolean; +} + +/** + * Three-element color channel tuple [x, y, z]. + */ +export type TriColorChannels = [x: number, y: number, z: number]; + +/** + * Readonly three-element color channel tuple [x, y, z]. + */ +export type ReadonlyTriColorChannels = readonly [ + x: number, + y: number, + z: number +]; + +/** + * 3x3 color conversion matrix tuple. + */ +export type ReadonlyColorMatrix = readonly [ + r1: ReadonlyTriColorChannels, + r2: ReadonlyTriColorChannels, + r3: ReadonlyTriColorChannels +]; + +/** + * Four-element color channel numeric tuple [x, y, z, alpha]. + */ +export type ColorChannels = [x: number, y: number, z: number, alpha: number]; + +/** + * Four-element color channel string tuple [x, y, z, alpha]. + */ +export type StringColorChannels = [ + x: string, + y: string, + z: string, + alpha: string | undefined +]; + +/** + * Four-element color channel numeric/string tuple [x, y, z, alpha]. + */ +export type NumStrColorChannels = [ + x: number | string, + y: number | string, + z: number | string, + alpha: number | string +]; + +/** + * Color channel tuple with missing/powerless string tags. + */ +export type ColorChannelsWithPowerless = [ + x: number | string, + y: number | string, + z: number | string, + alpha: number +]; + +/** + * Color space name and three channel strings with alpha. + */ +export type StringColorSpacedChannels = [ + cs: string, + x: string, + y: string, + z: string, + alpha: string | undefined +]; + +/** + * Resolved computed color channel representation. + */ +export type ComputedColorChannels = [ + cs: string, + x: number, + y: number, + z: number, + alpha: number +]; + +/** + * Resolved specified color channel representation. + */ +export type SpecifiedColorChannels = [ + cs: string, + x: number | string, + y: number | string, + z: number | string, + alpha: number | string +]; + +/** + * RegExp match result tuple with 3 capture groups. + */ +export type MatchedRegExp3 = [ + match: string, + gr1: string, + gr2: string, + gr3: string +]; + +/** + * RegExp match result tuple with 4 capture groups. + */ +export type MatchedRegExp4 = [ + match: string, + gr1: string, + gr2: string, + gr3: string, + gr4: string +]; + +/** + * Standard matched RegExp tuple alias. + */ +export type MatchedRegExp = MatchedRegExp4; + +/** + * Component validation configuration. + */ +export interface ValidateColorComponentsOptions { + /** Validate alpha channel presence. */ + alpha?: boolean; + /** Minimum number of components. */ + minLength?: number; + /** Maximum number of components. */ + maxLength?: number; + /** Minimum allowed component value. */ + minRange?: number; + /** Maximum allowed component value. */ + maxRange?: number; + /** Whether to enforce component value range check. */ + validateRange?: boolean; +} + +/** + * Options for linear RGB conversion. + */ +export interface LinearRgbOptions { + /** Target color space for conversion. */ + colorSpace?: ColorSpace; + /** Output color format. */ + format?: ColorFormat; +} + +/** + * Function type for converting color string to channel values. + */ +export type ColorConvertFn = ( + value: string, + opt?: Options +) => ColorChannels | ColorChannelsWithPowerless | null; + +/** + * Function type for resolving CSS color expressions. + */ +export type ColorResolverFn = ( + value: string, + opt?: Options +) => SpecifiedColorChannels | string | null; + +/** + * Parsed CSS gradient object structure. + */ +export interface Gradient { + /** Raw gradient CSS string value. */ + value: string; + /** Type of gradient expression. */ + type: GradientType; + /** Parsed gradient line parameter. */ + gradientLine?: string; + /** List of color stops. */ + colorStopList: ColorStopList; +} + +/** + * Color stops validation result. + */ +export interface ValidateColorStops { + /** Extracted color stop strings. */ + colorStops: string[]; + /** Flag indicating stop list validity. */ + valid: boolean; +} + +/** + * Gradient line validation result. + */ +export interface ValidateGradientLine { + /** Extracted gradient line string. */ + line: string; + /** Flag indicating line syntax validity. */ + valid: boolean; +} + +/** + * Tuple representing a minimum of two color stops. + */ +export type ColorStopList = [string, string, ...string[]]; + +/** + * Parsed color space parameter for color-mix(). + */ +export interface ColorSpaceParseResult { + /** Color space name. */ + colorSpace: ColorSpace; + /** Interpolation hue method. */ + hueArc: HueArc | string; +} + +/** + * Color and percentage pair for color-mix(). + */ +export interface ColorAndPct { + /** Raw color string. */ + color: string; + /** Raw percentage string. */ + pct: string; +} + +/** + * Normalized percentage values for color mixing. + */ +export interface NormalizedPercentages { + /** First color percentage weight (0 to 1). */ + pA: number; + /** Second color percentage weight (0 to 1). */ + pB: number; + /** Multiplier factor for un-normalized sums. */ + m: number; +} + +/** + * Interpolated channels and alpha output. + */ +export interface InterpolatedComponents { + /** Three-element color component values. */ + comps: TriColorChannels; + /** Resulting alpha transparency. */ + alpha: number; +} diff --git a/node_modules/@asamuzakjp/css-color/src/utils/cache.ts b/node_modules/@asamuzakjp/css-color/src/utils/cache.ts new file mode 100644 index 0000000..9e257f9 --- /dev/null +++ b/node_modules/@asamuzakjp/css-color/src/utils/cache.ts @@ -0,0 +1,121 @@ +/** + * cache + */ + +import { LRUCache } from 'lru-cache'; +import { Options } from '../typedef'; + +/* constants */ +const CACHE_SIZE = 4096; + +/** + * CacheItem + */ +export class CacheItem { + /* private */ + #item: T; + + constructor(item: T) { + this.#item = item; + } + + get item(): T { + return this.#item; + } +} + +/* + * lru cache instance + */ +export const lruCache = new LRUCache>({ + max: CACHE_SIZE +}); + +/** + * set cache + * @param key - cache key + * @param value - value to cache + */ +export const setCache = (key: string, value: T | CacheItem): void => { + if (!key) { + return; + } + if (value instanceof CacheItem) { + lruCache.set(key, value); + } else { + lruCache.set(key, new CacheItem(value)); + } +}; + +/** + * get cache + * @param key - cache key + * @returns cached item or false otherwise + */ +export const getCache = (key: string): CacheItem | false => { + if (!key) { + return false; + } + const item = lruCache.get(key); + if (item !== undefined) { + return item as CacheItem; + } + return false; +}; + +/** + * helper function to sort object keys alphabetically + * @param obj - Object + * @returns stringified JSON + */ +const stringifySorted = (obj: Record): string => { + const keys = Object.keys(obj); + if (keys.length === 0) { + return ''; + } + keys.sort(); + let result = ''; + for (const key of keys) { + result += `${key}:${JSON.stringify(obj[key])};`; + } + return result; +}; + +/** + * create cache key + * @param keyData - key data + * @param [opt] - options + * @returns cache key + */ +export const createCacheKey = ( + keyData: Record, + opt: Options = {} +): string => { + if ( + !keyData || + (opt.customProperty && typeof opt.customProperty.callback === 'function') || + (opt.dimension && typeof opt.dimension.callback === 'function') + ) { + return ''; + } + const namespace = keyData.namespace || ''; + const name = keyData.name || ''; + const value = keyData.value || ''; + if (!namespace && !name && !value) { + return ''; + } + const baseKey = `${namespace}:${name}:${value}`; + const opts = []; + for (const [key, val] of Object.entries(opt)) { + if (key !== 'customProperty' && key !== 'dimension') { + opts.push(`${key}_${val}`); + } + } + const customPropStr = opt.customProperty + ? stringifySorted(opt.customProperty as Record) + : ''; + const dimStr = opt.dimension + ? stringifySorted(opt.dimension as Record) + : ''; + return `${baseKey}:${opts.sort().join('|')}:${customPropStr}:${dimStr}`; +}; diff --git a/node_modules/@asamuzakjp/css-color/src/utils/common.ts b/node_modules/@asamuzakjp/css-color/src/utils/common.ts new file mode 100644 index 0000000..ddd8162 --- /dev/null +++ b/node_modules/@asamuzakjp/css-color/src/utils/common.ts @@ -0,0 +1,31 @@ +/** + * common + */ + +/* numeric constants */ +const TYPE_FROM = 8; +const TYPE_TO = -1; + +/** + * get type + * @param o - object to check + * @returns type of object + */ +export const getType = (o: unknown): string => + Object.prototype.toString.call(o).slice(TYPE_FROM, TYPE_TO); + +/** + * is string + * @param o - object to check + * @returns result + */ +export const isString = (o: unknown): o is string => + typeof o === 'string' || o instanceof String; + +/** + * is string or number + * @param o - object to check + * @returns result + */ +export const isStringOrNumber = (o: unknown): o is string | number => + isString(o) || typeof o === 'number'; diff --git a/node_modules/@asamuzakjp/css-color/src/utils/constant.ts b/node_modules/@asamuzakjp/css-color/src/utils/constant.ts new file mode 100644 index 0000000..0f6fa2f --- /dev/null +++ b/node_modules/@asamuzakjp/css-color/src/utils/constant.ts @@ -0,0 +1,99 @@ +/** + * constant + */ + +/* values and units */ +const _DIGIT = '(?:0|[1-9]\\d*)'; +const _COMPARE = 'clamp|max|min'; +const _EXPO = 'exp|hypot|log|pow|sqrt'; +const _SIGN = 'abs|sign'; +const _STEP = 'mod|rem|round'; +const _TRIG = 'a?(?:cos|sin|tan)|atan2'; +const _MATH = `${_COMPARE}|${_EXPO}|${_SIGN}|${_STEP}|${_TRIG}`; +const _CALC = `calc|${_MATH}`; +const _VAR = `var|${_CALC}`; +export const ANGLE = 'deg|g?rad|turn'; +export const LENGTH = + '[cm]m|[dls]?v(?:[bhiw]|max|min)|in|p[ctx]|q|r?(?:[cl]h|cap|e[mx]|ic)'; +export const NUM = `[+-]?(?:${_DIGIT}(?:\\.\\d*)?|\\.\\d+)(?:e-?${_DIGIT})?`; +export const NUM_POSITIVE = `\\+?(?:${_DIGIT}(?:\\.\\d*)?|\\.\\d+)(?:e-?${_DIGIT})?`; +export const NONE = 'none'; +export const PCT = `${NUM}%`; +export const SYN_FN_CALC = `^(?:${_CALC})\\(|(?<=[*\\/\\s\\(])(?:${_CALC})\\(`; +export const SYN_FN_MATH_START = `^(?:${_MATH})\\($`; +export const SYN_FN_VAR = '^var\\(|(?<=[*\\/\\s\\(])var\\('; +export const SYN_FN_VAR_START = `^(?:${_VAR})\\(`; + +/* colors */ +const _ALPHA = `(?:\\s*\\/\\s*(?:${NUM}|${PCT}|${NONE}))?`; +const _ALPHA_LV3 = `(?:\\s*,\\s*(?:${NUM}|${PCT}))?`; +const _COLOR_FUNC = '(?:ok)?l(?:ab|ch)|color|hsla?|hwb|rgba?'; +const _COLOR_KEY = '[a-z]+|#[\\da-f]{3}|#[\\da-f]{4}|#[\\da-f]{6}|#[\\da-f]{8}'; +const _CS_HUE = '(?:ok)?lch|hsl|hwb'; +const _CS_HUE_ARC = '(?:de|in)creasing|longer|shorter'; +const _NUM_ANGLE = `${NUM}(?:${ANGLE})?`; +const _NUM_ANGLE_NONE = `(?:${NUM}(?:${ANGLE})?|${NONE})`; +const _NUM_PCT_NONE = `(?:${NUM}|${PCT}|${NONE})`; +export const CS_HUE = `(?:${_CS_HUE})(?:\\s(?:${_CS_HUE_ARC})\\shue)?`; +export const CS_HUE_CAPT = `(${_CS_HUE})(?:\\s(${_CS_HUE_ARC})\\shue)?`; +export const CS_LAB = '(?:ok)?lab'; +export const CS_LCH = '(?:ok)?lch'; +export const CS_SRGB = 'srgb(?:-linear)?'; +export const CS_RGB = `(?:a98|prophoto)-rgb|display-p3|rec2020|${CS_SRGB}`; +export const CS_XYZ = 'xyz(?:-d(?:50|65))?'; +export const CS_RECT = `${CS_LAB}|${CS_RGB}|${CS_XYZ}`; +export const CS_MIX = `${CS_HUE}|${CS_RECT}`; +export const FN_COLOR = 'color('; +export const FN_LIGHT_DARK = 'light-dark('; +export const FN_MIX = 'color-mix('; +export const FN_REL = `(?:${_COLOR_FUNC})\\(\\s*from\\s+`; +export const FN_REL_CAPT = `(${_COLOR_FUNC})\\(\\s*from\\s+`; +export const FN_VAR = 'var('; +export const SYN_FN_COLOR = `(?:${CS_RGB}|${CS_XYZ})(?:\\s+${_NUM_PCT_NONE}){3}${_ALPHA}`; +export const SYN_FN_LIGHT_DARK = '^light-dark\\('; +export const SYN_FN_REL = `^${FN_REL}|(?<=[\\s])${FN_REL}`; +export const SYN_HSL = `${_NUM_ANGLE_NONE}(?:\\s+${_NUM_PCT_NONE}){2}${_ALPHA}`; +export const SYN_HSL_LV3 = `${_NUM_ANGLE}(?:\\s*,\\s*${PCT}){2}${_ALPHA_LV3}`; +export const SYN_LCH = `(?:${_NUM_PCT_NONE}\\s+){2}${_NUM_ANGLE_NONE}${_ALPHA}`; +export const SYN_MOD = `${_NUM_PCT_NONE}(?:\\s+${_NUM_PCT_NONE}){2}${_ALPHA}`; +export const SYN_RGB_LV3 = `(?:${NUM}(?:\\s*,\\s*${NUM}){2}|${PCT}(?:\\s*,\\s*${PCT}){2})${_ALPHA_LV3}`; +export const SYN_COLOR_TYPE = `${_COLOR_KEY}|hsla?\\(\\s*${SYN_HSL_LV3}\\s*\\)|rgba?\\(\\s*${SYN_RGB_LV3}\\s*\\)|(?:hsla?|hwb)\\(\\s*${SYN_HSL}\\s*\\)|(?:(?:ok)?lab|rgba?)\\(\\s*${SYN_MOD}\\s*\\)|(?:ok)?lch\\(\\s*${SYN_LCH}\\s*\\)|color\\(\\s*${SYN_FN_COLOR}\\s*\\)`; +export const SYN_MIX_PART = `(?:${SYN_COLOR_TYPE})(?:\\s+${PCT})?`; +export const SYN_MIX = `color-mix\\(\\s*in\\s+(?:${CS_MIX})\\s*,\\s*${SYN_MIX_PART}\\s*,\\s*${SYN_MIX_PART}\\s*\\)`; +export const SYN_MIX_CAPT = `color-mix\\(\\s*in\\s+(${CS_MIX})\\s*,\\s*(${SYN_MIX_PART})\\s*,\\s*(${SYN_MIX_PART})\\s*\\)`; + +/* formats */ +/* formats */ +export const VAL_COMP = 'computedValue' as const; +export const VAL_MIX = 'mixValue' as const; +export const VAL_SPEC = 'specifiedValue' as const; + +export type SpecialValueFormat = + typeof VAL_COMP | typeof VAL_MIX | typeof VAL_SPEC; + +/* numeric constants */ +export const DEC = 10; +export const DEG = 360; +export const DEG_HALF = 180; +export const DOZ = 12; +export const DUO = 2; +export const HALF = 0.5; +export const HEX = 16; +export const LAB_A = 500; +export const LAB_B = 200; +export const LAB_EPSILON = 216 / 24389; +export const LAB_KAPPA = 24389 / 27; +export const LAB_L = 116; +export const LINEAR_COEF = 12.92; +export const LINEAR_OFFSET = 0.055; +export const MAX_LENGTH = 1024; +export const MAX_PCT = 100; +export const MAX_RGB = 255; +export const OCT = 8; +export const POW_CUBE = 3; +export const POW_LINEAR = 2.4; +export const POW_SQR = 2; +export const PPTH = 0.001; +export const QUAD = 4; +export const SEXA = 60; +export const TRIA = 3; diff --git a/node_modules/@asamuzakjp/css-color/src/utils/css-calc-var.ts b/node_modules/@asamuzakjp/css-color/src/utils/css-calc-var.ts new file mode 100644 index 0000000..8386b09 --- /dev/null +++ b/node_modules/@asamuzakjp/css-color/src/utils/css-calc-var.ts @@ -0,0 +1,1289 @@ +/** + * css-calc-var + */ + +import { calc, conversionOptions as CalcOptions } from '@csstools/css-calc'; +import { CSSToken, TokenType, tokenize } from '@csstools/css-tokenizer'; +import { isValidColor } from '../resolvers/resolve-color'; +import { CalcASTNode, MatchedRegExp, Options } from '../typedef'; +import { createCacheKey, getCache, setCache } from './cache'; +import { isString, isStringOrNumber } from './common'; +import { getMaxLength, resolveLengthInPixels, roundToPrecision } from './util'; + +/* constants */ +import { + ANGLE, + FN_VAR, + HEX, + LENGTH, + MAX_PCT, + NUM, + SYN_FN_CALC, + SYN_FN_MATH_START, + SYN_FN_VAR, + SYN_FN_VAR_START, + TRIA, + VAL_SPEC +} from '../utils/constant'; + +const { + CloseParen: PAREN_CLOSE, + Comment: COMMENT, + Dimension: DIM, + EOF, + Function: FUNC, + Ident: IDENT, + OpenParen: PAREN_OPEN, + Whitespace: W_SPACE +} = TokenType; +const NAMESPACE = 'css-calc-var'; + +/* regexp */ +const REG_FN_CALC = new RegExp(SYN_FN_CALC); +const REG_FN_CALC_NUM = new RegExp(`^calc\\((${NUM})\\)$`); +const REG_FN_MATH_START = new RegExp(SYN_FN_MATH_START); +const REG_FN_VAR = new RegExp(SYN_FN_VAR); +const REG_FN_VAR_START = new RegExp(SYN_FN_VAR_START); +const REG_OPERATOR = /\s[*+/-]\s/; +const REG_PAREN_OPEN = /\($/; +const REG_TYPE_DIM = new RegExp(`^(${NUM})(${ANGLE}|${LENGTH})$`); +const REG_TYPE_DIM_PCT = new RegExp(`^(${NUM})(${ANGLE}|${LENGTH}|%)$`); +const REG_TYPE_PCT = new RegExp(`^(${NUM})%$`); +const REG_CSS_WIDE_KEYWORD = /^(?:inherit|initial|revert(?:-layer)?|unset)$/; + +/** + * Calclator + */ +export class Calculator { + /* private */ + // number + #hasNum: boolean; + #numSum: number[]; + #numMul: number[]; + // percentage + #hasPct: boolean; + #pctSum: number[]; + #pctMul: number[]; + // dimension + #hasDim: boolean; + #dimSum: string[]; + #dimSub: string[]; + #dimMul: string[]; + #dimDiv: string[]; + // et cetra + #hasEtc: boolean; + #etcSum: string[]; + #etcSub: string[]; + #etcMul: string[]; + #etcDiv: string[]; + // calc options + #calcOpts: CalcOptions; + + /** + * constructor + */ + constructor() { + // number + this.#hasNum = false; + this.#numSum = []; + this.#numMul = []; + // percentage + this.#hasPct = false; + this.#pctSum = []; + this.#pctMul = []; + // dimension + this.#hasDim = false; + this.#dimSum = []; + this.#dimSub = []; + this.#dimMul = []; + this.#dimDiv = []; + // et cetra + this.#hasEtc = false; + this.#etcSum = []; + this.#etcSub = []; + this.#etcMul = []; + this.#etcDiv = []; + // calc options + this.#calcOpts = { + toCanonicalUnits: true + }; + } + + get hasNum() { + return this.#hasNum; + } + + set hasNum(value: boolean) { + this.#hasNum = !!value; + } + + get numSum() { + return this.#numSum; + } + + get numMul() { + return this.#numMul; + } + + get hasPct() { + return this.#hasPct; + } + + set hasPct(value: boolean) { + this.#hasPct = !!value; + } + + get pctSum() { + return this.#pctSum; + } + + get pctMul() { + return this.#pctMul; + } + + get hasDim() { + return this.#hasDim; + } + + set hasDim(value: boolean) { + this.#hasDim = !!value; + } + + get dimSum() { + return this.#dimSum; + } + + get dimSub() { + return this.#dimSub; + } + + get dimMul() { + return this.#dimMul; + } + + get dimDiv() { + return this.#dimDiv; + } + + get hasEtc() { + return this.#hasEtc; + } + + set hasEtc(value: boolean) { + this.#hasEtc = !!value; + } + + get etcSum() { + return this.#etcSum; + } + + get etcSub() { + return this.#etcSub; + } + + get etcMul() { + return this.#etcMul; + } + + get etcDiv() { + return this.#etcDiv; + } + + /** + * clear values + */ + clear() { + // number + this.#hasNum = false; + this.#numSum.length = 0; + this.#numMul.length = 0; + // percentage + this.#hasPct = false; + this.#pctSum.length = 0; + this.#pctMul.length = 0; + // dimension + this.#hasDim = false; + this.#dimSum.length = 0; + this.#dimSub.length = 0; + this.#dimMul.length = 0; + this.#dimDiv.length = 0; + // et cetra + this.#hasEtc = false; + this.#etcSum.length = 0; + this.#etcSub.length = 0; + this.#etcMul.length = 0; + this.#etcDiv.length = 0; + } + + /** + * sort values + * @param values - values + * @returns sorted values + */ + sort(values: string[] = []): string[] { + const arr = [...values]; + if (arr.length > 1) { + arr.sort((a, b) => { + let res; + if (REG_TYPE_DIM_PCT.test(a) && REG_TYPE_DIM_PCT.test(b)) { + const [, valA, unitA] = a.match(REG_TYPE_DIM_PCT) as MatchedRegExp; + const [, valB, unitB] = b.match(REG_TYPE_DIM_PCT) as MatchedRegExp; + if (unitA === unitB) { + if (Number(valA) === Number(valB)) { + res = 0; + } else if (Number(valA) > Number(valB)) { + res = 1; + } else { + res = -1; + } + } else if (unitA > unitB) { + res = 1; + } else { + res = -1; + } + } else { + if (a === b) { + res = 0; + } else if (a > b) { + res = 1; + } else { + res = -1; + } + } + return res; + }); + } + return arr; + } + + /** + * multiply values + * @returns resolved value + */ + multiply(): string { + const value = []; + let num; + if (this.#hasNum) { + num = 1; + for (const i of this.#numMul) { + num *= i; + if (num === 0 || !Number.isFinite(num) || Number.isNaN(num)) { + break; + } + } + if (!this.#hasPct && !this.#hasDim && !this.hasEtc) { + if (Number.isFinite(num)) { + num = roundToPrecision(num, HEX); + } + value.push(num); + } + } + if (this.#hasPct) { + if (typeof num !== 'number') { + num = 1; + } + for (const i of this.#pctMul) { + num *= i; + if (num === 0 || !Number.isFinite(num) || Number.isNaN(num)) { + break; + } + } + if (Number.isFinite(num)) { + num = `${roundToPrecision(num, HEX)}%`; + } + if (!this.#hasDim && !this.hasEtc) { + value.push(num); + } + } + if (this.#hasDim) { + let dim = ''; + let mul = ''; + let div = ''; + if (this.#dimMul.length) { + if (this.#dimMul.length === 1) { + [mul] = this.#dimMul as [string]; + } else { + mul = `${this.sort(this.#dimMul).join(' * ')}`; + } + } + if (this.#dimDiv.length) { + if (this.#dimDiv.length === 1) { + [div] = this.#dimDiv as [string]; + } else { + div = `${this.sort(this.#dimDiv).join(' * ')}`; + } + } + if (Number.isFinite(num)) { + if (mul) { + if (div) { + if (div.includes('*')) { + dim = calc(`calc(${num} * ${mul} / (${div}))`, this.#calcOpts); + } else { + dim = calc(`calc(${num} * ${mul} / ${div})`, this.#calcOpts); + } + } else { + dim = calc(`calc(${num} * ${mul})`, this.#calcOpts); + } + } else if (div.includes('*')) { + dim = calc(`calc(${num} / (${div}))`, this.#calcOpts); + } else { + dim = calc(`calc(${num} / ${div})`, this.#calcOpts); + } + value.push(dim.replace(/^calc/, '')); + } else { + if (!value.length && num !== undefined) { + value.push(num); + } + if (mul) { + if (div) { + if (div.includes('*')) { + dim = calc(`calc(${mul} / (${div}))`, this.#calcOpts); + } else { + dim = calc(`calc(${mul} / ${div})`, this.#calcOpts); + } + } else { + dim = calc(`calc(${mul})`, this.#calcOpts); + } + if (value.length) { + value.push('*', dim.replace(/^calc/, '')); + } else { + value.push(dim.replace(/^calc/, '')); + } + } else { + dim = calc(`calc(${div})`, this.#calcOpts); + if (value.length) { + value.push('/', dim.replace(/^calc/, '')); + } else { + value.push('1', '/', dim.replace(/^calc/, '')); + } + } + } + } + if (this.#hasEtc) { + if (this.#etcMul.length) { + if (!value.length && num !== undefined) { + value.push(num); + } + const mul = this.sort(this.#etcMul).join(' * '); + if (value.length) { + value.push(`* ${mul}`); + } else { + value.push(`${mul}`); + } + } + if (this.#etcDiv.length) { + const div = this.sort(this.#etcDiv).join(' * '); + if (div.includes('*')) { + if (value.length) { + value.push(`/ (${div})`); + } else { + value.push(`1 / (${div})`); + } + } else if (value.length) { + value.push(`/ ${div}`); + } else { + value.push(`1 / ${div}`); + } + } + } + if (value.length) { + return value.join(' '); + } + return ''; + } + + /** + * sum values + * @returns resolved value + */ + sum(): string { + const value = []; + if (this.#hasNum) { + let num = 0; + for (const i of this.#numSum) { + num += i; + if (!Number.isFinite(num) || Number.isNaN(num)) { + break; + } + } + value.push(num); + } + if (this.#hasPct) { + let num: number | string = 0; + for (const i of this.#pctSum) { + num += i; + if (!Number.isFinite(num)) { + break; + } + } + if (Number.isFinite(num)) { + num = `${num}%`; + } + if (value.length) { + value.push(`+ ${num}`); + } else { + value.push(num); + } + } + if (this.#hasDim) { + let dim, sum, sub; + if (this.#dimSum.length) { + sum = this.sort(this.#dimSum).join(' + '); + } + if (this.#dimSub.length) { + sub = this.sort(this.#dimSub).join(' + '); + } + if (sum) { + if (sub) { + if (sub.includes('-')) { + dim = calc(`calc(${sum} - (${sub}))`, this.#calcOpts); + } else { + dim = calc(`calc(${sum} - ${sub})`, this.#calcOpts); + } + } else { + dim = calc(`calc(${sum})`, this.#calcOpts); + } + } else { + dim = calc(`calc(-1 * (${sub}))`, this.#calcOpts); + } + if (value.length) { + value.push('+', dim.replace(/^calc/, '')); + } else { + value.push(dim.replace(/^calc/, '')); + } + } + if (this.#hasEtc) { + if (this.#etcSum.length) { + const sum = this.sort(this.#etcSum) + .map(item => { + let res; + if ( + REG_OPERATOR.test(item) && + !item.startsWith('(') && + !item.endsWith(')') + ) { + res = `(${item})`; + } else { + res = item; + } + return res; + }) + .join(' + '); + if (value.length) { + if (this.#etcSum.length > 1) { + value.push(`+ (${sum})`); + } else { + value.push(`+ ${sum}`); + } + } else { + value.push(`${sum}`); + } + } + if (this.#etcSub.length) { + const sub = this.sort(this.#etcSub) + .map(item => { + let res; + if ( + REG_OPERATOR.test(item) && + !item.startsWith('(') && + !item.endsWith(')') + ) { + res = `(${item})`; + } else { + res = item; + } + return res; + }) + .join(' + '); + if (value.length) { + if (this.#etcSub.length > 1) { + value.push(`- (${sub})`); + } else { + value.push(`- ${sub}`); + } + } else if (this.#etcSub.length > 1) { + value.push(`-1 * (${sub})`); + } else { + value.push(`-1 * ${sub}`); + } + } + } + if (value.length) { + return value.join(' '); + } + return ''; + } +} + +/** + * sort calc values + * @param values - values to sort + * @param [finalize] - finalize values + * @returns sorted values + */ +export const sortCalcValues = ( + values: (number | string)[] = [], + finalize: boolean = false +): string => { + if (values.length < TRIA) { + throw new Error(`Unexpected array length ${values.length}.`); + } + const start = values.shift(); + if (!isString(start) || !start.endsWith('(')) { + throw new Error(`Unexpected token ${start}.`); + } + const end = values.pop(); + if (end !== ')') { + throw new Error(`Unexpected token ${end}.`); + } + if (values.length === 1) { + const [value] = values; + if (!isStringOrNumber(value)) { + throw new Error(`Unexpected token ${value}.`); + } + return `${start}${value}${end}`; + } + const sortedValues = []; + const cal = new Calculator(); + let operator: string = ''; + let hasAddSub = false; + for (const value of values) { + if (!isStringOrNumber(value)) { + throw new Error(`Unexpected token ${value}.`); + } + if (value === '*' || value === '/') { + operator = value; + } else if (value === '+' || value === '-') { + const sortedValue = cal.multiply(); + if (sortedValue) { + sortedValues.push(sortedValue, value); + } + // Mark presence of + or - + hasAddSub = true; + cal.clear(); + operator = ''; + } else { + const numValue = Number(value); + const strValue = `${value}`; + switch (operator) { + case '/': { + if (Number.isFinite(numValue)) { + cal.hasNum = true; + cal.numMul.push(1 / numValue); + } else if (REG_TYPE_PCT.test(strValue)) { + const [, val] = strValue.match(REG_TYPE_PCT) as MatchedRegExp; + cal.hasPct = true; + cal.pctMul.push((MAX_PCT * MAX_PCT) / Number(val)); + } else if (REG_TYPE_DIM.test(strValue)) { + cal.hasDim = true; + cal.dimDiv.push(strValue); + } else { + cal.hasEtc = true; + cal.etcDiv.push(strValue); + } + break; + } + case '*': + default: { + if (Number.isFinite(numValue)) { + cal.hasNum = true; + cal.numMul.push(numValue); + } else if (REG_TYPE_PCT.test(strValue)) { + const [, val] = strValue.match(REG_TYPE_PCT) as MatchedRegExp; + cal.hasPct = true; + cal.pctMul.push(Number(val)); + } else if (REG_TYPE_DIM.test(strValue)) { + cal.hasDim = true; + cal.dimMul.push(strValue); + } else { + cal.hasEtc = true; + cal.etcMul.push(strValue); + } + } + } + } + } + const sortedValue = cal.multiply(); + if (sortedValue) { + sortedValues.push(sortedValue); + } + let resolvedValue = ''; + if (finalize && hasAddSub) { + const finalizedValues = []; + cal.clear(); + operator = ''; + for (const value of sortedValues) { + if (value === '+' || value === '-') { + operator = value; + } else { + const numValue = Number(value); + const strValue = `${value}`; + switch (operator) { + case '-': { + if (Number.isFinite(numValue)) { + cal.hasNum = true; + cal.numSum.push(-1 * numValue); + } else if (REG_TYPE_PCT.test(strValue)) { + const [, val] = strValue.match(REG_TYPE_PCT) as MatchedRegExp; + cal.hasPct = true; + cal.pctSum.push(-1 * Number(val)); + } else if (REG_TYPE_DIM.test(strValue)) { + cal.hasDim = true; + cal.dimSub.push(strValue); + } else { + cal.hasEtc = true; + cal.etcSub.push(strValue); + } + break; + } + case '+': + default: { + if (Number.isFinite(numValue)) { + cal.hasNum = true; + cal.numSum.push(numValue); + } else if (REG_TYPE_PCT.test(strValue)) { + const [, val] = strValue.match(REG_TYPE_PCT) as MatchedRegExp; + cal.hasPct = true; + cal.pctSum.push(Number(val)); + } else if (REG_TYPE_DIM.test(strValue)) { + cal.hasDim = true; + cal.dimSum.push(strValue); + } else { + cal.hasEtc = true; + cal.etcSum.push(strValue); + } + } + } + } + } + const sortedValue = cal.sum(); + finalizedValues.push(sortedValue); + cal.clear(); + operator = ''; + resolvedValue = finalizedValues.join(' ').replace(/\+\s-/g, '- '); + } else { + resolvedValue = sortedValues.join(' ').replace(/\+\s-/g, '- '); + } + if ( + resolvedValue.startsWith('(') && + resolvedValue.endsWith(')') && + resolvedValue.lastIndexOf('(') === 0 && + resolvedValue.indexOf(')') === resolvedValue.length - 1 + ) { + resolvedValue = resolvedValue.substring(1, resolvedValue.length - 1); + } + return `${start}${resolvedValue}${end}`; +}; + +/** + * sort math function terms + * @param expr - unwrapped calc expression + * @returns sorted expression + */ +export const sortMathFnTerms = (expr: string): string => { + const tokens = tokenize({ css: expr }); + const terms: string[] = []; + let currentTerm = ''; + let currentSign = ''; + let depth = 0; + for (const token of tokens) { + const [type, value] = token as [TokenType, string]; + if (type === PAREN_OPEN || type === FUNC) { + depth++; + } else if (type === PAREN_CLOSE) { + depth--; + } + if (depth === 0 && (value === '+' || value === '-')) { + if (currentTerm.trim()) { + terms.push((currentSign === '-' ? '-' : '') + currentTerm.trim()); + } + currentTerm = ''; + currentSign = value; + continue; + } + currentTerm += value; + } + if (currentTerm.trim()) { + terms.push((currentSign === '-' ? '-' : '') + currentTerm.trim()); + } + terms.sort((a, b) => { + const reg = /^(-?(?:\d+(?:\.\d+)?|\.\d+))([a-z%]*)$/i; + const matchA = a.match(reg); + const matchB = b.match(reg); + if (matchA && matchB) { + const numA = Number(matchA[1] as string); + const numB = Number(matchB[1] as string); + const unitA = matchA[2] as string; + const unitB = matchB[2] as string; + if (unitA === unitB) { + return numA - numB; + } + return unitA > unitB ? 1 : -1; + } + if (a === b) { + return 0; + } + return a > b ? 1 : -1; + }); + const firstTerm = terms[0]; + if (firstTerm === undefined) { + return expr; + } + let res: string = firstTerm; + for (const term of terms.slice(1)) { + if (term.startsWith('-')) { + res += ' - ' + term.substring(1); + } else { + res += ' + ' + term; + } + } + return res; +}; + +/** + * resolve AST node + * @param node - AST node + * @param isRoot - is root node + * @returns resolved value + */ +export const resolveNode = (node: CalcASTNode[], isRoot: boolean): string => { + const firstItemRaw = node[0]; + const isCommaMathFnNode = + isString(firstItemRaw) && REG_FN_MATH_START.test(firstItemRaw); + const flatItems: string[] = []; + for (const item of node) { + if (Array.isArray(item)) { + flatItems.push(resolveNode(item, isCommaMathFnNode)); + } else { + flatItems.push(item); + } + } + const hasComma = flatItems.includes(','); + const firstItem = flatItems[0] ?? ''; + const isCommaMathFn = + isString(firstItem) && REG_FN_MATH_START.test(firstItem); + if (hasComma && isCommaMathFn && flatItems.at(-1) === ')') { + const fnName = flatItems.shift() as string; + const fnEnd = flatItems.pop() as string; + const args: string[][] = []; + let currentArg: string[] = []; + for (const item of flatItems) { + if (item === ',') { + args.push(currentArg); + currentArg = []; + } else { + currentArg.push(item); + } + } + if (currentArg.length) { + args.push(currentArg); + } + const resolvedArgs = args.map(argNodes => { + if (argNodes.length >= TRIA) { + const temp = ['calc(', ...argNodes, ')']; + const sorted = sortCalcValues(temp, true); + const unwrapped = sorted.substring(5, sorted.length - 1); + return sortMathFnTerms(unwrapped); + } else if (argNodes.length === 1) { + const item = argNodes[0]; + if (isString(item) && item.startsWith('calc(') && item.endsWith(')')) { + const unwrapped = item.substring(5, item.length - 1); + return sortMathFnTerms(unwrapped); + } + } + return argNodes.join(''); + }); + return `${fnName}${resolvedArgs.join(', ')}${fnEnd}`; + } + if (isRoot) { + if (!hasComma) { + if (flatItems.length >= TRIA) { + return sortCalcValues(flatItems, true); + } + const first = flatItems[0] ?? ''; + if (first.endsWith('(')) { + return flatItems.join(''); + } + return /^[a-z-]+\(/.test(first) ? first : `calc(${first})`; + } + return flatItems.join('').replace(/,\s*/g, ', '); + } + if (flatItems.length >= TRIA && !hasComma) { + let serialized = sortCalcValues(flatItems, false); + if (REG_FN_VAR_START.test(serialized)) { + serialized = calc(serialized, { toCanonicalUnits: true }); + } + return serialized; + } + return flatItems.join('').replace(/,\s*/g, ', '); +}; + +/** + * serialize calc + * @param value - CSS value + * @param [opt] - options + * @returns serialized value + */ +export const serializeCalc = (value: string, opt: Options = {}): string => { + if (!isString(value)) { + throw new TypeError(`${value} is not a string.`); + } + const { format = '' } = opt; + if (!REG_FN_VAR_START.test(value) || format !== VAL_SPEC) { + return value; + } + value = value.toLowerCase().trim(); + const cacheKey: string = createCacheKey( + { + namespace: NAMESPACE, + name: 'serializeCalc', + value + }, + opt + ); + const cachedResult = getCache(cacheKey); + if (cachedResult !== false) { + return cachedResult.item as string; + } + const items: string[] = tokenize({ css: value }) + .map((token: CSSToken): string => { + const [type, val] = token as [TokenType, string]; + let res = ''; + if (type !== W_SPACE && type !== COMMENT) { + res = val; + } + return res; + }) + .filter(v => v); + const stack: [CalcASTNode[], ...CalcASTNode[][]] = [[]]; + for (const item of items) { + if (REG_PAREN_OPEN.test(item)) { + const newNode: CalcASTNode[] = [item]; + const parent = stack.at(-1) as CalcASTNode[]; + parent.push(newNode); + stack.push(newNode); + } else if (item === ')') { + if (stack.length > 1) { + const currentLevel = stack.pop() as CalcASTNode[]; + currentLevel.push(item); + } else { + const root = stack[0] as CalcASTNode[]; + root.push(item); + } + } else { + const parent = stack.at(-1) as CalcASTNode[]; + parent.push(item); + } + } + let serializedCalc = ''; + const rootItems = stack[0]; + if (rootItems.length === 1 && Array.isArray(rootItems[0])) { + serializedCalc = resolveNode(rootItems[0], true); + } else { + serializedCalc = resolveNode(rootItems, true); + } + setCache(cacheKey, serializedCalc); + return serializedCalc; +}; + +/** + * resolve dimension + * @param token - CSS token + * @param [opt] - options + * @returns resolved value + */ +export const resolveDimension = ( + token: CSSToken, + opt: Options = {} +): string | null => { + if (!Array.isArray(token)) { + throw new TypeError(`${token} is not an array.`); + } + const [, , , , detail = {}] = token; + const { unit, value } = detail as { + unit: string; + value: number; + }; + if (unit === 'px') { + return `${value}${unit}`; + } + const pixelValue = resolveLengthInPixels(Number(value), unit, opt); + if (Number.isFinite(pixelValue)) { + return `${roundToPrecision(pixelValue, HEX)}px`; + } + return null; +}; + +/** + * parse CSS calc() tokens + * @param tokens - CSS tokens + * @param [opt] - options + * @returns parsed tokens + */ +export const parseCalcTokens = ( + tokens: CSSToken[], + opt: Options = {} +): string[] => { + if (!Array.isArray(tokens)) { + throw new TypeError(`${tokens} is not an array.`); + } + const { format = '' } = opt; + const mathFunc = new Set(); + let nest = 0; + const res: string[] = []; + for (const token of tokens) { + if (!Array.isArray(token)) { + throw new TypeError(`${token} is not an array.`); + } + const [type = '', value = ''] = token as [TokenType, string]; + switch (type) { + case DIM: { + if (format === VAL_SPEC && !mathFunc.has(nest)) { + res.push(value); + } else { + const resolvedValue = resolveDimension(token, opt); + if (isString(resolvedValue)) { + res.push(resolvedValue); + } else { + res.push(value); + } + } + break; + } + case FUNC: + case PAREN_OPEN: { + res.push(value); + nest++; + if (REG_FN_MATH_START.test(value)) { + mathFunc.add(nest); + } + break; + } + case PAREN_CLOSE: { + if (res.length) { + const lastValue = res.at(-1); + if (lastValue === ' ') { + res.splice(-1, 1, value); + } else { + res.push(value); + } + } else { + res.push(value); + } + if (mathFunc.has(nest)) { + mathFunc.delete(nest); + } + nest--; + break; + } + case W_SPACE: { + if (res.length) { + const lastValue = res.at(-1); + if ( + isString(lastValue) && + !lastValue.endsWith('(') && + lastValue !== ' ' + ) { + res.push(value); + } + } + break; + } + default: { + if (type !== COMMENT && type !== EOF) { + res.push(value); + } + } + } + } + return res; +}; + +/** + * CSS calc() + * @param value - CSS value including calc() + * @param [opt] - options + * @returns resolved value + */ +export const cssCalc = (value: string, opt: Options = {}): string => { + if (!isString(value)) { + throw new TypeError(`${value} is not a string.`); + } + const options = { + ...opt + }; + const maxLength = getMaxLength(options); + if (value.length > maxLength) { + return ''; + } + const { format } = options; + if (REG_FN_VAR.test(value)) { + if (format === VAL_SPEC) { + return value; + } else { + const resolvedValue = resolveVar(value, options); + if (isString(resolvedValue)) { + return resolvedValue; + } else { + return ''; + } + } + } else if (!REG_FN_CALC.test(value)) { + return value; + } + value = value.toLowerCase().trim(); + const cacheKey: string = createCacheKey( + { + namespace: NAMESPACE, + name: 'cssCalc', + value + }, + options + ); + const cachedResult = getCache(cacheKey); + if (cachedResult !== false) { + return cachedResult.item as string; + } + const tokens = tokenize({ css: value }); + const values = parseCalcTokens(tokens, options); + let resolvedValue: string = calc(values.join(''), { + toCanonicalUnits: true + }); + if (REG_FN_VAR_START.test(value)) { + if (REG_TYPE_DIM_PCT.test(resolvedValue)) { + const [, val, unit] = resolvedValue.match( + REG_TYPE_DIM_PCT + ) as MatchedRegExp; + resolvedValue = `${roundToPrecision(Number(val), HEX)}${unit}`; + } + // wrap with `calc()` + if ( + resolvedValue && + !REG_FN_VAR_START.test(resolvedValue) && + format === VAL_SPEC + ) { + resolvedValue = `calc(${resolvedValue})`; + } + } + if (format === VAL_SPEC) { + if (/\s[-+*/]\s/.test(resolvedValue) && !resolvedValue.includes('NaN')) { + resolvedValue = serializeCalc(resolvedValue, options); + } else if (REG_FN_CALC_NUM.test(resolvedValue)) { + const [, val] = resolvedValue.match(REG_FN_CALC_NUM) as MatchedRegExp; + resolvedValue = `calc(${roundToPrecision(Number(val), HEX)})`; + } + } + setCache(cacheKey, resolvedValue); + return resolvedValue; +}; + +/** + * resolve custom property + * @param tokens - CSS tokens + * @param [opt] - options + * @returns result - [tokens, resolvedValue] + */ +export function resolveCustomProperty( + tokens: CSSToken[], + opt: Options = {} +): [CSSToken[], string] { + if (!Array.isArray(tokens)) { + throw new TypeError(`${tokens} is not an array.`); + } + const { customProperty = {} } = opt; + const items: string[] = []; + while (tokens.length) { + const token = tokens.shift(); + if (!token) { + break; + } + if (!Array.isArray(token)) { + throw new TypeError(`${token} is not an array.`); + } + const [type, value] = token as [TokenType, string]; + // end of var() + if (type === PAREN_CLOSE) { + break; + } + // nested var() + if (value === FN_VAR) { + const [, item] = resolveCustomProperty(tokens, opt); + if (item) { + items.push(item); + } + } else if (value && type === IDENT) { + if (value.startsWith('--')) { + let item: string | undefined; + if (customProperty[value]) { + const resolver = customProperty[value]; + item = typeof resolver === 'function' ? resolver(value) : resolver; + } else if (typeof customProperty.callback === 'function') { + item = customProperty.callback(value); + } + if (item) { + items.push(item); + } + } else { + items.push(value); + } + } + } + let resolveAsColor = false; + if (items.length > 1) { + resolveAsColor = isValidColor(items.at(-1)); + } + let resolvedValue = ''; + for (let item of items) { + item = item.trim(); + if (REG_FN_VAR.test(item)) { + // recurse resolveVar() + const resolvedItem = resolveVar(item, opt); + if (isString(resolvedItem)) { + if (!resolveAsColor || isValidColor(resolvedItem)) { + resolvedValue = resolvedItem; + } + } + } else if (REG_FN_CALC.test(item)) { + item = cssCalc(item, opt); + if (!resolveAsColor || isValidColor(item)) { + resolvedValue = item; + } + } else if (item && !REG_CSS_WIDE_KEYWORD.test(item)) { + if (!resolveAsColor || isValidColor(item)) { + resolvedValue = item; + } + } + if (resolvedValue) { + break; + } + } + return [tokens, resolvedValue]; +} + +/** + * parse CSS var() tokens + * @param tokens - CSS tokens + * @param [opt] - options + * @returns parsed tokens + */ +export function parseVarTokens( + tokens: CSSToken[], + opt: Options = {} +): string[] | null { + const res: string[] = []; + while (tokens.length) { + const token = tokens.shift(); + if (!token) { + break; + } + const [type = '', value = ''] = token as [TokenType, string]; + if (value === FN_VAR) { + const [, resolvedValue] = resolveCustomProperty(tokens, opt); + if (!resolvedValue) { + return null; + } + res.push(resolvedValue); + } else { + switch (type) { + case PAREN_CLOSE: { + if (res.length) { + if (res.at(-1) === ' ') { + res[res.length - 1] = value; + } else { + res.push(value); + } + } else { + res.push(value); + } + break; + } + case W_SPACE: { + if (res.length) { + const lastValue = res.at(-1); + if ( + isString(lastValue) && + !lastValue.endsWith('(') && + lastValue !== ' ' + ) { + res.push(value); + } + } + break; + } + default: { + if (type !== COMMENT && type !== EOF) { + res.push(value); + } + } + } + } + } + return res; +} + +/** + * resolve CSS var() + * @param value - CSS value including var() + * @param [opt] - options + * @returns resolved value + */ +export function resolveVar(value: string, opt: Options = {}): string | null { + if (!isString(value)) { + throw new TypeError(`${value} is not a string.`); + } + const maxLength = getMaxLength(opt); + if (value.length > maxLength) { + return null; + } + if (!REG_FN_VAR.test(value) || opt.format === VAL_SPEC) { + return value; + } + value = value.trim(); + const cacheKey: string = createCacheKey( + { + namespace: NAMESPACE, + name: 'resolveVar', + value + }, + opt + ); + const cachedResult = getCache(cacheKey); + if (cachedResult !== false) { + return cachedResult.item as string | null; + } + const tokens = tokenize({ css: value }); + const values = parseVarTokens(tokens, opt); + if (Array.isArray(values)) { + let color = values.join(''); + // Check color length + if (color.length > maxLength) { + setCache(cacheKey, null); + return null; + } + if (REG_FN_CALC.test(color)) { + color = cssCalc(color, opt); + } + setCache(cacheKey, color); + return color; + } else { + setCache(cacheKey, null); + return null; + } +} + +/** + * CSS var() + * @param value - CSS value including var() + * @param [opt] - options + * @returns resolved value + */ +export const cssVar = (value: string, opt: Options = {}): string => { + const options = { + ...opt + }; + const resolvedValue = resolveVar(value, options); + if (isString(resolvedValue)) { + return resolvedValue; + } + return ''; +}; diff --git a/node_modules/@asamuzakjp/css-color/src/utils/length-percentage.ts b/node_modules/@asamuzakjp/css-color/src/utils/length-percentage.ts new file mode 100644 index 0000000..a41efd6 --- /dev/null +++ b/node_modules/@asamuzakjp/css-color/src/utils/length-percentage.ts @@ -0,0 +1,206 @@ +/** + * length-percentage + */ + +import { + CSSToken, + ParseError, + tokenize, + TokenType +} from '@csstools/css-tokenizer'; +import { CalculationState } from '../typedef'; +import { isString } from './common'; + +/* constants */ +import { LENGTH } from './constant'; + +/* regexp */ +const REG_LENGTH = new RegExp(`^(?:${LENGTH})$`, 'i'); +const REG_CALC = /^(?:calc|min|max|clamp)\(/i; +const REG_CALC_KEYWORD = /^(?:e|pi|-?infinity|NaN)$/i; + +/** + * Advance past whitespace and comments in a calculation. + * @param state - token stream and cursor + */ +export const skipCalculationWhitespace = (state: CalculationState): void => { + while ( + state.tokens[state.index]![0] === TokenType.Whitespace || + state.tokens[state.index]![0] === TokenType.Comment + ) { + state.index++; + } +}; + +/** + * Check for actual whitespace, ignoring adjacent comments. + * @param tokens - token stream + * @param start - first token to check + * @param step - direction to scan + * @returns whether whitespace occurs before another non-comment token + */ +export const hasCalculationWhitespace = ( + tokens: CSSToken[], + start: number, + step: 1 | -1 +): boolean => { + for (let i = start; i >= 0 && i < tokens.length; i += step) { + if (tokens[i]![0] === TokenType.Whitespace) { + return true; + } + if (tokens[i]![0] !== TokenType.Comment) { + break; + } + } + return false; +}; + +/** + * Parse multiplication and division of calculation operands. + * Multiplication requires a number on one side, division a number divisor. + * This subset intentionally excludes CSS Values Level 4 typed arithmetic. + * @param state - token stream and cursor + * @returns calculation type or null on failure + */ +export const parseCalculationProduct = ( + state: CalculationState +): number | null => { + let type = parseCalculationValue(state); + if (type === null) { + return null; + } + skipCalculationWhitespace(state); + while ( + state.tokens[state.index]![0] === TokenType.Delim && + (state.tokens[state.index]![1] === '*' || + state.tokens[state.index]![1] === '/') + ) { + const operator = state.tokens[state.index++]![1]; + const right = parseCalculationValue(state); + if ( + right === null || + (operator === '*' ? type !== 0 && right !== 0 : right !== 0) + ) { + return null; + } + type += right; + skipCalculationWhitespace(state); + } + return type; +}; + +/** + * Parse addition and subtraction, requiring matching operand types. + * @param state - token stream and cursor + * @returns calculation type or null on failure + */ +export const parseCalculationSum = (state: CalculationState): number | null => { + const type = parseCalculationProduct(state); + if (type === null) { + return null; + } + while ( + state.tokens[state.index]![0] === TokenType.Delim && + (state.tokens[state.index]![1] === '+' || + state.tokens[state.index]![1] === '-') + ) { + if ( + !hasCalculationWhitespace(state.tokens, state.index - 1, -1) || + !hasCalculationWhitespace(state.tokens, state.index + 1, 1) + ) { + return null; + } + state.index++; + if (parseCalculationProduct(state) !== type) { + return null; + } + } + return type; +}; + +/** + * Parse a scalar, length, percentage, parenthesized sum or math function. + * Percentages receive the length percent hint in this context. + * @param state - token stream and cursor + * @returns calculation type or null on failure + */ +export function parseCalculationValue(state: CalculationState): number | null { + skipCalculationWhitespace(state); + if (state.tokens[state.index]![0] === TokenType.EOF) { + return null; + } + const token = state.tokens[state.index++]!; + switch (token[0]) { + case TokenType.Number: { + return 0; + } + case TokenType.Percentage: { + return 1; + } + case TokenType.Dimension: { + return REG_LENGTH.test(token[4].unit) ? 1 : null; + } + case TokenType.Ident: { + return REG_CALC_KEYWORD.test(token[4].value) ? 0 : null; + } + case TokenType.OpenParen: + case TokenType.Function: { + const name = + token[0] === TokenType.Function ? token[4].value.toLowerCase() : 'calc'; + if (!['calc', 'min', 'max', 'clamp'].includes(name)) { + return null; + } + const type = parseCalculationSum(state); + if (type === null) { + return null; + } + let count = 1; + while (state.tokens[state.index]![0] === TokenType.Comma) { + state.index++; + if (parseCalculationSum(state) !== type) { + return null; + } + count++; + } + if ( + state.tokens[state.index]![0] !== TokenType.CloseParen || + (name === 'calc' && count !== 1) || + (name === 'clamp' && count !== 3) + ) { + return null; + } + state.index++; + return type; + } + default: { + return null; + } + } +} + +/** + * Validate a calculation in a length-percentage context. Types are represented + * as 0 for numbers and 1 for lengths/percentages, with scalar products only. + * @param value - calculation + * @returns whether the calculation has type length-percentage + */ +export const isLengthPercentageCalculation = (value: unknown): boolean => { + if (!isString(value) || !REG_CALC.test(value)) { + return false; + } + const errors: ParseError[] = []; + const state: CalculationState = { + tokens: tokenize( + { css: value }, + { onParseError: errors.push.bind(errors) } + ), + index: 0 + }; + const type = parseCalculationValue(state); + skipCalculationWhitespace(state); + return ( + errors.length === 0 && + type === 1 && + state.tokens[state.index]![0] === TokenType.EOF + ); +}; diff --git a/node_modules/@asamuzakjp/css-color/src/utils/util.ts b/node_modules/@asamuzakjp/css-color/src/utils/util.ts new file mode 100644 index 0000000..f85d28e --- /dev/null +++ b/node_modules/@asamuzakjp/css-color/src/utils/util.ts @@ -0,0 +1,581 @@ +/** + * util + */ + +import { TokenType, tokenize } from '@csstools/css-tokenizer'; +import { + HueArc, + MatchedRegExp, + Options, + SpecifiedColorChannels +} from '../typedef'; +import { createCacheKey, getCache, setCache } from './cache'; +import { isString } from './common'; + +/* constants */ +import { + ANGLE, + DEC, + DEG, + DEG_HALF, + DUO, + HEX, + MAX_LENGTH, + MAX_PCT, + MAX_RGB, + NONE, + NUM, + PPTH, + TRIA, + VAL_MIX, + VAL_SPEC +} from './constant'; +const NAMESPACE = 'util'; +const { + CloseParen: PAREN_CLOSE, + Comma: COMMA, + Comment: COMMENT, + Delim: DELIM, + EOF, + Function: FUNC, + OpenParen: PAREN_OPEN, + Whitespace: W_SPACE +} = TokenType; + +/* regexp */ +const REG_ANGLE_TO_DEG = new RegExp(`^(${NUM})(${ANGLE})?$`); +const REG_COMMA = /^,$/; +const REG_DASHED_IDENT = /--[\w-]+/g; +const REG_SLASH = /^\/$/; +const REG_WHITESPACE = /^\s+$/; + +/* absolute font size to pixel ratio */ +const absoluteFontSize = new Map([ + ['xx-small', 9 / 16], + ['x-small', 5 / 8], + ['small', 13 / 16], + ['medium', 1], + ['large', 9 / 8], + ['x-large', 3 / 2], + ['xx-large', 2], + ['xxx-large', 3] +]); + +/* relative font size to pixel ratio */ +const relativeFontSize = new Map([ + ['smaller', 1 / 1.2], + ['larger', 1.2] +]); + +/* absolute length to pixel ratio */ +const absoluteLength = new Map([ + ['cm', 96 / 2.54], + ['mm', 96 / 25.4], + ['q', 96 / 101.6], + ['in', 96], + ['pc', 16], + ['pt', 96 / 72], + ['px', 1] +]); + +/* relative length to pixel ratio */ +const relativeLength = new Map([ + ['rcap', 1], + ['rch', 0.5], + ['rem', 1], + ['rex', 0.5], + ['ric', 1], + ['rlh', 1.2] +]); + +/** + * get max length + * @param [opt] - options + * @returns max length + */ +export const getMaxLength = (opt: Options = {}): number => { + const { maxLength } = opt; + if ( + Number.isInteger(maxLength) && + (maxLength as number) > 0 && + (maxLength as number) < MAX_LENGTH + ) { + return maxLength as number; + } + return MAX_LENGTH; +}; + +/** + * split value + * NOTE: comments are stripped, it can be preserved if, in the options param, + * `delimiter` is either ',' or '/' and with `preserveComment` set to `true` + * @param value - CSS value + * @param [opt] - options + * @returns array of values + */ +export const splitValue = (value: string, opt: Options = {}): string[] => { + if (!isString(value)) { + throw new TypeError(`${value} is not a string.`); + } + const options = { + ...opt + }; + const strValue = value.trim(); + const maxLength = getMaxLength(options); + if (!strValue || strValue.length > maxLength) { + return []; + } + const { delimiter = ' ', preserveComment = false } = options; + const cacheKey: string = createCacheKey( + { + namespace: NAMESPACE, + name: 'splitValue', + value: strValue + }, + { delimiter, preserveComment } + ); + const cachedResult = getCache(cacheKey); + if (cachedResult) { + return [...cachedResult.item]; + } + let regDelimiter; + switch (delimiter) { + case ',': { + regDelimiter = REG_COMMA; + break; + } + case '/': { + regDelimiter = REG_SLASH; + break; + } + default: { + regDelimiter = REG_WHITESPACE; + } + } + const tokens = tokenize({ css: strValue }); + let nest = 0; + let currentStr = ''; + const res: string[] = []; + for (const [type, val] of tokens) { + switch (type) { + case COMMA: + case DELIM: { + if (nest === 0 && regDelimiter.test(val)) { + res.push(currentStr.trim()); + currentStr = ''; + } else { + currentStr += val; + } + break; + } + case COMMENT: { + if (preserveComment && (delimiter === ',' || delimiter === '/')) { + currentStr += val; + } + break; + } + case FUNC: + case PAREN_OPEN: { + currentStr += val; + nest++; + break; + } + case PAREN_CLOSE: { + currentStr += val; + nest--; + break; + } + case W_SPACE: { + if (regDelimiter.test(val)) { + if (nest === 0) { + if (currentStr) { + res.push(currentStr.trim()); + currentStr = ''; + } + } else { + currentStr += ' '; + } + } else if (!currentStr.endsWith(' ')) { + currentStr += ' '; + } + break; + } + default: { + if (type === EOF) { + res.push(currentStr.trim()); + currentStr = ''; + } else { + currentStr += val; + } + } + } + } + setCache(cacheKey, res); + return [...res]; +}; + +/** + * extract dashed-ident tokens + * @param value - CSS value + * @returns array of dashed-ident tokens + */ +export const extractDashedIdent = (value: string): string[] => { + if (!isString(value)) { + throw new TypeError(`${value} is not a string.`); + } + const strValue = value.trim(); + if (!strValue) { + return []; + } + const cacheKey: string = createCacheKey({ + namespace: NAMESPACE, + name: 'extractDashedIdent', + value: strValue + }); + const cachedResult = getCache(cacheKey); + if (cachedResult) { + return [...cachedResult.item]; + } + const matches = strValue.match(REG_DASHED_IDENT); + const res = matches ? [...new Set(matches)] : []; + setCache(cacheKey, res); + return [...res]; +}; + +/** + * round to specified precision + * @param value - numeric value + * @param bit - minimum bits + * @returns rounded value + */ +export const roundToPrecision = (value: number, bit: number = 0): number => { + if (!Number.isFinite(value)) { + throw new TypeError(`${value} is not a finite number.`); + } + if (!Number.isFinite(bit)) { + throw new TypeError(`${bit} is not a finite number.`); + } + if (bit < 0 || bit > HEX) { + throw new RangeError(`${bit} is not between 0 and ${HEX}.`); + } + if (bit === 0) { + return Math.round(value); + } + const precision = bit === HEX ? 6 : bit < DEC ? 4 : 5; + return parseFloat(value.toPrecision(precision)); +}; + +/** + * interpolate hue + * @param hueA - hue value + * @param hueB - hue value + * @param arc - shorter | longer | increasing | decreasing + * @returns result - [hueA, hueB] + */ +export const interpolateHue = ( + hueA: number, + hueB: number, + arc: HueArc | string = 'shorter' +): [number, number] => { + if (!Number.isFinite(hueA)) { + throw new TypeError(`${hueA} is not a finite number.`); + } + if (!Number.isFinite(hueB)) { + throw new TypeError(`${hueB} is not a finite number.`); + } + let a = hueA; + let b = hueB; + switch (arc) { + case 'decreasing': { + if (b > a) { + a += DEG; + } + break; + } + case 'increasing': { + if (b < a) { + b += DEG; + } + break; + } + case 'longer': { + if (b > a && b < a + DEG_HALF) { + a += DEG; + } else if (b > a - DEG_HALF && b <= a) { + b += DEG; + } + break; + } + case 'shorter': + default: { + if (b > a + DEG_HALF) { + a += DEG; + } else if (b < a - DEG_HALF) { + b += DEG; + } + } + } + return [a, b]; +}; + +/** + * resolve length in pixels + * @param value - value + * @param unit - unit + * @param [opt] - options + * @returns pixelated value + */ +export const resolveLengthInPixels = ( + value: number | string, + unit: string | undefined, + opt: Options = {} +): number => { + const { dimension = {} } = opt; + const { callback, em, rem, vh, vw } = dimension; + if (isString(value)) { + const str = value.toLowerCase().trim(); + const maxLength = getMaxLength(opt); + if (str.length > maxLength) { + return Number.NaN; + } + const ratio = absoluteFontSize.get(str); + if (ratio !== undefined && typeof rem === 'number') { + return ratio * rem; + } + const relRatio = relativeFontSize.get(str); + if (relRatio !== undefined && typeof em === 'number') { + return relRatio * em; + } + return Number.NaN; + } + if (Number.isFinite(value) && unit) { + const u = unit.toLowerCase(); + if (Object.hasOwn(dimension, u)) { + const dimVal = dimension[u]; + return typeof dimVal === 'number' + ? (value as number) * dimVal + : Number.NaN; + } + if (typeof callback === 'function') { + const cbVal = callback(u); + return typeof cbVal === 'number' ? (value as number) * cbVal : Number.NaN; + } + const absRatio = absoluteLength.get(u); + if (absRatio !== undefined) { + return (value as number) * absRatio; + } + const relRatio = relativeLength.get(u); + if (relRatio !== undefined && typeof rem === 'number') { + return (value as number) * relRatio * rem; + } + const rUnitRatio = relativeLength.get(`r${u}`); + if (rUnitRatio !== undefined && typeof em === 'number') { + return (value as number) * rUnitRatio * em; + } + switch (u) { + case 'vb': { + return typeof vh === 'number' ? (value as number) * vh : Number.NaN; + } + case 'vi': { + return typeof vw === 'number' ? (value as number) * vw : Number.NaN; + } + case 'vmax': { + return typeof vh === 'number' && typeof vw === 'number' + ? (value as number) * Math.max(vh, vw) + : Number.NaN; + } + case 'vmin': { + return typeof vh === 'number' && typeof vw === 'number' + ? (value as number) * Math.min(vh, vw) + : Number.NaN; + } + default: + } + } + // unsupported or invalid value + return Number.NaN; +}; + +/** + * angle to deg + * @param angle - angle + * @returns deg: 0..360 + */ +export const angleToDeg = (angle: string): number => { + if (isString(angle)) { + angle = angle.trim(); + } else { + throw new TypeError(`${angle} is not a string.`); + } + const GRAD = DEG / 400; + const RAD = DEG / (Math.PI * DUO); + if (!REG_ANGLE_TO_DEG.test(angle)) { + throw new SyntaxError(`Invalid property value: ${angle}`); + } + const [, value, unit] = angle.match(REG_ANGLE_TO_DEG) as MatchedRegExp; + let deg; + switch (unit) { + case 'grad': + deg = parseFloat(value) * GRAD; + break; + case 'rad': + deg = parseFloat(value) * RAD; + break; + case 'turn': + deg = parseFloat(value) * DEG; + break; + default: + deg = parseFloat(value); + } + deg %= DEG; + if (deg < 0) { + deg += DEG; + } else if (Object.is(deg, -0)) { + deg = 0; + } + return deg; +}; + +/** + * number to hex string + * @param value - numeric value + * @returns hex string + */ +export const numberToHexString = (value: number): string => { + if (!Number.isFinite(value)) { + throw new TypeError(`${value} is not a number.`); + } else { + value = Math.round(value); + if (value < 0 || value > MAX_RGB) { + throw new RangeError(`${value} is not between 0 and ${MAX_RGB}.`); + } + } + let hex = value.toString(HEX); + if (hex.length === 1) { + hex = `0${hex}`; + } + return hex; +}; + +/** + * parse alpha + * @param [alpha] - alpha value + * @returns alpha: 0..1 + */ +export const parseAlpha = (alpha: string = ''): number => { + if (isString(alpha)) { + alpha = alpha.trim(); + if (!alpha) { + alpha = '1'; + } else if (alpha === NONE) { + alpha = '0'; + } else { + let a; + if (alpha.endsWith('%')) { + a = parseFloat(alpha) / MAX_PCT; + } else { + a = parseFloat(alpha); + } + if (!Number.isFinite(a)) { + throw new TypeError(`${a} is not a finite number.`); + } + if (a < PPTH) { + alpha = '0'; + } else if (a > 1) { + alpha = '1'; + } else { + alpha = a.toFixed(TRIA); + } + } + } else { + alpha = '1'; + } + return parseFloat(alpha); +}; + +/** + * parse hex alpha + * @param value - alpha value in hex string + * @returns alpha: 0..1 + */ +export const parseHexAlpha = (value: string): number => { + if (isString(value)) { + if (value === '') { + throw new SyntaxError('Invalid property value: (empty string)'); + } + value = value.trim(); + } else { + throw new TypeError(`${value} is not a string.`); + } + let alpha = parseInt(value, HEX); + if (alpha <= 0) { + return 0; + } + if (alpha >= MAX_RGB) { + return 1; + } + const alphaMap = new Map(); + for (let i = 1; i < MAX_PCT; i++) { + alphaMap.set(Math.round((i * MAX_RGB) / MAX_PCT), i); + } + if (alphaMap.has(alpha)) { + alpha = alphaMap.get(alpha) / MAX_PCT; + } else { + alpha = Math.round(alpha / MAX_RGB / PPTH) * PPTH; + } + return parseFloat(alpha.toFixed(TRIA)); +}; + +/** + * cache invalid color value + * @param cacheKey - cache key + * @param format - format + * @param nullable - is nullable + * @returns cached value + */ +export const cacheInvalidColorValue = ( + cacheKey: string, + format: string, + nullable: boolean = false +): SpecifiedColorChannels | string | null => { + if (format === VAL_SPEC) { + const res = ''; + setCache(cacheKey, res); + return res; + } + if (nullable) { + setCache(cacheKey, null); + return null; + } + const res: SpecifiedColorChannels = ['rgb', 0, 0, 0, 0]; + setCache(cacheKey, res); + return res; +}; + +/** + * resolve invalid color value + * @param format - output format + * @param nullable - is nullable + * @returns resolved value + */ +export const resolveInvalidColorValue = ( + format: string, + nullable: boolean = false +): SpecifiedColorChannels | string | null => { + switch (format) { + case 'hsl': + case 'hwb': + case VAL_MIX: { + return null; + } + case VAL_SPEC: { + return ''; + } + default: { + if (nullable) { + return null; + } + return ['rgb', 0, 0, 0, 0] as SpecifiedColorChannels; + } + } +}; diff --git a/node_modules/@asamuzakjp/dom-selector/LICENSE b/node_modules/@asamuzakjp/dom-selector/LICENSE new file mode 100644 index 0000000..f3f97a3 --- /dev/null +++ b/node_modules/@asamuzakjp/dom-selector/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2023 asamuzaK (Kazz) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/node_modules/@asamuzakjp/dom-selector/README.md b/node_modules/@asamuzakjp/dom-selector/README.md new file mode 100644 index 0000000..a34c387 --- /dev/null +++ b/node_modules/@asamuzakjp/dom-selector/README.md @@ -0,0 +1,268 @@ +# DOM Selector + +[![build](https://github.com/asamuzaK/domSelector/actions/workflows/node.js.yml/badge.svg)](https://github.com/asamuzaK/domSelector/actions/workflows/node.js.yml) +[![CodeQL](https://github.com/asamuzaK/domSelector/actions/workflows/github-code-scanning/codeql/badge.svg)](https://github.com/asamuzaK/domSelector/actions/workflows/github-code-scanning/codeql) +[![npm (scoped)](https://img.shields.io/npm/v/@asamuzakjp/dom-selector)](https://www.npmjs.com/package/@asamuzakjp/dom-selector) + +A CSS selector engine built for strict specification compliance. + +## Features + +* **Strict Specification Compliance**: Strictly adheres to modern web standards. It accurately parses, evaluates, and extracts elements across complex combinations of pseudo-classes and HTML attributes. Features comprehensive support for CSS Selectors Level 4 (e.g., `:is()`, `:not()`, `:where()`, `:has()`) and Shadow DOM pseudo-classes (`:host`, `:host-context`). +* **Utility Functions**: Provides utility methods alongside standard querying, such as `check()` for AST evaluation and `extractSubjects()` for extracting subject keys from selectors. +* **jsdom's Default Engine**: Adopted as the CSS selector engine for [jsdom](https://github.com/jsdom/jsdom). + +## Install + +``` console +npm i @asamuzakjp/dom-selector +``` + +## Usage + +``` javascript +import { DOMSelector } from '@asamuzakjp/dom-selector'; +import { JSDOM } from 'jsdom'; + +const { window } = new JSDOM(); + +// Destructuring methods (all methods are bound to the instance) +const { + check, closest, extractSubjects, matches, querySelector, querySelectorAll, supports +} = new DOMSelector(window); +``` + +## API + +### `new DOMSelector(window, document?, opt?)` + +Creates an instance of the DOMSelector. + +* `window` **{Window}** The window object. +* `document` **{Document}?** The document object. Defaults to `window.document`. +* `opt` **{object}?** Options: + * `opt.cacheSize` **{number}?** Maximum number of items to store in the internal LRU cache. Defaults to `4096`. + * `opt.idlUtils` **{object}?** The internal IDL wrapper used for jsdom. + * `opt.maxLength` **{number}?** The maximum length of the selector allowed. Defaults to `2048`. + +--- + +### `matches(selector, node, opt?)` + +Equivalent to [Element.matches()](https://developer.mozilla.org/docs/Web/API/Element/matches). + +* `selector` **{string}** CSS selector. +* `node` **{Element}** Element node. +* `opt` **{object}?** Options: + * `opt.noexcept` **{boolean}?** `true` to suppress exceptions (e.g., `DOMException` for invalid selectors) and return `false` instead. + * `opt.warn` **{boolean}?** `true` to output warnings to the console when encountering unsupported or deprecated features. +* **Returns** **{boolean}** `true` if matched, `false` otherwise. + +### `closest(selector, node, opt?)` + +Equivalent to [Element.closest()](https://developer.mozilla.org/docs/Web/API/Element/closest). + +* `selector` **{string}** CSS selector. +* `node` **{Element}** Element node. +* `opt` **{object}?** Options: + * `opt.noexcept` **{boolean}?** `true` to suppress exceptions and return `null` instead. + * `opt.warn` **{boolean}?** `true` to output warnings to the console when encountering unsupported or deprecated features. +* **Returns** **{Element | null}** The matched ancestor node or `null`. + +### `querySelector(selector, node, opt?)` + +Equivalent to [Document.querySelector()](https://developer.mozilla.org/docs/Web/API/Document/querySelector), [DocumentFragment.querySelector()](https://developer.mozilla.org/docs/Web/API/DocumentFragment/querySelector) and [Element.querySelector()](https://developer.mozilla.org/docs/Web/API/Element/querySelector). + +* `selector` **{string}** CSS selector. +* `node` **{Document | DocumentFragment | Element}** Node to find within. +* `opt` **{object}?** Options: + * `opt.noexcept` **{boolean}?** `true` to suppress exceptions and return `null` instead. + * `opt.warn` **{boolean}?** `true` to output warnings to the console when encountering unsupported or deprecated features. +* **Returns** **{Element | null}** The matched node or `null`. + +### `querySelectorAll(selector, node, opt?)` + +Equivalent to [Document.querySelectorAll()](https://developer.mozilla.org/docs/Web/API/Document/querySelectorAll), [DocumentFragment.querySelectorAll()](https://developer.mozilla.org/docs/Web/API/DocumentFragment/querySelectorAll) and [Element.querySelectorAll()](https://developer.mozilla.org/docs/Web/API/Element/querySelectorAll). +**NOTE**: Returns a standard `Array`, not a `NodeList`. + +* `selector` **{string}** CSS selector. +* `node` **{Document | DocumentFragment | Element}** Node to find within. +* `opt` **{object}?** Options: + * `opt.noexcept` **{boolean}?** `true` to suppress exceptions and return an empty array `[]` instead. + * `opt.warn` **{boolean}?** `true` to output warnings to the console when encountering unsupported or deprecated features. +* **Returns** **{Array}** Array of matched elements. + +### `check(selector, node, opt?)` + +Checks if an element matches a CSS selector and returns additional abstract syntax tree (AST) information. +**NOTE**: Any pseudo-elements in the selector are excluded from the matching evaluation. + +* `selector` **{string}** CSS selector. +* `node` **{Element}** Element node. +* `opt` **{object}?** Options: + * `opt.requireAst` **{boolean}?** Indicates whether to always try to parse and return the AST. + * `opt.noexcept` **{boolean}?** `true` to suppress exceptions and store the error in the `error` property of the result instead of throwing. + * `opt.warn` **{boolean}?** `true` to output warnings to the console when encountering unsupported or deprecated features. +* **Returns** **{CheckResult}** An object containing the following properties: + * `match` **{boolean}** `true` if the element matches the selector, `false` otherwise. + * `pseudoElement` **{string | null}** The pseudo-element extracted from the selector, if any. + * `ast` **{object | null}** The parsed AST object. + * `error` **{DOMException | Error | null}** The error object, if any. + +### `extractSubjects(selector, caseSensitive?)` + +Parses a selector and extracts the rightmost subject keys (Id, Class, Tag). + +* `selector` **{string}** CSS selector. +* `caseSensitive` **{boolean}?** `true` if the tag key should be case sensitive. Defaults to `false`. +* **Returns** **{Array}** An array of extracted subject keys. Each object contains: + * `id` **{string | null}** The ID. + * `className` **{string | null}** The class name. + * `tag` **{string | null}** The tag name. + +### `supports(selector)` + +Checks if the given CSS selector is supported by this engine. +See the table below for the full list of supported selectors. + +* `selector` **{string}** CSS selector. +* **Returns** **{boolean}** `true` if the selector is supported, `false` otherwise. + +### `clear(clearAll?)` + +Clears the internal caches to free up memory. + +* `clearAll` **{boolean}?** Whether to clear all caches. If false, only cached matching results are cleared. Defaults to `false`. +* **Returns** **{void}** + +## Supported CSS selectors + +| Pattern | Supported | Note | +| :--- | :---: | :--- | +| `*` | ✓ | | +| `E` | ✓ | | +| ns\|E | ✓ | | +| *\|E | ✓ | | +| \|E | ✓ | | +| `E F` | ✓ | | +| `E > F` | ✓ | | +| `E + F` | ✓ | | +| `E ~ F` | ✓ | | +| F \|\| E | Unsupported | | +| `E.warning` | ✓ | | +| `E#myid` | ✓ | | +| `E[foo]` | ✓ | | +| `E[foo="bar"]` | ✓ | | +| `E[foo="bar" i]` | ✓ | | +| `E[foo="bar" s]` | ✓ | | +| `E[foo~="bar"]` | ✓ | | +| `E[foo^="bar"]` | ✓ | | +| `E[foo$="bar"]` | ✓ | | +| `E[foo*="bar"]` | ✓ | | +| E[foo\|="en"] | ✓ | | +| `E:is(s1, s2, …)` | ✓ | | +| `E:not(s1, s2, …)` | ✓ | | +| `E:where(s1, s2, …)` | ✓ | | +| `E:has(rs1, rs2, …)` | ✓ | | +| `E:defined` | Partially supported | Matching with MathML is not yet supported. | +| `E:dir(ltr)` | ✓ | | +| `E:lang(en)` | ✓ | | +| `E:any-link` | ✓ | | +| `E:link` | ✓ | | +| `E:visited` | ✓ | Returns `false` or `null` to prevent fingerprinting. | +| `E:local-link` | ✓ | | +| `E:target` | ✓ | | +| `E:target-within` | | Removed from spec. | +| `E:scope` | ✓ | | +| `E:hover` | ✓ | | +| `E:active` | ✓ | | +| `E:focus` | ✓ | | +| `E:focus-visible` | ✓ | | +| `E:focus-within` | ✓ | | +| `E:current` | Unsupported | | +| `E:current(s)` | Unsupported | | +| `E:past` | Unsupported | | +| `E:future` | Unsupported | | +| `E:open` | Partially supported | Matching with `` are not supported. | +| `E:popover-open` | Unsupported | | +| `E:enabled`
`E:disabled` | ✓ | | +| `E:read-write`
`E:read-only` | ✓ | | +| `E:placeholder-shown` | ✓ | | +| `E:default` | ✓ | | +| `E:checked` | ✓ | | +| `E:indeterminate` | ✓ | | +| `E:blank` | Unsupported | | +| `E:valid`
`E:invalid` | ✓ | | +| `E:in-range`
`E:out-of-range` | ✓ | | +| `E:required`
`E:optional` | ✓ | | +| `E:user-valid`
`E:user-invalid` | Unsupported | | +| `E:root` | ✓ | | +| `E:empty` | ✓ | | +| `E:nth-child(n [of S]?)` | ✓ | | +| `E:nth-last-child(n [of S]?)` | ✓ | | +| `E:first-child` | ✓ | | +| `E:last-child` | ✓ | | +| `E:only-child` | ✓ | | +| `E:nth-of-type(n)` | ✓ | | +| `E:nth-last-of-type(n)` | ✓ | | +| `E:first-of-type` | ✓ | | +| `E:last-of-type` | ✓ | | +| `E:only-of-type` | ✓ | | +| `E:nth-col(n)` | Unsupported | | +| `E:nth-last-col(n)` | Unsupported | | +| `CE:state(v)` | ✓ | \*1 | +| `:host` | ✓ | | +| `:host(s)` | ✓ | | +| `:host(:state(v))` | ✓ | \*1 | +| `:host:has(rs1, rs2, ...)` | ✓ | | +| `:host(s):has(rs1, rs2, ...)` | ✓ | | +| `:host-context(s)` | ✓ | | +| `:host-context(s):has(rs1, rs2, ...)` | ✓ | | +| `&` | ✓ | Only supports outermost `&`, i.e. equivalent to `:scope` | + +\*1: `ElementInternals.states`, i.e. `CustomStateSet`, is not implemented in jsdom, so you need to apply a patch in the custom element constructor. + +``` javascript +class LabeledCheckbox extends window.HTMLElement { + #internals; + constructor() { + super(); + this.#internals = this.attachInternals(); + // patch CustomStateSet + if (!this.#internals.states) { + this.#internals.states = new Set(); + } + this.addEventListener('click', this._onClick.bind(this)); + } + get checked() { + return this.#internals.states.has('checked'); + } + set checked(flag) { + if (flag) { + this.#internals.states.add('checked'); + } else { + this.#internals.states.delete('checked'); + } + } + _onClick(event) { + this.checked = !this.checked; + } +} +``` + +## Performance + +See [benchmark](https://github.com/asamuzaK/domSelector/actions/workflows/benchmark.yml) for the latest results. + +## Acknowledgments + +The following resources have been of great help in the development of the DOM Selector. + +* [CSSTree](https://github.com/csstree/csstree) +* [selery](https://github.com/danburzo/selery) +* [jsdom](https://github.com/jsdom/jsdom) +* [nwsapi](https://github.com/dperini/nwsapi) + +--- + +Copyright (c) 2023 [asamuzaK (Kazz)](https://github.com/asamuzaK/) diff --git a/node_modules/@asamuzakjp/dom-selector/package.json b/node_modules/@asamuzakjp/dom-selector/package.json new file mode 100644 index 0000000..dc9fe5b --- /dev/null +++ b/node_modules/@asamuzakjp/dom-selector/package.json @@ -0,0 +1,80 @@ +{ + "name": "@asamuzakjp/dom-selector", + "description": "A CSS selector engine.", + "author": "asamuzaK", + "license": "MIT", + "homepage": "https://github.com/asamuzaK/domSelector#readme", + "bugs": { + "url": "https://github.com/asamuzaK/domSelector/issues" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/asamuzaK/domSelector.git" + }, + "files": [ + "src", + "types" + ], + "type": "module", + "types": "./types/index.d.ts", + "exports": { + ".": { + "types": "./types/index.d.ts", + "default": "./src/index.js" + }, + "./package.json": "./package.json" + }, + "dependencies": { + "bidi-js": "^1.1.0", + "css-tree": "^3.2.1", + "is-potential-custom-element-name": "^1.0.1", + "lru-cache": "^11.5.3" + }, + "devDependencies": { + "@types/css-tree": "^3.2.0", + "@types/node": "^26.6.4", + "c8": "^12.0.0", + "chai": "^6.3.0", + "commander": "^15.0.0", + "eslint": "^10.12.0", + "eslint-config-prettier": "^10.1.8", + "eslint-plugin-jsdoc": "^65.0.2", + "eslint-plugin-prettier": "^5.5.6", + "eslint-plugin-regexp": "^3.3.1", + "eslint-plugin-unicorn": "^76.0.0", + "globals": "^17.13.0", + "jsdom": "^30.1.1", + "mitata": "^1.0.34", + "mocha": "^12.0.3", + "neostandard": "^0.14.0-next.1", + "prettier": "^3.9.9", + "sinon": "^22.1.0", + "tinybench": "^6.2.0", + "typescript": "^7.0.2", + "wpt-runner": "^7.0.0" + }, + "overrides": { + "jsdom": "$jsdom" + }, + "scripts": { + "bench": "node --expose-gc benchmark/bench.js", + "bench:cache": "node --expose-gc benchmark/bench-cache.js", + "bench:nwsapi": "node --expose-gc benchmark/bench-nwsapi.js", + "bench:ps-form": "node --expose-gc benchmark/bench-default.js && node --expose-gc benchmark/bench-indeterminate.js && node --expose-gc benchmark/bench-valid-invalid.js", + "bench:ps-has": "node --expose-gc benchmark/bench-has.js", + "bench:ps-nth": "node --expose-gc benchmark/bench-nth-child.js && node --expose-gc benchmark/bench-nth-of-type.js", + "bench:ps-traverse": "node --expose-gc benchmark/bench-dir.js && node --expose-gc benchmark/bench-lang.js", + "bench:tl": "node --expose-gc benchmark/bench-testing-library.js", + "bench:universal": "node --expose-gc benchmark/bench-universal.js", + "build": "npm run tsc && npm run lint && npm test", + "lint": "eslint --fix .", + "test": "c8 --reporter=text mocha --exit test/**/*.test.js", + "test:wpt": "node test/wpt/wpt-runner.js", + "tsc": "node scripts/index clean --dir=types -i && npx tsc", + "update:wpt": "git submodule update --init --recursive --remote" + }, + "engines": { + "node": "^22.22.2 || ^24.15.0 || >=26.0.0" + }, + "version": "9.2.4" +} diff --git a/node_modules/@asamuzakjp/dom-selector/src/index.js b/node_modules/@asamuzakjp/dom-selector/src/index.js new file mode 100644 index 0000000..4cbdd88 --- /dev/null +++ b/node_modules/@asamuzakjp/dom-selector/src/index.js @@ -0,0 +1,590 @@ +/*! + * DOM Selector - A CSS selector engine. + * @license MIT + * @copyright asamuzaK (Kazz) + * @see {@link https://github.com/asamuzaK/domSelector/blob/main/LICENSE} + */ + +/* import */ +import { LRUCache } from 'lru-cache'; +import { clone as cssTreeClone } from 'css-tree/utils'; +import { Finder } from './js/finder.js'; +import { Nwsapi } from './js/nwsapi.js'; +import { extractSubjectsAst, parseSelector } from './js/parser.js'; +import { + extractSubjectsRegExp, + filterSelector, + isSupportedAST +} from './js/selector.js'; +import { + collectAllDescendants, + findByExactIdAttribute, + findBySimpleAttribute, + getType, + stringifyValue +} from './js/utility.js'; + +/* constants */ +import { + DOCUMENT_NODE, + ELEMENT_NODE, + MIME_HTML, + NS_HTML, + TARGET_ALL, + TARGET_FIRST, + TARGET_LINEAL, + TARGET_SELF +} from './js/constant.js'; +const CACHE_SIZE = 4096; +const MAX_LENGTH = 2048; +const DEFAULT_SUBJECT = Object.freeze({ id: null, className: null, tag: null }); + +/* regexp */ +const REG_SELECTOR = /[[\]():\\"'`]/; +const REG_UNIVERSAL = /^\s*(?:\*\|)?\*\s*$/; + +/* types */ +/** + * @typedef {object} CheckResult + * @property {boolean} match - The match result. + * @property {string|null} pseudoElement - The pseudo-element, if any. + * @property {import('css-tree').CssNode|null} ast - The AST object. + * @property {DOMException|Error|null} error - The error object, or null. + */ + +/** + * @typedef {object} SelectorSubject + * @property {string|null} id - The ID. + * @property {string|null} className - The class name. + * @property {string|null} tag - The tag name. + */ + +/** + * @typedef {object} UserOptions + * @property {boolean} [noexcept] - True to suppress exceptions. + * @property {boolean} [warn] - True to enable console warnings. + */ + +/** + * @typedef {object} FindOptions + * @property {string} [dir] - The traversal direction. + * @property {boolean} [check] - Indicates if running in internal check mode. + * @property {boolean} [forgive] - True to ignore unknown or invalid selectors. + * @property {boolean} [noexcept] - True to suppress exceptions. + * @property {boolean} [warn] - True to enable console warnings. + * @property {boolean} [isShadowRoot] - Indicates if the node is a ShadowRoot. + * @property {object} [globalObject] - The Window object. + */ + +/* DOMSelector */ +export class DOMSelector { + /* private fields */ + #cache; + #cacheSize; + #document; + #finder; + #idlUtils; + #maxLength; + #nwsapi; + #window; + + /** + * Creates an instance of DOMSelector. + * @param {Window} window - The Window object. + * @param {Document} document - The Document object. + * @param {object} [opt] - Options. + * @param {number} [opt.cacheSize] - The maximum size of the LRU cache. + * @param {object} [opt.idlUtils] - The internal IDL wrapper used for jsdom. + * @param {number} [opt.maxLength] - The maximum length of the selector. + */ + constructor(window, document, opt = {}) { + const { cacheSize, idlUtils, maxLength } = opt; + this.#idlUtils = idlUtils; + this.#window = window; + this.#document = document ? this.#wrapNode(document) : window.document; + this.#maxLength = + Number.isInteger(maxLength) && maxLength > 0 ? maxLength : MAX_LENGTH; + this.#cacheSize = + Number.isInteger(cacheSize) && cacheSize > 0 ? cacheSize : CACHE_SIZE; + this.#cache = new LRUCache({ + max: this.#cacheSize + }); + this.#finder = new Finder(this.#window); + this.#nwsapi = new Nwsapi(this.#window, this.#document, this.#cacheSize); + } + + /** + * Clears the internal caches. + * @param {boolean} [clearAll] - True to clear all caches. If false, only + * cached matching results are cleared. + * @returns {void} + */ + clear(clearAll = false) { + if (clearAll) { + this.#cache.clear(); + } + this.#finder.clearResults(true); + this.#nwsapi.clear(clearAll); + } + + /** + * Parses a selector and extracts the rightmost subject keys (Id, Class, Tag). + * @param {string} selector - The CSS selector to parse. + * @param {boolean} [caseSensitive] - True if key should be case sensitive. + * @returns {Array} The list of selector subjects. + */ + extractSubjects(selector, caseSensitive = false) { + if (!selector || typeof selector !== 'string') { + return [DEFAULT_SUBJECT]; + } + const { error, selector: validatedSelector } = + this.#validateSelector(selector); + if (error) { + return [DEFAULT_SUBJECT]; + } + selector = validatedSelector; + const cacheKey = `extract_${selector}_${caseSensitive}`; + let subjects = this.#cache.get(cacheKey); + if (subjects !== undefined) { + return [...subjects]; + } + subjects = []; + if (!REG_SELECTOR.test(selector)) { + subjects = extractSubjectsRegExp(selector, caseSensitive); + } else { + try { + const ast = parseSelector(selector); + subjects = extractSubjectsAst(ast); + } catch { + // fall through + } + } + if (!subjects.length) { + subjects.push(DEFAULT_SUBJECT); + } + this.#cache.set(cacheKey, subjects); + return [...subjects]; + } + + /** + * Checks if the given CSS selector is supported by this engine. + * @param {string} selector - The CSS selector to check. + * @returns {boolean} True if the selector is supported, false otherwise. + */ + supports(selector) { + if (typeof selector !== 'string') { + return false; + } + const { error, selector: validatedSelector } = + this.#validateSelector(selector); + if (error) { + return false; + } + selector = validatedSelector; + const cacheKey = `supports_${selector}`; + let isSupported = this.#cache.get(cacheKey); + if (isSupported !== undefined) { + return isSupported; + } + if (filterSelector(selector, TARGET_SELF)) { + isSupported = true; + } else { + try { + const ast = parseSelector(selector); + isSupported = isSupportedAST(ast); + } catch { + isSupported = false; + } + } + this.#cache.set(cacheKey, isSupported); + return isSupported; + } + + /** + * Checks if an element matches a CSS selector. + * @param {string} selector - The CSS selector to check against. + * @param {Element} node - The element node to check. + * @param {object} [opt] - Optional parameters. + * @param {boolean} [opt.requireAst] - Indicates always try to parse AST. + * @returns {CheckResult} An object containing the check result. + */ + check(selector, node, opt = {}) { + const { error, selector: validatedSelector } = + this.#validateSelector(selector); + if (error) { + return { + error, + ast: null, + match: false, + pseudoElement: null + }; + } + selector = validatedSelector; + node = this.#wrapNode(node); + const nodeError = this.#validateNodeType(node, true); + if (nodeError) { + let ast = null; + if (opt.requireAst) { + const astCacheKey = `check_ast_${selector}`; + ast = this.#cache.get(astCacheKey); + if (ast === undefined) { + ast = parseSelector(selector); + this.#cache.set(astCacheKey, ast); + } + } + return { + ast: this.#cloneAST(ast), + error: nodeError, + match: false, + pseudoElement: null + }; + } + if (REG_UNIVERSAL.test(selector)) { + const astCacheKey = `check_ast_${selector.trim()}`; + let ast = this.#cache.get(astCacheKey); + if (ast === undefined) { + ast = parseSelector(selector); + this.#cache.set(astCacheKey, ast); + } + return { + ast: this.#cloneAST(ast), + error: null, + match: true, + pseudoElement: null + }; + } + const nwsapiRes = this.#tryNwsapi( + selector, + node, + TARGET_SELF, + n => this.#nwsapi.match(selector, n), + true + ); + if (nwsapiRes.success) { + let ast = null; + if (nwsapiRes.result || opt.requireAst) { + const astCacheKey = `check_ast_${selector}`; + ast = this.#cache.get(astCacheKey); + if (ast === undefined) { + ast = parseSelector(selector); + this.#cache.set(astCacheKey, ast); + } + } + return { + ast: this.#cloneAST(ast), + error: null, + match: nwsapiRes.result, + pseudoElement: null + }; + } + const options = { + check: true, + noexcept: true, + warn: false, + globalObject: this.#window + }; + const checkResult = this.#finder + .setup(selector, node, options) + .find(TARGET_SELF); + return { + ...checkResult, + ast: this.#cloneAST(checkResult.ast) + }; + } + + /** + * Returns true if the element matches the selector. + * @param {string} selector - The CSS selector to match against. + * @param {Element} node - The element node to test. + * @param {UserOptions} [opt] - User options. + * @returns {boolean} True if the element matches, false otherwise. + */ + matches(selector, node, opt = {}) { + const options = { + ...opt, + check: false, + globalObject: this.#window + }; + const { error, selector: validatedSelector } = + this.#validateSelector(selector); + if (error) { + this.#finder.onError(error, options); + return false; + } + selector = validatedSelector; + node = this.#wrapNode(node); + const nodeError = this.#validateNodeType(node, true); + if (nodeError) { + this.#finder.onError(nodeError, options); + return false; + } + if (REG_UNIVERSAL.test(selector)) { + return true; + } + const nwsapiRes = this.#tryNwsapi(selector, node, TARGET_SELF, n => + this.#nwsapi.match(selector, n) + ); + if (nwsapiRes.success) { + return nwsapiRes.result; + } + const nodes = this.#findNodes(selector, node, options, TARGET_SELF); + return !!(nodes && nodes.size > 0); + } + + /** + * Traverses up the DOM tree to find the first node that matches the selector. + * @param {string} selector - The CSS selector to match against. + * @param {Element} node - The element from which to start traversing. + * @param {UserOptions} [opt] - User options. + * @returns {Element|null} The first matching ancestor element, or `null`. + */ + closest(selector, node, opt = {}) { + const options = { + ...opt, + check: false, + globalObject: this.#window + }; + const { error, selector: validatedSelector } = + this.#validateSelector(selector); + if (error) { + this.#finder.onError(error, options); + return null; + } + selector = validatedSelector; + node = this.#wrapNode(node); + const nodeError = this.#validateNodeType(node, true); + if (nodeError) { + return this.#finder.onError(nodeError, options); + } + if (REG_UNIVERSAL.test(selector)) { + return node; + } + const nwsapiRes = this.#tryNwsapi(selector, node, TARGET_LINEAL, n => + this.#nwsapi.closest(selector, n) + ); + if (nwsapiRes.success) { + return nwsapiRes.result; + } + const nodes = this.#findNodes(selector, node, options, TARGET_LINEAL); + if (nodes && nodes.size) { + let refNode = node; + while (refNode) { + if (nodes.has(refNode)) { + return refNode; + } + refNode = refNode.parentNode; + } + } + return null; + } + + /** + * Returns the first element within the subtree that matches the selector. + * @param {string} selector - The CSS selector to match. + * @param {Document|DocumentFragment|Element} node - The node to find within. + * @param {UserOptions} [opt] - User options. + * @returns {Element|null} The first matching element, or `null`. + */ + querySelector(selector, node, opt = {}) { + const options = { + ...opt, + check: false, + globalObject: this.#window + }; + const { error, selector: validatedSelector } = + this.#validateSelector(selector); + if (error) { + this.#finder.onError(error, options); + return null; + } + selector = validatedSelector; + node = this.#wrapNode(node); + const nodeError = this.#validateNodeType(node); + if (nodeError) { + this.#finder.onError(nodeError, options); + return null; + } + if (REG_UNIVERSAL.test(selector)) { + return node.firstElementChild; + } + const fastNode = findByExactIdAttribute(selector, node); + if (fastNode === null || fastNode?.nodeType === ELEMENT_NODE) { + return fastNode; + } + const nodes = this.#findNodes(selector, node, options, TARGET_FIRST); + if (nodes && nodes.size) { + return nodes.values().next().value; + } + return null; + } + + /** + * Returns an array of elements within the subtree that match the selector. + * Note: This method returns an Array, not a NodeList. + * @param {string} selector - The CSS selector to match. + * @param {Document|DocumentFragment|Element} node - The node to find within. + * @param {UserOptions} [opt] - User options. + * @returns {Array} An array of elements, or an empty array. + */ + querySelectorAll(selector, node, opt = {}) { + const options = { + ...opt, + check: false, + globalObject: this.#window + }; + const { error, selector: validatedSelector } = + this.#validateSelector(selector); + if (error) { + this.#finder.onError(error, options); + return []; + } + selector = validatedSelector; + node = this.#wrapNode(node); + const nodeError = this.#validateNodeType(node); + if (nodeError) { + this.#finder.onError(nodeError, options); + return []; + } + if (REG_UNIVERSAL.test(selector)) { + const document = + node.nodeType === DOCUMENT_NODE ? node : node.ownerDocument; + return collectAllDescendants(node, document); + } + const fastNodes = findBySimpleAttribute(selector, node); + if (Array.isArray(fastNodes)) { + return fastNodes; + } + const nodes = this.#findNodes(selector, node, options, TARGET_ALL); + if (nodes && nodes.size) { + return [...nodes]; + } + return []; + } + + /** + * Generates a cloned selector AST. + * @private + * @param {import('css-tree').CssNode|null} ast - The selector AST. + * @returns {import('css-tree').CssNode|null} Cloned selector AST. + */ + #cloneAST(ast) { + if (!ast) { + return null; + } + return cssTreeClone(ast); + } + + /** + * Wraps the node for IDL internal implementation if idlUtils is present. + * @private + * @param {Document|DocumentFragment|Element} node - The raw node. + * @returns {object} The wrapped or raw node. + */ + #wrapNode(node) { + return this.#idlUtils ? this.#idlUtils.wrapperForImpl(node) : node; + } + + /** + * Validates a selector. + * @private + * @param {string} selector - The selector to check. + * @returns {{ selector:string|null, error:DOMException|RangeError|null}} The validation result. + */ + #validateSelector(selector) { + try { + selector = stringifyValue(selector, this.#window); + if (selector.length > this.#maxLength) { + return { + selector: null, + error: new this.#window.RangeError( + `Selector exceeds maximum allowed length of ${this.#maxLength}.` + ) + }; + } + return { + selector, + error: null + }; + } catch (e) { + return { + selector: null, + error: e + }; + } + } + + /** + * Validates a node. + * @private + * @param {Document|DocumentFragment|Element} node - The node to check. + * @param {boolean} [element] - `true` if the node must be an Element. + * @returns {TypeError|null} A TypeError if invalid, otherwise null. + */ + #validateNodeType(node, element = false) { + if (!node?.nodeType) { + return new this.#window.TypeError(`Unexpected type ${getType(node)}`); + } + if (element && node.nodeType !== ELEMENT_NODE) { + return new this.#window.TypeError(`Unexpected node ${node.nodeName}`); + } + return null; + } + + /** + * Executes Nwsapi matching logic with caching and error wrapping. + * @private + * @param {string} selector - The CSS selector to match against. + * @param {Element} node - The target node to check. + * @param {number} targetType - The target type indicating the scope. + * @param {(node: Element) => Array|Element|boolean|null} callback - The specific nwsapi function. + * @param {boolean} [isCheck] - True if called from the check method. + * @returns {{success: boolean, result: Array|Element|boolean|null}} An object indicating whether the execution succeeded and its result. + */ + #tryNwsapi(selector, node, targetType, callback, isCheck = false) { + const document = node.ownerDocument; + if ( + node.isConnected && + node.namespaceURI === NS_HTML && + document === this.#document && + document.contentType === MIME_HTML && + document.documentElement + ) { + const cacheKey = `${isCheck ? 'check' : targetType}_${selector}`; + let filterMatches = this.#cache.get(cacheKey); + if (filterMatches === undefined) { + filterMatches = filterSelector(selector, targetType); + this.#cache.set(cacheKey, filterMatches); + } + if (filterMatches) { + try { + const result = callback(node); + return { result, success: true }; + } catch { + // fall through + } + } + } + return { result: null, success: false }; + } + + /** + * Encapsulates Finder traversal logic and error handling. + * @private + * @param {string} selector - The CSS selector to match against. + * @param {Document|DocumentFragment|Element} node - The node from which to start searching. + * @param {FindOptions} [opt] - The finder options. + * @param {number} targetType - The target type indicating the scope. + * @returns {Set|null} The search results from Finder, or null. + */ + #findNodes(selector, node, opt, targetType) { + try { + const res = this.#finder.setup(selector, node, opt).find(targetType); + if (res instanceof Set) { + return res; + } + } catch (e) { + this.#finder.onError(e, opt); + } + return null; + } +} diff --git a/node_modules/@asamuzakjp/dom-selector/src/js/constant.js b/node_modules/@asamuzakjp/dom-selector/src/js/constant.js new file mode 100644 index 0000000..278f38d --- /dev/null +++ b/node_modules/@asamuzakjp/dom-selector/src/js/constant.js @@ -0,0 +1,307 @@ +/** + * constant.js + */ + +/* string */ +export const ATRULE = 'Atrule'; +export const ATTR_SELECTOR = 'AttributeSelector'; +export const CLASS_SELECTOR = 'ClassSelector'; +export const COMBINATOR = 'Combinator'; +export const DIR_NEXT = 'next'; +export const DIR_PREV = 'prev'; +export const IDENT = 'Identifier'; +export const ID_SELECTOR = 'IdSelector'; +export const NEST_SELECTOR = 'NestingSelector'; +export const NOT_SUPPORTED_ERR = 'NotSupportedError'; +export const NTH = 'Nth'; +export const OPERATOR = 'Operator'; +export const PS_CLASS_SELECTOR = 'PseudoClassSelector'; +export const PS_ELEMENT_SELECTOR = 'PseudoElementSelector'; +export const RULE = 'Rule'; +export const SCOPE = 'Scope'; +export const SELECTOR = 'Selector'; +export const SELECTOR_LIST = 'SelectorList'; +export const STRING = 'String'; +export const SYNTAX_ERR = 'SyntaxError'; +export const TARGET_ALL = 'all'; +export const TARGET_FIRST = 'first'; +export const TARGET_LINEAL = 'lineal'; +export const TARGET_SELF = 'self'; +export const TYPE_SELECTOR = 'TypeSelector'; + +/* numeric */ +export const BIT_01 = 1; +export const BIT_02 = 2; +export const BIT_04 = 4; +export const BIT_08 = 8; +export const BIT_16 = 0x10; +export const BIT_32 = 0x20; +export const BIT_FFFF = 0xffff; +export const DUO = 2; +export const HEX = 16; +export const TYPE_FROM = 8; +export const TYPE_TO = -1; + +/* Node */ +export const ELEMENT_NODE = 1; +export const TEXT_NODE = 3; +export const DOCUMENT_NODE = 9; +export const DOCUMENT_FRAGMENT_NODE = 11; +export const DOCUMENT_POSITION_PRECEDING = 2; +export const DOCUMENT_POSITION_CONTAINS = 8; +export const DOCUMENT_POSITION_CONTAINED_BY = 0x10; + +/* NodeFilter */ +export const FILTER_ACCEPT = 1; +export const FILTER_REJECT = 2; +export const FILTER_SKIP = 3; +export const SHOW_ALL = 0xffffffff; +export const SHOW_CONTAINER = 0x501; +export const SHOW_DOCUMENT = 0x100; +export const SHOW_DOCUMENT_FRAGMENT = 0x400; +export const SHOW_ELEMENT = 1; + +/* selectors */ +export const ALPHA_NUM = '[A-Z\\d]+'; +export const CHILD_IDX = '(?:first|last|only)-(?:child|of-type)'; +export const DIGIT = '(?:0|[1-9]\\d*)'; +export const LANG_ALPHA_NUM = '[A-Z\\d]{1,8}'; +export const LANG_SKIP_ALPHA_NUM = '[A-Z\\d]{2,8}'; +export const LANG_PART = `(?:-${LANG_ALPHA_NUM})*`; +export const LANG_PART_SKIP = `(?:-${LANG_SKIP_ALPHA_NUM})*`; +export const PSEUDO_CLASS = `(?:any-)?link|${CHILD_IDX}|checked|empty|indeterminate|read-(?:only|write)|target`; +export const ANB = `[+-]?(?:${DIGIT}n?|n)|(?:[+-]?${DIGIT})?n\\s*[+-]\\s*${DIGIT}`; +// combinators +export const COMBO = '\\s?[\\s>~+]\\s?'; +export const DESCEND = '\\s?[\\s>]\\s?'; +export const SIBLING = '\\s?[+~]\\s?'; +// LOGIC_IS: :is() +export const LOGIC_IS = `:is\\(\\s*[^)]+\\s*\\)`; +// N_TH: excludes An+B with selector list, e.g. :nth-child(2n+1 of .foo) +export const N_TH = `nth-(?:last-)?(?:child|of-type)\\(\\s*(?:even|odd|${ANB})\\s*\\)`; +// ATTR_TYPE: excludes [foo|=bar] +export const ATTR_TYPE = '\\[[^|\\]]+\\]'; +// SUB_TYPE: attr, id, class, pseudo-class +export const SUB_TYPE = `${ATTR_TYPE}|[#.:][\\w-]+`; +export const SUB_TYPE_WO_PSEUDO = `${ATTR_TYPE}|[#.][\\w-]+`; +// TAG_TYPE: *, tag +export const TAG_TYPE_WO_UNIVERSAL = '[A-Za-z][\\w-]*'; +export const TAG_TYPE = `\\*|${TAG_TYPE_WO_UNIVERSAL}`; +export const TAG_TYPE_I = '\\*|[A-Z][\\w-]*'; +export const COMPOUND = `(?:${TAG_TYPE}|(?:${TAG_TYPE})?(?:${SUB_TYPE})+)`; +export const COMPOUND_L = `(?:${TAG_TYPE}|(?:${TAG_TYPE})?(?:${SUB_TYPE}|${LOGIC_IS})+)`; +export const COMPOUND_I = `(?:${TAG_TYPE_I}|(?:${TAG_TYPE_I})?(?:${SUB_TYPE})+)`; +export const COMPOUND_WO_PSEUDO = `(?:${TAG_TYPE}|(?:${TAG_TYPE})?(?:${SUB_TYPE_WO_PSEUDO})+)`; +export const COMPLEX = `${COMPOUND}(?:${COMBO}${COMPOUND})*`; +export const COMPLEX_L = `${COMPOUND_L}(?:${COMBO}${COMPOUND_L})*`; +export const HAS_COMPOUND = `has\\([\\s>]?\\s*${COMPOUND_WO_PSEUDO}\\s*\\)`; +export const LOGIC_COMPOUND = `(?:is|not)\\(\\s*${COMPOUND_L}(?:\\s*,\\s*${COMPOUND_L})*\\s*\\)`; +export const LOGIC_COMPLEX = `(?:is|not)\\(\\s*${COMPLEX_L}(?:\\s*,\\s*${COMPLEX_L})*\\s*\\)`; + +/* forms and input types */ +/** @type {Array} */ +export const FORM_PARTS = Object.freeze([ + 'button', + 'input', + 'select', + 'textarea' +]); +/** @type {Array} */ +export const INPUT_BUTTON = Object.freeze(['button', 'reset', 'submit']); +/** @type {Array} */ +export const INPUT_CHECK = Object.freeze(['checkbox', 'radio']); +/** @type {Array} */ +export const INPUT_DATE = Object.freeze([ + 'date', + 'datetime-local', + 'month', + 'time', + 'week' +]); +/** @type {Array} */ +export const INPUT_TEXT = Object.freeze([ + 'email', + 'password', + 'search', + 'tel', + 'text', + 'url' +]); +/** @type {Array} */ +export const INPUT_EDIT = Object.freeze([ + ...INPUT_DATE, + ...INPUT_TEXT, + 'number' +]); +/** @type {Array} */ +export const INPUT_LTR = Object.freeze([ + ...INPUT_CHECK, + 'color', + 'date', + 'image', + 'number', + 'range', + 'time' +]); + +/* Attribute names that must treat values as ASCII case-insensitive */ +/** @type {Array} */ +export const ATTR_VALUE_I = Object.freeze([ + 'accept', + 'accept-charset', + 'align', + 'alink', + 'axis', + 'bgcolor', + 'charset', + 'checked', + 'clear', + 'codetype', + 'color', + 'compact', + 'declare', + 'defer', + 'dir', + 'direction', + 'disabled', + 'enctype', + 'face', + 'frame', + 'hreflang', + 'http-equiv', + 'lang', + 'language', + 'link', + 'media', + 'method', + 'multiple', + 'nohref', + 'noresize', + 'noshade', + 'nowrap', + 'readonly', + 'rel', + 'rev', + 'rules', + 'scope', + 'scrolling', + 'selected', + 'shape', + 'target', + 'text', + 'type', + 'valign', + 'valuetype', + 'vlink' +]); + +/* logical combination pseudo-classes */ +/** @type {Set} */ +export const KEYS_LOGICAL = new Set(['has', 'is', 'not', 'where']); + +/* lists of supported / unsupported pseudo-classes and pseudo-elements */ +/** @type {Set} */ +export const KEYS_PS_CLASS_SUPPORTED = new Set([ + 'active', + 'any-link', + 'checked', + 'closed', + 'default', + 'defined', + 'dir', + 'disabled', + 'empty', + 'enabled', + 'first-child', + 'first-of-type', + 'focus', + 'focus-visible', + 'focus-within', + 'has', + 'host', + 'host-context', + 'hover', + 'in-range', + 'indeterminate', + 'invalid', + 'is', + 'lang', + 'last-child', + 'last-of-type', + 'link', + 'local-link', + 'not', + 'nth-child', + 'nth-last-child', + 'nth-last-of-type', + 'nth-of-type', + 'only-child', + 'only-of-type', + 'open', + 'optional', + 'out-of-range', + 'placeholder-shown', + 'read-only', + 'read-write', + 'required', + 'root', + 'scope', + 'state', + 'target', + 'target-within', + 'valid', + 'visited', + 'where' +]); + +/** @type {Set} */ +export const KEYS_PS_CLASS_UNSUPPORTED = new Set([ + 'autofill', + 'blank', + 'buffering', + 'contains', + 'current', + 'fullscreen', + 'future', + 'has-slotted', + 'heading', + 'modal', + 'muted', + 'nth-col', + 'nth-last-col', + 'past', + 'paused', + 'picture-in-picture', + 'playing', + 'popover-open', + 'seeking', + 'stalled', + 'user-invalid', + 'user-valid', + 'volume-locked', + '-webkit-autofill' +]); + +/** @type {Set} */ +export const KEYS_PS_ELEMENT_UNSUPPORTED = new Set([ + 'after', + 'backdrop', + 'before', + 'cue', + 'cue-region', + 'file-selector-button', + 'first-letter', + 'first-line', + 'marker', + 'part', + 'placeholder', + 'selection', + 'slotted', + 'target-text' +]); + +/* mime type and namespace */ +/** @type {string} */ +export const MIME_HTML = 'text/html'; +/** @type {string} */ +export const NS_HTML = 'http://www.w3.org/1999/xhtml'; diff --git a/node_modules/@asamuzakjp/dom-selector/src/js/evaluator.js b/node_modules/@asamuzakjp/dom-selector/src/js/evaluator.js new file mode 100644 index 0000000..c2195cc --- /dev/null +++ b/node_modules/@asamuzakjp/dom-selector/src/js/evaluator.js @@ -0,0 +1,429 @@ +/** + * evaluator.js + */ + +/* import */ +import { EventHandler } from './event.js'; +import { + matchAttributeSelector, + matchPseudoElementSelector, + matchTypeSelector +} from './matcher.js'; +import { generateCSS, parseSelector, unescapeSelector } from './parser.js'; +import { PseudoClassEvaluator } from './pseudo-class.js'; +import { ShadowDOMEvaluator } from './shadow.js'; +import { DOMTraverser } from './traverser.js'; +import { resolveContent } from './utility.js'; + +/* constants */ +import { + ATTR_SELECTOR, + CLASS_SELECTOR, + DOCUMENT_FRAGMENT_NODE, + ELEMENT_NODE, + FORM_PARTS, + ID_SELECTOR, + NEST_SELECTOR, + NOT_SUPPORTED_ERR, + PS_CLASS_SELECTOR, + TYPE_SELECTOR +} from './constant.js'; +const KEYS_FORM = new Set([...FORM_PARTS, 'fieldset', 'form']); +const KEYS_UNCACHE = new Set(['any-link', 'defined', 'dir', 'link', 'scope']); + +/** + * Evaluator + * Determines if DOM elements match provided CSS selectors. + */ +export class Evaluator { + /* private fields */ + #domTraverser; + #eventHandler; + #filterLeavesCache; + #invalidate; + #invalidateResults; + #nestingAST; + #pseudoClassEvaluator; + #results; + #shadowEvaluator; + #unescapedCache; + + /** + * @param {Window} window - The window object. + */ + constructor(window) { + this.window = window; + this.documentCache = new WeakMap(); + this.#domTraverser = new DOMTraverser(this); + this.#eventHandler = new EventHandler(window); + this.#pseudoClassEvaluator = new PseudoClassEvaluator(this); + this.#shadowEvaluator = new ShadowDOMEvaluator(this); + this.#unescapedCache = new WeakMap(); + this.clearResults(true); + } + + /** + * Gets the event handler. + * @returns {EventHandler} The EventHandler instance. + */ + get eventHandler() { + return this.#eventHandler; + } + + /** + * Gets the invalidate flag. + * @returns {boolean} True if the selector should be invalidated, false otherwise. + */ + get invalidate() { + return this.#invalidate; + } + + /** + * Sets the invalidate flag. + * @param {boolean} value - A flag to set. + */ + set invalidate(value) { + this.#invalidate = !!value; + } + + /** + * Gets the verifyShadowHost flag from ShadowDOMEvaluator. + * @returns {boolean} True if shadow host is verified, false otherwise. + */ + get verifyShadowHost() { + return this.#shadowEvaluator.verifyShadowHost; + } + + /** + * Sets up the evaluator. + * @param {string} selector - The CSS selector. + * @param {Document|DocumentFragment|Element} node - Document, DocumentFragment, or Element. + * @param {import('../index.js').FindOptions} [opt] - Options. + * @returns {Evaluator} The Evaluator instance. + */ + setup(selector, node, opt = {}) { + const { check, noexcept, warn } = opt; + this.check = !!check; + this.noexcept = !!noexcept; + this.warn = !!warn; + [this.document, this.root, this.shadow] = resolveContent(node); + this.node = node; + this.pseudoElements = []; + this.#invalidate = false; + this.#domTraverser.reset(); + this.#shadowEvaluator.reset(); + this.#pseudoClassEvaluator.reset(); + this.clearResults(); + return this; + } + + /** + * Handles errors. + * @param {Error} e - The error object. + * @param {import('../index.js').FindOptions} [opt] - Options. + * @throws {Error} Throws an error. + * @returns {void} + */ + onError(e, opt = {}) { + const noexcept = opt.noexcept ?? this.noexcept; + if (noexcept) { + return; + } + const isDOMException = + e instanceof DOMException || e instanceof this.window.DOMException; + if (isDOMException) { + if (e.name === NOT_SUPPORTED_ERR) { + if (this.warn) { + console.warn(e.message); + } + return; + } + throw new this.window.DOMException(e.message, e.name); + } + const ErrorCtor = this.window[e.name]; + if (typeof ErrorCtor === 'function') { + throw new ErrorCtor(e.message, { cause: e }); + } + throw e; + } + + /** + * Destroys the evaluator instance and removes external event listeners. + */ + destroy() { + this.clearResults(true); + if (this.#eventHandler) { + this.#eventHandler.destroy(); + } + } + + /** + * Clear cached results. + * @param {boolean} all - Clear all results. + * @returns {void} + */ + clearResults(all = false) { + this.#invalidate = false; + this.#invalidateResults = null; + this.#pseudoClassEvaluator.clearResults(all); + if (all) { + this.#filterLeavesCache = null; + this.#nestingAST = null; + this.#results = new WeakMap(); + } + } + + /** + * Matches a selector. + * @param {import('css-tree').CssNode} ast - The AST. + * @param {Document|DocumentFragment|Element} node - The Document, DocumentFragment, or Element node. + * @param {import('../index.js').FindOptions} opt - Options. + * @returns {boolean} True if matches, otherwise false. + */ + matchSelector(ast, node, opt) { + if (node.nodeType === ELEMENT_NODE) { + return this.#matchSelectorForElement(ast, node, opt); + } + if ( + this.shadow && + node.nodeType === DOCUMENT_FRAGMENT_NODE && + ast.type === PS_CLASS_SELECTOR + ) { + return this.#shadowEvaluator.matchSelectorForShadowRoot(ast, node, opt); + } + return false; + } + + /** + * Matches leaves against a node with cache check. + * @param {Array} leaves - The AST leaves to match. + * @param {Element} node - The Element node. + * @param {import('../index.js').FindOptions} [opt] - Options. + * @returns {boolean} True if matched, otherwise false. + */ + matchLeaves(leaves, node, opt) { + let isFormParts; + if (leaves.length === 1) { + const [leaf] = leaves; + const isUncacheable = + leaf.type === ATTR_SELECTOR || + leaf.type === ID_SELECTOR || + (leaf.type === PS_CLASS_SELECTOR && KEYS_UNCACHE.has(leaf.name)); + if (!isUncacheable) { + isFormParts = + node.nodeType === ELEMENT_NODE && KEYS_FORM.has(node.localName); + } + if (isUncacheable || isFormParts) { + return this.matchSelector( + leaf, + node, + opt ?? { + warn: this.warn, + globalObject: this.window + } + ); + } + } + let results; + if (this.invalidate) { + if (!this.#invalidateResults) { + this.#invalidateResults = new WeakMap(); + } + results = this.#invalidateResults; + } else { + results = this.#results; + } + let result = results.get(leaves); + if (result) { + const nodeResult = result.get(node); + if (nodeResult !== undefined) { + return nodeResult; + } + } + isFormParts ??= + node.nodeType === ELEMENT_NODE && KEYS_FORM.has(node.localName); + let cacheable = !isFormParts; + let bool; + const l = leaves.length; + for (let i = 0; i < l; i++) { + const leaf = leaves[i]; + switch (leaf.type) { + case ATTR_SELECTOR: + case ID_SELECTOR: { + cacheable = false; + break; + } + case PS_CLASS_SELECTOR: { + if (KEYS_UNCACHE.has(leaf.name)) { + cacheable = false; + } + break; + } + default: { + // No action needed for other types. + } + } + bool = this.matchSelector( + leaf, + node, + opt ?? { + warn: this.warn, + globalObject: this.window + } + ); + if (!bool) { + break; + } + } + if (cacheable) { + if (!result) { + result = new WeakMap(); + } + result.set(node, bool); + results.set(leaves, result); + } + return bool; + } + + /** + * Returns a cached slice of the leaves array (excluding the first item). + * @param {Array} leaves - The original AST leaves array. + * @returns {Array} The filtered leaves. + */ + getFilterLeaves(leaves) { + if (!this.#filterLeavesCache) { + this.#filterLeavesCache = new WeakMap(); + } + let filterLeaves = this.#filterLeavesCache.get(leaves); + if (filterLeaves) { + return filterLeaves; + } + filterLeaves = leaves.slice(1); + this.#filterLeavesCache.set(leaves, filterLeaves); + return filterLeaves; + } + + /** + * Gets the unescaped name of an AST node from the cache. + * @param {import('css-tree').CssNode} ast - The AST node. + * @returns {string} The unescaped name. + */ + getUnescapedName(ast) { + let name = this.#unescapedCache.get(ast); + if (name === undefined) { + name = unescapeSelector(ast.name); + this.#unescapedCache.set(ast, name); + } + return name; + } + + /** + * Evaluates shadow host pseudo-classes. + * @param {import('css-tree').CssNode} ast - The AST. + * @param {DocumentFragment} node - The DocumentFragment node. + * @returns {boolean} True if matches, otherwise false. + */ + evaluateShadowHost(ast, node) { + return this.#shadowEvaluator.evaluateShadowHost(ast, node); + } + + /** + * Matches pseudo-class selector. + * @see https://html.spec.whatwg.org/_pseudo-classes + * @param {import('css-tree').CssNode} ast - The AST. + * @param {Element} node - The Element node. + * @param {import('../index.js').FindOptions} opt - Options. + * @returns {boolean} True if matches, otherwise false. + */ + matchPseudoClassSelector(ast, node, opt) { + return this.#pseudoClassEvaluator.matchPseudoClassSelector(ast, node, opt); + } + + /** + * Creates a TreeWalker. + * @param {Document|DocumentFragment|Element} node - The Document, DocumentFragment, or Element node. + * @param {object} opt - Options. + * @returns {TreeWalker} The TreeWalker object. + */ + createTreeWalker(node, opt) { + return this.#domTraverser.createTreeWalker(node, opt); + } + + /** + * Yields combinator matches (Lazy evaluation, O(1) memory). + * @param {import('./processor.js').ProcessedBranch} twig - The twig object. + * @param {Element} node - The Element node. + * @param {import('../index.js').FindOptions} opt - Options. + * @yields {Element} The matched node. + */ + *yieldCombinatorMatches(twig, node, opt) { + yield* this.#domTraverser.yieldCombinatorMatches(twig, node, opt); + } + + /** + * Finds descendant nodes and yields matches. + * @param {Array} leaves - The AST leaves. + * @param {DocumentFragment|Element} baseNode - The base Element node or Element.shadowRoot. + * @param {import('../index.js').FindOptions} opt - Options. + * @yields {Element} The matched node. + */ + *yieldFindDescendantNodes(leaves, baseNode, opt) { + yield* this.#domTraverser.yieldFindDescendantNodes(leaves, baseNode, opt); + } + + /** + * Matches a selector for element nodes. + * @private + * @param {import('css-tree').CssNode} ast - The AST. + * @param {Element} node - The Element node. + * @param {import('../index.js').FindOptions} opt - Options. + * @returns {boolean} True if matches, otherwise false. + */ + #matchSelectorForElement(ast, node, opt) { + const { type: astType } = ast; + switch (astType) { + case ATTR_SELECTOR: { + return matchAttributeSelector(ast, node, opt); + } + case ID_SELECTOR: { + return node.id === this.getUnescapedName(ast); + } + case CLASS_SELECTOR: { + const astName = this.getUnescapedName(ast); + return node.classList.contains(astName); + } + case NEST_SELECTOR: { + if (!this.#nestingAST) { + this.#nestingAST = parseSelector(':scope', 'selector'); + } + return this.matchPseudoClassSelector( + this.#nestingAST.children.head.data, + node, + opt + ); + } + case PS_CLASS_SELECTOR: { + return this.matchPseudoClassSelector(ast, node, opt); + } + case TYPE_SELECTOR: { + return matchTypeSelector(ast, node, opt); + } + // PS_ELEMENT_SELECTOR is handled by default. + default: { + try { + if (this.check) { + const css = generateCSS(ast); + this.pseudoElements.push(css); + return true; + } else { + const astName = this.getUnescapedName(ast); + matchPseudoElementSelector(astName, astType, opt); + } + } catch (e) { + this.onError(e); + } + } + } + return false; + } +} diff --git a/node_modules/@asamuzakjp/dom-selector/src/js/event.js b/node_modules/@asamuzakjp/dom-selector/src/js/event.js new file mode 100644 index 0000000..61c731c --- /dev/null +++ b/node_modules/@asamuzakjp/dom-selector/src/js/event.js @@ -0,0 +1,146 @@ +/** + * event.js + */ + +/* constants */ +const KEYS_MODIFIER = new Set([ + 'Alt', + 'AltGraph', + 'CapsLock', + 'Control', + 'Fn', + 'FnLock', + 'Hyper', + 'Meta', + 'NumLock', + 'ScrollLock', + 'Shift', + 'Super', + 'Symbol', + 'SymbolLock' +]); + +/** + * EventHandler + * Tracks window events to record recent user interactions. + */ +export class EventHandler { + /* private fields */ + #window; + #event; + #eventHandlers; + #focusEvent; + #lastFocusVisible; + + /** + * @param {Window} window - The window object. + */ + constructor(window) { + this.#window = window; + this.#event = null; + this.#focusEvent = null; + this.#lastFocusVisible = null; + this.#eventHandlers = [ + { + keys: ['focus', 'focusin'], + handler: this.handleFocusEvent.bind(this) + }, + { + keys: ['keydown', 'keyup'], + handler: this.handleKeyboardEvent.bind(this) + }, + { + keys: ['mouseover', 'mousedown', 'mouseup', 'click', 'mouseout'], + handler: this.handleMouseEvent.bind(this) + } + ]; + this.registerEventListeners(); + } + + /** + * Gets the most recent non-modifier keyboard or mouse event. + * @returns {Event|null} The current event object. + */ + get currentEvent() { + return this.#event; + } + + /** + * Gets the most recent focus event. + * @returns {Event|null} The current focus event object. + */ + get currentFocus() { + return this.#focusEvent; + } + + /** + * Gets the node that last had visible focus. + * @returns {Element|null} The last focused node. + */ + get lastFocusVisible() { + return this.#lastFocusVisible; + } + + /** + * Sets the node that last had visible focus. + * @param {Element} node - The node to set as the last visible focus. + */ + set lastFocusVisible(node) { + this.#lastFocusVisible = node; + } + + /** + * Handles focus events and updates the current focus state. + * @param {Event} evt - The focus event. + */ + handleFocusEvent(evt) { + this.#focusEvent = evt; + } + + /** + * Handles keyboard events and updates the current event state. + * @param {KeyboardEvent} evt - The keyboard event. + */ + handleKeyboardEvent(evt) { + const { key } = evt; + if (!KEYS_MODIFIER.has(key)) { + this.#event = evt; + } + } + + /** + * Handles mouse events and updates the current event state. + * @param {MouseEvent} evt - The mouse event. + */ + handleMouseEvent(evt) { + this.#event = evt; + } + + /** + * Registers all predefined event listeners on the window object. + */ + registerEventListeners() { + for (const { keys, handler } of this.#eventHandlers) { + for (const key of keys) { + this.#window.addEventListener(key, handler, { + capture: true, + passive: true + }); + } + } + } + + /** + * Removes all registered event listeners and resets all internal states. + */ + destroy() { + for (const { keys, handler } of this.#eventHandlers) { + for (const key of keys) { + this.#window.removeEventListener(key, handler, { capture: true }); + } + } + this.#event = null; + this.#focusEvent = null; + this.#lastFocusVisible = null; + } +} diff --git a/node_modules/@asamuzakjp/dom-selector/src/js/finder.js b/node_modules/@asamuzakjp/dom-selector/src/js/finder.js new file mode 100644 index 0000000..678b259 --- /dev/null +++ b/node_modules/@asamuzakjp/dom-selector/src/js/finder.js @@ -0,0 +1,1061 @@ +/** + * finder.js + */ + +/* import */ +import { Evaluator } from './evaluator.js'; +import { Mapper } from './mapper.js'; +import { matchPseudoElementSelector } from './matcher.js'; +import { generateCSS } from './parser.js'; +import { + canUseFastClassSearch, + canUseFastTagSearch, + getTraversalStrategy, + sortNodes, + traverseNode +} from './utility.js'; + +/* constants */ +import { + ATTR_SELECTOR, + CLASS_SELECTOR, + DIR_NEXT, + DIR_PREV, + DOCUMENT_FRAGMENT_NODE, + ELEMENT_NODE, + ID_SELECTOR, + MIME_HTML, + PS_ELEMENT_SELECTOR, + TARGET_ALL, + TARGET_FIRST, + TARGET_LINEAL, + TARGET_SELF, + TYPE_SELECTOR +} from './constant.js'; + +/* types */ +/** + * @typedef {object} StrategyOptions + * @property {boolean} [complex] - Indicates if the selector branch is complex. + * @property {boolean} [precede] - Indicates whether to search preceding nodes. + * @property {string} [dir] - The traversal direction. + * @property {Array} [filterLeaves] - An array of AST leaves used for filtering. + */ + +/** + * @typedef {object} TraversalOptions + * @property {boolean} [force] - Indicates whether to force traversal. + * @property {boolean} [precede] - Indicates whether to search preceding nodes. + * @property {Element} [boundaryNode] - The traversal boundary limit. + * @property {Element} [startNode] - The starting node for the traversal. + * @property {string} [targetType] - The target type. + */ + +/** + * Finder + * Evaluates CSS selectors to find and collect matched nodes. + * NOTE: #ast[i] corresponds to #nodes[i] + */ +export class Finder extends Evaluator { + /* private fields */ + #ast; + #mapper; + #nodeWalker; + #nodes; + #rootWalker; + #scoped; + #selector; + #selectorAST = null; + + /** + * Gets the selector AST. + * @returns {import('css-tree').CssNode|null} The selector AST. + */ + get selectorAST() { + return this.#selectorAST; + } + + /** + * Sets up the finder. + * @param {string} selector - The CSS selector. + * @param {Document|DocumentFragment|Element} node - Document, DocumentFragment, or Element. + * @param {import('../index.js').FindOptions} opt - Options. + * @returns {Finder} The Finder instance. + */ + setup(selector, node, opt) { + super.setup(selector, node, opt); + this.#ast = null; + this.#mapper = new Mapper(this); + this.#nodeWalker = null; + this.#nodes = null; + this.#scoped = + this.node !== this.root && this.node.nodeType === ELEMENT_NODE; + this.#rootWalker = null; + this.#selector = selector; + this.#selectorAST = null; + return this; + } + + /** + * Finds matched nodes. + * @param {string} targetType - The target type. + * @returns {Set|import('../index.js').CheckResult} A collection of matched nodes or a CheckResult object. + */ + find(targetType) { + let collection; + try { + collection = this.#collectNodes(targetType); + } catch (e) { + if (this.check) { + return { + ast: this.#selectorAST, + error: e, + match: false, + pseudoElement: this.pseudoElements.length + ? this.pseudoElements.join('') + : null + }; + } else { + throw e; + } + } + const [[...branches], collectedNodes] = collection; + const l = branches.length; + let sort = l > 1 && targetType === TARGET_ALL; + let nodes = new Set(); + for (let i = 0; i < l; i++) { + const { branch, dir, find } = branches[i]; + if (!branch.length || !find) { + continue; + } + const entryNodes = collectedNodes[i]; + const lastIndex = branch.length - 1; + if (lastIndex === 0) { + if ( + (targetType === TARGET_ALL || targetType === TARGET_FIRST) && + this.node.nodeType === ELEMENT_NODE + ) { + for (const node of entryNodes) { + if (node !== this.node) { + if (targetType === TARGET_ALL || this.node.contains(node)) { + nodes.add(node); + if (targetType === TARGET_FIRST) { + break; + } + } + } + } + } else if (targetType === TARGET_ALL) { + if (nodes.size) { + for (const node of entryNodes) { + nodes.add(node); + } + sort = true; + } else { + nodes = new Set(entryNodes); + } + } else { + if (entryNodes.length) { + nodes.add(entryNodes[0]); + } + } + } else if (targetType === TARGET_ALL) { + const newNodes = this.#processComplexBranchAll(branch, entryNodes, dir); + if (nodes.size) { + for (const newNode of newNodes) { + nodes.add(newNode); + } + sort = true; + } else { + nodes = newNodes; + } + } else { + const matchedNode = this.#processComplexBranchFirst( + branch, + entryNodes, + dir, + targetType + ); + if (matchedNode) { + nodes.add(matchedNode); + } + } + } + if (this.check) { + return { + ast: this.#selectorAST, + error: null, + match: nodes.size > 0, + pseudoElement: this.pseudoElements.length + ? this.pseudoElements.join('') + : null + }; + } + if (targetType === TARGET_FIRST || targetType === TARGET_ALL) { + nodes.delete(this.node); + } + if ((sort || targetType === TARGET_FIRST) && nodes.size > 1) { + return new Set(sortNodes(nodes)); + } + return nodes; + } + + /** + * Collects all matching nodes into AST nodes array. + * @private + * @param {string} targetType - The target type. + * @returns {Array} Array containing the AST and nodes arrays. + */ + #collectNodes(targetType) { + const { ast, invalidate, nodes, selectorAST } = this.#mapper.correspond( + this.#selector + ); + this.#ast = ast; + this.#nodes = nodes; + this.invalidate = invalidate; + this.#selectorAST = selectorAST; + const astValues = this.#ast.values(); + if (targetType === TARGET_ALL || targetType === TARGET_FIRST) { + const pendingItems = new Set(); + const hasScope = + typeof this.#selector === 'string' && this.#selector.includes(':scope'); + const scoped = this.#scoped; + let i = 0; + for (const { branch } of astValues) { + const complex = branch.length > 1; + const { dir, twig } = getTraversalStrategy( + branch, + targetType, + hasScope, + scoped + ); + const { compound, filtered, nodes, pending } = this.#findEntryNodes( + twig, + targetType, + { complex, dir } + ); + if (nodes.length) { + this.#ast[i].find = true; + this.#nodes[i] = nodes; + } else if (pending) { + pendingItems.add({ + index: i, + twig + }); + } + this.#ast[i].dir = dir; + this.#ast[i].filtered = filtered || !compound; + i++; + } + this.#processPendingItems(pendingItems); + } else { + let i = 0; + for (const { branch } of astValues) { + const twig = branch[branch.length - 1]; + const complex = branch.length > 1; + const dir = DIR_PREV; + const { compound, filtered, nodes } = this.#findEntryNodes( + twig, + targetType, + { complex, dir } + ); + if (nodes.length) { + this.#ast[i].find = true; + this.#nodes[i] = nodes; + } + this.#ast[i].dir = dir; + this.#ast[i].filtered = filtered || !compound; + i++; + } + } + return [this.#ast, this.#nodes]; + } + + /** + * Finds entry nodes based on the selector type. + * @private + * @param {import('./processor.js').ProcessedBranch} twig - The twig object containing leaves. + * @param {string} targetType - The target type. + * @param {StrategyOptions} [opt] - The strategy options. + * @returns {object} Result object with nodes and flags. + */ + #findEntryNodes(twig, targetType, opt = {}) { + const { leaves } = twig; + const [leaf] = leaves; + const filterLeaves = this.getFilterLeaves(leaves); + const { complex = false, dir = DIR_PREV } = opt; + const precede = + dir === DIR_NEXT && + this.node.nodeType === ELEMENT_NODE && + this.node !== this.root; + switch (leaf.type) { + case PS_ELEMENT_SELECTOR: { + return this.#findEntryNodesForPseudoElement( + leaf, + filterLeaves, + targetType, + opt + ); + } + case ID_SELECTOR: { + return this.#findEntryNodesForId(twig, targetType, { + complex, + precede, + filterLeaves + }); + } + case CLASS_SELECTOR: { + return this.#findEntryNodesForClass(leaves, targetType, { + complex, + precede, + filterLeaves + }); + } + case TYPE_SELECTOR: { + return this.#findEntryNodesForType(leaves, targetType, { + complex, + precede, + filterLeaves + }); + } + default: { + return this.#findEntryNodesForOther(twig, targetType, { + complex, + precede, + filterLeaves + }); + } + } + } + + /** + * Finds entry nodes for pseudo-elements. + * @private + * @param {import('css-tree').CssNode} leaf - The AST leaf. + * @param {Array} filterLeaves - Leaves for filtering. + * @param {string} targetType - The target type. + * @param {StrategyOptions} opt - The strategy options. + * @returns {object} Object with nodes, filtered, and pending flags. + */ + #findEntryNodesForPseudoElement(leaf, filterLeaves, targetType, opt) { + const compound = filterLeaves.length > 0; + if (targetType === TARGET_SELF && this.check) { + const css = generateCSS(leaf); + this.pseudoElements.push(css); + if (filterLeaves.length) { + const [nodes, filtered] = this.#matchSelf(filterLeaves); + return { compound, filtered, nodes, pending: false }; + } + return { compound, filtered: true, nodes: [this.node], pending: false }; + } + matchPseudoElementSelector(leaf.name, leaf.type, opt); + return { compound, filtered: false, nodes: [], pending: false }; + } + + /** + * Finds entry nodes using ID selector strategy. + * @private + * @param {import('./processor.js').ProcessedBranch} twig - The twig object containing leaves. + * @param {string} targetType - The target type. + * @param {StrategyOptions} [opt] - The strategy options. + * @returns {object} Result object with nodes and flags. + */ + #findEntryNodesForId(twig, targetType, opt = {}) { + const { leaves } = twig; + const { complex, precede, filterLeaves = [] } = opt; + const compound = filterLeaves.length > 0; + const earlyResult = this.#checkSelfOrLinealTarget( + leaves, + targetType, + complex, + compound + ); + if (earlyResult) { + return earlyResult; + } + if ( + targetType === TARGET_FIRST && + this.root.nodeType !== ELEMENT_NODE && + this.node.nodeType !== ELEMENT_NODE + ) { + const [leaf] = leaves; + const node = this.root.getElementById(leaf.name); + /* + * getElementById() answers with the first element carrying the id. + * For a compound selector that element may fail the remaining leaves + * while a later element sharing the id still matches, so the shortcut + * can only conclude the search when it succeeds. + */ + if (!filterLeaves.length) { + const nodes = node ? [node] : []; + return { compound, filtered: nodes.length > 0, nodes, pending: false }; + } + if (node && this.matchLeaves(filterLeaves, node)) { + return { compound, filtered: true, nodes: [node], pending: false }; + } + } + return this.#fallbackToWalkerResult(leaves, targetType, precede, compound); + } + + /** + * Finds entry nodes using class selector strategy. + * @private + * @param {Array} leaves - The AST leaves. + * @param {string} targetType - The target type. + * @param {StrategyOptions} [opt] - The strategy options. + * @returns {object} Result object with nodes and flags. + */ + #findEntryNodesForClass(leaves, targetType, opt = {}) { + const { complex, precede, filterLeaves = [] } = opt; + const compound = filterLeaves.length > 0; + const earlyResult = this.#checkSelfOrLinealTarget( + leaves, + targetType, + complex, + compound + ); + if (earlyResult) { + return earlyResult; + } + if ( + targetType !== TARGET_FIRST && + !precede && + canUseFastClassSearch(this.node) + ) { + this.matchLeaves(leaves, this.node); + const [leaf] = leaves; + const className = this.getUnescapedName(leaf); + const collection = this.node.getElementsByClassName(className); + return this.#filterAndFormatCollection( + collection, + filterLeaves, + compound + ); + } + return this.#fallbackToWalkerResult(leaves, targetType, precede, compound); + } + + /** + * Finds entry nodes using type selector strategy. + * @private + * @param {Array} leaves - The AST leaves. + * @param {string} targetType - The target type. + * @param {StrategyOptions} [opt] - The strategy options. + * @returns {object} Result object with nodes and flags. + */ + #findEntryNodesForType(leaves, targetType, opt = {}) { + const { complex, precede, filterLeaves = [] } = opt; + const compound = filterLeaves.length > 0; + const earlyResult = this.#checkSelfOrLinealTarget( + leaves, + targetType, + complex, + compound + ); + if (earlyResult) { + return earlyResult; + } + const [leaf] = leaves; + const tagName = this.getUnescapedName(leaf); + if ( + targetType !== TARGET_FIRST && + !precede && + this.document.contentType === MIME_HTML && + canUseFastTagSearch(this.node, tagName) + ) { + this.matchLeaves(leaves, this.node); + const collection = this.node.getElementsByTagName(tagName); + return this.#filterAndFormatCollection( + collection, + filterLeaves, + compound + ); + } + return this.#fallbackToWalkerResult(leaves, targetType, precede, compound); + } + + /** + * Finds entry nodes for other selector types. + * @private + * @param {import('./processor.js').ProcessedBranch} twig - The twig object containing leaves. + * @param {string} targetType - The target type. + * @param {StrategyOptions} [opt] - The strategy options. + * @returns {object} Result object with nodes and flags. + */ + #findEntryNodesForOther(twig, targetType, opt = {}) { + const { leaves } = twig; + const [leaf] = leaves; + const { complex, precede, filterLeaves = [] } = opt; + const compound = filterLeaves.length > 0; + if (targetType !== TARGET_LINEAL && /host(?:-context)?/.test(leaf.name)) { + let shadowRoot = null; + if ( + this.shadow && + this.node.nodeType === DOCUMENT_FRAGMENT_NODE && + this.evaluateShadowHost(leaf, this.node) + ) { + shadowRoot = this.node; + } else if ( + filterLeaves.length && + this.node.nodeType === ELEMENT_NODE && + this.evaluateShadowHost(leaf, this.node.shadowRoot) + ) { + shadowRoot = this.node.shadowRoot; + } + if (shadowRoot) { + let bool = true; + const l = filterLeaves.length; + for (let i = 0; i < l; i++) { + const filterLeaf = filterLeaves[i]; + switch (filterLeaf.name) { + case 'host': + case 'host-context': { + bool = this.evaluateShadowHost(filterLeaf, shadowRoot); + break; + } + case 'has': { + bool = this.matchPseudoClassSelector(filterLeaf, shadowRoot, {}); + break; + } + default: { + bool = false; + } + } + if (!bool) { + break; + } + } + const nodes = []; + if (bool) { + nodes.push(shadowRoot); + } + return { compound, filtered: nodes.length > 0, nodes, pending: false }; + } + } + const earlyResult = this.#checkSelfOrLinealTarget( + leaves, + targetType, + complex, + compound + ); + if (earlyResult) { + return earlyResult; + } + if ( + targetType === TARGET_FIRST || + (leaf.type === ATTR_SELECTOR && !compound) + ) { + return this.#fallbackToWalkerResult( + leaves, + targetType, + precede, + compound + ); + } + return { compound, filtered: false, nodes: [], pending: true }; + } + + /** + * Processes pending items to find matches. + * @private + * @param {Set<{index: number, twig: import('./processor.js').ProcessedBranch}>} pendingItems - Set of pending items to process. + * @returns {void} + */ + #processPendingItems(pendingItems) { + if (!pendingItems.size) { + return; + } + if (!this.#rootWalker) { + this.#rootWalker = this.createTreeWalker(this.root); + } + const node = this.#scoped ? this.node : this.root; + const walker = this.#rootWalker; + let nextNode = traverseNode(node, walker); + while (nextNode) { + const isWithinScope = + this.node.nodeType !== ELEMENT_NODE || + nextNode === this.node || + this.node.contains(nextNode); + if (isWithinScope) { + for (const pendingItem of pendingItems) { + const { leaves } = pendingItem.twig; + if (this.matchLeaves(leaves, nextNode)) { + const { index } = pendingItem; + this.#ast[index].filtered = true; + this.#ast[index].find = true; + this.#nodes[index].push(nextNode); + } + } + } else if (this.#scoped) { + break; + } + nextNode = walker.nextNode(); + } + } + + /** + * Processes complex branch for all matches. + * @private + * @param {Array} branch - The selector branch. + * @param {Array} entryNodes - The entry nodes. + * @param {string} dir - The traversal direction. + * @returns {Set} Set of matched nodes. + */ + #processComplexBranchAll(branch, entryNodes, dir) { + const matchedNodes = new Set(); + const branchLen = branch.length; + const lastIndex = branchLen - 1; + if (dir === DIR_NEXT) { + const { combo: firstCombo } = branch[0]; + for (const node of entryNodes) { + this.#dfsComplexBranchNext( + node, + 1, + firstCombo, + branch, + lastIndex, + matchedNodes, + dir + ); + } + } else { + for (const node of entryNodes) { + if (this.#hasValidPathPrev(node, branch, lastIndex - 1)) { + matchedNodes.add(node); + } + } + } + return matchedNodes; + } + + /** + * Depth-first search for tracking complex combinator branches forward. + * @private + * @param {Element} node - The current DOM node. + * @param {number} index - The current index in the selector branch. + * @param {import('css-tree').CssNode|null} currentCombo - The current combinator AST node. + * @param {Array} branch - The selector branch array. + * @param {number} lastIndex - The last index of the branch. + * @param {Set} matchedNodes - The set accumulating matched nodes. + * @param {string} dir - The traversal direction. + * @returns {void} + */ + #dfsComplexBranchNext( + node, + index, + currentCombo, + branch, + lastIndex, + matchedNodes, + dir + ) { + const { combo: nextCombo, leaves } = branch[index]; + const twig = { combo: currentCombo, leaves }; + for (const nextNode of this.yieldCombinatorMatches(twig, node, { dir })) { + if (index === lastIndex) { + matchedNodes.add(nextNode); + } else { + this.#dfsComplexBranchNext( + nextNode, + index + 1, + nextCombo, + branch, + lastIndex, + matchedNodes, + dir + ); + } + } + } + + /** + * Processes complex branch for the first match. + * @private + * @param {Array} branch - The selector branch. + * @param {Array} entryNodes - The entry nodes. + * @param {string} dir - The traversal direction. + * @param {string} targetType - The target type. + * @returns {Element|null} The matched node or null. + */ + #processComplexBranchFirst(branch, entryNodes, dir, targetType) { + const branchLen = branch.length; + const lastIndex = branchLen - 1; + if (dir === DIR_NEXT) { + return this.#processComplexBranchFirstNext( + branch, + entryNodes, + targetType + ); + } else { + return this.#processComplexBranchFirstPrev( + branch, + entryNodes, + targetType, + lastIndex + ); + } + } + + /** + * Processes complex branch first match in the forward direction. + * @private + * @param {Array} branch - The selector branch. + * @param {Array} entryNodes - The entry nodes. + * @param {string} targetType - The target type. + * @returns {Element|null} The matched node or null if not found. + */ + #processComplexBranchFirstNext(branch, entryNodes, targetType) { + const { combo: entryCombo } = branch[0]; + for (const node of entryNodes) { + const matchedNode = this.#matchNodeNext(node, branch, 1, entryCombo); + if (matchedNode) { + if (this.node.nodeType === ELEMENT_NODE) { + if (matchedNode !== this.node && this.node.contains(matchedNode)) { + return matchedNode; + } + } else { + return matchedNode; + } + } + } + const { leaves: entryLeaves } = branch[0]; + const [entryNode] = entryNodes; + if (this.node.contains(entryNode)) { + let [refNode] = this.#findNodeWalker(entryLeaves, entryNode, { + targetType + }); + while (refNode) { + const matchedNode = this.#matchNodeNext(refNode, branch, 1, entryCombo); + if (matchedNode) { + return matchedNode; + } + [refNode] = this.#findNodeWalker(entryLeaves, refNode, { + targetType, + force: true + }); + } + } + return null; + } + + /** + * Matches a node in the next direction. + * @private + * @param {Element} node - The starting node. + * @param {Array} branch - The selector branch. + * @param {number} index - The branch index. + * @param {object} combo - The combinator AST. + * @returns {Element|null} The matched node or null. + */ + #matchNodeNext(node, branch, index, combo) { + const { combo: nextCombo, leaves } = branch[index]; + const twig = { + combo, + leaves + }; + for (const nextNode of this.yieldCombinatorMatches(twig, node, { + dir: DIR_NEXT + })) { + if (index === branch.length - 1) { + return nextNode; + } + const result = this.#matchNodeNext( + nextNode, + branch, + index + 1, + nextCombo + ); + if (result) { + return result; + } + } + return null; + } + + /** + * Processes complex branch first match in the backward direction. + * @private + * @param {Array} branch - The selector branch. + * @param {Array} entryNodes - The entry nodes. + * @param {string} targetType - The target type. + * @param {number} lastIndex - The last index of the branch. + * @returns {Element|null} The matched node or null if not found. + */ + #processComplexBranchFirstPrev(branch, entryNodes, targetType, lastIndex) { + for (const node of entryNodes) { + if (this.#hasValidPathPrev(node, branch, lastIndex - 1)) { + return node; + } + } + if (targetType === TARGET_FIRST) { + const { leaves: entryLeaves } = branch[lastIndex]; + const entryNode = entryNodes[0]; + let [refNode] = this.#findNodeWalker(entryLeaves, entryNode, { + targetType + }); + while (refNode) { + if (this.#hasValidPathPrev(refNode, branch, lastIndex - 1)) { + return refNode; + } + [refNode] = this.#findNodeWalker(entryLeaves, refNode, { + targetType, + force: true + }); + } + } + return null; + } + + /** + * Recursively checks for a valid backward path. + * @private + * @param {Element} node - The starting node. + * @param {Array} branch - The selector branch. + * @param {number} index - The current branch index. + * @returns {boolean} True if a valid path exists, otherwise false. + */ + #hasValidPathPrev(node, branch, index) { + if (index < 0) { + return true; + } + const twig = branch[index]; + const { combo, leaves } = twig; + const comboName = combo.name; + if (comboName === '+') { + const refNode = node.previousElementSibling; + if (refNode && this.matchLeaves(leaves, refNode)) { + if (this.#hasValidPathPrev(refNode, branch, index - 1)) { + return true; + } + } + } else if (comboName === '~') { + let refNode = node.previousElementSibling; + while (refNode) { + if (this.matchLeaves(leaves, refNode)) { + if (this.#hasValidPathPrev(refNode, branch, index - 1)) { + return true; + } + } + refNode = refNode.previousElementSibling; + } + } else if (comboName === '>') { + const parentNode = node.parentNode; + if (parentNode && this.matchLeaves(leaves, parentNode)) { + if (this.#hasValidPathPrev(parentNode, branch, index - 1)) { + return true; + } + } + } else { + let refNode = node.parentNode; + while (refNode) { + if (this.matchLeaves(leaves, refNode)) { + if (this.#hasValidPathPrev(refNode, branch, index - 1)) { + return true; + } + } + refNode = refNode.parentNode; + } + } + return false; + } + + /** + * Performs early evaluation for TARGET_SELF and TARGET_LINEAL. + * @private + * @param {Array} leaves - The AST leaves. + * @param {string} targetType - The target type. + * @param {boolean} complex - Indicates if the branch is complex. + * @param {boolean} compound - Indicates if there are filter leaves. + * @returns {object|null} The result object if matched, or null otherwise. + */ + #checkSelfOrLinealTarget(leaves, targetType, complex, compound) { + if (targetType === TARGET_SELF) { + const [nodes, filtered] = this.#matchSelf(leaves); + return { compound, filtered, nodes, pending: false }; + } else if (targetType === TARGET_LINEAL) { + const [nodes, filtered] = this.#findLineal(leaves, { complex }); + return { compound, filtered, nodes, pending: false }; + } + return null; + } + + /** + * Matches the current node itself against leaves. + * @private + * @param {Array} leaves - The AST leaves. + * @returns {Array} Array with nodes, match boolean, and pseudo-elements. + */ + #matchSelf(leaves) { + const matched = this.matchLeaves(leaves, this.node, { + check: this.check, + warn: this.warn + }); + const nodes = matched ? [this.node] : []; + return [nodes, matched, this.pseudoElements]; + } + + /** + * Finds lineal matching nodes (self and ancestors). + * @private + * @param {Array} leaves - The AST leaves. + * @param {StrategyOptions} [opt] - The strategy options. + * @returns {Array} Array containing nodes and filtered boolean. + */ + #findLineal(leaves, opt = {}) { + const { complex } = opt; + const nodes = []; + const selfMatched = this.matchLeaves(leaves, this.node); + if (selfMatched) { + nodes.push(this.node); + } + if (!selfMatched || complex) { + let currentNode = this.node.parentNode; + while (currentNode) { + if (this.matchLeaves(leaves, currentNode)) { + nodes.push(currentNode); + if (!complex) { + break; + } + } + currentNode = currentNode.parentNode; + } + } + const filtered = nodes.length > 0; + return [nodes, filtered]; + } + + /** + * Standardizes the loop processing and filtering of a collection. + * @private + * @param {object} collection - The HTMLCollection or NodeList to process. + * @param {Array} filterLeaves - Leaves for filtering. + * @param {boolean} compound - Indicates if there are filter leaves. + * @returns {object} Result object with nodes and flags. + */ + #filterAndFormatCollection(collection, filterLeaves, compound) { + const len = collection.length; + const hasFilter = filterLeaves.length > 0; + const nodeArray = []; + for (let i = 0; i < len; i++) { + const currentNode = collection[i]; + if (!hasFilter || this.matchLeaves(filterLeaves, currentNode)) { + nodeArray.push(currentNode); + } + } + return { + compound, + filtered: nodeArray.length > 0, + nodes: nodeArray, + pending: false + }; + } + + /** + * Returns the fallback search result using NodeWalker. + * @private + * @param {Array} leaves - The AST leaves. + * @param {string} targetType - The target type. + * @param {boolean} precede - Indicates if searching preceding nodes. + * @param {boolean} compound - Indicates if there are filter leaves. + * @returns {object} Result object with nodes and flags. + */ + #fallbackToWalkerResult(leaves, targetType, precede, compound) { + const nodes = this.#findNodeWalker(leaves, this.node, { + precede, + targetType + }); + return { compound, filtered: nodes.length > 0, nodes, pending: false }; + } + + /** + * Finds matching nodes using TreeWalker. + * @private + * @param {Array} leaves - The AST leaves. + * @param {Element} node - The starting node. + * @param {TraversalOptions} [opt] - The traversal options. + * @returns {Array} An array of matched nodes. + */ + #findNodeWalker(leaves, node, opt = {}) { + const { precede, ...traversalOpts } = opt; + if (precede) { + const precedeNodes = this.#findPrecede(leaves, this.root, opt); + if (precedeNodes.length) { + return precedeNodes; + } + } + if (!this.#nodeWalker) { + this.#nodeWalker = this.createTreeWalker(this.node); + } + return this.#traverseAndCollectNodes(this.#nodeWalker, leaves, { + ...traversalOpts, + startNode: node + }); + } + + /** + * Finds matching nodes preceding the current node. + * @private + * @param {Array} leaves - The AST leaves to match. + * @param {Element} node - The starting node. + * @param {TraversalOptions} [opt] - The traversal options. + * @returns {Array} An array of matched nodes. + */ + #findPrecede(leaves, node, opt = {}) { + const { force, targetType } = opt; + if (!this.#rootWalker) { + this.#rootWalker = this.createTreeWalker(this.root); + } + return this.#traverseAndCollectNodes(this.#rootWalker, leaves, { + boundaryNode: this.node, + force, + targetType, + startNode: node + }); + } + + /** + * Traverses and collects nodes matching leaves. + * @private + * @param {TreeWalker} walker - The TreeWalker instance. + * @param {Array} leaves - The AST leaves to match. + * @param {TraversalOptions} [opt] - The traversal options. + * @returns {Array} An array of collected nodes. + */ + #traverseAndCollectNodes(walker, leaves, opt = {}) { + const { boundaryNode, force, startNode, targetType } = opt; + const collectedNodes = []; + if ( + targetType === TARGET_ALL && + boundaryNode && + this.matchLeaves(leaves, boundaryNode) + ) { + collectedNodes.push(boundaryNode); + } + let currentNode = traverseNode(startNode, walker, !!force); + if (currentNode.nodeType !== ELEMENT_NODE) { + currentNode = walker.nextNode(); + } else if (currentNode === startNode && currentNode !== this.root) { + currentNode = walker.nextNode(); + } + while (currentNode) { + if (boundaryNode) { + if (currentNode === boundaryNode) { + break; + } else if ( + targetType === TARGET_ALL && + !boundaryNode.contains(currentNode) + ) { + break; + } + } + if (this.matchLeaves(leaves, currentNode) && currentNode !== this.node) { + collectedNodes.push(currentNode); + if (targetType !== TARGET_ALL) { + break; + } + } + currentNode = walker.nextNode(); + } + return collectedNodes; + } +} diff --git a/node_modules/@asamuzakjp/dom-selector/src/js/mapper.js b/node_modules/@asamuzakjp/dom-selector/src/js/mapper.js new file mode 100644 index 0000000..807398f --- /dev/null +++ b/node_modules/@asamuzakjp/dom-selector/src/js/mapper.js @@ -0,0 +1,122 @@ +/** + * mapper.js + */ +import { SelectorProcessor } from './processor.js'; +import { parseSelector, walkAST } from './parser.js'; +import { createHasValidator } from './selector.js'; + +/** + * @typedef {object} MapperResult + * @property {Array} ast - Fresh AST nodes. + * @property {boolean} invalidate - Invalidation flag for dynamic evaluation. + * @property {Array>} nodes - Array of matched element arrays per branch. + * @property {import('css-tree').CssNode} selectorAST - The selector AST. + */ + +/** + * Mapper + * Maps CSS selectors to parsed ASTs and sets up node arrays. + */ +export class Mapper { + #context; + #processor; + + /** + * @param {import('./finder.js').Finder} context - The Finder instance. + */ + constructor(context) { + this.#context = context; + this.#processor = new SelectorProcessor(context); + } + + /** + * Gets the corresponding AST, nodes array, invalidate flag, and selector AST. + * @param {string} selector - The CSS selector string. + * @returns {MapperResult} The MapperResult object. + */ + correspond(selector) { + const ctx = this.#context; + let ast = null; + let invalidate = false; + let selectorAST = null; + // Check cache. + if (ctx.documentCache.has(ctx.document)) { + const cachedItem = ctx.documentCache.get(ctx.document); + if (cachedItem && cachedItem.has(selector)) { + const item = cachedItem.get(selector); + ast = item.ast; + invalidate = item.invalidate; + selectorAST = item.selectorAST; + } + } + if (ast) { + return this.#prepareResult(ast, invalidate, selectorAST); + } + // Parse selector and build metadata. + selectorAST = parseSelector(selector); + const { branches, info } = walkAST( + selectorAST, + true, + createHasValidator(ctx.window) + ); + const { + hasHasPseudoFunc, + hasNestingSelector, + hasNthChildOfSelector, + hasSiblingCombinator, + hasStatePseudoClass, + hasUnsupportedPseudoClass + } = info; + // Determine invalidation flags. + invalidate = + hasHasPseudoFunc || + hasNestingSelector || + hasNthChildOfSelector || + hasSiblingCombinator || + hasStatePseudoClass || + hasUnsupportedPseudoClass; + // Process branches. + const processed = this.#processor.process(branches, selector); + ast = processed.ast; + const descendant = processed.descendant; + // Store in cache. + let cachedItem; + if (ctx.documentCache.has(ctx.document)) { + cachedItem = ctx.documentCache.get(ctx.document); + } else { + cachedItem = new Map(); + ctx.documentCache.set(ctx.document, cachedItem); + } + cachedItem.set(selector, { + ast, + descendant, + invalidate, + selectorAST + }); + return this.#prepareResult(ast, invalidate, selectorAST); + } + + /** + * Prepares fresh AST nodes and initialized matching nodes array. + * @private + * @param {Array} ast - The cached or parsed AST. + * @param {boolean} invalidate - Invalidation flag for dynamic evaluation. + * @param {import('css-tree').CssNode} selectorAST - The parsed CSS selector AST. + * @returns {MapperResult} The MapperResult object. + */ + #prepareResult(ast, invalidate, selectorAST) { + const l = ast.length; + const freshAst = new Array(l); + const nodes = new Array(l); + for (let i = 0; i < l; i++) { + freshAst[i] = { + branch: ast[i].branch, + dir: null, + filtered: false, + find: false + }; + nodes[i] = []; + } + return { ast: freshAst, invalidate, nodes, selectorAST }; + } +} diff --git a/node_modules/@asamuzakjp/dom-selector/src/js/matcher.js b/node_modules/@asamuzakjp/dom-selector/src/js/matcher.js new file mode 100644 index 0000000..ac65c4a --- /dev/null +++ b/node_modules/@asamuzakjp/dom-selector/src/js/matcher.js @@ -0,0 +1,807 @@ +/** + * matcher.js + */ + +/* import */ +import { generateCSS, parseAstName, unescapeSelector } from './parser.js'; +import { + generateException, + getDirectionality, + getLanguageAttribute, + getType, + isContentEditable, + isHTMLElement, + isNamespaceDeclared +} from './utility.js'; + +/* constants */ +import { + ATTR_VALUE_I, + INPUT_EDIT, + LANG_ALPHA_NUM, + LANG_PART, + LANG_PART_SKIP, + NOT_SUPPORTED_ERR, + PS_ELEMENT_SELECTOR, + STRING, + SYNTAX_ERR +} from './constant.js'; +const KEYS_ATTR_VALUE_I = new Set(ATTR_VALUE_I); +const KEYS_INPUT_EDIT = new Set(INPUT_EDIT); + +/* regexp */ +const REG_LANG_VALID = new RegExp( + `^(?:\\*-)?${LANG_ALPHA_NUM}${LANG_PART}$`, + 'i' +); +const REG_ATTR_EQUALITY = /^[a-z][a-z\d_-]*$/; + +/* cache */ +const astMetaCache = new WeakMap(); +const htmlAttrMetaCache = new WeakMap(); + +/** + * Validates a pseudo-element selector. + * @param {string} astName - The name of the pseudo-element from the AST. + * @param {string} astType - The type of the selector from the AST. + * @param {import('../index.js').FindOptions} [opt] - Options. + * @throws {DOMException} If the selector is invalid or unsupported. + * @returns {void} + */ +export const matchPseudoElementSelector = ( + astName, + astType, + { forgive, globalObject, warn } = {} +) => { + if (astType !== PS_ELEMENT_SELECTOR) { + // Ensure the AST node is a pseudo-element selector. + throw new TypeError(`Unexpected ast type ${getType(astType)}`); + } + switch (astName) { + case 'after': + case 'backdrop': + case 'before': + case 'cue': + case 'cue-region': + case 'first-letter': + case 'first-line': + case 'file-selector-button': + case 'marker': + case 'placeholder': + case 'selection': + case 'target-text': { + // Warn if the pseudo-element is known but unsupported. + if (warn) { + throw generateException( + `Unsupported pseudo-element ::${astName}`, + NOT_SUPPORTED_ERR, + globalObject + ); + } + break; + } + case 'part': + case 'slotted': { + // Warn if the functional pseudo-element is known but unsupported. + if (warn) { + throw generateException( + `Unsupported pseudo-element ::${astName}()`, + NOT_SUPPORTED_ERR, + globalObject + ); + } + break; + } + default: { + // Handle vendor-prefixed unknown pseudo-elements. + if (astName.startsWith('-webkit-')) { + if (warn) { + throw generateException( + `Unsupported pseudo-element ::${astName}`, + NOT_SUPPORTED_ERR, + globalObject + ); + } + } else if (!forgive) { + // Throw an error for unknown pseudo-elements if not forgiven. + throw generateException( + `Unknown pseudo-element ::${astName}`, + SYNTAX_ERR, + globalObject + ); + } + } + } +}; + +/** + * Matches the :dir() pseudo-class against an element's directionality. + * @param {import('css-tree').CssNode} ast - The AST object for the pseudo-class. + * @param {Element} node - The element node to match against. + * @param {WeakMap} [dirCache] - Cache for directionality. + * @throws {TypeError} If the AST does not contain a valid direction value. + * @returns {boolean} - True if matches, otherwise false. + */ +export const matchDirectionPseudoClass = ( + ast, + node, + dirCache = new WeakMap() +) => { + const { name } = ast; + if (!name) { + const type = name === '' ? '(empty String)' : getType(name); + throw new TypeError(`Unexpected ast type ${type}`); + } + const dir = getDirectionality(node, dirCache); + return name === dir; +}; + +/** + * Matches the :lang() pseudo-class against an element's language attribute. + * @param {import('css-tree').CssNode} ast - The AST object for the pseudo-class child. + * @param {Element} node - The element node to match against. + * @param {WeakMap} [langCache] - Cache for language attributes. + * @throws {TypeError} If the AST does not contain a valid language value. + * @returns {boolean} - True if matches, otherwise false. + */ +export const matchLanguagePseudoClass = ( + ast, + node, + langCache = new WeakMap() +) => { + const elementLang = getLanguageAttribute(node, langCache); + if (elementLang === null) { + return false; + } + let meta = astMetaCache.get(ast); + if (meta === undefined) { + meta = {}; + astMetaCache.set(ast, meta); + } + if (meta.langRegex !== undefined) { + if (meta.langPattern === '*') { + return elementLang !== ''; + } + if (meta.langRegex === null) { + return false; + } + return meta.langRegex.test(elementLang); + } + const { name, type, value } = ast; + const langPattern = + type === STRING && value !== undefined ? value : unescapeSelector(name); + meta.langPattern = langPattern; + if (typeof langPattern !== 'string') { + meta.langRegex = null; + return false; + } + if (langPattern === '*') { + meta.langRegex = null; + return elementLang !== ''; + } + if (!REG_LANG_VALID.test(langPattern)) { + meta.langRegex = null; + return false; + } + const parts = langPattern.split('-'); + const regexStr = parts + .map((part, index) => { + const core = part === '*' ? LANG_ALPHA_NUM : part; + const skip = index === parts.length - 1 ? LANG_PART : LANG_PART_SKIP; + return (index === 0 ? core : `-${core}`) + skip; + }) + .join(''); + const matcherRegex = new RegExp(`^${regexStr}$`, 'i'); + meta.langRegex = matcherRegex; + return matcherRegex.test(elementLang); +}; + +/** + * Matches the :checked pseudo-class. + * @param {Element} node - The Element node. + * @returns {boolean} True if matches, otherwise false. + */ +export const matchCheckedPseudoClass = node => { + const { localName } = node; + if (localName === 'option') { + return node.selected; + } + if (localName === 'input') { + const attrType = node.getAttribute('type'); + if (node.checked) { + return attrType === 'checkbox' || attrType === 'radio'; + } + } + return false; +}; + +/** + * Matches the :any-link and :link pseudo-classes. + * @param {Element} node - The Element node. + * @returns {boolean} True if matches, otherwise false. + */ +export const matchLinkPseudoClass = node => { + const { localName } = node; + if (localName === 'a' || localName === 'area') { + return node.hasAttribute('href'); + } + return false; +}; + +/** + * Matches the :open pseudo-class. + * @param {Element} node - The Element node. + * @returns {boolean} True if matches, otherwise false. + */ +export const matchOpenPseudoClass = node => { + const { localName } = node; + if (localName === 'details' || localName === 'dialog') { + return node.hasAttribute('open'); + } + return false; +}; + +/** + * Matches the :placeholder-shown pseudo-class. + * @param {Element} node - The Element node. + * @param {Set} keys - A set of input type keys. + * @returns {boolean} True if matches, otherwise false. + */ +export const matchPlaceholderShownPseudoClass = (node, keys) => { + let placeholder; + if (node.placeholder) { + placeholder = node.placeholder; + } else if (node.hasAttribute('placeholder')) { + placeholder = node.getAttribute('placeholder'); + } + if (typeof placeholder === 'string' && !/[\r\n]/.test(placeholder)) { + let targetNode; + const { localName } = node; + if (localName === 'textarea') { + targetNode = node; + } else if (localName === 'input') { + if (node.hasAttribute('type')) { + if (keys.has(node.getAttribute('type'))) { + targetNode = node; + } + } else { + targetNode = node; + } + } + if (targetNode) { + return node.value === ''; + } + } + return false; +}; + +/** + * Matches the :in-range and :out-of-range pseudo-classes. + * @param {string} astName - The name of the pseudo-class. + * @param {Element} node - The Element node. + * @param {Set} keys - A set of input type keys. + * @returns {boolean} True if matches, otherwise false. + */ +export const matchRangePseudoClass = (astName, node, keys) => { + const { localName } = node; + const attrType = node.getAttribute('type'); + if ( + localName === 'input' && + !(node.readOnly || node.hasAttribute('readonly')) && + !(node.disabled || node.hasAttribute('disabled')) && + keys.has(attrType) + ) { + const flowed = node.validity.rangeUnderflow || node.validity.rangeOverflow; + if (astName === 'out-of-range') { + return flowed; + } + if (flowed) { + return false; + } + return ( + node.hasAttribute('min') || + node.hasAttribute('max') || + attrType === 'range' + ); + } + return false; +}; + +/** + * Match the :read-only and :read-write pseudo-classes + * @param {string} astName - pseudo-class name + * @param {Element} node - Element node + * @returns {boolean} - True if matches, otherwise false. + */ +export const matchReadOnlyPseudoClass = (astName, node) => { + const { localName } = node; + let isReadOnly = false; + switch (localName) { + case 'textarea': + case 'input': { + const isEditableInput = !node.type || KEYS_INPUT_EDIT.has(node.type); + if (localName === 'textarea' || isEditableInput) { + isReadOnly = + node.readOnly || + node.hasAttribute('readonly') || + node.disabled || + node.hasAttribute('disabled'); + } else { + // Non-editable input types are always read-only + isReadOnly = true; + } + break; + } + default: { + isReadOnly = !isContentEditable(node); + } + } + if (astName === 'read-only') { + return isReadOnly; + } + return !isReadOnly; +}; + +/** + * Matches the :required and :optional pseudo-classes. + * @param {string} astName - The name of the pseudo-class. + * @param {Element} node - The Element node. + * @param {Set} keys - A set of input type keys. + * @returns {boolean} True if matches, otherwise false. + */ +export const matchRequiredPseudoClass = (astName, node, keys) => { + const { localName } = node; + let required = false; + if (localName === 'select' || localName === 'textarea') { + if (node.required || node.hasAttribute('required')) { + required = true; + } + } else if (localName === 'input') { + if (node.hasAttribute('type')) { + const attrType = node.getAttribute('type'); + if (keys.has(attrType)) { + if (node.required || node.hasAttribute('required')) { + required = true; + } + } + } else if (node.required || node.hasAttribute('required')) { + required = true; + } + } else { + return false; + } + if (astName === 'optional') { + return !required; + } + return required; +}; + +/** + * Matches an attribute selector against an element. + * @param {import('css-tree').CssNode} ast - The AST for the attribute selector. + * @param {Element} node - The element node to match against. + * @param {import('../index.js').FindOptions} [opt] - Options. + * @returns {boolean} - True if the attribute selector matches, otherwise false. + */ +export const matchAttributeSelector = ( + ast, + node, + { check, forgive, globalObject } = {} +) => { + const { + flags: astFlags, + matcher: astMatcher, + name: astName, + value: astValue + } = ast; + if (typeof astFlags === 'string' && !/^[is]$/i.test(astFlags) && !forgive) { + const css = generateCSS(ast); + throw generateException( + `Invalid selector ${css}`, + SYNTAX_ERR, + globalObject + ); + } + const astRawName = astName?.name; + const isHTML = isHTMLElement(node); + const metaCache = isHTML ? htmlAttrMetaCache : astMetaCache; + let meta = metaCache.get(ast); + if (meta === undefined) { + meta = { + attrValues: new Set(), + equalityName: null + }; + if ( + astMatcher === '=' && + !astFlags && + astValue?.type === STRING && + typeof astRawName === 'string' && + astRawName !== 'lang' && + !KEYS_ATTR_VALUE_I.has(astRawName) && + REG_ATTR_EQUALITY.test(astRawName) + ) { + meta.equalityName = astRawName; + } + metaCache.set(ast, meta); + } + // Parsing and flag validation still run before this matching shortcut. + if (isHTML && meta.equalityName !== null) { + const attrName = meta.equalityName; + if (node.getAttribute(attrName) === astValue.value) { + return true; + } + // Prefixed or duplicate names can hide another matching attribute. + let occurrences = 0; + let needsFallback = false; + for (const attributeName of node.getAttributeNames()) { + if (attributeName === attrName) { + occurrences++; + } + if (attributeName.includes(':') || occurrences > 1) { + needsFallback = true; + break; + } + } + if (!needsFallback) { + return false; + } + } + if (astMatcher === null && !astFlags && typeof astRawName === 'string') { + if (meta.astName === undefined) { + const rawName = unescapeSelector(astRawName); + meta.astName = rawName; + meta.hasPipe = rawName.indexOf('|') > -1; + } + if (!meta.hasPipe) { + if ( + meta.astName === 'lang' && + node.hasAttributeNS('http://www.w3.org/XML/1998/namespace', 'lang') + ) { + return false; + } + if (node.hasAttribute(meta.astName)) { + return true; + } + const attrs = node.attributes; + if (!attrs || attrs.length === 0) { + return false; + } + const checkName = isHTML ? meta.astName.toLowerCase() : meta.astName; + for (const itemAttr of attrs) { + let itemName = itemAttr.name; + if (isHTML) { + itemName = itemName.toLowerCase(); + } + const colonIdx = itemName.indexOf(':'); + if (colonIdx > -1) { + const itemLocalName = itemName + .substring(colonIdx + 1) + .replace(/^:/, ''); + if (checkName === itemLocalName) { + return true; + } + } else if (checkName === itemName) { + return true; + } + } + return false; + } + } + const { attributes } = node; + if (!attributes || !attributes.length) { + return false; + } + if (meta.caseInsensitive === undefined) { + let caseInsensitive = false; + if (typeof astFlags === 'string') { + caseInsensitive = /^i$/i.test(astFlags); + } else if (isHTML) { + caseInsensitive = KEYS_ATTR_VALUE_I.has(astRawName); + } + meta.caseInsensitive = caseInsensitive; + let astAttrName = unescapeSelector(astRawName); + if (isHTML) { + if (typeof astFlags === 'string') { + if (/^i$/i.test(astFlags)) { + astAttrName = astAttrName.toLowerCase(); + } + } else { + astAttrName = astAttrName.toLowerCase(); + } + } else if (caseInsensitive) { + astAttrName = astAttrName.toLowerCase(); + } + meta.astAttrName = astAttrName; + meta.hasPipeInName = astAttrName.indexOf('|') > -1; + if (meta.hasPipeInName) { + const { prefix, localName } = parseAstName(astAttrName); + meta.astPrefix = prefix; + meta.astLocalName = localName; + } + const { name: astIdentValue, value: astStringValue } = astValue ?? {}; + let attrValue; + if (astIdentValue) { + attrValue = unescapeSelector(astIdentValue); + } else if (astStringValue !== undefined) { + attrValue = astStringValue; + } + if (caseInsensitive && typeof attrValue === 'string') { + attrValue = attrValue.toLowerCase(); + } + meta.cachedAttrValue = attrValue; + if (astMatcher === '~=' && attrValue && typeof attrValue === 'string') { + meta.tildeTarget = /\s/.test(attrValue) ? null : ` ${attrValue} `; + } + } + const caseInsensitive = meta.caseInsensitive; + const astAttrName = meta.astAttrName; + const attrValue = meta.cachedAttrValue; + const attrValues = meta.attrValues; + if (attrValues.size) { + attrValues.clear(); + } + if (meta.hasPipeInName) { + const astPrefix = meta.astPrefix; + const astLocalName = meta.astLocalName; + for (const item of attributes) { + let itemName = item.name; + let itemValue = item.value; + if (caseInsensitive) { + itemName = itemName.toLowerCase(); + itemValue = itemValue.toLowerCase(); + } + const colonIdx = itemName.indexOf(':'); + switch (astPrefix) { + case '': { + if (astLocalName === itemName) { + attrValues.add(itemValue); + } + break; + } + case '*': { + if (colonIdx > -1) { + const itemLocalName = itemName + .substring(colonIdx + 1) + .replace(/^:/, ''); + if (itemLocalName === astLocalName) { + attrValues.add(itemValue); + } + } else if (astLocalName === itemName) { + attrValues.add(itemValue); + } + break; + } + default: { + if (!check) { + if (forgive) { + return false; + } + const css = generateCSS(ast); + throw generateException( + `Invalid selector ${css}`, + SYNTAX_ERR, + globalObject + ); + } + if (colonIdx > -1) { + const itemPrefix = itemName.substring(0, colonIdx); + const itemLocalName = itemName + .substring(colonIdx + 1) + .replace(/^:/, ''); + if (itemPrefix === 'xml' && itemLocalName === 'lang') { + continue; + } + if (astPrefix === itemPrefix && astLocalName === itemLocalName) { + if (isNamespaceDeclared(astPrefix, node)) { + attrValues.add(itemValue); + } + } + } + } + } + } + } else { + for (const item of attributes) { + const origName = item.name; + if ( + item.namespaceURI === 'http://www.w3.org/XML/1998/namespace' && + item.localName === 'lang' + ) { + continue; + } + const colonIdx = origName.indexOf(':'); + if (colonIdx > -1) { + const itemPrefix = origName.substring(0, colonIdx); + const itemLocalName = origName + .substring(colonIdx + 1) + .replace(/^:/, ''); + if (itemPrefix === 'xml' && itemLocalName === 'lang') { + continue; + } + } + let isMatch = false; + if (origName === astAttrName) { + isMatch = true; + } else if (caseInsensitive && origName.toLowerCase() === astAttrName) { + isMatch = true; + } + if (isMatch) { + attrValues.add(caseInsensitive ? item.value.toLowerCase() : item.value); + } else if (colonIdx > -1) { + const itemLocalName = origName + .substring(colonIdx + 1) + .replace(/^:/, ''); + let isLocalMatch = false; + if (itemLocalName === astAttrName) { + isLocalMatch = true; + } else if ( + caseInsensitive && + itemLocalName.toLowerCase() === astAttrName + ) { + isLocalMatch = true; + } + if (isLocalMatch) { + attrValues.add( + caseInsensitive ? item.value.toLowerCase() : item.value + ); + } + } + } + } + if (!attrValues.size) { + return false; + } + switch (astMatcher) { + case '=': { + return typeof attrValue === 'string' && attrValues.has(attrValue); + } + case '~=': { + if (meta.tildeTarget === null || !attrValue) { + return false; + } + const target = meta.tildeTarget; + for (const value of attrValues) { + if (` ${value.replace(/[\t\r\n\f]/g, ' ')} `.includes(target)) { + return true; + } + } + return false; + } + case '|=': { + if (!attrValue || typeof attrValue !== 'string') { + return false; + } + const prefix = `${attrValue}-`; + for (const value of attrValues) { + if (value === attrValue || value.startsWith(prefix)) { + return true; + } + } + return false; + } + case '^=': { + if (!attrValue || typeof attrValue !== 'string') { + return false; + } + for (const value of attrValues) { + if (value.startsWith(attrValue)) { + return true; + } + } + return false; + } + case '$=': { + if (!attrValue || typeof attrValue !== 'string') { + return false; + } + for (const value of attrValues) { + if (value.endsWith(attrValue)) { + return true; + } + } + return false; + } + case '*=': { + if (!attrValue || typeof attrValue !== 'string') { + return false; + } + for (const value of attrValues) { + if (value.includes(attrValue)) { + return true; + } + } + return false; + } + case null: + default: { + return true; + } + } +}; + +/** + * Matches a type selector against an element. + * @param {import('css-tree').CssNode} ast - The AST for the type selector. + * @param {Element} node - The element node to match against. + * @param {import('../index.js').FindOptions} [opt] - Options. + * @returns {boolean} - True if the type selector matches, otherwise false. + */ +export const matchTypeSelector = ( + ast, + node, + { check, forgive, globalObject } = {} +) => { + const { localName, namespaceURI, prefix } = node; + let meta = astMetaCache.get(ast); + if (meta === undefined) { + meta = {}; + astMetaCache.set(ast, meta); + } + if (meta.astName === undefined) { + const astName = unescapeSelector(ast.name); + const { prefix: parsedPrefix, localName: parsedLocalName } = parseAstName( + astName, + node + ); + meta.astName = astName; + meta.astPrefix = parsedPrefix; + meta.astPrefixLowerCased = parsedPrefix.toLowerCase(); + meta.astLocalName = parsedLocalName; + meta.astLocalNameLowerCased = parsedLocalName.toLowerCase(); + meta.hasPipe = astName.includes('|'); + } + const isHTML = isHTMLElement(node); + if (isHTML && localName === meta.astLocalName && !meta.hasPipe) { + return true; + } + let nodePrefix; + let nodeLocalName; + const colonIdx = localName.indexOf(':'); + if (colonIdx > -1) { + nodePrefix = localName.substring(0, colonIdx); + nodeLocalName = localName.substring(colonIdx + 1); + } else { + nodePrefix = prefix || ''; + nodeLocalName = localName; + } + const astPrefix = isHTML ? meta.astPrefixLowerCased : meta.astPrefix; + const astLocalName = isHTML ? meta.astLocalNameLowerCased : meta.astLocalName; + const isUniversal = astLocalName === '*'; + switch (astPrefix) { + case '': { + return ( + !nodePrefix && + !namespaceURI && + (isUniversal || astLocalName === nodeLocalName) + ); + } + case '*': { + return isUniversal || astLocalName === nodeLocalName; + } + default: { + if (!check) { + if (forgive) { + return false; + } + const css = generateCSS(ast); + throw generateException( + `Invalid selector ${css}`, + SYNTAX_ERR, + globalObject + ); + } + const astNS = node.lookupNamespaceURI(astPrefix); + const nodeNS = node.lookupNamespaceURI(nodePrefix); + if (astNS === nodeNS && astPrefix === nodePrefix) { + return isUniversal || astLocalName === nodeLocalName; + } else if (!forgive && !astNS) { + throw generateException( + `Undeclared namespace ${astPrefix}`, + SYNTAX_ERR, + globalObject + ); + } + return false; + } + } +}; diff --git a/node_modules/@asamuzakjp/dom-selector/src/js/nwsapi.js b/node_modules/@asamuzakjp/dom-selector/src/js/nwsapi.js new file mode 100644 index 0000000..9e7fea1 --- /dev/null +++ b/node_modules/@asamuzakjp/dom-selector/src/js/nwsapi.js @@ -0,0 +1,1354 @@ +/** + * nwsapi.js + * Forked from nwsapi@2.2.2 + * @see https://github.com/dperini/nwsapi + */ + +/* import */ +import { LRUCache } from 'lru-cache'; +import { isContentEditable } from './utility.js'; + +/* constants */ +import { DOCUMENT_NODE, ELEMENT_NODE, MIME_HTML } from './constant.js'; +const CACHE_SIZE = 4096; +const F_INIT = '"use strict";return function resolver(c,f,x,r)'; +const S_HEAD = 'var e,n,o,j=r.length-1,k=-1'; +const M_HEAD = 'var e,n,o'; +const S_LOOP = 'main:while((e=c[++k]))'; +const M_LOOP = 'e=c;'; +const S_BODY = 'r[++j]=c[k];'; +const M_BODY = ''; +const S_TAIL = 'continue main;'; +const M_TAIL = 'r=true;'; +const CFG_OPERATORS = '[~*^$|]=|='; +const CFG_COMBINATORS = '[\\s>+~](?=[^>+~])'; +const NEG_DOUBLE_ENC = '(?=(?:[^"]*"[^"]*")*[^"]*$)'; +const NEG_SINGLE_ENC = "(?=(?:[^']*'[^']*')*[^']*$)"; +const NEG_PARENS_ENC = '(?![^\\x28]*\\x29)'; +const NEG_SQUARE_ENC = '(?![^\\x5b]*\\x5d)'; +const NOT_ENOUGH_ARGS = 'Not enough arguments'; +const SEL_INVALID = ' is not a valid selector'; + +/* fast maps */ +const ATTR_STD_OPS = Object.freeze( + Object.assign(Object.create(null), { + '=': 1, + '^=': 1, + '$=': 1, + '|=': 1, + '*=': 1, + '~=': 1 + }) +); +const OPERATORS = Object.freeze( + Object.assign(Object.create(null), { + '=': { p1: '^', p2: '$', p3: 'true' }, + '^=': { p1: '^', p2: '', p3: 'true' }, + '$=': { p1: '', p2: '$', p3: 'true' }, + '*=': { p1: '', p2: '', p3: 'true' }, + '|=': { p1: '^', p2: '(-|$)', p3: 'true' }, + '~=': { p1: '(^|\\s)', p2: '(\\s|$)', p3: 'true' } + }) +); +const METHOD = Object.freeze( + Object.assign(Object.create(null), { + '#': 'getElementById', + '*': 'getElementsByTagName', + '.': 'getElementsByClassName' + }) +); +const GROUPS = Object.freeze( + Object.assign(Object.create(null), { + logicalsel: + '(is|not|has)(?:\\x28\\s?(' + + (() => { + const out = + '\\([^)(]*?(?:'.repeat(3) + + '\\([^)(]*?\\)' + + '[^)(]*?)*?\\)'.repeat(3); + return out.slice(2, out.length - 2); + })() + + ')\\s?\\x29)', + treestruct: + '(nth(?:-last)?(?:-child|-of-type))(?:\\x28\\s?(even|odd|(?:[-+]?\\d*)(?:n\\s?[-+]?\\s?\\d*)?)\\s?(?:\\x29|$))', + locationpc: '(any-link|link|target)\\b', + structural: '(empty|(?:(?:first|last|only)(?:-child|-of-type)))\\b', + inputstate: '(read-(?:only|write))\\b', + inputvalue: '(checked|indeterminate)\\b' + }) +); +const HTML_TABLE = Object.freeze( + Object.assign(Object.create(null), { + accept: 1, + 'accept-charset': 1, + align: 1, + alink: 1, + axis: 1, + bgcolor: 1, + charset: 1, + checked: 1, + clear: 1, + codetype: 1, + color: 1, + compact: 1, + declare: 1, + defer: 1, + dir: 1, + direction: 1, + disabled: 1, + enctype: 1, + face: 1, + frame: 1, + hreflang: 1, + 'http-equiv': 1, + lang: 1, + language: 1, + link: 1, + media: 1, + method: 1, + multiple: 1, + nohref: 1, + noresize: 1, + noshade: 1, + nowrap: 1, + readonly: 1, + rel: 1, + rev: 1, + rules: 1, + scope: 1, + scrolling: 1, + selected: 1, + shape: 1, + target: 1, + text: 1, + type: 1, + valign: 1, + valuetype: 1, + vlink: 1 + }) +); +const REX = Object.freeze( + Object.assign(Object.create(null), { + regExpChar: /(?:(?!\\)[\\^$.*+?()[\]{}|/])/g, + trimSpaces: /[\r\n\f]|^\s+|\s+$/g, + commaGroup: new RegExp( + '(\\s{0,255},\\s{0,255})' + NEG_SQUARE_ENC + NEG_PARENS_ENC, + 'g' + ), + splitGroup: /((?:\x28[^\x29]{0,255}\x29|\[[^\]]{0,255}\]|\\.|[^,])+)/g, + combineWSP: new RegExp('\\s{1,255}' + NEG_SINGLE_ENC + NEG_DOUBLE_ENC, 'g'), + tabCharWSP: new RegExp( + '(\\s?\\t{1,255}\\s?)' + NEG_SINGLE_ENC + NEG_DOUBLE_ENC, + 'g' + ), + pseudosWSP: new RegExp('\\s{1,255}([-+])\\s{1,255}' + NEG_SQUARE_ENC, 'g'), + nthElement: /(:nth(?:-last)?-child)/i, + nthOfType: /(:nth(?:-last)?-of-type)/i, + combinator: /\s?([>+~])\s?/g + }) +); + +/** + * @typedef {(c: Element|Array|NodeList, f?: ((element: Element) => boolean|void), x?: Element|Document|null, r?: boolean|Array) => boolean|Array} ResolverFactory + */ + +/** + * Iterates through nodes and calls a callback function, concatenating elements. + * @param {Array|NodeList} nodes - The nodes to process. + * @param {((element: Element) => boolean | void)=} callback - Optional callback. + * @returns {Array} A new array of the processed nodes. + */ +export const concatCall = (nodes, callback) => { + const l = nodes.length; + const list = new Array(l); + for (let i = 0; i < l; i++) { + if (callback((list[i] = nodes[i])) === false) { + break; + } + } + return list; +}; + +/** + * Checks if a given node belongs to an HTML document. + * @param {Element|Document} node - The node to evaluate. + * @returns {boolean} True if it is an HTML document. + */ +export const isHTML = node => { + const document = node.ownerDocument || node; + return ( + document.nodeType === DOCUMENT_NODE && document.contentType === MIME_HTML + ); +}; + +/** + * Checks if the given node is the target fragment in the document's URL. + * @param {Element} node - The element to check. + * @returns {boolean} True if the node is the current URL target. + */ +export const isTarget = node => { + if (!node?.nodeType === ELEMENT_NODE || !node.id) { + return false; + } + const document = node.ownerDocument; + const { hash } = new URL(document.URL); + return hash === `#${node.id}` && document.contains(node); +}; + +/** + * Checks if an input element or progress bar is in an indeterminate state. + * @param {Element} node - The element to evaluate. + * @returns {boolean} True if the element's state is indeterminate. + */ +export const isIndeterminate = node => { + if ( + (node.indeterminate && + node.localName === 'input' && + node.type === 'checkbox') || + (node.localName === 'progress' && !node.hasAttribute('value')) + ) { + return true; + } + if ( + node.localName === 'input' && + node.type === 'radio' && + !node.hasAttribute('checked') + ) { + const nodeName = node.name; + let parent = node.parentNode; + while (parent) { + if (parent.localName === 'form') { + break; + } + parent = parent.parentNode; + } + if (!parent) { + parent = node.ownerDocument.documentElement; + } + const items = parent.getElementsByTagName('input'); + let checked; + for (const item of items) { + if (item.getAttribute('type') === 'radio') { + if (nodeName) { + if (item.getAttribute('name') === nodeName) { + checked = !!item.checked; + } + } else if (!item.hasAttribute('name')) { + checked = !!item.checked; + } + if (checked) { + break; + } + } + } + if (!checked) { + return true; + } + } + return false; +}; + +/** + * Performs preliminary string manipulation to optimize deep query lookups. + * @param {string} selector - The raw selector string. + * @param {Array} tokens - Derived tokens matching selector end segments. + * @returns {string} The optimized target selector slice. + */ +export const optimize = (selector, tokens) => { + const index = tokens.index; + const length = tokens[1].length + tokens[2].length; + let middle = ''; + if (' >+~'.indexOf(selector.charAt(index - 1)) > -1) { + if (':['.indexOf(selector.charAt(index + length + 1)) > -1) { + middle = '*'; + } + } + let offset = 0; + if (tokens[1] === '*') { + offset = 1; + } + return ( + selector.slice(0, index) + middle + selector.slice(index + length - offset) + ); +}; + +/** + * Validates the matched resolvers sequentially upon a defined Element. + * @param {Array} factory - Collection of factory lambda checking functions. + * @param {Element} element - The referenced node resolving. + * @param {((element: Element) => boolean | void)=} callback - Callback operation. + * @returns {boolean} Whether all condition factories asserted positively. + */ +export const matchAssert = (factory, element, callback) => { + let res = false; + for (const factoryFn of factory) { + if (factoryFn(element, null, null, false)) { + res = true; + break; + } + } + if (res && typeof callback === 'function') { + callback(element); + } + return res; +}; + +/** + * Core logic for nth-index calculations. + * This function is stateless; it relies on the provided 'state' object. + * @param {Element} element - The element to check. + * @param {boolean|number} dir - Direction/Mode (true: last, false: normal, 2: reset). + * @param {object} state - The instance-specific cache state. + * @param {boolean} isOfType - Whether to filter by element type (localName/namespaceURI). + * @returns {number} The calculated index or -1 if reset. + */ +export const solveNth = (element, dir, state, isOfType) => { + if (dir === 2) { + state.idx = 0; + state.len = 0; + state.set = 0; + state.nodes = []; + state.parents = []; + state.parent = undefined; + return -1; + } + const name = isOfType ? element.localName : null; + const nsURI = isOfType ? element.namespaceURI : null; + if (isOfType && nsURI !== 'http://www.w3.org/1999/xhtml') { + state.idx = 0; + state.len = 0; + state.set = 0; + state.nodes = []; + state.parents = []; + state.parent = undefined; + } + const parentMatch = state.parent === element.parentElement; + const hasTypeNode = isOfType + ? state.nodes[state.set] && state.nodes[state.set][name] + : true; + let i, j, k, l; + if (parentMatch && hasTypeNode) { + i = state.set; + j = state.idx; + l = state.len; + } else { + l = state.parents.length; + state.parent = element.parentElement; + for (i = -1, j = 0, k = l - 1; l > j; ++j, --k) { + if (state.parents[j] === state.parent) { + i = j; + break; + } + if (state.parents[k] === state.parent) { + i = k; + break; + } + } + if (i < 0 || (isOfType && !state.nodes[i][name])) { + state.parents[(i = l)] = state.parent; + if (isOfType && !state.nodes[i]) { + state.nodes[i] = Object.create(null); + } + l = 0; + const targetArr = isOfType + ? (state.nodes[i][name] = []) + : (state.nodes[i] = []); + let node = state?.parent?.firstElementChild || element; + while (node) { + if (node === element) { + j = l; + } + if ( + !isOfType || + (node.localName === name && node.namespaceURI === nsURI) + ) { + targetArr[l] = node; + ++l; + } + node = node.nextElementSibling; + } + state.set = i; + state.idx = j; + state.len = l; + if (l < 2) { + return l; + } + } else { + l = isOfType ? state.nodes[i][name].length : state.nodes[i].length; + state.set = i; + } + } + const currentNodes = isOfType ? state.nodes[i][name] : state.nodes[i]; + if (element !== currentNodes[j] && element !== currentNodes[(j = 0)]) { + for (j = 0, k = l - 1; l > j; ++j, --k) { + if (currentNodes[j] === element) { + break; + } + if (currentNodes[k] === element) { + j = k; + break; + } + } + } + state.idx = j + 1; + state.len = l; + return dir ? l - j : state.idx; +}; + +/** + * Nwsapi + * Compiles CSS selectors to efficiently match and query nodes. + */ +export class Nwsapi { + /* private */ + #boundDocumentOrder; + #compat; + #document; + #hasDupes = false; + #htmlDoc = false; + #lastContext; + #lastMatched; + #lastSelected; + #matchLambdas; + #matchResolvers; + #nthChildState; + #nthTypeState; + #quirksMode = false; + #selectLambdas; + #selectResolvers; + #snapshot; + #uidCounter = 0; + #window; + + /* static */ + static #reOptimizer; + static #reValidator; + static #patterns; + static { + const identifier = '(?:--|-?[a-z_])[\\w-]*'; + const pseudonames = '[-\\w]+'; + const pseudoparms = '[-+]?\\d*(?:n\\s?[-+]?\\s?\\d*)'; + const doublequote = '"[^"\\\\]*(?:\\\\.[^"\\\\]*)*(?:"|$)'; + const singlequote = "'[^'\\\\]*(?:\\\\.[^'\\\\]*)*(?:'|$)"; + const attrparser = `${identifier}|${doublequote}|${singlequote}`; + const attrvalues = '([\\x22\\x27]?)((?!\\3)*|(?:\\\\?.)*?)(?:\\3|$)'; + const attributes = `\\[\\s?(${identifier}(?::${identifier})?)\\s?(?:(${CFG_OPERATORS})\\s?(?:${attrparser}))?(?:\\s?\\b(i))?\\s?(?:\\]|$)`; + const attrmatcher = attributes.replace(attrparser, attrvalues); + const pseudoclass = `(?:\\x28\\s*${pseudoparms}?|\\*|:${pseudonames}(?:\\x28${pseudoparms}?\\x29?)?|[.#]?${identifier}|${attributes}|\\s?[>+~]\\s?|\\s?,\\s?|[\\s\\x29])*`; + const standardValidator = `(?=\\s?[^>+~(){}<])(?:\\*|[.#]?${identifier}|${attributes}|::?${pseudonames}${pseudoclass}|\\s?${CFG_COMBINATORS}\\s?|\\s?,\\s?|\\s)+`; + this.#reOptimizer = new RegExp( + `([.:#*]?)(${identifier})(?::[-\\w]+|\\[[^\\]]+(?:\\]|$)|\\x28[^\\x29]+(?:\\x29|$))*$`, + 'i' + ); + this.#reValidator = new RegExp(standardValidator, 'gi'); + this.#patterns = Object.freeze({ + treestruct: new RegExp(`^:(?:${GROUPS.treestruct})(.*)`, 'i'), + structural: new RegExp(`^:(?:${GROUPS.structural})(.*)`, 'i'), + inputstate: new RegExp(`^:(?:${GROUPS.inputstate})(.*)`, 'i'), + inputvalue: new RegExp(`^:(?:${GROUPS.inputvalue})(.*)`, 'i'), + locationpc: new RegExp(`^:(?:${GROUPS.locationpc})(.*)`, 'i'), + logicalsel: new RegExp(`^:(?:${GROUPS.logicalsel})(.*)`, 'i'), + children: /^\s?>\s?(.*)/, + adjacent: /^\s?\+\s?(.*)/, + relative: /^\s?~\s?(.*)/, + ancestor: /^\s+(.*)/, + universal: /^\*(.*)/, + id: new RegExp(`^#(${identifier})(.*)`, 'i'), + tagName: new RegExp(`^(${identifier})(.*)`, 'i'), + className: new RegExp(`^\\.(${identifier})(.*)`, 'i'), + attribute: new RegExp(`^(?:${attrmatcher})(.*)`) + }); + } + + /** + * Initializes the Nwsapi instance. + * @param {Window} window - The Window object. + * @param {Document} document - The Document node. + * @param {number} [cacheSize] - The max number of items to cache. + */ + constructor(window, document, cacheSize = CACHE_SIZE) { + this.#window = window; + const cacheOpt = { + max: cacheSize + }; + this.#matchLambdas = new LRUCache(cacheOpt); + this.#selectLambdas = new LRUCache(cacheOpt); + this.#matchResolvers = new LRUCache(cacheOpt); + this.#selectResolvers = new LRUCache(cacheOpt); + this.#nthChildState = { + idx: 0, + len: 0, + set: 0, + parent: undefined, + parents: [], + nodes: [] + }; + this.#nthTypeState = { + idx: 0, + len: 0, + set: 0, + parent: undefined, + parents: [], + nodes: [] + }; + this.#snapshot = Object.freeze( + Object.assign(Object.create(null), { + isContentEditable, + isIndeterminate, + isTarget, + nthElement: (element, dir) => + solveNth(element, dir, this.#nthChildState, false), + nthOfType: (element, dir) => + solveNth(element, dir, this.#nthTypeState, true) + }) + ); + this.#compat = Object.freeze( + Object.assign(Object.create(null), { + '#': (c, n) => () => this.byId(n, c), + '*': (c, n) => () => this.byTag(n, c), + '.': (c, n) => () => this.byClass(n, c) + }) + ); + this.#lastContext = this.#switchContext(document, true); + this.#boundDocumentOrder = this.#documentOrder.bind(this); + } + + /** + * Comparison function to sort DOM nodes by document order. + * @private + * @param {Element} a - The first node. + * @param {Element} b - The second node. + * @returns {number} Sort indication (-1, 0, or 1). + */ + #documentOrder(a, b) { + if (a === b) { + this.hasDupes = true; + return 0; + } + if (a.compareDocumentPosition(b) & 4) { + return -1; + } + return 1; + } + + /** + * Filters an array of nodes to remove duplicates. + * @private + * @param {Array} nodes - The array of nodes. + * @returns {Array} A new array containing unique nodes. + */ + #unique(nodes) { + let i = 0; + let j = -1; + let l = nodes.length + 1; + const list = []; + while (--l) { + if (nodes[i++] === nodes[i]) { + continue; + } + list[++j] = nodes[i - 1]; + } + this.hasDupes = false; + return list; + } + + /** + * Retrieve elements by ID through an iterative tree walk. + * Ensures all elements with duplicate IDs are found. + * @param {string} id - The ID to search for. + * @param {Element|Document} context - The base element or document. + * @returns {Array} The list of matching elements. + */ + byId(id, context) { + const nodes = []; + const all = context.getElementsByTagName('*'); + for (const element of all) { + if (element.id === id) { + nodes.push(element); + } + } + return nodes; + } + + /** + * Context-agnostic implementation of `getElementsByTagName`. + * @param {string} tag - The tag name to search for. + * @param {Element|Document|DocumentFragment} context - The scope. + * @returns {Array} An array of matched elements. + */ + byTag(tag, context) { + const api = METHOD['*']; + if (api in context) { + const collection = context[api](tag); + const len = collection.length; + const arr = new Array(len); + for (let i = 0; i < len; i++) { + arr[i] = collection[i]; + } + return arr; + } + const nodes = []; + const lowerTag = tag.toLowerCase(); + let e = context.firstElementChild; + while (e) { + if (tag === '*' || e.localName === lowerTag) { + nodes.push(e); + } + const children = e[api](tag); + for (const child of children) { + nodes.push(child); + } + e = e.nextElementSibling; + } + return nodes; + } + + /** + * Context-agnostic implementation of `getElementsByClassName`. + * @param {string} cls - The class name to search for. + * @param {Element|Document|DocumentFragment} context - The scope context. + * @returns {Array} An array of matched elements. + */ + byClass(cls, context) { + const api = METHOD['.']; + if (api in context) { + const collection = context[api](cls); + const len = collection.length; + const arr = new Array(len); + for (let i = 0; i < len; i++) { + arr[i] = collection[i]; + } + return arr; + } + return []; + } + + /** + * Centralized error handler. + * @private + * @param {string} message - The error message to emit. + * @param {string} proto - The exception prototype type name. + * @throws {Error|DOMException} Will always throw to guarantee fallback routing. + */ + #emit(message, proto) { + if (proto === 'TypeError') { + throw new this.#window.TypeError(message); + } else { + throw new this.#window.DOMException(message, 'SyntaxError'); + } + } + + /** + * Swaps the the underlying document context for parsing and resolving nodes. + * @private + * @param {Element|Document} context - The new context element or document. + * @param {boolean} [force] - Forces re-initialization of contextual flags. + * @returns {Element|Document} The applied context object. + */ + #switchContext(context, force) { + const oldDoc = this.#document; + this.#document = context.ownerDocument || context; + if (force || oldDoc !== this.#document) { + this.#htmlDoc = isHTML(this.#document); + this.#quirksMode = + this.#htmlDoc && this.#document.compatMode.indexOf('CSS') < 0; + } + return context; + } + + /** + * Transforms a selector string sequence into a javascript string. + * @param {string} expression - The unparsed selector sequence expression. + * @param {string} source - The initial source string macro logic to compound. + * @param {boolean} mode - Selectively evaluates caching string derivations between matched and selected calls. + * @returns {string} The final compiled block of javascript mapping logic string. + */ + compileSelector(expression, source, mode) { + let selector = expression.replace(REX.combinator, '$1'); + const selectorString = mode ? this.#lastSelected : this.#lastMatched; + while (selector) { + const symbol = selector[0]; + switch (symbol) { + case '*': { + ({ source, selector } = this.compileUniversal(selector, source)); + break; + } + case '#': { + ({ source, selector } = this.compileId(selector, source)); + break; + } + case '.': { + ({ source, selector } = this.compileClass(selector, source)); + break; + } + case '[': { + ({ source, selector } = this.compileAttribute(selector, source)); + break; + } + case '~': + case '+': + case '\x09': + case '\x20': + case '>': { + ({ source, selector } = this.compileCombinator( + symbol, + selector, + source + )); + break; + } + case ':': { + ({ source, selector } = this.compilePseudo( + selector, + source, + selectorString + )); + break; + } + default: { + if (/[_a-z]/i.test(symbol)) { + ({ source, selector } = this.compileTag(selector, source)); + } else { + this.#emit(`'${selectorString}'${SEL_INVALID}`); + } + break; + } + } + } + return source; + } + + /** + * Compiles universal selector. + * @param {string} selector - The unparsed selector string sequence. + * @param {string} source - The compiled source string wrapper. + * @returns {{source: string, selector: string}} The new modified sequence object representation. + */ + compileUniversal(selector, source) { + const match = selector.match(Nwsapi.#patterns.universal); + return { source, selector: match.pop() }; + } + + /** + * Compiles id targeting selector. + * @param {string} selector - The unparsed selector string sequence. + * @param {string} source - The compiled source string wrapper. + * @returns {{source: string, selector: string}} The new modified sequence object representation. + */ + compileId(selector, source) { + const match = selector.match(Nwsapi.#patterns.id); + return { + source: `if(/^${match[1]}$/.test(e.getAttribute("id")??"")){${source}}`, + selector: match.pop() + }; + } + + /** + * Compiles class targeting selector. + * @param {string} selector - The unparsed selector string sequence. + * @param {string} source - The compiled source string wrapper. + * @returns {{source: string, selector: string}} The new modified sequence object representation. + */ + compileClass(selector, source) { + const match = selector.match(Nwsapi.#patterns.className); + const compatLocal = this.#quirksMode ? 'i' : ''; + return { + source: `if(/(^|\\s)${match[1]}(\\s|$)/${compatLocal}.test(e.getAttribute("class")??"")){${source}}`, + selector: match.pop() + }; + } + + /** + * Compiles tag name targeted selector. + * @param {string} selector - The unparsed selector string sequence. + * @param {string} source - The compiled source string wrapper. + * @returns {{source: string, selector: string}} The new modified sequence object representation. + */ + compileTag(selector, source) { + const match = selector.match(Nwsapi.#patterns.tagName); + const tagCompare = match[1].toLowerCase(); + return { + source: `if(e.localName==="${tagCompare}"){${source}}`, + selector: match.pop() + }; + } + + /** + * Compiles attribute targeting selector expression. + * @param {string} selector - The unparsed selector string sequence. + * @param {string} source - The compiled source string wrapper. + * @returns {{source: string, selector: string}} The new modified sequence object representation. + */ + compileAttribute(selector, source) { + const match = selector.match(Nwsapi.#patterns.attribute); + const name = match[1]; + let expr = name.split(':'); + expr = expr.length === 2 ? expr[1] : expr[0]; + let test; + if (match[2]) { + test = OPERATORS[match[2]]; + } + if (match[4] === '') { + if (match[2] === '~=') { + test = { p1: '^\\s', p2: '+$', p3: 'true' }; + } else if (match[2] in ATTR_STD_OPS && match[2] !== '~=') { + test = { p1: '^', p2: '$', p3: 'true' }; + } + } else { + if (match[2] === '~=' && match[4].includes(' ')) { + return { source: `if(false){${source}}`, selector: match.pop() }; + } else if (match[4]) { + match[4] = match[4].replace(REX.regExpChar, '\\$&'); + } + } + const type = + match[5] === 'i' || (this.#htmlDoc && HTML_TABLE[expr.toLowerCase()]) + ? 'i' + : ''; + let attrCheck = ''; + if (!match[2]) { + attrCheck = `e.hasAttribute&&e.hasAttribute("${name}")`; + } else if (!match[4] && ATTR_STD_OPS[match[2]] && match[2] !== '~=') { + attrCheck = `e.getAttribute&&e.getAttribute("${name}")===""`; + } else { + attrCheck = `(/${test.p1}${match[4]}${test.p2}/${type}).test(e.getAttribute&&e.getAttribute("${name}"))===${test.p3}`; + } + return { + source: `if(${attrCheck}){${source}}`, + selector: match.pop() + }; + } + + /** + * Compiles relationship structural combinators. + * @param {string} symbol - The symbol mapping target connection logic. + * @param {string} selector - The unparsed selector string sequence. + * @param {string} source - The compiled source string wrapper. + * @returns {{source: string, selector: string}} The new modified sequence object representation. + */ + compileCombinator(symbol, selector, source) { + let match; + if (symbol === '~') { + match = selector.match(Nwsapi.#patterns.relative); + source = `n=e;while((e=e.previousElementSibling)){${source}}e=n;`; + } else if (symbol === '+') { + match = selector.match(Nwsapi.#patterns.adjacent); + source = `n=e;if((e=e.previousElementSibling)){${source}}e=n;`; + } else if (symbol === '\x09' || symbol === '\x20') { + match = selector.match(Nwsapi.#patterns.ancestor); + source = `n=e;while((e=e.parentElement)){${source}}e=n;`; + } else if (symbol === '>') { + match = selector.match(Nwsapi.#patterns.children); + source = `n=e;if((e=e.parentElement)){${source}}e=n;`; + } + return { source, selector: match.pop() }; + } + + /** + * Routes resolving pseudo-classes toward corresponding logic functions. + * @param {string} selector - The unparsed selector string sequence. + * @param {string} source - The compiled source string wrapper. + * @param {string} selectorString - Original string block utilized within error output. + * @returns {{source: string, selector: string}} The new modified sequence object representation. + */ + compilePseudo(selector, source, selectorString) { + let match; + if ((match = selector.match(Nwsapi.#patterns.structural))) { + source = this.compilePseudoStructural(match, source); + } else if ((match = selector.match(Nwsapi.#patterns.treestruct))) { + source = this.compilePseudoTreeStruct(match, source, selectorString); + } else if ((match = selector.match(Nwsapi.#patterns.logicalsel))) { + source = this.compilePseudoLogical(match, source); + } else if ((match = selector.match(Nwsapi.#patterns.locationpc))) { + source = this.compilePseudoLocation(match, source); + } else if ((match = selector.match(Nwsapi.#patterns.inputstate))) { + source = this.compilePseudoInputState(match, source); + } else if ((match = selector.match(Nwsapi.#patterns.inputvalue))) { + source = this.compilePseudoInputValue(match, source); + } else { + this.#emit(`unknown pseudo-class selector '${selector}'`); + } + return { source, selector: match.pop() }; + } + + /** + * Compiles simple structural pseudo-class selectors. + * @param {Array} match - Group matched properties extracted from regex processing. + * @param {string} source - The parent compiled mapping logic sequence base to interlock with. + * @returns {string} The executed source output constraint. + */ + compilePseudoStructural(match, source) { + const pseudoName = match[1].toLowerCase(); + switch (pseudoName) { + case 'empty': { + return `n=e.firstChild;while(n&&!(/1|3/).test(n.nodeType)){n=n.nextSibling}if(!n){${source}}`; + } + case 'only-child': { + return `if(!e.nextElementSibling&&!e.previousElementSibling){${source}}`; + } + case 'last-child': { + return `if(!e.nextElementSibling){${source}}`; + } + case 'first-child': { + return `if(!e.previousElementSibling){${source}}`; + } + case 'only-of-type': { + return `o=e.localName;n=e;while((n=n.nextElementSibling)&&n.localName!==o);if(!n){n=e;while((n=n.previousElementSibling)&&n.localName!==o);}if(!n){${source}}`; + } + case 'last-of-type': { + return `n=e;o=e.localName;while((n=n.nextElementSibling)&&n.localName!==o);if(!n){${source}}`; + } + case 'first-of-type': { + return `n=e;o=e.localName;while((n=n.previousElementSibling)&&n.localName!==o);if(!n){${source}}`; + } + default: { + return source; + } + } + } + + /** + * Compiles targeted complex iteration pseudo classes. + * @param {Array} match - Group matched properties extracted from regex processing. + * @param {string} source - The parent compiled mapping logic sequence base to interlock with. + * @param {string} selectorString - Original string block utilized within error output. + * @returns {string} The computed logic operation function snippet string. + */ + compilePseudoTreeStruct(match, source, selectorString) { + const pseudoName = match[1] ? match[1].toLowerCase() : ''; + const formula = match[2]; + if (!pseudoName || !formula) { + this.#emit(`'${selectorString}'${SEL_INVALID}`); + return source; + } + const exprBool = /-of-type/i.test(pseudoName); + const typeBool = /last/i.test(pseudoName); + let test = ''; + if (formula === 'n') { + return `if(true){${source}}`; + } + if (formula === '1') { + const testDir = typeBool ? 'next' : 'previous'; + if (exprBool) { + return `n=e;o=e.localName;while((n=n.${testDir}ElementSibling)&&n.localName!==o);if(!n){${source}}`; + } + return `if(!e.${testDir}ElementSibling){${source}}`; + } + if ( + formula === 'even' || + formula === '2n0' || + formula === '2n+0' || + formula === '2n' + ) { + test = 'n%2===0'; + } else if (formula === 'odd' || formula === '2n1' || formula === '2n+1') { + test = 'n%2===1'; + } else { + const hasN = /n/i.test(formula); + const nParts = formula.split('n'); + let a = parseInt(nParts[0], 10) || 0; + const b = parseInt(nParts[1], 10) || 0; + if (nParts[0] === '-') { + a = -1; + } + if (nParts[0] === '' || nParts[0] === '+') { + a = 1; + } + let nTerm = 'n'; + if (b) { + const sign = b > 0 ? '-' : '+'; + nTerm = `(n${sign}${Math.abs(b)})`; + } + test = `${nTerm}%${a}===0`; + if (a >= 1) { + if (hasN) { + const extra = Math.abs(a) !== 1 ? `&&${test}` : ''; + test = `n>${b - 1}${extra}`; + } else { + test = `n===${a}`; + } + } else if (a <= -1) { + const extra = Math.abs(a) !== 1 ? `&&${test}` : ''; + test = `n<${b + 1}${extra}`; + } else if (a === 0) { + test = `n===${b}`; + } + } + const exprStr = exprBool ? 'OfType' : 'Element'; + const typeStr = typeBool ? 'true' : 'false'; + return `n=s.nth${exprStr}(e,${typeStr});if(${test}){${source}}`; + } + + /** + * Compiles dynamic query processing targeting internal pseudo matching loops. + * @param {Array} match - Group matched properties extracted from regex processing. + * @param {string} source - The parent compiled mapping logic sequence base to interlock with. + * @returns {string} String wrapper resolving the specified matched logic loop blocks. + */ + compilePseudoLogical(match, source) { + const pseudoName = match[1].toLowerCase(); + const expr = match[2] + .replace(REX.commaGroup, ',') + .replace(REX.trimSpaces, ''); + if (pseudoName === 'is' || pseudoName === 'not') { + const subExprs = expr.match(REX.splitGroup) || [expr]; + const uid = ++this.#uidCounter; + const label = `l_${uid}`; + let code = `{ let r_${uid}=false, e_${uid}=e, n_${uid}=n, o_${uid}=o; ${label}: { `; + for (const subExpr of subExprs) { + const subCode = this.compileSelector( + subExpr, + `r_${uid}=true; break ${label};`, + false + ); + code += `{ ${subCode} } e=e_${uid}; n=n_${uid}; o=o_${uid}; `; + } + code += `} e=e_${uid}; n=n_${uid}; o=o_${uid}; `; + if (pseudoName === 'is') { + return `${code} if(r_${uid}){${source}} }`; + } else { + return `${code} if(!r_${uid}){${source}} }`; + } + } else if (pseudoName === 'has') { + const escapedExpr = expr.replace(/\\/g, '\\\\').replace(/\x22/g, '\\"'); + this.#matchResolvers.clear(); + return `if(e.querySelector(":scope ${escapedExpr}")){${source}}`; + } + return source; + } + + /** + * Resolves structural specific location evaluation parsing queries. + * @param {Array} match - Group matched properties extracted from regex processing. + * @param {string} source - The parent compiled mapping logic sequence base to interlock with. + * @returns {string} Processed function execution evaluation snippet structure string. + */ + compilePseudoLocation(match, source) { + const pseudoName = match[1].toLowerCase(); + if (pseudoName === 'any-link' || pseudoName === 'link') { + return `if(/^a|area$/i.test(e.localName)&&e.hasAttribute("href")){${source}}`; + } else if (pseudoName === 'target') { + return `if(s.isTarget(e)){${source}}`; + } + return source; + } + + /** + * Compiles input elements pseudo constraints analyzing read-only attributes. + * @param {Array} match - Group matched properties extracted from regex processing. + * @param {string} source - The parent compiled mapping logic sequence base to interlock with. + * @returns {string} Evaluated conditional logic block processing sequence input evaluation constraints string. + */ + compilePseudoInputState(match, source) { + const pseudoName = match[1].toLowerCase(); + if (pseudoName === 'read-only') { + return `if((/^textarea$/i.test(e.localName)&&(e.readOnly||e.disabled))||(/^input$/i.test(e.localName)&&("|date|datetime-local|email|month|number|password|search|tel|text|time|url|week|".includes("|"+e.type+"|")?(e.readOnly||e.disabled):true))||(!/^(?:input|textarea)$/i.test(e.localName) && !s.isContentEditable(e))){${source}}`; + } else if (pseudoName === 'read-write') { + return `if((/^textarea$/i.test(e.localName)&&!e.readOnly&&!e.disabled)||(/^input$/i.test(e.localName)&&"|date|datetime-local|email|month|number|password|search|tel|text|time|url|week|".includes("|"+e.type+"|")&&!e.readOnly&&!e.disabled)||(!/^(?:input|textarea)$/i.test(e.localName) && s.isContentEditable(e))){${source}}`; + } + return source; + } + + /** + * Validates elements form states resolving input evaluation context. + * @param {Array} match - Group matched properties extracted from regex processing. + * @param {string} source - The parent compiled mapping logic sequence base to interlock with. + * @returns {string} Function context execution constraint wrapper processing mapping condition validations. + */ + compilePseudoInputValue(match, source) { + const pseudoName = match[1].toLowerCase(); + if (pseudoName === 'checked') { + return `if((/^input$/i.test(e.localName)&&("|radio|checkbox|".includes("|"+e.type+"|")&&e.checked)||(/^option$/i.test(e.localName)&&(e.selected||e.checked)))){${source}}`; + } else if (pseudoName === 'indeterminate') { + return `if(s.isIndeterminate(e)){${source}}`; + } + return source; + } + + /** + * Checks and fetches lambdas from GenerationalCache, compiling closures. + * @param {string} selector - The CSS selector string. + * @param {boolean} mode - Mode specifying lambda output behavior (true: select, false: match). + * @returns {ResolverFactory} The generated executable selector processing function. + */ + compile(selector, mode) { + let head = ''; + let loop = ''; + let macro = ''; + let source = ''; + let cached; + if (mode) { + cached = this.#selectLambdas.get(selector); + if (cached !== undefined) { + return cached; + } + head = S_HEAD; + macro = S_BODY + S_TAIL; + loop = S_LOOP; + } else { + cached = this.#matchLambdas.get(selector); + if (cached !== undefined) { + return cached; + } + head = M_HEAD; + macro = M_BODY + M_TAIL; + loop = M_LOOP; + } + source = this.compileSelector(selector, macro, mode); + if (mode) { + loop += '{' + source + '}'; + } else { + loop += source; + } + if (mode && selector.includes(':nth')) { + if (REX.nthElement.test(selector)) { + loop += 's.nthElement(null, 2);'; + } + if (REX.nthOfType.test(selector)) { + loop += 's.nthOfType(null, 2);'; + } + } + const factory = Function( + 's', + F_INIT + '{' + head + ';' + loop + 'return r;}' + )(this.#snapshot); + if (mode) { + this.#selectLambdas.set(selector, factory); + } else { + this.#matchLambdas.set(selector, factory); + } + return factory; + } + + /** + * Centralized collector pipeline constructing combined resolvers. + * @param {Array} selectors - The comma-split groups of selector patterns. + * @param {Element|Document} context - The context object to query from. + * @param {((element: Element) => boolean | void)=} callback - Function to be applied over returned nodes. + * @returns {object} An object containing the mapped arrays of resolvers and results. + */ + collect(selectors, context, callback) { + let i, l, type; + const seen = Object.create(null); + let token = ['', '*', '*']; + const optimized = selectors; + const factory = []; + const htmlset = []; + const nodeset = []; + let results = []; + for (i = 0, l = selectors.length; l > i; ++i) { + if (!seen[selectors[i]]) { + seen[selectors[i]] = true; + type = selectors[i].match(Nwsapi.#reOptimizer); + if (type && type[1] !== ':') { + token = type; + if (!token[1]) { + token[1] = '*'; + } + optimized[i] = optimize(optimized[i], token); + } else { + token = ['', '*', '*']; + } + } + nodeset[i] = token[1] + token[2]; + htmlset[i] = this.#compat[token[1]](context, token[2]); + factory[i] = this.compile(optimized[i], true); + factory[i](htmlset[i](), callback, context, results); + } + if (l > 1) { + results.sort(this.#boundDocumentOrder); + if (this.hasDupes) { + results = this.#unique(results); + } + } + return { callback, context, factory, htmlset, nodeset, results }; + } + + /** + * Creates mapping pipelines directly collecting matching lambdas. + * @private + * @param {Array} selectors - The comma-split groups of selector patterns. + * @returns {object} Object encapsulating generated lambda constraints. + */ + #matchCollect(selectors) { + return { + factory: selectors.map(selector => { + return this.compile(selector, false); + }) + }; + } + + /** + * Normalizes the selector string and returns an array of expressions. + * @private + * @param {string} selectors - The target CSS selector string to process. + * @returns {Array} An array of selector expressions split by commas. + */ + #parseSelector(selectors) { + const rawSelectors = + typeof selectors !== 'string' ? String(selectors) : selectors; + const parsed = rawSelectors + .replace(/\0|\\$/g, '\ufffd') + .replace(REX.combineWSP, '\x20') + .replace(REX.pseudosWSP, '$1') + .replace(REX.tabCharWSP, '\t') + .replace(REX.commaGroup, ',') + .replace(REX.trimSpaces, ''); + let expressions = parsed.match(Nwsapi.#reValidator); + if (!expressions || expressions.join('') !== parsed) { + this.#emit(`'${rawSelectors}'${SEL_INVALID}`); + } else { + expressions = parsed.match(REX.splitGroup); + if (parsed.at(-1) === ',') { + this.#emit(`'${rawSelectors}'${SEL_INVALID}`); + } + } + return expressions; + } + + /** + * Validates whether an element complies strictly with the selector condition. + * @param {string} selectors - The CSS selector condition input. + * @param {Element} element - The single element attempting matching. + * @param {((element: Element) => boolean | void)=} callback - A callback evaluated on success. + * @returns {boolean} Return true if matched else false. + */ + match(selectors, element, callback) { + if (selectors === undefined) { + this.#emit(NOT_ENOUGH_ARGS, 'TypeError'); + } + if (selectors === '') { + this.#emit(`''${SEL_INVALID}`); + } + const cachedResolver = this.#matchResolvers.get(selectors); + if (element && !/:has\(/.test(selectors) && cachedResolver !== undefined) { + return matchAssert(cachedResolver.factory, element, callback); + } + this.#lastMatched = selectors; + const expressions = this.#parseSelector(selectors); + const newResolver = this.#matchCollect(expressions); + this.#matchResolvers.set(selectors, newResolver); + return matchAssert(newResolver.factory, element, callback); + } + + /** + * Searches upwards finding the nearest element evaluating to the selector. + * @param {string} selectors - The CSS target rule lookup. + * @param {Element} element - The start baseline tracking backwards. + * @param {((element: Element) => boolean | void)=} callback - An optional callback evaluated securely upon a hit. + * @returns {Element|null} The nearest matched element instance or `null` if terminating unfulfilled. + */ + closest(selectors, element, callback) { + while (element) { + if (this.match(selectors, element, callback)) { + break; + } + element = element.parentElement; + } + return element; + } + + /** + * Collects a structural list of every single matching child element. + * @param {string} selectors - Extensible compound selector queries targeting DOM layouts. + * @param {Element|Document} context - Root tree execution base. + * @param {((element: Element) => boolean | void)=} callback - Iterative injection applied conditionally. + * @returns {Array} Collection representing matching elements inside the root boundary. + */ + select(selectors, context, callback) { + if (selectors === undefined) { + this.#emit(NOT_ENOUGH_ARGS, 'TypeError'); + } + if (selectors === '') { + this.#emit(`''${SEL_INVALID}`); + } + if (!context) { + context = this.#document; + } + if (this.#lastContext !== context) { + this.#lastContext = this.#switchContext(context); + } + let nodes = []; + const resolver = this.#selectResolvers.get(selectors); + if (resolver !== undefined) { + if (resolver.context === context && resolver.callback === callback) { + const f = resolver.factory; + const h = resolver.htmlset; + const n = resolver.nodeset; + if (n.length > 1) { + const l = n.length; + for (let i = 0; i < l; ++i) { + const list = this.#compat[n[i][0]](context, n[i].slice(1))(); + f[i](list, callback, context, nodes); + } + if (l > 1 && nodes.length > 1) { + nodes.sort(this.#boundDocumentOrder); + if (this.hasDupes) { + nodes = this.#unique(nodes); + } + } + } else { + nodes = f[0](h[0](), callback, context, nodes); + } + if (typeof callback === 'function') { + return concatCall(nodes, callback); + } + return nodes; + } + } + this.#lastSelected = selectors; + const expressions = this.#parseSelector(selectors); + const newResolver = this.collect(expressions, context, callback); + this.#selectResolvers.set(selectors, newResolver); + nodes = newResolver.results; + if (typeof callback === 'function') { + return concatCall(nodes, callback); + } + return nodes; + } + + /** + * Returns the first matching element within the `select()` method. + * @param {string} selectors - Standard string format selector queries targeting the document tree. + * @param {Element|Document} context - Element evaluation starting scope block. + * @param {((element: Element) => boolean | void)=} callback - Conditionally executes mapping on retrieval. + * @returns {Element|null} Single element mapping success or `null`. + */ + first(selectors, context, callback) { + if (selectors === '') { + this.#emit(`''${SEL_INVALID}`); + } + if (!context) { + context = this.#document; + } + const localCallback = + typeof callback === 'function' + ? element => { + callback(element); + return false; + } + : () => { + return false; + }; + const result = this.select(selectors, context, localCallback); + if (result[0]) { + return result[0]; + } + return null; + } + + /** + * Clears internal caches and state. + * @param {boolean} [clearAll] - Whether to clear all caches. + */ + clear(clearAll = false) { + if (clearAll) { + this.#matchLambdas.clear(); + this.#selectLambdas.clear(); + this.#matchResolvers.clear(); + this.#selectResolvers.clear(); + } + this.#snapshot.nthElement(null, 2); + this.#snapshot.nthOfType(null, 2); + } +} diff --git a/node_modules/@asamuzakjp/dom-selector/src/js/parser.js b/node_modules/@asamuzakjp/dom-selector/src/js/parser.js new file mode 100644 index 0000000..7a66884 --- /dev/null +++ b/node_modules/@asamuzakjp/dom-selector/src/js/parser.js @@ -0,0 +1,511 @@ +/** + * parser.js + */ + +/* import */ +import cssTreeParse from 'css-tree/selector-parser'; +import cssTreeWalk from 'css-tree/walker'; +import cssTreeConvertor from 'css-tree/convertor'; +import { clone as cssTreeClone } from 'css-tree/utils'; +import cssTreeGenerate from 'css-tree/generator'; +import { stringifyValue } from './utility.js'; + +/* constants */ +import { + ATTR_SELECTOR, + BIT_01, + BIT_02, + BIT_04, + BIT_08, + BIT_16, + BIT_32, + BIT_FFFF, + CLASS_SELECTOR, + COMBINATOR, + DUO, + HEX, + ID_SELECTOR, + KEYS_LOGICAL, + KEYS_PS_CLASS_SUPPORTED, + NEST_SELECTOR, + NTH, + PS_CLASS_SELECTOR, + PS_ELEMENT_SELECTOR, + SELECTOR, + SYNTAX_ERR, + TYPE_SELECTOR +} from './constant.js'; +const AST_SORT_ORDER = new Map([ + [PS_ELEMENT_SELECTOR, BIT_01], + [ID_SELECTOR, BIT_02], + [CLASS_SELECTOR, BIT_04], + [TYPE_SELECTOR, BIT_08], + [ATTR_SELECTOR, BIT_16], + [PS_CLASS_SELECTOR, BIT_32] +]); +const KEYS_PS_NTH = new Set([ + 'first-child', + 'first-of-type', + 'last-child', + 'last-of-type', + 'only-child', + 'only-of-type' +]); +const KEYS_PS_CLASS_STATE = new Set([ + 'checked', + 'closed', + 'disabled', + 'empty', + 'enabled', + 'in-range', + 'indeterminate', + 'invalid', + 'open', + 'out-of-range', + 'placeholder-shown', + 'read-only', + 'read-write', + 'valid', + ...KEYS_PS_NTH +]); +const KEYS_SHADOW_HOST = new Set(['host', 'host-context']); +const U_FFFD = '\uFFFD'; + +/* regexp */ +const REG_EMPTY_PS_FUNC = + /(?<=:(?:dir|has|host(?:-context)?|is|lang|not|nth-(?:last-)?(?:child|of-type)|where))\(\s+\)/g; +const REG_SHADOW_PS_ELEMENT = /^part|slotted$/; + +/** + * Unescapes a CSS selector string. + * @param {string} [selector] - The CSS selector to unescape. + * @returns {string} The unescaped selector string. + */ +export const unescapeSelector = (selector = '') => { + if (typeof selector === 'string' && selector.indexOf('\\', 0) >= 0) { + const arr = selector.split('\\'); + const selectorItems = [arr[0]]; + const l = arr.length; + for (let i = 1; i < l; i++) { + const item = arr[i]; + if (item === '' && i === l - 1) { + selectorItems.push(U_FFFD); + } else if (item === '') { + // Empty segment at non-last position means \\ (escaped backslash) + selectorItems.push('\\'); + // skip the next segment which is the remainder after \\ + i++; + if (i < l) { + selectorItems.push(arr[i]); + } + } else { + const hexExists = /^([\da-f]{1,6}\s?)/i.exec(item); + if (hexExists) { + const [, hex] = hexExists; + let str; + try { + const low = parseInt('D800', HEX); + const high = parseInt('DFFF', HEX); + const deci = parseInt(hex, HEX); + if (deci === 0 || (deci >= low && deci <= high)) { + str = U_FFFD; + } else { + str = String.fromCodePoint(deci); + } + } catch (e) { + str = U_FFFD; + } + let postStr = ''; + if (item.length > hex.length) { + postStr = item.substring(hex.length); + } + selectorItems.push(`${str}${postStr}`); + } else if (/^[\n\r\f]/.test(item)) { + // whitespace + selectorItems.push(`\\${item}`); + } else { + selectorItems.push(item); + } + } + } + return selectorItems.join(''); + } + return selector; +}; + +/** + * Preprocesses a selector string according to the specification. + * @see https://drafts.csswg.org/css-syntax-3/#input-preprocessing + * @param {string} value - The value to preprocess. + * @returns {string} The preprocessed selector string. + */ +export const preprocess = value => { + let selector = stringifyValue(value); + let index = 0; + while (index >= 0) { + // @see https://drafts.csswg.org/selectors/#id-selectors + index = selector.indexOf('#', index); + if (index < 0) { + break; + } + const preHash = selector.substring(0, index + 1); + let postHash = selector.substring(index + 1); + const codePoint = postHash.codePointAt(0); + if (codePoint > BIT_FFFF) { + const str = `\\${codePoint.toString(HEX)} `; + if (postHash.length === DUO) { + postHash = str; + } else { + postHash = `${str}${postHash.substring(DUO)}`; + } + } + selector = `${preHash}${postHash}`; + index++; + } + selector = selector + .replace(/\f|\r\n?/g, '\n') + .replace(/[\0\uD800-\uDFFF]|\\$/g, U_FFFD); + if (selector === '&') { + return ''; + } + return selector; +}; + +/** + * Creates an Abstract Syntax Tree (AST) from a CSS selector string. + * @param {string} sel - The CSS selector string. + * @param {string} [context] - Parse what part of CSS. + * @returns {import('css-tree').CssNode} The parsed AST object. + */ +export const parseSelector = (sel, context = 'selectorList') => { + const selector = preprocess(sel); + // invalid selectors + if (/^$|^\s*>|,\s*$/.test(selector)) { + throw new DOMException(`Invalid selector ${selector}`, SYNTAX_ERR); + } + try { + return cssTreeParse(selector, { context }); + } catch (e) { + const { message } = e; + if ( + /^(?:"\]"|Attribute selector [()\s,=~^$*|]+) is expected$/.test( + message + ) && + !selector.endsWith(']') + ) { + const index = selector.lastIndexOf('['); + const selPart = selector.substring(index); + if (selPart.includes('"')) { + const quotes = selPart.match(/"/g).length; + if (quotes % 2) { + return parseSelector(`${selector}"]`); + } + return parseSelector(`${selector}]`); + } + return parseSelector(`${selector}]`); + } else if (message === '")" is expected') { + // workaround for https://github.com/csstree/csstree/issues/283 + if (REG_EMPTY_PS_FUNC.test(selector)) { + return parseSelector(`${selector.replaceAll(REG_EMPTY_PS_FUNC, '()')}`); + } else if (!selector.endsWith(')')) { + return parseSelector(`${selector})`); + } else { + throw new DOMException(`Invalid selector ${selector}`, SYNTAX_ERR); + } + } else { + throw new DOMException(`Invalid selector ${selector}`, SYNTAX_ERR); + } + } +}; + +/** + * Walks the provided AST to collect selector branches and gather information + * about its contents. + * @param {import('css-tree').CssNode} [ast] - The AST to traverse. + * @param {boolean} [toObject] - True if converts ast to object. + * @param {(node: import('css-tree').CssNode) => void} [callback] - Optional callback for each node. + * @returns {{branches: Array>, info: object}} An object containing the selector branches and info. + */ +export const walkAST = (ast = {}, toObject = false, callback = null) => { + const branches = new Set(); + const info = { + hasForgivenPseudoFunc: false, + hasHasPseudoFunc: false, + hasLogicalPseudoFunc: false, + hasNestedSelector: false, + hasNestingSelector: false, + hasNotPseudoFunc: false, + hasNthChildOfSelector: false, + hasSiblingCombinator: false, + hasStatePseudoClass: false, + hasUnsupportedPseudoClass: false + }; + const opt = { + enter(node) { + if (typeof callback === 'function') { + callback(node); + } + switch (node.type) { + case CLASS_SELECTOR: { + if (/^-?\d/.test(node.name)) { + throw new DOMException( + `Invalid selector .${node.name}`, + SYNTAX_ERR + ); + } + break; + } + case COMBINATOR: { + if (/^[+~]$/.test(node.name)) { + info.hasSiblingCombinator = true; + } + break; + } + case ID_SELECTOR: { + if (/^-?\d/.test(node.name)) { + throw new DOMException( + `Invalid selector #${node.name}`, + SYNTAX_ERR + ); + } + break; + } + case PS_CLASS_SELECTOR: { + const name = node.name.toLowerCase(); + if (KEYS_LOGICAL.has(name)) { + info.hasNestedSelector = true; + info.hasLogicalPseudoFunc = true; + if (name === 'has') { + info.hasHasPseudoFunc = true; + } else if (name === 'not') { + info.hasNotPseudoFunc = true; + } else { + info.hasForgivenPseudoFunc = true; + } + } else if (KEYS_PS_CLASS_STATE.has(name)) { + info.hasStatePseudoClass = true; + } else if ( + KEYS_SHADOW_HOST.has(name) && + Array.isArray(node.children) && + node.children.length + ) { + info.hasNestedSelector = true; + } else if (!KEYS_PS_CLASS_SUPPORTED.has(name)) { + info.hasUnsupportedPseudoClass = true; + } + break; + } + case PS_ELEMENT_SELECTOR: { + if (REG_SHADOW_PS_ELEMENT.test(node.name)) { + info.hasNestedSelector = true; + } + break; + } + case NEST_SELECTOR: { + info.hasNestingSelector = true; + break; + } + case NTH: { + if (node.selector) { + info.hasNestedSelector = true; + info.hasNthChildOfSelector = true; + } + break; + } + case SELECTOR: { + branches.add(node.children); + break; + } + default: + } + } + }; + const clonedAst = cssTreeClone(ast); + cssTreeWalk( + toObject ? cssTreeConvertor.toPlainObject(clonedAst) : clonedAst, + opt + ); + if (info.hasNestedSelector === true) { + cssTreeWalk.findAll(clonedAst, (node, item, list) => { + if (list) { + if (node.type === PS_CLASS_SELECTOR && KEYS_LOGICAL.has(node.name)) { + const itemList = list.filter(i => { + const { name, type } = i; + return type === PS_CLASS_SELECTOR && KEYS_LOGICAL.has(name); + }); + for (const { children } of itemList) { + // SelectorList + for (const { children: grandChildren } of children) { + // Selector + for (const { children: greatGrandChildren } of grandChildren) { + if (branches.has(greatGrandChildren)) { + branches.delete(greatGrandChildren); + } + } + } + } + } else if ( + node.type === PS_CLASS_SELECTOR && + KEYS_SHADOW_HOST.has(node.name) && + Array.isArray(node.children) && + node.children.length + ) { + const itemList = list.filter(i => { + const { children, name, type } = i; + return ( + type === PS_CLASS_SELECTOR && + KEYS_SHADOW_HOST.has(name) && + Array.isArray(children) && + children.length + ); + }); + for (const { children } of itemList) { + // Selector + for (const { children: grandChildren } of children) { + if (branches.has(grandChildren)) { + branches.delete(grandChildren); + } + } + } + } else if ( + node.type === PS_ELEMENT_SELECTOR && + REG_SHADOW_PS_ELEMENT.test(node.name) + ) { + const itemList = list.filter(i => { + const { name, type } = i; + return ( + type === PS_ELEMENT_SELECTOR && REG_SHADOW_PS_ELEMENT.test(name) + ); + }); + for (const { children } of itemList) { + // Selector + for (const { children: grandChildren } of children) { + if (branches.has(grandChildren)) { + branches.delete(grandChildren); + } + } + } + } else if (node.type === NTH && node.selector) { + const itemList = list.filter(i => { + const { selector, type } = i; + return type === NTH && selector; + }); + for (const { selector } of itemList) { + const { children } = selector; + // Selector + for (const { children: grandChildren } of children) { + if (branches.has(grandChildren)) { + branches.delete(grandChildren); + } + } + } + } + } + }); + } + return { + info, + branches: [...branches] + }; +}; + +/** + * Comparison function for sorting AST nodes based on specificity. + * @param {import('css-tree').CssNode} a - The first AST node. + * @param {import('css-tree').CssNode} b - The second AST node. + * @returns {number} -1, 0 or 1, depending on the sort order. + */ +export const compareASTNodes = (a, b) => { + const bitA = AST_SORT_ORDER.get(a.type); + const bitB = AST_SORT_ORDER.get(b.type); + if (bitA === bitB) { + return 0; + } else if (bitA > bitB) { + return 1; + } else { + return -1; + } +}; + +/** + * Sorts a collection of AST nodes based on CSS specificity rules. + * @param {Array} asts - A collection of AST nodes to sort. + * @returns {Array} A new array containing the sorted AST nodes. + */ +export const sortAST = asts => { + const arr = [...asts]; + if (arr.length > 1) { + arr.sort(compareASTNodes); + } + return arr; +}; + +/** + * Parses a type selector's name, which may include a namespace prefix. + * @param {string} selector - The type selector name (e.g., 'ns|E' or 'E'). + * @returns {{prefix: string, localName: string}} An object with `prefix` and + * `localName` properties. + */ +export const parseAstName = selector => { + let prefix; + let localName; + if (selector && typeof selector === 'string') { + if (selector.indexOf('|') > -1) { + [prefix, localName] = selector.split('|'); + } else { + prefix = '*'; + localName = selector; + } + } else { + throw new DOMException(`Invalid selector ${selector}`, SYNTAX_ERR); + } + return { + prefix, + localName + }; +}; + +/** + * Extracts the rightmost subject keys (id, class, tag) from a CSS selector AST. + * @param {import('css-tree').CssNode} ast - The AST representation of the CSS selector. + * @returns {Array<{id: string|null, className: string|null, tag: string|null}>} The list of extracted keys for each selector group. + */ +export const extractSubjectsAst = ast => { + const subjects = []; + if (ast?.type === 'SelectorList') { + for (const selectorNode of ast.children) { + let idKey = null; + let classKey = null; + let tagKey = null; + let current = selectorNode.children.tail; + while (current) { + const node = current.data; + if (node.type === COMBINATOR) { + break; + } + if (node.type === ID_SELECTOR && idKey === null) { + idKey = unescapeSelector(node.name); + } else if (node.type === CLASS_SELECTOR && classKey === null) { + classKey = unescapeSelector(node.name); + } else if (node.type === TYPE_SELECTOR && tagKey === null) { + const { localName } = parseAstName(unescapeSelector(node.name)); + if (localName !== '*') { + tagKey = localName.toLowerCase(); + } + } + if (idKey !== null && classKey !== null && tagKey !== null) { + break; + } + current = current.prev; + } + subjects.push({ id: idKey, className: classKey, tag: tagKey }); + } + } + return subjects; +}; + +/* Re-exported from css-tree. */ +/** @type {typeof import('css-tree').find} */ +export const findAST = cssTreeWalk.find; +/** @type {typeof import('css-tree').generate} */ +export const generateCSS = cssTreeGenerate; diff --git a/node_modules/@asamuzakjp/dom-selector/src/js/processor.js b/node_modules/@asamuzakjp/dom-selector/src/js/processor.js new file mode 100644 index 0000000..0dab68d --- /dev/null +++ b/node_modules/@asamuzakjp/dom-selector/src/js/processor.js @@ -0,0 +1,100 @@ +/** + * processor.js + */ + +/* import */ +import { sortAST, unescapeSelector } from './parser.js'; +import { isInvalidCombinator } from './selector.js'; +import { generateException } from './utility.js'; + +/* constants */ +import { COMBINATOR, SYNTAX_ERR } from './constant.js'; + +/** + * @typedef {object} ProcessedBranch + * @property {import('css-tree').CssNode|null} combo - The combinator AST node. + * @property {Array} leaves - An array of AST leaf nodes. + */ + +/** + * @typedef {object} ProcessedASTNode + * @property {Array} branch - The processed selector branch. + * @property {string|null} dir - The traversal direction. + * @property {boolean} filtered - Indicates if the node is filtered. + * @property {boolean} find - Indicates if the match is found. + */ + +/** + * SelectorProcessor + * Processes raw selector branches into an internal AST format. + */ +export class SelectorProcessor { + #context; + + /** + * @param {import('./finder.js').Finder} context - The Finder instance. + */ + constructor(context) { + this.#context = context; + } + + /** + * Processes selector branches into the internal AST. + * @param {Array>} branches - The raw selector branches. + * @param {string} selector - The original CSS selector string. + * @returns {{ast: Array, descendant: boolean, invalidate?: boolean}} An object containing the ast, a descendant flag, and an optional invalidate flag. + */ + process(branches, selector) { + let descendant = false; + const ast = []; + for (const items of branches) { + const branch = []; + let prevType = null; + const itemsLen = items.length; + if (itemsLen) { + const leaves = new Set(); + for (let j = 0; j < itemsLen; j++) { + const item = items[j]; + const isLast = j === itemsLen - 1; + // Validate combinator syntax. + if (isInvalidCombinator(item.type, prevType, isLast)) { + const msg = `Invalid selector ${selector}`; + this.#context.onError( + generateException(msg, SYNTAX_ERR, this.#context.window) + ); + return { ast: [], descendant: false, invalidate: false }; + } + if (item.type === COMBINATOR) { + // Flag if the branch contains descendant or child combinators. + if (item.name === ' ' || item.name === '>') { + descendant = true; + } + branch.push({ combo: item, leaves: sortAST(leaves) }); + leaves.clear(); + } else { + // Unescape selector names and detect namespaces. + if (item.name && typeof item.name === 'string') { + const unescapedName = unescapeSelector(item.name); + if (unescapedName !== item.name) { + item.name = unescapedName; + } + if (/[|:]/.test(unescapedName)) { + item.namespace = true; + } + } + leaves.add(item); + } + prevType = item.type; + // Handle the trailing items after the loop finishes. + if (isLast) { + branch.push({ combo: null, leaves: sortAST(leaves) }); + leaves.clear(); + } + } + } + // Initialize the structure required for node collection. + ast.push({ branch, dir: null, filtered: false, find: false }); + } + return { ast, descendant }; + } +} diff --git a/node_modules/@asamuzakjp/dom-selector/src/js/pseudo-class.js b/node_modules/@asamuzakjp/dom-selector/src/js/pseudo-class.js new file mode 100644 index 0000000..34dca2e --- /dev/null +++ b/node_modules/@asamuzakjp/dom-selector/src/js/pseudo-class.js @@ -0,0 +1,1625 @@ +/** + * pseudo-class.js + */ + +import { + matchCheckedPseudoClass, + matchDirectionPseudoClass, + matchLanguagePseudoClass, + matchLinkPseudoClass, + matchOpenPseudoClass, + matchPlaceholderShownPseudoClass, + matchRangePseudoClass, + matchReadOnlyPseudoClass, + matchRequiredPseudoClass +} from './matcher.js'; +import { generateCSS, unescapeSelector, walkAST } from './parser.js'; +import { + canUseFastClassSearch, + canUseFastIdSearch, + canUseFastTagSearch, + findBestSeed, + generateException, + isCustomElement, + isFocusVisible, + isFocusableArea, + populateHasAllowlist, + traverseNode +} from './utility.js'; +import { + CLASS_SELECTOR, + COMBINATOR, + DIR_NEXT, + DIR_PREV, + DOCUMENT_FRAGMENT_NODE, + ELEMENT_NODE, + FORM_PARTS, + HEX, + ID_SELECTOR, + INPUT_CHECK, + INPUT_DATE, + INPUT_EDIT, + INPUT_TEXT, + KEYS_LOGICAL, + NOT_SUPPORTED_ERR, + PS_CLASS_SELECTOR, + SHOW_ALL, + SYNTAX_ERR, + TEXT_NODE, + TYPE_SELECTOR +} from './constant.js'; +const KEYS_FORM_PS_VALID = new Set(FORM_PARTS); +const KEYS_INPUT_CHECK = new Set(INPUT_CHECK); +const KEYS_INPUT_PLACEHOLDER = new Set([...INPUT_TEXT, 'number']); +const KEYS_INPUT_RANGE = new Set([...INPUT_DATE, 'number', 'range']); +const KEYS_INPUT_REQUIRED = new Set([...INPUT_CHECK, ...INPUT_EDIT, 'file']); +const KEYS_INPUT_RESET = new Set(['button', 'reset']); +const KEYS_INPUT_SUBMIT = new Set(['image', 'submit']); +const KEYS_FORM_PS_DISABLED = new Set([ + ...FORM_PARTS, + 'fieldset', + 'optgroup', + 'option' +]); +const KEYS_PS_NTH_OF_TYPE = new Set([ + 'first-of-type', + 'last-of-type', + 'only-of-type' +]); + +/** + * PseudoClassEvaluator + * Handles the evaluation of CSS pseudo-classes. + */ +export class PseudoClassEvaluator { + /* private fields */ + #evaluator; + #anbCache; + #astCache = new WeakMap(); + #documentURL; + #focusWithinCache; + #lastFocusVisible; + #nthIndexCache; + #psDefaultCache; + #psDirCache; + #psDisabledCache; + #psHasFilterCache; + #psIndeterminateCache; + #psLangCache; + #psValidCache; + #setPool = []; + #setPoolIndex = 0; + + /** + * @param {import('./evaluator.js').Evaluator} evaluator - The Evaluator instance. + */ + constructor(evaluator) { + this.#evaluator = evaluator; + } + + /** + * Clears cached evaluation results. + * @param {boolean} [all] - If true, clears all cached results. + * @returns {void} + */ + clearResults(all = false) { + this.#anbCache = null; + this.#focusWithinCache = null; + this.#psDefaultCache = null; + this.#psDirCache = null; + this.#psDisabledCache = null; + this.#psHasFilterCache = null; + this.#psIndeterminateCache = null; + this.#psLangCache = null; + this.#psValidCache = null; + } + + /** + * Resets the evaluator state. + * @returns {void} + */ + reset() { + this.#documentURL = null; + this.#nthIndexCache = null; + this.#setPool = []; + this.#setPoolIndex = 0; + } + + /** + * Matches a pseudo-class selector. + * @see https://html.spec.whatwg.org/_pseudo-classes + * @param {import('css-tree').CssNode} ast - The AST. + * @param {Element} node - The Element node. + * @param {import('../index.js').FindOptions} [opt] - Options. + * @returns {boolean} True if matches, otherwise false. + */ + matchPseudoClassSelector(ast, node, opt = {}) { + const { children: astChildren, name: astName } = ast; + const { localName, parentNode } = node; + const { forgive, warn = this.#evaluator.warn } = opt; + if (Array.isArray(astChildren)) { + // :has(), :is(), :not(), :where() + if (KEYS_LOGICAL.has(astName)) { + return this.#evaluateLogicalPseudo(ast, node, opt); + } + return this.#evaluatePseudoClassFunc(ast, node, opt); + } + if (KEYS_PS_NTH_OF_TYPE.has(astName)) { + if (!parentNode) { + return node === this.#evaluator.root; + } + const { localName, namespaceURI } = node; + let hasPrev = false; + let hasNext = false; + let current = node.previousElementSibling; + while (current) { + if ( + current.localName === localName && + current.namespaceURI === namespaceURI + ) { + hasPrev = true; + break; + } + current = current.previousElementSibling; + } + if (astName !== 'first-of-type') { + current = node.nextElementSibling; + while (current) { + if ( + current.localName === localName && + current.namespaceURI === namespaceURI + ) { + hasNext = true; + break; + } + current = current.nextElementSibling; + } + } + switch (astName) { + case 'first-of-type': { + return !hasPrev; + } + case 'last-of-type': { + return !hasNext; + } + case 'only-of-type': + default: { + return !hasPrev && !hasNext; + } + } + } + switch (astName) { + case 'any-link': + case 'link': { + return matchLinkPseudoClass(node); + } + case 'checked': { + return matchCheckedPseudoClass(node); + } + case 'defined': { + if (node.hasAttribute('is') || localName.includes('-')) { + return isCustomElement(node); + } + return ( + node instanceof this.#evaluator.window.HTMLElement || + node instanceof this.#evaluator.window.SVGElement + ); + } + case 'first-child': + case 'last-child': + case 'only-child': { + if (!parentNode) { + return node === this.#evaluator.root; + } + if (astName === 'first-child') { + return node === parentNode.firstElementChild; + } + if (astName === 'last-child') { + return node === parentNode.lastElementChild; + } + return ( + node === parentNode.firstElementChild && + node === parentNode.lastElementChild + ); + } + case 'in-range': + case 'out-of-range': { + return matchRangePseudoClass(astName, node, KEYS_INPUT_RANGE); + } + case 'open': { + // are not supported. + return matchOpenPseudoClass(node); + } + case 'optional': + case 'required': { + return matchRequiredPseudoClass(astName, node, KEYS_INPUT_REQUIRED); + } + case 'placeholder-shown': { + return matchPlaceholderShownPseudoClass(node, KEYS_INPUT_PLACEHOLDER); + } + case 'read-only': + case 'read-write': { + return matchReadOnlyPseudoClass(astName, node); + } + case 'root': { + return node === this.#evaluator.document.documentElement; + } + case 'scope': { + if (this.#evaluator.node.nodeType === ELEMENT_NODE) { + return !this.#evaluator.shadow && node === this.#evaluator.node; + } + return node === this.#evaluator.document.documentElement; + } + // Handled by private methods. + case 'active': { + return this.#matchActivePseudoClass(node); + } + case 'default': { + return this.#matchDefaultPseudoClass(node); + } + case 'disabled': + case 'enabled': { + return this.#matchDisabledPseudoClass(astName, node); + } + case 'empty': { + return this.#matchEmptyPseudoClass(node); + } + case 'focus': { + return this.#matchFocusPseudoClass(node); + } + case 'focus-visible': { + return this.#matchFocusVisiblePseudoClass(node); + } + case 'focus-within': { + return this.#matchFocusWithinPseudoClass(node); + } + case 'hover': { + return this.#matchHoverPseudoClass(node); + } + case 'indeterminate': { + return this.#matchIndeterminatePseudoClass(node); + } + case 'invalid': + case 'valid': { + return this.#matchValidityPseudoClass(astName, node); + } + case 'local-link': { + return this.#matchLocalLinkPseudoClass(node); + } + case 'target': { + return this.#matchTargetPseudoClass(node); + } + // No-op pseudo-classes. + case 'host': { + break; + } + case 'popover-open': { + // FIXME: Not implemented in jsdom + // @see https://github.com/jsdom/jsdom/issues/3721 + // return node.popover && isVisible(node); + break; + } + case 'visited': { + // Prevent fingerprinting. + break; + } + // Legacy pseudo-elements. + case 'after': + case 'before': + case 'first-letter': + case 'first-line': { + if (warn) { + this.#evaluator.onError( + generateException( + `Unsupported pseudo-element ::${astName}`, + NOT_SUPPORTED_ERR, + this.#evaluator.window + ) + ); + } + break; + } + // Not supported. + case 'autofill': + case 'blank': + case 'buffering': + case 'current': + case 'fullscreen': + case 'future': + case 'has-slotted': + case 'heading': + case 'modal': + case 'muted': + case 'past': + case 'paused': + case 'picture-in-picture': + case 'playing': + case 'seeking': + case 'stalled': + case 'user-invalid': + case 'user-valid': + case 'volume-locked': + case '-webkit-autofill': { + if (warn) { + this.#evaluator.onError( + generateException( + `Unsupported pseudo-class :${astName}`, + NOT_SUPPORTED_ERR, + this.#evaluator.window + ) + ); + } + break; + } + default: { + if (astName.startsWith('-webkit-')) { + if (warn) { + this.#evaluator.onError( + generateException( + `Unsupported pseudo-class :${astName}`, + NOT_SUPPORTED_ERR, + this.#evaluator.window + ) + ); + } + } else if (!forgive) { + this.#evaluator.onError( + generateException( + `Unknown pseudo-class :${astName}`, + SYNTAX_ERR, + this.#evaluator.window + ) + ); + } + } + } + return false; + } + + /** + * Evaluates logical pseudo-class selector. + * @private + * @param {import('css-tree').CssNode} ast - The AST. + * @param {Element} node - The Element node. + * @param {import('../index.js').FindOptions} opt - Options. + * @returns {boolean} True if matches, otherwise false. + */ + #evaluateLogicalPseudo(ast, node, opt) { + const { children: astChildren, name: astName } = ast; + if (!astChildren.length && astName !== 'is' && astName !== 'where') { + const css = generateCSS(ast); + this.#evaluator.onError( + generateException( + `Invalid selector ${css}`, + SYNTAX_ERR, + this.#evaluator.window + ) + ); + return false; + } + const cachedAstData = this.#astCache.get(ast); + if (cachedAstData) { + return this.#matchLogicalPseudoFunc(cachedAstData, node, opt); + } + const { branches } = walkAST(ast); + if (astName === 'has') { + const astData = { astName, branches }; + this.#astCache.set(ast, astData); + return this.#matchLogicalPseudoFunc(astData, node, opt); + } + let isInvalidShadow = false; + const twigBranches = []; + const l = branches.length; + for (let i = 0; i < l; i++) { + const leaves = branches[i]; + const branch = []; + const leavesSet = new Set(); + const leavesLen = leaves.length; + if (!isInvalidShadow && astName !== 'has') { + if (leavesLen > 1) { + isInvalidShadow = true; + } else if (astName === 'not') { + const [{ type: childAstType }] = leaves; + if (childAstType !== PS_CLASS_SELECTOR) { + isInvalidShadow = true; + } + } + } + for (let j = 0; j < leavesLen; j++) { + const item = leaves[j]; + if (item.type === COMBINATOR) { + branch.push({ combo: item, leaves: [...leavesSet] }); + leavesSet.clear(); + } else { + leavesSet.add(item); + } + if (j === leavesLen - 1) { + branch.push({ combo: null, leaves: [...leavesSet] }); + leavesSet.clear(); + } + } + twigBranches.push(branch); + } + const astData = { astName, isInvalidShadow, twigBranches }; + this.#astCache.set(ast, astData); + return this.#matchLogicalPseudoFunc(astData, node, opt); + } + + /** + * Evaluates pseudo-class function. + * @private + * @see https://html.spec.whatwg.org/_pseudo-classes + * @param {import('css-tree').CssNode} ast - The AST. + * @param {Element} node - The Element node. + * @param {import('../index.js').FindOptions} [opt] - Options. + * @returns {boolean} True if matches, otherwise false. + */ + #evaluatePseudoClassFunc(ast, node, opt = {}) { + const { children: astChildren, name: astName } = ast; + const { forgive, warn = this.#evaluator.warn } = opt; + if (/^nth-(?:last-)?(?:child|of-type)$/.test(astName)) { + if (astChildren.length !== 1) { + const css = generateCSS(ast); + this.#evaluator.onError( + generateException( + `Invalid selector ${css}`, + SYNTAX_ERR, + this.#evaluator.window + ) + ); + return false; + } + const [branch] = astChildren; + return this.#matchAnPlusB(branch, node, astName, opt); + } + switch (astName) { + case 'dir': { + if (astChildren.length !== 1) { + const css = generateCSS(ast); + this.#evaluator.onError( + generateException( + `Invalid selector ${css}`, + SYNTAX_ERR, + this.#evaluator.window + ) + ); + return false; + } + const [astChild] = astChildren; + if (!this.#psDirCache) { + this.#psDirCache = new WeakMap(); + } + return matchDirectionPseudoClass(astChild, node, this.#psDirCache); + } + case 'lang': { + if (!astChildren.length) { + const css = generateCSS(ast); + this.#evaluator.onError( + generateException( + `Invalid selector ${css}`, + SYNTAX_ERR, + this.#evaluator.window + ) + ); + return false; + } + if (!this.#psLangCache) { + this.#psLangCache = new WeakMap(); + } + let bool; + for (const astChild of astChildren) { + bool = matchLanguagePseudoClass(astChild, node, this.#psLangCache); + if (bool) { + break; + } + } + return !!bool; + } + case 'state': { + if (isCustomElement(node)) { + const [{ value: stateValue }] = astChildren; + if (stateValue) { + if (node[stateValue]) { + return true; + } + for (const i in node) { + const prop = node[i]; + if (prop instanceof this.#evaluator.window.ElementInternals) { + if (prop?.states?.has(stateValue)) { + return true; + } + break; + } + } + } + } + break; + } + // Ignore :host() and :host-context(). + case 'host': + case 'host-context': { + break; + } + // Not supported. + case 'current': + case 'heading': + case 'nth-col': + case 'nth-last-col': { + if (warn) { + this.#evaluator.onError( + generateException( + `Unsupported pseudo-class :${astName}()`, + NOT_SUPPORTED_ERR, + this.#evaluator.window + ) + ); + } + break; + } + // Deprecated in CSS Selectors 3. + case 'contains': { + if (warn) { + this.#evaluator.onError( + generateException( + `Unknown pseudo-class :${astName}()`, + NOT_SUPPORTED_ERR, + this.#evaluator.window + ) + ); + } + break; + } + default: { + if (!forgive) { + this.#evaluator.onError( + generateException( + `Unknown pseudo-class :${astName}()`, + SYNTAX_ERR, + this.#evaluator.window + ) + ); + } + } + } + return false; + } + + /** + * Evaluates the :active pseudo-class. + * @private + * @param {Element} node - The Element node. + * @returns {boolean} True if matched, otherwise false. + */ + #matchActivePseudoClass(node) { + const { buttons, target, type } = + this.#evaluator.eventHandler.currentEvent ?? {}; + return ( + type === 'mousedown' && + (buttons & 1) === 1 && + target?.nodeType === ELEMENT_NODE && + node.contains(target) + ); + } + + /** + * Evaluates the :default pseudo-class. + * @private + * @param {Element} node - The Element node. + * @returns {boolean} True if matched, otherwise false. + */ + #matchDefaultPseudoClass(node) { + const { localName } = node; + if (localName === 'option') { + return node.hasAttribute('selected'); + } + const attrType = node.getAttribute('type'); + if ( + localName === 'input' && + node.hasAttribute('type') && + node.hasAttribute('checked') + ) { + return KEYS_INPUT_CHECK.has(attrType); + } + if ( + (localName === 'button' && + !(node.hasAttribute('type') && KEYS_INPUT_RESET.has(attrType))) || + (localName === 'input' && + node.hasAttribute('type') && + KEYS_INPUT_SUBMIT.has(attrType)) + ) { + let form = node.parentNode; + while (form) { + if (form.localName === 'form') { + break; + } + form = form.parentNode; + } + if (form) { + if (!this.#psDefaultCache) { + this.#psDefaultCache = new WeakMap(); + } + let defaultSubmit = this.#psDefaultCache.get(form); + if (defaultSubmit === undefined) { + const walker = this.#evaluator.createTreeWalker(form, { + force: true + }); + let refNode = traverseNode(form, walker); + refNode = walker.firstChild(); + while (refNode) { + const nodeName = refNode.localName; + const nodeAttrType = refNode.getAttribute('type'); + let m; + if (nodeName === 'button') { + m = !( + refNode.hasAttribute('type') && + KEYS_INPUT_RESET.has(nodeAttrType) + ); + } else if (nodeName === 'input') { + m = + refNode.hasAttribute('type') && + KEYS_INPUT_SUBMIT.has(nodeAttrType); + } + if (m) { + defaultSubmit = refNode; + break; + } + refNode = walker.nextNode(); + } + this.#psDefaultCache.set(form, defaultSubmit); + } + return defaultSubmit === node; + } + } + return false; + } + + /** + * Evaluates the :disabled and :enabled pseudo-classes with tree-caching. + * @private + * @param {string} astName - The pseudo-class name ('disabled' or 'enabled'). + * @param {Element} node - The Element node. + * @returns {boolean} True if matched, otherwise false. + */ + #matchDisabledPseudoClass(astName, node) { + const { localName, parentNode } = node; + if ( + !KEYS_FORM_PS_DISABLED.has(localName) && + !isCustomElement(node, { formAssociated: true }) + ) { + return false; + } + if (node.disabled || node.hasAttribute('disabled')) { + return astName === 'disabled'; + } + if (!this.#psDisabledCache) { + this.#psDisabledCache = new WeakMap(); + } + let isDisabled = this.#psDisabledCache.get(node); + if (isDisabled !== undefined) { + if (astName === 'disabled') { + return isDisabled; + } + return !isDisabled; + } + isDisabled = false; + if (localName === 'option') { + if ( + parentNode && + parentNode.localName === 'optgroup' && + (parentNode.disabled || parentNode.hasAttribute('disabled')) + ) { + isDisabled = true; + } + } else if (localName !== 'optgroup') { + let current = parentNode; + while (current) { + if (current.localName === 'fieldset') { + if (current.disabled || current.hasAttribute('disabled')) { + let legend; + let element = current.firstElementChild; + while (element) { + if (element.localName === 'legend') { + legend = element; + break; + } + element = element.nextElementSibling; + } + if (!legend || !legend.contains(node)) { + isDisabled = true; + break; + } + } + } + current = current.parentNode; + } + } + if (isDisabled) { + this.#psDisabledCache.set(node, isDisabled); + } + if (astName === 'disabled') { + return isDisabled; + } + return !isDisabled; + } + + /** + * Evaluates the :empty pseudo-class. + * @private + * @param {Element} node - The Element node. + * @returns {boolean} True if matched, otherwise false. + */ + #matchEmptyPseudoClass(node) { + if (!node.hasChildNodes()) { + return true; + } + const walker = this.#evaluator.createTreeWalker(node, { + force: true, + whatToShow: SHOW_ALL + }); + let refNode = walker.firstChild(); + let bool; + while (refNode) { + bool = + refNode.nodeType !== ELEMENT_NODE && refNode.nodeType !== TEXT_NODE; + if (!bool) { + break; + } + refNode = walker.nextSibling(); + } + return bool; + } + + /** + * Evaluates the :focus pseudo-class. + * @private + * @param {Element} node - The Element node. + * @returns {boolean} True if matched, otherwise false. + */ + #matchFocusPseudoClass(node) { + const { activeElement } = this.#evaluator.document; + if (!activeElement) { + return false; + } + let active = activeElement; + while (active) { + if (node === active) { + if (active.shadowRoot && active.shadowRoot.activeElement) { + return true; + } + return isFocusableArea(node); + } + if (active.shadowRoot && active.shadowRoot.activeElement) { + active = active.shadowRoot.activeElement; + } else { + break; + } + } + return false; + } + + /** + * Evaluates the :focus-visible pseudo-class. + * @private + * @param {Element} node - The Element node. + * @returns {boolean} True if matched, otherwise false. + */ + #matchFocusVisiblePseudoClass(node) { + if ( + node === this.#evaluator.document.activeElement && + isFocusableArea(node) + ) { + let bool = false; + if (isFocusVisible(node)) { + bool = true; + } else if (this.#evaluator.eventHandler.currentFocus) { + const { relatedTarget, target: focusTarget } = + this.#evaluator.eventHandler.currentFocus; + if (focusTarget === node) { + if (isFocusVisible(relatedTarget)) { + bool = true; + } else if (this.#evaluator.eventHandler.currentEvent) { + const { altKey, ctrlKey, key, metaKey, target, type } = + this.#evaluator.eventHandler.currentEvent; + if (target === relatedTarget) { + if ( + !this.#lastFocusVisible || + focusTarget === this.#lastFocusVisible + ) { + bool = true; + } + } else if (key === 'Tab') { + if ( + (type === 'keydown' && target !== node) || + (type === 'keyup' && target === node) + ) { + if (target === focusTarget) { + if ( + !this.#lastFocusVisible || + (target === this.#lastFocusVisible && + relatedTarget === null) + ) { + bool = true; + } + } else { + bool = true; + } + } + } else if (key) { + if ( + (type === 'keydown' || type === 'keyup') && + !altKey && + !ctrlKey && + !metaKey && + target === node + ) { + bool = true; + } + } + } else if ( + relatedTarget === null || + relatedTarget === this.#lastFocusVisible + ) { + bool = true; + } + } + } + if (bool) { + this.#lastFocusVisible = node; + return bool; + } + if (this.#lastFocusVisible === node) { + this.#lastFocusVisible = null; + } + } + return false; + } + + /** + * Evaluates the :focus-within pseudo-class. + * @private + * @param {Element} node - The Element node. + * @returns {boolean} True if matched, otherwise false. + */ + #matchFocusWithinPseudoClass(node) { + if (!this.#focusWithinCache) { + this.#focusWithinCache = new Set(); + let currentFocus = this.#evaluator.document.activeElement; + while (currentFocus?.shadowRoot?.activeElement) { + currentFocus = currentFocus.shadowRoot.activeElement; + } + if (currentFocus && isFocusableArea(currentFocus)) { + while (currentFocus) { + this.#focusWithinCache.add(currentFocus); + if (currentFocus.parentNode) { + currentFocus = currentFocus.parentNode; + } else if ( + currentFocus.nodeType === DOCUMENT_FRAGMENT_NODE && + currentFocus.host + ) { + currentFocus = currentFocus.host; + } else { + break; + } + } + } + } + return this.#focusWithinCache.has(node); + } + + /** + * Evaluates the :hover pseudo-class. + * @private + * @param {Element} node - The Element node. + * @returns {boolean} True if matched, otherwise false. + */ + #matchHoverPseudoClass(node) { + const { target, type } = this.#evaluator.eventHandler.currentEvent ?? {}; + return ( + /^(?:click|mouse(?:down|over|up))$/.test(type) && + target?.nodeType === ELEMENT_NODE && + node.contains(target) + ); + } + + /** + * Evaluates the :indeterminate pseudo-class. + * @private + * @param {Element} node - The Element node. + * @returns {boolean} True if matched, otherwise false. + */ + #matchIndeterminatePseudoClass(node) { + const { localName } = node; + if (localName === 'progress') { + return !node.hasAttribute('value'); + } + if (localName === 'input' && node.type === 'checkbox') { + return node.indeterminate; + } + if (localName === 'input' && node.type === 'radio') { + if (node.checked || node.hasAttribute('checked')) { + return false; + } + const nodeName = node.name; + let parent = node.parentNode; + while (parent) { + if (parent.localName === 'form') { + break; + } + parent = parent.parentNode; + } + if (!parent) { + parent = this.#evaluator.document.documentElement; + } + if (!this.#psIndeterminateCache) { + this.#psIndeterminateCache = new WeakMap(); + } + let parentCache = this.#psIndeterminateCache.get(parent); + if (parentCache === undefined) { + parentCache = new Map(); + this.#psIndeterminateCache.set(parent, parentCache); + } + let checked = parentCache.get(nodeName); + if (checked === undefined) { + const walker = this.#evaluator.createTreeWalker(parent, { + force: true + }); + let refNode = traverseNode(parent, walker); + refNode = walker.firstChild(); + while (refNode) { + if ( + refNode.localName === 'input' && + refNode.getAttribute('type') === 'radio' + ) { + if (nodeName && refNode.getAttribute('name') === nodeName) { + checked = !!refNode.checked; + } + if (checked) { + break; + } + } + refNode = walker.nextNode(); + } + checked = !!checked; + parentCache.set(nodeName, checked); + } + return !checked; + } + return false; + } + + /** + * Evaluates the :local-link pseudo-class. + * @private + * @param {Element} node - The Element node. + * @returns {boolean} True if matched, otherwise false. + */ + #matchLocalLinkPseudoClass(node) { + const { localName } = node; + if ( + (localName === 'a' || localName === 'area') && + node.hasAttribute('href') + ) { + if (!this.#documentURL) { + this.#documentURL = new URL(this.#evaluator.document.URL); + } + const { href, origin, pathname } = this.#documentURL; + const attrURL = new URL(node.getAttribute('href'), href); + return attrURL.origin === origin && attrURL.pathname === pathname; + } + return false; + } + + /** + * Evaluates the :target pseudo-class. + * @private + * @param {Element} node - The Element node. + * @returns {boolean} True if matched, otherwise false. + */ + #matchTargetPseudoClass(node) { + if (!this.#documentURL) { + this.#documentURL = new URL(this.#evaluator.document.URL); + } + const { hash } = this.#documentURL; + return !!( + hash && + hash === `#${node.id}` && + this.#evaluator.document.contains(node) + ); + } + + /** + * Evaluates the :valid and :invalid pseudo-classes. + * @private + * @param {string} astName - The name of the pseudo-class. + * @param {Element} node - The Element node. + * @returns {boolean} True if matched, otherwise false. + */ + #matchValidityPseudoClass(astName, node) { + const { localName } = node; + if (KEYS_FORM_PS_VALID.has(localName)) { + let { valid } = node.validity; + if (node.maxLength >= 0) { + valid = node.maxLength >= node.value.length; + } + if (valid && node.minLength >= 0) { + valid = node.minLength <= node.value.length; + } + return astName === 'invalid' ? !valid : valid; + } + if (localName === 'form' || localName === 'fieldset') { + if (!this.#psValidCache) { + this.#psValidCache = new WeakMap(); + } + let valid = this.#psValidCache.get(node); + if (valid === undefined) { + const walker = this.#evaluator.createTreeWalker(node, { force: true }); + let refNode = traverseNode(node, walker); + refNode = walker.firstChild(); + if (!refNode) { + valid = true; + } else { + while (refNode) { + if (KEYS_FORM_PS_VALID.has(refNode.localName)) { + valid = refNode.validity.valid; + if (refNode.maxLength >= 0) { + valid = refNode.maxLength >= refNode.value.length; + } + if (valid && refNode.minLength >= 0) { + valid = refNode.minLength <= refNode.value.length; + } + if (!valid) { + break; + } + } + refNode = walker.nextNode(); + } + } + this.#psValidCache.set(node, valid); + } + return astName === 'invalid' ? !valid : valid; + } + return false; + } + + /** + * Evaluates An+B mathematically. + * @private + * @param {import('css-tree').CssNode} ast - The AST. + * @param {Element} node - The Element node. + * @param {string} nthName - The name of the nth pseudo-class. + * @param {import('../index.js').FindOptions} opt - Options. + * @returns {boolean} True if matches, otherwise false. + */ + #matchAnPlusB(ast, node, nthName, opt) { + const { parentNode } = node; + if (!parentNode && node !== this.#evaluator.root) { + return false; + } + if (!this.#anbCache) { + this.#anbCache = new WeakMap(); + } + let anb = this.#anbCache.get(ast); + if (anb === undefined) { + const { + nth: { a, b, name: nthIdentName }, + selector + } = ast; + anb = { + a: 0, + b: 0, + isLast: nthName.includes('last'), + isOfType: nthName.includes('of-type'), + selector: null + }; + if (nthIdentName) { + if (nthIdentName === 'even') { + anb.a = 2; + anb.b = 0; + } else if (nthIdentName === 'odd') { + anb.a = 2; + anb.b = 1; + } + } else { + const intA = parseInt(a); + if (Number.isInteger(intA)) { + anb.a = intA; + } + const intB = parseInt(b); + if (Number.isInteger(intB)) { + anb.b = intB; + } + } + if (selector && /^nth-(?:last-)?child$/.test(nthName)) { + anb.selector = selector; + } + this.#anbCache.set(ast, anb); + } + const { a, b, isLast, isOfType, selector: anbSelector } = anb; + let pos; + if (!parentNode) { + if (anbSelector) { + const selectorBranches = this.#getSelectorBranches(anbSelector); + if ( + !this.#filterNthChildOfSelectorBranches(selectorBranches, node, opt) + ) { + return false; + } + } + pos = 1; + } else { + if (!this.#nthIndexCache) { + this.#nthIndexCache = new WeakMap(); + } + let parentCache = this.#nthIndexCache.get(parentNode); + if (parentCache === undefined) { + parentCache = new Map(); + this.#nthIndexCache.set(parentNode, parentCache); + } + let indexMap = parentCache.get(ast); + if (indexMap === undefined) { + indexMap = new Map(); + parentCache.set(ast, indexMap); + let currentPos = 1; + let current = isLast + ? parentNode.lastElementChild + : parentNode.firstElementChild; + if (anbSelector) { + const selectorBranches = this.#getSelectorBranches(anbSelector); + while (current) { + if ( + this.#filterNthChildOfSelectorBranches( + selectorBranches, + current, + opt + ) + ) { + indexMap.set(current, currentPos++); + } + current = isLast + ? current.previousElementSibling + : current.nextElementSibling; + } + } else { + const typeCounts = new Map(); + while (current) { + if (isOfType) { + const typeKey = `${current.localName}|${current.namespaceURI}`; + const tPos = (typeCounts.get(typeKey) || 0) + 1; + typeCounts.set(typeKey, tPos); + indexMap.set(current, tPos); + } else { + indexMap.set(current, currentPos++); + } + current = isLast + ? current.previousElementSibling + : current.nextElementSibling; + } + } + } + pos = indexMap.get(node); + if (pos === undefined) { + return false; + } + } + if (a === 0) { + return pos === b; + } + const diff = pos - b; + if (diff % a !== 0) { + return false; + } + return a > 0 ? diff >= 0 : diff <= 0; + } + + /** + * Gets selector branches from cache or parses them. + * @private + * @param {import('css-tree').CssNode} selector - The AST. + * @returns {Array>} The selector branches. + */ + #getSelectorBranches(selector) { + let branches = this.#astCache.get(selector); + if (branches) { + return branches; + } + const walkedResult = walkAST(selector); + branches = walkedResult.branches; + this.#astCache.set(selector, branches); + return branches; + } + + /** + * Checks if a node matches any of the given selector branches. + * @private + * @param {Array>} branches - The selector branches to test. + * @param {Element} node - The element node to match against. + * @param {import('../index.js').FindOptions} opt - Options. + * @returns {boolean} True if any branch matches, otherwise false. + */ + #filterNthChildOfSelectorBranches(branches, node, opt) { + let filterMatch = false; + for (const branch of branches) { + if (this.#evaluator.matchLeaves(branch, node, opt)) { + filterMatch = true; + break; + } + } + return filterMatch; + } + + /** + * Matches logical pseudo-class functions. + * @private + * @param {import('css-tree').CssNode} astData - The AST data. + * @param {Element} node - The Element node. + * @param {import('../index.js').FindOptions} [opt] - Options. + * @returns {boolean} True if matches, otherwise false. + */ + #matchLogicalPseudoFunc(astData, node, opt = {}) { + const { astName, isInvalidShadow, twigBranches } = astData; + if (astName === 'has') { + return this.#evaluateHasPseudo(astData, node, opt) === node; + } + const isShadowRoot = + (opt.isShadowRoot || this.#evaluator.shadow) && + node.nodeType === DOCUMENT_FRAGMENT_NODE; + if (isShadowRoot && isInvalidShadow) { + return false; + } + const prevForgive = opt.forgive; + const prevDir = opt.dir; + opt.forgive = astName === 'is' || astName === 'where'; + opt.dir = undefined; + const l = twigBranches.length; + let bool = false; + for (let i = 0; i < l; i++) { + const branch = twigBranches[i]; + const lastIndex = branch.length - 1; + const { leaves } = branch[lastIndex]; + bool = this.#evaluator.matchLeaves(leaves, node, opt); + if (bool && lastIndex > 0) { + const initialPoolIndex = this.#setPoolIndex; + let currentNodes = this.#acquireSet(); + currentNodes.add(node); + for (let j = lastIndex - 1; j >= 0; j--) { + const twig = branch[j]; + const isLastStep = j === 0; + const nextNodes = isLastStep ? null : this.#acquireSet(); + let hasMatch = false; + opt.dir = DIR_PREV; + for (const nextNode of currentNodes) { + for (const matchedNode of this.#evaluator.yieldCombinatorMatches( + twig, + nextNode, + opt + )) { + hasMatch = true; + if (isLastStep) { + break; + } + nextNodes.add(matchedNode); + } + if (isLastStep && hasMatch) { + break; + } + } + if (!hasMatch) { + bool = false; + break; + } + if (isLastStep) { + bool = true; + } else { + currentNodes = nextNodes; + } + } + this.#setPoolIndex = initialPoolIndex; + } + if (bool) { + break; + } + } + opt.forgive = prevForgive; + opt.dir = prevDir; + return astName === 'not' ? !bool : bool; + } + + /** + * Evaluates :has() pseudo-class. + * @private + * @param {import('css-tree').CssNode} astData - The AST data. + * @param {Element} node - The Element node. + * @param {import('../index.js').FindOptions} [opt] - Options. + * @returns {Element|null} The matched node. + */ + #evaluateHasPseudo(astData, node, opt = {}) { + const { branches } = astData; + let bool = false; + if (!this.#psHasFilterCache) { + this.#psHasFilterCache = new WeakMap(); + } + let rootCache = this.#psHasFilterCache.get(this.#evaluator.root); + if (rootCache === undefined) { + rootCache = new WeakMap(); + this.#psHasFilterCache.set(this.#evaluator.root, rootCache); + } + for (const leaves of branches) { + if (!rootCache.has(leaves)) { + const filterResult = this.#buildHasAllowlist(leaves); + rootCache.set(leaves, filterResult); + } + const allowlist = rootCache.get(leaves); + if ( + allowlist && + allowlist.seeded && + node.nodeType !== DOCUMENT_FRAGMENT_NODE && + !allowlist.set.has(node) + ) { + continue; + } + bool = this.#matchHasPseudoFunc(leaves, node, opt); + if (bool) { + break; + } + } + if (!bool) { + return null; + } + if ( + (opt.isShadowRoot || this.#evaluator.shadow) && + node.nodeType === DOCUMENT_FRAGMENT_NODE + ) { + return this.#evaluator.verifyShadowHost ? node : null; + } + return node; + } + + /** + * Builds an Allowlist for the :has() branch using a sparse seed element. + * @private + * @param {Array} leaves - The AST leaves of the selector branch. + * @returns {object|null} The wrapper object containing the WeakSet, or null. + */ + #buildHasAllowlist(leaves) { + if ( + this.#evaluator.shadow || + this.#evaluator.node.nodeType === DOCUMENT_FRAGMENT_NODE + ) { + return null; + } + const { seed } = findBestSeed(leaves); + if (!seed) { + return null; + } + let seedElements = null; + let isSingleNode = false; + if (seed.type === 'id') { + if (typeof this.#evaluator.root.getElementById === 'function') { + const node = this.#evaluator.root.getElementById(seed.value); + if (node) { + seedElements = node; + isSingleNode = true; + } + } + } else if (seed.type === 'class') { + if (typeof this.#evaluator.root.getElementsByClassName === 'function') { + seedElements = this.#evaluator.root.getElementsByClassName(seed.value); + } + } else if (seed.type === 'tag') { + if (typeof this.#evaluator.root.getElementsByTagName === 'function') { + seedElements = this.#evaluator.root.getElementsByTagName(seed.value); + } + } + if (!seedElements) { + return null; + } + const len = isSingleNode ? 1 : seedElements.length; + if (len === 0 || len > HEX * HEX) { + return null; + } + const filterResult = { seeded: true, set: new WeakSet() }; + const list = filterResult.set; + const visitedAncestors = new Set(); + if (this.#evaluator.node) { + list.add(this.#evaluator.node); + } + for (let i = 0; i < len; i++) { + const current = isSingleNode ? seedElements : seedElements[i]; + if (current) { + populateHasAllowlist(current, list, visitedAncestors); + } + } + return filterResult; + } + + /** + * Retrieves a cleared Set from the pool. + * @private + * @returns {Set} A cleared Set instance. + */ + #acquireSet() { + if (this.#setPoolIndex === this.#setPool.length) { + this.#setPool.push(new Set()); + } + const set = this.#setPool[this.#setPoolIndex++]; + set.clear(); + return set; + } + + /** + * Matches the :has() pseudo-class function. + * @private + * @param {Array} astLeaves - The AST leaves. + * @param {Element} node - The Element node. + * @param {import('../index.js').FindOptions} [opt] - Options. + * @returns {boolean} True if matched, otherwise false. + */ + #matchHasPseudoFunc(astLeaves, node, opt = {}) { + let combo; + let startIndex = 0; + if (astLeaves[0].type === COMBINATOR) { + combo = astLeaves[0]; + startIndex = 1; + } else { + combo = { name: ' ', type: COMBINATOR }; + startIndex = 0; + } + const twigLeaves = []; + const l = astLeaves.length; + let nextComboIndex = startIndex; + for (; nextComboIndex < l; nextComboIndex++) { + if (astLeaves[nextComboIndex].type === COMBINATOR) { + break; + } + twigLeaves.push(astLeaves[nextComboIndex]); + } + const twig = { combo, leaves: twigLeaves }; + opt.dir = DIR_NEXT; + const remainingLeaves = astLeaves.slice(nextComboIndex); + return this.#hasCombinatorMatch(twig, node, remainingLeaves, opt); + } + + /** + * Evaluates if any combinator match satisfies the condition to short-circuit. + * @private + * @param {import('./processor.js').ProcessedBranch} twig - The AST twig object. + * @param {Element} node - The Element node. + * @param {Array} remainingLeaves - The remaining AST leaves. + * @param {import('../index.js').FindOptions} opt - Options. + * @returns {boolean} True if matched, otherwise false. + */ + #hasCombinatorMatch(twig, node, remainingLeaves, opt) { + const { + combo: { name: comboName }, + leaves + } = twig; + const isLastLeaf = remainingLeaves.length === 0; + switch (comboName) { + case '+': { + const refNode = node.nextElementSibling; + return refNode + ? this.#checkNode(refNode, leaves, remainingLeaves, opt) + : false; + } + case '~': { + let refNode = node.nextElementSibling; + while (refNode) { + if (this.#checkNode(refNode, leaves, remainingLeaves, opt)) { + return true; + } + refNode = refNode.nextElementSibling; + } + return false; + } + case '>': { + let refNode = node.firstElementChild; + while (refNode) { + if (this.#checkNode(refNode, leaves, remainingLeaves, opt)) { + return true; + } + refNode = refNode.nextElementSibling; + } + return false; + } + case ' ': + default: { + const [leaf] = leaves; + const filterLeaves = this.#evaluator.getFilterLeaves(leaves); + const isLastFilter = filterLeaves.length === 0; + if (leaf.type === CLASS_SELECTOR && canUseFastClassSearch(node)) { + const leafName = unescapeSelector(leaf.name); + const collection = node.getElementsByClassName(leafName); + for (let i = 0, len = collection.length; i < len; i++) { + const item = collection[i]; + if ( + isLastFilter || + this.#evaluator.matchLeaves(filterLeaves, item, opt) + ) { + if (isLastLeaf) { + return true; + } + if (this.#matchHasPseudoFunc(remainingLeaves, item, opt)) { + return true; + } + } + } + return false; + } + if ( + leaf.type === TYPE_SELECTOR && + canUseFastTagSearch(node, leaf.name) && + leaf.name !== '*' + ) { + const leafName = unescapeSelector(leaf.name); + const collection = node.getElementsByTagName(leafName); + for (let i = 0, len = collection.length; i < len; i++) { + const item = collection[i]; + if ( + isLastFilter || + this.#evaluator.matchLeaves(filterLeaves, item, opt) + ) { + if (isLastLeaf) { + return true; + } + if (this.#matchHasPseudoFunc(remainingLeaves, item, opt)) { + return true; + } + } + } + return false; + } + if ( + leaf.type === ID_SELECTOR && + canUseFastIdSearch(node, this.#evaluator.root) + ) { + const leafName = unescapeSelector(leaf.name); + const foundNode = this.#evaluator.root.getElementById(leafName); + if (foundNode && foundNode !== node && node.contains(foundNode)) { + if ( + isLastFilter || + this.#evaluator.matchLeaves(filterLeaves, foundNode, opt) + ) { + if (isLastLeaf) { + return true; + } + if (this.#matchHasPseudoFunc(remainingLeaves, foundNode, opt)) { + return true; + } + } + } + } + const walker = this.#evaluator.createTreeWalker(node); + traverseNode(node, walker); + let currentNode = walker.firstChild(); + while (currentNode) { + if (this.#checkNode(currentNode, leaves, remainingLeaves, opt)) { + return true; + } + currentNode = walker.nextNode(); + } + return false; + } + } + } + + /** + * Checks if a target node satisfies the given conditions. + * @private + * @param {Element} refNode - The element node to check. + * @param {Array} leaves - The current AST leaves. + * @param {Array} remainingLeaves - The remaining AST leaves. + * @param {import('../index.js').FindOptions} opt - Options. + * @returns {boolean} True if matched, otherwise false. + */ + #checkNode(refNode, leaves, remainingLeaves, opt) { + if (this.#evaluator.matchLeaves(leaves, refNode, opt)) { + if (remainingLeaves.length === 0) { + return true; + } + if (this.#matchHasPseudoFunc(remainingLeaves, refNode, opt)) { + return true; + } + } + return false; + } +} diff --git a/node_modules/@asamuzakjp/dom-selector/src/js/selector.js b/node_modules/@asamuzakjp/dom-selector/src/js/selector.js new file mode 100644 index 0000000..9cec02f --- /dev/null +++ b/node_modules/@asamuzakjp/dom-selector/src/js/selector.js @@ -0,0 +1,330 @@ +/** + * selector.js + */ + +/* import */ +import cssTreeWalk from 'css-tree/walker'; +import cssTreeGenerate from 'css-tree/generator'; +import { generateException } from './utility.js'; + +/* constants */ +import { + COMBINATOR, + COMBO, + COMPOUND_I, + HAS_COMPOUND, + KEYS_LOGICAL, + KEYS_PS_CLASS_SUPPORTED, + LOGIC_COMPLEX, + LOGIC_COMPOUND, + N_TH, + PSEUDO_CLASS, + PS_CLASS_SELECTOR, + PS_ELEMENT_SELECTOR, + SELECTOR, + SYNTAX_ERR, + TARGET_ALL, + TARGET_FIRST +} from './constant.js'; + +/* regexp */ +const REG_EXCLUDE_BASIC = + /[|\\]|::|[^\u0021-\u007F\s]|\[\s*[\w$*=^|~-]+(?:(?:"[\w$*=^|~\s'-]+"|'[\w$*=^|~\s"-]+')?(?:\s+[\w$*=^|~-]+)+|"[^"\]]{1,255}|'[^'\]]{1,255})\s*\]|:(?:is|where)\(\s*\)|\[\s*data-/; +const REG_HAS = /has\(/i; +const REG_IS_NOT = /(?:is|not)\(/i; +const REG_COMPLEX = new RegExp(`${COMPOUND_I}${COMBO}${COMPOUND_I}`, 'i'); +const REG_LOGIC_COMPLEX = new RegExp( + `:(?!${PSEUDO_CLASS}|${N_TH}|${LOGIC_COMPLEX})`, + 'i' +); +const REG_LOGIC_COMPOUND = new RegExp( + `:(?!${PSEUDO_CLASS}|${N_TH}|${LOGIC_COMPOUND})`, + 'i' +); +const REG_LOGIC_HAS_COMPOUND = new RegExp( + `:(?!${PSEUDO_CLASS}|${N_TH}|${LOGIC_COMPOUND}|${HAS_COMPOUND})` +); +const REG_END_WITH_HAS = new RegExp(`:${HAS_COMPOUND}$`); +const REG_WO_LOGICAL = new RegExp(`:(?!${PSEUDO_CLASS}|${N_TH})`, 'i'); +const REG_COMBO = new RegExp(COMBO); +const REG_ID = /#(\D[^#.*]+)/g; +const REG_CLASS = /\.(\D[^#.*]+)/g; +const REG_TAG = /^([^#.]+)/; +const REG_INVALID_SYNTAX = + /[+~>]\s*[+~>]|^\s*[+~>]|[+~>]\s*$|^\s*,|,\s*,|,\s*$/; +const REG_UPPERCASE_TAG = + /(?:^|[\s>+~,])[a-z\d-]*[A-Z][a-zA-Z\d-]*(?=[#.:[\s>+~,]|$)/; + +/** + * Find a nested :has() pseudo-class. + * @param {object} leaf - The AST leaf to check. + * @returns {object|null} The leaf if it's :has, otherwise null. + */ +export const findNestedHas = leaf => leaf.name === 'has'; + +/** + * Find a logical pseudo-class that contains a nested :has(). + * @param {object} leaf - The AST leaf to check. + * @returns {object|null} The leaf if it matches, otherwise null. + */ +export const findLogicalWithNestedHas = leaf => { + if (KEYS_LOGICAL.has(leaf.name) && cssTreeWalk.find(leaf, findNestedHas)) { + return leaf; + } + return null; +}; + +/** + * Validates nesting restrictions within :has() arguments. + * @param {Array} astChildren - The AST nodes representing the :has() arguments. + * @returns {boolean} False if there's an invalid nesting constraint violation. + */ +export const validateHasNesting = astChildren => { + const l = astChildren.length; + for (let i = 0; i < l; i++) { + const item = cssTreeWalk.find(astChildren[i], findLogicalWithNestedHas); + if (item) { + // If nested :has() is wrapped inside :is() or :where(), it is forgiven. + if (item.name !== 'is' && item.name !== 'where') { + return false; + } + } + } + return true; +}; + +/** + * Creates a callback function to validate :has() nesting during AST walk. + * @param {object} globalObj - The global window object. + * @returns {(node: object) => void} The callback function for walkAST. + */ +export const createHasValidator = globalObj => node => { + if ( + node.type === PS_CLASS_SELECTOR && + node.name.toLowerCase() === 'has' && + !validateHasNesting(Array.from(node.children || [])) + ) { + const css = cssTreeGenerate(node); + throw generateException( + `Disallowed nested :has() pseudo-class: ${css}`, + SYNTAX_ERR, + globalObj + ); + } +}; + +/** + * Check if a combinator node is invalid (leading, trailing, or consecutive). + * @param {string} type - The current node type. + * @param {string|null} prevType - The previous node type. + * @param {boolean} isLast - Whether the current node is the last in the list. + * @returns {boolean} True if the combinator is invalid. + */ +export const isInvalidCombinator = (type, prevType, isLast) => + type === COMBINATOR && + (prevType === null || prevType === COMBINATOR || isLast); + +/** + * Checks if a given AST is supported by the DOMSelector engine. + * @param {import('css-tree').CssNode} ast - The AST to validate. + * @returns {boolean} True if the selector is fully supported. + */ +export const isSupportedAST = ast => { + let isSupported = true; + const walk = ( + node, + context = { insideHas: false, insideForgiving: false } + ) => { + if (!isSupported || !node) { + return; + } + const nextContext = { ...context }; + if (node.type === PS_ELEMENT_SELECTOR) { + isSupported = false; + return; + } else if (node.type === PS_CLASS_SELECTOR) { + let name = node.name; + if (name && typeof name === 'string') { + name = name.toLowerCase(); + } + if (!KEYS_PS_CLASS_SUPPORTED.has(name)) { + isSupported = false; + return; + } + if (name === 'has') { + if (context.insideHas && !context.insideForgiving) { + isSupported = false; + return; + } + nextContext.insideHas = true; + } else if (name === 'is' || name === 'where') { + nextContext.insideForgiving = true; + } + } + if (node.children) { + let prevType = null; + if (node.children.head !== undefined) { + let current = node.children.head; + while (current) { + if (!current.data) { + current = current.next; + continue; + } + const childType = current.data.type; + if ( + node.type === SELECTOR && + isInvalidCombinator(childType, prevType, !current.next) + ) { + if (!(prevType === null && context.insideHas)) { + isSupported = false; + return; + } + } + prevType = childType; + walk(current.data, nextContext); + if (!isSupported) { + return; + } + current = current.next; + } + } else if (Array.isArray(node.children)) { + const l = node.children.length; + for (let i = 0; i < l; i++) { + const child = node.children[i]; + if (!child) { + continue; + } + const childType = child.type; + if ( + node.type === SELECTOR && + isInvalidCombinator(childType, prevType, i === l - 1) + ) { + if (!(prevType === null && context.insideHas)) { + isSupported = false; + return; + } + } + prevType = childType; + walk(child, nextContext); + if (!isSupported) { + return; + } + } + } + } + if (node.selector) { + walk(node.selector, nextContext); + } + }; + walk(ast); + return isSupported; +}; + +/** + * Extracts the rightmost subject keys (id, class, tag) from a selector. + * @param {string} selector - The CSS selector string to parse. + * @param {boolean} caseSensitive - True if the tag should be case-sensitive. + * @returns {Array<{id: string|null, className: string|null, tag: string|null}>} The list of extracted keys for each selector group. + */ +export const extractSubjectsRegExp = (selector, caseSensitive) => { + const subjects = []; + const groups = selector.split(','); + for (const item of groups) { + const group = item.trim(); + if (!group) { + continue; + } + const compounds = group.split(REG_COMBO); + const rightmost = compounds.at(-1); + let idKey = null; + let classKey = null; + let tagKey = null; + if (rightmost) { + const idMatch = rightmost.match(REG_ID); + if (idMatch) { + idKey = idMatch.at(-1).slice(1); + } + const classMatch = rightmost.match(REG_CLASS); + if (classMatch) { + classKey = classMatch.at(-1).slice(1); + } + const tagMatch = rightmost.match(REG_TAG); + if (tagMatch) { + const tag = tagMatch[1]; + if (tag !== '*') { + tagKey = caseSensitive ? tag : tag.toLowerCase(); + } + } + } + subjects.push({ id: idKey, className: classKey, tag: tagKey }); + } + return subjects; +}; + +/** + * Filter a selector for use with nwsapi. + * @param {string} selector - The selector string. + * @param {string} target - The target type. + * @returns {boolean} - True if the selector is valid for nwsapi. + */ +export const filterSelector = (selector, target) => { + // Basic validation and fast-fail for null/undefined/non-string values. + // Rejects stringified nullish values as well. + if ( + !selector || + typeof selector !== 'string' || + selector === 'null' || + selector === 'undefined' + ) { + return false; + } + // Exclude querySelectorAll and querySelector + if (target === TARGET_ALL || target === TARGET_FIRST) { + return false; + } + // Validate syntax. + if (REG_INVALID_SYNTAX.test(selector)) { + return false; + } + // Exclude various complex or unsupported selectors early. + // i.e. non-ASCII, escaped selectors, namespaced selectors, pseudo-elements. + if ( + selector.includes('/') || + selector.includes('&') || + REG_EXCLUDE_BASIC.test(selector) || + REG_UPPERCASE_TAG.test(selector) + ) { + return false; + } + // Validate attribute selector integrity. + if (selector.includes('[')) { + const index = selector.lastIndexOf('['); + if (selector.indexOf(']', index) === -1) { + return false; + } + } + // Logic for pseudo-classes. + if (selector.includes(':')) { + // Determine if the selector has complex logical structures. + const isComplex = REG_COMPLEX.test(selector); + // Handle :has() specifically. + if (REG_HAS.test(selector)) { + if (!isComplex || REG_LOGIC_HAS_COMPOUND.test(selector)) { + return false; + } + return REG_END_WITH_HAS.test(selector); + } + // Handle :is() and :not(). + if (REG_IS_NOT.test(selector)) { + if (isComplex) { + return !REG_LOGIC_COMPLEX.test(selector); + } + return !REG_LOGIC_COMPOUND.test(selector); + } + // Default check for other pseudo-classes against known list. + if (REG_WO_LOGICAL.test(selector)) { + return false; + } + } + return true; +}; diff --git a/node_modules/@asamuzakjp/dom-selector/src/js/shadow.js b/node_modules/@asamuzakjp/dom-selector/src/js/shadow.js new file mode 100644 index 0000000..9a77c34 --- /dev/null +++ b/node_modules/@asamuzakjp/dom-selector/src/js/shadow.js @@ -0,0 +1,179 @@ +/** + * shadow.js + */ + +import { generateCSS, walkAST } from './parser.js'; +import { generateException } from './utility.js'; +import { COMBINATOR, KEYS_LOGICAL, SYNTAX_ERR } from './constant.js'; + +/** + * ShadowDOMEvaluator + * Handles the evaluation of Shadow DOM specific selectors. + */ +export class ShadowDOMEvaluator { + /* private fields */ + #evaluator; + #verifyShadowHost; + + /** + * @param {import('./evaluator.js').Evaluator} evaluator - The Evaluator instance. + */ + constructor(evaluator) { + this.#evaluator = evaluator; + this.#verifyShadowHost = false; + } + + /** + * Gets the verifyShadowHost state. + * @returns {boolean} True if verified, otherwise false. + */ + get verifyShadowHost() { + return this.#verifyShadowHost; + } + + /** + * Resets the evaluation state. + * @returns {void} + */ + reset() { + this.#verifyShadowHost = false; + } + + /** + * Matches a selector for a shadow root. + * @param {import('css-tree').CssNode} ast - The AST. + * @param {DocumentFragment} node - The DocumentFragment node. + * @param {object} [opt] - Options. + * @returns {boolean} True if matches, otherwise false. + */ + matchSelectorForShadowRoot(ast, node, opt = {}) { + const { name: astName } = ast; + if (KEYS_LOGICAL.has(astName)) { + opt.isShadowRoot = true; + return this.#evaluator.matchPseudoClassSelector(ast, node, opt); + } + if (astName === 'host' || astName === 'host-context') { + const matches = this.evaluateShadowHost(ast, node, opt); + if (matches) { + this.#verifyShadowHost = true; + return true; + } + } + return false; + } + + /** + * Evaluates shadow host pseudo-classes. + * @param {import('css-tree').CssNode} ast - The AST. + * @param {DocumentFragment} node - The DocumentFragment node. + * @returns {boolean} True if matches, otherwise false. + */ + evaluateShadowHost(ast, node) { + const { children: astChildren, name: astName } = ast; + // Handle simple pseudo-class (no arguments). + if (!Array.isArray(astChildren)) { + if (astName === 'host') { + return true; + } + const msg = `Invalid selector :${astName}`; + this.#evaluator.onError( + generateException(msg, SYNTAX_ERR, this.#evaluator.window) + ); + return false; + } + // Handle functional pseudo-class like :host(...). + if (astName !== 'host' && astName !== 'host-context') { + const msg = `Invalid selector :${astName}()`; + this.#evaluator.onError( + generateException(msg, SYNTAX_ERR, this.#evaluator.window) + ); + return false; + } + if (astChildren.length === 0) { + const css = generateCSS(ast); + const msg = `Invalid selector ${css}`; + this.#evaluator.onError( + generateException(msg, SYNTAX_ERR, this.#evaluator.window) + ); + return false; + } + const { host } = node; + for (const child of astChildren) { + const { branches } = walkAST(child); + for (const branch of branches) { + if (astName === 'host' && this.#evaluateHostPseudo(branch, host, ast)) { + return true; + } else if ( + astName === 'host-context' && + this.#evaluateHostContextPseudo(branch, host, ast) + ) { + return true; + } + } + } + return false; + } + + /** + * Evaluates the :host() pseudo-class. + * @private + * @param {Array} leaves - The AST leaves. + * @param {Element} host - The host element. + * @param {import('css-tree').CssNode} ast - The original AST for error reporting. + * @returns {boolean} True if matches, otherwise false. + */ + #evaluateHostPseudo(leaves, host, ast) { + const l = leaves.length; + for (let i = 0; i < l; i++) { + const leaf = leaves[i]; + if (leaf.type === COMBINATOR) { + const css = generateCSS(ast); + const msg = `Invalid selector ${css}`; + this.#evaluator.onError( + generateException(msg, SYNTAX_ERR, this.#evaluator.window) + ); + return false; + } + if (!this.#evaluator.matchSelector(leaf, host)) { + return false; + } + } + return true; + } + + /** + * Evaluates the :host-context() pseudo-class. + * @private + * @param {Array} leaves - The AST leaves. + * @param {Element} host - The host element. + * @param {import('css-tree').CssNode} ast - The original AST for error reporting. + * @returns {boolean} True if matched, otherwise false. + */ + #evaluateHostContextPseudo(leaves, host, ast) { + let parent = host; + while (parent) { + let bool; + const l = leaves.length; + for (let i = 0; i < l; i++) { + const leaf = leaves[i]; + if (leaf.type === COMBINATOR) { + const css = generateCSS(ast); + const msg = `Invalid selector ${css}`; + this.#evaluator.onError( + generateException(msg, SYNTAX_ERR, this.#evaluator.window) + ); + return false; + } + bool = this.#evaluator.matchSelector(leaf, parent); + if (!bool) { + break; + } + } + if (bool) { + return true; + } + parent = parent.parentNode || parent.host; + } + return false; + } +} diff --git a/node_modules/@asamuzakjp/dom-selector/src/js/traverser.js b/node_modules/@asamuzakjp/dom-selector/src/js/traverser.js new file mode 100644 index 0000000..279a3d7 --- /dev/null +++ b/node_modules/@asamuzakjp/dom-selector/src/js/traverser.js @@ -0,0 +1,256 @@ +/** + * traverser.js + */ + +/* import */ +import { matchPseudoElementSelector } from './matcher.js'; +import { + canUseFastClassSearch, + canUseFastIdSearch, + canUseFastTagSearch, + traverseNode +} from './utility.js'; + +/* constants */ +import { + DIR_NEXT, + ID_SELECTOR, + CLASS_SELECTOR, + TYPE_SELECTOR, + PS_ELEMENT_SELECTOR, + SHOW_CONTAINER +} from './constant.js'; + +/** + * DOMTraverser + * Handles DOM tree traversal and combinator matches. + */ +export class DOMTraverser { + #evaluator; + #walkers; + + /** + * @param {import('./evaluator.js').Evaluator} evaluator - The Evaluator instance. + */ + constructor(evaluator) { + this.#evaluator = evaluator; + } + + /** + * Resets the traversal state. + * @returns {void} + */ + reset() { + this.#walkers = null; + } + + /** + * Creates a TreeWalker. + * @param {Document|DocumentFragment|Element} node - The Document, DocumentFragment, or Element node. + * @param {object} [opt] - Options. + * @param {boolean} [opt.force] - Force creation of a new TreeWalker. + * @param {number} [opt.whatToShow] - The NodeFilter whatToShow value. + * @returns {TreeWalker} The TreeWalker object. + */ + createTreeWalker(node, opt = {}) { + const { force = false, whatToShow = SHOW_CONTAINER } = opt; + if (force) { + return this.#evaluator.document.createTreeWalker(node, whatToShow); + } + if (!this.#walkers) { + this.#walkers = new WeakMap(); + } + let walker = this.#walkers.get(node); + if (walker) { + return walker; + } + walker = this.#evaluator.document.createTreeWalker(node, whatToShow); + this.#walkers.set(node, walker); + return walker; + } + + /** + * Yields combinator matches. + * @param {import('./processor.js').ProcessedBranch} twig - The twig object. + * @param {Element} node - The Element node. + * @param {import('../index.js').FindOptions} [opt] - Options. + * @yields {Element} The matched node. + */ + *yieldCombinatorMatches(twig, node, opt = {}) { + const { + combo: { name: comboName }, + leaves + } = twig; + const { dir } = opt; + switch (comboName) { + case '+': { + const refNode = + dir === DIR_NEXT + ? node.nextElementSibling + : node.previousElementSibling; + if (refNode && this.#evaluator.matchLeaves(leaves, refNode, opt)) { + yield refNode; + } + break; + } + case '~': { + let refNode = + dir === DIR_NEXT + ? node.nextElementSibling + : node.previousElementSibling; + while (refNode) { + if (this.#evaluator.matchLeaves(leaves, refNode, opt)) { + yield refNode; + } + refNode = + dir === DIR_NEXT + ? refNode.nextElementSibling + : refNode.previousElementSibling; + } + break; + } + case '>': { + if (dir === DIR_NEXT) { + let refNode = node.firstElementChild; + while (refNode) { + if (this.#evaluator.matchLeaves(leaves, refNode, opt)) { + yield refNode; + } + refNode = refNode.nextElementSibling; + } + } else { + const { parentNode } = node; + if ( + parentNode && + this.#evaluator.matchLeaves(leaves, parentNode, opt) + ) { + yield parentNode; + } + } + break; + } + case ' ': + default: { + if (dir === DIR_NEXT) { + for (const refNode of this.yieldFindDescendantNodes( + leaves, + node, + opt + )) { + yield refNode; + } + } else { + const ancestors = []; + let refNode = node.parentNode; + while (refNode) { + if (this.#evaluator.matchLeaves(leaves, refNode, opt)) { + ancestors.push(refNode); + } + refNode = refNode.parentNode; + } + if (ancestors.length) { + for (let i = ancestors.length - 1; i >= 0; i--) { + yield ancestors[i]; + } + } + } + } + } + } + + /** + * Finds descendant nodes and yields matches. + * @param {Array} leaves - The AST leaves. + * @param {DocumentFragment|Element} baseNode - The base Element node or Element.shadowRoot. + * @param {import('../index.js').FindOptions} opt - Options. + * @yields {Element} The matched node. + */ + *yieldFindDescendantNodes(leaves, baseNode, opt) { + const [leaf] = leaves; + const { type: leafType } = leaf; + const leafName = this.#evaluator.getUnescapedName(leaf); + const filterLeaves = this.#evaluator.getFilterLeaves(leaves); + const isSimple = filterLeaves.length === 0; + switch (leafType) { + case ID_SELECTOR: { + if (canUseFastIdSearch(baseNode, this.#evaluator.root)) { + const foundNode = this.#evaluator.root.getElementById(leafName); + if ( + foundNode && + foundNode !== baseNode && + baseNode.contains(foundNode) + ) { + if ( + isSimple || + this.#evaluator.matchLeaves(filterLeaves, foundNode, opt) + ) { + yield foundNode; + return; + } + } + break; + } + break; + } + case CLASS_SELECTOR: { + if (canUseFastClassSearch(baseNode)) { + const collection = baseNode.getElementsByClassName(leafName); + for (let i = 0, len = collection.length; i < len; i++) { + const item = collection[i]; + if ( + isSimple || + this.#evaluator.matchLeaves(filterLeaves, item, opt) + ) { + yield item; + } + } + return; + } + break; + } + case TYPE_SELECTOR: { + if (canUseFastTagSearch(baseNode, leafName)) { + const collection = baseNode.getElementsByTagName(leafName); + for (let i = 0, len = collection.length; i < len; i++) { + const item = collection[i]; + if ( + isSimple || + this.#evaluator.matchLeaves(filterLeaves, item, opt) + ) { + yield item; + } + } + return; + } + break; + } + case PS_ELEMENT_SELECTOR: { + matchPseudoElementSelector(leafName, leafType, opt); + return; + } + default: { + // no-op + } + } + yield* this.yieldTraverseAllDescendants(baseNode, leaves, opt); + } + + /** + * Traverses all descendant nodes and yields matches. + * @param {DocumentFragment|Element} baseNode - The base Element node or Element.shadowRoot. + * @param {Array} leaves - The AST leaves. + * @param {import('../index.js').FindOptions} opt - Options. + * @yields {Element} The matched node. + */ + *yieldTraverseAllDescendants(baseNode, leaves, opt) { + const walker = this.createTreeWalker(baseNode); + traverseNode(baseNode, walker); + let currentNode = walker.firstChild(); + while (currentNode) { + if (this.#evaluator.matchLeaves(leaves, currentNode, opt)) { + yield currentNode; + } + currentNode = walker.nextNode(); + } + } +} diff --git a/node_modules/@asamuzakjp/dom-selector/src/js/utility.js b/node_modules/@asamuzakjp/dom-selector/src/js/utility.js new file mode 100644 index 0000000..160f288 --- /dev/null +++ b/node_modules/@asamuzakjp/dom-selector/src/js/utility.js @@ -0,0 +1,1132 @@ +/** + * utility.js + */ + +/* import */ +import bidiFactory from 'bidi-js'; +import isCustomElementName from 'is-potential-custom-element-name'; + +/* constants */ +import { + CLASS_SELECTOR, + DIR_NEXT, + DIR_PREV, + DOCUMENT_FRAGMENT_NODE, + DOCUMENT_NODE, + DOCUMENT_POSITION_CONTAINS, + DOCUMENT_POSITION_PRECEDING, + ELEMENT_NODE, + ID_SELECTOR, + INPUT_BUTTON, + INPUT_EDIT, + INPUT_LTR, + INPUT_TEXT, + MIME_HTML, + NS_HTML, + PS_ELEMENT_SELECTOR, + SHOW_ELEMENT, + SYNTAX_ERR, + TARGET_FIRST, + TEXT_NODE, + TYPE_FROM, + TYPE_SELECTOR, + TYPE_TO +} from './constant.js'; +const KEYS_DIR_AUTO = new Set([...INPUT_BUTTON, ...INPUT_TEXT, 'hidden']); +const KEYS_DIR_LTR = new Set(INPUT_LTR); +const KEYS_INPUT_EDIT = new Set(INPUT_EDIT); +const KEYS_NODE_DIR_EXCLUDE = new Set(['bdi', 'script', 'style', 'textarea']); +const KEYS_NODE_FOCUSABLE = new Set(['button', 'select', 'textarea']); +const KEYS_NODE_FOCUSABLE_SVG = new Set([ + 'clipPath', + 'defs', + 'desc', + 'linearGradient', + 'marker', + 'mask', + 'metadata', + 'pattern', + 'radialGradient', + 'script', + 'style', + 'symbol', + 'title' +]); + +/* regexp */ +const REG_IS_XHTML = /^(?:application\/xhtml\+x|text\/ht)ml$/; +const REG_IS_XML = + /^(?:application\/(?:[\w\-.]+\+)?|image\/[\w\-.]+\+|text\/)xml$/; +const REG_EXACT_ID_ATTRIBUTE = + /^\[id="([A-Za-z]\w*(?:-(?:\w*|\u00AB\w+\u00BB))*)"\]$/; +const REG_SIMPLE_ATTRIBUTE = /^\[([a-z][a-z\d_-]*)\]$/; + +/** + * Get type of an object. + * @param {object} o - Object to check. + * @returns {string} - Type of the object. + */ +export const getType = o => + Object.prototype.toString.call(o).slice(TYPE_FROM, TYPE_TO); + +/** + * Verify array contents. + * @param {Array} arr - The array. + * @param {string} type - Expected type, e.g. 'String'. + * @throws {TypeError} - Throws if array or its items are of unexpected type. + * @returns {Array} - The verified array. + */ +export const verifyArray = (arr, type) => { + if (!Array.isArray(arr)) { + throw new TypeError(`Unexpected type ${getType(arr)}`); + } + if (typeof type !== 'string') { + throw new TypeError(`Unexpected type ${getType(type)}`); + } + for (const item of arr) { + if (getType(item) !== type) { + throw new TypeError(`Unexpected type ${getType(item)}`); + } + } + return arr; +}; + +/** + * Generate a DOMException. + * @param {string} msg - The error message. + * @param {string} name - The error name. + * @param {object} [globalObject] - The global object (e.g., Window). + * @returns {DOMException} The generated DOMException object. + */ +export const generateException = (msg, name, globalObject = globalThis) => { + return new globalObject.DOMException(msg, name); +}; + +/** + * Stringify a value. + * @param {unknown} value - The value to stringify. + * @param {object} [globalObject] - The global object (e.g., Window). + * @returns {string} The stringifyed value. + */ +export const stringifyValue = (value, globalObject = globalThis) => { + if (typeof value === 'string') { + return value; + } + if (value === undefined || value === null || typeof value === 'boolean') { + return String(value); + } + if (Array.isArray(value)) { + return value.join(','); + } + if (Object.hasOwn(value, 'toString')) { + return value.toString(); + } + const error = generateException( + `Invalid selector ${value}`, + SYNTAX_ERR, + globalObject + ); + throw error; +}; + +/** + * Resolve content document, root node, and check if it's in a shadow DOM. + * @param {Document|DocumentFragment|Element} node - Document, DocumentFragment, or Element node. + * @returns {Array} - [document, root, isInShadow]. + */ +export const resolveContent = node => { + if (!node?.nodeType) { + throw new TypeError(`Unexpected type ${getType(node)}`); + } + let document; + let root; + let shadow; + switch (node.nodeType) { + case DOCUMENT_NODE: { + document = node; + root = node; + break; + } + case DOCUMENT_FRAGMENT_NODE: { + const { host, mode, ownerDocument } = node; + document = ownerDocument; + root = node; + shadow = host && (mode === 'close' || mode === 'open'); + break; + } + case ELEMENT_NODE: { + document = node.ownerDocument; + let refNode = node; + while (refNode) { + const { host, mode, nodeType, parentNode } = refNode; + if (nodeType === DOCUMENT_FRAGMENT_NODE) { + shadow = host && (mode === 'close' || mode === 'open'); + break; + } else if (parentNode) { + refNode = parentNode; + } else { + break; + } + } + root = refNode; + break; + } + default: { + throw new TypeError(`Unexpected node ${node.nodeName}`); + } + } + return [document, root, !!shadow]; +}; + +/** + * Traverse node tree with a TreeWalker. + * @param {Element} node - The target node. + * @param {TreeWalker} walker - The TreeWalker instance. + * @param {boolean} [force] - Traverse only to the next node. + * @returns {Element|null} - The current Element node if found, otherwise null. + */ +export const traverseNode = (node, walker, force = false) => { + if (!node?.nodeType) { + throw new TypeError(`Unexpected type ${getType(node)}`); + } + if (!walker) { + return null; + } + let refNode = walker.currentNode; + if (refNode === node) { + return refNode; + } else if (force || refNode.contains(node)) { + refNode = walker.nextNode(); + while (refNode) { + if (refNode === node) { + break; + } + refNode = walker.nextNode(); + } + return refNode; + } else { + if (refNode !== walker.root) { + let bool; + while (refNode) { + if (refNode === node) { + bool = true; + break; + } else if (refNode === walker.root || refNode.contains(node)) { + break; + } + refNode = walker.parentNode(); + } + if (bool) { + return refNode; + } + } + if (node.nodeType === ELEMENT_NODE) { + let bool; + while (refNode) { + if (refNode === node) { + bool = true; + break; + } + refNode = walker.nextNode(); + } + if (bool) { + return refNode; + } + } + } + return null; +}; + +/** + * Check if a node is an HTML element. + * @param {Element} node - The Element node. + * @returns {boolean} - True if it's the HTML element. + */ +export const isHTMLElement = node => { + if (!node?.nodeType) { + throw new TypeError(`Unexpected type ${getType(node)}`); + } + if (node.nodeType !== ELEMENT_NODE) { + return false; + } + const { namespaceURI, ownerDocument } = node; + return ( + ownerDocument.contentType === MIME_HTML && + (!namespaceURI || namespaceURI === NS_HTML) + ); +}; + +/** + * Check if a node is a custom element. + * @param {Element} node - The Element node. + * @param {object} [opt] - Options. + * @param {boolean} [opt.formAssociated] - True if the node is form associated. + * @returns {boolean} - True if it's the custom element. + */ +export const isCustomElement = (node, { formAssociated } = {}) => { + if (!node?.nodeType) { + throw new TypeError(`Unexpected type ${getType(node)}`); + } + if (node.nodeType !== ELEMENT_NODE) { + return false; + } + const { localName, ownerDocument } = node; + const window = ownerDocument.defaultView; + let elmConstructor; + const attr = node.getAttribute('is'); + if (attr) { + elmConstructor = + isCustomElementName(attr) && window.customElements.get(attr); + } else { + elmConstructor = + isCustomElementName(localName) && window.customElements.get(localName); + } + if (elmConstructor) { + if (formAssociated) { + return !!elmConstructor.formAssociated; + } + return true; + } + return false; +}; + +/** + * Get slotted text content. + * @param {Element} node - The Element node (likely a ). + * @returns {string|null} - The text content. + */ +export const getSlottedTextContent = node => { + if (!node?.nodeType) { + throw new TypeError(`Unexpected type ${getType(node)}`); + } + if (typeof node.assignedNodes !== 'function') { + return null; + } + const nodes = node.assignedNodes(); + if (nodes.length) { + let text = ''; + const l = nodes.length; + for (let i = 0; i < l; i++) { + const item = nodes[i]; + text = item.textContent.trim(); + if (text) { + break; + } + } + return text; + } + return node.textContent.trim(); +}; + +/** + * Get directionality of a node. + * @see https://html.spec.whatwg.org/multipage/dom.html#the-dir-attribute + * @param {Element} node - The Element node. + * @param {WeakMap} [dirCache] - Cache for directionality. + * @returns {string|null} - 'ltr' or 'rtl'. + */ +export const getDirectionality = (node, dirCache = new WeakMap()) => { + if (!node?.nodeType) { + throw new TypeError(`Unexpected type ${getType(node)}`); + } + if (node.nodeType !== ELEMENT_NODE) { + return null; + } + if (dirCache.has(node)) { + return dirCache.get(node); + } + const { dir: dirAttr, localName, parentNode } = node; + const { getEmbeddingLevels } = bidiFactory(); + let result = 'ltr'; + if (dirAttr === 'ltr' || dirAttr === 'rtl') { + result = dirAttr; + } else if (dirAttr === 'auto') { + let text = ''; + switch (localName) { + case 'input': { + if (!node.type || KEYS_DIR_AUTO.has(node.type)) { + text = node.value; + } else if (KEYS_DIR_LTR.has(node.type)) { + result = 'ltr'; + text = null; // Flag to skip text evaluation + } + break; + } + case 'slot': { + text = getSlottedTextContent(node); + break; + } + case 'textarea': { + text = node.value; + break; + } + default: { + const items = [].slice.call(node.childNodes); + for (const item of items) { + const { + dir: itemDir, + localName: itemLocalName, + nodeType: itemNodeType, + textContent: itemTextContent + } = item; + if (itemNodeType === TEXT_NODE) { + text = itemTextContent.trim(); + } else if ( + itemNodeType === ELEMENT_NODE && + !KEYS_NODE_DIR_EXCLUDE.has(itemLocalName) && + (!itemDir || (itemDir !== 'ltr' && itemDir !== 'rtl')) + ) { + if (itemLocalName === 'slot') { + text = getSlottedTextContent(item); + } else { + text = itemTextContent.trim(); + } + } + if (text) { + break; + } + } + } + } + if (text !== null) { + if (text) { + const { + paragraphs: [{ level }] + } = getEmbeddingLevels(text); + if (level % 2 === 1) { + result = 'rtl'; + } + } else if (parentNode) { + const { nodeType: parentNodeType } = parentNode; + if (parentNodeType === ELEMENT_NODE) { + result = getDirectionality(parentNode, dirCache); + } + } + } + } else if (localName === 'input' && node.type === 'tel') { + result = 'ltr'; + } else if (localName === 'bdi') { + const text = node.textContent.trim(); + if (text) { + const { + paragraphs: [{ level }] + } = getEmbeddingLevels(text); + if (level % 2 === 1) { + result = 'rtl'; + } + } + } else if (parentNode) { + if (localName === 'slot') { + const text = getSlottedTextContent(node); + if (text) { + const { + paragraphs: [{ level }] + } = getEmbeddingLevels(text); + if (level % 2 === 1) { + result = 'rtl'; + } else { + result = 'ltr'; + } + } else { + const { nodeType: parentNodeType } = parentNode; + if (parentNodeType === ELEMENT_NODE) { + result = getDirectionality(parentNode, dirCache); + } + } + } else { + const { nodeType: parentNodeType } = parentNode; + if (parentNodeType === ELEMENT_NODE) { + result = getDirectionality(parentNode, dirCache); + } + } + } + dirCache.set(node, result); + return result; +}; + +/** + * Get language attribute of a node. + * @param {Element} node - The Element node. + * @param {WeakMap} [langCache] - Cache for language attributes. + * @returns {string|null} - Language attribute value. + */ +export const getLanguageAttribute = (node, langCache = new WeakMap()) => { + if (!node?.nodeType) { + throw new TypeError(`Unexpected type ${getType(node)}`); + } + if (node.nodeType !== ELEMENT_NODE) { + return null; + } + if (langCache.has(node)) { + return langCache.get(node); + } + const { contentType } = node.ownerDocument; + const isHtml = REG_IS_XHTML.test(contentType); + const isXml = REG_IS_XML.test(contentType); + let isShadow = false; + let result; + const visited = []; + // Traverse up from the current node to the root. + let current = node; + while (current) { + if (current.nodeType === ELEMENT_NODE && langCache.has(current)) { + result = langCache.get(current); + break; + } + if (current.nodeType === ELEMENT_NODE) { + visited.push(current); + } + // Check if the current node is an element. + switch (current.nodeType) { + case ELEMENT_NODE: { + // Check for and return the language attribute if present. + if (isHtml && current.hasAttribute('lang')) { + result = current.getAttribute('lang'); + } else if (isXml && current.hasAttribute('xml:lang')) { + result = current.getAttribute('xml:lang'); + } + break; + } + case DOCUMENT_FRAGMENT_NODE: { + // Continue traversal if the current node is a shadow root. + if (current.host) { + isShadow = true; + } + break; + } + case DOCUMENT_NODE: + default: { + // Stop if we reach the root document node. + result = null; + } + } + if (result !== undefined) { + break; + } + if (isShadow) { + current = current.host; + isShadow = false; + } else if (current.parentNode) { + current = current.parentNode; + } else { + break; + } + } + if (result === undefined) { + result = null; + } + for (const visitedNode of visited) { + langCache.set(visitedNode, result); + } + return result; +}; + +/** + * Check if content is editable. + * NOTE: Not implemented in jsdom https://github.com/jsdom/jsdom/issues/1670 + * @param {Element} node - The Element node. + * @returns {boolean} - True if content is editable. + */ +export const isContentEditable = node => { + if (!node?.nodeType) { + throw new TypeError(`Unexpected type ${getType(node)}`); + } + if (node.nodeType !== ELEMENT_NODE) { + return false; + } + if (typeof node.isContentEditable === 'boolean') { + return node.isContentEditable; + } else if (node.ownerDocument.designMode === 'on') { + return true; + } else { + let attr; + if (node.hasAttribute('contenteditable')) { + attr = node.getAttribute('contenteditable'); + } else { + attr = 'inherit'; + } + switch (attr) { + case '': + case 'true': { + return true; + } + case 'plaintext-only': { + // FIXME: + // @see https://github.com/w3c/editing/issues/470 + // @see https://github.com/whatwg/html/issues/10651 + return true; + } + case 'false': { + return false; + } + default: { + if (node?.parentNode?.nodeType === ELEMENT_NODE) { + return isContentEditable(node.parentNode); + } + return false; + } + } + } +}; + +/** + * Check if a node is visible. + * @param {Element} node - The Element node. + * @returns {boolean} - True if the node is visible. + */ +export const isVisible = node => { + if (node?.nodeType !== ELEMENT_NODE) { + return false; + } + // TODO: switch to node.checkVisibility(). + const window = node.ownerDocument.defaultView; + const { display, visibility } = window.getComputedStyle(node); + return display !== 'none' && visibility === 'visible'; +}; + +/** + * Check if focus is visible on the node. + * @param {Element} node - The Element node. + * @returns {boolean} - True if focus is visible. + */ +export const isFocusVisible = node => { + if (node?.nodeType !== ELEMENT_NODE) { + return false; + } + const { localName, type } = node; + switch (localName) { + case 'input': { + if (!type || KEYS_INPUT_EDIT.has(type)) { + return true; + } + return false; + } + case 'textarea': { + return true; + } + default: { + return isContentEditable(node); + } + } +}; + +/** + * Check if an area is focusable. + * @param {Element} node - The Element node. + * @returns {boolean} - True if the area is focusable. + */ +export const isFocusableArea = node => { + if (node?.nodeType !== ELEMENT_NODE) { + return false; + } + if (!node.isConnected) { + return false; + } + const window = node.ownerDocument.defaultView; + if (node instanceof window.HTMLElement) { + if (Number.isInteger(parseInt(node.getAttribute('tabindex')))) { + return true; + } + if (isContentEditable(node)) { + return true; + } + const { localName, parentNode } = node; + switch (localName) { + case 'a': { + if (node.href || node.hasAttribute('href')) { + return true; + } + return false; + } + case 'iframe': { + return true; + } + case 'input': { + if ( + node.disabled || + node.hasAttribute('disabled') || + node.hidden || + node.hasAttribute('hidden') + ) { + return false; + } + return true; + } + case 'summary': { + if (parentNode.localName === 'details') { + let child = parentNode.firstElementChild; + let bool = false; + while (child) { + if (child.localName === 'summary') { + bool = child === node; + break; + } + child = child.nextElementSibling; + } + return bool; + } + return false; + } + default: { + if ( + KEYS_NODE_FOCUSABLE.has(localName) && + !(node.disabled || node.hasAttribute('disabled')) + ) { + return true; + } + } + } + } else if (node instanceof window.SVGElement) { + if (Number.isInteger(parseInt(node.getAttributeNS(null, 'tabindex')))) { + const ns = 'http://www.w3.org/2000/svg'; + let bool; + let refNode = node; + while (refNode.namespaceURI === ns) { + bool = KEYS_NODE_FOCUSABLE_SVG.has(refNode.localName); + if (bool) { + break; + } + if (refNode?.parentNode?.namespaceURI === ns) { + refNode = refNode.parentNode; + } else { + break; + } + } + if (bool) { + return false; + } + return true; + } + if ( + node.localName === 'a' && + (node.href || node.hasAttributeNS(null, 'href')) + ) { + return true; + } + } + return false; +}; + +/** + * Check if a node is focusable. + * NOTE: Not applied, needs fix in jsdom itself. + * @see https://github.com/whatwg/html/pull/8392 + * @see https://phabricator.services.mozilla.com/D156219 + * @see https://github.com/jsdom/jsdom/issues/3029 + * @see https://github.com/jsdom/jsdom/issues/3464 + * @param {Element} node - The Element node. + * @returns {boolean} - True if the node is focusable. + */ +export const isFocusable = node => { + if (node?.nodeType !== ELEMENT_NODE) { + return false; + } + const window = node.ownerDocument.defaultView; + let refNode = node; + let res = true; + while (refNode) { + if (refNode.disabled || refNode.hasAttribute('disabled')) { + res = false; + break; + } + if (refNode.hidden || refNode.hasAttribute('hidden')) { + res = false; + } + const { contentVisibility, display, visibility } = + window.getComputedStyle(refNode); + if ( + display === 'none' || + visibility !== 'visible' || + (contentVisibility === 'hidden' && refNode !== node) + ) { + res = false; + } else { + res = true; + } + if (res && refNode?.parentNode?.nodeType === ELEMENT_NODE) { + refNode = refNode.parentNode; + } else { + break; + } + } + return res; +}; + +/** + * Get namespace URI. + * @param {string} ns - The namespace prefix. + * @param {Element} node - The Element node. + * @returns {string|null} - The namespace URI. + */ +export const getNamespaceURI = (ns, node) => { + if (typeof ns !== 'string') { + throw new TypeError(`Unexpected type ${getType(ns)}`); + } else if (!node?.nodeType) { + throw new TypeError(`Unexpected type ${getType(node)}`); + } + if (!ns || node.nodeType !== ELEMENT_NODE) { + return null; + } + const { attributes } = node; + let res; + for (const attr of attributes) { + const { name, namespaceURI, prefix, value } = attr; + if (name === `xmlns:${ns}`) { + res = value; + } else if (prefix === ns) { + res = namespaceURI; + } + if (res) { + break; + } + } + return res ?? null; +}; + +/** + * Check if a namespace is declared. + * @param {string} [ns] - The namespace. + * @param {Element} [node] - The Element node. + * @returns {boolean} - True if the namespace is declared. + */ +export const isNamespaceDeclared = (ns = '', node = {}) => { + if (!ns || typeof ns !== 'string' || node?.nodeType !== ELEMENT_NODE) { + return false; + } + if (node.lookupNamespaceURI(ns)) { + return true; + } + const root = node.ownerDocument.documentElement; + let parent = node; + let res; + while (parent) { + res = getNamespaceURI(ns, parent); + if (res || parent === root) { + break; + } + parent = parent.parentNode; + } + return !!res; +}; + +/** + * Check if nodeA precedes and/or contains nodeB. + * @param {Element} nodeA - The first Element node. + * @param {Element} nodeB - The second Element node. + * @returns {boolean} - True if nodeA precedes nodeB. + */ +export const isPreceding = (nodeA, nodeB) => { + if (!nodeA?.nodeType) { + throw new TypeError(`Unexpected type ${getType(nodeA)}`); + } else if (!nodeB?.nodeType) { + throw new TypeError(`Unexpected type ${getType(nodeB)}`); + } + if (nodeA.nodeType !== ELEMENT_NODE || nodeB.nodeType !== ELEMENT_NODE) { + return false; + } + const posBit = nodeB.compareDocumentPosition(nodeA); + const res = + posBit & DOCUMENT_POSITION_PRECEDING || posBit & DOCUMENT_POSITION_CONTAINS; + return !!res; +}; + +/** + * Comparison function for sorting nodes based on document position. + * @param {Element} a - The first node. + * @param {Element} b - The second node. + * @returns {number} - Sort order. + */ +export const compareNodes = (a, b) => { + if (isPreceding(b, a)) { + return 1; + } + return -1; +}; + +/** + * Sort a collection of nodes. + * @param {Array|Set} [nodes] - Collection of nodes. + * @returns {Array} - Collection of sorted nodes. + */ +export const sortNodes = (nodes = []) => { + const arr = [...nodes]; + if (arr.length > 1) { + arr.sort(compareNodes); + } + return arr; +}; + +/** + * Traverses AST nodes to find the most optimal seed selector + * (ID > Class > Tag). + * @param {Array} nodes - AST nodes to traverse. + * @param {object} [state] - The current state of the search. + * @returns {object} The search state containing the best seed. + */ +export const findBestSeed = (nodes, state = { seed: null, priority: 0 }) => { + for (const node of nodes) { + if (state.priority === 3) { + return state; + } + if (Array.isArray(node)) { + findBestSeed(node, state); + } else if (node && typeof node === 'object') { + if (node.type === ID_SELECTOR && nodes.length === 1) { + state.seed = { type: 'id', value: node.name }; + state.priority = 3; + return state; + } + if (node.type === CLASS_SELECTOR && state.priority < 2) { + state.seed = { type: 'class', value: node.name }; + state.priority = 2; + } else if ( + node.type === TYPE_SELECTOR && + state.priority < 1 && + node.name && + node.name !== '*' + ) { + state.seed = { type: 'tag', value: node.name }; + state.priority = 1; + } + } + } + return state; +}; + +/** + * Traces the DOM tree upwards and sideways from a seed element, + * populating the allowlist with safe paths for :has() evaluation. + * @param {Element} current - The starting seed element. + * @param {WeakSet} list - The WeakSet to populate. + * @param {Set} visitedAncestors - The Set to track visited nodes. + * @returns {void} + */ +export const populateHasAllowlist = (current, list, visitedAncestors) => { + list.add(current); + while ( + current && + (current.nodeType === ELEMENT_NODE || + current.nodeType === DOCUMENT_FRAGMENT_NODE) + ) { + if (visitedAncestors.has(current)) { + break; + } + visitedAncestors.add(current); + let sibling = current.previousElementSibling; + while (sibling) { + list.add(sibling); + sibling = sibling.previousElementSibling; + } + sibling = current.nextElementSibling; + while (sibling) { + list.add(sibling); + sibling = sibling.nextElementSibling; + } + current = current.parentNode; + if (current) { + list.add(current); + } + } +}; + +/** + * Collects all descendant elements of a given node using a TreeWalker. + * @param {Document|DocumentFragment|Element} node - The node to start from. + * @param {Document} document - The Document used to create the TreeWalker. + * @returns {Array} An array containing all descendant elements. + */ +export const collectAllDescendants = (node, document) => { + if (!node?.nodeType) { + throw new TypeError(`Unexpected type ${getType(node)}`); + } + if (document?.nodeType !== DOCUMENT_NODE) { + throw new TypeError(`Unexpected type ${getType(document)}`); + } + const walker = document.createTreeWalker(node, SHOW_ELEMENT); + const descendants = []; + let refNode = walker.nextNode(); + while (refNode) { + descendants.push(refNode); + refNode = walker.nextNode(); + } + return descendants; +}; + +/** + * Tests whether an element has an attribute with the given local name. + * @param {Element} node - The element to test. + * @param {string} name - The lower-case attribute local name. + * @returns {boolean} `true` if the attribute is present. + */ +export const hasAttributeLocalName = (node, name) => { + if (node.hasAttribute(name)) { + return true; + } + const names = node.getAttributeNames(); + for (const itemName of names) { + const colonIndex = itemName.indexOf(':'); + if (colonIndex > -1) { + const localName = itemName.slice(colonIndex + 1); + if ( + localName === name || + (isHTMLElement(node) && localName.toLowerCase() === name) + ) { + return true; + } + } + } + return false; +}; + +/** + * Finds the first descendant for an exact ID attribute selector. + * @param {string} selector - The CSS selector to match against. + * @param {Document|DocumentFragment|Element} node - The node to find within. + * @returns {Element|null|undefined} The matching element, `null` if no ID exists, + * or `undefined` when the normal selector engine must be used. + */ +export const findByExactIdAttribute = (selector, node) => { + if (typeof selector !== 'string') { + return; + } + if (!node?.nodeType) { + return; + } + const match = REG_EXACT_ID_ATTRIBUTE.exec(selector); + if (!match) { + return; + } + const [, id] = match; + if (node.nodeType === DOCUMENT_NODE) { + return node.getElementById(id); + } + if ( + node.nodeType !== ELEMENT_NODE || + node.getRootNode() !== node.ownerDocument + ) { + return; + } + const candidate = node.ownerDocument.getElementById(id); + if (candidate === null) { + return null; + } + if (candidate !== node && node.contains(candidate)) { + return candidate; + } +}; + +/** + * Finds descendants for simple attribute-presence selectors. + * @param {string} selector - The CSS selector to match against. + * @param {Document|DocumentFragment|Element} node - The node to find within. + * @returns {Array|null} Matching elements, or `null` when this function does not apply. + */ +export const findBySimpleAttribute = (selector, node) => { + if (typeof selector !== 'string') { + return null; + } + if (!node?.nodeType) { + return null; + } + const match = REG_SIMPLE_ATTRIBUTE.exec(selector); + if (!match) { + return null; + } + const [, name] = match; + // Finder deliberately excludes xml:lang from unprefixed [lang]. + if (name === 'lang') { + return null; + } + const { nodeType } = node; + const isQueryContext = + nodeType === DOCUMENT_NODE || + nodeType === DOCUMENT_FRAGMENT_NODE || + nodeType === ELEMENT_NODE; + if (!isQueryContext) { + return null; + } + const document = nodeType === DOCUMENT_NODE ? node : node.ownerDocument; + if (document.contentType !== MIME_HTML) { + return null; + } + const walker = document.createTreeWalker(node, SHOW_ELEMENT); + const nodes = []; + let nextNode = walker.nextNode(); + while (nextNode) { + if (hasAttributeLocalName(nextNode, name)) { + nodes.push(nextNode); + } + nextNode = walker.nextNode(); + } + return nodes; +}; + +/** + * Gets the traversal direction and starting twig. + * @param {Array} branch - The selector branch. + * @param {string} targetType - The target type. + * @param {boolean} hasScope - True if selector includes ':scope'. + * @param {boolean} scoped - True if traversal is scoped within target node. + * @returns {object} Object containing dir and twig properties. + */ +export const getTraversalStrategy = (branch, targetType, hasScope, scoped) => { + const branchLen = branch.length; + const firstTwig = branch[0]; + if (branchLen === 1) { + return { dir: DIR_PREV, twig: firstTwig }; + } + const lastTwig = branch[branchLen - 1]; + const { + leaves: [{ name: firstName, type: firstType }] + } = firstTwig; + const { + leaves: [{ name: lastName, type: lastType }] + } = lastTwig; + const lastCombo = branch[branchLen - 2].combo?.name; + if ( + hasScope || + lastType === PS_ELEMENT_SELECTOR || + lastType === ID_SELECTOR || + lastCombo === '+' || + lastCombo === '~' + ) { + return { dir: DIR_PREV, twig: lastTwig }; + } else if (firstType === ID_SELECTOR) { + return { dir: DIR_NEXT, twig: firstTwig }; + } else if (firstName === '*' && firstType === TYPE_SELECTOR) { + return { dir: DIR_PREV, twig: lastTwig }; + } else if (lastName === '*' && lastType === TYPE_SELECTOR) { + return { dir: DIR_NEXT, twig: firstTwig }; + } else if (branchLen === 2) { + return { dir: DIR_PREV, twig: lastTwig }; + } else if (scoped && targetType === TARGET_FIRST) { + return { dir: DIR_PREV, twig: lastTwig }; + } + return { dir: DIR_NEXT, twig: firstTwig }; +}; + +/** + * Checks if the fast ID search (getElementById) is applicable. + * @param {Element} node - The starting node for the search. + * @param {Document|DocumentFragment|Element} root - The root node of the tree. + * @returns {boolean} True if fast ID search is applicable, otherwise false. + */ +export const canUseFastIdSearch = (node, root) => + node.nodeType === ELEMENT_NODE && root.nodeType !== ELEMENT_NODE; + +/** + * Checks if the fast class search (getElementsByClassName) is applicable. + * @param {Document|DocumentFragment|Element} node - The node to search within. + * @returns {boolean} True if fast class search is applicable, otherwise false. + */ +export const canUseFastClassSearch = node => + typeof node.getElementsByClassName === 'function'; + +/** + * Checks if the fast tag search (getElementsByTagName) is applicable. + * @param {Document|DocumentFragment|Element} node - The node to search within. + * @param {string} leafName - The tag name to search for. + * @returns {boolean} True if fast tag search is applicable, otherwise false. + */ +export const canUseFastTagSearch = (node, leafName) => + typeof node.getElementsByTagName === 'function' && !leafName.includes('|'); diff --git a/node_modules/@asamuzakjp/dom-selector/types/index.d.ts b/node_modules/@asamuzakjp/dom-selector/types/index.d.ts new file mode 100644 index 0000000..9867707 --- /dev/null +++ b/node_modules/@asamuzakjp/dom-selector/types/index.d.ts @@ -0,0 +1,54 @@ +/*! + * DOM Selector - A CSS selector engine. + * @license MIT + * @copyright asamuzaK (Kazz) + * @see {@link https://github.com/asamuzaK/domSelector/blob/main/LICENSE} + */ +export type CheckResult = { + match: boolean; + pseudoElement: string | null; + ast: import('css-tree').CssNode | null; + error: DOMException | Error | null; +}; +export type SelectorSubject = { + id: string | null; + className: string | null; + tag: string | null; +}; +export type UserOptions = { + noexcept?: boolean; + warn?: boolean; +}; +export type FindOptions = { + dir?: string; + check?: boolean; + forgive?: boolean; + noexcept?: boolean; + warn?: boolean; + isShadowRoot?: boolean; + globalObject?: object; +}; +export declare class DOMSelector { + #private; + constructor(window: Window, document: Document, opt?: { + cacheSize?: number; + idlUtils?: object; + maxLength?: number; + }); + clear(clearAll?: boolean): void; + extractSubjects(selector: string, caseSensitive?: boolean): Array; + supports(selector: string): boolean; + check(selector: string, node: Element, opt?: { + requireAst?: boolean; + }): CheckResult; + matches(selector: string, node: Element, opt?: UserOptions): boolean; + closest(selector: string, node: Element, opt?: UserOptions): Element | null; + querySelector(selector: string, node: Document | DocumentFragment | Element, opt?: UserOptions): Element | null; + querySelectorAll(selector: string, node: Document | DocumentFragment | Element, opt?: UserOptions): Array; + private #cloneAST; + private #wrapNode; + private #validateSelector; + private #validateNodeType; + private #tryNwsapi; + private #findNodes; +} diff --git a/node_modules/@asamuzakjp/dom-selector/types/js/constant.d.ts b/node_modules/@asamuzakjp/dom-selector/types/js/constant.d.ts new file mode 100644 index 0000000..e4cf1c1 --- /dev/null +++ b/node_modules/@asamuzakjp/dom-selector/types/js/constant.d.ts @@ -0,0 +1,94 @@ +export declare const ATRULE = "Atrule"; +export declare const ATTR_SELECTOR = "AttributeSelector"; +export declare const CLASS_SELECTOR = "ClassSelector"; +export declare const COMBINATOR = "Combinator"; +export declare const DIR_NEXT = "next"; +export declare const DIR_PREV = "prev"; +export declare const IDENT = "Identifier"; +export declare const ID_SELECTOR = "IdSelector"; +export declare const NEST_SELECTOR = "NestingSelector"; +export declare const NOT_SUPPORTED_ERR = "NotSupportedError"; +export declare const NTH = "Nth"; +export declare const OPERATOR = "Operator"; +export declare const PS_CLASS_SELECTOR = "PseudoClassSelector"; +export declare const PS_ELEMENT_SELECTOR = "PseudoElementSelector"; +export declare const RULE = "Rule"; +export declare const SCOPE = "Scope"; +export declare const SELECTOR = "Selector"; +export declare const SELECTOR_LIST = "SelectorList"; +export declare const STRING = "String"; +export declare const SYNTAX_ERR = "SyntaxError"; +export declare const TARGET_ALL = "all"; +export declare const TARGET_FIRST = "first"; +export declare const TARGET_LINEAL = "lineal"; +export declare const TARGET_SELF = "self"; +export declare const TYPE_SELECTOR = "TypeSelector"; +export declare const BIT_01 = 1; +export declare const BIT_02 = 2; +export declare const BIT_04 = 4; +export declare const BIT_08 = 8; +export declare const BIT_16 = 16; +export declare const BIT_32 = 32; +export declare const BIT_FFFF = 65535; +export declare const DUO = 2; +export declare const HEX = 16; +export declare const TYPE_FROM = 8; +export declare const TYPE_TO = -1; +export declare const ELEMENT_NODE = 1; +export declare const TEXT_NODE = 3; +export declare const DOCUMENT_NODE = 9; +export declare const DOCUMENT_FRAGMENT_NODE = 11; +export declare const DOCUMENT_POSITION_PRECEDING = 2; +export declare const DOCUMENT_POSITION_CONTAINS = 8; +export declare const DOCUMENT_POSITION_CONTAINED_BY = 16; +export declare const FILTER_ACCEPT = 1; +export declare const FILTER_REJECT = 2; +export declare const FILTER_SKIP = 3; +export declare const SHOW_ALL = 4294967295; +export declare const SHOW_CONTAINER = 1281; +export declare const SHOW_DOCUMENT = 256; +export declare const SHOW_DOCUMENT_FRAGMENT = 1024; +export declare const SHOW_ELEMENT = 1; +export declare const ALPHA_NUM = "[A-Z\\d]+"; +export declare const CHILD_IDX = "(?:first|last|only)-(?:child|of-type)"; +export declare const DIGIT = "(?:0|[1-9]\\d*)"; +export declare const LANG_ALPHA_NUM = "[A-Z\\d]{1,8}"; +export declare const LANG_SKIP_ALPHA_NUM = "[A-Z\\d]{2,8}"; +export declare const LANG_PART = "(?:-[A-Z\\d]{1,8})*"; +export declare const LANG_PART_SKIP = "(?:-[A-Z\\d]{2,8})*"; +export declare const PSEUDO_CLASS = "(?:any-)?link|(?:first|last|only)-(?:child|of-type)|checked|empty|indeterminate|read-(?:only|write)|target"; +export declare const ANB = "[+-]?(?:(?:0|[1-9]\\d*)n?|n)|(?:[+-]?(?:0|[1-9]\\d*))?n\\s*[+-]\\s*(?:0|[1-9]\\d*)"; +export declare const COMBO = "\\s?[\\s>~+]\\s?"; +export declare const DESCEND = "\\s?[\\s>]\\s?"; +export declare const SIBLING = "\\s?[+~]\\s?"; +export declare const LOGIC_IS = ":is\\(\\s*[^)]+\\s*\\)"; +export declare const N_TH = "nth-(?:last-)?(?:child|of-type)\\(\\s*(?:even|odd|[+-]?(?:(?:0|[1-9]\\d*)n?|n)|(?:[+-]?(?:0|[1-9]\\d*))?n\\s*[+-]\\s*(?:0|[1-9]\\d*))\\s*\\)"; +export declare const ATTR_TYPE = "\\[[^|\\]]+\\]"; +export declare const SUB_TYPE = "\\[[^|\\]]+\\]|[#.:][\\w-]+"; +export declare const SUB_TYPE_WO_PSEUDO = "\\[[^|\\]]+\\]|[#.][\\w-]+"; +export declare const TAG_TYPE_WO_UNIVERSAL = "[A-Za-z][\\w-]*"; +export declare const TAG_TYPE = "\\*|[A-Za-z][\\w-]*"; +export declare const TAG_TYPE_I = "\\*|[A-Z][\\w-]*"; +export declare const COMPOUND = "(?:\\*|[A-Za-z][\\w-]*|(?:\\*|[A-Za-z][\\w-]*)?(?:\\[[^|\\]]+\\]|[#.:][\\w-]+)+)"; +export declare const COMPOUND_L = "(?:\\*|[A-Za-z][\\w-]*|(?:\\*|[A-Za-z][\\w-]*)?(?:\\[[^|\\]]+\\]|[#.:][\\w-]+|:is\\(\\s*[^)]+\\s*\\))+)"; +export declare const COMPOUND_I = "(?:\\*|[A-Z][\\w-]*|(?:\\*|[A-Z][\\w-]*)?(?:\\[[^|\\]]+\\]|[#.:][\\w-]+)+)"; +export declare const COMPOUND_WO_PSEUDO = "(?:\\*|[A-Za-z][\\w-]*|(?:\\*|[A-Za-z][\\w-]*)?(?:\\[[^|\\]]+\\]|[#.][\\w-]+)+)"; +export declare const COMPLEX = "(?:\\*|[A-Za-z][\\w-]*|(?:\\*|[A-Za-z][\\w-]*)?(?:\\[[^|\\]]+\\]|[#.:][\\w-]+)+)(?:\\s?[\\s>~+]\\s?(?:\\*|[A-Za-z][\\w-]*|(?:\\*|[A-Za-z][\\w-]*)?(?:\\[[^|\\]]+\\]|[#.:][\\w-]+)+))*"; +export declare const COMPLEX_L = "(?:\\*|[A-Za-z][\\w-]*|(?:\\*|[A-Za-z][\\w-]*)?(?:\\[[^|\\]]+\\]|[#.:][\\w-]+|:is\\(\\s*[^)]+\\s*\\))+)(?:\\s?[\\s>~+]\\s?(?:\\*|[A-Za-z][\\w-]*|(?:\\*|[A-Za-z][\\w-]*)?(?:\\[[^|\\]]+\\]|[#.:][\\w-]+|:is\\(\\s*[^)]+\\s*\\))+))*"; +export declare const HAS_COMPOUND = "has\\([\\s>]?\\s*(?:\\*|[A-Za-z][\\w-]*|(?:\\*|[A-Za-z][\\w-]*)?(?:\\[[^|\\]]+\\]|[#.][\\w-]+)+)\\s*\\)"; +export declare const LOGIC_COMPOUND = "(?:is|not)\\(\\s*(?:\\*|[A-Za-z][\\w-]*|(?:\\*|[A-Za-z][\\w-]*)?(?:\\[[^|\\]]+\\]|[#.:][\\w-]+|:is\\(\\s*[^)]+\\s*\\))+)(?:\\s*,\\s*(?:\\*|[A-Za-z][\\w-]*|(?:\\*|[A-Za-z][\\w-]*)?(?:\\[[^|\\]]+\\]|[#.:][\\w-]+|:is\\(\\s*[^)]+\\s*\\))+))*\\s*\\)"; +export declare const LOGIC_COMPLEX = "(?:is|not)\\(\\s*(?:\\*|[A-Za-z][\\w-]*|(?:\\*|[A-Za-z][\\w-]*)?(?:\\[[^|\\]]+\\]|[#.:][\\w-]+|:is\\(\\s*[^)]+\\s*\\))+)(?:\\s?[\\s>~+]\\s?(?:\\*|[A-Za-z][\\w-]*|(?:\\*|[A-Za-z][\\w-]*)?(?:\\[[^|\\]]+\\]|[#.:][\\w-]+|:is\\(\\s*[^)]+\\s*\\))+))*(?:\\s*,\\s*(?:\\*|[A-Za-z][\\w-]*|(?:\\*|[A-Za-z][\\w-]*)?(?:\\[[^|\\]]+\\]|[#.:][\\w-]+|:is\\(\\s*[^)]+\\s*\\))+)(?:\\s?[\\s>~+]\\s?(?:\\*|[A-Za-z][\\w-]*|(?:\\*|[A-Za-z][\\w-]*)?(?:\\[[^|\\]]+\\]|[#.:][\\w-]+|:is\\(\\s*[^)]+\\s*\\))+))*)*\\s*\\)"; +export declare const FORM_PARTS: Array; +export declare const INPUT_BUTTON: Array; +export declare const INPUT_CHECK: Array; +export declare const INPUT_DATE: Array; +export declare const INPUT_TEXT: Array; +export declare const INPUT_EDIT: Array; +export declare const INPUT_LTR: Array; +export declare const ATTR_VALUE_I: Array; +export declare const KEYS_LOGICAL: Set; +export declare const KEYS_PS_CLASS_SUPPORTED: Set; +export declare const KEYS_PS_CLASS_UNSUPPORTED: Set; +export declare const KEYS_PS_ELEMENT_UNSUPPORTED: Set; +export declare const MIME_HTML: string; +export declare const NS_HTML: string; diff --git a/node_modules/@asamuzakjp/dom-selector/types/js/evaluator.d.ts b/node_modules/@asamuzakjp/dom-selector/types/js/evaluator.d.ts new file mode 100644 index 0000000..28f6a8b --- /dev/null +++ b/node_modules/@asamuzakjp/dom-selector/types/js/evaluator.d.ts @@ -0,0 +1,30 @@ +import { EventHandler } from './event.js'; +export declare class Evaluator { + #private; + window: Window; + documentCache: WeakMap; + check: boolean | undefined; + noexcept: boolean | undefined; + warn: boolean | undefined; + node: Document | DocumentFragment | Element | undefined; + pseudoElements: any[] | undefined; + constructor(window: Window); + get eventHandler(): EventHandler; + get invalidate(): boolean; + set invalidate(value: boolean); + get verifyShadowHost(): boolean; + setup(selector: string, node: Document | DocumentFragment | Element, opt?: import('../index.js').FindOptions): Evaluator; + onError(e: Error, opt?: import('../index.js').FindOptions): void; + destroy(): void; + clearResults(all?: boolean): void; + matchSelector(ast: import('css-tree').CssNode, node: Document | DocumentFragment | Element, opt: import('../index.js').FindOptions): boolean; + matchLeaves(leaves: Array, node: Element, opt?: import('../index.js').FindOptions): boolean; + getFilterLeaves(leaves: Array): Array; + getUnescapedName(ast: import('css-tree').CssNode): string; + evaluateShadowHost(ast: import('css-tree').CssNode, node: DocumentFragment): boolean; + matchPseudoClassSelector(ast: import('css-tree').CssNode, node: Element, opt: import('../index.js').FindOptions): boolean; + createTreeWalker(node: Document | DocumentFragment | Element, opt: object): TreeWalker; + yieldCombinatorMatches(twig: import('./processor.js').ProcessedBranch, node: Element, opt: import('../index.js').FindOptions): Generator; + yieldFindDescendantNodes(leaves: Array, baseNode: DocumentFragment | Element, opt: import('../index.js').FindOptions): Generator; + private #matchSelectorForElement; +} diff --git a/node_modules/@asamuzakjp/dom-selector/types/js/event.d.ts b/node_modules/@asamuzakjp/dom-selector/types/js/event.d.ts new file mode 100644 index 0000000..564ba02 --- /dev/null +++ b/node_modules/@asamuzakjp/dom-selector/types/js/event.d.ts @@ -0,0 +1,13 @@ +export declare class EventHandler { + #private; + constructor(window: Window); + get currentEvent(): Event | null; + get currentFocus(): Event | null; + get lastFocusVisible(): Element | null; + set lastFocusVisible(node: Element); + handleFocusEvent(evt: Event): void; + handleKeyboardEvent(evt: KeyboardEvent): void; + handleMouseEvent(evt: MouseEvent): void; + registerEventListeners(): void; + destroy(): void; +} diff --git a/node_modules/@asamuzakjp/dom-selector/types/js/finder.d.ts b/node_modules/@asamuzakjp/dom-selector/types/js/finder.d.ts new file mode 100644 index 0000000..882d578 --- /dev/null +++ b/node_modules/@asamuzakjp/dom-selector/types/js/finder.d.ts @@ -0,0 +1,43 @@ +import { Evaluator } from './evaluator.js'; +export type StrategyOptions = { + complex?: boolean; + precede?: boolean; + dir?: string; + filterLeaves?: Array; +}; +export type TraversalOptions = { + force?: boolean; + precede?: boolean; + boundaryNode?: Element; + startNode?: Element; + targetType?: string; +}; +export declare class Finder extends Evaluator { + #private; + get selectorAST(): import('css-tree').CssNode | null; + setup(selector: string, node: Document | DocumentFragment | Element, opt: import('../index.js').FindOptions): Finder; + find(targetType: string): Set | import('../index.js').CheckResult; + private #collectNodes; + private #findEntryNodes; + private #findEntryNodesForPseudoElement; + private #findEntryNodesForId; + private #findEntryNodesForClass; + private #findEntryNodesForType; + private #findEntryNodesForOther; + private #processPendingItems; + private #processComplexBranchAll; + private #dfsComplexBranchNext; + private #processComplexBranchFirst; + private #processComplexBranchFirstNext; + private #matchNodeNext; + private #processComplexBranchFirstPrev; + private #hasValidPathPrev; + private #checkSelfOrLinealTarget; + private #matchSelf; + private #findLineal; + private #filterAndFormatCollection; + private #fallbackToWalkerResult; + private #findNodeWalker; + private #findPrecede; + private #traverseAndCollectNodes; +} diff --git a/node_modules/@asamuzakjp/dom-selector/types/js/mapper.d.ts b/node_modules/@asamuzakjp/dom-selector/types/js/mapper.d.ts new file mode 100644 index 0000000..a7fb15e --- /dev/null +++ b/node_modules/@asamuzakjp/dom-selector/types/js/mapper.d.ts @@ -0,0 +1,12 @@ +export type MapperResult = { + ast: Array; + invalidate: boolean; + nodes: Array>; + selectorAST: import('css-tree').CssNode; +}; +export declare class Mapper { + #private; + constructor(context: import('./finder.js').Finder); + correspond(selector: string): MapperResult; + private #prepareResult; +} diff --git a/node_modules/@asamuzakjp/dom-selector/types/js/matcher.d.ts b/node_modules/@asamuzakjp/dom-selector/types/js/matcher.d.ts new file mode 100644 index 0000000..eda0d3f --- /dev/null +++ b/node_modules/@asamuzakjp/dom-selector/types/js/matcher.d.ts @@ -0,0 +1,12 @@ +export declare const matchPseudoElementSelector: (astName: string, astType: string, { forgive, globalObject, warn }?: import('../index.js').FindOptions) => void; +export declare const matchDirectionPseudoClass: (ast: import('css-tree').CssNode, node: Element, dirCache?: WeakMap) => boolean; +export declare const matchLanguagePseudoClass: (ast: import('css-tree').CssNode, node: Element, langCache?: WeakMap) => boolean; +export declare const matchCheckedPseudoClass: (node: Element) => boolean; +export declare const matchLinkPseudoClass: (node: Element) => boolean; +export declare const matchOpenPseudoClass: (node: Element) => boolean; +export declare const matchPlaceholderShownPseudoClass: (node: Element, keys: Set) => boolean; +export declare const matchRangePseudoClass: (astName: string, node: Element, keys: Set) => boolean; +export declare const matchReadOnlyPseudoClass: (astName: string, node: Element) => boolean; +export declare const matchRequiredPseudoClass: (astName: string, node: Element, keys: Set) => boolean; +export declare const matchAttributeSelector: (ast: import('css-tree').CssNode, node: Element, { check, forgive, globalObject }?: import('../index.js').FindOptions) => boolean; +export declare const matchTypeSelector: (ast: import('css-tree').CssNode, node: Element, { check, forgive, globalObject }?: import('../index.js').FindOptions) => boolean; diff --git a/node_modules/@asamuzakjp/dom-selector/types/js/nwsapi.d.ts b/node_modules/@asamuzakjp/dom-selector/types/js/nwsapi.d.ts new file mode 100644 index 0000000..282b1c8 --- /dev/null +++ b/node_modules/@asamuzakjp/dom-selector/types/js/nwsapi.d.ts @@ -0,0 +1,64 @@ +export type ResolverFactory = (c: Element | Array | NodeList, f?: ((element: Element) => boolean | void), x?: Element | Document | null, r?: boolean | Array) => boolean | Array; +export declare const concatCall: (nodes: Array | NodeList, callback?: ((element: Element) => boolean | void) | undefined) => Array; +export declare const isHTML: (node: Element | Document) => boolean; +export declare const isTarget: (node: Element) => boolean; +export declare const isIndeterminate: (node: Element) => boolean; +export declare const optimize: (selector: string, tokens: Array) => string; +export declare const matchAssert: (factory: Array, element: Element, callback?: ((element: Element) => boolean | void) | undefined) => boolean; +export declare const solveNth: (element: Element, dir: boolean | number, state: object, isOfType: boolean) => number; +export declare class Nwsapi { + #private; + hasDupes: boolean | undefined; + constructor(window: Window, document: Document, cacheSize?: number); + private #documentOrder; + private #unique; + byId(id: string, context: Element | Document): Array; + byTag(tag: string, context: Element | Document | DocumentFragment): Array; + byClass(cls: string, context: Element | Document | DocumentFragment): Array; + private #emit; + private #switchContext; + compileSelector(expression: string, source: string, mode: boolean): string; + compileUniversal(selector: string, source: string): { + source: string; + selector: string; + }; + compileId(selector: string, source: string): { + source: string; + selector: string; + }; + compileClass(selector: string, source: string): { + source: string; + selector: string; + }; + compileTag(selector: string, source: string): { + source: string; + selector: string; + }; + compileAttribute(selector: string, source: string): { + source: string; + selector: string; + }; + compileCombinator(symbol: string, selector: string, source: string): { + source: string; + selector: string; + }; + compilePseudo(selector: string, source: string, selectorString: string): { + source: string; + selector: string; + }; + compilePseudoStructural(match: Array, source: string): string; + compilePseudoTreeStruct(match: Array, source: string, selectorString: string): string; + compilePseudoLogical(match: Array, source: string): string; + compilePseudoLocation(match: Array, source: string): string; + compilePseudoInputState(match: Array, source: string): string; + compilePseudoInputValue(match: Array, source: string): string; + compile(selector: string, mode: boolean): ResolverFactory; + collect(selectors: Array, context: Element | Document, callback?: ((element: Element) => boolean | void) | undefined): object; + private #matchCollect; + private #parseSelector; + match(selectors: string, element: Element, callback?: ((element: Element) => boolean | void) | undefined): boolean; + closest(selectors: string, element: Element, callback?: ((element: Element) => boolean | void) | undefined): Element | null; + select(selectors: string, context: Element | Document, callback?: ((element: Element) => boolean | void) | undefined): Array; + first(selectors: string, context: Element | Document, callback?: ((element: Element) => boolean | void) | undefined): Element | null; + clear(clearAll?: boolean): void; +} diff --git a/node_modules/@asamuzakjp/dom-selector/types/js/parser.d.ts b/node_modules/@asamuzakjp/dom-selector/types/js/parser.d.ts new file mode 100644 index 0000000..d65af00 --- /dev/null +++ b/node_modules/@asamuzakjp/dom-selector/types/js/parser.d.ts @@ -0,0 +1,20 @@ +export declare const unescapeSelector: (selector?: string) => string; +export declare const preprocess: (value: string) => string; +export declare const parseSelector: (sel: string, context?: string) => import('css-tree').CssNode; +export declare const walkAST: (ast?: import('css-tree').CssNode, toObject?: boolean, callback?: (node: import('css-tree').CssNode) => void) => { + branches: Array>; + info: object; +}; +export declare const compareASTNodes: (a: import('css-tree').CssNode, b: import('css-tree').CssNode) => number; +export declare const sortAST: (asts: Array) => Array; +export declare const parseAstName: (selector: string) => { + prefix: string; + localName: string; +}; +export declare const extractSubjectsAst: (ast: import('css-tree').CssNode) => Array<{ + id: string | null; + className: string | null; + tag: string | null; +}>; +export declare const findAST: typeof import('css-tree').find; +export declare const generateCSS: typeof import('css-tree').generate; diff --git a/node_modules/@asamuzakjp/dom-selector/types/js/processor.d.ts b/node_modules/@asamuzakjp/dom-selector/types/js/processor.d.ts new file mode 100644 index 0000000..f8d4576 --- /dev/null +++ b/node_modules/@asamuzakjp/dom-selector/types/js/processor.d.ts @@ -0,0 +1,19 @@ +export type ProcessedBranch = { + combo: import('css-tree').CssNode | null; + leaves: Array; +}; +export type ProcessedASTNode = { + branch: Array; + dir: string | null; + filtered: boolean; + find: boolean; +}; +export declare class SelectorProcessor { + #private; + constructor(context: import('./finder.js').Finder); + process(branches: Array>, selector: string): { + ast: Array; + descendant: boolean; + invalidate?: boolean; + }; +} diff --git a/node_modules/@asamuzakjp/dom-selector/types/js/pseudo-class.d.ts b/node_modules/@asamuzakjp/dom-selector/types/js/pseudo-class.d.ts new file mode 100644 index 0000000..f215247 --- /dev/null +++ b/node_modules/@asamuzakjp/dom-selector/types/js/pseudo-class.d.ts @@ -0,0 +1,31 @@ +export declare class PseudoClassEvaluator { + #private; + constructor(evaluator: import('./evaluator.js').Evaluator); + clearResults(all?: boolean): void; + reset(): void; + matchPseudoClassSelector(ast: import('css-tree').CssNode, node: Element, opt?: import('../index.js').FindOptions): boolean; + private #evaluateLogicalPseudo; + private #evaluatePseudoClassFunc; + private #matchActivePseudoClass; + private #matchDefaultPseudoClass; + private #matchDisabledPseudoClass; + private #matchEmptyPseudoClass; + private #matchFocusPseudoClass; + private #matchFocusVisiblePseudoClass; + private #matchFocusWithinPseudoClass; + private #matchHoverPseudoClass; + private #matchIndeterminatePseudoClass; + private #matchLocalLinkPseudoClass; + private #matchTargetPseudoClass; + private #matchValidityPseudoClass; + private #matchAnPlusB; + private #getSelectorBranches; + private #filterNthChildOfSelectorBranches; + private #matchLogicalPseudoFunc; + private #evaluateHasPseudo; + private #buildHasAllowlist; + private #acquireSet; + private #matchHasPseudoFunc; + private #hasCombinatorMatch; + private #checkNode; +} diff --git a/node_modules/@asamuzakjp/dom-selector/types/js/selector.d.ts b/node_modules/@asamuzakjp/dom-selector/types/js/selector.d.ts new file mode 100644 index 0000000..0e91e9f --- /dev/null +++ b/node_modules/@asamuzakjp/dom-selector/types/js/selector.d.ts @@ -0,0 +1,12 @@ +export declare const findNestedHas: (leaf: object) => object | null; +export declare const findLogicalWithNestedHas: (leaf: object) => object | null; +export declare const validateHasNesting: (astChildren: Array) => boolean; +export declare const createHasValidator: (globalObj: object) => (node: object) => void; +export declare const isInvalidCombinator: (type: string, prevType: string | null, isLast: boolean) => boolean; +export declare const isSupportedAST: (ast: import('css-tree').CssNode) => boolean; +export declare const extractSubjectsRegExp: (selector: string, caseSensitive: boolean) => Array<{ + id: string | null; + className: string | null; + tag: string | null; +}>; +export declare const filterSelector: (selector: string, target: string) => boolean; diff --git a/node_modules/@asamuzakjp/dom-selector/types/js/shadow.d.ts b/node_modules/@asamuzakjp/dom-selector/types/js/shadow.d.ts new file mode 100644 index 0000000..0172a2f --- /dev/null +++ b/node_modules/@asamuzakjp/dom-selector/types/js/shadow.d.ts @@ -0,0 +1,10 @@ +export declare class ShadowDOMEvaluator { + #private; + constructor(evaluator: import('./evaluator.js').Evaluator); + get verifyShadowHost(): boolean; + reset(): void; + matchSelectorForShadowRoot(ast: import('css-tree').CssNode, node: DocumentFragment, opt?: object): boolean; + evaluateShadowHost(ast: import('css-tree').CssNode, node: DocumentFragment): boolean; + private #evaluateHostPseudo; + private #evaluateHostContextPseudo; +} diff --git a/node_modules/@asamuzakjp/dom-selector/types/js/traverser.d.ts b/node_modules/@asamuzakjp/dom-selector/types/js/traverser.d.ts new file mode 100644 index 0000000..7266f9e --- /dev/null +++ b/node_modules/@asamuzakjp/dom-selector/types/js/traverser.d.ts @@ -0,0 +1,12 @@ +export declare class DOMTraverser { + #private; + constructor(evaluator: import('./evaluator.js').Evaluator); + reset(): void; + createTreeWalker(node: Document | DocumentFragment | Element, opt?: { + force?: boolean; + whatToShow?: number; + }): TreeWalker; + yieldCombinatorMatches(twig: import('./processor.js').ProcessedBranch, node: Element, opt?: import('../index.js').FindOptions): Generator; + yieldFindDescendantNodes(leaves: Array, baseNode: DocumentFragment | Element, opt: import('../index.js').FindOptions): Generator; + yieldTraverseAllDescendants(baseNode: DocumentFragment | Element, leaves: Array, opt: import('../index.js').FindOptions): Generator; +} diff --git a/node_modules/@asamuzakjp/dom-selector/types/js/utility.d.ts b/node_modules/@asamuzakjp/dom-selector/types/js/utility.d.ts new file mode 100644 index 0000000..454b267 --- /dev/null +++ b/node_modules/@asamuzakjp/dom-selector/types/js/utility.d.ts @@ -0,0 +1,33 @@ +export declare const getType: (o: object) => string; +export declare const verifyArray: (arr: any[], type: string) => any[]; +export declare const generateException: (msg: string, name: string, globalObject?: object) => DOMException; +export declare const stringifyValue: (value: unknown, globalObject?: object) => string; +export declare const resolveContent: (node: Document | DocumentFragment | Element) => Array; +export declare const traverseNode: (node: Element, walker: TreeWalker, force?: boolean) => Element | null; +export declare const isHTMLElement: (node: Element) => boolean; +export declare const isCustomElement: (node: Element, { formAssociated }?: { + formAssociated?: boolean; +}) => boolean; +export declare const getSlottedTextContent: (node: Element) => string | null; +export declare const getDirectionality: (node: Element, dirCache?: WeakMap) => string | null; +export declare const getLanguageAttribute: (node: Element, langCache?: WeakMap) => string | null; +export declare const isContentEditable: (node: Element) => boolean; +export declare const isVisible: (node: Element) => boolean; +export declare const isFocusVisible: (node: Element) => boolean; +export declare const isFocusableArea: (node: Element) => boolean; +export declare const isFocusable: (node: Element) => boolean; +export declare const getNamespaceURI: (ns: string, node: Element) => string | null; +export declare const isNamespaceDeclared: (ns?: string, node?: Element) => boolean; +export declare const isPreceding: (nodeA: Element, nodeB: Element) => boolean; +export declare const compareNodes: (a: Element, b: Element) => number; +export declare const sortNodes: (nodes?: Array | Set) => Array; +export declare const findBestSeed: (nodes: Array, state?: object) => object; +export declare const populateHasAllowlist: (current: Element, list: WeakSet, visitedAncestors: Set) => void; +export declare const collectAllDescendants: (node: Document | DocumentFragment | Element, document: Document) => Array; +export declare const hasAttributeLocalName: (node: Element, name: string) => boolean; +export declare const findByExactIdAttribute: (selector: string, node: Document | DocumentFragment | Element) => Element | null | undefined; +export declare const findBySimpleAttribute: (selector: string, node: Document | DocumentFragment | Element) => Array | null; +export declare const getTraversalStrategy: (branch: Array, targetType: string, hasScope: boolean, scoped: boolean) => object; +export declare const canUseFastIdSearch: (node: Element, root: Document | DocumentFragment | Element) => boolean; +export declare const canUseFastClassSearch: (node: Document | DocumentFragment | Element) => boolean; +export declare const canUseFastTagSearch: (node: Document | DocumentFragment | Element, leafName: string) => boolean; diff --git a/node_modules/@bramus/specificity/LICENSE b/node_modules/@bramus/specificity/LICENSE new file mode 100644 index 0000000..34642d0 --- /dev/null +++ b/node_modules/@bramus/specificity/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2022 Bramus Van Damme - https://www.bram.us/ + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is furnished +to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/node_modules/@bramus/specificity/README.md b/node_modules/@bramus/specificity/README.md new file mode 100644 index 0000000..61c4223 --- /dev/null +++ b/node_modules/@bramus/specificity/README.md @@ -0,0 +1,164 @@ +[![Calculate CSS Specificity](./screenshots/calculate-specificity.png)](https://codepen.io/bramus/pen/WNXyoYm) + +# Specificity + +`@bramus/specificity` is a package to calculate the specificity of CSS Selectors. It also includes some convenience functions to compare, sort, and filter an array of specificity values. + +Supports [Selectors Level 4](https://www.w3.org/TR/selectors-4/), including those special cases `:is()`, `:where()`, `:not()`, etc. + +Demo: [https://codepen.io/bramus/pen/WNXyoYm](https://codepen.io/bramus/pen/WNXyoYm) + +## Installation + +```bash +npm i @bramus/specificity +``` + +## Usage / Example + +At its core, `@bramus/specificity` exposes a `Specificity` class. Its static `calculate` method can be used to calculate the specificity of a given CSS [Selector List](https://www.w3.org/TR/selectors-4/#grouping) string. + +```js +import Specificity from '@bramus/specificity'; + +const specificities = Specificity.calculate('header:where(#top) nav li:nth-child(2n), #doormat'); +``` + +Because `calculate` accepts a [Selector List](https://www.w3.org/TR/selectors-4/#grouping) — which can contain more than 1 [Selector](https://www.w3.org/TR/selectors-4/#selector) — it will always return an array, with each entry being a `Specificity` instance — one per found selector. + +```js +const specificities = Specificity.calculate('header:where(#top) nav li:nth-child(2n), #doormat'); +specificities.map((s) => s.toString()); // ~> ["(0,1,3)","(1,0,0)"] +``` + +💡 If you know you’re passing only a single Selector into `calculate()`, you can use JavaScript’s built-in destructuring to keep your variable names clean. + +```js +const [s] = Specificity.calculate('header:where(#top) nav li:nth-child(2n)'); +s.toString(); // ~> "(0,1,3)" +``` + +💡 Under the hood, `@bramus/specificity` uses [CSSTree](https://github.com/csstree/csstree) to do the parsing of strings to Selectors. As a result, the `calculate` method also accepts a [CSSTree AST](https://github.com/csstree/csstree/blob/master/docs/ast.md) of the types `Selector` and `SelectorList`. + +If you have a pre-parsed CSSTree AST of the type `Selector` you can pass it into `Specificity.calculateForAST()`. It [performs slightly better](#benchmark) than `Specificity.calculate()` as it needs to check fewer things. It differs from `Specificity.calculate()` in that it does not return an array of `Specificity` instances but only a single value. + +## The Return Format + +A calculated specificity is represented as an instance of the `Specificity` class. The `Specificity` class includes methods to get the specificity value in a certain format, along with some convenience methods to compare it against other instances. + +```js +// 🚀 Thunderbirds are go! +import Specificity from '@bramus/specificity'; + +// ✨ Calculate specificity for each Selector in the given Selector List +const specificities = Specificity.calculate('header:where(#top) nav li:nth-child(2n), #doormat'); + +// 🚚 The values in the array are instances of the Specificity class +const s = specificities[0]; // Instance of Specificity + +// 👀 Read the specificity value using one of its accessors +s.value; // { a: 0, b: 1, c: 3 } +s.a; // 0 +s.b; // 1 +s.c; // 3 + +// 🛠 Convert the calculated value to various formats using one of the toXXX() instance methods +s.toString(); // "(0,1,3)" +s.toArray(); // [0, 1, 3] +s.toObject(); // { a: 0, b: 1, c: 3 } + +// 💡 Extract the matched selector string +s.selectorString(); // "header:where(#top) nav li:nth-child(2n)" + +// 🔀 Use one of its instance comparison methods to compare it to another Specificity instance +s.isEqualTo(specificities[1]); // false +s.isGreaterThan(specificities[1]); // false +s.isLessThan(specificities[1]); // true + +// 💻 Don’t worry about JSON.stringify() +JSON.stringify(s); +// { +// "selector": 'header:where(#top) nav li:nth-child(2n)', +// "asObject": { "a": 0, "b": 1, "c": 3 }, +// "asArray": [0, 1, 3], +// "asString": "(0,1,3)", +// } +``` + +## Utility Functions (Static Methods) + +This package also exposes some utility functions to work with specificities. These utility functions are all exposed as static methods on the `Specificity` class. + +- Comparing: + + - `Specificity.compare(s1, s2)`: Compares s1 to s2. Returns a value that can be: + - `> 0` = Sort s2 before s1 _(i.e. s1 is more specific than s2)_ + - `0` = Keep original order of s1 and s2 _(i.e. s1 and s2 are equally specific)_ + - `< 0` = Sort s1 before s2 _(i.e. s1 is less specific than s2)_ + - `Specificity.equals(s1, s2)`: Returns `true` if s1 and s2 have the same specificity. If not, `false` is returned. + - `Specificity.greaterThan(s1, s2)`: Returns `true` if s1 has a higher specificity than s2. If not, `false` is returned. + - `Specificity.lessThan(s1, s2)`: Returns `true` if s1 has a lower specificity than s2. If not, `false` is returned. + +- Sorting: + + - `Specificity.sortAsc(s1, s2, …, sN)`: Sorts the given specificities in ascending order _(low specificity to high specificity)_ + - `Specificity.sortDesc(s1, s2, …, sN)`: Sorts the given specificities in descending order _(high specificity to low specificity)_ + +- Filtering: + - `Specificity.min(s1, s2, …, sN)`: Filters out the value with the lowest specificity + - `Specificity.max(s1, s2, …, sN)`: Filters out the value with the highest specificity + +A specificity passed into any of these utility functions can be any of: + +- An instance of the included `Specificity` class +- A simple Object such as `{'a': 1, 'b': 0, 'c': 2}` + +## Utility Functions (Standalone) + +All static methods the `Specificity` class exposes are also exported as standalone functions using [Subpath Exports](https://nodejs.org/api/packages.html#subpath-exports). + +If you're only interested in including some of these functions into your project you can import them from their Subpath. As a result, your bundle size will be reduced greatly _(except for including the standalone `calculate`, as it returns an array of `Specificity` instances that relies on the whole lot)_ + +```js +import { calculate, calculateForAST } from '@bramus/specificity/core'; +import { compare, equals, greaterThan, lessThan } from '@bramus/specificity/compare'; +import { min, max } from '@bramus/specificity/filter'; +import { sortAsc, sortDesc } from '@bramus/specificity/sort'; +``` + +## Type Definitions + +Although `@bramus/specificity` is written in Vanilla JavaScript, it does include [Type Definitions](https://www.typescriptlang.org/docs/handbook/2/type-declarations.html) which are exposed via its `package.json`. + +## Binary/CLI + +`@bramus/specificity` exposes a binary named `specificity` to calculate the specificity of a given selector list on the CLI. For each selector that it finds, it'll print out the calculated specificity as a string on a new line. + +```bash +$ specificity "header:where(#top) nav li:nth-child(2n), #doormat" +(0,1,3) +(1,0,0) +``` + +## Benchmark + +A benchmark is included, which you can invoke using `npm run benchmark`. + +Sample results (tested on a MacBook Air M3): + +``` +Specificity.calculate(string) x 420,682 ops/sec ±0.34% (98 runs sampled) +Specificity.calculate(ast) - using SelectorList x 8,994,080 ops/sec ±0.25% (98 runs sampled) +Specificity.calculate(ast) - using Selector x 11,054,856 ops/sec ±0.39% (91 runs sampled) +Specificity.calculateForAST(ast) x 12,652,322 ops/sec ±0.35% (96 runs sampled) +``` + +## License + +`@bramus/specificity` is released under the MIT public license. See the enclosed `LICENSE` for details. + +## Acknowledgements + +The idea to create this package was sparked by [the wonderful Specificity Calculator created by Kilian Valkhof / Polypane](https://polypane.app/css-specificity-calculator/), a highly educational tool that not only calculates the specificity, but also explains which parts are responsible for it. + +The heavy lifting of doing the actual parsing of Selectors is done by [CSSTree](https://github.com/csstree/csstree). diff --git a/node_modules/@bramus/specificity/bin/cli.js b/node_modules/@bramus/specificity/bin/cli.js new file mode 100755 index 0000000..9d26b68 --- /dev/null +++ b/node_modules/@bramus/specificity/bin/cli.js @@ -0,0 +1,14 @@ +#!/usr/bin/env node +import Specificity from '../dist/index.js'; + +if (!process.argv[2]) { + console.error('❌ Missing selector argument'); + process.exit(1); +} + +try { + const specificities = Specificity.calculate(process.argv[2]); + console.log(specificities.map((specificity) => `${specificity}`).join('\n')); +} catch (e) { + console.error(`❌ ${e.message}`); +} diff --git a/node_modules/@bramus/specificity/dist/index.cjs b/node_modules/@bramus/specificity/dist/index.cjs new file mode 100644 index 0000000..0b42888 --- /dev/null +++ b/node_modules/@bramus/specificity/dist/index.cjs @@ -0,0 +1,8 @@ +var Zn=Object.create;var Et=Object.defineProperty;var ti=Object.getOwnPropertyDescriptor;var ei=Object.getOwnPropertyNames;var ri=Object.getPrototypeOf,ni=Object.prototype.hasOwnProperty;var rt=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(r){throw t=0,r}},vt=(e,t)=>{for(var r in t)Et(e,r,{get:t[r],enumerable:!0})},Be=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of ei(t))!ni.call(e,i)&&i!==r&&Et(e,i,{get:()=>t[i],enumerable:!(n=ti(t,i))||n.enumerable});return e};var ii=(e,t,r)=>(r=e!=null?Zn(ri(e)):{},Be(t||!e||!e.__esModule?Et(r,"default",{value:e,enumerable:!0}):r,e)),si=e=>Be(Et({},"__esModule",{value:!0}),e);var je=rt(he=>{var He="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split("");he.encode=function(e){if(0<=e&&e{var Ye=je(),fe=5,qe=1<>1;return t?-r:r}pe.encode=function(t){var r="",n,i=pi(t);do n=i&Ke,i>>>=fe,i>0&&(n|=ze),r+=Ye.encode(n);while(i>0);return r};pe.decode=function(t,r,n){var i=t.length,o=0,c=0,l,u;do{if(r>=i)throw new Error("Expected more digits in base 64 VLQ value.");if(u=Ye.decode(t.charCodeAt(r++)),u===-1)throw new Error("Invalid base64 digit: "+t.charAt(r-1));l=!!(u&ze),u&=Ke,o=o+(u<{function di(e,t,r){if(t in e)return e[t];if(arguments.length===3)return r;throw new Error('"'+t+'" is a required argument.')}L.getArg=di;var $e=/^(?:([\w+\-.]+):)?\/\/(?:(\w+:\w+)@)?([\w.-]*)(?::(\d+))?(.*)$/,ki=/^data:.+\,.+$/;function gt(e){var t=e.match($e);return t?{scheme:t[1],auth:t[2],host:t[3],port:t[4],path:t[5]}:null}L.urlParse=gt;function ot(e){var t="";return e.scheme&&(t+=e.scheme+":"),t+="//",e.auth&&(t+=e.auth+"@"),e.host&&(t+=e.host),e.port&&(t+=":"+e.port),e.path&&(t+=e.path),t}L.urlGenerate=ot;var xi=32;function Si(e){var t=[];return function(r){for(var n=0;nxi&&t.pop(),o}}var me=Si(function(t){var r=t,n=gt(t);if(n){if(!n.path)return t;r=n.path}for(var i=L.isAbsolute(r),o=[],c=0,l=0;;)if(c=l,l=r.indexOf("/",c),l===-1){o.push(r.slice(c));break}else for(o.push(r.slice(c,l));l=0;l--)u=o[l],u==="."?o.splice(l,1):u===".."?s++:s>0&&(u===""?(o.splice(l+1,s),s=0):(o.splice(l,2),s--));return r=o.join("/"),r===""&&(r=i?"/":"."),n?(n.path=r,ot(n)):r});L.normalize=me;function Xe(e,t){e===""&&(e="."),t===""&&(t=".");var r=gt(t),n=gt(e);if(n&&(e=n.path||"/"),r&&!r.scheme)return n&&(r.scheme=n.scheme),ot(r);if(r||t.match(ki))return t;if(n&&!n.host&&!n.path)return n.host=t,ot(n);var i=t.charAt(0)==="/"?t:me(e.replace(/\/+$/,"")+"/"+t);return n?(n.path=i,ot(n)):i}L.join=Xe;L.isAbsolute=function(e){return e.charAt(0)==="/"||$e.test(e)};function gi(e,t){e===""&&(e="."),e=e.replace(/\/$/,"");for(var r=0;t.indexOf(e+"/")!==0;){var n=e.lastIndexOf("/");if(n<0||(e=e.slice(0,n),e.match(/^([^\/]+:\/)?\/*$/)))return t;++r}return Array(r+1).join("../")+t.substr(e.length+1)}L.relative=gi;var Je=(function(){var e=Object.create(null);return!("__proto__"in e)})();function Ze(e){return e}function Ci(e){return tr(e)?"$"+e:e}L.toSetString=Je?Ze:Ci;function yi(e){return tr(e)?e.slice(1):e}L.fromSetString=Je?Ze:yi;function tr(e){if(!e)return!1;var t=e.length;if(t<9||e.charCodeAt(t-1)!==95||e.charCodeAt(t-2)!==95||e.charCodeAt(t-3)!==111||e.charCodeAt(t-4)!==116||e.charCodeAt(t-5)!==111||e.charCodeAt(t-6)!==114||e.charCodeAt(t-7)!==112||e.charCodeAt(t-8)!==95||e.charCodeAt(t-9)!==95)return!1;for(var r=t-10;r>=0;r--)if(e.charCodeAt(r)!==36)return!1;return!0}function bi(e,t,r){var n=G(e.source,t.source);return n!==0||(n=e.originalLine-t.originalLine,n!==0)||(n=e.originalColumn-t.originalColumn,n!==0||r)||(n=e.generatedColumn-t.generatedColumn,n!==0)||(n=e.generatedLine-t.generatedLine,n!==0)?n:G(e.name,t.name)}L.compareByOriginalPositions=bi;function Ti(e,t,r){var n;return n=e.originalLine-t.originalLine,n!==0||(n=e.originalColumn-t.originalColumn,n!==0||r)||(n=e.generatedColumn-t.generatedColumn,n!==0)||(n=e.generatedLine-t.generatedLine,n!==0)?n:G(e.name,t.name)}L.compareByOriginalPositionsNoSource=Ti;function Li(e,t,r){var n=e.generatedLine-t.generatedLine;return n!==0||(n=e.generatedColumn-t.generatedColumn,n!==0||r)||(n=G(e.source,t.source),n!==0)||(n=e.originalLine-t.originalLine,n!==0)||(n=e.originalColumn-t.originalColumn,n!==0)?n:G(e.name,t.name)}L.compareByGeneratedPositionsDeflated=Li;function Ei(e,t,r){var n=e.generatedColumn-t.generatedColumn;return n!==0||r||(n=G(e.source,t.source),n!==0)||(n=e.originalLine-t.originalLine,n!==0)||(n=e.originalColumn-t.originalColumn,n!==0)?n:G(e.name,t.name)}L.compareByGeneratedPositionsDeflatedNoLine=Ei;function G(e,t){return e===t?0:e===null?1:t===null?-1:e>t?1:-1}function vi(e,t){var r=e.generatedLine-t.generatedLine;return r!==0||(r=e.generatedColumn-t.generatedColumn,r!==0)||(r=G(e.source,t.source),r!==0)||(r=e.originalLine-t.originalLine,r!==0)||(r=e.originalColumn-t.originalColumn,r!==0)?r:G(e.name,t.name)}L.compareByGeneratedPositionsInflated=vi;function wi(e){return JSON.parse(e.replace(/^\)]}'[^\n]*\n/,""))}L.parseSourceMapInput=wi;function Ai(e,t,r){if(t=t||"",e&&(e[e.length-1]!=="/"&&t[0]!=="/"&&(e+="/"),t=e+t),r){var n=gt(r);if(!n)throw new Error("sourceMapURL could not be parsed");if(n.path){var i=n.path.lastIndexOf("/");i>=0&&(n.path=n.path.substring(0,i+1))}t=Xe(ot(n),t)}return me(t)}L.computeSourceURL=Ai});var rr=rt(er=>{var de=Yt(),ke=Object.prototype.hasOwnProperty,X=typeof Map<"u";function H(){this._array=[],this._set=X?new Map:Object.create(null)}H.fromArray=function(t,r){for(var n=new H,i=0,o=t.length;i=0)return r}else{var n=de.toSetString(t);if(ke.call(this._set,n))return this._set[n]}throw new Error('"'+t+'" is not in the set.')};H.prototype.at=function(t){if(t>=0&&t{var nr=Yt();function Ii(e,t){var r=e.generatedLine,n=t.generatedLine,i=e.generatedColumn,o=t.generatedColumn;return n>r||n==r&&o>=i||nr.compareByGeneratedPositionsInflated(e,t)<=0}function qt(){this._array=[],this._sorted=!0,this._last={generatedLine:-1,generatedColumn:0}}qt.prototype.unsortedForEach=function(t,r){this._array.forEach(t,r)};qt.prototype.add=function(t){Ii(this._last,t)?(this._last=t,this._array.push(t)):(this._sorted=!1,this._array.push(t))};qt.prototype.toArray=function(){return this._sorted||(this._array.sort(nr.compareByGeneratedPositionsInflated),this._sorted=!0),this._array};ir.MappingList=qt});var ar=rt(or=>{var Ct=Qe(),y=Yt(),Kt=rr().ArraySet,Ni=sr().MappingList;function P(e){e||(e={}),this._file=y.getArg(e,"file",null),this._sourceRoot=y.getArg(e,"sourceRoot",null),this._skipValidation=y.getArg(e,"skipValidation",!1),this._ignoreInvalidMapping=y.getArg(e,"ignoreInvalidMapping",!1),this._sources=new Kt,this._names=new Kt,this._mappings=new Ni,this._sourcesContents=null}P.prototype._version=3;P.fromSourceMap=function(t,r){var n=t.sourceRoot,i=new P(Object.assign(r||{},{file:t.file,sourceRoot:n}));return t.eachMapping(function(o){var c={generated:{line:o.generatedLine,column:o.generatedColumn}};o.source!=null&&(c.source=o.source,n!=null&&(c.source=y.relative(n,c.source)),c.original={line:o.originalLine,column:o.originalColumn},o.name!=null&&(c.name=o.name)),i.addMapping(c)}),t.sources.forEach(function(o){var c=o;n!==null&&(c=y.relative(n,o)),i._sources.has(c)||i._sources.add(c);var l=t.sourceContentFor(o);l!=null&&i.setSourceContent(o,l)}),i};P.prototype.addMapping=function(t){var r=y.getArg(t,"generated"),n=y.getArg(t,"original",null),i=y.getArg(t,"source",null),o=y.getArg(t,"name",null);!this._skipValidation&&this._validateMapping(r,n,i,o)===!1||(i!=null&&(i=String(i),this._sources.has(i)||this._sources.add(i)),o!=null&&(o=String(o),this._names.has(o)||this._names.add(o)),this._mappings.add({generatedLine:r.line,generatedColumn:r.column,originalLine:n!=null&&n.line,originalColumn:n!=null&&n.column,source:i,name:o}))};P.prototype.setSourceContent=function(t,r){var n=t;this._sourceRoot!=null&&(n=y.relative(this._sourceRoot,n)),r!=null?(this._sourcesContents||(this._sourcesContents=Object.create(null)),this._sourcesContents[y.toSetString(n)]=r):this._sourcesContents&&(delete this._sourcesContents[y.toSetString(n)],Object.keys(this._sourcesContents).length===0&&(this._sourcesContents=null))};P.prototype.applySourceMap=function(t,r,n){var i=r;if(r==null){if(t.file==null)throw new Error(`SourceMapGenerator.prototype.applySourceMap requires either an explicit source file, or the source map's "file" property. Both were omitted.`);i=t.file}var o=this._sourceRoot;o!=null&&(i=y.relative(o,i));var c=new Kt,l=new Kt;this._mappings.unsortedForEach(function(u){if(u.source===i&&u.originalLine!=null){var s=t.originalPositionFor({line:u.originalLine,column:u.originalColumn});s.source!=null&&(u.source=s.source,n!=null&&(u.source=y.join(n,u.source)),o!=null&&(u.source=y.relative(o,u.source)),u.originalLine=s.line,u.originalColumn=s.column,s.name!=null&&(u.name=s.name))}var a=u.source;a!=null&&!c.has(a)&&c.add(a);var h=u.name;h!=null&&!l.has(h)&&l.add(h)},this),this._sources=c,this._names=l,t.sources.forEach(function(u){var s=t.sourceContentFor(u);s!=null&&(n!=null&&(u=y.join(n,u)),o!=null&&(u=y.relative(o,u)),this.setSourceContent(u,s))},this)};P.prototype._validateMapping=function(t,r,n,i){if(r&&typeof r.line!="number"&&typeof r.column!="number"){var o="original.line and original.column are not numbers -- you probably meant to omit the original mapping entirely and only map the generated position. If so, pass null for the original mapping instead of an object with empty or null values.";if(this._ignoreInvalidMapping)return typeof console<"u"&&console.warn&&console.warn(o),!1;throw new Error(o)}if(!(t&&"line"in t&&"column"in t&&t.line>0&&t.column>=0&&!r&&!n&&!i)){if(t&&"line"in t&&"column"in t&&r&&"line"in r&&"column"in r&&t.line>0&&t.column>=0&&r.line>0&&r.column>=0&&n)return;var o="Invalid mapping: "+JSON.stringify({generated:t,source:n,original:r,name:i});if(this._ignoreInvalidMapping)return typeof console<"u"&&console.warn&&console.warn(o),!1;throw new Error(o)}};P.prototype._serializeMappings=function(){for(var t=0,r=1,n=0,i=0,o=0,c=0,l="",u,s,a,h,p=this._mappings.toArray(),m=0,k=p.length;m0){if(!y.compareByGeneratedPositionsInflated(s,p[m-1]))continue;u+=","}u+=Ct.encode(s.generatedColumn-t),t=s.generatedColumn,s.source!=null&&(h=this._sources.indexOf(s.source),u+=Ct.encode(h-c),c=h,u+=Ct.encode(s.originalLine-1-i),i=s.originalLine-1,u+=Ct.encode(s.originalColumn-n),n=s.originalColumn,s.name!=null&&(a=this._names.indexOf(s.name),u+=Ct.encode(a-o),o=a)),l+=u}return l};P.prototype._generateSourcesContent=function(t,r){return t.map(function(n){if(!this._sourcesContents)return null;r!=null&&(n=y.relative(r,n));var i=y.toSetString(n);return Object.prototype.hasOwnProperty.call(this._sourcesContents,i)?this._sourcesContents[i]:null},this)};P.prototype.toJSON=function(){var t={version:this._version,sources:this._sources.toArray(),names:this._names.toArray(),mappings:this._serializeMappings()};return this._file!=null&&(t.file=this._file),this._sourceRoot!=null&&(t.sourceRoot=this._sourceRoot),this._sourcesContents&&(t.sourcesContent=this._generateSourcesContent(t.sources,t.sourceRoot)),t};P.prototype.toString=function(){return JSON.stringify(this.toJSON())};or.SourceMapGenerator=P});var bs={};vt(bs,{default:()=>Re});module.exports=si(bs);function E(e){return e>=48&&e<=57}function j(e){return E(e)||e>=65&&e<=70||e>=97&&e<=102}function At(e){return e>=65&&e<=90}function oi(e){return e>=97&&e<=122}function ai(e){return At(e)||oi(e)}function ci(e){return e>=128}function wt(e){return ai(e)||ci(e)||e===95}function It(e){return wt(e)||E(e)||e===45}function li(e){return e>=0&&e<=8||e===11||e>=14&&e<=31||e===127}function ft(e){return e===10||e===13||e===12}function Y(e){return ft(e)||e===32||e===9}function A(e,t){return!(e!==92||ft(t)||t===0)}function Nt(e,t,r){return e===45?wt(t)||t===45||A(t,r):wt(e)?!0:e===92?A(e,t):!1}function Dt(e,t,r){return e===43||e===45?E(t)?2:t===46&&E(r)?3:0:e===46?E(t)?2:0:E(e)?1:0}function Pt(e){return e===65279||e===65534?1:0}var re=new Array(128),ui=128,pt=130,ne=131,Ft=132,ie=133;for(let e=0;ee.length)return!1;for(let i=t;i=0&&Y(e.charCodeAt(t));t--);return t+1}function mt(e,t){for(;t=55296&&t<=57343||t>1114111)&&(t=65533),String.fromCodePoint(t)}var it=["EOF-token","ident-token","function-token","at-keyword-token","hash-token","string-token","bad-string-token","url-token","bad-url-token","delim-token","number-token","percentage-token","dimension-token","whitespace-token","CDO-token","CDC-token","colon-token","semicolon-token","comma-token","[-token","]-token","(-token",")-token","{-token","}-token","comment-token"];function st(e=null,t){return e===null||e.length0?Pt(t.charCodeAt(0)):0,i=st(e.lines,r),o=st(e.columns,r),c=e.startLine,l=e.startColumn;for(let u=n;ur?r:e}var Wt=class{constructor(t,r){this.setSource(t,r)}reset(){this.eof=!1,this.tokenIndex=-1,this.tokenType=0,this.tokenStart=this.firstCharOffset,this.tokenEnd=this.firstCharOffset}setSource(t="",r=()=>{}){t=String(t||"");let n=t.length,i=st(this.offsetAndType,t.length+1),o=st(this.balance,t.length+1),c=0,l=-1,u=0,s=t.length;this.offsetAndType=null,this.balance=null,o.fill(0),r(t,(a,h,p)=>{let m=c++;if(i[m]=a<>O]}else this.isBlockOpenerTokenType(a)&&(s=m,u=K[a])}),i[c]=0<c&&(o[a]=c)}this.source=t,this.firstCharOffset=l===-1?0:l,this.tokenCount=c,this.offsetAndType=i,this.balance=o,this.reset(),this.next()}lookupType(t){return t+=this.tokenIndex,t>O:0}lookupTypeNonSC(t){for(let r=this.tokenIndex;r>O;if(n!==13&&n!==25&&t--===0)return n}return 0}lookupOffset(t){return t+=this.tokenIndex,t>O;if(n!==13&&n!==25&&t--===0)return r-this.tokenIndex}return 0}lookupValue(t,r){return t+=this.tokenIndex,t0?t>O}substrToCursor(t){return this.source.substring(t,this.tokenStart)}isBlockOpenerTokenType(t){return R[t]===kt}isBlockCloserTokenType(t){return R[t]===Ht}getBlockTokenPairIndex(t){let r=this.getTokenType(t);if(R[r]===1){let n=this.balance[t],i=this.getTokenType(n);return K[r]===i?n:-1}else if(R[r]===2){let n=this.balance[t],i=this.getTokenType(n);return K[i]===r?n:-1}return-1}isBalanceEdge(t){return this.balance[this.tokenIndex]>O,this.tokenEnd=r&F):(this.tokenIndex=this.tokenCount,this.next())}next(){let t=this.tokenIndex+1;t>O,this.tokenEnd=t&F):(this.eof=!0,this.tokenIndex=this.tokenCount,this.tokenType=0,this.tokenStart=this.tokenEnd=this.source.length)}skipSC(){for(;this.tokenType===13||this.tokenType===25;)this.next()}skipUntilBalanced(t,r){let n=t,i=0,o=0;t:for(;n0?this.offsetAndType[n-1]&F:this.firstCharOffset,r(this.source.charCodeAt(o))){case 1:break t;case 2:n++;break t;default:this.isBlockOpenerTokenType(this.offsetAndType[n]>>O)&&(n=i)}}this.skip(n-this.tokenIndex)}forEachToken(t){for(let r=0,n=this.firstCharOffset;r>O;n=c,t(l,i,c,r)}}dump(){let t=new Array(this.tokenCount);return this.forEachToken((r,n,i,o)=>{t[o]={idx:o,type:it[r],chunk:this.source.substring(n,i),balance:this.balance[o]}}),t}};function jt(e,t){function r(h){return h=e.length){sSe,spec:()=>Oi});var Di=43,Pi=45,xe=(e,t)=>(e===9&&(e=t),typeof e=="string"&&(e=Math.min(e.charCodeAt(0),128)<<6),e<<1),hr=[[1,1],[1,2],[1,7],[1,8],[1,"-"],[1,10],[1,11],[1,12],[1,15],[1,21],[3,1],[3,2],[3,7],[3,8],[3,"-"],[3,10],[3,11],[3,12],[3,15],[4,1],[4,2],[4,7],[4,8],[4,"-"],[4,10],[4,11],[4,12],[4,15],[12,1],[12,2],[12,7],[12,8],[12,"-"],[12,10],[12,11],[12,12],[12,15],["#",1],["#",2],["#",7],["#",8],["#","-"],["#",10],["#",11],["#",12],["#",15],["-",1],["-",2],["-",7],["-",8],["-","-"],["-",10],["-",11],["-",12],["-",15],[10,1],[10,2],[10,7],[10,8],[10,10],[10,11],[10,12],[10,"%"],[10,15],["@",1],["@",2],["@",7],["@",8],["@","-"],["@",15],[".",10],[".",11],[".",12],["+",10],["+",11],["+",12],["/","*"]],Fi=hr.concat([[1,4],[12,4],[4,4],[3,21],[3,5],[3,16],[11,11],[11,12],[11,2],[11,"-"],[22,1],[22,2],[22,11],[22,12],[22,4],[22,"-"]]);function fr(e){let t=new Set(e.map(([r,n])=>xe(r)<<16|xe(n)));return function(r,n,i){let o=xe(n,i),c=i.charCodeAt(0),l=c===Pi&&n!==1&&n!==2&&n!==15||c===Di?t.has((r&65534)<<16|c<<7):t.has((r&65534)<<16|o);return o|l}}var Oi=fr(hr),Se=fr(Fi);var Ri=92;function _i(e,t){if(typeof t=="function"){let r=null;e.children.forEach(n=>{r!==null&&t.call(this,r),this.node(n),r=n});return}e.children.forEach(this.node,this)}function pr(e){let t=new Map;for(let[r,n]of Object.entries(e.node))typeof(n.generate||n)=="function"&&t.set(r,n.generate||n);return function(r,n){let i="",o=0,c={node(u){if(t.has(u.type))t.get(u.type).call(l,u);else throw new Error("Unknown node type: "+u.type)},tokenBefore:Se,token(u,s,a){o=this.tokenBefore(o,u,s),!a&&o&1&&this.emit(" ",13,!0),this.emit(s,u,!1),u===9&&s.charCodeAt(0)===Ri&&this.emit(` +`,13,!0)},emit(u){i+=u},result(){return i}};n&&(typeof n.decorator=="function"&&(c=n.decorator(c)),n.sourceMap&&(c=ur(c)),n.mode in zt&&(c.tokenBefore=zt[n.mode]));let l={node:u=>c.node(u),children:_i,token:(u,s)=>c.token(u,s),tokenize:u=>jt(u,(s,a,h)=>{c.token(s,u.slice(a,h),a!==0)})};return c.node(r),c.result()}}var Te={};vt(Te,{AnPlusB:()=>dr,Atrule:()=>kr,AtrulePrelude:()=>xr,AttributeSelector:()=>Cr,Block:()=>yr,Brackets:()=>br,CDC:()=>Tr,CDO:()=>Lr,ClassSelector:()=>vr,Combinator:()=>Ir,Comment:()=>Nr,Condition:()=>Dr,Declaration:()=>Pr,DeclarationList:()=>Fr,Dimension:()=>Or,Feature:()=>Rr,FeatureFunction:()=>_r,FeatureRange:()=>Br,Function:()=>Mr,GeneralEnclosed:()=>Ur,Hash:()=>Wr,IdSelector:()=>jr,Identifier:()=>Gr,Layer:()=>Yr,LayerList:()=>qr,MediaQuery:()=>Kr,MediaQueryList:()=>zr,NestingSelector:()=>$r,Nth:()=>Jr,Number:()=>Zr,Operator:()=>en,Parentheses:()=>rn,Percentage:()=>sn,PseudoClassSelector:()=>an,PseudoElementSelector:()=>ln,Ratio:()=>un,Raw:()=>fn,Rule:()=>pn,Scope:()=>mn,Selector:()=>kn,SelectorList:()=>Sn,String:()=>Ln,StyleSheet:()=>En,SupportsDeclaration:()=>vn,TypeSelector:()=>In,UnicodeRange:()=>Nn,Url:()=>Pn,Value:()=>Fn,WhiteSpace:()=>On});var V=43,N=45,Qt=110,J=!0,Bi=!1;function $t(e,t){let r=this.tokenStart+e,n=this.charCodeAt(r);for((n===V||n===N)&&(t&&this.error("Number sign is not allowed"),r++);r0&&this.skip(e),t===0&&(r=this.charCodeAt(this.tokenStart),r!==V&&r!==N&&this.error("Number sign is expected")),at.call(this,t!==0),t===N?"-"+this.consume(10):this.consume(10)}function mr(){let e=this.tokenStart,t=null,r=null;if(this.tokenType===10)at.call(this,Bi),r=this.consume(10);else if(this.tokenType===1&&this.cmpChar(this.tokenStart,N))switch(t="-1",z.call(this,1,Qt),this.tokenEnd-this.tokenStart){case 2:this.next(),r=ge.call(this);break;case 3:z.call(this,2,N),this.next(),this.skipSC(),at.call(this,J),r="-"+this.consume(10);break;default:z.call(this,2,N),$t.call(this,3,J),this.next(),r=this.substrToCursor(e+2)}else if(this.tokenType===1||this.isDelim(V)&&this.lookupType(1)===1){let n=0;switch(t="1",this.isDelim(V)&&(n=1,this.next()),z.call(this,0,Qt),this.tokenEnd-this.tokenStart){case 1:this.next(),r=ge.call(this);break;case 2:z.call(this,1,N),this.next(),this.skipSC(),at.call(this,J),r="-"+this.consume(10);break;default:z.call(this,1,N),$t.call(this,2,J),this.next(),r=this.substrToCursor(e+n+1)}}else if(this.tokenType===12){let n=this.charCodeAt(this.tokenStart),i=n===V||n===N,o=this.tokenStart+i;for(;o{t.type==="Declaration"&&this.token(17,";")}),this.token(24,"}")}function br(e){this.token(9,"["),this.children(e),this.token(9,"]")}function Tr(){this.token(15,"-->")}function Lr(){this.token(14,"\n\n return {\n type: 'CDC',\n loc: this.getLocation(start, this.tokenStart)\n };\n}\n\nexport function generate() {\n this.token(CDC, '-->');\n}\n", "import { CDO } from '../../tokenizer/index.js';\n\nexport const name = 'CDO';\nexport const structure = [];\n\nexport function parse() {\n const start = this.tokenStart;\n\n this.eat(CDO); // \n child = this.CDC();\n break;\n\n // CSS Syntax Module Level 3\n // \u00A72.2 Error handling\n // At the \"top level\" of a stylesheet, an starts an at-rule.\n case AtKeyword:\n child = this.parseWithFallback(this.Atrule, consumeRaw);\n break;\n\n // Anything else starts a qualified rule ...\n default:\n child = this.parseWithFallback(this.Rule, consumeRaw);\n }\n\n children.push(child);\n }\n\n return {\n type: 'StyleSheet',\n loc: this.getLocation(start, this.tokenStart),\n children\n };\n}\n\nexport function generate(node) {\n this.children(node);\n}\n", "import {\n LeftParenthesis,\n RightParenthesis\n} from '../../tokenizer/index.js';\n\nexport const name = 'SupportsDeclaration';\nexport const structure = {\n declaration: 'Declaration'\n};\n\nexport function parse() {\n const start = this.tokenStart;\n\n this.eat(LeftParenthesis);\n this.skipSC();\n\n const declaration = this.Declaration();\n\n if (!this.eof) {\n this.eat(RightParenthesis);\n }\n\n return {\n type: 'SupportsDeclaration',\n loc: this.getLocation(start, this.tokenStart),\n declaration\n };\n}\n\nexport function generate(node) {\n this.token(LeftParenthesis, '(');\n this.node(node.declaration);\n this.token(RightParenthesis, ')');\n}\n", "import { Ident } from '../../tokenizer/index.js';\n\nconst ASTERISK = 0x002A; // U+002A ASTERISK (*)\nconst VERTICALLINE = 0x007C; // U+007C VERTICAL LINE (|)\n\nfunction eatIdentifierOrAsterisk() {\n if (this.tokenType !== Ident &&\n this.isDelim(ASTERISK) === false) {\n this.error('Identifier or asterisk is expected');\n }\n\n this.next();\n}\n\nexport const name = 'TypeSelector';\nexport const structure = {\n name: String\n};\n\n// ident\n// ident|ident\n// ident|*\n// *\n// *|ident\n// *|*\n// |ident\n// |*\nexport function parse() {\n const start = this.tokenStart;\n\n if (this.isDelim(VERTICALLINE)) {\n this.next();\n eatIdentifierOrAsterisk.call(this);\n } else {\n eatIdentifierOrAsterisk.call(this);\n\n if (this.isDelim(VERTICALLINE)) {\n this.next();\n eatIdentifierOrAsterisk.call(this);\n }\n }\n\n return {\n type: 'TypeSelector',\n loc: this.getLocation(start, this.tokenStart),\n name: this.substrToCursor(start)\n };\n}\n\nexport function generate(node) {\n this.tokenize(node.name);\n}\n", "import {\n isHexDigit,\n Ident,\n Number,\n Dimension\n} from '../../tokenizer/index.js';\n\nconst PLUSSIGN = 0x002B; // U+002B PLUS SIGN (+)\nconst HYPHENMINUS = 0x002D; // U+002D HYPHEN-MINUS (-)\nconst QUESTIONMARK = 0x003F; // U+003F QUESTION MARK (?)\n\nfunction eatHexSequence(offset, allowDash) {\n let len = 0;\n\n for (let pos = this.tokenStart + offset; pos < this.tokenEnd; pos++) {\n const code = this.charCodeAt(pos);\n\n if (code === HYPHENMINUS && allowDash && len !== 0) {\n eatHexSequence.call(this, offset + len + 1, false);\n return -1;\n }\n\n if (!isHexDigit(code)) {\n this.error(\n allowDash && len !== 0\n ? 'Hyphen minus' + (len < 6 ? ' or hex digit' : '') + ' is expected'\n : (len < 6 ? 'Hex digit is expected' : 'Unexpected input'),\n pos\n );\n }\n\n if (++len > 6) {\n this.error('Too many hex digits', pos);\n };\n }\n\n this.next();\n return len;\n}\n\nfunction eatQuestionMarkSequence(max) {\n let count = 0;\n\n while (this.isDelim(QUESTIONMARK)) {\n if (++count > max) {\n this.error('Too many question marks');\n }\n\n this.next();\n }\n}\n\nfunction startsWith(code) {\n if (this.charCodeAt(this.tokenStart) !== code) {\n this.error((code === PLUSSIGN ? 'Plus sign' : 'Hyphen minus') + ' is expected');\n }\n}\n\n// https://drafts.csswg.org/css-syntax/#urange\n// Informally, the production has three forms:\n// U+0001\n// Defines a range consisting of a single code point, in this case the code point \"1\".\n// U+0001-00ff\n// Defines a range of codepoints between the first and the second value, in this case\n// the range between \"1\" and \"ff\" (255 in decimal) inclusive.\n// U+00??\n// Defines a range of codepoints where the \"?\" characters range over all hex digits,\n// in this case defining the same as the value U+0000-00ff.\n// In each form, a maximum of 6 digits is allowed for each hexadecimal number (if you treat \"?\" as a hexadecimal digit).\n//\n// =\n// u '+' '?'* |\n// u '?'* |\n// u '?'* |\n// u |\n// u |\n// u '+' '?'+\nfunction scanUnicodeRange() {\n let hexLength = 0;\n\n switch (this.tokenType) {\n case Number:\n // u '?'*\n // u \n // u \n hexLength = eatHexSequence.call(this, 1, true);\n\n if (this.isDelim(QUESTIONMARK)) {\n eatQuestionMarkSequence.call(this, 6 - hexLength);\n break;\n }\n\n if (this.tokenType === Dimension ||\n this.tokenType === Number) {\n startsWith.call(this, HYPHENMINUS);\n eatHexSequence.call(this, 1, false);\n break;\n }\n\n break;\n\n case Dimension:\n // u '?'*\n hexLength = eatHexSequence.call(this, 1, true);\n\n if (hexLength > 0) {\n eatQuestionMarkSequence.call(this, 6 - hexLength);\n }\n\n break;\n\n default:\n // u '+' '?'*\n // u '+' '?'+\n this.eatDelim(PLUSSIGN);\n\n if (this.tokenType === Ident) {\n hexLength = eatHexSequence.call(this, 0, true);\n if (hexLength > 0) {\n eatQuestionMarkSequence.call(this, 6 - hexLength);\n }\n break;\n }\n\n if (this.isDelim(QUESTIONMARK)) {\n this.next();\n eatQuestionMarkSequence.call(this, 5);\n break;\n }\n\n this.error('Hex digit or question mark is expected');\n }\n}\n\nexport const name = 'UnicodeRange';\nexport const structure = {\n value: String\n};\n\nexport function parse() {\n const start = this.tokenStart;\n\n // U or u\n this.eatIdent('u');\n scanUnicodeRange.call(this);\n\n return {\n type: 'UnicodeRange',\n loc: this.getLocation(start, this.tokenStart),\n value: this.substrToCursor(start)\n };\n}\n\nexport function generate(node) {\n this.tokenize(node.value);\n}\n", "import {\n isHexDigit,\n isWhiteSpace,\n isValidEscape,\n consumeEscaped,\n decodeEscaped\n} from '../tokenizer/index.js';\n\nconst SPACE = 0x0020; // U+0020 SPACE\nconst REVERSE_SOLIDUS = 0x005c; // U+005C REVERSE SOLIDUS (\\)\nconst QUOTATION_MARK = 0x0022; // \"\nconst APOSTROPHE = 0x0027; // '\nconst LEFTPARENTHESIS = 0x0028; // U+0028 LEFT PARENTHESIS (()\nconst RIGHTPARENTHESIS = 0x0029; // U+0029 RIGHT PARENTHESIS ())\n\nexport function decode(str) {\n const len = str.length;\n let start = 4; // length of \"url(\"\n let end = str.charCodeAt(len - 1) === RIGHTPARENTHESIS ? len - 2 : len - 1;\n let decoded = '';\n\n while (start < end && isWhiteSpace(str.charCodeAt(start))) {\n start++;\n }\n\n while (start < end && isWhiteSpace(str.charCodeAt(end))) {\n end--;\n }\n\n for (let i = start; i <= end; i++) {\n let code = str.charCodeAt(i);\n\n if (code === REVERSE_SOLIDUS) {\n // special case at the ending\n if (i === end) {\n // if the next input code point is EOF, do nothing\n // otherwise include last left parenthesis as escaped\n if (i !== len - 1) {\n decoded = str.substr(i + 1);\n }\n break;\n }\n\n code = str.charCodeAt(++i);\n\n // consume escaped\n if (isValidEscape(REVERSE_SOLIDUS, code)) {\n const escapeStart = i - 1;\n const escapeEnd = consumeEscaped(str, escapeStart);\n\n i = escapeEnd - 1;\n decoded += decodeEscaped(str.substring(escapeStart + 1, escapeEnd));\n } else {\n // \\r\\n\n if (code === 0x000d && str.charCodeAt(i + 1) === 0x000a) {\n i++;\n }\n }\n } else {\n decoded += str[i];\n }\n }\n\n return decoded;\n}\n\nexport function encode(str) {\n let encoded = '';\n let wsBeforeHexIsNeeded = false;\n\n for (let i = 0; i < str.length; i++) {\n const code = str.charCodeAt(i);\n\n // If the character is NULL (U+0000), then the REPLACEMENT CHARACTER (U+FFFD).\n if (code === 0x0000) {\n encoded += '\\uFFFD';\n continue;\n }\n\n // If the character is in the range [\\1-\\1f] (U+0001 to U+001F) or is U+007F,\n // the character escaped as code point.\n // Note: Do not compare with 0x0001 since 0x0000 is precessed before\n if (code <= 0x001f || code === 0x007F) {\n encoded += '\\\\' + code.toString(16);\n wsBeforeHexIsNeeded = true;\n continue;\n }\n\n if (code === SPACE ||\n code === REVERSE_SOLIDUS ||\n code === QUOTATION_MARK ||\n code === APOSTROPHE ||\n code === LEFTPARENTHESIS ||\n code === RIGHTPARENTHESIS) {\n encoded += '\\\\' + str.charAt(i);\n wsBeforeHexIsNeeded = false;\n } else {\n if (wsBeforeHexIsNeeded && isHexDigit(code)) {\n encoded += ' ';\n }\n\n encoded += str.charAt(i);\n wsBeforeHexIsNeeded = false;\n }\n }\n\n return 'url(' + encoded + ')';\n}\n", "import * as url from '../../utils/url.js';\nimport * as string from '../../utils/string.js';\nimport {\n Function as FunctionToken,\n String as StringToken,\n Url,\n RightParenthesis\n} from '../../tokenizer/index.js';\n\nexport const name = 'Url';\nexport const structure = {\n value: String\n};\n\n// | )\nexport function parse() {\n const start = this.tokenStart;\n let value;\n\n switch (this.tokenType) {\n case Url:\n value = url.decode(this.consume(Url));\n break;\n\n case FunctionToken:\n if (!this.cmpStr(this.tokenStart, this.tokenEnd, 'url(')) {\n this.error('Function name must be `url`');\n }\n\n this.eat(FunctionToken);\n this.skipSC();\n value = string.decode(this.consume(StringToken));\n this.skipSC();\n if (!this.eof) {\n this.eat(RightParenthesis);\n }\n break;\n\n default:\n this.error('Url or Function is expected');\n }\n\n return {\n type: 'Url',\n loc: this.getLocation(start, this.tokenStart),\n value\n };\n}\n\nexport function generate(node) {\n this.token(Url, url.encode(node.value));\n}\n", "export const name = 'Value';\nexport const structure = {\n children: [[]]\n};\n\nexport function parse() {\n const start = this.tokenStart;\n const children = this.readSequence(this.scope.Value);\n\n return {\n type: 'Value',\n loc: this.getLocation(start, this.tokenStart),\n children\n };\n}\n\nexport function generate(node) {\n this.children(node);\n}\n", "import { WhiteSpace } from '../../tokenizer/index.js';\n\nconst SPACE = Object.freeze({\n type: 'WhiteSpace',\n loc: null,\n value: ' '\n});\n\nexport const name = 'WhiteSpace';\nexport const structure = {\n value: String\n};\n\nexport function parse() {\n this.eat(WhiteSpace);\n return SPACE;\n\n // return {\n // type: 'WhiteSpace',\n // loc: this.getLocation(this.tokenStart, this.tokenEnd),\n // value: this.consume(WHITESPACE)\n // };\n}\n\nexport function generate(node) {\n this.token(WhiteSpace, node.value);\n}\n", "import * as node from '../node/index-generate.js';\n\nexport default {\n node\n};\n", "import { createGenerator } from './create.js';\nimport config from '../syntax/config/generator.js';\n\nexport default createGenerator(config);\n", "//\n// list\n// \u250C\u2500\u2500\u2500\u2500\u2500\u2500\u2510\n// \u250C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253C\u2500head \u2502\n// \u2502 \u2502 tail\u2500\u253C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510\n// \u2502 \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2518 \u2502\n// \u25BC \u25BC\n// item item item item\n// \u250C\u2500\u2500\u2500\u2500\u2500\u2500\u2510 \u250C\u2500\u2500\u2500\u2500\u2500\u2500\u2510 \u250C\u2500\u2500\u2500\u2500\u2500\u2500\u2510 \u250C\u2500\u2500\u2500\u2500\u2500\u2500\u2510\n// null \u25C0\u2500\u2500\u253C\u2500prev \u2502\u25C0\u2500\u2500\u2500\u253C\u2500prev \u2502\u25C0\u2500\u2500\u2500\u253C\u2500prev \u2502\u25C0\u2500\u2500\u2500\u253C\u2500prev \u2502\n// \u2502 next\u2500\u253C\u2500\u2500\u2500\u25B6\u2502 next\u2500\u253C\u2500\u2500\u2500\u25B6\u2502 next\u2500\u253C\u2500\u2500\u2500\u25B6\u2502 next\u2500\u253C\u2500\u2500\u25B6 null\n// \u251C\u2500\u2500\u2500\u2500\u2500\u2500\u2524 \u251C\u2500\u2500\u2500\u2500\u2500\u2500\u2524 \u251C\u2500\u2500\u2500\u2500\u2500\u2500\u2524 \u251C\u2500\u2500\u2500\u2500\u2500\u2500\u2524\n// \u2502 data \u2502 \u2502 data \u2502 \u2502 data \u2502 \u2502 data \u2502\n// \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2518 \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2518 \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2518 \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2518\n//\n\nlet releasedCursors = null;\n\nexport class List {\n static createItem(data) {\n return {\n prev: null,\n next: null,\n data\n };\n }\n\n constructor() {\n this.head = null;\n this.tail = null;\n this.cursor = null;\n }\n createItem(data) {\n return List.createItem(data);\n }\n\n // cursor helpers\n allocateCursor(prev, next) {\n let cursor;\n\n if (releasedCursors !== null) {\n cursor = releasedCursors;\n releasedCursors = releasedCursors.cursor;\n cursor.prev = prev;\n cursor.next = next;\n cursor.cursor = this.cursor;\n } else {\n cursor = {\n prev,\n next,\n cursor: this.cursor\n };\n }\n\n this.cursor = cursor;\n\n return cursor;\n }\n releaseCursor() {\n const { cursor } = this;\n\n this.cursor = cursor.cursor;\n cursor.prev = null;\n cursor.next = null;\n cursor.cursor = releasedCursors;\n releasedCursors = cursor;\n }\n updateCursors(prevOld, prevNew, nextOld, nextNew) {\n let { cursor } = this;\n\n while (cursor !== null) {\n if (cursor.prev === prevOld) {\n cursor.prev = prevNew;\n }\n\n if (cursor.next === nextOld) {\n cursor.next = nextNew;\n }\n\n cursor = cursor.cursor;\n }\n }\n *[Symbol.iterator]() {\n for (let cursor = this.head; cursor !== null; cursor = cursor.next) {\n yield cursor.data;\n }\n }\n\n // getters\n get size() {\n let size = 0;\n\n for (let cursor = this.head; cursor !== null; cursor = cursor.next) {\n size++;\n }\n\n return size;\n }\n get isEmpty() {\n return this.head === null;\n }\n get first() {\n return this.head && this.head.data;\n }\n get last() {\n return this.tail && this.tail.data;\n }\n\n // convertors\n fromArray(array) {\n let cursor = null;\n this.head = null;\n\n for (let data of array) {\n const item = List.createItem(data);\n\n if (cursor !== null) {\n cursor.next = item;\n } else {\n this.head = item;\n }\n\n item.prev = cursor;\n cursor = item;\n }\n\n this.tail = cursor;\n return this;\n }\n toArray() {\n return [...this];\n }\n toJSON() {\n return [...this];\n }\n\n // array-like methods\n forEach(fn, thisArg = this) {\n // push cursor\n const cursor = this.allocateCursor(null, this.head);\n\n while (cursor.next !== null) {\n const item = cursor.next;\n cursor.next = item.next;\n fn.call(thisArg, item.data, item, this);\n }\n\n // pop cursor\n this.releaseCursor();\n }\n forEachRight(fn, thisArg = this) {\n // push cursor\n const cursor = this.allocateCursor(this.tail, null);\n\n while (cursor.prev !== null) {\n const item = cursor.prev;\n cursor.prev = item.prev;\n fn.call(thisArg, item.data, item, this);\n }\n\n // pop cursor\n this.releaseCursor();\n }\n reduce(fn, initialValue, thisArg = this) {\n // push cursor\n let cursor = this.allocateCursor(null, this.head);\n let acc = initialValue;\n let item;\n\n while (cursor.next !== null) {\n item = cursor.next;\n cursor.next = item.next;\n\n acc = fn.call(thisArg, acc, item.data, item, this);\n }\n\n // pop cursor\n this.releaseCursor();\n\n return acc;\n }\n reduceRight(fn, initialValue, thisArg = this) {\n // push cursor\n let cursor = this.allocateCursor(this.tail, null);\n let acc = initialValue;\n let item;\n\n while (cursor.prev !== null) {\n item = cursor.prev;\n cursor.prev = item.prev;\n\n acc = fn.call(thisArg, acc, item.data, item, this);\n }\n\n // pop cursor\n this.releaseCursor();\n\n return acc;\n }\n some(fn, thisArg = this) {\n for (let cursor = this.head; cursor !== null; cursor = cursor.next) {\n if (fn.call(thisArg, cursor.data, cursor, this)) {\n return true;\n }\n }\n\n return false;\n }\n map(fn, thisArg = this) {\n const result = new List();\n\n for (let cursor = this.head; cursor !== null; cursor = cursor.next) {\n result.appendData(fn.call(thisArg, cursor.data, cursor, this));\n }\n\n return result;\n }\n filter(fn, thisArg = this) {\n const result = new List();\n\n for (let cursor = this.head; cursor !== null; cursor = cursor.next) {\n if (fn.call(thisArg, cursor.data, cursor, this)) {\n result.appendData(cursor.data);\n }\n }\n\n return result;\n }\n\n nextUntil(start, fn, thisArg = this) {\n if (start === null) {\n return;\n }\n\n // push cursor\n const cursor = this.allocateCursor(null, start);\n\n while (cursor.next !== null) {\n const item = cursor.next;\n cursor.next = item.next;\n if (fn.call(thisArg, item.data, item, this)) {\n break;\n }\n }\n\n // pop cursor\n this.releaseCursor();\n }\n prevUntil(start, fn, thisArg = this) {\n if (start === null) {\n return;\n }\n\n // push cursor\n const cursor = this.allocateCursor(start, null);\n\n while (cursor.prev !== null) {\n const item = cursor.prev;\n cursor.prev = item.prev;\n if (fn.call(thisArg, item.data, item, this)) {\n break;\n }\n }\n\n // pop cursor\n this.releaseCursor();\n }\n\n // mutation\n clear() {\n this.head = null;\n this.tail = null;\n }\n copy() {\n const result = new List();\n\n for (let data of this) {\n result.appendData(data);\n }\n\n return result;\n }\n prepend(item) {\n // head\n // ^\n // item\n this.updateCursors(null, item, this.head, item);\n\n // insert to the beginning of the list\n if (this.head !== null) {\n // new item <- first item\n this.head.prev = item;\n // new item -> first item\n item.next = this.head;\n } else {\n // if list has no head, then it also has no tail\n // in this case tail points to the new item\n this.tail = item;\n }\n\n // head always points to new item\n this.head = item;\n return this;\n }\n prependData(data) {\n return this.prepend(List.createItem(data));\n }\n append(item) {\n return this.insert(item);\n }\n appendData(data) {\n return this.insert(List.createItem(data));\n }\n insert(item, before = null) {\n if (before !== null) {\n // prev before\n // ^\n // item\n this.updateCursors(before.prev, item, before, item);\n\n if (before.prev === null) {\n // insert to the beginning of list\n if (this.head !== before) {\n throw new Error('before doesn\\'t belong to list');\n }\n // since head points to before therefore list doesn't empty\n // no need to check tail\n this.head = item;\n before.prev = item;\n item.next = before;\n this.updateCursors(null, item);\n } else {\n // insert between two items\n before.prev.next = item;\n item.prev = before.prev;\n before.prev = item;\n item.next = before;\n }\n } else {\n // tail\n // ^\n // item\n this.updateCursors(this.tail, item, null, item);\n\n // insert to the ending of the list\n if (this.tail !== null) {\n // last item -> new item\n this.tail.next = item;\n // last item <- new item\n item.prev = this.tail;\n } else {\n // if list has no tail, then it also has no head\n // in this case head points to new item\n this.head = item;\n }\n\n // tail always points to new item\n this.tail = item;\n }\n\n return this;\n }\n insertData(data, before) {\n return this.insert(List.createItem(data), before);\n }\n remove(item) {\n // item\n // ^\n // prev next\n this.updateCursors(item, item.prev, item, item.next);\n\n if (item.prev !== null) {\n item.prev.next = item.next;\n } else {\n if (this.head !== item) {\n throw new Error('item doesn\\'t belong to list');\n }\n\n this.head = item.next;\n }\n\n if (item.next !== null) {\n item.next.prev = item.prev;\n } else {\n if (this.tail !== item) {\n throw new Error('item doesn\\'t belong to list');\n }\n\n this.tail = item.prev;\n }\n\n item.prev = null;\n item.next = null;\n\n return item;\n }\n push(data) {\n this.insert(List.createItem(data));\n }\n pop() {\n return this.tail !== null ? this.remove(this.tail) : null;\n }\n unshift(data) {\n this.prepend(List.createItem(data));\n }\n shift() {\n return this.head !== null ? this.remove(this.head) : null;\n }\n prependList(list) {\n return this.insertList(list, this.head);\n }\n appendList(list) {\n return this.insertList(list);\n }\n insertList(list, before) {\n // ignore empty lists\n if (list.head === null) {\n return this;\n }\n\n if (before !== undefined && before !== null) {\n this.updateCursors(before.prev, list.tail, before, list.head);\n\n // insert in the middle of dist list\n if (before.prev !== null) {\n // before.prev <-> list.head\n before.prev.next = list.head;\n list.head.prev = before.prev;\n } else {\n this.head = list.head;\n }\n\n before.prev = list.tail;\n list.tail.next = before;\n } else {\n this.updateCursors(this.tail, list.tail, null, list.head);\n\n // insert to end of the list\n if (this.tail !== null) {\n // if destination list has a tail, then it also has a head,\n // but head doesn't change\n // dest tail -> source head\n this.tail.next = list.head;\n // dest tail <- source head\n list.head.prev = this.tail;\n } else {\n // if list has no a tail, then it also has no a head\n // in this case points head to new item\n this.head = list.head;\n }\n\n // tail always start point to new item\n this.tail = list.tail;\n }\n\n list.head = null;\n list.tail = null;\n return this;\n }\n replace(oldItem, newItemOrList) {\n if ('head' in newItemOrList) {\n this.insertList(newItemOrList, oldItem);\n } else {\n this.insert(newItemOrList, oldItem);\n }\n\n this.remove(oldItem);\n }\n}\n", "export function createCustomError(name, message) {\n // use Object.create(), because some VMs prevent setting line/column otherwise\n // (iOS Safari 10 even throws an exception)\n const error = Object.create(SyntaxError.prototype);\n const errorStack = new Error();\n\n return Object.assign(error, {\n name,\n message,\n get stack() {\n return (errorStack.stack || '').replace(/^(.+\\n){1,3}/, `${name}: ${message}\\n`);\n }\n });\n};\n", "import { createCustomError } from '../utils/create-custom-error.js';\n\nconst MAX_LINE_LENGTH = 100;\nconst OFFSET_CORRECTION = 60;\nconst TAB_REPLACEMENT = ' ';\n\nfunction sourceFragment({ source, line, column, baseLine, baseColumn }, extraLines) {\n function processLines(start, end) {\n return lines\n .slice(start, end)\n .map((line, idx) =>\n String(start + idx + 1).padStart(maxNumLength) + ' |' + line\n ).join('\\n');\n }\n\n const prelines = '\\n'.repeat(Math.max(baseLine - 1, 0));\n const precolumns = ' '.repeat(Math.max(baseColumn - 1, 0));\n const lines = (prelines + precolumns + source).split(/\\r\\n?|\\n|\\f/);\n const startLine = Math.max(1, line - extraLines) - 1;\n const endLine = Math.min(line + extraLines, lines.length + 1);\n const maxNumLength = Math.max(4, String(endLine).length) + 1;\n let cutLeft = 0;\n\n // column correction according to replaced tab before column\n column += (TAB_REPLACEMENT.length - 1) * (lines[line - 1].substr(0, column - 1).match(/\\t/g) || []).length;\n\n if (column > MAX_LINE_LENGTH) {\n cutLeft = column - OFFSET_CORRECTION + 3;\n column = OFFSET_CORRECTION - 2;\n }\n\n for (let i = startLine; i <= endLine; i++) {\n if (i >= 0 && i < lines.length) {\n lines[i] = lines[i].replace(/\\t/g, TAB_REPLACEMENT);\n lines[i] =\n (cutLeft > 0 && lines[i].length > cutLeft ? '\\u2026' : '') +\n lines[i].substr(cutLeft, MAX_LINE_LENGTH - 2) +\n (lines[i].length > cutLeft + MAX_LINE_LENGTH - 1 ? '\\u2026' : '');\n }\n }\n\n return [\n processLines(startLine, line),\n new Array(column + maxNumLength + 2).join('-') + '^',\n processLines(line, endLine)\n ].filter(Boolean)\n .join('\\n')\n .replace(/^(\\s+\\d+\\s+\\|\\n)+/, '')\n .replace(/\\n(\\s+\\d+\\s+\\|)+$/, '');\n}\n\nexport function SyntaxError(message, source, offset, line, column, baseLine = 1, baseColumn = 1) {\n const error = Object.assign(createCustomError('SyntaxError', message), {\n source,\n offset,\n line,\n column,\n sourceFragment(extraLines) {\n return sourceFragment({ source, line, column, baseLine, baseColumn }, isNaN(extraLines) ? 0 : extraLines);\n },\n get formattedMessage() {\n return (\n `Parse error: ${message}\\n` +\n sourceFragment({ source, line, column, baseLine, baseColumn }, 2)\n );\n }\n });\n\n return error;\n}\n", "import { WhiteSpace, Comment } from '../tokenizer/index.js';\n\nexport function readSequence(recognizer) {\n const children = this.createList();\n let space = false;\n const context = {\n recognizer\n };\n\n while (!this.eof) {\n switch (this.tokenType) {\n case Comment:\n this.next();\n continue;\n\n case WhiteSpace:\n space = true;\n this.next();\n continue;\n }\n\n let child = recognizer.getNode.call(this, context);\n\n if (child === undefined) {\n break;\n }\n\n if (space) {\n if (recognizer.onWhiteSpace) {\n recognizer.onWhiteSpace.call(this, child, children, context);\n }\n space = false;\n }\n\n children.push(child);\n }\n\n if (space && recognizer.onWhiteSpace) {\n recognizer.onWhiteSpace.call(this, null, children, context);\n }\n\n return children;\n};\n", "import { List } from '../utils/List.js';\nimport { SyntaxError } from './SyntaxError.js';\nimport {\n tokenize,\n OffsetToLocation,\n TokenStream,\n tokenNames,\n\n consumeNumber,\n findWhiteSpaceStart,\n cmpChar,\n cmpStr,\n\n WhiteSpace,\n Comment,\n Ident,\n Function as FunctionToken,\n Url,\n Hash,\n Percentage,\n Number as NumberToken\n} from '../tokenizer/index.js';\nimport { readSequence } from './sequence.js';\n\nconst NOOP = () => {};\nconst EXCLAMATIONMARK = 0x0021; // U+0021 EXCLAMATION MARK (!)\nconst NUMBERSIGN = 0x0023; // U+0023 NUMBER SIGN (#)\nconst SEMICOLON = 0x003B; // U+003B SEMICOLON (;)\nconst LEFTCURLYBRACKET = 0x007B; // U+007B LEFT CURLY BRACKET ({)\nconst NULL = 0;\n\nconst arrayMethods = {\n createList() {\n return [];\n },\n createSingleNodeList(node) {\n return [node];\n },\n getFirstListNode(list) {\n return list && list[0] || null;\n },\n getLastListNode(list) {\n return list && list.length > 0 ? list[list.length - 1] : null;\n }\n};\n\nconst listMethods = {\n createList() {\n return new List();\n },\n createSingleNodeList(node) {\n return new List().appendData(node);\n },\n getFirstListNode(list) {\n return list && list.first;\n },\n getLastListNode(list) {\n return list && list.last;\n }\n};\n\nfunction createParseContext(name) {\n return function() {\n return this[name]();\n };\n}\n\nfunction fetchParseValues(dict) {\n const result = Object.create(null);\n\n for (const name of Object.keys(dict)) {\n const item = dict[name];\n const fn = item.parse || item;\n\n if (fn) {\n result[name] = fn;\n }\n }\n\n return result;\n}\n\nfunction processConfig(config) {\n const parseConfig = {\n context: Object.create(null),\n features: Object.assign(Object.create(null), config.features),\n scope: Object.assign(Object.create(null), config.scope),\n atrule: fetchParseValues(config.atrule),\n pseudo: fetchParseValues(config.pseudo),\n node: fetchParseValues(config.node)\n };\n\n for (const [name, context] of Object.entries(config.parseContext)) {\n switch (typeof context) {\n case 'function':\n parseConfig.context[name] = context;\n break;\n\n case 'string':\n parseConfig.context[name] = createParseContext(context);\n break;\n }\n }\n\n return {\n config: parseConfig,\n ...parseConfig,\n ...parseConfig.node\n };\n}\n\nexport function createParser(config) {\n let source = '';\n let filename = '';\n let needPositions = false;\n let onParseError = NOOP;\n let onParseErrorThrow = false;\n\n const locationMap = new OffsetToLocation();\n const parser = Object.assign(new TokenStream(), processConfig(config || {}), {\n parseAtrulePrelude: true,\n parseRulePrelude: true,\n parseValue: true,\n parseCustomProperty: false,\n\n readSequence,\n\n consumeUntilBalanceEnd: () => 0,\n consumeUntilLeftCurlyBracket(code) {\n return code === LEFTCURLYBRACKET ? 1 : 0;\n },\n consumeUntilLeftCurlyBracketOrSemicolon(code) {\n return code === LEFTCURLYBRACKET || code === SEMICOLON ? 1 : 0;\n },\n consumeUntilExclamationMarkOrSemicolon(code) {\n return code === EXCLAMATIONMARK || code === SEMICOLON ? 1 : 0;\n },\n consumeUntilSemicolonIncluded(code) {\n return code === SEMICOLON ? 2 : 0;\n },\n\n createList: NOOP,\n createSingleNodeList: NOOP,\n getFirstListNode: NOOP,\n getLastListNode: NOOP,\n\n parseWithFallback(consumer, fallback) {\n const startIndex = this.tokenIndex;\n\n try {\n return consumer.call(this);\n } catch (e) {\n if (onParseErrorThrow) {\n throw e;\n }\n\n this.skip(startIndex - this.tokenIndex);\n const fallbackNode = fallback.call(this);\n\n onParseErrorThrow = true;\n onParseError(e, fallbackNode);\n onParseErrorThrow = false;\n\n return fallbackNode;\n }\n },\n\n lookupNonWSType(offset) {\n let type;\n\n do {\n type = this.lookupType(offset++);\n if (type !== WhiteSpace && type !== Comment) {\n return type;\n }\n } while (type !== NULL);\n\n return NULL;\n },\n\n charCodeAt(offset) {\n return offset >= 0 && offset < source.length ? source.charCodeAt(offset) : 0;\n },\n substring(offsetStart, offsetEnd) {\n return source.substring(offsetStart, offsetEnd);\n },\n substrToCursor(start) {\n return this.source.substring(start, this.tokenStart);\n },\n\n cmpChar(offset, charCode) {\n return cmpChar(source, offset, charCode);\n },\n cmpStr(offsetStart, offsetEnd, str) {\n return cmpStr(source, offsetStart, offsetEnd, str);\n },\n\n consume(tokenType) {\n const start = this.tokenStart;\n\n this.eat(tokenType);\n\n return this.substrToCursor(start);\n },\n consumeFunctionName() {\n const name = source.substring(this.tokenStart, this.tokenEnd - 1);\n\n this.eat(FunctionToken);\n\n return name;\n },\n consumeNumber(type) {\n const number = source.substring(this.tokenStart, consumeNumber(source, this.tokenStart));\n\n this.eat(type);\n\n return number;\n },\n\n eat(tokenType) {\n if (this.tokenType !== tokenType) {\n const tokenName = tokenNames[tokenType].slice(0, -6).replace(/-/g, ' ').replace(/^./, m => m.toUpperCase());\n let message = `${/[[\\](){}]/.test(tokenName) ? `\"${tokenName}\"` : tokenName} is expected`;\n let offset = this.tokenStart;\n\n // tweak message and offset\n switch (tokenType) {\n case Ident:\n // when identifier is expected but there is a function or url\n if (this.tokenType === FunctionToken || this.tokenType === Url) {\n offset = this.tokenEnd - 1;\n message = 'Identifier is expected but function found';\n } else {\n message = 'Identifier is expected';\n }\n break;\n\n case Hash:\n if (this.isDelim(NUMBERSIGN)) {\n this.next();\n offset++;\n message = 'Name is expected';\n }\n break;\n\n case Percentage:\n if (this.tokenType === NumberToken) {\n offset = this.tokenEnd;\n message = 'Percent sign is expected';\n }\n break;\n }\n\n this.error(message, offset);\n }\n\n this.next();\n },\n eatIdent(name) {\n if (this.tokenType !== Ident || this.lookupValue(0, name) === false) {\n this.error(`Identifier \"${name}\" is expected`);\n }\n\n this.next();\n },\n eatDelim(code) {\n if (!this.isDelim(code)) {\n this.error(`Delim \"${String.fromCharCode(code)}\" is expected`);\n }\n\n this.next();\n },\n\n getLocation(start, end) {\n if (needPositions) {\n return locationMap.getLocationRange(\n start,\n end,\n filename\n );\n }\n\n return null;\n },\n getLocationFromList(list) {\n if (needPositions) {\n const head = this.getFirstListNode(list);\n const tail = this.getLastListNode(list);\n return locationMap.getLocationRange(\n head !== null ? head.loc.start.offset - locationMap.startOffset : this.tokenStart,\n tail !== null ? tail.loc.end.offset - locationMap.startOffset : this.tokenStart,\n filename\n );\n }\n\n return null;\n },\n\n error(message, offset) {\n const location = typeof offset !== 'undefined' && offset < source.length\n ? locationMap.getLocation(offset)\n : this.eof\n ? locationMap.getLocation(findWhiteSpaceStart(source, source.length - 1))\n : locationMap.getLocation(this.tokenStart);\n\n throw new SyntaxError(\n message || 'Unexpected input',\n source,\n location.offset,\n location.line,\n location.column,\n locationMap.startLine,\n locationMap.startColumn\n );\n }\n });\n const createTokenIterateAPI = () => ({\n filename,\n source,\n tokenCount: parser.tokenCount,\n\n getTokenType: (index) =>\n parser.getTokenType(index),\n getTokenTypeName: (index) =>\n tokenNames[parser.getTokenType(index)],\n getTokenStart: (index) =>\n parser.getTokenStart(index),\n getTokenEnd: (index) =>\n parser.getTokenEnd(index),\n getTokenValue: (index) =>\n parser.source.substring(parser.getTokenStart(index), parser.getTokenEnd(index)),\n\n substring: (start, end) =>\n parser.source.substring(start, end),\n\n balance: parser.balance.subarray(0, parser.tokenCount + 1),\n isBlockOpenerTokenType: parser.isBlockOpenerTokenType,\n isBlockCloserTokenType: parser.isBlockCloserTokenType,\n getBlockTokenPairIndex: (index) =>\n parser.getBlockTokenPairIndex(index),\n\n getLocation: (offset) =>\n locationMap.getLocation(offset, filename),\n getRangeLocation: (start, end) =>\n locationMap.getLocationRange(start, end, filename)\n });\n\n const parse = function(source_, options) {\n source = source_;\n options = options || {};\n\n parser.setSource(source, tokenize);\n locationMap.setSource(\n source,\n options.offset,\n options.line,\n options.column\n );\n\n filename = options.filename || '';\n needPositions = Boolean(options.positions);\n onParseError = typeof options.onParseError === 'function' ? options.onParseError : NOOP;\n onParseErrorThrow = false;\n\n parser.parseAtrulePrelude = 'parseAtrulePrelude' in options ? Boolean(options.parseAtrulePrelude) : true;\n parser.parseRulePrelude = 'parseRulePrelude' in options ? Boolean(options.parseRulePrelude) : true;\n parser.parseValue = 'parseValue' in options ? Boolean(options.parseValue) : true;\n parser.parseCustomProperty = 'parseCustomProperty' in options ? Boolean(options.parseCustomProperty) : false;\n\n const { context = 'default', list = true, onComment, onToken } = options;\n\n if (context in parser.context === false) {\n throw new Error('Unknown context `' + context + '`');\n }\n\n Object.assign(parser, list ? listMethods : arrayMethods);\n\n if (Array.isArray(onToken)) {\n parser.forEachToken((type, start, end) => {\n onToken.push({ type, start, end });\n });\n } else if (typeof onToken === 'function') {\n parser.forEachToken(onToken.bind(createTokenIterateAPI()));\n }\n\n if (typeof onComment === 'function') {\n parser.forEachToken((type, start, end) => {\n if (type === Comment) {\n const loc = parser.getLocation(start, end);\n const value = cmpStr(source, end - 2, end, '*/')\n ? source.slice(start + 2, end - 2)\n : source.slice(start + 2, end);\n\n onComment(value, loc);\n }\n });\n }\n\n const ast = parser.context[context].call(parser, options);\n\n if (!parser.eof) {\n parser.error();\n }\n\n return ast;\n };\n\n return Object.assign(parse, {\n SyntaxError,\n config: parser.config\n });\n};\n", "import {\n Delim,\n Ident,\n Dimension,\n Percentage,\n Number as NumberToken,\n Hash,\n Colon,\n LeftSquareBracket\n} from '../../tokenizer/index.js';\n\nconst NUMBERSIGN = 0x0023; // U+0023 NUMBER SIGN (#)\nconst AMPERSAND = 0x0026; // U+0026 AMPERSAND (&)\nconst ASTERISK = 0x002A; // U+002A ASTERISK (*)\nconst PLUSSIGN = 0x002B; // U+002B PLUS SIGN (+)\nconst SOLIDUS = 0x002F; // U+002F SOLIDUS (/)\nconst FULLSTOP = 0x002E; // U+002E FULL STOP (.)\nconst GREATERTHANSIGN = 0x003E; // U+003E GREATER-THAN SIGN (>)\nconst VERTICALLINE = 0x007C; // U+007C VERTICAL LINE (|)\nconst TILDE = 0x007E; // U+007E TILDE (~)\n\nfunction onWhiteSpace(next, children) {\n if (children.last !== null && children.last.type !== 'Combinator' &&\n next !== null && next.type !== 'Combinator') {\n children.push({ // FIXME: this.Combinator() should be used instead\n type: 'Combinator',\n loc: null,\n name: ' '\n });\n }\n}\n\nfunction getNode() {\n switch (this.tokenType) {\n case LeftSquareBracket:\n return this.AttributeSelector();\n\n case Hash:\n return this.IdSelector();\n\n case Colon:\n if (this.lookupType(1) === Colon) {\n return this.PseudoElementSelector();\n } else {\n return this.PseudoClassSelector();\n }\n\n case Ident:\n return this.TypeSelector();\n\n case NumberToken:\n case Percentage:\n return this.Percentage();\n\n case Dimension:\n // throws when .123ident\n if (this.charCodeAt(this.tokenStart) === FULLSTOP) {\n this.error('Identifier is expected', this.tokenStart + 1);\n }\n break;\n\n case Delim: {\n const code = this.charCodeAt(this.tokenStart);\n\n switch (code) {\n case PLUSSIGN:\n case GREATERTHANSIGN:\n case TILDE:\n case SOLIDUS: // /deep/\n return this.Combinator();\n\n case FULLSTOP:\n return this.ClassSelector();\n\n case ASTERISK:\n case VERTICALLINE:\n return this.TypeSelector();\n\n case NUMBERSIGN:\n return this.IdSelector();\n\n case AMPERSAND:\n return this.NestingSelector();\n }\n\n break;\n }\n }\n};\n\nexport default {\n onWhiteSpace,\n getNode\n};\n", "import { Comma, String as StringToken, Ident, RightParenthesis } from '../../tokenizer/index.js';\n\nexport function parseLanguageRangeList() {\n const children = this.createList();\n\n this.skipSC();\n\n loop: while (!this.eof) {\n switch (this.tokenType) {\n case Ident:\n children.push(this.Identifier());\n break;\n\n case StringToken:\n children.push(this.String());\n break;\n\n case Comma:\n children.push(this.Operator());\n break;\n\n case RightParenthesis:\n break loop;\n\n default:\n this.error('Identifier, string or comma is expected');\n }\n\n this.skipSC();\n }\n\n return children;\n}\n", "import { parseLanguageRangeList } from './lang.js';\n\nconst selectorList = {\n parse() {\n return this.createSingleNodeList(\n this.SelectorList()\n );\n }\n};\n\nconst selector = {\n parse() {\n return this.createSingleNodeList(\n this.Selector()\n );\n }\n};\n\nconst identList = {\n parse() {\n return this.createSingleNodeList(\n this.Identifier()\n );\n }\n};\n\nconst langList = {\n parse: parseLanguageRangeList\n};\n\nconst nth = {\n parse() {\n return this.createSingleNodeList(\n this.Nth()\n );\n }\n};\n\nexport default {\n 'dir': identList,\n 'has': selectorList,\n 'lang': langList,\n 'matches': selectorList,\n 'is': selectorList,\n '-moz-any': selectorList,\n '-webkit-any': selectorList,\n 'where': selectorList,\n 'not': selectorList,\n 'nth-child': nth,\n 'nth-last-child': nth,\n 'nth-last-of-type': nth,\n 'nth-of-type': nth,\n 'slotted': selector,\n 'host': selector,\n 'host-context': selector\n};\n", "export { parse as AnPlusB } from './AnPlusB.js';\nexport { parse as AttributeSelector } from './AttributeSelector.js';\nexport { parse as ClassSelector } from './ClassSelector.js';\nexport { parse as Combinator } from './Combinator.js';\nexport { parse as Identifier } from './Identifier.js';\nexport { parse as IdSelector } from './IdSelector.js';\nexport { parse as NestingSelector } from './NestingSelector.js';\nexport { parse as Nth } from './Nth.js';\nexport { parse as Operator } from './Operator.js';\nexport { parse as Percentage } from './Percentage.js';\nexport { parse as PseudoClassSelector } from './PseudoClassSelector.js';\nexport { parse as PseudoElementSelector } from './PseudoElementSelector.js';\nexport { parse as Raw } from './Raw.js';\nexport { parse as Selector } from './Selector.js';\nexport { parse as SelectorList } from './SelectorList.js';\nexport { parse as String } from './String.js';\nexport { parse as TypeSelector } from './TypeSelector.js';\n", "import { Selector } from '../scope/index.js';\nimport pseudo from '../pseudo/index.js';\nimport * as node from '../node/index-parse-selector.js';\n\nexport default {\n parseContext: {\n default: 'SelectorList',\n selectorList: 'SelectorList',\n selector: 'Selector'\n },\n scope: { Selector },\n atrule: {},\n pseudo,\n node\n};\n", "import { createParser } from './create.js';\nimport config from '../syntax/config/parser-selector.js';\n\nexport default createParser(config);\n", "const compare = (s1, s2) => {\n if (s1.a === s2.a) {\n if (s1.b === s2.b) {\n return s1.c - s2.c;\n }\n return s1.b - s2.b;\n }\n return s1.a - s2.a;\n};\n\nconst equals = (s1, s2) => {\n return compare(s1, s2) === 0;\n};\n\nconst greaterThan = (s1, s2) => {\n return compare(s1, s2) > 0;\n};\n\nconst lessThan = (s1, s2) => {\n return compare(s1, s2) < 0;\n};\n\nexport { compare, equals, greaterThan, lessThan };\n", "import { compare } from './compare.js';\n\nconst sort = (specificities, order = 'ASC') => {\n const sorted = specificities.sort(compare);\n\n if (order === 'DESC') {\n return sorted.reverse();\n }\n\n return sorted;\n};\n\nconst sortAsc = (...specificities) => {\n return sort(specificities, 'ASC');\n};\n\nconst sortDesc = (...specificities) => {\n return sort(specificities, 'DESC');\n};\n\nexport { sortAsc, sortDesc };\n", "import { sortAsc, sortDesc } from './sort.js';\n\nconst max = (...specificities) => {\n const sorted = sortDesc(...specificities);\n return sorted[0];\n};\n\nconst min = (...specificities) => {\n const sorted = sortAsc(...specificities);\n return sorted[0];\n};\n\nexport { max, min };\n", "import parse from 'css-tree/selector-parser';\nimport Specificity from '../index.js';\nimport { max } from './../util/index.js';\n\n/** @param {import('css-tree').Selector} selectorAST */\nconst calculateForAST = (selectorAST) => {\n // Quit while you're ahead\n if (!selectorAST || selectorAST.type !== 'Selector') {\n throw new TypeError(`Passed in source is not a Selector AST`);\n }\n\n // https://www.w3.org/TR/selectors-4/#specificity-rules\n let a = 0; /* ID Selectors */\n let b = 0; /* Class selectors, Attributes selectors, and Pseudo-classes */\n let c = 0; /* Type selectors and Pseudo-elements */\n\n selectorAST.children.forEach((child) => {\n switch (child.type) {\n case 'IdSelector':\n a += 1;\n break;\n\n case 'AttributeSelector':\n case 'ClassSelector':\n b += 1;\n break;\n\n case 'PseudoClassSelector':\n switch (child.name.toLowerCase()) {\n // \u201CThe specificity of a :where() pseudo-class is replaced by zero.\u201D\n case 'where':\n // Noop :)\n break;\n\n case '-webkit-any':\n case 'any':\n if (child.children?.first) {\n b += 1;\n }\n break;\n\n // \u201CThe specificity of an :is(), :not(), or :has() pseudo-class is replaced by the specificity of the most specific complex selector in its selector list argument.\u201C\n case '-moz-any':\n case 'is':\n case 'matches':\n case 'not':\n case 'has':\n if (child.children?.first) {\n // Calculate Specificity from nested SelectorList\n const max1 = max(...calculate(child.children.first));\n\n // Adjust orig specificity\n a += max1.a;\n b += max1.b;\n c += max1.c;\n }\n\n break;\n\n // \u201CThe specificity of an :nth-child() or :nth-last-child() selector is the specificity of the pseudo class itself (counting as one pseudo-class selector) plus the specificity of the most specific complex selector in its selector list argument\u201D\n case 'nth-child':\n case 'nth-last-child':\n b += 1;\n\n if (child.children?.first?.selector) {\n // Calculate Specificity from SelectorList\n const max2 = max(...calculate(child.children.first.selector));\n\n // Adjust orig specificity\n a += max2.a;\n b += max2.b;\n c += max2.c;\n }\n break;\n\n // \u201CThe specificity of :host is that of a pseudo-class. The specificity of :host() is that of a pseudo-class, plus the specificity of its argument.\u201D\n // \u201CThe specificity of :host-context() is that of a pseudo-class, plus the specificity of its argument.\u201D\n case 'host-context':\n case 'host':\n b += 1;\n\n if (child.children?.first?.children) {\n // Workaround to a css-tree bug in which it allows complex selectors instead of only compound selectors\n // We work around it by filtering out any Combinator and successive Selectors\n const childAST = { type: 'Selector', children: [] };\n let foundCombinator = false;\n child.children.first.children.forEach((entry) => {\n if (foundCombinator) return false;\n if (entry.type === 'Combinator') {\n foundCombinator = true;\n return false;\n }\n childAST.children.push(entry);\n });\n\n // Calculate Specificity from Selector\n const childSpecificity = calculate(childAST)[0];\n\n // Adjust orig specificity\n a += childSpecificity.a;\n b += childSpecificity.b;\n c += childSpecificity.c;\n }\n break;\n\n // Improper use of Pseudo-Class Selectors instead of a Pseudo-Element\n // @ref https://developer.mozilla.org/en-US/docs/Web/CSS/Pseudo-elements#index\n case 'after':\n case 'before':\n case 'first-letter':\n case 'first-line':\n c += 1;\n break;\n\n default:\n b += 1;\n break;\n }\n break;\n\n case 'PseudoElementSelector':\n switch (child.name) {\n // \u201CThe specificity of ::slotted() is that of a pseudo-element, plus the specificity of its argument.\u201D\n case 'slotted':\n c += 1;\n\n if (child.children?.first?.children) {\n // Workaround to a css-tree bug in which it allows complex selectors instead of only compound selectors\n // We work around it by filtering out any Combinator and successive Selectors\n const childAST = { type: 'Selector', children: [] };\n let foundCombinator = false;\n child.children.first.children.forEach((entry) => {\n if (foundCombinator) return false;\n if (entry.type === 'Combinator') {\n foundCombinator = true;\n return false;\n }\n childAST.children.push(entry);\n });\n\n // Calculate Specificity from Selector\n const childSpecificity = calculate(childAST)[0];\n\n // Adjust orig specificity\n a += childSpecificity.a;\n b += childSpecificity.b;\n c += childSpecificity.c;\n }\n break;\n\n case 'view-transition-group':\n case 'view-transition-image-pair':\n case 'view-transition-old':\n case 'view-transition-new':\n // The specificity of a view-transition selector with a * argument is zero.\n if (child.children?.first?.value === '*') {\n break;\n }\n // The specificity of a view-transition selector with an argument is the same\n // as for other pseudo - elements, and is equivalent to a type selector.\n c += 1;\n break;\n\n case 'highlight':\n if (child.children?.size > 0) {\n // The specificity of a ::highlight() selector with a * argument is zero.\n if (child.children.first?.value === '*') {\n break;\n }\n // The specificity of a ::highlight() selector with a argument\n // is equivalent to a type selector.\n c += 1;\n }\n break;\n\n default:\n c += 1;\n break;\n }\n break;\n\n case 'TypeSelector':\n // Omit namespace\n let typeSelector = child.name;\n if (typeSelector.includes('|')) {\n typeSelector = typeSelector.split('|')[1];\n }\n\n // \u201CIgnore the universal selector\u201D\n if (typeSelector !== '*') {\n c += 1;\n }\n break;\n\n default:\n // NOOP\n break;\n }\n });\n\n return new Specificity({ a, b, c }, selectorAST);\n};\n\nconst convertToAST = (source) => {\n // The passed in argument was a String.\n // ~> Let's try and parse to an AST\n if (typeof source === 'string' || source instanceof String) {\n try {\n return parse(source, {\n context: 'selectorList',\n });\n } catch (e) {\n throw new TypeError(`Could not convert passed in source '${source}' to SelectorList: ${e.message}`);\n }\n }\n\n // The passed in argument was an Object.\n // ~> Let's verify if it's a AST of the type Selector or SelectorList\n if (source instanceof Object) {\n if (source.type && ['Selector', 'SelectorList'].includes(source.type)) {\n return source;\n }\n\n // Manually parsing subtree when the child is of the type Raw, most likely due to https://github.com/csstree/csstree/issues/151\n if (source.type && source.type === 'Raw') {\n try {\n return parse(source.value, {\n context: 'selectorList',\n });\n } catch (e) {\n throw new TypeError(`Could not convert passed in source to SelectorList: ${e.message}`);\n }\n }\n\n throw new TypeError(`Passed in source is an Object but no AST / AST of the type Selector or SelectorList`);\n }\n\n throw new TypeError(`Passed in source is not a String nor an Object. I don't know what to do with it.`);\n};\n\n/**\n * @param {string} selector\n * @returns {Specificity[]}\n */\nconst calculate = (selector) => {\n // Quit while you're ahead\n if (!selector) {\n return [];\n }\n\n // Make sure we have a SelectorList AST\n // If not, an exception will be thrown\n const ast = convertToAST(selector);\n\n // Selector?\n if (ast.type === 'Selector') {\n return [calculateForAST(selector)];\n }\n\n // SelectorList?\n // ~> Calculate Specificity for each contained Selector\n if (ast.type === 'SelectorList') {\n const specificities = [];\n ast.children.forEach((childAST) => {\n const specificity = calculateForAST(childAST);\n specificities.push(specificity);\n });\n return specificities;\n }\n};\n\nexport { calculate, calculateForAST };\n"], + "mappings": "8pBAAA,IAAAA,GAAAC,GAAAC,IAAA,CAOA,IAAIC,GAAe,mEAAmE,MAAM,EAAE,EAK9FD,GAAQ,OAAS,SAAUE,EAAQ,CACjC,GAAI,GAAKA,GAAUA,EAASD,GAAa,OACvC,OAAOA,GAAaC,CAAM,EAE5B,MAAM,IAAI,UAAU,6BAA+BA,CAAM,CAC3D,EAMAF,GAAQ,OAAS,SAAUG,EAAU,CACnC,IAAIC,EAAO,GACPC,EAAO,GAEPC,EAAU,GACVC,EAAU,IAEVC,EAAO,GACPC,EAAO,GAEPC,EAAO,GACPC,EAAQ,GAERC,EAAe,GACfC,EAAe,GAGnB,OAAIT,GAAQD,GAAYA,GAAYE,EAC1BF,EAAWC,EAIjBE,GAAWH,GAAYA,GAAYI,EAC7BJ,EAAWG,EAAUM,EAI3BJ,GAAQL,GAAYA,GAAYM,EAC1BN,EAAWK,EAAOK,EAIxBV,GAAYO,EACP,GAILP,GAAYQ,EACP,GAIF,EACT,IClE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CAEA,QAAS,CACL,MAAO,CACH,SAAU,KAAK,eAAe,EAC9B,SAAU,KAAK,SAAS,EACxB,QAAS,KAAK,QAAQ,EACtB,SAAU,KAAK,SAAS,CAC5B,CACJ,CAEA,UAAUC,EAAkB,CACxB,OAAOC,GAAO,KAAMD,CAAgB,CACxC,CAEA,cAAcA,EAAkB,CAC5B,OAAOE,GAAY,KAAMF,CAAgB,CAC7C,CAEA,WAAWA,EAAkB,CACzB,OAAOG,GAAS,KAAMH,CAAgB,CAC1C,CAEA,OAAO,UAAUH,EAAU,CACvB,OAAOO,GAAUP,CAAQ,CAC7B,CAEA,OAAO,gBAAgBA,EAAU,CAC7B,OAAOQ,GAAgBR,CAAQ,CACnC,CAEA,OAAO,QAAQS,EAAIC,EAAI,CACnB,OAAOC,GAAQF,EAAIC,CAAE,CACzB,CAEA,OAAO,OAAOD,EAAIC,EAAI,CAClB,OAAON,GAAOK,EAAIC,CAAE,CACxB,CAEA,OAAO,SAASD,EAAIC,EAAI,CACpB,OAAOJ,GAASG,EAAIC,CAAE,CAC1B,CAEA,OAAO,YAAYD,EAAIC,EAAI,CACvB,OAAOL,GAAYI,EAAIC,CAAE,CAC7B,CAEA,OAAO,OAAOE,EAAe,CACzB,OAAOC,GAAI,GAAGD,CAAa,CAC/B,CAEA,OAAO,OAAOA,EAAe,CACzB,OAAOE,GAAI,GAAGF,CAAa,CAC/B,CAEA,OAAO,WAAWA,EAAe,CAC7B,OAAOG,GAAQ,GAAGH,CAAa,CACnC,CAEA,OAAO,YAAYA,EAAe,CAC9B,OAAOI,GAAS,GAAGJ,CAAa,CACpC,CACJ,EAEOK,GAAQnB", + "names": ["require_base64", "__commonJSMin", "exports", "intToCharMap", "number", "charCode", "bigA", "bigZ", "littleA", "littleZ", "zero", "nine", "plus", "slash", "littleOffset", "numberOffset", "require_base64_vlq", "__commonJSMin", "exports", "base64", "VLQ_BASE_SHIFT", "VLQ_BASE", "VLQ_BASE_MASK", "VLQ_CONTINUATION_BIT", "toVLQSigned", "aValue", "fromVLQSigned", "isNegative", "shifted", "encoded", "digit", "vlq", "aStr", "aIndex", "aOutParam", "strLen", "result", "shift", "continuation", "require_util", "__commonJSMin", "exports", "getArg", "aArgs", "aName", "aDefaultValue", "urlRegexp", "dataUrlRegexp", "urlParse", "aUrl", "match", "urlGenerate", "aParsedUrl", "url", "MAX_CACHED_INPUTS", "lruMemoize", "f", "cache", "input", "i", "temp", "result", "normalize", "aPath", "path", "isAbsolute", "parts", "start", "part", "up", "join", "aRoot", "aPathUrl", "aRootUrl", "joined", "relative", "level", "index", "supportsNullProto", "obj", "identity", "s", "toSetString", "aStr", "isProtoString", "fromSetString", "length", "compareByOriginalPositions", "mappingA", "mappingB", "onlyCompareOriginal", "cmp", "strcmp", "compareByOriginalPositionsNoSource", "compareByGeneratedPositionsDeflated", "onlyCompareGenerated", "compareByGeneratedPositionsDeflatedNoLine", "aStr1", "aStr2", "compareByGeneratedPositionsInflated", "parseSourceMapInput", "str", "computeSourceURL", "sourceRoot", "sourceURL", "sourceMapURL", "parsed", "require_array_set", "__commonJSMin", "exports", "util", "has", "hasNativeMap", "ArraySet", "aArray", "aAllowDuplicates", "set", "len", "aStr", "sStr", "isDuplicate", "idx", "aIdx", "require_mapping_list", "__commonJSMin", "exports", "util", "generatedPositionAfter", "mappingA", "mappingB", "lineA", "lineB", "columnA", "columnB", "MappingList", "aCallback", "aThisArg", "aMapping", "require_source_map_generator", "__commonJSMin", "exports", "base64VLQ", "util", "ArraySet", "MappingList", "SourceMapGenerator", "aArgs", "aSourceMapConsumer", "generatorOps", "sourceRoot", "generator", "mapping", "newMapping", "sourceFile", "sourceRelative", "content", "generated", "original", "source", "name", "aSourceFile", "aSourceContent", "aSourceMapPath", "newSources", "newNames", "aGenerated", "aOriginal", "aSource", "aName", "message", "previousGeneratedColumn", "previousGeneratedLine", "previousOriginalColumn", "previousOriginalLine", "previousName", "previousSource", "result", "next", "nameIdx", "sourceIdx", "mappings", "i", "len", "lineDelta", "aSources", "aSourceRoot", "key", "map", "index_exports", "__export", "index_default", "__toCommonJS", "isDigit", "code", "isHexDigit", "isUppercaseLetter", "isLowercaseLetter", "isLetter", "isNonAscii", "isNameStart", "isName", "isNonPrintable", "isNewline", "isWhiteSpace", "isValidEscape", "first", "second", "isIdentifierStart", "third", "isNumberStart", "isBOM", "CATEGORY", "EofCategory", "WhiteSpaceCategory", "DigitCategory", "NameStartCategory", "NonPrintableCategory", "i", "charCodeCategory", "getCharCode", "source", "offset", "getNewlineLength", "code", "cmpChar", "testStr", "referenceCode", "isUppercaseLetter", "cmpStr", "start", "end", "referenceStr", "testCode", "findWhiteSpaceStart", "isWhiteSpace", "findWhiteSpaceEnd", "findDecimalNumberEnd", "isDigit", "consumeEscaped", "isHexDigit", "maxOffset", "consumeName", "isName", "isValidEscape", "consumeNumber", "sign", "consumeBadUrlRemnants", "decodeEscaped", "escaped", "names_default", "adoptBuffer", "buffer", "size", "N", "F", "R", "computeLinesAndColumns", "host", "source", "sourceLength", "startOffset", "isBOM", "lines", "adoptBuffer", "columns", "line", "column", "i", "code", "OffsetToLocation", "startLine", "startColumn", "offset", "filename", "start", "end", "OFFSET_MASK", "TYPE_SHIFT", "BLOCK_OPEN_TOKEN", "BLOCK_CLOSE_TOKEN", "balancePair", "blockTokens", "boundIndex", "index", "min", "max", "TokenStream", "source", "tokenize", "sourceLength", "offsetAndType", "adoptBuffer", "balance", "tokenCount", "firstCharOffset", "balanceCloseType", "balanceStart", "type", "start", "end", "prevBalanceStart", "i", "balanceEnd", "offset", "idx", "tokenType", "referenceStr", "cmpStr", "tokenIndex", "pairIndex", "closeType", "openType", "code", "next", "startToken", "stopConsume", "cursor", "loop", "fn", "item", "tokens", "names_default", "tokenize", "source", "onToken", "getCharCode", "offset", "sourceLength", "consumeNumericToken", "consumeNumber", "isIdentifierStart", "type", "consumeName", "consumeIdentLikeToken", "nameStartOffset", "cmpStr", "findWhiteSpaceEnd", "consumeUrlToken", "consumeStringToken", "endingCodePoint", "code", "charCodeCategory", "WhiteSpaceCategory", "isNewline", "getNewlineLength", "nextCode", "isValidEscape", "consumeEscaped", "consumeBadUrlRemnants", "NonPrintableCategory", "start", "isBOM", "isName", "isNumberStart", "DigitCategory", "NameStartCategory", "import_source_map_generator", "trackNodes", "generateSourceMap", "handlers", "map", "generated", "original", "activatedGenerated", "activatedMapping", "line", "column", "sourceMappingActive", "origHandlersNode", "node", "nodeLine", "nodeColumn", "origHandlersEmit", "value", "type", "auto", "i", "origHandlersResult", "token_before_exports", "__export", "safe", "spec", "PLUSSIGN", "HYPHENMINUS", "code", "type", "value", "specPairs", "safePairs", "createMap", "pairs", "isWhiteSpaceRequired", "prev", "next", "prevCode", "nextCode", "nextCharCode", "emitWs", "spec", "safe", "REVERSESOLIDUS", "processChildren", "node", "delimeter", "prev", "createGenerator", "config", "types", "name", "item", "options", "buffer", "prevCode", "handlers", "publicApi", "safe", "type", "value", "suppressAutoWhiteSpace", "generateSourceMap", "token_before_exports", "raw", "tokenize", "start", "end", "index_generate_exports", "__export", "generate", "PLUSSIGN", "HYPHENMINUS", "N", "DISALLOW_SIGN", "ALLOW_SIGN", "checkInteger", "offset", "disallowSign", "pos", "code", "isDigit", "checkTokenIsInteger", "expectCharCode", "msg", "consumeB", "sign", "type", "parse", "start", "a", "b", "checkTokenIsInteger", "ALLOW_SIGN", "HYPHENMINUS", "expectCharCode", "N", "consumeB", "DISALLOW_SIGN", "checkInteger", "PLUSSIGN", "sign", "code", "i", "isDigit", "generate", "node", "generate", "node", "generate", "node", "DOLLARSIGN", "ASTERISK", "EQUALSSIGN", "CIRCUMFLEXACCENT", "VERTICALLINE", "TILDE", "getAttributeName", "start", "expectIdent", "getOperator", "code", "parse", "start", "name", "matcher", "value", "flags", "getAttributeName", "getOperator", "generate", "node", "generate", "node", "prev", "generate", "node", "generate", "generate", "FULLSTOP", "parse", "FULLSTOP", "generate", "node", "PLUSSIGN", "SOLIDUS", "GREATERTHANSIGN", "TILDE", "parse", "start", "name", "GREATERTHANSIGN", "PLUSSIGN", "TILDE", "SOLIDUS", "generate", "node", "generate", "node", "generate", "node", "child", "generate", "node", "generate", "node", "prev", "generate", "node", "generate", "node", "generate", "node", "generate", "node", "generate", "node", "generate", "node", "generate", "node", "parse", "generate", "node", "parse", "start", "generate", "node", "generate", "node", "generate", "node", "generate", "node", "generate", "node", "AMPERSAND", "parse", "start", "AMPERSAND", "generate", "parse", "start", "end", "selector", "nth", "generate", "node", "generate", "node", "parse", "start", "generate", "node", "generate", "node", "parse", "generate", "node", "parse", "start", "children", "name", "nameLowerCase", "generate", "node", "parse", "start", "children", "name", "nameLowerCase", "generate", "node", "generate", "node", "getOffsetExcludeWS", "parse", "consumeUntil", "excludeWhiteSpace", "startOffset", "endOffset", "getOffsetExcludeWS", "generate", "node", "generate", "node", "generate", "node", "parse", "children", "generate", "node", "parse", "children", "generate", "node", "REVERSE_SOLIDUS", "QUOTATION_MARK", "APOSTROPHE", "decode", "str", "len", "firstChar", "start", "end", "decoded", "i", "code", "isValidEscape", "escapeStart", "escapeEnd", "consumeEscaped", "decodeEscaped", "encode", "apostrophe", "quote", "quoteCode", "encoded", "wsBeforeHexIsNeeded", "isHexDigit", "isWhiteSpace", "parse", "decode", "generate", "node", "encode", "generate", "node", "generate", "node", "ASTERISK", "VERTICALLINE", "eatIdentifierOrAsterisk", "parse", "start", "VERTICALLINE", "eatIdentifierOrAsterisk", "generate", "node", "generate", "node", "SPACE", "REVERSE_SOLIDUS", "QUOTATION_MARK", "APOSTROPHE", "LEFTPARENTHESIS", "RIGHTPARENTHESIS", "encode", "str", "encoded", "wsBeforeHexIsNeeded", "i", "code", "SPACE", "REVERSE_SOLIDUS", "QUOTATION_MARK", "APOSTROPHE", "LEFTPARENTHESIS", "RIGHTPARENTHESIS", "isHexDigit", "generate", "node", "encode", "generate", "node", "SPACE", "generate", "node", "generator_default", "index_generate_exports", "generator_default", "createGenerator", "releasedCursors", "List", "_List", "data", "prev", "next", "cursor", "prevOld", "prevNew", "nextOld", "nextNew", "size", "array", "item", "fn", "thisArg", "initialValue", "acc", "result", "start", "before", "list", "oldItem", "newItemOrList", "createCustomError", "name", "message", "error", "errorStack", "MAX_LINE_LENGTH", "OFFSET_CORRECTION", "TAB_REPLACEMENT", "sourceFragment", "source", "line", "column", "baseLine", "baseColumn", "extraLines", "processLines", "start", "end", "lines", "idx", "maxNumLength", "prelines", "precolumns", "startLine", "endLine", "cutLeft", "i", "SyntaxError", "message", "offset", "createCustomError", "readSequence", "recognizer", "children", "space", "context", "child", "NOOP", "EXCLAMATIONMARK", "NUMBERSIGN", "SEMICOLON", "LEFTCURLYBRACKET", "NULL", "arrayMethods", "node", "list", "listMethods", "List", "createParseContext", "name", "fetchParseValues", "dict", "result", "item", "fn", "processConfig", "config", "parseConfig", "context", "createParser", "source", "filename", "needPositions", "onParseError", "onParseErrorThrow", "locationMap", "OffsetToLocation", "parser", "TokenStream", "readSequence", "code", "consumer", "fallback", "startIndex", "e", "fallbackNode", "offset", "type", "offsetStart", "offsetEnd", "start", "charCode", "cmpChar", "str", "cmpStr", "tokenType", "number", "consumeNumber", "tokenName", "names_default", "m", "message", "end", "head", "tail", "location", "findWhiteSpaceStart", "SyntaxError", "createTokenIterateAPI", "index", "source_", "options", "tokenize", "onComment", "onToken", "loc", "value", "ast", "NUMBERSIGN", "AMPERSAND", "ASTERISK", "PLUSSIGN", "SOLIDUS", "FULLSTOP", "GREATERTHANSIGN", "VERTICALLINE", "TILDE", "onWhiteSpace", "next", "children", "getNode", "selector_default", "parseLanguageRangeList", "children", "loop", "selectorList", "selector", "identList", "langList", "parseLanguageRangeList", "nth", "pseudo_default", "index_parse_selector_exports", "__export", "parse", "parser_selector_default", "selector_default", "pseudo_default", "index_parse_selector_exports", "parse_selector_default", "createParser", "parser_selector_default", "compare", "s1", "s2", "equals", "greaterThan", "lessThan", "sort", "specificities", "order", "sorted", "compare", "sortAsc", "sortDesc", "max", "specificities", "sortDesc", "min", "sortAsc", "calculateForAST", "selectorAST", "a", "b", "c", "child", "max1", "max", "calculate", "max2", "childAST", "foundCombinator", "entry", "childSpecificity", "typeSelector", "index_default", "convertToAST", "source", "parse_selector_default", "e", "selector", "ast", "specificities", "specificity", "NotAllowedError", "Specificity", "value", "selector", "val", "generator_default", "otherSpecificity", "equals", "greaterThan", "lessThan", "calculate", "calculateForAST", "s1", "s2", "compare", "specificities", "min", "max", "sortAsc", "sortDesc", "index_default"] +} diff --git a/node_modules/@bramus/specificity/dist/index.js b/node_modules/@bramus/specificity/dist/index.js new file mode 100644 index 0000000..d8903a4 --- /dev/null +++ b/node_modules/@bramus/specificity/dist/index.js @@ -0,0 +1,8 @@ +var Jn=Object.create;var te=Object.defineProperty;var Zn=Object.getOwnPropertyDescriptor;var ti=Object.getOwnPropertyNames;var ei=Object.getPrototypeOf,ri=Object.prototype.hasOwnProperty;var rt=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(r){throw t=0,r}},ee=(e,t)=>{for(var r in t)te(e,r,{get:t[r],enumerable:!0})},ni=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of ti(t))!ri.call(e,i)&&i!==r&&te(e,i,{get:()=>t[i],enumerable:!(n=Zn(t,i))||n.enumerable});return e};var ii=(e,t,r)=>(r=e!=null?Jn(ei(e)):{},ni(t||!e||!e.__esModule?te(r,"default",{value:e,enumerable:!0}):r,e));var Ge=rt(he=>{var Ve="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split("");he.encode=function(e){if(0<=e&&e{var He=Ge(),fe=5,je=1<>1;return t?-r:r}pe.encode=function(t){var r="",n,i=fi(t);do n=i&Ye,i>>>=fe,i>0&&(n|=qe),r+=He.encode(n);while(i>0);return r};pe.decode=function(t,r,n){var i=t.length,o=0,c=0,l,u;do{if(r>=i)throw new Error("Expected more digits in base 64 VLQ value.");if(u=He.decode(t.charCodeAt(r++)),u===-1)throw new Error("Invalid base64 digit: "+t.charAt(r-1));l=!!(u&qe),u&=Ye,o=o+(u<{function mi(e,t,r){if(t in e)return e[t];if(arguments.length===3)return r;throw new Error('"'+t+'" is a required argument.')}L.getArg=mi;var ze=/^(?:([\w+\-.]+):)?\/\/(?:(\w+:\w+)@)?([\w.-]*)(?::(\d+))?(.*)$/,di=/^data:.+\,.+$/;function gt(e){var t=e.match(ze);return t?{scheme:t[1],auth:t[2],host:t[3],port:t[4],path:t[5]}:null}L.urlParse=gt;function ot(e){var t="";return e.scheme&&(t+=e.scheme+":"),t+="//",e.auth&&(t+=e.auth+"@"),e.host&&(t+=e.host),e.port&&(t+=":"+e.port),e.path&&(t+=e.path),t}L.urlGenerate=ot;var ki=32;function xi(e){var t=[];return function(r){for(var n=0;nki&&t.pop(),o}}var me=xi(function(t){var r=t,n=gt(t);if(n){if(!n.path)return t;r=n.path}for(var i=L.isAbsolute(r),o=[],c=0,l=0;;)if(c=l,l=r.indexOf("/",c),l===-1){o.push(r.slice(c));break}else for(o.push(r.slice(c,l));l=0;l--)u=o[l],u==="."?o.splice(l,1):u===".."?s++:s>0&&(u===""?(o.splice(l+1,s),s=0):(o.splice(l,2),s--));return r=o.join("/"),r===""&&(r=i?"/":"."),n?(n.path=r,ot(n)):r});L.normalize=me;function Qe(e,t){e===""&&(e="."),t===""&&(t=".");var r=gt(t),n=gt(e);if(n&&(e=n.path||"/"),r&&!r.scheme)return n&&(r.scheme=n.scheme),ot(r);if(r||t.match(di))return t;if(n&&!n.host&&!n.path)return n.host=t,ot(n);var i=t.charAt(0)==="/"?t:me(e.replace(/\/+$/,"")+"/"+t);return n?(n.path=i,ot(n)):i}L.join=Qe;L.isAbsolute=function(e){return e.charAt(0)==="/"||ze.test(e)};function Si(e,t){e===""&&(e="."),e=e.replace(/\/$/,"");for(var r=0;t.indexOf(e+"/")!==0;){var n=e.lastIndexOf("/");if(n<0||(e=e.slice(0,n),e.match(/^([^\/]+:\/)?\/*$/)))return t;++r}return Array(r+1).join("../")+t.substr(e.length+1)}L.relative=Si;var $e=(function(){var e=Object.create(null);return!("__proto__"in e)})();function Xe(e){return e}function gi(e){return Je(e)?"$"+e:e}L.toSetString=$e?Xe:gi;function Ci(e){return Je(e)?e.slice(1):e}L.fromSetString=$e?Xe:Ci;function Je(e){if(!e)return!1;var t=e.length;if(t<9||e.charCodeAt(t-1)!==95||e.charCodeAt(t-2)!==95||e.charCodeAt(t-3)!==111||e.charCodeAt(t-4)!==116||e.charCodeAt(t-5)!==111||e.charCodeAt(t-6)!==114||e.charCodeAt(t-7)!==112||e.charCodeAt(t-8)!==95||e.charCodeAt(t-9)!==95)return!1;for(var r=t-10;r>=0;r--)if(e.charCodeAt(r)!==36)return!1;return!0}function yi(e,t,r){var n=G(e.source,t.source);return n!==0||(n=e.originalLine-t.originalLine,n!==0)||(n=e.originalColumn-t.originalColumn,n!==0||r)||(n=e.generatedColumn-t.generatedColumn,n!==0)||(n=e.generatedLine-t.generatedLine,n!==0)?n:G(e.name,t.name)}L.compareByOriginalPositions=yi;function bi(e,t,r){var n;return n=e.originalLine-t.originalLine,n!==0||(n=e.originalColumn-t.originalColumn,n!==0||r)||(n=e.generatedColumn-t.generatedColumn,n!==0)||(n=e.generatedLine-t.generatedLine,n!==0)?n:G(e.name,t.name)}L.compareByOriginalPositionsNoSource=bi;function Ti(e,t,r){var n=e.generatedLine-t.generatedLine;return n!==0||(n=e.generatedColumn-t.generatedColumn,n!==0||r)||(n=G(e.source,t.source),n!==0)||(n=e.originalLine-t.originalLine,n!==0)||(n=e.originalColumn-t.originalColumn,n!==0)?n:G(e.name,t.name)}L.compareByGeneratedPositionsDeflated=Ti;function Li(e,t,r){var n=e.generatedColumn-t.generatedColumn;return n!==0||r||(n=G(e.source,t.source),n!==0)||(n=e.originalLine-t.originalLine,n!==0)||(n=e.originalColumn-t.originalColumn,n!==0)?n:G(e.name,t.name)}L.compareByGeneratedPositionsDeflatedNoLine=Li;function G(e,t){return e===t?0:e===null?1:t===null?-1:e>t?1:-1}function Ei(e,t){var r=e.generatedLine-t.generatedLine;return r!==0||(r=e.generatedColumn-t.generatedColumn,r!==0)||(r=G(e.source,t.source),r!==0)||(r=e.originalLine-t.originalLine,r!==0)||(r=e.originalColumn-t.originalColumn,r!==0)?r:G(e.name,t.name)}L.compareByGeneratedPositionsInflated=Ei;function vi(e){return JSON.parse(e.replace(/^\)]}'[^\n]*\n/,""))}L.parseSourceMapInput=vi;function wi(e,t,r){if(t=t||"",e&&(e[e.length-1]!=="/"&&t[0]!=="/"&&(e+="/"),t=e+t),r){var n=gt(r);if(!n)throw new Error("sourceMapURL could not be parsed");if(n.path){var i=n.path.lastIndexOf("/");i>=0&&(n.path=n.path.substring(0,i+1))}t=Qe(ot(n),t)}return me(t)}L.computeSourceURL=wi});var tr=rt(Ze=>{var de=Ht(),ke=Object.prototype.hasOwnProperty,X=typeof Map<"u";function H(){this._array=[],this._set=X?new Map:Object.create(null)}H.fromArray=function(t,r){for(var n=new H,i=0,o=t.length;i=0)return r}else{var n=de.toSetString(t);if(ke.call(this._set,n))return this._set[n]}throw new Error('"'+t+'" is not in the set.')};H.prototype.at=function(t){if(t>=0&&t{var er=Ht();function Ai(e,t){var r=e.generatedLine,n=t.generatedLine,i=e.generatedColumn,o=t.generatedColumn;return n>r||n==r&&o>=i||er.compareByGeneratedPositionsInflated(e,t)<=0}function jt(){this._array=[],this._sorted=!0,this._last={generatedLine:-1,generatedColumn:0}}jt.prototype.unsortedForEach=function(t,r){this._array.forEach(t,r)};jt.prototype.add=function(t){Ai(this._last,t)?(this._last=t,this._array.push(t)):(this._sorted=!1,this._array.push(t))};jt.prototype.toArray=function(){return this._sorted||(this._array.sort(er.compareByGeneratedPositionsInflated),this._sorted=!0),this._array};rr.MappingList=jt});var sr=rt(ir=>{var Ct=Ke(),y=Ht(),Yt=tr().ArraySet,Ii=nr().MappingList;function P(e){e||(e={}),this._file=y.getArg(e,"file",null),this._sourceRoot=y.getArg(e,"sourceRoot",null),this._skipValidation=y.getArg(e,"skipValidation",!1),this._ignoreInvalidMapping=y.getArg(e,"ignoreInvalidMapping",!1),this._sources=new Yt,this._names=new Yt,this._mappings=new Ii,this._sourcesContents=null}P.prototype._version=3;P.fromSourceMap=function(t,r){var n=t.sourceRoot,i=new P(Object.assign(r||{},{file:t.file,sourceRoot:n}));return t.eachMapping(function(o){var c={generated:{line:o.generatedLine,column:o.generatedColumn}};o.source!=null&&(c.source=o.source,n!=null&&(c.source=y.relative(n,c.source)),c.original={line:o.originalLine,column:o.originalColumn},o.name!=null&&(c.name=o.name)),i.addMapping(c)}),t.sources.forEach(function(o){var c=o;n!==null&&(c=y.relative(n,o)),i._sources.has(c)||i._sources.add(c);var l=t.sourceContentFor(o);l!=null&&i.setSourceContent(o,l)}),i};P.prototype.addMapping=function(t){var r=y.getArg(t,"generated"),n=y.getArg(t,"original",null),i=y.getArg(t,"source",null),o=y.getArg(t,"name",null);!this._skipValidation&&this._validateMapping(r,n,i,o)===!1||(i!=null&&(i=String(i),this._sources.has(i)||this._sources.add(i)),o!=null&&(o=String(o),this._names.has(o)||this._names.add(o)),this._mappings.add({generatedLine:r.line,generatedColumn:r.column,originalLine:n!=null&&n.line,originalColumn:n!=null&&n.column,source:i,name:o}))};P.prototype.setSourceContent=function(t,r){var n=t;this._sourceRoot!=null&&(n=y.relative(this._sourceRoot,n)),r!=null?(this._sourcesContents||(this._sourcesContents=Object.create(null)),this._sourcesContents[y.toSetString(n)]=r):this._sourcesContents&&(delete this._sourcesContents[y.toSetString(n)],Object.keys(this._sourcesContents).length===0&&(this._sourcesContents=null))};P.prototype.applySourceMap=function(t,r,n){var i=r;if(r==null){if(t.file==null)throw new Error(`SourceMapGenerator.prototype.applySourceMap requires either an explicit source file, or the source map's "file" property. Both were omitted.`);i=t.file}var o=this._sourceRoot;o!=null&&(i=y.relative(o,i));var c=new Yt,l=new Yt;this._mappings.unsortedForEach(function(u){if(u.source===i&&u.originalLine!=null){var s=t.originalPositionFor({line:u.originalLine,column:u.originalColumn});s.source!=null&&(u.source=s.source,n!=null&&(u.source=y.join(n,u.source)),o!=null&&(u.source=y.relative(o,u.source)),u.originalLine=s.line,u.originalColumn=s.column,s.name!=null&&(u.name=s.name))}var a=u.source;a!=null&&!c.has(a)&&c.add(a);var h=u.name;h!=null&&!l.has(h)&&l.add(h)},this),this._sources=c,this._names=l,t.sources.forEach(function(u){var s=t.sourceContentFor(u);s!=null&&(n!=null&&(u=y.join(n,u)),o!=null&&(u=y.relative(o,u)),this.setSourceContent(u,s))},this)};P.prototype._validateMapping=function(t,r,n,i){if(r&&typeof r.line!="number"&&typeof r.column!="number"){var o="original.line and original.column are not numbers -- you probably meant to omit the original mapping entirely and only map the generated position. If so, pass null for the original mapping instead of an object with empty or null values.";if(this._ignoreInvalidMapping)return typeof console<"u"&&console.warn&&console.warn(o),!1;throw new Error(o)}if(!(t&&"line"in t&&"column"in t&&t.line>0&&t.column>=0&&!r&&!n&&!i)){if(t&&"line"in t&&"column"in t&&r&&"line"in r&&"column"in r&&t.line>0&&t.column>=0&&r.line>0&&r.column>=0&&n)return;var o="Invalid mapping: "+JSON.stringify({generated:t,source:n,original:r,name:i});if(this._ignoreInvalidMapping)return typeof console<"u"&&console.warn&&console.warn(o),!1;throw new Error(o)}};P.prototype._serializeMappings=function(){for(var t=0,r=1,n=0,i=0,o=0,c=0,l="",u,s,a,h,p=this._mappings.toArray(),m=0,k=p.length;m0){if(!y.compareByGeneratedPositionsInflated(s,p[m-1]))continue;u+=","}u+=Ct.encode(s.generatedColumn-t),t=s.generatedColumn,s.source!=null&&(h=this._sources.indexOf(s.source),u+=Ct.encode(h-c),c=h,u+=Ct.encode(s.originalLine-1-i),i=s.originalLine-1,u+=Ct.encode(s.originalColumn-n),n=s.originalColumn,s.name!=null&&(a=this._names.indexOf(s.name),u+=Ct.encode(a-o),o=a)),l+=u}return l};P.prototype._generateSourcesContent=function(t,r){return t.map(function(n){if(!this._sourcesContents)return null;r!=null&&(n=y.relative(r,n));var i=y.toSetString(n);return Object.prototype.hasOwnProperty.call(this._sourcesContents,i)?this._sourcesContents[i]:null},this)};P.prototype.toJSON=function(){var t={version:this._version,sources:this._sources.toArray(),names:this._names.toArray(),mappings:this._serializeMappings()};return this._file!=null&&(t.file=this._file),this._sourceRoot!=null&&(t.sourceRoot=this._sourceRoot),this._sourcesContents&&(t.sourcesContent=this._generateSourcesContent(t.sources,t.sourceRoot)),t};P.prototype.toString=function(){return JSON.stringify(this.toJSON())};ir.SourceMapGenerator=P});function E(e){return e>=48&&e<=57}function j(e){return E(e)||e>=65&&e<=70||e>=97&&e<=102}function vt(e){return e>=65&&e<=90}function si(e){return e>=97&&e<=122}function oi(e){return vt(e)||si(e)}function ai(e){return e>=128}function Et(e){return oi(e)||ai(e)||e===95}function wt(e){return Et(e)||E(e)||e===45}function ci(e){return e>=0&&e<=8||e===11||e>=14&&e<=31||e===127}function ft(e){return e===10||e===13||e===12}function Y(e){return ft(e)||e===32||e===9}function A(e,t){return!(e!==92||ft(t)||t===0)}function At(e,t,r){return e===45?Et(t)||t===45||A(t,r):Et(e)?!0:e===92?A(e,t):!1}function It(e,t,r){return e===43||e===45?E(t)?2:t===46&&E(r)?3:0:e===46?E(t)?2:0:E(e)?1:0}function Nt(e){return e===65279||e===65534?1:0}var re=new Array(128),li=128,pt=130,ne=131,Dt=132,ie=133;for(let e=0;ee.length)return!1;for(let i=t;i=0&&Y(e.charCodeAt(t));t--);return t+1}function mt(e,t){for(;t=55296&&t<=57343||t>1114111)&&(t=65533),String.fromCodePoint(t)}var it=["EOF-token","ident-token","function-token","at-keyword-token","hash-token","string-token","bad-string-token","url-token","bad-url-token","delim-token","number-token","percentage-token","dimension-token","whitespace-token","CDO-token","CDC-token","colon-token","semicolon-token","comma-token","[-token","]-token","(-token",")-token","{-token","}-token","comment-token"];function st(e=null,t){return e===null||e.length0?Nt(t.charCodeAt(0)):0,i=st(e.lines,r),o=st(e.columns,r),c=e.startLine,l=e.startColumn;for(let u=n;ur?r:e}var Mt=class{constructor(t,r){this.setSource(t,r)}reset(){this.eof=!1,this.tokenIndex=-1,this.tokenType=0,this.tokenStart=this.firstCharOffset,this.tokenEnd=this.firstCharOffset}setSource(t="",r=()=>{}){t=String(t||"");let n=t.length,i=st(this.offsetAndType,t.length+1),o=st(this.balance,t.length+1),c=0,l=-1,u=0,s=t.length;this.offsetAndType=null,this.balance=null,o.fill(0),r(t,(a,h,p)=>{let m=c++;if(i[m]=a<>O]}else this.isBlockOpenerTokenType(a)&&(s=m,u=K[a])}),i[c]=0<c&&(o[a]=c)}this.source=t,this.firstCharOffset=l===-1?0:l,this.tokenCount=c,this.offsetAndType=i,this.balance=o,this.reset(),this.next()}lookupType(t){return t+=this.tokenIndex,t>O:0}lookupTypeNonSC(t){for(let r=this.tokenIndex;r>O;if(n!==13&&n!==25&&t--===0)return n}return 0}lookupOffset(t){return t+=this.tokenIndex,t>O;if(n!==13&&n!==25&&t--===0)return r-this.tokenIndex}return 0}lookupValue(t,r){return t+=this.tokenIndex,t0?t>O}substrToCursor(t){return this.source.substring(t,this.tokenStart)}isBlockOpenerTokenType(t){return R[t]===kt}isBlockCloserTokenType(t){return R[t]===Vt}getBlockTokenPairIndex(t){let r=this.getTokenType(t);if(R[r]===1){let n=this.balance[t],i=this.getTokenType(n);return K[r]===i?n:-1}else if(R[r]===2){let n=this.balance[t],i=this.getTokenType(n);return K[i]===r?n:-1}return-1}isBalanceEdge(t){return this.balance[this.tokenIndex]>O,this.tokenEnd=r&F):(this.tokenIndex=this.tokenCount,this.next())}next(){let t=this.tokenIndex+1;t>O,this.tokenEnd=t&F):(this.eof=!0,this.tokenIndex=this.tokenCount,this.tokenType=0,this.tokenStart=this.tokenEnd=this.source.length)}skipSC(){for(;this.tokenType===13||this.tokenType===25;)this.next()}skipUntilBalanced(t,r){let n=t,i=0,o=0;t:for(;n0?this.offsetAndType[n-1]&F:this.firstCharOffset,r(this.source.charCodeAt(o))){case 1:break t;case 2:n++;break t;default:this.isBlockOpenerTokenType(this.offsetAndType[n]>>O)&&(n=i)}}this.skip(n-this.tokenIndex)}forEachToken(t){for(let r=0,n=this.firstCharOffset;r>O;n=c,t(l,i,c,r)}}dump(){let t=new Array(this.tokenCount);return this.forEachToken((r,n,i,o)=>{t[o]={idx:o,type:it[r],chunk:this.source.substring(n,i),balance:this.balance[o]}}),t}};function Gt(e,t){function r(h){return h=e.length){sSe,spec:()=>Fi});var Ni=43,Di=45,xe=(e,t)=>(e===9&&(e=t),typeof e=="string"&&(e=Math.min(e.charCodeAt(0),128)<<6),e<<1),lr=[[1,1],[1,2],[1,7],[1,8],[1,"-"],[1,10],[1,11],[1,12],[1,15],[1,21],[3,1],[3,2],[3,7],[3,8],[3,"-"],[3,10],[3,11],[3,12],[3,15],[4,1],[4,2],[4,7],[4,8],[4,"-"],[4,10],[4,11],[4,12],[4,15],[12,1],[12,2],[12,7],[12,8],[12,"-"],[12,10],[12,11],[12,12],[12,15],["#",1],["#",2],["#",7],["#",8],["#","-"],["#",10],["#",11],["#",12],["#",15],["-",1],["-",2],["-",7],["-",8],["-","-"],["-",10],["-",11],["-",12],["-",15],[10,1],[10,2],[10,7],[10,8],[10,10],[10,11],[10,12],[10,"%"],[10,15],["@",1],["@",2],["@",7],["@",8],["@","-"],["@",15],[".",10],[".",11],[".",12],["+",10],["+",11],["+",12],["/","*"]],Pi=lr.concat([[1,4],[12,4],[4,4],[3,21],[3,5],[3,16],[11,11],[11,12],[11,2],[11,"-"],[22,1],[22,2],[22,11],[22,12],[22,4],[22,"-"]]);function ur(e){let t=new Set(e.map(([r,n])=>xe(r)<<16|xe(n)));return function(r,n,i){let o=xe(n,i),c=i.charCodeAt(0),l=c===Di&&n!==1&&n!==2&&n!==15||c===Ni?t.has((r&65534)<<16|c<<7):t.has((r&65534)<<16|o);return o|l}}var Fi=ur(lr),Se=ur(Pi);var Oi=92;function Ri(e,t){if(typeof t=="function"){let r=null;e.children.forEach(n=>{r!==null&&t.call(this,r),this.node(n),r=n});return}e.children.forEach(this.node,this)}function hr(e){let t=new Map;for(let[r,n]of Object.entries(e.node))typeof(n.generate||n)=="function"&&t.set(r,n.generate||n);return function(r,n){let i="",o=0,c={node(u){if(t.has(u.type))t.get(u.type).call(l,u);else throw new Error("Unknown node type: "+u.type)},tokenBefore:Se,token(u,s,a){o=this.tokenBefore(o,u,s),!a&&o&1&&this.emit(" ",13,!0),this.emit(s,u,!1),u===9&&s.charCodeAt(0)===Oi&&this.emit(` +`,13,!0)},emit(u){i+=u},result(){return i}};n&&(typeof n.decorator=="function"&&(c=n.decorator(c)),n.sourceMap&&(c=cr(c)),n.mode in qt&&(c.tokenBefore=qt[n.mode]));let l={node:u=>c.node(u),children:Ri,token:(u,s)=>c.token(u,s),tokenize:u=>Gt(u,(s,a,h)=>{c.token(s,u.slice(a,h),a!==0)})};return c.node(r),c.result()}}var Te={};ee(Te,{AnPlusB:()=>pr,Atrule:()=>mr,AtrulePrelude:()=>dr,AttributeSelector:()=>Sr,Block:()=>gr,Brackets:()=>Cr,CDC:()=>yr,CDO:()=>br,ClassSelector:()=>Lr,Combinator:()=>wr,Comment:()=>Ar,Condition:()=>Ir,Declaration:()=>Nr,DeclarationList:()=>Dr,Dimension:()=>Pr,Feature:()=>Fr,FeatureFunction:()=>Or,FeatureRange:()=>Rr,Function:()=>_r,GeneralEnclosed:()=>Br,Hash:()=>Mr,IdSelector:()=>Gr,Identifier:()=>Wr,Layer:()=>Hr,LayerList:()=>jr,MediaQuery:()=>Yr,MediaQueryList:()=>qr,NestingSelector:()=>zr,Nth:()=>$r,Number:()=>Xr,Operator:()=>Zr,Parentheses:()=>tn,Percentage:()=>rn,PseudoClassSelector:()=>sn,PseudoElementSelector:()=>an,Ratio:()=>cn,Raw:()=>un,Rule:()=>hn,Scope:()=>fn,Selector:()=>mn,SelectorList:()=>kn,String:()=>bn,StyleSheet:()=>Tn,SupportsDeclaration:()=>Ln,TypeSelector:()=>wn,UnicodeRange:()=>An,Url:()=>Nn,Value:()=>Dn,WhiteSpace:()=>Pn});var V=43,N=45,Kt=110,J=!0,_i=!1;function zt(e,t){let r=this.tokenStart+e,n=this.charCodeAt(r);for((n===V||n===N)&&(t&&this.error("Number sign is not allowed"),r++);r0&&this.skip(e),t===0&&(r=this.charCodeAt(this.tokenStart),r!==V&&r!==N&&this.error("Number sign is expected")),at.call(this,t!==0),t===N?"-"+this.consume(10):this.consume(10)}function fr(){let e=this.tokenStart,t=null,r=null;if(this.tokenType===10)at.call(this,_i),r=this.consume(10);else if(this.tokenType===1&&this.cmpChar(this.tokenStart,N))switch(t="-1",z.call(this,1,Kt),this.tokenEnd-this.tokenStart){case 2:this.next(),r=ge.call(this);break;case 3:z.call(this,2,N),this.next(),this.skipSC(),at.call(this,J),r="-"+this.consume(10);break;default:z.call(this,2,N),zt.call(this,3,J),this.next(),r=this.substrToCursor(e+2)}else if(this.tokenType===1||this.isDelim(V)&&this.lookupType(1)===1){let n=0;switch(t="1",this.isDelim(V)&&(n=1,this.next()),z.call(this,0,Kt),this.tokenEnd-this.tokenStart){case 1:this.next(),r=ge.call(this);break;case 2:z.call(this,1,N),this.next(),this.skipSC(),at.call(this,J),r="-"+this.consume(10);break;default:z.call(this,1,N),zt.call(this,2,J),this.next(),r=this.substrToCursor(e+n+1)}}else if(this.tokenType===12){let n=this.charCodeAt(this.tokenStart),i=n===V||n===N,o=this.tokenStart+i;for(;o{t.type==="Declaration"&&this.token(17,";")}),this.token(24,"}")}function Cr(e){this.token(9,"["),this.children(e),this.token(9,"]")}function yr(){this.token(15,"-->")}function br(){this.token(14,"\n\n return {\n type: 'CDC',\n loc: this.getLocation(start, this.tokenStart)\n };\n}\n\nexport function generate() {\n this.token(CDC, '-->');\n}\n", "import { CDO } from '../../tokenizer/index.js';\n\nexport const name = 'CDO';\nexport const structure = [];\n\nexport function parse() {\n const start = this.tokenStart;\n\n this.eat(CDO); // \n child = this.CDC();\n break;\n\n // CSS Syntax Module Level 3\n // \u00A72.2 Error handling\n // At the \"top level\" of a stylesheet, an starts an at-rule.\n case AtKeyword:\n child = this.parseWithFallback(this.Atrule, consumeRaw);\n break;\n\n // Anything else starts a qualified rule ...\n default:\n child = this.parseWithFallback(this.Rule, consumeRaw);\n }\n\n children.push(child);\n }\n\n return {\n type: 'StyleSheet',\n loc: this.getLocation(start, this.tokenStart),\n children\n };\n}\n\nexport function generate(node) {\n this.children(node);\n}\n", "import {\n LeftParenthesis,\n RightParenthesis\n} from '../../tokenizer/index.js';\n\nexport const name = 'SupportsDeclaration';\nexport const structure = {\n declaration: 'Declaration'\n};\n\nexport function parse() {\n const start = this.tokenStart;\n\n this.eat(LeftParenthesis);\n this.skipSC();\n\n const declaration = this.Declaration();\n\n if (!this.eof) {\n this.eat(RightParenthesis);\n }\n\n return {\n type: 'SupportsDeclaration',\n loc: this.getLocation(start, this.tokenStart),\n declaration\n };\n}\n\nexport function generate(node) {\n this.token(LeftParenthesis, '(');\n this.node(node.declaration);\n this.token(RightParenthesis, ')');\n}\n", "import { Ident } from '../../tokenizer/index.js';\n\nconst ASTERISK = 0x002A; // U+002A ASTERISK (*)\nconst VERTICALLINE = 0x007C; // U+007C VERTICAL LINE (|)\n\nfunction eatIdentifierOrAsterisk() {\n if (this.tokenType !== Ident &&\n this.isDelim(ASTERISK) === false) {\n this.error('Identifier or asterisk is expected');\n }\n\n this.next();\n}\n\nexport const name = 'TypeSelector';\nexport const structure = {\n name: String\n};\n\n// ident\n// ident|ident\n// ident|*\n// *\n// *|ident\n// *|*\n// |ident\n// |*\nexport function parse() {\n const start = this.tokenStart;\n\n if (this.isDelim(VERTICALLINE)) {\n this.next();\n eatIdentifierOrAsterisk.call(this);\n } else {\n eatIdentifierOrAsterisk.call(this);\n\n if (this.isDelim(VERTICALLINE)) {\n this.next();\n eatIdentifierOrAsterisk.call(this);\n }\n }\n\n return {\n type: 'TypeSelector',\n loc: this.getLocation(start, this.tokenStart),\n name: this.substrToCursor(start)\n };\n}\n\nexport function generate(node) {\n this.tokenize(node.name);\n}\n", "import {\n isHexDigit,\n Ident,\n Number,\n Dimension\n} from '../../tokenizer/index.js';\n\nconst PLUSSIGN = 0x002B; // U+002B PLUS SIGN (+)\nconst HYPHENMINUS = 0x002D; // U+002D HYPHEN-MINUS (-)\nconst QUESTIONMARK = 0x003F; // U+003F QUESTION MARK (?)\n\nfunction eatHexSequence(offset, allowDash) {\n let len = 0;\n\n for (let pos = this.tokenStart + offset; pos < this.tokenEnd; pos++) {\n const code = this.charCodeAt(pos);\n\n if (code === HYPHENMINUS && allowDash && len !== 0) {\n eatHexSequence.call(this, offset + len + 1, false);\n return -1;\n }\n\n if (!isHexDigit(code)) {\n this.error(\n allowDash && len !== 0\n ? 'Hyphen minus' + (len < 6 ? ' or hex digit' : '') + ' is expected'\n : (len < 6 ? 'Hex digit is expected' : 'Unexpected input'),\n pos\n );\n }\n\n if (++len > 6) {\n this.error('Too many hex digits', pos);\n };\n }\n\n this.next();\n return len;\n}\n\nfunction eatQuestionMarkSequence(max) {\n let count = 0;\n\n while (this.isDelim(QUESTIONMARK)) {\n if (++count > max) {\n this.error('Too many question marks');\n }\n\n this.next();\n }\n}\n\nfunction startsWith(code) {\n if (this.charCodeAt(this.tokenStart) !== code) {\n this.error((code === PLUSSIGN ? 'Plus sign' : 'Hyphen minus') + ' is expected');\n }\n}\n\n// https://drafts.csswg.org/css-syntax/#urange\n// Informally, the production has three forms:\n// U+0001\n// Defines a range consisting of a single code point, in this case the code point \"1\".\n// U+0001-00ff\n// Defines a range of codepoints between the first and the second value, in this case\n// the range between \"1\" and \"ff\" (255 in decimal) inclusive.\n// U+00??\n// Defines a range of codepoints where the \"?\" characters range over all hex digits,\n// in this case defining the same as the value U+0000-00ff.\n// In each form, a maximum of 6 digits is allowed for each hexadecimal number (if you treat \"?\" as a hexadecimal digit).\n//\n// =\n// u '+' '?'* |\n// u '?'* |\n// u '?'* |\n// u |\n// u |\n// u '+' '?'+\nfunction scanUnicodeRange() {\n let hexLength = 0;\n\n switch (this.tokenType) {\n case Number:\n // u '?'*\n // u \n // u \n hexLength = eatHexSequence.call(this, 1, true);\n\n if (this.isDelim(QUESTIONMARK)) {\n eatQuestionMarkSequence.call(this, 6 - hexLength);\n break;\n }\n\n if (this.tokenType === Dimension ||\n this.tokenType === Number) {\n startsWith.call(this, HYPHENMINUS);\n eatHexSequence.call(this, 1, false);\n break;\n }\n\n break;\n\n case Dimension:\n // u '?'*\n hexLength = eatHexSequence.call(this, 1, true);\n\n if (hexLength > 0) {\n eatQuestionMarkSequence.call(this, 6 - hexLength);\n }\n\n break;\n\n default:\n // u '+' '?'*\n // u '+' '?'+\n this.eatDelim(PLUSSIGN);\n\n if (this.tokenType === Ident) {\n hexLength = eatHexSequence.call(this, 0, true);\n if (hexLength > 0) {\n eatQuestionMarkSequence.call(this, 6 - hexLength);\n }\n break;\n }\n\n if (this.isDelim(QUESTIONMARK)) {\n this.next();\n eatQuestionMarkSequence.call(this, 5);\n break;\n }\n\n this.error('Hex digit or question mark is expected');\n }\n}\n\nexport const name = 'UnicodeRange';\nexport const structure = {\n value: String\n};\n\nexport function parse() {\n const start = this.tokenStart;\n\n // U or u\n this.eatIdent('u');\n scanUnicodeRange.call(this);\n\n return {\n type: 'UnicodeRange',\n loc: this.getLocation(start, this.tokenStart),\n value: this.substrToCursor(start)\n };\n}\n\nexport function generate(node) {\n this.tokenize(node.value);\n}\n", "import {\n isHexDigit,\n isWhiteSpace,\n isValidEscape,\n consumeEscaped,\n decodeEscaped\n} from '../tokenizer/index.js';\n\nconst SPACE = 0x0020; // U+0020 SPACE\nconst REVERSE_SOLIDUS = 0x005c; // U+005C REVERSE SOLIDUS (\\)\nconst QUOTATION_MARK = 0x0022; // \"\nconst APOSTROPHE = 0x0027; // '\nconst LEFTPARENTHESIS = 0x0028; // U+0028 LEFT PARENTHESIS (()\nconst RIGHTPARENTHESIS = 0x0029; // U+0029 RIGHT PARENTHESIS ())\n\nexport function decode(str) {\n const len = str.length;\n let start = 4; // length of \"url(\"\n let end = str.charCodeAt(len - 1) === RIGHTPARENTHESIS ? len - 2 : len - 1;\n let decoded = '';\n\n while (start < end && isWhiteSpace(str.charCodeAt(start))) {\n start++;\n }\n\n while (start < end && isWhiteSpace(str.charCodeAt(end))) {\n end--;\n }\n\n for (let i = start; i <= end; i++) {\n let code = str.charCodeAt(i);\n\n if (code === REVERSE_SOLIDUS) {\n // special case at the ending\n if (i === end) {\n // if the next input code point is EOF, do nothing\n // otherwise include last left parenthesis as escaped\n if (i !== len - 1) {\n decoded = str.substr(i + 1);\n }\n break;\n }\n\n code = str.charCodeAt(++i);\n\n // consume escaped\n if (isValidEscape(REVERSE_SOLIDUS, code)) {\n const escapeStart = i - 1;\n const escapeEnd = consumeEscaped(str, escapeStart);\n\n i = escapeEnd - 1;\n decoded += decodeEscaped(str.substring(escapeStart + 1, escapeEnd));\n } else {\n // \\r\\n\n if (code === 0x000d && str.charCodeAt(i + 1) === 0x000a) {\n i++;\n }\n }\n } else {\n decoded += str[i];\n }\n }\n\n return decoded;\n}\n\nexport function encode(str) {\n let encoded = '';\n let wsBeforeHexIsNeeded = false;\n\n for (let i = 0; i < str.length; i++) {\n const code = str.charCodeAt(i);\n\n // If the character is NULL (U+0000), then the REPLACEMENT CHARACTER (U+FFFD).\n if (code === 0x0000) {\n encoded += '\\uFFFD';\n continue;\n }\n\n // If the character is in the range [\\1-\\1f] (U+0001 to U+001F) or is U+007F,\n // the character escaped as code point.\n // Note: Do not compare with 0x0001 since 0x0000 is precessed before\n if (code <= 0x001f || code === 0x007F) {\n encoded += '\\\\' + code.toString(16);\n wsBeforeHexIsNeeded = true;\n continue;\n }\n\n if (code === SPACE ||\n code === REVERSE_SOLIDUS ||\n code === QUOTATION_MARK ||\n code === APOSTROPHE ||\n code === LEFTPARENTHESIS ||\n code === RIGHTPARENTHESIS) {\n encoded += '\\\\' + str.charAt(i);\n wsBeforeHexIsNeeded = false;\n } else {\n if (wsBeforeHexIsNeeded && isHexDigit(code)) {\n encoded += ' ';\n }\n\n encoded += str.charAt(i);\n wsBeforeHexIsNeeded = false;\n }\n }\n\n return 'url(' + encoded + ')';\n}\n", "import * as url from '../../utils/url.js';\nimport * as string from '../../utils/string.js';\nimport {\n Function as FunctionToken,\n String as StringToken,\n Url,\n RightParenthesis\n} from '../../tokenizer/index.js';\n\nexport const name = 'Url';\nexport const structure = {\n value: String\n};\n\n// | )\nexport function parse() {\n const start = this.tokenStart;\n let value;\n\n switch (this.tokenType) {\n case Url:\n value = url.decode(this.consume(Url));\n break;\n\n case FunctionToken:\n if (!this.cmpStr(this.tokenStart, this.tokenEnd, 'url(')) {\n this.error('Function name must be `url`');\n }\n\n this.eat(FunctionToken);\n this.skipSC();\n value = string.decode(this.consume(StringToken));\n this.skipSC();\n if (!this.eof) {\n this.eat(RightParenthesis);\n }\n break;\n\n default:\n this.error('Url or Function is expected');\n }\n\n return {\n type: 'Url',\n loc: this.getLocation(start, this.tokenStart),\n value\n };\n}\n\nexport function generate(node) {\n this.token(Url, url.encode(node.value));\n}\n", "export const name = 'Value';\nexport const structure = {\n children: [[]]\n};\n\nexport function parse() {\n const start = this.tokenStart;\n const children = this.readSequence(this.scope.Value);\n\n return {\n type: 'Value',\n loc: this.getLocation(start, this.tokenStart),\n children\n };\n}\n\nexport function generate(node) {\n this.children(node);\n}\n", "import { WhiteSpace } from '../../tokenizer/index.js';\n\nconst SPACE = Object.freeze({\n type: 'WhiteSpace',\n loc: null,\n value: ' '\n});\n\nexport const name = 'WhiteSpace';\nexport const structure = {\n value: String\n};\n\nexport function parse() {\n this.eat(WhiteSpace);\n return SPACE;\n\n // return {\n // type: 'WhiteSpace',\n // loc: this.getLocation(this.tokenStart, this.tokenEnd),\n // value: this.consume(WHITESPACE)\n // };\n}\n\nexport function generate(node) {\n this.token(WhiteSpace, node.value);\n}\n", "import * as node from '../node/index-generate.js';\n\nexport default {\n node\n};\n", "import { createGenerator } from './create.js';\nimport config from '../syntax/config/generator.js';\n\nexport default createGenerator(config);\n", "//\n// list\n// \u250C\u2500\u2500\u2500\u2500\u2500\u2500\u2510\n// \u250C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253C\u2500head \u2502\n// \u2502 \u2502 tail\u2500\u253C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510\n// \u2502 \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2518 \u2502\n// \u25BC \u25BC\n// item item item item\n// \u250C\u2500\u2500\u2500\u2500\u2500\u2500\u2510 \u250C\u2500\u2500\u2500\u2500\u2500\u2500\u2510 \u250C\u2500\u2500\u2500\u2500\u2500\u2500\u2510 \u250C\u2500\u2500\u2500\u2500\u2500\u2500\u2510\n// null \u25C0\u2500\u2500\u253C\u2500prev \u2502\u25C0\u2500\u2500\u2500\u253C\u2500prev \u2502\u25C0\u2500\u2500\u2500\u253C\u2500prev \u2502\u25C0\u2500\u2500\u2500\u253C\u2500prev \u2502\n// \u2502 next\u2500\u253C\u2500\u2500\u2500\u25B6\u2502 next\u2500\u253C\u2500\u2500\u2500\u25B6\u2502 next\u2500\u253C\u2500\u2500\u2500\u25B6\u2502 next\u2500\u253C\u2500\u2500\u25B6 null\n// \u251C\u2500\u2500\u2500\u2500\u2500\u2500\u2524 \u251C\u2500\u2500\u2500\u2500\u2500\u2500\u2524 \u251C\u2500\u2500\u2500\u2500\u2500\u2500\u2524 \u251C\u2500\u2500\u2500\u2500\u2500\u2500\u2524\n// \u2502 data \u2502 \u2502 data \u2502 \u2502 data \u2502 \u2502 data \u2502\n// \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2518 \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2518 \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2518 \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2518\n//\n\nlet releasedCursors = null;\n\nexport class List {\n static createItem(data) {\n return {\n prev: null,\n next: null,\n data\n };\n }\n\n constructor() {\n this.head = null;\n this.tail = null;\n this.cursor = null;\n }\n createItem(data) {\n return List.createItem(data);\n }\n\n // cursor helpers\n allocateCursor(prev, next) {\n let cursor;\n\n if (releasedCursors !== null) {\n cursor = releasedCursors;\n releasedCursors = releasedCursors.cursor;\n cursor.prev = prev;\n cursor.next = next;\n cursor.cursor = this.cursor;\n } else {\n cursor = {\n prev,\n next,\n cursor: this.cursor\n };\n }\n\n this.cursor = cursor;\n\n return cursor;\n }\n releaseCursor() {\n const { cursor } = this;\n\n this.cursor = cursor.cursor;\n cursor.prev = null;\n cursor.next = null;\n cursor.cursor = releasedCursors;\n releasedCursors = cursor;\n }\n updateCursors(prevOld, prevNew, nextOld, nextNew) {\n let { cursor } = this;\n\n while (cursor !== null) {\n if (cursor.prev === prevOld) {\n cursor.prev = prevNew;\n }\n\n if (cursor.next === nextOld) {\n cursor.next = nextNew;\n }\n\n cursor = cursor.cursor;\n }\n }\n *[Symbol.iterator]() {\n for (let cursor = this.head; cursor !== null; cursor = cursor.next) {\n yield cursor.data;\n }\n }\n\n // getters\n get size() {\n let size = 0;\n\n for (let cursor = this.head; cursor !== null; cursor = cursor.next) {\n size++;\n }\n\n return size;\n }\n get isEmpty() {\n return this.head === null;\n }\n get first() {\n return this.head && this.head.data;\n }\n get last() {\n return this.tail && this.tail.data;\n }\n\n // convertors\n fromArray(array) {\n let cursor = null;\n this.head = null;\n\n for (let data of array) {\n const item = List.createItem(data);\n\n if (cursor !== null) {\n cursor.next = item;\n } else {\n this.head = item;\n }\n\n item.prev = cursor;\n cursor = item;\n }\n\n this.tail = cursor;\n return this;\n }\n toArray() {\n return [...this];\n }\n toJSON() {\n return [...this];\n }\n\n // array-like methods\n forEach(fn, thisArg = this) {\n // push cursor\n const cursor = this.allocateCursor(null, this.head);\n\n while (cursor.next !== null) {\n const item = cursor.next;\n cursor.next = item.next;\n fn.call(thisArg, item.data, item, this);\n }\n\n // pop cursor\n this.releaseCursor();\n }\n forEachRight(fn, thisArg = this) {\n // push cursor\n const cursor = this.allocateCursor(this.tail, null);\n\n while (cursor.prev !== null) {\n const item = cursor.prev;\n cursor.prev = item.prev;\n fn.call(thisArg, item.data, item, this);\n }\n\n // pop cursor\n this.releaseCursor();\n }\n reduce(fn, initialValue, thisArg = this) {\n // push cursor\n let cursor = this.allocateCursor(null, this.head);\n let acc = initialValue;\n let item;\n\n while (cursor.next !== null) {\n item = cursor.next;\n cursor.next = item.next;\n\n acc = fn.call(thisArg, acc, item.data, item, this);\n }\n\n // pop cursor\n this.releaseCursor();\n\n return acc;\n }\n reduceRight(fn, initialValue, thisArg = this) {\n // push cursor\n let cursor = this.allocateCursor(this.tail, null);\n let acc = initialValue;\n let item;\n\n while (cursor.prev !== null) {\n item = cursor.prev;\n cursor.prev = item.prev;\n\n acc = fn.call(thisArg, acc, item.data, item, this);\n }\n\n // pop cursor\n this.releaseCursor();\n\n return acc;\n }\n some(fn, thisArg = this) {\n for (let cursor = this.head; cursor !== null; cursor = cursor.next) {\n if (fn.call(thisArg, cursor.data, cursor, this)) {\n return true;\n }\n }\n\n return false;\n }\n map(fn, thisArg = this) {\n const result = new List();\n\n for (let cursor = this.head; cursor !== null; cursor = cursor.next) {\n result.appendData(fn.call(thisArg, cursor.data, cursor, this));\n }\n\n return result;\n }\n filter(fn, thisArg = this) {\n const result = new List();\n\n for (let cursor = this.head; cursor !== null; cursor = cursor.next) {\n if (fn.call(thisArg, cursor.data, cursor, this)) {\n result.appendData(cursor.data);\n }\n }\n\n return result;\n }\n\n nextUntil(start, fn, thisArg = this) {\n if (start === null) {\n return;\n }\n\n // push cursor\n const cursor = this.allocateCursor(null, start);\n\n while (cursor.next !== null) {\n const item = cursor.next;\n cursor.next = item.next;\n if (fn.call(thisArg, item.data, item, this)) {\n break;\n }\n }\n\n // pop cursor\n this.releaseCursor();\n }\n prevUntil(start, fn, thisArg = this) {\n if (start === null) {\n return;\n }\n\n // push cursor\n const cursor = this.allocateCursor(start, null);\n\n while (cursor.prev !== null) {\n const item = cursor.prev;\n cursor.prev = item.prev;\n if (fn.call(thisArg, item.data, item, this)) {\n break;\n }\n }\n\n // pop cursor\n this.releaseCursor();\n }\n\n // mutation\n clear() {\n this.head = null;\n this.tail = null;\n }\n copy() {\n const result = new List();\n\n for (let data of this) {\n result.appendData(data);\n }\n\n return result;\n }\n prepend(item) {\n // head\n // ^\n // item\n this.updateCursors(null, item, this.head, item);\n\n // insert to the beginning of the list\n if (this.head !== null) {\n // new item <- first item\n this.head.prev = item;\n // new item -> first item\n item.next = this.head;\n } else {\n // if list has no head, then it also has no tail\n // in this case tail points to the new item\n this.tail = item;\n }\n\n // head always points to new item\n this.head = item;\n return this;\n }\n prependData(data) {\n return this.prepend(List.createItem(data));\n }\n append(item) {\n return this.insert(item);\n }\n appendData(data) {\n return this.insert(List.createItem(data));\n }\n insert(item, before = null) {\n if (before !== null) {\n // prev before\n // ^\n // item\n this.updateCursors(before.prev, item, before, item);\n\n if (before.prev === null) {\n // insert to the beginning of list\n if (this.head !== before) {\n throw new Error('before doesn\\'t belong to list');\n }\n // since head points to before therefore list doesn't empty\n // no need to check tail\n this.head = item;\n before.prev = item;\n item.next = before;\n this.updateCursors(null, item);\n } else {\n // insert between two items\n before.prev.next = item;\n item.prev = before.prev;\n before.prev = item;\n item.next = before;\n }\n } else {\n // tail\n // ^\n // item\n this.updateCursors(this.tail, item, null, item);\n\n // insert to the ending of the list\n if (this.tail !== null) {\n // last item -> new item\n this.tail.next = item;\n // last item <- new item\n item.prev = this.tail;\n } else {\n // if list has no tail, then it also has no head\n // in this case head points to new item\n this.head = item;\n }\n\n // tail always points to new item\n this.tail = item;\n }\n\n return this;\n }\n insertData(data, before) {\n return this.insert(List.createItem(data), before);\n }\n remove(item) {\n // item\n // ^\n // prev next\n this.updateCursors(item, item.prev, item, item.next);\n\n if (item.prev !== null) {\n item.prev.next = item.next;\n } else {\n if (this.head !== item) {\n throw new Error('item doesn\\'t belong to list');\n }\n\n this.head = item.next;\n }\n\n if (item.next !== null) {\n item.next.prev = item.prev;\n } else {\n if (this.tail !== item) {\n throw new Error('item doesn\\'t belong to list');\n }\n\n this.tail = item.prev;\n }\n\n item.prev = null;\n item.next = null;\n\n return item;\n }\n push(data) {\n this.insert(List.createItem(data));\n }\n pop() {\n return this.tail !== null ? this.remove(this.tail) : null;\n }\n unshift(data) {\n this.prepend(List.createItem(data));\n }\n shift() {\n return this.head !== null ? this.remove(this.head) : null;\n }\n prependList(list) {\n return this.insertList(list, this.head);\n }\n appendList(list) {\n return this.insertList(list);\n }\n insertList(list, before) {\n // ignore empty lists\n if (list.head === null) {\n return this;\n }\n\n if (before !== undefined && before !== null) {\n this.updateCursors(before.prev, list.tail, before, list.head);\n\n // insert in the middle of dist list\n if (before.prev !== null) {\n // before.prev <-> list.head\n before.prev.next = list.head;\n list.head.prev = before.prev;\n } else {\n this.head = list.head;\n }\n\n before.prev = list.tail;\n list.tail.next = before;\n } else {\n this.updateCursors(this.tail, list.tail, null, list.head);\n\n // insert to end of the list\n if (this.tail !== null) {\n // if destination list has a tail, then it also has a head,\n // but head doesn't change\n // dest tail -> source head\n this.tail.next = list.head;\n // dest tail <- source head\n list.head.prev = this.tail;\n } else {\n // if list has no a tail, then it also has no a head\n // in this case points head to new item\n this.head = list.head;\n }\n\n // tail always start point to new item\n this.tail = list.tail;\n }\n\n list.head = null;\n list.tail = null;\n return this;\n }\n replace(oldItem, newItemOrList) {\n if ('head' in newItemOrList) {\n this.insertList(newItemOrList, oldItem);\n } else {\n this.insert(newItemOrList, oldItem);\n }\n\n this.remove(oldItem);\n }\n}\n", "export function createCustomError(name, message) {\n // use Object.create(), because some VMs prevent setting line/column otherwise\n // (iOS Safari 10 even throws an exception)\n const error = Object.create(SyntaxError.prototype);\n const errorStack = new Error();\n\n return Object.assign(error, {\n name,\n message,\n get stack() {\n return (errorStack.stack || '').replace(/^(.+\\n){1,3}/, `${name}: ${message}\\n`);\n }\n });\n};\n", "import { createCustomError } from '../utils/create-custom-error.js';\n\nconst MAX_LINE_LENGTH = 100;\nconst OFFSET_CORRECTION = 60;\nconst TAB_REPLACEMENT = ' ';\n\nfunction sourceFragment({ source, line, column, baseLine, baseColumn }, extraLines) {\n function processLines(start, end) {\n return lines\n .slice(start, end)\n .map((line, idx) =>\n String(start + idx + 1).padStart(maxNumLength) + ' |' + line\n ).join('\\n');\n }\n\n const prelines = '\\n'.repeat(Math.max(baseLine - 1, 0));\n const precolumns = ' '.repeat(Math.max(baseColumn - 1, 0));\n const lines = (prelines + precolumns + source).split(/\\r\\n?|\\n|\\f/);\n const startLine = Math.max(1, line - extraLines) - 1;\n const endLine = Math.min(line + extraLines, lines.length + 1);\n const maxNumLength = Math.max(4, String(endLine).length) + 1;\n let cutLeft = 0;\n\n // column correction according to replaced tab before column\n column += (TAB_REPLACEMENT.length - 1) * (lines[line - 1].substr(0, column - 1).match(/\\t/g) || []).length;\n\n if (column > MAX_LINE_LENGTH) {\n cutLeft = column - OFFSET_CORRECTION + 3;\n column = OFFSET_CORRECTION - 2;\n }\n\n for (let i = startLine; i <= endLine; i++) {\n if (i >= 0 && i < lines.length) {\n lines[i] = lines[i].replace(/\\t/g, TAB_REPLACEMENT);\n lines[i] =\n (cutLeft > 0 && lines[i].length > cutLeft ? '\\u2026' : '') +\n lines[i].substr(cutLeft, MAX_LINE_LENGTH - 2) +\n (lines[i].length > cutLeft + MAX_LINE_LENGTH - 1 ? '\\u2026' : '');\n }\n }\n\n return [\n processLines(startLine, line),\n new Array(column + maxNumLength + 2).join('-') + '^',\n processLines(line, endLine)\n ].filter(Boolean)\n .join('\\n')\n .replace(/^(\\s+\\d+\\s+\\|\\n)+/, '')\n .replace(/\\n(\\s+\\d+\\s+\\|)+$/, '');\n}\n\nexport function SyntaxError(message, source, offset, line, column, baseLine = 1, baseColumn = 1) {\n const error = Object.assign(createCustomError('SyntaxError', message), {\n source,\n offset,\n line,\n column,\n sourceFragment(extraLines) {\n return sourceFragment({ source, line, column, baseLine, baseColumn }, isNaN(extraLines) ? 0 : extraLines);\n },\n get formattedMessage() {\n return (\n `Parse error: ${message}\\n` +\n sourceFragment({ source, line, column, baseLine, baseColumn }, 2)\n );\n }\n });\n\n return error;\n}\n", "import { WhiteSpace, Comment } from '../tokenizer/index.js';\n\nexport function readSequence(recognizer) {\n const children = this.createList();\n let space = false;\n const context = {\n recognizer\n };\n\n while (!this.eof) {\n switch (this.tokenType) {\n case Comment:\n this.next();\n continue;\n\n case WhiteSpace:\n space = true;\n this.next();\n continue;\n }\n\n let child = recognizer.getNode.call(this, context);\n\n if (child === undefined) {\n break;\n }\n\n if (space) {\n if (recognizer.onWhiteSpace) {\n recognizer.onWhiteSpace.call(this, child, children, context);\n }\n space = false;\n }\n\n children.push(child);\n }\n\n if (space && recognizer.onWhiteSpace) {\n recognizer.onWhiteSpace.call(this, null, children, context);\n }\n\n return children;\n};\n", "import { List } from '../utils/List.js';\nimport { SyntaxError } from './SyntaxError.js';\nimport {\n tokenize,\n OffsetToLocation,\n TokenStream,\n tokenNames,\n\n consumeNumber,\n findWhiteSpaceStart,\n cmpChar,\n cmpStr,\n\n WhiteSpace,\n Comment,\n Ident,\n Function as FunctionToken,\n Url,\n Hash,\n Percentage,\n Number as NumberToken\n} from '../tokenizer/index.js';\nimport { readSequence } from './sequence.js';\n\nconst NOOP = () => {};\nconst EXCLAMATIONMARK = 0x0021; // U+0021 EXCLAMATION MARK (!)\nconst NUMBERSIGN = 0x0023; // U+0023 NUMBER SIGN (#)\nconst SEMICOLON = 0x003B; // U+003B SEMICOLON (;)\nconst LEFTCURLYBRACKET = 0x007B; // U+007B LEFT CURLY BRACKET ({)\nconst NULL = 0;\n\nconst arrayMethods = {\n createList() {\n return [];\n },\n createSingleNodeList(node) {\n return [node];\n },\n getFirstListNode(list) {\n return list && list[0] || null;\n },\n getLastListNode(list) {\n return list && list.length > 0 ? list[list.length - 1] : null;\n }\n};\n\nconst listMethods = {\n createList() {\n return new List();\n },\n createSingleNodeList(node) {\n return new List().appendData(node);\n },\n getFirstListNode(list) {\n return list && list.first;\n },\n getLastListNode(list) {\n return list && list.last;\n }\n};\n\nfunction createParseContext(name) {\n return function() {\n return this[name]();\n };\n}\n\nfunction fetchParseValues(dict) {\n const result = Object.create(null);\n\n for (const name of Object.keys(dict)) {\n const item = dict[name];\n const fn = item.parse || item;\n\n if (fn) {\n result[name] = fn;\n }\n }\n\n return result;\n}\n\nfunction processConfig(config) {\n const parseConfig = {\n context: Object.create(null),\n features: Object.assign(Object.create(null), config.features),\n scope: Object.assign(Object.create(null), config.scope),\n atrule: fetchParseValues(config.atrule),\n pseudo: fetchParseValues(config.pseudo),\n node: fetchParseValues(config.node)\n };\n\n for (const [name, context] of Object.entries(config.parseContext)) {\n switch (typeof context) {\n case 'function':\n parseConfig.context[name] = context;\n break;\n\n case 'string':\n parseConfig.context[name] = createParseContext(context);\n break;\n }\n }\n\n return {\n config: parseConfig,\n ...parseConfig,\n ...parseConfig.node\n };\n}\n\nexport function createParser(config) {\n let source = '';\n let filename = '';\n let needPositions = false;\n let onParseError = NOOP;\n let onParseErrorThrow = false;\n\n const locationMap = new OffsetToLocation();\n const parser = Object.assign(new TokenStream(), processConfig(config || {}), {\n parseAtrulePrelude: true,\n parseRulePrelude: true,\n parseValue: true,\n parseCustomProperty: false,\n\n readSequence,\n\n consumeUntilBalanceEnd: () => 0,\n consumeUntilLeftCurlyBracket(code) {\n return code === LEFTCURLYBRACKET ? 1 : 0;\n },\n consumeUntilLeftCurlyBracketOrSemicolon(code) {\n return code === LEFTCURLYBRACKET || code === SEMICOLON ? 1 : 0;\n },\n consumeUntilExclamationMarkOrSemicolon(code) {\n return code === EXCLAMATIONMARK || code === SEMICOLON ? 1 : 0;\n },\n consumeUntilSemicolonIncluded(code) {\n return code === SEMICOLON ? 2 : 0;\n },\n\n createList: NOOP,\n createSingleNodeList: NOOP,\n getFirstListNode: NOOP,\n getLastListNode: NOOP,\n\n parseWithFallback(consumer, fallback) {\n const startIndex = this.tokenIndex;\n\n try {\n return consumer.call(this);\n } catch (e) {\n if (onParseErrorThrow) {\n throw e;\n }\n\n this.skip(startIndex - this.tokenIndex);\n const fallbackNode = fallback.call(this);\n\n onParseErrorThrow = true;\n onParseError(e, fallbackNode);\n onParseErrorThrow = false;\n\n return fallbackNode;\n }\n },\n\n lookupNonWSType(offset) {\n let type;\n\n do {\n type = this.lookupType(offset++);\n if (type !== WhiteSpace && type !== Comment) {\n return type;\n }\n } while (type !== NULL);\n\n return NULL;\n },\n\n charCodeAt(offset) {\n return offset >= 0 && offset < source.length ? source.charCodeAt(offset) : 0;\n },\n substring(offsetStart, offsetEnd) {\n return source.substring(offsetStart, offsetEnd);\n },\n substrToCursor(start) {\n return this.source.substring(start, this.tokenStart);\n },\n\n cmpChar(offset, charCode) {\n return cmpChar(source, offset, charCode);\n },\n cmpStr(offsetStart, offsetEnd, str) {\n return cmpStr(source, offsetStart, offsetEnd, str);\n },\n\n consume(tokenType) {\n const start = this.tokenStart;\n\n this.eat(tokenType);\n\n return this.substrToCursor(start);\n },\n consumeFunctionName() {\n const name = source.substring(this.tokenStart, this.tokenEnd - 1);\n\n this.eat(FunctionToken);\n\n return name;\n },\n consumeNumber(type) {\n const number = source.substring(this.tokenStart, consumeNumber(source, this.tokenStart));\n\n this.eat(type);\n\n return number;\n },\n\n eat(tokenType) {\n if (this.tokenType !== tokenType) {\n const tokenName = tokenNames[tokenType].slice(0, -6).replace(/-/g, ' ').replace(/^./, m => m.toUpperCase());\n let message = `${/[[\\](){}]/.test(tokenName) ? `\"${tokenName}\"` : tokenName} is expected`;\n let offset = this.tokenStart;\n\n // tweak message and offset\n switch (tokenType) {\n case Ident:\n // when identifier is expected but there is a function or url\n if (this.tokenType === FunctionToken || this.tokenType === Url) {\n offset = this.tokenEnd - 1;\n message = 'Identifier is expected but function found';\n } else {\n message = 'Identifier is expected';\n }\n break;\n\n case Hash:\n if (this.isDelim(NUMBERSIGN)) {\n this.next();\n offset++;\n message = 'Name is expected';\n }\n break;\n\n case Percentage:\n if (this.tokenType === NumberToken) {\n offset = this.tokenEnd;\n message = 'Percent sign is expected';\n }\n break;\n }\n\n this.error(message, offset);\n }\n\n this.next();\n },\n eatIdent(name) {\n if (this.tokenType !== Ident || this.lookupValue(0, name) === false) {\n this.error(`Identifier \"${name}\" is expected`);\n }\n\n this.next();\n },\n eatDelim(code) {\n if (!this.isDelim(code)) {\n this.error(`Delim \"${String.fromCharCode(code)}\" is expected`);\n }\n\n this.next();\n },\n\n getLocation(start, end) {\n if (needPositions) {\n return locationMap.getLocationRange(\n start,\n end,\n filename\n );\n }\n\n return null;\n },\n getLocationFromList(list) {\n if (needPositions) {\n const head = this.getFirstListNode(list);\n const tail = this.getLastListNode(list);\n return locationMap.getLocationRange(\n head !== null ? head.loc.start.offset - locationMap.startOffset : this.tokenStart,\n tail !== null ? tail.loc.end.offset - locationMap.startOffset : this.tokenStart,\n filename\n );\n }\n\n return null;\n },\n\n error(message, offset) {\n const location = typeof offset !== 'undefined' && offset < source.length\n ? locationMap.getLocation(offset)\n : this.eof\n ? locationMap.getLocation(findWhiteSpaceStart(source, source.length - 1))\n : locationMap.getLocation(this.tokenStart);\n\n throw new SyntaxError(\n message || 'Unexpected input',\n source,\n location.offset,\n location.line,\n location.column,\n locationMap.startLine,\n locationMap.startColumn\n );\n }\n });\n const createTokenIterateAPI = () => ({\n filename,\n source,\n tokenCount: parser.tokenCount,\n\n getTokenType: (index) =>\n parser.getTokenType(index),\n getTokenTypeName: (index) =>\n tokenNames[parser.getTokenType(index)],\n getTokenStart: (index) =>\n parser.getTokenStart(index),\n getTokenEnd: (index) =>\n parser.getTokenEnd(index),\n getTokenValue: (index) =>\n parser.source.substring(parser.getTokenStart(index), parser.getTokenEnd(index)),\n\n substring: (start, end) =>\n parser.source.substring(start, end),\n\n balance: parser.balance.subarray(0, parser.tokenCount + 1),\n isBlockOpenerTokenType: parser.isBlockOpenerTokenType,\n isBlockCloserTokenType: parser.isBlockCloserTokenType,\n getBlockTokenPairIndex: (index) =>\n parser.getBlockTokenPairIndex(index),\n\n getLocation: (offset) =>\n locationMap.getLocation(offset, filename),\n getRangeLocation: (start, end) =>\n locationMap.getLocationRange(start, end, filename)\n });\n\n const parse = function(source_, options) {\n source = source_;\n options = options || {};\n\n parser.setSource(source, tokenize);\n locationMap.setSource(\n source,\n options.offset,\n options.line,\n options.column\n );\n\n filename = options.filename || '';\n needPositions = Boolean(options.positions);\n onParseError = typeof options.onParseError === 'function' ? options.onParseError : NOOP;\n onParseErrorThrow = false;\n\n parser.parseAtrulePrelude = 'parseAtrulePrelude' in options ? Boolean(options.parseAtrulePrelude) : true;\n parser.parseRulePrelude = 'parseRulePrelude' in options ? Boolean(options.parseRulePrelude) : true;\n parser.parseValue = 'parseValue' in options ? Boolean(options.parseValue) : true;\n parser.parseCustomProperty = 'parseCustomProperty' in options ? Boolean(options.parseCustomProperty) : false;\n\n const { context = 'default', list = true, onComment, onToken } = options;\n\n if (context in parser.context === false) {\n throw new Error('Unknown context `' + context + '`');\n }\n\n Object.assign(parser, list ? listMethods : arrayMethods);\n\n if (Array.isArray(onToken)) {\n parser.forEachToken((type, start, end) => {\n onToken.push({ type, start, end });\n });\n } else if (typeof onToken === 'function') {\n parser.forEachToken(onToken.bind(createTokenIterateAPI()));\n }\n\n if (typeof onComment === 'function') {\n parser.forEachToken((type, start, end) => {\n if (type === Comment) {\n const loc = parser.getLocation(start, end);\n const value = cmpStr(source, end - 2, end, '*/')\n ? source.slice(start + 2, end - 2)\n : source.slice(start + 2, end);\n\n onComment(value, loc);\n }\n });\n }\n\n const ast = parser.context[context].call(parser, options);\n\n if (!parser.eof) {\n parser.error();\n }\n\n return ast;\n };\n\n return Object.assign(parse, {\n SyntaxError,\n config: parser.config\n });\n};\n", "import {\n Delim,\n Ident,\n Dimension,\n Percentage,\n Number as NumberToken,\n Hash,\n Colon,\n LeftSquareBracket\n} from '../../tokenizer/index.js';\n\nconst NUMBERSIGN = 0x0023; // U+0023 NUMBER SIGN (#)\nconst AMPERSAND = 0x0026; // U+0026 AMPERSAND (&)\nconst ASTERISK = 0x002A; // U+002A ASTERISK (*)\nconst PLUSSIGN = 0x002B; // U+002B PLUS SIGN (+)\nconst SOLIDUS = 0x002F; // U+002F SOLIDUS (/)\nconst FULLSTOP = 0x002E; // U+002E FULL STOP (.)\nconst GREATERTHANSIGN = 0x003E; // U+003E GREATER-THAN SIGN (>)\nconst VERTICALLINE = 0x007C; // U+007C VERTICAL LINE (|)\nconst TILDE = 0x007E; // U+007E TILDE (~)\n\nfunction onWhiteSpace(next, children) {\n if (children.last !== null && children.last.type !== 'Combinator' &&\n next !== null && next.type !== 'Combinator') {\n children.push({ // FIXME: this.Combinator() should be used instead\n type: 'Combinator',\n loc: null,\n name: ' '\n });\n }\n}\n\nfunction getNode() {\n switch (this.tokenType) {\n case LeftSquareBracket:\n return this.AttributeSelector();\n\n case Hash:\n return this.IdSelector();\n\n case Colon:\n if (this.lookupType(1) === Colon) {\n return this.PseudoElementSelector();\n } else {\n return this.PseudoClassSelector();\n }\n\n case Ident:\n return this.TypeSelector();\n\n case NumberToken:\n case Percentage:\n return this.Percentage();\n\n case Dimension:\n // throws when .123ident\n if (this.charCodeAt(this.tokenStart) === FULLSTOP) {\n this.error('Identifier is expected', this.tokenStart + 1);\n }\n break;\n\n case Delim: {\n const code = this.charCodeAt(this.tokenStart);\n\n switch (code) {\n case PLUSSIGN:\n case GREATERTHANSIGN:\n case TILDE:\n case SOLIDUS: // /deep/\n return this.Combinator();\n\n case FULLSTOP:\n return this.ClassSelector();\n\n case ASTERISK:\n case VERTICALLINE:\n return this.TypeSelector();\n\n case NUMBERSIGN:\n return this.IdSelector();\n\n case AMPERSAND:\n return this.NestingSelector();\n }\n\n break;\n }\n }\n};\n\nexport default {\n onWhiteSpace,\n getNode\n};\n", "import { Comma, String as StringToken, Ident, RightParenthesis } from '../../tokenizer/index.js';\n\nexport function parseLanguageRangeList() {\n const children = this.createList();\n\n this.skipSC();\n\n loop: while (!this.eof) {\n switch (this.tokenType) {\n case Ident:\n children.push(this.Identifier());\n break;\n\n case StringToken:\n children.push(this.String());\n break;\n\n case Comma:\n children.push(this.Operator());\n break;\n\n case RightParenthesis:\n break loop;\n\n default:\n this.error('Identifier, string or comma is expected');\n }\n\n this.skipSC();\n }\n\n return children;\n}\n", "import { parseLanguageRangeList } from './lang.js';\n\nconst selectorList = {\n parse() {\n return this.createSingleNodeList(\n this.SelectorList()\n );\n }\n};\n\nconst selector = {\n parse() {\n return this.createSingleNodeList(\n this.Selector()\n );\n }\n};\n\nconst identList = {\n parse() {\n return this.createSingleNodeList(\n this.Identifier()\n );\n }\n};\n\nconst langList = {\n parse: parseLanguageRangeList\n};\n\nconst nth = {\n parse() {\n return this.createSingleNodeList(\n this.Nth()\n );\n }\n};\n\nexport default {\n 'dir': identList,\n 'has': selectorList,\n 'lang': langList,\n 'matches': selectorList,\n 'is': selectorList,\n '-moz-any': selectorList,\n '-webkit-any': selectorList,\n 'where': selectorList,\n 'not': selectorList,\n 'nth-child': nth,\n 'nth-last-child': nth,\n 'nth-last-of-type': nth,\n 'nth-of-type': nth,\n 'slotted': selector,\n 'host': selector,\n 'host-context': selector\n};\n", "export { parse as AnPlusB } from './AnPlusB.js';\nexport { parse as AttributeSelector } from './AttributeSelector.js';\nexport { parse as ClassSelector } from './ClassSelector.js';\nexport { parse as Combinator } from './Combinator.js';\nexport { parse as Identifier } from './Identifier.js';\nexport { parse as IdSelector } from './IdSelector.js';\nexport { parse as NestingSelector } from './NestingSelector.js';\nexport { parse as Nth } from './Nth.js';\nexport { parse as Operator } from './Operator.js';\nexport { parse as Percentage } from './Percentage.js';\nexport { parse as PseudoClassSelector } from './PseudoClassSelector.js';\nexport { parse as PseudoElementSelector } from './PseudoElementSelector.js';\nexport { parse as Raw } from './Raw.js';\nexport { parse as Selector } from './Selector.js';\nexport { parse as SelectorList } from './SelectorList.js';\nexport { parse as String } from './String.js';\nexport { parse as TypeSelector } from './TypeSelector.js';\n", "import { Selector } from '../scope/index.js';\nimport pseudo from '../pseudo/index.js';\nimport * as node from '../node/index-parse-selector.js';\n\nexport default {\n parseContext: {\n default: 'SelectorList',\n selectorList: 'SelectorList',\n selector: 'Selector'\n },\n scope: { Selector },\n atrule: {},\n pseudo,\n node\n};\n", "import { createParser } from './create.js';\nimport config from '../syntax/config/parser-selector.js';\n\nexport default createParser(config);\n", "const compare = (s1, s2) => {\n if (s1.a === s2.a) {\n if (s1.b === s2.b) {\n return s1.c - s2.c;\n }\n return s1.b - s2.b;\n }\n return s1.a - s2.a;\n};\n\nconst equals = (s1, s2) => {\n return compare(s1, s2) === 0;\n};\n\nconst greaterThan = (s1, s2) => {\n return compare(s1, s2) > 0;\n};\n\nconst lessThan = (s1, s2) => {\n return compare(s1, s2) < 0;\n};\n\nexport { compare, equals, greaterThan, lessThan };\n", "import { compare } from './compare.js';\n\nconst sort = (specificities, order = 'ASC') => {\n const sorted = specificities.sort(compare);\n\n if (order === 'DESC') {\n return sorted.reverse();\n }\n\n return sorted;\n};\n\nconst sortAsc = (...specificities) => {\n return sort(specificities, 'ASC');\n};\n\nconst sortDesc = (...specificities) => {\n return sort(specificities, 'DESC');\n};\n\nexport { sortAsc, sortDesc };\n", "import { sortAsc, sortDesc } from './sort.js';\n\nconst max = (...specificities) => {\n const sorted = sortDesc(...specificities);\n return sorted[0];\n};\n\nconst min = (...specificities) => {\n const sorted = sortAsc(...specificities);\n return sorted[0];\n};\n\nexport { max, min };\n", "import parse from 'css-tree/selector-parser';\nimport Specificity from '../index.js';\nimport { max } from './../util/index.js';\n\n/** @param {import('css-tree').Selector} selectorAST */\nconst calculateForAST = (selectorAST) => {\n // Quit while you're ahead\n if (!selectorAST || selectorAST.type !== 'Selector') {\n throw new TypeError(`Passed in source is not a Selector AST`);\n }\n\n // https://www.w3.org/TR/selectors-4/#specificity-rules\n let a = 0; /* ID Selectors */\n let b = 0; /* Class selectors, Attributes selectors, and Pseudo-classes */\n let c = 0; /* Type selectors and Pseudo-elements */\n\n selectorAST.children.forEach((child) => {\n switch (child.type) {\n case 'IdSelector':\n a += 1;\n break;\n\n case 'AttributeSelector':\n case 'ClassSelector':\n b += 1;\n break;\n\n case 'PseudoClassSelector':\n switch (child.name.toLowerCase()) {\n // \u201CThe specificity of a :where() pseudo-class is replaced by zero.\u201D\n case 'where':\n // Noop :)\n break;\n\n case '-webkit-any':\n case 'any':\n if (child.children?.first) {\n b += 1;\n }\n break;\n\n // \u201CThe specificity of an :is(), :not(), or :has() pseudo-class is replaced by the specificity of the most specific complex selector in its selector list argument.\u201C\n case '-moz-any':\n case 'is':\n case 'matches':\n case 'not':\n case 'has':\n if (child.children?.first) {\n // Calculate Specificity from nested SelectorList\n const max1 = max(...calculate(child.children.first));\n\n // Adjust orig specificity\n a += max1.a;\n b += max1.b;\n c += max1.c;\n }\n\n break;\n\n // \u201CThe specificity of an :nth-child() or :nth-last-child() selector is the specificity of the pseudo class itself (counting as one pseudo-class selector) plus the specificity of the most specific complex selector in its selector list argument\u201D\n case 'nth-child':\n case 'nth-last-child':\n b += 1;\n\n if (child.children?.first?.selector) {\n // Calculate Specificity from SelectorList\n const max2 = max(...calculate(child.children.first.selector));\n\n // Adjust orig specificity\n a += max2.a;\n b += max2.b;\n c += max2.c;\n }\n break;\n\n // \u201CThe specificity of :host is that of a pseudo-class. The specificity of :host() is that of a pseudo-class, plus the specificity of its argument.\u201D\n // \u201CThe specificity of :host-context() is that of a pseudo-class, plus the specificity of its argument.\u201D\n case 'host-context':\n case 'host':\n b += 1;\n\n if (child.children?.first?.children) {\n // Workaround to a css-tree bug in which it allows complex selectors instead of only compound selectors\n // We work around it by filtering out any Combinator and successive Selectors\n const childAST = { type: 'Selector', children: [] };\n let foundCombinator = false;\n child.children.first.children.forEach((entry) => {\n if (foundCombinator) return false;\n if (entry.type === 'Combinator') {\n foundCombinator = true;\n return false;\n }\n childAST.children.push(entry);\n });\n\n // Calculate Specificity from Selector\n const childSpecificity = calculate(childAST)[0];\n\n // Adjust orig specificity\n a += childSpecificity.a;\n b += childSpecificity.b;\n c += childSpecificity.c;\n }\n break;\n\n // Improper use of Pseudo-Class Selectors instead of a Pseudo-Element\n // @ref https://developer.mozilla.org/en-US/docs/Web/CSS/Pseudo-elements#index\n case 'after':\n case 'before':\n case 'first-letter':\n case 'first-line':\n c += 1;\n break;\n\n default:\n b += 1;\n break;\n }\n break;\n\n case 'PseudoElementSelector':\n switch (child.name) {\n // \u201CThe specificity of ::slotted() is that of a pseudo-element, plus the specificity of its argument.\u201D\n case 'slotted':\n c += 1;\n\n if (child.children?.first?.children) {\n // Workaround to a css-tree bug in which it allows complex selectors instead of only compound selectors\n // We work around it by filtering out any Combinator and successive Selectors\n const childAST = { type: 'Selector', children: [] };\n let foundCombinator = false;\n child.children.first.children.forEach((entry) => {\n if (foundCombinator) return false;\n if (entry.type === 'Combinator') {\n foundCombinator = true;\n return false;\n }\n childAST.children.push(entry);\n });\n\n // Calculate Specificity from Selector\n const childSpecificity = calculate(childAST)[0];\n\n // Adjust orig specificity\n a += childSpecificity.a;\n b += childSpecificity.b;\n c += childSpecificity.c;\n }\n break;\n\n case 'view-transition-group':\n case 'view-transition-image-pair':\n case 'view-transition-old':\n case 'view-transition-new':\n // The specificity of a view-transition selector with a * argument is zero.\n if (child.children?.first?.value === '*') {\n break;\n }\n // The specificity of a view-transition selector with an argument is the same\n // as for other pseudo - elements, and is equivalent to a type selector.\n c += 1;\n break;\n\n case 'highlight':\n if (child.children?.size > 0) {\n // The specificity of a ::highlight() selector with a * argument is zero.\n if (child.children.first?.value === '*') {\n break;\n }\n // The specificity of a ::highlight() selector with a argument\n // is equivalent to a type selector.\n c += 1;\n }\n break;\n\n default:\n c += 1;\n break;\n }\n break;\n\n case 'TypeSelector':\n // Omit namespace\n let typeSelector = child.name;\n if (typeSelector.includes('|')) {\n typeSelector = typeSelector.split('|')[1];\n }\n\n // \u201CIgnore the universal selector\u201D\n if (typeSelector !== '*') {\n c += 1;\n }\n break;\n\n default:\n // NOOP\n break;\n }\n });\n\n return new Specificity({ a, b, c }, selectorAST);\n};\n\nconst convertToAST = (source) => {\n // The passed in argument was a String.\n // ~> Let's try and parse to an AST\n if (typeof source === 'string' || source instanceof String) {\n try {\n return parse(source, {\n context: 'selectorList',\n });\n } catch (e) {\n throw new TypeError(`Could not convert passed in source '${source}' to SelectorList: ${e.message}`);\n }\n }\n\n // The passed in argument was an Object.\n // ~> Let's verify if it's a AST of the type Selector or SelectorList\n if (source instanceof Object) {\n if (source.type && ['Selector', 'SelectorList'].includes(source.type)) {\n return source;\n }\n\n // Manually parsing subtree when the child is of the type Raw, most likely due to https://github.com/csstree/csstree/issues/151\n if (source.type && source.type === 'Raw') {\n try {\n return parse(source.value, {\n context: 'selectorList',\n });\n } catch (e) {\n throw new TypeError(`Could not convert passed in source to SelectorList: ${e.message}`);\n }\n }\n\n throw new TypeError(`Passed in source is an Object but no AST / AST of the type Selector or SelectorList`);\n }\n\n throw new TypeError(`Passed in source is not a String nor an Object. I don't know what to do with it.`);\n};\n\n/**\n * @param {string} selector\n * @returns {Specificity[]}\n */\nconst calculate = (selector) => {\n // Quit while you're ahead\n if (!selector) {\n return [];\n }\n\n // Make sure we have a SelectorList AST\n // If not, an exception will be thrown\n const ast = convertToAST(selector);\n\n // Selector?\n if (ast.type === 'Selector') {\n return [calculateForAST(selector)];\n }\n\n // SelectorList?\n // ~> Calculate Specificity for each contained Selector\n if (ast.type === 'SelectorList') {\n const specificities = [];\n ast.children.forEach((childAST) => {\n const specificity = calculateForAST(childAST);\n specificities.push(specificity);\n });\n return specificities;\n }\n};\n\nexport { calculate, calculateForAST };\n", "import generate from 'css-tree/generator';\n\nimport { calculate, calculateForAST } from './core/index.js';\nimport { compare, equals, greaterThan, lessThan } from './util/compare.js';\nimport { min, max } from './util/filter.js';\nimport { sortAsc, sortDesc } from './util/sort.js';\n\nclass NotAllowedError extends Error {\n constructor() {\n super('Manipulating a Specificity instance is not allowed. Instead, create a new Specificity()');\n }\n}\n\nclass Specificity {\n constructor(value, selector = null) {\n this.value = value;\n this.selector = selector;\n }\n\n get a() {\n return this.value.a;\n }\n\n set a(val) {\n throw new NotAllowedError();\n }\n\n get b() {\n return this.value.b;\n }\n\n set b(val) {\n throw new NotAllowedError();\n }\n\n get c() {\n return this.value.c;\n }\n\n set c(val) {\n throw new NotAllowedError();\n }\n\n selectorString() {\n // this.selector already is a String\n if (typeof this.selector === 'string' || this.selector instanceof String) {\n return this.selector;\n }\n\n // this.selector is a Selector as parsed by CSSTree\n if (this.selector instanceof Object) {\n if (this.selector.type === 'Selector') {\n return generate(this.selector);\n }\n }\n\n // this.selector is something else \u2026\n return '';\n }\n\n toObject() {\n return this.value;\n }\n\n toArray() {\n return [this.value.a, this.value.b, this.value.c];\n }\n\n toString() {\n return `(${this.value.a},${this.value.b},${this.value.c})`;\n }\n\n toJSON() {\n return {\n selector: this.selectorString(),\n asObject: this.toObject(),\n asArray: this.toArray(),\n asString: this.toString(),\n };\n }\n\n isEqualTo(otherSpecificity) {\n return equals(this, otherSpecificity);\n }\n\n isGreaterThan(otherSpecificity) {\n return greaterThan(this, otherSpecificity);\n }\n\n isLessThan(otherSpecificity) {\n return lessThan(this, otherSpecificity);\n }\n\n static calculate(selector) {\n return calculate(selector);\n }\n\n static calculateForAST(selector) {\n return calculateForAST(selector);\n }\n\n static compare(s1, s2) {\n return compare(s1, s2);\n }\n\n static equals(s1, s2) {\n return equals(s1, s2);\n }\n\n static lessThan(s1, s2) {\n return lessThan(s1, s2);\n }\n\n static greaterThan(s1, s2) {\n return greaterThan(s1, s2);\n }\n\n static min(...specificities) {\n return min(...specificities);\n }\n\n static max(...specificities) {\n return max(...specificities);\n }\n\n static sortAsc(...specificities) {\n return sortAsc(...specificities);\n }\n\n static sortDesc(...specificities) {\n return sortDesc(...specificities);\n }\n}\n\nexport default Specificity;\n"], + "mappings": "mnBAAA,IAAAA,GAAAC,GAAAC,IAAA,CAOA,IAAIC,GAAe,mEAAmE,MAAM,EAAE,EAK9FD,GAAQ,OAAS,SAAUE,EAAQ,CACjC,GAAI,GAAKA,GAAUA,EAASD,GAAa,OACvC,OAAOA,GAAaC,CAAM,EAE5B,MAAM,IAAI,UAAU,6BAA+BA,CAAM,CAC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CAAa,CACnC,CAEA,OAAO,YAAYA,EAAe,CAC9B,OAAOI,GAAS,GAAGJ,CAAa,CACpC,CACJ,EAEOK,GAAQnB", + "names": ["require_base64", "__commonJSMin", "exports", "intToCharMap", "number", "charCode", "bigA", "bigZ", "littleA", "littleZ", "zero", "nine", "plus", "slash", "littleOffset", "numberOffset", "require_base64_vlq", "__commonJSMin", "exports", "base64", "VLQ_BASE_SHIFT", "VLQ_BASE", "VLQ_BASE_MASK", "VLQ_CONTINUATION_BIT", "toVLQSigned", "aValue", "fromVLQSigned", "isNegative", "shifted", "encoded", "digit", "vlq", "aStr", "aIndex", "aOutParam", "strLen", "result", "shift", "continuation", "require_util", "__commonJSMin", "exports", "getArg", "aArgs", "aName", "aDefaultValue", "urlRegexp", "dataUrlRegexp", "urlParse", "aUrl", "match", "urlGenerate", "aParsedUrl", "url", "MAX_CACHED_INPUTS", "lruMemoize", "f", "cache", "input", "i", "temp", "result", "normalize", "aPath", "path", "isAbsolute", "parts", "start", "part", "up", "join", "aRoot", "aPathUrl", "aRootUrl", "joined", "relative", "level", "index", "supportsNullProto", "obj", "identity", "s", "toSetString", "aStr", "isProtoString", "fromSetString", "length", "compareByOriginalPositions", "mappingA", "mappingB", "onlyCompareOriginal", "cmp", "strcmp", "compareByOriginalPositionsNoSource", "compareByGeneratedPositionsDeflated", "onlyCompareGenerated", "compareByGeneratedPositionsDeflatedNoLine", "aStr1", "aStr2", "compareByGeneratedPositionsInflated", "parseSourceMapInput", "str", "computeSourceURL", "sourceRoot", "sourceURL", "sourceMapURL", "parsed", "require_array_set", "__commonJSMin", "exports", "util", "has", "hasNativeMap", "ArraySet", "aArray", "aAllowDuplicates", "set", "len", "aStr", "sStr", "isDuplicate", "idx", "aIdx", "require_mapping_list", "__commonJSMin", "exports", "util", "generatedPositionAfter", "mappingA", "mappingB", "lineA", "lineB", "columnA", "columnB", "MappingList", "aCallback", "aThisArg", "aMapping", "require_source_map_generator", "__commonJSMin", "exports", "base64VLQ", "util", "ArraySet", "MappingList", "SourceMapGenerator", "aArgs", "aSourceMapConsumer", "generatorOps", "sourceRoot", "generator", "mapping", "newMapping", "sourceFile", "sourceRelative", "content", "generated", "original", "source", "name", "aSourceFile", "aSourceContent", "aSourceMapPath", "newSources", "newNames", "aGenerated", "aOriginal", "aSource", "aName", "message", "previousGeneratedColumn", "previousGeneratedLine", "previousOriginalColumn", "previousOriginalLine", "previousName", "previousSource", "result", "next", "nameIdx", "sourceIdx", "mappings", "i", "len", "lineDelta", "aSources", "aSourceRoot", "key", "map", "isDigit", "code", "isHexDigit", "isUppercaseLetter", "isLowercaseLetter", "isLetter", "isNonAscii", "isNameStart", "isName", "isNonPrintable", "isNewline", "isWhiteSpace", "isValidEscape", "first", "second", "isIdentifierStart", "third", "isNumberStart", "isBOM", "CATEGORY", "EofCategory", "WhiteSpaceCategory", "DigitCategory", "NameStartCategory", "NonPrintableCategory", "i", "charCodeCategory", "getCharCode", "source", "offset", "getNewlineLength", "code", "cmpChar", "testStr", "referenceCode", "isUppercaseLetter", "cmpStr", "start", "end", "referenceStr", "testCode", "findWhiteSpaceStart", "isWhiteSpace", "findWhiteSpaceEnd", "findDecimalNumberEnd", "isDigit", "consumeEscaped", "isHexDigit", "maxOffset", "consumeName", "isName", "isValidEscape", "consumeNumber", "sign", "consumeBadUrlRemnants", "decodeEscaped", "escaped", "names_default", "adoptBuffer", "buffer", "size", "N", "F", "R", "computeLinesAndColumns", "host", "source", "sourceLength", "startOffset", "isBOM", "lines", "adoptBuffer", "columns", "line", "column", "i", "code", "OffsetToLocation", "startLine", "startColumn", "offset", "filename", "start", "end", "OFFSET_MASK", "TYPE_SHIFT", "BLOCK_OPEN_TOKEN", "BLOCK_CLOSE_TOKEN", "balancePair", "blockTokens", "boundIndex", "index", "min", "max", "TokenStream", "source", "tokenize", "sourceLength", "offsetAndType", "adoptBuffer", "balance", "tokenCount", "firstCharOffset", "balanceCloseType", "balanceStart", "type", "start", "end", "prevBalanceStart", "i", "balanceEnd", "offset", "idx", "tokenType", "referenceStr", "cmpStr", "tokenIndex", "pairIndex", "closeType", "openType", "code", "next", "startToken", "stopConsume", "cursor", "loop", "fn", "item", "tokens", "names_default", "tokenize", "source", "onToken", "getCharCode", "offset", "sourceLength", "consumeNumericToken", "consumeNumber", "isIdentifierStart", "type", "consumeName", "consumeIdentLikeToken", "nameStartOffset", "cmpStr", "findWhiteSpaceEnd", "consumeUrlToken", "consumeStringToken", "endingCodePoint", "code", "charCodeCategory", "WhiteSpaceCategory", "isNewline", "getNewlineLength", "nextCode", "isValidEscape", "consumeEscaped", "consumeBadUrlRemnants", "NonPrintableCategory", "start", "isBOM", "isName", "isNumberStart", "DigitCategory", "NameStartCategory", "import_source_map_generator", "trackNodes", "generateSourceMap", "handlers", "map", "generated", "original", "activatedGenerated", "activatedMapping", "line", "column", "sourceMappingActive", "origHandlersNode", "node", "nodeLine", "nodeColumn", "origHandlersEmit", "value", "type", "auto", "i", "origHandlersResult", "token_before_exports", "__export", "safe", "spec", "PLUSSIGN", "HYPHENMINUS", "code", "type", "value", "specPairs", "safePairs", "createMap", "pairs", "isWhiteSpaceRequired", "prev", "next", "prevCode", "nextCode", "nextCharCode", "emitWs", "spec", "safe", "REVERSESOLIDUS", "processChildren", "node", "delimeter", "prev", "createGenerator", "config", "types", "name", "item", "options", "buffer", "prevCode", "handlers", "publicApi", "safe", "type", "value", "suppressAutoWhiteSpace", "generateSourceMap", "token_before_exports", "raw", "tokenize", "start", "end", "index_generate_exports", "__export", "generate", "PLUSSIGN", "HYPHENMINUS", "N", "DISALLOW_SIGN", "ALLOW_SIGN", "checkInteger", "offset", "disallowSign", "pos", "code", "isDigit", "checkTokenIsInteger", "expectCharCode", "msg", "consumeB", "sign", "type", "parse", "start", "a", "b", "checkTokenIsInteger", "ALLOW_SIGN", "HYPHENMINUS", "expectCharCode", "N", "consumeB", "DISALLOW_SIGN", "checkInteger", "PLUSSIGN", "sign", "code", "i", "isDigit", "generate", "node", "generate", "node", "generate", "node", "DOLLARSIGN", "ASTERISK", "EQUALSSIGN", "CIRCUMFLEXACCENT", "VERTICALLINE", "TILDE", "getAttributeName", "start", "expectIdent", "getOperator", "code", "parse", "start", "name", "matcher", "value", "flags", "getAttributeName", "getOperator", "generate", "node", "generate", "node", "prev", "generate", "node", "generate", "generate", "FULLSTOP", "parse", "FULLSTOP", "generate", "node", "PLUSSIGN", "SOLIDUS", "GREATERTHANSIGN", "TILDE", "parse", "start", "name", "GREATERTHANSIGN", "PLUSSIGN", "TILDE", "SOLIDUS", "generate", "node", "generate", "node", "generate", "node", "child", "generate", "node", "generate", "node", "prev", "generate", "node", "generate", "node", "generate", "node", "generate", "node", "generate", "node", "generate", "node", "generate", "node", "parse", "generate", "node", "parse", "start", "generate", "node", "generate", "node", "generate", "node", "generate", "node", "generate", "node", "AMPERSAND", "parse", "start", "AMPERSAND", "generate", "parse", "start", "end", "selector", "nth", "generate", "node", "generate", "node", "parse", "start", "generate", "node", "generate", "node", "parse", "generate", "node", "parse", "start", "children", "name", "nameLowerCase", "generate", "node", "parse", "start", "children", "name", "nameLowerCase", "generate", "node", "generate", "node", "getOffsetExcludeWS", "parse", "consumeUntil", "excludeWhiteSpace", "startOffset", "endOffset", "getOffsetExcludeWS", "generate", "node", "generate", "node", "generate", "node", "parse", "children", "generate", "node", "parse", "children", "generate", "node", "REVERSE_SOLIDUS", "QUOTATION_MARK", "APOSTROPHE", "decode", "str", "len", "firstChar", "start", "end", "decoded", "i", "code", "isValidEscape", "escapeStart", "escapeEnd", "consumeEscaped", "decodeEscaped", "encode", "apostrophe", "quote", "quoteCode", "encoded", "wsBeforeHexIsNeeded", "isHexDigit", "isWhiteSpace", "parse", "decode", "generate", "node", "encode", "generate", "node", "generate", "node", "ASTERISK", "VERTICALLINE", "eatIdentifierOrAsterisk", "parse", "start", "VERTICALLINE", "eatIdentifierOrAsterisk", "generate", "node", "generate", "node", "SPACE", "REVERSE_SOLIDUS", "QUOTATION_MARK", "APOSTROPHE", "LEFTPARENTHESIS", "RIGHTPARENTHESIS", "encode", "str", "encoded", "wsBeforeHexIsNeeded", "i", "code", "SPACE", "REVERSE_SOLIDUS", "QUOTATION_MARK", "APOSTROPHE", "LEFTPARENTHESIS", "RIGHTPARENTHESIS", "isHexDigit", "generate", "node", "encode", "generate", "node", "SPACE", "generate", "node", "generator_default", "index_generate_exports", "generator_default", "createGenerator", "releasedCursors", "List", "_List", "data", "prev", "next", "cursor", "prevOld", "prevNew", "nextOld", "nextNew", "size", "array", "item", "fn", "thisArg", "initialValue", "acc", "result", "start", "before", "list", "oldItem", "newItemOrList", "createCustomError", "name", "message", "error", "errorStack", "MAX_LINE_LENGTH", "OFFSET_CORRECTION", "TAB_REPLACEMENT", "sourceFragment", "source", "line", "column", "baseLine", "baseColumn", "extraLines", "processLines", "start", "end", "lines", "idx", "maxNumLength", "prelines", "precolumns", "startLine", "endLine", "cutLeft", "i", "SyntaxError", "message", "offset", "createCustomError", "readSequence", "recognizer", "children", "space", "context", "child", "NOOP", "EXCLAMATIONMARK", "NUMBERSIGN", "SEMICOLON", "LEFTCURLYBRACKET", "NULL", "arrayMethods", "node", "list", "listMethods", "List", "createParseContext", "name", "fetchParseValues", "dict", "result", "item", "fn", "processConfig", "config", "parseConfig", "context", "createParser", "source", "filename", "needPositions", "onParseError", "onParseErrorThrow", "locationMap", "OffsetToLocation", "parser", "TokenStream", "readSequence", "code", "consumer", "fallback", "startIndex", "e", "fallbackNode", "offset", "type", "offsetStart", "offsetEnd", "start", "charCode", "cmpChar", "str", "cmpStr", "tokenType", "number", "consumeNumber", "tokenName", "names_default", "m", "message", "end", "head", "tail", "location", "findWhiteSpaceStart", "SyntaxError", "createTokenIterateAPI", "index", "source_", "options", "tokenize", "onComment", "onToken", "loc", "value", "ast", "NUMBERSIGN", "AMPERSAND", "ASTERISK", "PLUSSIGN", "SOLIDUS", "FULLSTOP", "GREATERTHANSIGN", "VERTICALLINE", "TILDE", "onWhiteSpace", "next", "children", "getNode", "selector_default", "parseLanguageRangeList", "children", "loop", "selectorList", "selector", "identList", "langList", "parseLanguageRangeList", "nth", "pseudo_default", "index_parse_selector_exports", "__export", "parse", "parser_selector_default", "selector_default", "pseudo_default", "index_parse_selector_exports", "parse_selector_default", "createParser", "parser_selector_default", "compare", "s1", "s2", "equals", "greaterThan", "lessThan", "sort", "specificities", "order", "sorted", "compare", "sortAsc", "sortDesc", "max", "specificities", "sortDesc", "min", "sortAsc", "calculateForAST", "selectorAST", "a", "b", "c", "child", "max1", "max", "calculate", "max2", "childAST", "foundCombinator", "entry", "childSpecificity", "typeSelector", "index_default", "convertToAST", "source", "parse_selector_default", "e", "selector", "ast", "specificities", "specificity", "NotAllowedError", "Specificity", "value", "selector", "val", "generator_default", "otherSpecificity", "equals", "greaterThan", "lessThan", "calculate", "calculateForAST", "s1", "s2", "compare", "specificities", "min", "max", "sortAsc", "sortDesc", "index_default"] +} diff --git a/node_modules/@bramus/specificity/index.d.ts b/node_modules/@bramus/specificity/index.d.ts new file mode 100644 index 0000000..95d477a --- /dev/null +++ b/node_modules/@bramus/specificity/index.d.ts @@ -0,0 +1,59 @@ +// Types & Classes +export type SpecificityArray = [number, number, number]; +export type SpecificityObject = { a: number; b: number; c: number }; + +export default class Specificity { + static calculate(selector: string | CSSTreeAST): Array; + static calculateForAST(selectorAST: CSSTreeAST): Specificity; + static compare(s1: SpecificityInstanceOrObject, s2: SpecificityInstanceOrObject): number; + static equals(s1: SpecificityInstanceOrObject, s2: SpecificityInstanceOrObject): boolean; + static lessThan(s1: SpecificityInstanceOrObject, s2: SpecificityInstanceOrObject): boolean; + static greaterThan(s1: SpecificityInstanceOrObject, s2: SpecificityInstanceOrObject): boolean; + static min(...specificities: SpecificityInstanceOrObject[]): SpecificityInstanceOrObject; + static max(...specificities: SpecificityInstanceOrObject[]): SpecificityInstanceOrObject; + static sortAsc(...specificities: SpecificityInstanceOrObject[]): SpecificityInstanceOrObject; + static sortDesc(...specificities: SpecificityInstanceOrObject[]): SpecificityInstanceOrObject; + constructor(value: SpecificityObject, selector?: any); + value: SpecificityObject; + selector: string | CSSTreeAST; + set a(arg: number); + get a(): number; + set b(arg: number); + get b(): number; + set c(arg: number); + get c(): number; + selectorString(): string; + toObject(): SpecificityObject; + toArray(): SpecificityArray; + toString(): string; + toJSON(): { + selector: string; + asObject: SpecificityObject; + asArray: SpecificityArray; + asString: string; + }; + isEqualTo(otherSpecificity: SpecificityInstanceOrObject): boolean; + isGreaterThan(otherSpecificity: SpecificityInstanceOrObject): boolean; + isLessThan(otherSpecificity: SpecificityInstanceOrObject): boolean; +} + +type SpecificityInstanceOrObject = Specificity | SpecificityObject; +type CSSTreeAST = Object; // @TODO: Define shape + +// CORE +export function calculate(selector: string | CSSTreeAST): Array; +export function calculateForAST(selectorAST: CSSTreeAST): Specificity; + +// UTIL: COMPARE +export function equals(s1: SpecificityInstanceOrObject, s2: SpecificityInstanceOrObject): boolean; +export function greaterThan(s1: SpecificityInstanceOrObject, s2: SpecificityInstanceOrObject): boolean; +export function lessThan(s1: SpecificityInstanceOrObject, s2: SpecificityInstanceOrObject): boolean; +export function compare(s1: SpecificityInstanceOrObject, s2: SpecificityInstanceOrObject): number; + +// UTIL: FILTER +export function min(specificities: SpecificityInstanceOrObject[]): SpecificityInstanceOrObject; +export function max(specificities: SpecificityInstanceOrObject[]): SpecificityInstanceOrObject; + +// UTIL: SORT +export function sortAsc(specificities: SpecificityInstanceOrObject[]): SpecificityInstanceOrObject[]; +export function sortDesc(specificities: SpecificityInstanceOrObject[]): SpecificityInstanceOrObject[]; diff --git a/node_modules/@bramus/specificity/package.json b/node_modules/@bramus/specificity/package.json new file mode 100644 index 0000000..8cf0985 --- /dev/null +++ b/node_modules/@bramus/specificity/package.json @@ -0,0 +1,92 @@ +{ + "name": "@bramus/specificity", + "version": "2.4.3", + "description": "Calculate specificity of a CSS Selector", + "type": "module", + "main": "./dist/index.cjs", + "module": "./dist/index.js", + "exports": { + ".": { + "browser": "./dist/index.js", + "import": "./dist/index.js", + "require": "./dist/index.cjs" + }, + "./core": { + "import": "./src/core/index.js" + }, + "./util": { + "import": "./src/util/index.js" + }, + "./compare": { + "import": "./src/util/compare.js" + }, + "./filter": { + "import": "./src/util/filter.js" + }, + "./sort": { + "import": "./src/util/sort.js" + } + }, + "unpkg": "./dist/index.js", + "jsdelivr": "./dist/index.js", + "files": [ + "bin", + "src", + "dist", + "index.d.ts" + ], + "types": "./index.d.ts", + "bin": { + "specificity": "./bin/cli.js" + }, + "scripts": { + "build-esm": "esbuild --bundle ./src/index.js --outfile=./dist/index.js --format=esm --sourcemap --minify", + "build-cjs": "esbuild --bundle ./src/index.js --outfile=./dist/index.cjs --format=cjs --sourcemap --minify", + "lint": "prettier --check '{src,test}/**/*.{ts,tsx,js,jsx}'", + "format": "prettier --write '{src,test}/**/*.{ts,tsx,js,jsx}'", + "build": "npm run build-esm && npm run build-cjs", + "prepack": "npm run prevent-dirty-tree && npm run test", + "prepublish": "npm run build", + "pretest": "npm run build", + "test": "mocha", + "prebenchmark": "npm run build", + "benchmark": "node ./benchmark/bench.cjs", + "beta-version-patch": "npm version $(semver $npm_package_version -i prerelease --preid beta)", + "beta-version-minor": "npm version $(semver $npm_package_version -i preminor --preid beta)", + "beta-version-major": "npm version $(semver $npm_package_version -i premajor --preid beta)", + "rc-version": "npm version $(semver $npm_package_version -i prerelease --preid rc)", + "final-release": "npm version $(semver $npm_package_version -i)", + "preversion": "npm run prevent-dirty-tree && npm run test", + "prevent-dirty-tree": "exit $(git status --porcelain | wc -l)" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/bramus/specificity.git" + }, + "keywords": [ + "css", + "specificity" + ], + "author": { + "name": "Bramus Van Damme", + "email": "bramus@bram.us", + "twitter": "@bramus", + "web": "https://www.bram.us/" + }, + "license": "MIT", + "bugs": { + "url": "https://github.com/bramus/specificity/issues" + }, + "homepage": "https://github.com/bramus/specificity#readme", + "devDependencies": { + "benchmark": "^2.1.4", + "esbuild": "^0.28.2", + "microtime": "^3.1.1", + "mocha": "^12.0.3", + "prettier": "^3.9.9", + "semver": "^7.8.5" + }, + "dependencies": { + "css-tree": "^3.2.1" + } +} diff --git a/node_modules/@bramus/specificity/src/core/calculate.js b/node_modules/@bramus/specificity/src/core/calculate.js new file mode 100644 index 0000000..70510e5 --- /dev/null +++ b/node_modules/@bramus/specificity/src/core/calculate.js @@ -0,0 +1,272 @@ +import parse from 'css-tree/selector-parser'; +import Specificity from '../index.js'; +import { max } from './../util/index.js'; + +/** @param {import('css-tree').Selector} selectorAST */ +const calculateForAST = (selectorAST) => { + // Quit while you're ahead + if (!selectorAST || selectorAST.type !== 'Selector') { + throw new TypeError(`Passed in source is not a Selector AST`); + } + + // https://www.w3.org/TR/selectors-4/#specificity-rules + let a = 0; /* ID Selectors */ + let b = 0; /* Class selectors, Attributes selectors, and Pseudo-classes */ + let c = 0; /* Type selectors and Pseudo-elements */ + + selectorAST.children.forEach((child) => { + switch (child.type) { + case 'IdSelector': + a += 1; + break; + + case 'AttributeSelector': + case 'ClassSelector': + b += 1; + break; + + case 'PseudoClassSelector': + switch (child.name.toLowerCase()) { + // “The specificity of a :where() pseudo-class is replaced by zero.” + case 'where': + // Noop :) + break; + + case '-webkit-any': + case 'any': + if (child.children?.first) { + b += 1; + } + break; + + // “The specificity of an :is(), :not(), or :has() pseudo-class is replaced by the specificity of the most specific complex selector in its selector list argument.“ + case '-moz-any': + case 'is': + case 'matches': + case 'not': + case 'has': + if (child.children?.first) { + // Calculate Specificity from nested SelectorList + const max1 = max(...calculate(child.children.first)); + + // Adjust orig specificity + a += max1.a; + b += max1.b; + c += max1.c; + } + + break; + + // “The specificity of an :nth-child() or :nth-last-child() selector is the specificity of the pseudo class itself (counting as one pseudo-class selector) plus the specificity of the most specific complex selector in its selector list argument” + case 'nth-child': + case 'nth-last-child': + b += 1; + + if (child.children?.first?.selector) { + // Calculate Specificity from SelectorList + const max2 = max(...calculate(child.children.first.selector)); + + // Adjust orig specificity + a += max2.a; + b += max2.b; + c += max2.c; + } + break; + + // “The specificity of :host is that of a pseudo-class. The specificity of :host() is that of a pseudo-class, plus the specificity of its argument.” + // “The specificity of :host-context() is that of a pseudo-class, plus the specificity of its argument.” + case 'host-context': + case 'host': + b += 1; + + if (child.children?.first?.children) { + // Workaround to a css-tree bug in which it allows complex selectors instead of only compound selectors + // We work around it by filtering out any Combinator and successive Selectors + const childAST = { type: 'Selector', children: [] }; + let foundCombinator = false; + child.children.first.children.forEach((entry) => { + if (foundCombinator) return false; + if (entry.type === 'Combinator') { + foundCombinator = true; + return false; + } + childAST.children.push(entry); + }); + + // Calculate Specificity from Selector + const childSpecificity = calculate(childAST)[0]; + + // Adjust orig specificity + a += childSpecificity.a; + b += childSpecificity.b; + c += childSpecificity.c; + } + break; + + // Improper use of Pseudo-Class Selectors instead of a Pseudo-Element + // @ref https://developer.mozilla.org/en-US/docs/Web/CSS/Pseudo-elements#index + case 'after': + case 'before': + case 'first-letter': + case 'first-line': + c += 1; + break; + + default: + b += 1; + break; + } + break; + + case 'PseudoElementSelector': + switch (child.name) { + // “The specificity of ::slotted() is that of a pseudo-element, plus the specificity of its argument.” + case 'slotted': + c += 1; + + if (child.children?.first?.children) { + // Workaround to a css-tree bug in which it allows complex selectors instead of only compound selectors + // We work around it by filtering out any Combinator and successive Selectors + const childAST = { type: 'Selector', children: [] }; + let foundCombinator = false; + child.children.first.children.forEach((entry) => { + if (foundCombinator) return false; + if (entry.type === 'Combinator') { + foundCombinator = true; + return false; + } + childAST.children.push(entry); + }); + + // Calculate Specificity from Selector + const childSpecificity = calculate(childAST)[0]; + + // Adjust orig specificity + a += childSpecificity.a; + b += childSpecificity.b; + c += childSpecificity.c; + } + break; + + case 'view-transition-group': + case 'view-transition-image-pair': + case 'view-transition-old': + case 'view-transition-new': + // The specificity of a view-transition selector with a * argument is zero. + if (child.children?.first?.value === '*') { + break; + } + // The specificity of a view-transition selector with an argument is the same + // as for other pseudo - elements, and is equivalent to a type selector. + c += 1; + break; + + case 'highlight': + if (child.children?.size > 0) { + // The specificity of a ::highlight() selector with a * argument is zero. + if (child.children.first?.value === '*') { + break; + } + // The specificity of a ::highlight() selector with a argument + // is equivalent to a type selector. + c += 1; + } + break; + + default: + c += 1; + break; + } + break; + + case 'TypeSelector': + // Omit namespace + let typeSelector = child.name; + if (typeSelector.includes('|')) { + typeSelector = typeSelector.split('|')[1]; + } + + // “Ignore the universal selector” + if (typeSelector !== '*') { + c += 1; + } + break; + + default: + // NOOP + break; + } + }); + + return new Specificity({ a, b, c }, selectorAST); +}; + +const convertToAST = (source) => { + // The passed in argument was a String. + // ~> Let's try and parse to an AST + if (typeof source === 'string' || source instanceof String) { + try { + return parse(source, { + context: 'selectorList', + }); + } catch (e) { + throw new TypeError(`Could not convert passed in source '${source}' to SelectorList: ${e.message}`); + } + } + + // The passed in argument was an Object. + // ~> Let's verify if it's a AST of the type Selector or SelectorList + if (source instanceof Object) { + if (source.type && ['Selector', 'SelectorList'].includes(source.type)) { + return source; + } + + // Manually parsing subtree when the child is of the type Raw, most likely due to https://github.com/csstree/csstree/issues/151 + if (source.type && source.type === 'Raw') { + try { + return parse(source.value, { + context: 'selectorList', + }); + } catch (e) { + throw new TypeError(`Could not convert passed in source to SelectorList: ${e.message}`); + } + } + + throw new TypeError(`Passed in source is an Object but no AST / AST of the type Selector or SelectorList`); + } + + throw new TypeError(`Passed in source is not a String nor an Object. I don't know what to do with it.`); +}; + +/** + * @param {string} selector + * @returns {Specificity[]} + */ +const calculate = (selector) => { + // Quit while you're ahead + if (!selector) { + return []; + } + + // Make sure we have a SelectorList AST + // If not, an exception will be thrown + const ast = convertToAST(selector); + + // Selector? + if (ast.type === 'Selector') { + return [calculateForAST(selector)]; + } + + // SelectorList? + // ~> Calculate Specificity for each contained Selector + if (ast.type === 'SelectorList') { + const specificities = []; + ast.children.forEach((childAST) => { + const specificity = calculateForAST(childAST); + specificities.push(specificity); + }); + return specificities; + } +}; + +export { calculate, calculateForAST }; diff --git a/node_modules/@bramus/specificity/src/core/index.js b/node_modules/@bramus/specificity/src/core/index.js new file mode 100644 index 0000000..0db60bf --- /dev/null +++ b/node_modules/@bramus/specificity/src/core/index.js @@ -0,0 +1 @@ +export { calculate, calculateForAST } from './calculate.js'; diff --git a/node_modules/@bramus/specificity/src/index.js b/node_modules/@bramus/specificity/src/index.js new file mode 100644 index 0000000..cfa1932 --- /dev/null +++ b/node_modules/@bramus/specificity/src/index.js @@ -0,0 +1,135 @@ +import generate from 'css-tree/generator'; + +import { calculate, calculateForAST } from './core/index.js'; +import { compare, equals, greaterThan, lessThan } from './util/compare.js'; +import { min, max } from './util/filter.js'; +import { sortAsc, sortDesc } from './util/sort.js'; + +class NotAllowedError extends Error { + constructor() { + super('Manipulating a Specificity instance is not allowed. Instead, create a new Specificity()'); + } +} + +class Specificity { + constructor(value, selector = null) { + this.value = value; + this.selector = selector; + } + + get a() { + return this.value.a; + } + + set a(val) { + throw new NotAllowedError(); + } + + get b() { + return this.value.b; + } + + set b(val) { + throw new NotAllowedError(); + } + + get c() { + return this.value.c; + } + + set c(val) { + throw new NotAllowedError(); + } + + selectorString() { + // this.selector already is a String + if (typeof this.selector === 'string' || this.selector instanceof String) { + return this.selector; + } + + // this.selector is a Selector as parsed by CSSTree + if (this.selector instanceof Object) { + if (this.selector.type === 'Selector') { + return generate(this.selector); + } + } + + // this.selector is something else … + return ''; + } + + toObject() { + return this.value; + } + + toArray() { + return [this.value.a, this.value.b, this.value.c]; + } + + toString() { + return `(${this.value.a},${this.value.b},${this.value.c})`; + } + + toJSON() { + return { + selector: this.selectorString(), + asObject: this.toObject(), + asArray: this.toArray(), + asString: this.toString(), + }; + } + + isEqualTo(otherSpecificity) { + return equals(this, otherSpecificity); + } + + isGreaterThan(otherSpecificity) { + return greaterThan(this, otherSpecificity); + } + + isLessThan(otherSpecificity) { + return lessThan(this, otherSpecificity); + } + + static calculate(selector) { + return calculate(selector); + } + + static calculateForAST(selector) { + return calculateForAST(selector); + } + + static compare(s1, s2) { + return compare(s1, s2); + } + + static equals(s1, s2) { + return equals(s1, s2); + } + + static lessThan(s1, s2) { + return lessThan(s1, s2); + } + + static greaterThan(s1, s2) { + return greaterThan(s1, s2); + } + + static min(...specificities) { + return min(...specificities); + } + + static max(...specificities) { + return max(...specificities); + } + + static sortAsc(...specificities) { + return sortAsc(...specificities); + } + + static sortDesc(...specificities) { + return sortDesc(...specificities); + } +} + +export default Specificity; diff --git a/node_modules/@bramus/specificity/src/util/compare.js b/node_modules/@bramus/specificity/src/util/compare.js new file mode 100644 index 0000000..4e2fcf9 --- /dev/null +++ b/node_modules/@bramus/specificity/src/util/compare.js @@ -0,0 +1,23 @@ +const compare = (s1, s2) => { + if (s1.a === s2.a) { + if (s1.b === s2.b) { + return s1.c - s2.c; + } + return s1.b - s2.b; + } + return s1.a - s2.a; +}; + +const equals = (s1, s2) => { + return compare(s1, s2) === 0; +}; + +const greaterThan = (s1, s2) => { + return compare(s1, s2) > 0; +}; + +const lessThan = (s1, s2) => { + return compare(s1, s2) < 0; +}; + +export { compare, equals, greaterThan, lessThan }; diff --git a/node_modules/@bramus/specificity/src/util/filter.js b/node_modules/@bramus/specificity/src/util/filter.js new file mode 100644 index 0000000..4cf500a --- /dev/null +++ b/node_modules/@bramus/specificity/src/util/filter.js @@ -0,0 +1,13 @@ +import { sortAsc, sortDesc } from './sort.js'; + +const max = (...specificities) => { + const sorted = sortDesc(...specificities); + return sorted[0]; +}; + +const min = (...specificities) => { + const sorted = sortAsc(...specificities); + return sorted[0]; +}; + +export { max, min }; diff --git a/node_modules/@bramus/specificity/src/util/index.js b/node_modules/@bramus/specificity/src/util/index.js new file mode 100644 index 0000000..160f341 --- /dev/null +++ b/node_modules/@bramus/specificity/src/util/index.js @@ -0,0 +1,3 @@ +export * from './compare.js'; +export * from './sort.js'; +export * from './filter.js'; diff --git a/node_modules/@bramus/specificity/src/util/sort.js b/node_modules/@bramus/specificity/src/util/sort.js new file mode 100644 index 0000000..9691c6e --- /dev/null +++ b/node_modules/@bramus/specificity/src/util/sort.js @@ -0,0 +1,21 @@ +import { compare } from './compare.js'; + +const sort = (specificities, order = 'ASC') => { + const sorted = specificities.sort(compare); + + if (order === 'DESC') { + return sorted.reverse(); + } + + return sorted; +}; + +const sortAsc = (...specificities) => { + return sort(specificities, 'ASC'); +}; + +const sortDesc = (...specificities) => { + return sort(specificities, 'DESC'); +}; + +export { sortAsc, sortDesc }; diff --git a/node_modules/@csstools/color-helpers/CHANGELOG.md b/node_modules/@csstools/color-helpers/CHANGELOG.md new file mode 100644 index 0000000..ff09400 --- /dev/null +++ b/node_modules/@csstools/color-helpers/CHANGELOG.md @@ -0,0 +1,9 @@ +# Changes to Color Helpers + +### 6.1.2 + +_September 25, 2026_ + +- Fixed a potential infinite loop when gamut mapping a color with infinite components + +[Full CHANGELOG](https://github.com/csstools/postcss-plugins/tree/main/packages/color-helpers/CHANGELOG.md) diff --git a/node_modules/@csstools/color-helpers/LICENSE.md b/node_modules/@csstools/color-helpers/LICENSE.md new file mode 100644 index 0000000..e8ae93b --- /dev/null +++ b/node_modules/@csstools/color-helpers/LICENSE.md @@ -0,0 +1,18 @@ +MIT No Attribution (MIT-0) + +Copyright © CSSTools Contributors + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the “Software”), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so. + +THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/node_modules/@csstools/color-helpers/README.md b/node_modules/@csstools/color-helpers/README.md new file mode 100644 index 0000000..97528d0 --- /dev/null +++ b/node_modules/@csstools/color-helpers/README.md @@ -0,0 +1,32 @@ +# Color Helpers for CSS + +[npm version][npm-url] +[Build Status][cli-url] +[Discord][discord] + +## Usage + +Add [Color Helpers] to your project: + +```bash +npm install @csstools/color-helpers --save-dev +``` + +This package exists to join all the different color functions scattered among the Colors 4 and Colors 5 plugins we maintain such as: + +* [PostCSS Color Function] +* [PostCSS Lab Function] +* [PostCSS OKLab Function] + +## Copyright + +This software or document includes material copied from or derived from https://github.com/w3c/csswg-drafts/tree/main/css-color-4. Copyright © 2022 W3C® (MIT, ERCIM, Keio, Beihang). + +[cli-url]: https://github.com/csstools/postcss-plugins/actions/workflows/test.yml?query=workflow/test +[discord]: https://discord.gg/bUadyRwkJS +[npm-url]: https://www.npmjs.com/package/@csstools/color-helpers + +[Color Helpers]: https://github.com/csstools/postcss-plugins/tree/main/packages/color-helpers +[PostCSS Color Function]: https://github.com/csstools/postcss-plugins/tree/main/plugins/postcss-color-function +[PostCSS Lab Function]: https://github.com/csstools/postcss-plugins/tree/main/plugins/postcss-lab-functionw +[PostCSS OKLab Function]: https://github.com/csstools/postcss-plugins/tree/main/plugins/postcss-oklab-function diff --git a/node_modules/@csstools/color-helpers/dist/index.d.ts b/node_modules/@csstools/color-helpers/dist/index.d.ts new file mode 100644 index 0000000..ed7b5f4 --- /dev/null +++ b/node_modules/@csstools/color-helpers/dist/index.d.ts @@ -0,0 +1,711 @@ +/** + * @param {Color} color [r, g, b] + * - Red as number 0..1; + * - Green as number 0..1; + * - Blue as number 0..1; + * @return {Color} D50 XYZ [x, y, z] + */ +export declare function a98_RGB_to_XYZ_D50(x: Color): Color; + +/** + * @param {Color} color [r, g, b] + * - Red as number 0..1; + * - Green as number 0..1; + * - Blue as number 0..1; + * @return {Color} D50 XYZ [x, y, z] + */ +export declare function a98_RGB_to_XYZ_D65(x: Color): Color; + +export declare function clip(color: Color): Color; + +export declare type Color = [number, number, number]; + +/** + * WCAG 2.1 contrast ratio + */ +export declare function contrast_ratio_wcag_2_1(color1: Color, color2: Color): number; + +/** + * Convert an array of linear-light display-p3 RGB in the range 0.0-1.0 + * to gamma corrected form + * + * @license W3C https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document + * @copyright This software or document includes material copied from or derived from https://github.com/w3c/csswg-drafts/blob/main/css-color-4/conversions.js. Copyright © 2022 W3C® (MIT, ERCIM, Keio, Beihang). + */ +export declare function gam_P3(RGB: Color): Color; + +/** + * Convert an array of linear-light sRGB values in the range 0.0-1.0 to gamma corrected form + * Extended transfer function: + * For negative values, linear portion extends on reflection + * of axis, then uses reflected pow below that + * + * @license W3C https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document + * @copyright This software or document includes material copied from or derived from https://github.com/w3c/csswg-drafts/blob/main/css-color-4/conversions.js. Copyright © 2022 W3C® (MIT, ERCIM, Keio, Beihang). + * @see https://en.wikipedia.org/wiki/SRGB + */ +export declare function gam_sRGB(RGB: Color): Color; + +/** + * @param {Color} color [h, s, l] + * - Hue as degrees 0..360; + * - Saturation as number 0..100; + * - Lightness as number 0..100; + * @return {Color} D50 XYZ [x, y, z] + */ +export declare function HSL_to_XYZ_D50(x: Color): Color; + +/** + * @param {Color} color [h, s, l] + * - Hue as degrees 0..360; + * - Saturation as number 0..100; + * - Lightness as number 0..100; + * @return {Color} D50 XYZ [x, y, z] + */ +export declare function HSL_to_XYZ_D65(x: Color): Color; + +/** + * @param {Color} color [h, w, b] + * - Hue as degrees 0..360; + * - Whiteness as number 0..100; + * - Blackness as number 0..100; + * @return {Color} D50 XYZ [x, y, z] + */ +export declare function HWB_to_XYZ_D50(x: Color): Color; + +/** + * @param {Color} color [h, w, b] + * - Hue as degrees 0..360; + * - Whiteness as number 0..100; + * - Blackness as number 0..100; + * @return {Color} D50 XYZ [x, y, z] + */ +export declare function HWB_to_XYZ_D65(x: Color): Color; + +export declare function inGamut(x: Color): boolean; + +/** + * @param {Color} color [l, a, b] + * - Lightness as number 0..100; + * - a as number -160..160; + * - b as number -160..160; + * @return {Color} D50 XYZ [x, y, z] + */ +export declare function Lab_to_XYZ_D50(x: Color): Color; + +/** + * @param {Color} color [l, a, b] + * - Lightness as number 0..100; + * - a as number -160..160; + * - b as number -160..160; + * @return {Color} D50 XYZ [x, y, z] + */ +export declare function Lab_to_XYZ_D65(x: Color): Color; + +/** + * @param {Color} color [l, c, h] + * - Lightness as number 0..100; + * - Chroma as number 0..230; + * - Hue as degrees 0..360; + * @return {Color} D50 XYZ [x, y, z] + */ +export declare function LCH_to_XYZ_D50(x: Color): Color; + +/** + * @param {Color} color [l, c, h] + * - Lightness as number 0..100; + * - Chroma as number 0..230; + * - Hue as degrees 0..360; + * @return {Color} D50 XYZ [x, y, z] + */ +export declare function LCH_to_XYZ_D65(x: Color): Color; + +/** + * Convert an array of display-p3 RGB values in the range 0.0 - 1.0 + * to linear light (un-companded) form. + * + * @license W3C https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document + * @copyright This software or document includes material copied from or derived from https://github.com/w3c/csswg-drafts/blob/main/css-color-4/conversions.js. Copyright © 2022 W3C® (MIT, ERCIM, Keio, Beihang). + */ +export declare function lin_P3(RGB: Color): Color; + +/** + * Convert an array of linear-light display-p3 values to CIE XYZ + * using D65 (no chromatic adaptation) + * + * @license W3C https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document + * @copyright This software or document includes material copied from or derived from https://github.com/w3c/csswg-drafts/blob/main/css-color-4/conversions.js. Copyright © 2022 W3C® (MIT, ERCIM, Keio, Beihang). + * @see http://www.brucelindbloom.com/index.html?Eqn_RGB_XYZ_Matrix.html + */ +export declare function lin_P3_to_XYZ(rgb: Color): Color; + +/** + * @param {Color} color [r, g, b] + * - Red as number 0..1; + * - Green as number 0..1; + * - Blue as number 0..1; + * @return {Color} D50 XYZ [x, y, z] + */ +export declare function lin_P3_to_XYZ_D50(x: Color): Color; + +/** + * @param {Color} color [r, g, b] + * - Red as number 0..1; + * - Green as number 0..1; + * - Blue as number 0..1; + * @return {Color} D50 XYZ [x, y, z] + */ +export declare function lin_P3_to_XYZ_D65(x: Color): Color; + +/** + * Convert an array of of sRGB values where in-gamut values are in the range + * [0 - 1] to linear light (un-companded) form. + * Extended transfer function: + * For negative values, linear portion is extended on reflection of axis, + * then reflected power function is used. + * + * @license W3C https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document + * @copyright This software or document includes material copied from or derived from https://github.com/w3c/csswg-drafts/blob/main/css-color-4/conversions.js. Copyright © 2022 W3C® (MIT, ERCIM, Keio, Beihang). + * @see https://en.wikipedia.org/wiki/SRGB + */ +export declare function lin_sRGB(RGB: Color): Color; + +/** + * Convert an array of linear-light sRGB values to CIE XYZ + * using sRGB's own white, D65 (no chromatic adaptation) + * + * @license W3C https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document + * @copyright This software or document includes material copied from or derived from https://github.com/w3c/csswg-drafts/blob/main/css-color-4/conversions.js. Copyright © 2022 W3C® (MIT, ERCIM, Keio, Beihang). + */ +export declare function lin_sRGB_to_XYZ(rgb: Color): Color; + +/** + * @param {Color} color [r, g, b] + * - Red as number 0..1; + * - Green as number 0..1; + * - Blue as number 0..1; + * @return {Color} D50 XYZ [x, y, z] + */ +export declare function lin_sRGB_to_XYZ_D50(x: Color): Color; + +/** + * @param {Color} color [r, g, b] + * - Red as number 0..1; + * - Green as number 0..1; + * - Blue as number 0..1; + * @return {Color} D50 XYZ [x, y, z] + */ +export declare function lin_sRGB_to_XYZ_D65(x: Color): Color; + +export declare function mapGamut(startOKLCH: Color, toDestination: (x: Color) => Color, fromDestination: (x: Color) => Color): Color; + +/** + * @license MIT https://github.com/facelessuser/coloraide/blob/main/LICENSE.md + */ +export declare function mapGamutRayTrace(startOKLCH: Color, toLinear: (x: Color) => Color, fromLinear: (x: Color) => Color): Color; + +export declare const namedColors: Record; + +/** + * @license W3C https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document + * @copyright This software or document includes material copied from or derived from https://github.com/w3c/csswg-drafts/blob/main/css-color-4/conversions.js. Copyright © 2022 W3C® (MIT, ERCIM, Keio, Beihang). + * @see https://github.com/w3c/csswg-drafts/blob/main/css-color-4/conversions.js + */ +export declare function OKLab_to_OKLCH(OKLab: Color): Color; + +/** + * Given OKLab, convert to XYZ relative to D65 + * + * @license W3C https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document + * @copyright This software or document includes material copied from or derived from https://github.com/w3c/csswg-drafts/blob/main/css-color-4/conversions.js. Copyright © 2022 W3C® (MIT, ERCIM, Keio, Beihang). + * @see https://github.com/w3c/csswg-drafts/blob/main/css-color-4/conversions.js + */ +export declare function OKLab_to_XYZ(OKLab: Color): Color; + +/** + * @param {Color} color [l, a, b] + * - Lightness as number 0..1; + * - a as number 0..0.5; + * - b as number 0..0.5; + * @return {Color} D50 XYZ [x, y, z] + */ +export declare function OKLab_to_XYZ_D50(x: Color): Color; + +/** + * @param {Color} color [l, a, b] + * - Lightness as number 0..1; + * - a as number 0..0.5; + * - b as number 0..0.5; + * @return {Color} D50 XYZ [x, y, z] + */ +export declare function OKLab_to_XYZ_D65(x: Color): Color; + +/** + * @license W3C https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document + * @copyright This software or document includes material copied from or derived from https://github.com/w3c/csswg-drafts/blob/main/css-color-4/conversions.js. Copyright © 2022 W3C® (MIT, ERCIM, Keio, Beihang). + * @see https://github.com/w3c/csswg-drafts/blob/main/css-color-4/conversions.js + */ +export declare function OKLCH_to_OKLab(OKLCH: Color): Color; + +/** + * @param {Color} color [l, c, h] + * - Lightness as number 0..1; + * - Chroma as number 0..0.5; + * - Hue as degrees 0..360; + * @return {Color} D50 XYZ [x, y, z] + */ +export declare function OKLCH_to_XYZ_D50(x: Color): Color; + +/** + * @param {Color} color [l, c, h] + * - Lightness as number 0..1; + * - Chroma as number 0..0.5; + * - Hue as degrees 0..360; + * @return {Color} D50 XYZ [x, y, z] + */ +export declare function OKLCH_to_XYZ_D65(x: Color): Color; + +/** + * @param {Color} color [r, g, b] + * - Red as number 0..1; + * - Green as number 0..1; + * - Blue as number 0..1; + * @return {Color} D50 XYZ [x, y, z] + */ +export declare function P3_to_XYZ_D50(x: Color): Color; + +/** + * @param {Color} color [r, g, b] + * - Red as number 0..1; + * - Green as number 0..1; + * - Blue as number 0..1; + * @return {Color} D50 XYZ [x, y, z] + */ +export declare function P3_to_XYZ_D65(x: Color): Color; + +/** + * @param {Color} color [r, g, b] + * - Red as number 0..1; + * - Green as number 0..1; + * - Blue as number 0..1; + * @return {Color} D50 XYZ [x, y, z] + */ +export declare function ProPhoto_RGB_to_XYZ_D50(x: Color): Color; + +/** + * @param {Color} color [r, g, b] + * - Red as number 0..1; + * - Green as number 0..1; + * - Blue as number 0..1; + * @return {Color} D50 XYZ [x, y, z] + */ +export declare function ProPhoto_RGB_to_XYZ_D65(x: Color): Color; + +/** + * @param {Color} color [r, g, b] + * - Red as number 0..1; + * - Green as number 0..1; + * - Blue as number 0..1; + * @return {Color} D50 XYZ [x, y, z] + */ +export declare function rec_2020_to_XYZ_D50(x: Color): Color; + +/** + * @param {Color} color [r, g, b] + * - Red as number 0..1; + * - Green as number 0..1; + * - Blue as number 0..1; + * @return {Color} D50 XYZ [x, y, z] + */ +export declare function rec_2020_to_XYZ_D65(x: Color): Color; + +/** + * @param {Color} color [r, g, b] + * - Red as number 0..1; + * - Green as number 0..1; + * - Blue as number 0..1; + * @return {Color} D50 XYZ [x, y, z] + */ +export declare function sRGB_to_XYZ_D50(x: Color): Color; + +/** + * @param {Color} color [r, g, b] + * - Red as number 0..1; + * - Green as number 0..1; + * - Blue as number 0..1; + * @return {Color} D50 XYZ [x, y, z] + */ +export declare function sRGB_to_XYZ_D65(x: Color): Color; + +/** + * @param {Color} color [x, y, z] + * - X as number 0..1; + * - Y as number 0..1; + * - Z as number 0..1; + * @return {Color} a98 sRGB [r, g, b] + * - Red as number 0..1; + * - Green as number 0..1; + * - Blue as number 0..1; + */ +export declare function XYZ_D50_to_a98_RGB(x: Color): Color; + +/** + * @param {Color} color [x, y, z] + * - X as number 0..1; + * - Y as number 0..1; + * - Z as number 0..1; + * @return {Color} HSL [r, g, b] + * - Hue as degrees 0..360; + * - Saturation as number 0..100; + * - Lightness as number 0..100; + */ +export declare function XYZ_D50_to_HSL(x: Color): Color; + +/** + * @param {Color} color [x, y, z] + * - X as number 0..1; + * - Y as number 0..1; + * - Z as number 0..1; + * @return {Color} HWB [r, g, b] + * - Hue as degrees 0..360; + * - Whiteness as number 0..100; + * - Blackness as number 0..100; + */ +export declare function XYZ_D50_to_HWB(x: Color): Color; + +/** + * @param {Color} color [x, y, z] + * - X as number 0..1; + * - Y as number 0..1; + * - Z as number 0..1; + * @return {Color} Lab [r, g, b] + * - Lightness as number 0..100; + * - a as number -160..160; + * - b as number -160..160; + */ +export declare function XYZ_D50_to_Lab(x: Color): Color; + +/** + * @param {Color} color [x, y, z] + * - X as number 0..1; + * - Y as number 0..1; + * - Z as number 0..1; + * @return {Color} LCH [r, g, b] + * - Lightness as number 0..100; + * - Chroma as number 0..230; + * - Hue as degrees 0..360; + */ +export declare function XYZ_D50_to_LCH(x: Color): Color; + +/** + * @param {Color} color [x, y, z] + * - X as number 0..1; + * - Y as number 0..1; + * - Z as number 0..1; + * @return {Color} P3 [r, g, b] + * - R as number 0..1; + * - G as number 0..1; + * - B as number 0..1; + */ +export declare function XYZ_D50_to_lin_P3(x: Color): Color; + +/** + * @param {Color} color [x, y, z] + * - X as number 0..1; + * - Y as number 0..1; + * - Z as number 0..1; + * @return {Color} linear sRGB [r, g, b] + * - Red as number 0..1; + * - Green as number 0..1; + * - Blue as number 0..1; + */ +export declare function XYZ_D50_to_lin_sRGB(x: Color): Color; + +/** + * @param {Color} color [x, y, z] + * - X as number 0..1; + * - Y as number 0..1; + * - Z as number 0..1; + * @return {Color} OKLab [r, g, b] + * - Lightness as number 0..1; + * - a as number 0..0.5; + * - b as number 0..0.5; + */ +export declare function XYZ_D50_to_OKLab(x: Color): Color; + +/** + * @param {Color} color [x, y, z] + * - X as number 0..1; + * - Y as number 0..1; + * - Z as number 0..1; + * @return {Color} OKLCH [r, g, b] + * - Lightness as number 0..1; + * - Chroma as number 0..0.5; + * - Hue as degrees 0..360; + */ +export declare function XYZ_D50_to_OKLCH(x: Color): Color; + +/** + * @param {Color} color [x, y, z] + * - X as number 0..1; + * - Y as number 0..1; + * - Z as number 0..1; + * @return {Color} P3 [r, g, b] + * - R as number 0..1; + * - G as number 0..1; + * - B as number 0..1; + */ +export declare function XYZ_D50_to_P3(x: Color): Color; + +/** + * @param {Color} color [x, y, z] + * - X as number 0..1; + * - Y as number 0..1; + * - Z as number 0..1; + * @return {Color} ProPhoto [r, g, b] + * - Red as number 0..1; + * - Green as number 0..1; + * - Blue as number 0..1; + */ +export declare function XYZ_D50_to_ProPhoto(x: Color): Color; + +/** + * @param {Color} color [x, y, z] + * - X as number 0..1; + * - Y as number 0..1; + * - Z as number 0..1; + * @return {Color} rec 2020 [r, g, b] + * - Red as number 0..1; + * - Green as number 0..1; + * - Blue as number 0..1; + */ +export declare function XYZ_D50_to_rec_2020(x: Color): Color; + +/** + * @param {Color} color [x, y, z] + * - X as number 0..1; + * - Y as number 0..1; + * - Z as number 0..1; + * @return {Color} sRGB [r, g, b] + * - Red as number 0..1; + * - Green as number 0..1; + * - Blue as number 0..1; + */ +export declare function XYZ_D50_to_sRGB(x: Color): Color; + +/** + * @param {Color} color [x, y, z] + * - X as number 0..1; + * - Y as number 0..1; + * - Z as number 0..1; + * @return {Color} D50 XYZ [x, y, z] + */ +export declare function XYZ_D50_to_XYZ_D50(x: Color): Color; + +/** + * @param {Color} color [x, y, z] + * - X as number 0..1; + * - Y as number 0..1; + * - Z as number 0..1; + * @return {Color} D65 XYZ [x, y, z] + */ +export declare function XYZ_D50_to_XYZ_D65(x: Color): Color; + +/** + * @param {Color} color [x, y, z] + * - X as number 0..1; + * - Y as number 0..1; + * - Z as number 0..1; + * @return {Color} a98 sRGB [r, g, b] + * - Red as number 0..1; + * - Green as number 0..1; + * - Blue as number 0..1; + */ +export declare function XYZ_D65_to_a98_RGB(x: Color): Color; + +/** + * @param {Color} color [x, y, z] + * - X as number 0..1; + * - Y as number 0..1; + * - Z as number 0..1; + * @return {Color} HSL [r, g, b] + * - Hue as degrees 0..360; + * - Saturation as number 0..100; + * - Lightness as number 0..100; + */ +export declare function XYZ_D65_to_HSL(x: Color): Color; + +/** + * @param {Color} color [x, y, z] + * - X as number 0..1; + * - Y as number 0..1; + * - Z as number 0..1; + * @return {Color} HWB [r, g, b] + * - Hue as degrees 0..360; + * - Whiteness as number 0..100; + * - Blackness as number 0..100; + */ +export declare function XYZ_D65_to_HWB(x: Color): Color; + +/** + * @param {Color} color [x, y, z] + * - X as number 0..1; + * - Y as number 0..1; + * - Z as number 0..1; + * @return {Color} Lab [r, g, b] + * - Lightness as number 0..100; + * - a as number -160..160; + * - b as number -160..160; + */ +export declare function XYZ_D65_to_Lab(x: Color): Color; + +/** + * @param {Color} color [x, y, z] + * - X as number 0..1; + * - Y as number 0..1; + * - Z as number 0..1; + * @return {Color} LCH [r, g, b] + * - Lightness as number 0..100; + * - Chroma as number 0..230; + * - Hue as degrees 0..360; + */ +export declare function XYZ_D65_to_LCH(x: Color): Color; + +/** + * @param {Color} color [x, y, z] + * - X as number 0..1; + * - Y as number 0..1; + * - Z as number 0..1; + * @return {Color} P3 [r, g, b] + * - R as number 0..1; + * - G as number 0..1; + * - B as number 0..1; + */ +export declare function XYZ_D65_to_lin_P3(x: Color): Color; + +/** + * @param {Color} color [x, y, z] + * - X as number 0..1; + * - Y as number 0..1; + * - Z as number 0..1; + * @return {Color} linear sRGB [r, g, b] + * - Red as number 0..1; + * - Green as number 0..1; + * - Blue as number 0..1; + */ +export declare function XYZ_D65_to_lin_sRGB(x: Color): Color; + +/** + * @param {Color} color [x, y, z] + * - X as number 0..1; + * - Y as number 0..1; + * - Z as number 0..1; + * @return {Color} OKLab [r, g, b] + * - Lightness as number 0..1; + * - a as number 0..0.5; + * - b as number 0..0.5; + */ +export declare function XYZ_D65_to_OKLab(x: Color): Color; + +/** + * @param {Color} color [x, y, z] + * - X as number 0..1; + * - Y as number 0..1; + * - Z as number 0..1; + * @return {Color} OKLCH [r, g, b] + * - Lightness as number 0..1; + * - Chroma as number 0..0.5; + * - Hue as degrees 0..360; + */ +export declare function XYZ_D65_to_OKLCH(x: Color): Color; + +/** + * @param {Color} color [x, y, z] + * - X as number 0..1; + * - Y as number 0..1; + * - Z as number 0..1; + * @return {Color} P3 [r, g, b] + * - R as number 0..1; + * - G as number 0..1; + * - B as number 0..1; + */ +export declare function XYZ_D65_to_P3(x: Color): Color; + +/** + * @param {Color} color [x, y, z] + * - X as number 0..1; + * - Y as number 0..1; + * - Z as number 0..1; + * @return {Color} ProPhoto [r, g, b] + * - Red as number 0..1; + * - Green as number 0..1; + * - Blue as number 0..1; + */ +export declare function XYZ_D65_to_ProPhoto(x: Color): Color; + +/** + * @param {Color} color [x, y, z] + * - X as number 0..1; + * - Y as number 0..1; + * - Z as number 0..1; + * @return {Color} rec 2020 [r, g, b] + * - Red as number 0..1; + * - Green as number 0..1; + * - Blue as number 0..1; + */ +export declare function XYZ_D65_to_rec_2020(x: Color): Color; + +/** + * @param {Color} color [x, y, z] + * - X as number 0..1; + * - Y as number 0..1; + * - Z as number 0..1; + * @return {Color} sRGB [r, g, b] + * - Red as number 0..1; + * - Green as number 0..1; + * - Blue as number 0..1; + */ +export declare function XYZ_D65_to_sRGB(x: Color): Color; + +/** + * @param {Color} color [x, y, z] + * - X as number 0..1; + * - Y as number 0..1; + * - Z as number 0..1; + * @return {Color} D50 XYZ [x, y, z] + */ +export declare function XYZ_D65_to_XYZ_D50(x: Color): Color; + +/** + * @param {Color} color [x, y, z] + * - X as number 0..1; + * - Y as number 0..1; + * - Z as number 0..1; + * @return {Color} D50 XYZ [x, y, z] + */ +export declare function XYZ_D65_to_XYZ_D65(x: Color): Color; + +/** + * Convert XYZ to linear-light P3 + * + * @license W3C https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document + * @copyright This software or document includes material copied from or derived from https://github.com/w3c/csswg-drafts/blob/main/css-color-4/conversions.js. Copyright © 2022 W3C® (MIT, ERCIM, Keio, Beihang). + */ +export declare function XYZ_to_lin_P3(XYZ: Color): Color; + +/** + * @license W3C https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document + * @copyright This software or document includes material copied from or derived from https://github.com/w3c/csswg-drafts/blob/main/css-color-4/conversions.js. Copyright © 2022 W3C® (MIT, ERCIM, Keio, Beihang). + */ +export declare function XYZ_to_lin_sRGB(XYZ: Color): Color; + +/** + * @license W3C https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document + * @copyright This software or document includes material copied from or derived from https://github.com/w3c/csswg-drafts/blob/main/css-color-4/conversions.js. Copyright © 2022 W3C® (MIT, ERCIM, Keio, Beihang). + * + * XYZ <-> LMS matrices recalculated for consistent reference white + * @see https://github.com/w3c/csswg-drafts/issues/6642#issuecomment-943521484 + */ +export declare function XYZ_to_OKLab(XYZ: Color): Color; + +export { } diff --git a/node_modules/@csstools/color-helpers/dist/index.mjs b/node_modules/@csstools/color-helpers/dist/index.mjs new file mode 100644 index 0000000..e57618c --- /dev/null +++ b/node_modules/@csstools/color-helpers/dist/index.mjs @@ -0,0 +1,261 @@ +function multiplyMatrices(_,t){return[_[0]*t[0]+_[1]*t[1]+_[2]*t[2],_[3]*t[0]+_[4]*t[1]+_[5]*t[2],_[6]*t[0]+_[7]*t[1]+_[8]*t[2]]}const _=[.955473421488075,-.02309845494876471,.06325924320057072,-.0283697093338637,1.0099953980813041,.021041441191917323,.012314014864481998,-.020507649298898964,1.330365926242124]; +/** + * Bradford chromatic adaptation from D50 to D65 + * + * @license W3C https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document + * @copyright This software or document includes material copied from or derived from https://github.com/w3c/csswg-drafts/blob/main/css-color-4/conversions.js. Copyright © 2022 W3C® (MIT, ERCIM, Keio, Beihang). + */function D50_to_D65(t){return multiplyMatrices(_,t)}const t=[1.0479297925449969,.022946870601609652,-.05019226628920524,.02962780877005599,.9904344267538799,-.017073799063418826,-.009243040646204504,.015055191490298152,.7518742814281371]; +/** + * Bradford chromatic adaptation from D65 to D50 + * @license W3C https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document + * @copyright This software or document includes material copied from or derived from https://github.com/w3c/csswg-drafts/blob/main/css-color-4/conversions.js. Copyright © 2022 W3C® (MIT, ERCIM, Keio, Beihang). + * @see http://www.brucelindbloom.com/index.html?Eqn_ChromAdapt.html + */function D65_to_D50(_){return multiplyMatrices(t,_)} +/** + * @param {number} hue - Hue as degrees 0..360 + * @param {number} sat - Saturation as percentage 0..100 + * @param {number} light - Lightness as percentage 0..100 + * @return {number[]} Array of sRGB components; in-gamut colors in range [0..1] + * + * @license W3C https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document + * @copyright This software or document includes material copied from or derived from https://github.com/w3c/csswg-drafts/blob/main/css-color-4/hslToRgb.js. Copyright © 2022 W3C® (MIT, ERCIM, Keio, Beihang). + * @see https://github.com/w3c/csswg-drafts/blob/main/css-color-4/hslToRgb.js + */function HSL_to_sRGB(_){let t=_[0]%360;const n=_[1]/100,o=_[2]/100;return t<0&&(t+=360),[HSL_to_sRGB_channel(0,t,n,o),HSL_to_sRGB_channel(8,t,n,o),HSL_to_sRGB_channel(4,t,n,o)]}function HSL_to_sRGB_channel(_,t,n,o){const e=(_+t/30)%12;return o-n*Math.min(o,1-o)*Math.max(-1,Math.min(e-3,9-e,1))} +/** + * @param {number} hue - Hue as degrees 0..360 + * @param {number} white - Whiteness as percentage 0..100 + * @param {number} black - Blackness as percentage 0..100 + * @return {number[]} Array of RGB components 0..1 + * + * @license W3C https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document + * @copyright This software or document includes material copied from or derived from https://github.com/w3c/csswg-drafts/blob/main/css-color-4/hwbToRgb.js. Copyright © 2022 W3C® (MIT, ERCIM, Keio, Beihang). + * @see https://github.com/w3c/csswg-drafts/blob/main/css-color-4/hwbToRgb.js + */function HWB_to_sRGB(_){const t=_[0],n=_[1]/100,o=_[2]/100;if(n+o>=1){const _=n/(n+o);return[_,_,_]}const e=HSL_to_sRGB([t,100,50]),r=1-n-o;return[e[0]*r+n,e[1]*r+n,e[2]*r+n]} +/** + * @license W3C https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document + * @copyright This software or document includes material copied from or derived from https://github.com/w3c/csswg-drafts/blob/main/css-color-4/conversions.js. Copyright © 2022 W3C® (MIT, ERCIM, Keio, Beihang). + */function LCH_to_Lab(_){const t=_[2]*Math.PI/180;return[_[0],_[1]*Math.cos(t),_[1]*Math.sin(t)]} +/** + * @license W3C https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document + * @copyright This software or document includes material copied from or derived from https://github.com/w3c/csswg-drafts/blob/main/css-color-4/conversions.js. Copyright © 2022 W3C® (MIT, ERCIM, Keio, Beihang). + */function Lab_to_LCH(_){const t=Math.sqrt(Math.pow(_[1],2)+Math.pow(_[2],2));let n=180*Math.atan2(_[2],_[1])/Math.PI;return n<0&&(n+=360),t<=.0015&&(n=NaN),[_[0],t,n]}const n=[.3457/.3585,1,.2958/.3585]; +/** + * Convert Lab to D50-adapted XYZ + * @license W3C https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document + * @copyright This software or document includes material copied from or derived from https://github.com/w3c/csswg-drafts/blob/main/css-color-4/conversions.js. Copyright © 2022 W3C® (MIT, ERCIM, Keio, Beihang). + * @see http://www.brucelindbloom.com/index.html?Eqn_RGB_XYZ_Matrix.html + */function Lab_to_XYZ(_){const t=24389/27,o=216/24389,e=(_[0]+16)/116,r=_[1]/500+e,a=e-_[2]/200;return[(Math.pow(r,3)>o?Math.pow(r,3):(116*r-16)/t)*n[0],(_[0]>8?Math.pow((_[0]+16)/116,3):_[0]/t)*n[1],(Math.pow(a,3)>o?Math.pow(a,3):(116*a-16)/t)*n[2]]} +/** + * @license W3C https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document + * @copyright This software or document includes material copied from or derived from https://github.com/w3c/csswg-drafts/blob/main/css-color-4/conversions.js. Copyright © 2022 W3C® (MIT, ERCIM, Keio, Beihang). + * @see https://github.com/w3c/csswg-drafts/blob/main/css-color-4/conversions.js + */function OKLCH_to_OKLab(_){const t=_[2]*Math.PI/180;return[_[0],_[1]*Math.cos(t),_[1]*Math.sin(t)]} +/** + * @license W3C https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document + * @copyright This software or document includes material copied from or derived from https://github.com/w3c/csswg-drafts/blob/main/css-color-4/conversions.js. Copyright © 2022 W3C® (MIT, ERCIM, Keio, Beihang). + * @see https://github.com/w3c/csswg-drafts/blob/main/css-color-4/conversions.js + */function OKLab_to_OKLCH(_){const t=Math.sqrt(_[1]**2+_[2]**2);let n=180*Math.atan2(_[2],_[1])/Math.PI;return n<0&&(n+=360),t<=4e-6&&(n=NaN),[_[0],t,n]}const o=[1.2268798758459243,-.5578149944602171,.2813910456659647,-.0405757452148008,1.112286803280317,-.0717110580655164,-.0763729366746601,-.4214933324022432,1.5869240198367816],e=[1,.3963377773761749,.2158037573099136,1,-.1055613458156586,-.0638541728258133,1,-.0894841775298119,-1.2914855480194092]; +/** + * Given OKLab, convert to XYZ relative to D65 + * + * @license W3C https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document + * @copyright This software or document includes material copied from or derived from https://github.com/w3c/csswg-drafts/blob/main/css-color-4/conversions.js. Copyright © 2022 W3C® (MIT, ERCIM, Keio, Beihang). + * @see https://github.com/w3c/csswg-drafts/blob/main/css-color-4/conversions.js + */ +function OKLab_to_XYZ(_){const t=multiplyMatrices(e,_);return multiplyMatrices(o,[t[0]**3,t[1]**3,t[2]**3])} +/** + * Assuming XYZ is relative to D50, convert to CIE Lab + * from CIE standard, which now defines these as a rational fraction + * + * @license W3C https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document + * @copyright This software or document includes material copied from or derived from https://github.com/w3c/csswg-drafts/blob/main/css-color-4/conversions.js. Copyright © 2022 W3C® (MIT, ERCIM, Keio, Beihang). + */function XYZ_to_Lab(_){const t=compute_f(_[0]/n[0]),o=compute_f(_[1]/n[1]);return[116*o-16,500*(t-o),200*(o-compute_f(_[2]/n[2]))]}const r=216/24389,a=24389/27;function compute_f(_){return _>r?Math.cbrt(_):(a*_+16)/116}const i=[.819022437996703,.3619062600528904,-.1288737815209879,.0329836539323885,.9292868615863434,.0361446663506424,.0481771893596242,.2642395317527308,.6335478284694309],l=[.210454268309314,.7936177747023054,-.0040720430116193,1.9779985324311684,-2.42859224204858,.450593709617411,.0259040424655478,.7827717124575296,-.8086757549230774]; +/** + * @license W3C https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document + * @copyright This software or document includes material copied from or derived from https://github.com/w3c/csswg-drafts/blob/main/css-color-4/conversions.js. Copyright © 2022 W3C® (MIT, ERCIM, Keio, Beihang). + * + * XYZ <-> LMS matrices recalculated for consistent reference white + * @see https://github.com/w3c/csswg-drafts/issues/6642#issuecomment-943521484 + */ +function XYZ_to_OKLab(_){const t=multiplyMatrices(i,_);return multiplyMatrices(l,[Math.cbrt(t[0]),Math.cbrt(t[1]),Math.cbrt(t[2])])}const u=[30757411/17917100,-6372589/17917100,-4539589/17917100,-.666684351832489,1.616481236634939,467509/29648200,792561/44930125,-1921689/44930125,.942103121235474]; +/** + * Convert XYZ to linear-light rec2020 + * + * @license W3C https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document + * @copyright This software or document includes material copied from or derived from https://github.com/w3c/csswg-drafts/blob/main/css-color-4/conversions.js. Copyright © 2022 W3C® (MIT, ERCIM, Keio, Beihang). + */function XYZ_to_lin_2020(_){return multiplyMatrices(u,_)}const c=[446124/178915,-333277/357830,-72051/178915,-14852/17905,63121/35810,423/17905,11844/330415,-50337/660830,316169/330415]; +/** + * Convert XYZ to linear-light P3 + * + * @license W3C https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document + * @copyright This software or document includes material copied from or derived from https://github.com/w3c/csswg-drafts/blob/main/css-color-4/conversions.js. Copyright © 2022 W3C® (MIT, ERCIM, Keio, Beihang). + */function XYZ_to_lin_P3(_){return multiplyMatrices(c,_)}const s=[1.3457868816471583,-.25557208737979464,-.05110186497554526,-.5446307051249019,1.5082477428451468,.02052744743642139,0,0,1.2119675456389452]; +/** + * Convert D50 XYZ to linear-light prophoto-rgb + * + * @license W3C https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document + * @copyright This software or document includes material copied from or derived from https://github.com/w3c/csswg-drafts/blob/main/css-color-4/conversions.js. Copyright © 2022 W3C® (MIT, ERCIM, Keio, Beihang). + * @see http://www.brucelindbloom.com/index.html?Eqn_RGB_XYZ_Matrix.html + */function XYZ_to_lin_ProPhoto(_){return multiplyMatrices(s,_)}const X=[1829569/896150,-506331/896150,-308931/896150,-851781/878810,1648619/878810,36519/878810,16779/1248040,-147721/1248040,1266979/1248040]; +/** + * Convert XYZ to linear-light a98-rgb + * + * @license W3C https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document + * @copyright This software or document includes material copied from or derived from https://github.com/w3c/csswg-drafts/blob/main/css-color-4/conversions.js. Copyright © 2022 W3C® (MIT, ERCIM, Keio, Beihang). + */function XYZ_to_lin_a98rgb(_){return multiplyMatrices(X,_)}const Y=[12831/3959,-329/214,-1974/3959,-851781/878810,1648619/878810,36519/878810,705/12673,-2585/12673,705/667]; +/** + * @license W3C https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document + * @copyright This software or document includes material copied from or derived from https://github.com/w3c/csswg-drafts/blob/main/css-color-4/conversions.js. Copyright © 2022 W3C® (MIT, ERCIM, Keio, Beihang). + */function XYZ_to_lin_sRGB(_){return multiplyMatrices(Y,_)} +/** + * Convert an array of linear-light rec2020 RGB in the range 0.0-1.0 + * to gamma corrected form ITU-R BT.2020-2 p.4 + * + * @license W3C https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document + * @copyright This software or document includes material copied from or derived from https://github.com/w3c/csswg-drafts/blob/main/css-color-4/conversions.js. Copyright © 2022 W3C® (MIT, ERCIM, Keio, Beihang). + */function gam_2020(_){return[gam_2020_channel(_[0]),gam_2020_channel(_[1]),gam_2020_channel(_[2])]}function gam_2020_channel(_){const t=_<0?-1:1,n=Math.abs(_);return t*Math.pow(n,1/2.4)} +/** + * Convert an array of linear-light sRGB values in the range 0.0-1.0 to gamma corrected form + * Extended transfer function: + * For negative values, linear portion extends on reflection + * of axis, then uses reflected pow below that + * + * @license W3C https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document + * @copyright This software or document includes material copied from or derived from https://github.com/w3c/csswg-drafts/blob/main/css-color-4/conversions.js. Copyright © 2022 W3C® (MIT, ERCIM, Keio, Beihang). + * @see https://en.wikipedia.org/wiki/SRGB + */function gam_sRGB(_){return[gam_sRGB_channel(_[0]),gam_sRGB_channel(_[1]),gam_sRGB_channel(_[2])]}function gam_sRGB_channel(_){const t=_<0?-1:1,n=Math.abs(_);return n>.0031308?t*(1.055*Math.pow(n,1/2.4)-.055):12.92*_} +/** + * Convert an array of linear-light display-p3 RGB in the range 0.0-1.0 + * to gamma corrected form + * + * @license W3C https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document + * @copyright This software or document includes material copied from or derived from https://github.com/w3c/csswg-drafts/blob/main/css-color-4/conversions.js. Copyright © 2022 W3C® (MIT, ERCIM, Keio, Beihang). + */function gam_P3(_){return gam_sRGB(_)} +/** + * Convert an array of linear-light prophoto-rgb in the range 0.0-1.0 + * to gamma corrected form. + * Transfer curve is gamma 1.8 with a small linear portion. + * + * @license W3C https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document + * @copyright This software or document includes material copied from or derived from https://github.com/w3c/csswg-drafts/blob/main/css-color-4/conversions.js. Copyright © 2022 W3C® (MIT, ERCIM, Keio, Beihang). + */function gam_ProPhoto(_){return[gam_ProPhoto_channel(_[0]),gam_ProPhoto_channel(_[1]),gam_ProPhoto_channel(_[2])]}const Z=1/512;function gam_ProPhoto_channel(_){const t=_<0?-1:1,n=Math.abs(_);return n>=Z?t*Math.pow(n,1/1.8):16*_} +/** + * Convert an array of linear-light a98-rgb in the range 0.0-1.0 + * to gamma corrected form. Negative values are also now accepted + * + * @license W3C https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document + * @copyright This software or document includes material copied from or derived from https://github.com/w3c/csswg-drafts/blob/main/css-color-4/conversions.js. Copyright © 2022 W3C® (MIT, ERCIM, Keio, Beihang). + */function gam_a98rgb(_){return[gam_a98rgb_channel(_[0]),gam_a98rgb_channel(_[1]),gam_a98rgb_channel(_[2])]}function gam_a98rgb_channel(_){const t=_<0?-1:1,n=Math.abs(_);return t*Math.pow(n,256/563)} +/** + * Convert an array of rec2020 RGB values in the range 0.0 - 1.0 + * to linear light (un-companded) form. + * ITU-R BT.2020-2 p.4 + * + * @license W3C https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document + * @copyright This software or document includes material copied from or derived from https://github.com/w3c/csswg-drafts/blob/main/css-color-4/conversions.js. Copyright © 2022 W3C® (MIT, ERCIM, Keio, Beihang). + */function lin_2020(_){return[lin_2020_channel(_[0]),lin_2020_channel(_[1]),lin_2020_channel(_[2])]}function lin_2020_channel(_){const t=_<0?-1:1,n=Math.abs(_);return t*Math.pow(n,2.4)}const D=[63426534/99577255,20160776/139408157,47086771/278816314,26158966/99577255,.677998071518871,8267143/139408157,0,19567812/697040785,1.0609850577107909]; +/** + * Convert an array of linear-light rec2020 values to CIE XYZ + * using D65 (no chromatic adaptation) + * + * @license W3C https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document + * @copyright This software or document includes material copied from or derived from https://github.com/w3c/csswg-drafts/blob/main/css-color-4/conversions.js. Copyright © 2022 W3C® (MIT, ERCIM, Keio, Beihang). + * @see http://www.brucelindbloom.com/index.html?Eqn_RGB_XYZ_Matrix.html + */function lin_2020_to_XYZ(_){return multiplyMatrices(D,_)} +/** + * Convert an array of of sRGB values where in-gamut values are in the range + * [0 - 1] to linear light (un-companded) form. + * Extended transfer function: + * For negative values, linear portion is extended on reflection of axis, + * then reflected power function is used. + * + * @license W3C https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document + * @copyright This software or document includes material copied from or derived from https://github.com/w3c/csswg-drafts/blob/main/css-color-4/conversions.js. Copyright © 2022 W3C® (MIT, ERCIM, Keio, Beihang). + * @see https://en.wikipedia.org/wiki/SRGB + */function lin_sRGB(_){return[lin_sRGB_channel(_[0]),lin_sRGB_channel(_[1]),lin_sRGB_channel(_[2])]}function lin_sRGB_channel(_){const t=_<0?-1:1,n=Math.abs(_);return n<=.04045?_/12.92:t*Math.pow((n+.055)/1.055,2.4)} +/** + * Convert an array of display-p3 RGB values in the range 0.0 - 1.0 + * to linear light (un-companded) form. + * + * @license W3C https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document + * @copyright This software or document includes material copied from or derived from https://github.com/w3c/csswg-drafts/blob/main/css-color-4/conversions.js. Copyright © 2022 W3C® (MIT, ERCIM, Keio, Beihang). + */function lin_P3(_){return lin_sRGB(_)}const h=[608311/1250200,189793/714400,198249/1000160,35783/156275,247089/357200,198249/2500400,0,32229/714400,5220557/5000800]; +/** + * Convert an array of linear-light display-p3 values to CIE XYZ + * using D65 (no chromatic adaptation) + * + * @license W3C https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document + * @copyright This software or document includes material copied from or derived from https://github.com/w3c/csswg-drafts/blob/main/css-color-4/conversions.js. Copyright © 2022 W3C® (MIT, ERCIM, Keio, Beihang). + * @see http://www.brucelindbloom.com/index.html?Eqn_RGB_XYZ_Matrix.html + */function lin_P3_to_XYZ(_){return multiplyMatrices(h,_)} +/** + * Convert an array of prophoto-rgb values where in-gamut Colors are in the + * range [0.0 - 1.0] to linear light (un-companded) form. Transfer curve is + * gamma 1.8 with a small linear portion. Extended transfer function + * + * @license W3C https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document + * @copyright This software or document includes material copied from or derived from https://github.com/w3c/csswg-drafts/blob/main/css-color-4/conversions.js. Copyright © 2022 W3C® (MIT, ERCIM, Keio, Beihang). + */function lin_ProPhoto(_){return[lin_ProPhoto_channel(_[0]),lin_ProPhoto_channel(_[1]),lin_ProPhoto_channel(_[2])]}const f=16/512;function lin_ProPhoto_channel(_){const t=_<0?-1:1,n=Math.abs(_);return n<=f?_/16:t*Math.pow(n,1.8)}const m=[.7977666449006423,.13518129740053308,.0313477341283922,.2880748288194013,.711835234241873,8993693872564e-17,0,0,.8251046025104602]; +/** + * Convert an array of linear-light prophoto-rgb values to CIE D50 XYZ. + * Matrix cannot be expressed in rational form, but is calculated to 64 bit accuracy. + * + * @license W3C https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document + * @copyright This software or document includes material copied from or derived from https://github.com/w3c/csswg-drafts/blob/main/css-color-4/conversions.js. Copyright © 2022 W3C® (MIT, ERCIM, Keio, Beihang). + * @see see https://github.com/w3c/csswg-drafts/issues/7675 + */function lin_ProPhoto_to_XYZ(_){return multiplyMatrices(m,_)} +/** + * Convert an array of a98-rgb values in the range 0.0 - 1.0 + * to linear light (un-companded) form. Negative values are also now accepted + * + * @license W3C https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document + * @copyright This software or document includes material copied from or derived from https://github.com/w3c/csswg-drafts/blob/main/css-color-4/conversions.js. Copyright © 2022 W3C® (MIT, ERCIM, Keio, Beihang). + */function lin_a98rgb(_){return[lin_a98rgb_channel(_[0]),lin_a98rgb_channel(_[1]),lin_a98rgb_channel(_[2])]}function lin_a98rgb_channel(_){const t=_<0?-1:1,n=Math.abs(_);return t*Math.pow(n,563/256)}const b=[573536/994567,263643/1420810,187206/994567,591459/1989134,6239551/9945670,374412/4972835,53769/1989134,351524/4972835,4929758/4972835]; +/** + * Convert an array of linear-light a98-rgb values to CIE XYZ + * http://www.brucelindbloom.com/index.html?Eqn_RGB_XYZ_Matrix.html + * has greater numerical precision than section 4.3.5.3 of + * https://www.adobe.com/digitalimag/pdfs/AdobeRGB1998.pdf + * but the values below were calculated from first principles + * from the chromaticity coordinates of R G B W + * + * @license W3C https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document + * @copyright This software or document includes material copied from or derived from https://github.com/w3c/csswg-drafts/blob/main/css-color-4/conversions.js. Copyright © 2022 W3C® (MIT, ERCIM, Keio, Beihang). + * @see http://www.brucelindbloom.com/index.html?Eqn_RGB_XYZ_Matrix.html + * @see https://www.adobe.com/digitalimag/pdfs/AdobeRGB1998.pdf + * @see https://github.com/w3c/csswg-drafts/blob/main/css-color-4/matrixmaker.html + */function lin_a98rgb_to_XYZ(_){return multiplyMatrices(b,_)}const g=[506752/1228815,87881/245763,12673/70218,87098/409605,175762/245763,12673/175545,7918/409605,87881/737289,1001167/1053270]; +/** + * Convert an array of linear-light sRGB values to CIE XYZ + * using sRGB's own white, D65 (no chromatic adaptation) + * + * @license W3C https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document + * @copyright This software or document includes material copied from or derived from https://github.com/w3c/csswg-drafts/blob/main/css-color-4/conversions.js. Copyright © 2022 W3C® (MIT, ERCIM, Keio, Beihang). + */function lin_sRGB_to_XYZ(_){return multiplyMatrices(g,_)} +/** + * Convert an array of gamma-corrected sRGB values in the 0.0 to 1.0 range to HSL. + * + * @param {Color} RGB [r, g, b] + * - Red component 0..1 + * - Green component 0..1 + * - Blue component 0..1 + * @return {number[]} Array of HSL values: Hue as degrees 0..360, Saturation and Lightness as percentages 0..100 + * + * @license W3C https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document + * @copyright This software or document includes material copied from or derived from https://github.com/w3c/csswg-drafts/blob/main/css-color-4/utilities.js. Copyright © 2022 W3C® (MIT, ERCIM, Keio, Beihang). + * + * @see https://github.com/w3c/csswg-drafts/blob/main/css-color-4/better-rgbToHsl.js + */function sRGB_to_HSL(_){const t=_[0],n=_[1],o=_[2],e=Math.max(t,n,o),r=Math.min(t,n,o),a=(r+e)/2,i=e-r;let l=Number.NaN,u=0;if(0!==Math.round(1e5*i)){const _=Math.round(1e5*a);switch(u=0===_||1e5===_?0:(e-a)/Math.min(a,1-a),e){case t:l=(n-o)/i+(n=360&&(l-=360);return u<=1e-5&&(l=NaN),[l,100*u,100*a]}function sRGB_to_Hue(_){const t=_[0],n=_[1],o=_[2],e=Math.max(t,n,o),r=Math.min(t,n,o);let a=Number.NaN;const i=e-r;if(0!==i){switch(e){case t:a=(n-o)/i+(n=360&&(a-=360),a}function sRGB_to_XYZ_D50(_){let t=_;return t=lin_sRGB(t),t=lin_sRGB_to_XYZ(t),t=D65_to_D50(t),t}function XYZ_D50_to_sRGB(_){let t=_;return t=D50_to_D65(t),t=XYZ_to_lin_sRGB(t),t=gam_sRGB(t),t}function HSL_to_XYZ_D50(_){let t=_;return t=HSL_to_sRGB(t),t=lin_sRGB(t),t=lin_sRGB_to_XYZ(t),t=D65_to_D50(t),t}function XYZ_D50_to_HSL(_){let t=_;return t=D50_to_D65(t),t=XYZ_to_lin_sRGB(t),t=gam_sRGB(t),t=sRGB_to_HSL(t),t}function HWB_to_XYZ_D50(_){let t=_;return t=HWB_to_sRGB(t),t=lin_sRGB(t),t=lin_sRGB_to_XYZ(t),t=D65_to_D50(t),t}function XYZ_D50_to_HWB(_){let t=_;t=D50_to_D65(t),t=XYZ_to_lin_sRGB(t);const n=gam_sRGB(t),o=Math.min(n[0],n[1],n[2]),e=1-Math.max(n[0],n[1],n[2]);let r=sRGB_to_Hue(n);return o+e>=.99999&&(r=NaN),[r,100*o,100*e]}function Lab_to_XYZ_D50(_){let t=_;return t=Lab_to_XYZ(t),t}function XYZ_D50_to_Lab(_){let t=_;return t=XYZ_to_Lab(t),t}function LCH_to_XYZ_D50(_){let t=_;return t=LCH_to_Lab(t),t=Lab_to_XYZ(t),t}function XYZ_D50_to_LCH(_){let t=_;return t=XYZ_to_Lab(t),t=Lab_to_LCH(t),t}function OKLab_to_XYZ_D50(_){let t=_;return t=OKLab_to_XYZ(t),t=D65_to_D50(t),t}function XYZ_D50_to_OKLab(_){let t=_;return t=D50_to_D65(t),t=XYZ_to_OKLab(t),t}function OKLCH_to_XYZ_D50(_){let t=_;return t=OKLCH_to_OKLab(t),t=OKLab_to_XYZ(t),t=D65_to_D50(t),t}function XYZ_D50_to_OKLCH(_){let t=_;return t=D50_to_D65(t),t=XYZ_to_OKLab(t),t=OKLab_to_OKLCH(t),t}function lin_sRGB_to_XYZ_D50(_){let t=_;return t=lin_sRGB_to_XYZ(t),t=D65_to_D50(t),t}function XYZ_D50_to_lin_sRGB(_){let t=_;return t=D50_to_D65(t),t=XYZ_to_lin_sRGB(t),t}function a98_RGB_to_XYZ_D50(_){let t=_;return t=lin_a98rgb(t),t=lin_a98rgb_to_XYZ(t),t=D65_to_D50(t),t}function XYZ_D50_to_a98_RGB(_){let t=_;return t=D50_to_D65(t),t=XYZ_to_lin_a98rgb(t),t=gam_a98rgb(t),t}function P3_to_XYZ_D50(_){let t=_;return t=lin_P3(t),t=lin_P3_to_XYZ(t),t=D65_to_D50(t),t}function XYZ_D50_to_P3(_){let t=_;return t=D50_to_D65(t),t=XYZ_to_lin_P3(t),t=gam_P3(t),t}function lin_P3_to_XYZ_D50(_){let t=_;return t=lin_P3_to_XYZ(t),t=D65_to_D50(t),t}function XYZ_D50_to_lin_P3(_){let t=_;return t=D50_to_D65(t),t=XYZ_to_lin_P3(t),t}function rec_2020_to_XYZ_D50(_){let t=_;return t=lin_2020(t),t=lin_2020_to_XYZ(t),t=D65_to_D50(t),t}function XYZ_D50_to_rec_2020(_){let t=_;return t=D50_to_D65(t),t=XYZ_to_lin_2020(t),t=gam_2020(t),t}function ProPhoto_RGB_to_XYZ_D50(_){let t=_;return t=lin_ProPhoto(t),t=lin_ProPhoto_to_XYZ(t),t}function XYZ_D50_to_ProPhoto(_){let t=_;return t=XYZ_to_lin_ProPhoto(t),t=gam_ProPhoto(t),t}function XYZ_D65_to_XYZ_D50(_){let t=_;return t=D65_to_D50(t),t}function XYZ_D50_to_XYZ_D65(_){let t=_;return t=D50_to_D65(t),t}function XYZ_D50_to_XYZ_D50(_){return _}function XYZ_D65_to_XYZ_D65(_){return _}function sRGB_to_XYZ_D65(_){let t=_;return t=lin_sRGB(t),t=lin_sRGB_to_XYZ(t),t}function XYZ_D65_to_sRGB(_){let t=_;return t=XYZ_to_lin_sRGB(t),t=gam_sRGB(t),t}function HSL_to_XYZ_D65(_){let t=_;return t=HSL_to_sRGB(t),t=lin_sRGB(t),t=lin_sRGB_to_XYZ(t),t}function XYZ_D65_to_HSL(_){let t=_;return t=XYZ_to_lin_sRGB(t),t=gam_sRGB(t),t=sRGB_to_HSL(t),t}function HWB_to_XYZ_D65(_){let t=_;return t=HWB_to_sRGB(t),t=lin_sRGB(t),t=lin_sRGB_to_XYZ(t),t}function XYZ_D65_to_HWB(_){let t=_;t=XYZ_to_lin_sRGB(t);const n=gam_sRGB(t),o=Math.min(n[0],n[1],n[2]),e=1-Math.max(n[0],n[1],n[2]);let r=sRGB_to_Hue(n);return o+e>=.99999&&(r=NaN),[r,100*o,100*e]}function Lab_to_XYZ_D65(_){let t=_;return t=Lab_to_XYZ(t),t=D50_to_D65(t),t}function XYZ_D65_to_Lab(_){let t=_;return t=D65_to_D50(t),t=XYZ_to_Lab(t),t}function LCH_to_XYZ_D65(_){let t=_;return t=LCH_to_Lab(t),t=Lab_to_XYZ(t),t=D50_to_D65(t),t}function XYZ_D65_to_LCH(_){let t=_;return t=D65_to_D50(t),t=XYZ_to_Lab(t),t=Lab_to_LCH(t),t}function OKLab_to_XYZ_D65(_){let t=_;return t=OKLab_to_XYZ(t),t}function XYZ_D65_to_OKLab(_){let t=_;return t=XYZ_to_OKLab(t),t}function OKLCH_to_XYZ_D65(_){let t=_;return t=OKLCH_to_OKLab(t),t=OKLab_to_XYZ(t),t}function XYZ_D65_to_OKLCH(_){let t=_;return t=XYZ_to_OKLab(t),t=OKLab_to_OKLCH(t),t}function lin_sRGB_to_XYZ_D65(_){let t=_;return t=lin_sRGB_to_XYZ(t),t}function XYZ_D65_to_lin_sRGB(_){let t=_;return t=XYZ_to_lin_sRGB(t),t}function a98_RGB_to_XYZ_D65(_){let t=_;return t=lin_a98rgb(t),t=lin_a98rgb_to_XYZ(t),t}function XYZ_D65_to_a98_RGB(_){let t=_;return t=XYZ_to_lin_a98rgb(t),t=gam_a98rgb(t),t}function P3_to_XYZ_D65(_){let t=_;return t=lin_P3(t),t=lin_P3_to_XYZ(t),t}function XYZ_D65_to_P3(_){let t=_;return t=XYZ_to_lin_P3(t),t=gam_P3(t),t}function lin_P3_to_XYZ_D65(_){let t=_;return t=lin_P3_to_XYZ(t),t}function XYZ_D65_to_lin_P3(_){let t=_;return t=XYZ_to_lin_P3(t),t}function rec_2020_to_XYZ_D65(_){let t=_;return t=lin_2020(t),t=lin_2020_to_XYZ(t),t}function XYZ_D65_to_rec_2020(_){let t=_;return t=XYZ_to_lin_2020(t),t=gam_2020(t),t}function ProPhoto_RGB_to_XYZ_D65(_){let t=_;return t=lin_ProPhoto(t),t=lin_ProPhoto_to_XYZ(t),t=D50_to_D65(t),t}function XYZ_D65_to_ProPhoto(_){let t=_;return t=D65_to_D50(t),t=XYZ_to_lin_ProPhoto(t),t=gam_ProPhoto(t),t}function inGamut(_){return _[0]>=-1e-4&&_[0]<=1.0001&&_[1]>=-1e-4&&_[1]<=1.0001&&_[2]>=-1e-4&&_[2]<=1.0001}function clip(_){return[_[0]<0?0:_[0]>1?1:_[0],_[1]<0?0:_[1]>1?1:_[1],_[2]<0?0:_[2]>1?1:_[2]]} +/** + * @description Calculate deltaE OK which is the simple root sum of squares + * @param {number[]} reference - Array of OKLab values: L as 0..1, a and b as -1..1 + * @param {number[]} sample - Array of OKLab values: L as 0..1, a and b as -1..1 + * @return {number} How different a color sample is from reference + * + * @license W3C https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document + * @copyright This software or document includes material copied from or derived from https://github.com/w3c/csswg-drafts/blob/main/css-color-4/deltaEOK.js. Copyright © 2022 W3C® (MIT, ERCIM, Keio, Beihang). + * @see https://github.com/w3c/csswg-drafts/blob/main/css-color-4/deltaEOK.js + */function deltaEOK(_,t){const[n,o,e]=_,[r,a,i]=t,l=n-r,u=o-a,c=e-i;return Math.sqrt(l**2+u**2+c**2)}const L=.02,B=1e-4;function mapGamut(_,t,n){const o=_;let e=clip(t(o)),r=deltaEOK(OKLCH_to_OKLab(n(e)),OKLCH_to_OKLab(o));if(r0&&!Number.isFinite(i)&&(i=2147483647);i-a>B;){const _=(a+i)/2;if(o[1]=_,l&&inGamut(t(o)))a=_;else if(e=clip(t(o)),r=deltaEOK(OKLCH_to_OKLab(n(e)),OKLCH_to_OKLab(o)),r0){const _=n(r);_[0]=o,_[2]=e,r=t(_)}const i=rayTraceBox(a,r);if(!i)break;r=i}return clip(r)}function rayTraceBox(_,t){let n=1/0,o=-1/0;const e=[0,0,0];for(let r=0;r<3;r++){const a=_[r],i=t[r]-a;e[r]=i;const l=0,u=1;if(Math.abs(i)>1e-12){const _=1/i,t=(l-a)*_,e=(u-a)*_;o=Math.max(Math.min(t,e),o),n=Math.min(Math.max(t,e),n)}else if(au)return!1}return!(o>n||n<0)&&(o<0&&(o=n),!!isFinite(o)&&[_[0]+e[0]*o,_[1]+e[1]*o,_[2]+e[2]*o])}const G={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]};function luminance(_){const[t,n,o]=_.map(_=>_<=.04045?_/12.92:Math.pow((_+.055)/1.055,2.4));return.2126*t+.7152*n+.0722*o}function contrast_ratio_wcag_2_1(_,t){const n=luminance(_),o=luminance(t);return(Math.max(n,o)+.05)/(Math.min(n,o)+.05)}export{HSL_to_XYZ_D50,HSL_to_XYZ_D65,HWB_to_XYZ_D50,HWB_to_XYZ_D65,LCH_to_XYZ_D50,LCH_to_XYZ_D65,Lab_to_XYZ_D50,Lab_to_XYZ_D65,OKLCH_to_OKLab,OKLCH_to_XYZ_D50,OKLCH_to_XYZ_D65,OKLab_to_OKLCH,OKLab_to_XYZ,OKLab_to_XYZ_D50,OKLab_to_XYZ_D65,P3_to_XYZ_D50,P3_to_XYZ_D65,ProPhoto_RGB_to_XYZ_D50,ProPhoto_RGB_to_XYZ_D65,XYZ_D50_to_HSL,XYZ_D50_to_HWB,XYZ_D50_to_LCH,XYZ_D50_to_Lab,XYZ_D50_to_OKLCH,XYZ_D50_to_OKLab,XYZ_D50_to_P3,XYZ_D50_to_ProPhoto,XYZ_D50_to_XYZ_D50,XYZ_D50_to_XYZ_D65,XYZ_D50_to_a98_RGB,XYZ_D50_to_lin_P3,XYZ_D50_to_lin_sRGB,XYZ_D50_to_rec_2020,XYZ_D50_to_sRGB,XYZ_D65_to_HSL,XYZ_D65_to_HWB,XYZ_D65_to_LCH,XYZ_D65_to_Lab,XYZ_D65_to_OKLCH,XYZ_D65_to_OKLab,XYZ_D65_to_P3,XYZ_D65_to_ProPhoto,XYZ_D65_to_XYZ_D50,XYZ_D65_to_XYZ_D65,XYZ_D65_to_a98_RGB,XYZ_D65_to_lin_P3,XYZ_D65_to_lin_sRGB,XYZ_D65_to_rec_2020,XYZ_D65_to_sRGB,XYZ_to_OKLab,XYZ_to_lin_P3,XYZ_to_lin_sRGB,a98_RGB_to_XYZ_D50,a98_RGB_to_XYZ_D65,clip,contrast_ratio_wcag_2_1,gam_P3,gam_sRGB,inGamut,lin_P3,lin_P3_to_XYZ,lin_P3_to_XYZ_D50,lin_P3_to_XYZ_D65,lin_sRGB,lin_sRGB_to_XYZ,lin_sRGB_to_XYZ_D50,lin_sRGB_to_XYZ_D65,mapGamut,mapGamutRayTrace,G as namedColors,rec_2020_to_XYZ_D50,rec_2020_to_XYZ_D65,sRGB_to_XYZ_D50,sRGB_to_XYZ_D65}; diff --git a/node_modules/@csstools/color-helpers/package.json b/node_modules/@csstools/color-helpers/package.json new file mode 100644 index 0000000..7ff5bff --- /dev/null +++ b/node_modules/@csstools/color-helpers/package.json @@ -0,0 +1,55 @@ +{ + "name": "@csstools/color-helpers", + "description": "Color helpers to ease transformation between formats, gamut, etc", + "version": "6.1.2", + "contributors": [ + { + "name": "Antonio Laguna", + "email": "antonio@laguna.es", + "url": "https://antonio.laguna.es" + }, + { + "name": "Romain Menke", + "email": "romainmenke@gmail.com" + } + ], + "license": "MIT-0", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/csstools" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/csstools" + } + ], + "engines": { + "node": ">=20.19.0" + }, + "type": "module", + "exports": { + ".": { + "types": "./dist/index.d.ts", + "default": "./dist/index.mjs" + } + }, + "files": [ + "CHANGELOG.md", + "LICENSE.md", + "README.md", + "dist" + ], + "scripts": {}, + "homepage": "https://github.com/csstools/postcss-plugins/tree/main/packages/color-helpers#readme", + "repository": { + "type": "git", + "url": "git+https://github.com/csstools/postcss-plugins.git", + "directory": "packages/color-helpers" + }, + "bugs": "https://github.com/csstools/postcss-plugins/issues", + "keywords": [ + "colors", + "css" + ] +} diff --git a/node_modules/@csstools/css-calc/CHANGELOG.md b/node_modules/@csstools/css-calc/CHANGELOG.md new file mode 100644 index 0000000..61844ec --- /dev/null +++ b/node_modules/@csstools/css-calc/CHANGELOG.md @@ -0,0 +1,9 @@ +# Changes to CSS Calc + +### 3.4.3 + +_October 2, 2026_ + +- Precompute the CRC32 lookup table instead of parsing a hex substring for every character, avoiding quadratic work when hashing `random()`. + +[Full CHANGELOG](https://github.com/csstools/postcss-plugins/tree/main/packages/css-calc/CHANGELOG.md) diff --git a/node_modules/@csstools/css-calc/LICENSE.md b/node_modules/@csstools/css-calc/LICENSE.md new file mode 100644 index 0000000..af5411f --- /dev/null +++ b/node_modules/@csstools/css-calc/LICENSE.md @@ -0,0 +1,20 @@ +The MIT License (MIT) + +Copyright 2022 Romain Menke, Antonio Laguna + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/@csstools/css-calc/README.md b/node_modules/@csstools/css-calc/README.md new file mode 100644 index 0000000..3b35398 --- /dev/null +++ b/node_modules/@csstools/css-calc/README.md @@ -0,0 +1,137 @@ +# CSS Calc for CSS + +[npm version][npm-url] +[Build Status][cli-url] +[Discord][discord] + +Implemented from : https://drafts.csswg.org/css-values-4/ on 2023-02-17 + +## Usage + +Add [CSS calc] to your project: + +```bash +npm install @csstools/css-calc @csstools/css-parser-algorithms @csstools/css-tokenizer --save-dev +``` + +### With string values : + +```mjs +import { calc } from '@csstools/css-calc'; + +// '20' +console.log(calc('calc(10 * 2)')); +``` + +### With component values : + +```mjs +import { stringify, tokenizer } from '@csstools/css-tokenizer'; +import { parseCommaSeparatedListOfComponentValues } from '@csstools/css-parser-algorithms'; +import { calcFromComponentValues } from '@csstools/css-calc'; + +const t = tokenizer({ + css: 'calc(10 * 2)', +}); + +const tokens = []; + +{ + while (!t.endOfFile()) { + tokens.push(t.nextToken()); + } + + tokens.push(t.nextToken()); // EOF-token +} + +const result = parseCommaSeparatedListOfComponentValues(tokens, {}); + +// filter or mutate the component values + +const calcResult = calcFromComponentValues(result, { precision: 5, toCanonicalUnits: true }); + +// filter or mutate the component values even further + +const calcResultStr = calcResult.map((componentValues) => { + return componentValues.map((x) => stringify(...x.tokens())).join(''); +}).join(','); + +// '20' +console.log(calcResultStr); +``` + +### Options + +#### `precision` : + +The `precision` option is a number of decimals. +The default precision is fairly high. +It aims to be high enough to make rounding unnoticeable in the browser. + +Values that serialize in scientific notation are left untouched. + +You can set it to a lower number to suit your needs. + +```mjs +import { calc } from '@csstools/css-calc'; + +// '0.3' +console.log(calc('calc(1 / 3)', { precision: 1 })); +// '0.33' +console.log(calc('calc(1 / 3)', { precision: 2 })); +// '1.0000000000000001e-20' +console.log(calc('calc(1e-10 * 1e-10)')); +``` + +#### `globals` : + +Pass global values as a map of key value pairs. + +> Example : Relative color syntax (`lch(from pink calc(l / 2) c h)`) exposes color channel information as ident tokens. +> By passing globals for `l`, `c` and `h` it is possible to solve nested `calc()`'s. + +```mjs +import { calc } from '@csstools/css-calc'; + +const globals = new Map([ + ['a', '10px'], + ['b', '2rem'], +]); + +// '20px' +console.log(calc('calc(a * 2)', { globals: globals })); +// '6rem' +console.log(calc('calc(b * 3)', { globals: globals })); +``` + +#### `toCanonicalUnits` : + +By default this package will try to preserve units. +The heuristic to do this is very simplistic. +We take the first unit we encounter and try to convert other dimensions to that unit. + +This better matches what users expect from a CSS dev tool. + +If you want to have outputs that are closes to CSS serialized values you can pass `toCanonicalUnits: true`. + +```mjs +import { calc } from '@csstools/css-calc'; + +// '20hz' +console.log(calc('calc(0.01khz + 10hz)', { toCanonicalUnits: true })); + +// '20hz' +console.log(calc('calc(10hz + 0.01khz)', { toCanonicalUnits: true })); + +// '0.02khz' !!! +console.log(calc('calc(0.01khz + 10hz)', { toCanonicalUnits: false })); + +// '20hz' +console.log(calc('calc(10hz + 0.01khz)', { toCanonicalUnits: false })); +``` + +[cli-url]: https://github.com/csstools/postcss-plugins/actions/workflows/test.yml?query=workflow/test +[discord]: https://discord.gg/bUadyRwkJS +[npm-url]: https://www.npmjs.com/package/@csstools/css-calc + +[CSS calc]: https://github.com/csstools/postcss-plugins/tree/main/packages/css-calc diff --git a/node_modules/@csstools/css-calc/dist/index.d.ts b/node_modules/@csstools/css-calc/dist/index.d.ts new file mode 100644 index 0000000..86f224e --- /dev/null +++ b/node_modules/@csstools/css-calc/dist/index.d.ts @@ -0,0 +1,113 @@ +import { ComponentValue } from '@csstools/css-parser-algorithms'; +import type { TokenDimension } from '@csstools/css-tokenizer'; +import type { TokenNumber } from '@csstools/css-tokenizer'; +import type { TokenPercentage } from '@csstools/css-tokenizer'; + +export declare function calc(css: string, options?: conversionOptions): string; + +export declare function calcFromComponentValues(componentValuesList: Array>, options?: conversionOptions): Array>; + +export declare type conversionOptions = { + /** + * If a calc expression can not be solved the parse error might be reported through this callback. + * Not all cases are covered. Open an issue if you need specific errors reported. + * + * Values are recursively visited and at each nesting level an attempt is made to solve the expression. + * Errors can be reported multiple times as a result of this. + */ + onParseError?: (error: ParseError) => void; + /** + * Pass global values as a map of key value pairs. + */ + globals?: GlobalsWithStrings; + /** + * The default precision is fairly high. + * It aims to be high enough to make rounding unnoticeable in the browser. + * You can set it to a lower number to suite your needs. + */ + precision?: number; + /** + * The CSS pixel length of one device pixel. + * Used when rounding to `line-width` and similar features + */ + devicePixelLength?: number; + /** + * By default this package will try to preserve units. + * The heuristic to do this is very simplistic. + * We take the first unit we encounter and try to convert other dimensions to that unit. + * + * This better matches what users expect from a CSS dev tool. + * + * If you want to have outputs that are closes to CSS serialized values you can set `true`. + */ + toCanonicalUnits?: boolean; + /** + * Convert NaN, Infinity, ... into standard representable values. + */ + censorIntoStandardRepresentableValues?: boolean; + /** + * Some percentages resolve against other values and might be negative or positive depending on context. + * Raw percentages are more likely to be safe to simplify outside of a browser context + * + * @see https://drafts.csswg.org/css-values-4/#calc-simplification + */ + rawPercentages?: boolean; + /** + * Out of range values or floats are invalid in some contexts. + * Wrapping values in a `calc()` or other noop math function can make these valid anyway. + * + * Instead of completely removing math functions it is preferable to keep a noop `calc()`. + */ + calcWrapper?: boolean; + /** + * The values used to generate random value cache keys. + */ + randomCaching?: { + /** + * The name of the property the random function is used in. + */ + propertyName: string; + /** + * N is the index of the random function among other random functions in the same property value. + */ + propertyN: number; + /** + * An element ID identifying the element the style is being applied to. + * When omitted any `random()` call will not be computed. + */ + elementID: string; + /** + * A document ID identifying the Document the styles are from. + * When omitted any `random()` call will not be computed. + */ + documentID: string; + }; +}; + +export declare type GlobalsWithStrings = Map; + +export declare const mathFunctionNames: Set; + +/** + * Any errors are reported through the `onParseError` callback. + */ +export declare class ParseError extends Error { + /** The index of the start character of the current token. */ + sourceStart: number; + /** The index of the end character of the current token. */ + sourceEnd: number; + constructor(message: string, sourceStart: number, sourceEnd: number); +} + +export declare const ParseErrorMessage: { + UnexpectedAdditionOfDimensionOrPercentageWithNumber: string; + UnexpectedSubtractionOfDimensionOrPercentageWithNumber: string; +}; + +export declare class ParseErrorWithComponentValues extends ParseError { + /** The associated component values. */ + componentValues: Array; + constructor(message: string, componentValues: Array); +} + +export { } diff --git a/node_modules/@csstools/css-calc/dist/index.mjs b/node_modules/@csstools/css-calc/dist/index.mjs new file mode 100644 index 0000000..c5305a9 --- /dev/null +++ b/node_modules/@csstools/css-calc/dist/index.mjs @@ -0,0 +1 @@ +import{sourceIndices as e,TokenNode as n,isTokenNode as t,isWhiteSpaceOrCommentNode as r,isFunctionNode as u,isSimpleBlockNode as a,FunctionNode as o,WhitespaceNode as i,parseCommaSeparatedListOfComponentValues as l,walk as c}from"@csstools/css-parser-algorithms";import{isTokenDimension as s,TokenType as v,NumberType as f,mutateUnit as p,isTokenNumber as m,isTokenPercentage as d,isTokenIdent as N,isTokenNumeric as C,isTokenOpenParen as g,isTokenDelim as h,isTokenComma as D,isToken as b,tokenizer as B,tokenize as A,stringify as w,isTokenColon as F,isTokenSemicolon as E}from"@csstools/css-tokenizer";class ParseError extends Error{sourceStart;sourceEnd;constructor(e,n,t){super(e),this.name="ParseError",this.sourceStart=n,this.sourceEnd=t}}class ParseErrorWithComponentValues extends ParseError{componentValues;constructor(n,t){super(n,...e(t)),this.componentValues=t}}const S={UnexpectedAdditionOfDimensionOrPercentageWithNumber:"Unexpected addition of a dimension or percentage with a number.",UnexpectedSubtractionOfDimensionOrPercentageWithNumber:"Unexpected subtraction of a dimension or percentage with a number."},y=/[A-Z]/g;function toLowerCaseAZ(e){return e.replace(y,e=>String.fromCharCode(e.charCodeAt(0)+32))}const I={cm:"px",in:"px",mm:"px",pc:"px",pt:"px",px:"px",q:"px",deg:"deg",grad:"deg",rad:"deg",turn:"deg",ms:"s",s:"s",hz:"hz",khz:"hz"},x=new Map([["cm",e=>e],["mm",e=>10*e],["q",e=>40*e],["in",e=>e/2.54],["pc",e=>e/2.54*6],["pt",e=>e/2.54*72],["px",e=>e/2.54*96]]),M=new Map([["deg",e=>e],["grad",e=>e/.9],["rad",e=>e/180*Math.PI],["turn",e=>e/360]]),T=new Map([["deg",e=>.9*e],["grad",e=>e],["rad",e=>.9*e/180*Math.PI],["turn",e=>.9*e/360]]),P=new Map([["hz",e=>e],["khz",e=>e/1e3]]),k=new Map([["cm",e=>2.54*e],["mm",e=>25.4*e],["q",e=>25.4*e*4],["in",e=>e],["pc",e=>6*e],["pt",e=>72*e],["px",e=>96*e]]),W=new Map([["hz",e=>1e3*e],["khz",e=>e]]),O=new Map([["cm",e=>e/10],["mm",e=>e],["q",e=>4*e],["in",e=>e/25.4],["pc",e=>e/25.4*6],["pt",e=>e/25.4*72],["px",e=>e/25.4*96]]),U=new Map([["ms",e=>e],["s",e=>e/1e3]]),L=new Map([["cm",e=>e/6*2.54],["mm",e=>e/6*25.4],["q",e=>e/6*25.4*4],["in",e=>e/6],["pc",e=>e],["pt",e=>e/6*72],["px",e=>e/6*96]]),$=new Map([["cm",e=>e/72*2.54],["mm",e=>e/72*25.4],["q",e=>e/72*25.4*4],["in",e=>e/72],["pc",e=>e/72*6],["pt",e=>e],["px",e=>e/72*96]]),V=new Map([["cm",e=>e/96*2.54],["mm",e=>e/96*25.4],["q",e=>e/96*25.4*4],["in",e=>e/96],["pc",e=>e/96*6],["pt",e=>e/96*72],["px",e=>e]]),Z=new Map([["cm",e=>e/4/10],["mm",e=>e/4],["q",e=>e],["in",e=>e/4/25.4],["pc",e=>e/4/25.4*6],["pt",e=>e/4/25.4*72],["px",e=>e/4/25.4*96]]),z=new Map([["deg",e=>180*e/Math.PI],["grad",e=>180*e/Math.PI/.9],["rad",e=>e],["turn",e=>180*e/Math.PI/360]]),q=new Map([["ms",e=>1e3*e],["s",e=>e]]),R=new Map([["deg",e=>360*e],["grad",e=>360*e/.9],["rad",e=>360*e/180*Math.PI],["turn",e=>e]]),G=new Map([["cm",x],["mm",O],["q",Z],["in",k],["pc",L],["pt",$],["px",V],["ms",U],["s",q],["deg",M],["grad",T],["rad",z],["turn",R],["hz",P],["khz",W]]);function convertUnit(e,n){if(!s(e))return n;if(!s(n))return n;const t=toLowerCaseAZ(e[4].unit),r=toLowerCaseAZ(n[4].unit);if(t===r)return n;const u=G.get(r);if(!u)return n;const a=u.get(t);if(!a)return n;const o=a(n[4].value),i=[v.Dimension,"",n[2],n[3],{...n[4],signCharacter:o<0?"-":void 0,type:Number.isInteger(o)?f.Integer:f.Number,value:o}];return p(i,e[4].unit),i}function toCanonicalUnit(e){if(!s(e))return e;const n=toLowerCaseAZ(e[4].unit),t=I[n];if(n===t)return e;const r=G.get(n);if(!r)return e;const u=r.get(t);if(!u)return e;const a=u(e[4].value),o=[v.Dimension,"",e[2],e[3],{...e[4],signCharacter:a<0?"-":void 0,type:Number.isInteger(a)?f.Integer:f.Number,value:a}];return p(o,t),o}function addition(e,t){if(2!==e.length)return-1;const r=e[0].value;let u=e[1].value;if(m(r)&&m(u)){const e=r[4].value+u[4].value;return new n([v.Number,e.toString(),r[2],u[3],{value:e,type:r[4].type===f.Integer&&u[4].type===f.Integer?f.Integer:f.Number}])}if(d(r)&&d(u)){const e=r[4].value+u[4].value;return new n([v.Percentage,e.toString()+"%",r[2],u[3],{value:e}])}if(s(r)&&s(u)&&(u=convertUnit(r,u),toLowerCaseAZ(r[4].unit)===toLowerCaseAZ(u[4].unit))){const e=r[4].value+u[4].value;return new n([v.Dimension,e.toString()+r[4].unit,r[2],u[3],{value:e,type:r[4].type===f.Integer&&u[4].type===f.Integer?f.Integer:f.Number,unit:r[4].unit}])}return(m(r)&&(s(u)||d(u))||m(u)&&(s(r)||d(r)))&&t.onParseError?.(new ParseErrorWithComponentValues(S.UnexpectedAdditionOfDimensionOrPercentageWithNumber,e)),-1}function division(e){if(2!==e.length)return-1;const t=e[0].value,r=e[1].value;if(m(t)&&m(r)){const e=t[4].value/r[4].value;return new n([v.Number,e.toString(),t[2],r[3],{value:e,type:Number.isInteger(e)?f.Integer:f.Number}])}if(d(t)&&m(r)){const e=t[4].value/r[4].value;return new n([v.Percentage,e.toString()+"%",t[2],r[3],{value:e}])}if(s(t)&&m(r)){const e=t[4].value/r[4].value;return new n([v.Dimension,e.toString()+t[4].unit,t[2],r[3],{value:e,type:Number.isInteger(e)?f.Integer:f.Number,unit:t[4].unit}])}return-1}function isCalculation(e){return!!e&&"object"==typeof e&&"inputs"in e&&Array.isArray(e.inputs)&&"operation"in e}function solve(e,n){if(-1===e)return-1;const r=[{calculation:e,inputs:[],index:0}];let u=-1;for(;r.length;){const e=r[r.length-1];if(e.indexconvertUnit(u,e.value));if(!arrayOfSameNumeric(a))return-1;if(a.some(e=>Number.isNaN(e[4].value)))return resultToCalculation(e,u,Number.NaN);if(!r.rawPercentages&&d(u))return-1;const o=a.map(e=>e[4].value);if(o.some(Number.isNaN))return resultToCalculation(e,u,Number.NaN);const i=Math.hypot(...o);return resultToCalculation(e,u,i)}function solveMax(e,n,r){if(!n.every(t))return-1;const u=n[0].value;if(!C(u))return-1;const a=n.map(e=>convertUnit(u,e.value));if(!arrayOfSameNumeric(a))return-1;if(a.some(e=>Number.isNaN(e[4].value)))return resultToCalculation(e,u,Number.NaN);if(!r.rawPercentages&&d(u))return-1;const o=a.map(e=>e[4].value),i=Math.max(...o);return resultToCalculation(e,u,i)}function solveMin(e,n,r){if(!n.every(t))return-1;const u=n[0].value;if(!C(u))return-1;const a=n.map(e=>convertUnit(u,e.value));if(!arrayOfSameNumeric(a))return-1;if(a.some(e=>Number.isNaN(e[4].value)))return resultToCalculation(e,u,Number.NaN);if(!r.rawPercentages&&d(u))return-1;const o=a.map(e=>e[4].value),i=Math.min(...o);return resultToCalculation(e,u,i)}function solveMod(e,n,t){const r=n.value;if(!C(r))return-1;const u=convertUnit(r,t.value);if(!twoOfSameNumeric(r,u))return-1;let a;return a=Number.isNaN(r[4].value)||Number.isNaN(u[4].value)||0===u[4].value?Number.NaN:Number.isFinite(r[4].value)&&(Number.isFinite(u[4].value)||(u[4].value!==Number.POSITIVE_INFINITY||r[4].value!==Number.NEGATIVE_INFINITY&&!Object.is(0*r[4].value,-0))&&(u[4].value!==Number.NEGATIVE_INFINITY||r[4].value!==Number.POSITIVE_INFINITY&&!Object.is(0*r[4].value,0)))?Number.isFinite(u[4].value)?(r[4].value%u[4].value+u[4].value)%u[4].value:r[4].value:Number.NaN,resultToCalculation(e,r,a)}function solvePow(e,n,t){const r=n.value,u=t.value;if(!m(r))return-1;if(!twoOfSameNumeric(r,u))return-1;if(Number.isNaN(r[4].value)||Number.isNaN(u[4].value))return numberToCalculation(e,Number.NaN);return numberToCalculation(e,Math.pow(r[4].value,u[4].value))}function solveRem(e,n,t){const r=n.value;if(!C(r))return-1;const u=convertUnit(r,t.value);if(!twoOfSameNumeric(r,u))return-1;let a;return a=Number.isNaN(r[4].value)||Number.isNaN(u[4].value)||0===u[4].value?Number.NaN:Number.isFinite(r[4].value)?Number.isFinite(u[4].value)?r[4].value%u[4].value:r[4].value:Number.NaN,resultToCalculation(e,r,a)}function snapAsBorderWidth(e,n,t){if(!s(n))return-1;const r=t.devicePixelLength??1,u=[v.Dimension,`${r}px`,n[2],n[3],{value:r,type:f.Integer,unit:"px"}],a=convertUnit(u,n);if(!twoOfSameNumeric(a,u))return-1;if(Number.isInteger(a[4].value/r))return resultToCalculation(e,n,n[4].value);if(a[4].value>0){if(a[4].value0?1/0:Object.is(0,0*a[4].value)?0:-0;break;default:i=Object.is(0,0*a[4].value)?0:-0}else switch(n){case"down":i=(o[4].value>0?Math.floor:Math.ceil)(a[4].value/o[4].value)*o[4].value;break;case"up":i=(o[4].value>0?Math.ceil:Math.floor)(a[4].value/o[4].value)*o[4].value;break;case"to-zero":i=Math.trunc(a[4].value/o[4].value)*o[4].value;break;default:{let t=Math.floor(a[4].value/o[4].value)*o[4].value,r=Math.ceil(a[4].value/o[4].value)*o[4].value;if(t>r){const e=t;t=r,r=e}const l=Math.abs(a[4].value-t),c=Math.abs(a[4].value-r);if(i="line-width"!==n||0!==r&&0!==t?l===c?r:l!r(e));return 1===n.length&&isNone(n[0])}if(!t(e))return!1;const n=e.value;return!!N(n)&&j.test(n[4].value)}function patchPrecision(e,n=13){if(-1===e)return-1;if(n<=0)return e;if(u(e))return e;const t=e.value;if(!C(t))return e;if(shouldSkipPrecisionRounding(t[4].value))return e;const r=roundToPrecision(t[4].value,n).toString();return m(t)?t[1]=r:d(t)?t[1]=r+"%":s(t)&&(t[1]=r+t[4].unit),e}function shouldSkipPrecisionRounding(e){if(!Number.isFinite(e)||0===e)return!0;if(Number.isInteger(e))return!0;const n=e.toString();return n.includes("e")||n.includes("E")}function roundToPrecision(e,n=13){return shouldSkipPrecisionRounding(e)?e:Number(e.toFixed(n))}const Y=String.fromCodePoint(0);function solveRandom(e,n,t,r,u,a){if(-1===n.fixed&&!a.randomCaching)return-1;const o=t.value;if(!C(o))return-1;const i=convertUnit(o,r.value);if(!twoOfSameNumeric(o,i))return-1;let l=null;if(u&&(l=convertUnit(o,u.value),!twoOfSameNumeric(o,l)))return-1;if(Number.isNaN(o[4].value)||Number.isNaN(i[4].value))return resultToCalculation(e,o,Number.NaN);if(!Number.isFinite(o[4].value))return resultToCalculation(e,o,o[4].value);if(!Number.isFinite(i[4].value)||!Number.isFinite(i[4].value-o[4].value))return resultToCalculation(e,o,Number.NaN);if(l){if(Number.isNaN(l[4].value))return resultToCalculation(e,o,Number.NaN);if(!Number.isFinite(l[4].value))return resultToCalculation(e,o,o[4].value)}const c=-1!==n.fixed?()=>n.fixed:(a.randomCaching.propertyN||(a.randomCaching.propertyN=0),sfc32(crc32([n.dashedIdent?n.dashedIdent:"",n.elementScoped?a.randomCaching.elementID:"",n.propertyScoped||n.propertyIndexScoped?a.randomCaching.propertyName:"",n.propertyIndexScoped?a.randomCaching.propertyN:"",a.randomCaching.documentID].join(Y)))),s=o[4].value;let v=i[4].value;if(v1e10)&&(l=null),l){const n=l[4].value,t=Math.max(n/1e3,1e-9);let r=Math.floor((v-s)/n);Math.abs(s+r*n-v)>=t&&Math.abs(s+(r+1)*n-v){const u=((e|=0)+(n|=0)|0)+(r|=0)|0;return r=r+1|0,e=n^n>>>9,n=(t|=0)+(t<<3)|0,t=(t=t<<21|t>>>11)+u|0,(u>>>0)/4294967296}}const _=(()=>{const e=new Uint32Array(256);for(let n=0;n<256;n++)e[n]=Number("0x"+"00000000 77073096 EE0E612C 990951BA 076DC419 706AF48F E963A535 9E6495A3 0EDB8832 79DCB8A4 E0D5E91E 97D2D988 09B64C2B 7EB17CBD E7B82D07 90BF1D91 1DB71064 6AB020F2 F3B97148 84BE41DE 1ADAD47D 6DDDE4EB F4D4B551 83D385C7 136C9856 646BA8C0 FD62F97A 8A65C9EC 14015C4F 63066CD9 FA0F3D63 8D080DF5 3B6E20C8 4C69105E D56041E4 A2677172 3C03E4D1 4B04D447 D20D85FD A50AB56B 35B5A8FA 42B2986C DBBBC9D6 ACBCF940 32D86CE3 45DF5C75 DCD60DCF ABD13D59 26D930AC 51DE003A C8D75180 BFD06116 21B4F4B5 56B3C423 CFBA9599 B8BDA50F 2802B89E 5F058808 C60CD9B2 B10BE924 2F6F7C87 58684C11 C1611DAB B6662D3D 76DC4190 01DB7106 98D220BC EFD5102A 71B18589 06B6B51F 9FBFE4A5 E8B8D433 7807C9A2 0F00F934 9609A88E E10E9818 7F6A0DBB 086D3D2D 91646C97 E6635C01 6B6B51F4 1C6C6162 856530D8 F262004E 6C0695ED 1B01A57B 8208F4C1 F50FC457 65B0D9C6 12B7E950 8BBEB8EA FCB9887C 62DD1DDF 15DA2D49 8CD37CF3 FBD44C65 4DB26158 3AB551CE A3BC0074 D4BB30E2 4ADFA541 3DD895D7 A4D1C46D D3D6F4FB 4369E96A 346ED9FC AD678846 DA60B8D0 44042D73 33031DE5 AA0A4C5F DD0D7CC9 5005713C 270241AA BE0B1010 C90C2086 5768B525 206F85B3 B966D409 CE61E49F 5EDEF90E 29D9C998 B0D09822 C7D7A8B4 59B33D17 2EB40D81 B7BD5C3B C0BA6CAD EDB88320 9ABFB3B6 03B6E20C 74B1D29A EAD54739 9DD277AF 04DB2615 73DC1683 E3630B12 94643B84 0D6D6A3E 7A6A5AA8 E40ECF0B 9309FF9D 0A00AE27 7D079EB1 F00F9344 8708A3D2 1E01F268 6906C2FE F762575D 806567CB 196C3671 6E6B06E7 FED41B76 89D32BE0 10DA7A5A 67DD4ACC F9B9DF6F 8EBEEFF9 17B7BE43 60B08ED5 D6D6A3E8 A1D1937E 38D8C2C4 4FDFF252 D1BB67F1 A6BC5767 3FB506DD 48B2364B D80D2BDA AF0A1B4C 36034AF6 41047A60 DF60EFC3 A867DF55 316E8EEF 4669BE79 CB61B38C BC66831A 256FD2A0 5268E236 CC0C7795 BB0B4703 220216B9 5505262F C5BA3BBE B2BD0B28 2BB45A92 5CB36A04 C2D7FFA7 B5D0CF31 2CD99E8B 5BDEAE1D 9B64C2B0 EC63F226 756AA39C 026D930A 9C0906A9 EB0E363F 72076785 05005713 95BF4A82 E2B87A14 7BB12BAE 0CB61B38 92D28E9B E5D5BE0D 7CDCEFB7 0BDBDF21 86D3D2D4 F1D4E242 68DDB3F8 1FDA836E 81BE16CD F6B9265B 6FB077E1 18B74777 88085AE6 FF0F6A70 66063BCA 11010B5C 8F659EFF F862AE69 616BFFD3 166CCF45 A00AE278 D70DD2EE 4E048354 3903B3C2 A7672661 D06016F7 4969474D 3E6E77DB AED16A4A D9D65ADC 40DF0B66 37D83BF0 A9BCAE53 DEBB9EC5 47B2CF7F 30B5FFE9 BDBDF21C CABAC28A 53B39330 24B4A3A6 BAD03605 CDD70693 54DE5729 23D967BF B3667A2E C4614AB8 5D681B02 2A6F2B94 B40BBE37 C30C8EA1 5A05DF1B 2D02EF8D".substring(9*n,9*n+8));return e})();function crc32(e){let n,t,r=0;r^=-1;for(let u=0,a=e.length;u>>8^n;return(-1^r)>>>0}function solveCalcMix(e,n){const t=n[0].calcSum.value;if(!C(t))return-1;const r=n.map(e=>({calcSum:convertUnit(t,e.calcSum.value),percentage:e.percentage}));if(!arrayOfSameNumeric(r.map(e=>e.calcSum)))return-1;const{items:u}=normalizeMixPercentages(r,!1),a=u.map(e=>e.calcSum[4].value*e.percentage/100);let o=0;for(let e=0;e100||a>0&&n)for(const e of u)e.percentage=e.percentage*(100/a);let o=0;return a<100&&(o=100-a),{items:u,leftover:o}}const H=new Map([["abs",function abs(e,n,t){return singleNodeSolver(e,n,t,solveAbs)}],["acos",function acos(e,n,t){return singleNodeSolver(e,n,t,solveACos)}],["asin",function asin(e,n,t){return singleNodeSolver(e,n,t,solveASin)}],["atan",function atan(e,n,t){return singleNodeSolver(e,n,t,solveATan)}],["atan2",function atan2(e,n,t){return twoCommaSeparatedNodesSolver(e,n,t,solveATan2)}],["calc",calc$1],["calc-mix",function calcMix(e,n,t){const r=variadicArgumentsCalcMix(e,e.value,n,t);if(-1===r)return-1;return solveCalcMix(e,r)}],["clamp",function clamp(u,a,i){const l=resolveGlobalsAndConstants([...u.value.filter(e=>!r(e))],a),c=[],s=[],f=[];{let e=c;for(let n=0;n!r(e)),n,t);if(-1===u)return-1;const[a,o]=u,i=variadicArguments(e,o,n,t);if(-1===i)return-1;const[l,c,s]=i;if(!l||!c)return-1;return solveRandom(e,a,l,c,s,t)}],["rem",function rem(e,n,t){return twoCommaSeparatedNodesSolver(e,n,t,solveRem)}],["round",function round(e,u,a){const o=resolveGlobalsAndConstants([...e.value.filter(e=>!r(e))],u);let i="",l=!1;const c=[],p=[];{let e=c;for(let n=0;n!r(e))],n);if(i.length>J)throw new Error(`Maximum number of nodes in a math function (${J}) exceeded, reduce the complexity of your expression`);if(1===i.length&&t(i[0]))return{inputs:[i[0]],operation:unary};let l=0;for(;l!r(e))],n),a=solve(calc$1(calcWrapper(e,u),n,t),t);return-1===a?-1:a}function twoCommaSeparatedNodesSolver(e,n,t,r){const u=twoCommaSeparatedArguments(e,n,t);if(-1===u)return-1;const[a,o]=u;return r(e,a,o,t)}function twoCommaSeparatedArguments(e,n,u){const a=resolveGlobalsAndConstants([...e.value.filter(e=>!r(e))],n),o=[],i=[];{let e=o;for(let n=0;n!r(e))],u),i=[];{const n=[];let r=[];for(let e=0;e!r(e))],u),i=[];{const n=[];let l=[];for(let e=0;e=0;i--){if(r(n[o][i]))continue;if(l=solve(calc$1(calcWrapper(e,n[o].slice(0,i+1)),u,a),a),-1===l)continue;const s=n[o].slice(i+1).filter(e=>!r(e));if(s.length)if(1===s.length&&t(s[0])&&d(s[0].value)){if(c=s[0].value[4].value,c<0||c>100)return-1}else{const n=solve(calc$1(calcWrapper(e,s),u,a),a);if(-1===n)return-1;if(!d(n.value))return-1;c=n.value[4].value,c=Math.min(100,Math.max(0,c))}break}if(-1===l)return-1;i.push({calcSum:l,percentage:c})}}return i}const K=new Set(["nearest","line-width","up","down","to-zero"]);function parseRandomValueSharing(e,n,r,u){const a={dashedIdent:"",fixed:-1,elementScoped:!1,propertyScoped:!1,propertyIndexScoped:!1};let o=!1;const i=n[0];if(!t(i)||!N(i.value))return[a,n];for(let i=0;i1)return-1;a.fixed=Math.max(0,Math.min(l.value[4].value,1-Number.EPSILON/2));continue}if("auto"!==c){if(!c.startsWith("--"))return 0===i?[a,n]:-1;if(-1!==a.fixed||o||a.dashedIdent)return-1;a.dashedIdent=c}else{if(-1!==a.fixed||o||a.dashedIdent||a.elementScoped||a.propertyScoped||a.propertyIndexScoped)return-1;a.elementScoped=!0,a.propertyIndexScoped=!0,o=!0}}else{if(-1!==a.fixed||o||a.propertyScoped||a.propertyIndexScoped)return-1;a.propertyIndexScoped=!0}else{if(-1!==a.fixed||o||a.propertyScoped||a.propertyIndexScoped)return-1;a.propertyScoped=!0}else{if(-1!==a.fixed||o||a.elementScoped)return-1;a.elementScoped=!0}}return-1}function calcWrapper(e,n){return new o([v.Function,"calc(",e.name[2],e.name[3],{value:"calc"}],[v.CloseParen,")",e.endToken[2],e.endToken[3],void 0],n)}function maxWrapper(t,r,u){return new o([v.Function,"max(",t.name[2],t.name[3],{value:"max"}],[v.CloseParen,")",t.endToken[2],t.endToken[3],void 0],[r,new n([v.Comma,",",...e(r),void 0]),u])}function patchNaN(e){if(-1===e)return-1;if(u(e))return e;const t=e.value;return C(t)&&Number.isNaN(t[4].value)?m(t)?new o([v.Function,"calc(",t[2],t[3],{value:"calc"}],[v.CloseParen,")",t[2],t[3],void 0],[new n([v.Ident,"NaN",t[2],t[3],{value:"NaN"}])]):s(t)?new o([v.Function,"calc(",t[2],t[3],{value:"calc"}],[v.CloseParen,")",t[2],t[3],void 0],[new n([v.Ident,"NaN",t[2],t[3],{value:"NaN"}]),new i([[v.Whitespace," ",t[2],t[3],void 0]]),new n([v.Delim,"*",t[2],t[3],{value:"*"}]),new i([[v.Whitespace," ",t[2],t[3],void 0]]),new n([v.Dimension,"1"+t[4].unit,t[2],t[3],{value:1,type:f.Integer,unit:t[4].unit}])]):d(t)?new o([v.Function,"calc(",t[2],t[3],{value:"calc"}],[v.CloseParen,")",t[2],t[3],void 0],[new n([v.Ident,"NaN",t[2],t[3],{value:"NaN"}]),new i([[v.Whitespace," ",t[2],t[3],void 0]]),new n([v.Delim,"*",t[2],t[3],{value:"*"}]),new i([[v.Whitespace," ",t[2],t[3],void 0]]),new n([v.Percentage,"1%",t[2],t[3],{value:1}])]):-1:e}function patchInfinity(e){if(-1===e)return-1;if(u(e))return e;const t=e.value;if(!C(t))return e;if(Number.isFinite(t[4].value)||Number.isNaN(t[4].value))return e;let r="";return Number.NEGATIVE_INFINITY===t[4].value&&(r="-"),m(t)?new o([v.Function,"calc(",t[2],t[3],{value:"calc"}],[v.CloseParen,")",t[2],t[3],void 0],[new n([v.Ident,r+"infinity",t[2],t[3],{value:r+"infinity"}])]):s(t)?new o([v.Function,"calc(",t[2],t[3],{value:"calc"}],[v.CloseParen,")",t[2],t[3],void 0],[new n([v.Ident,r+"infinity",t[2],t[3],{value:r+"infinity"}]),new i([[v.Whitespace," ",t[2],t[3],void 0]]),new n([v.Delim,"*",t[2],t[3],{value:"*"}]),new i([[v.Whitespace," ",t[2],t[3],void 0]]),new n([v.Dimension,"1"+t[4].unit,t[2],t[3],{value:1,type:f.Integer,unit:t[4].unit}])]):new o([v.Function,"calc(",t[2],t[3],{value:"calc"}],[v.CloseParen,")",t[2],t[3],void 0],[new n([v.Ident,r+"infinity",t[2],t[3],{value:r+"infinity"}]),new i([[v.Whitespace," ",t[2],t[3],void 0]]),new n([v.Delim,"*",t[2],t[3],{value:"*"}]),new i([[v.Whitespace," ",t[2],t[3],void 0]]),new n([v.Percentage,"1%",t[2],t[3],{value:1}])])}function patchMinusZero(e){if(-1===e)return-1;if(u(e))return e;const n=e.value;return C(n)&&Object.is(-0,n[4].value)?("-0"===n[1]||(d(n)?n[1]="-0%":s(n)?n[1]="-0"+n[4].unit:n[1]="-0"),e):e}function patchCanonicalUnit(e){return-1===e?-1:u(e)?e:s(e.value)?(e.value=toCanonicalUnit(e.value),e):e}function patchCalcResult(e,n){let t=e;return n?.toCanonicalUnits&&(t=patchCanonicalUnit(t)),t=patchPrecision(t,n?.precision),t=patchMinusZero(t),n?.censorIntoStandardRepresentableValues||(t=patchNaN(t),t=patchInfinity(t)),t}function tokenizeGlobals(e){const n=new Map;if(!e)return n;for(const[t,r]of e)if(b(r))n.set(t,r);else if("string"==typeof r){const e=B({css:r}),u=e.nextToken();if(e.nextToken(),!e.endOfFile())continue;if(!C(u))continue;n.set(t,u);continue}return n}function calc(e,n){return calcFromComponentValues(l(A({css:e}),{}),n).map(e=>e.map(e=>w(e.tokens())).join("")).join(",")}function calcFromComponentValues(e,n){const t=tokenizeGlobals(n?.globals);return replaceComponentValues(e,e=>{if(!u(e))return;const r=H.get(e.getName().toLowerCase());if(!r)return;const a=patchCalcResult(solve(r(e,t,n??{}),n??{}),n);return-1!==a?n?.calcWrapper?calcWrapper(e,[a]):a:void 0})}function replaceComponentValues(n,u){for(let a=0;a{if("number"!=typeof a)return;const o=u(n.node);if(!o)return;const l=[o],c=n.parent.value[a-1];t(c)&&h(c.value)&&("-"===c.value[4].value||"+"===c.value[4].value)&&l.splice(0,0,new i([[v.Whitespace," ",...e(n.node),void 0]]));const s=n.parent.value[a+1];!s||r(s)||t(s)&&(D(s.value)||F(s.value)||E(s.value)||h(s.value)&&"-"!==s.value[4].value&&"+"!==s.value[4].value)||l.push(new i([[v.Whitespace," ",...e(n.node),void 0]])),n.parent.value.splice(a,1,...l)})}return n}const Q=new Set(H.keys());export{ParseError,S as ParseErrorMessage,ParseErrorWithComponentValues,calc,calcFromComponentValues,Q as mathFunctionNames}; diff --git a/node_modules/@csstools/css-calc/package.json b/node_modules/@csstools/css-calc/package.json new file mode 100644 index 0000000..02235c2 --- /dev/null +++ b/node_modules/@csstools/css-calc/package.json @@ -0,0 +1,61 @@ +{ + "name": "@csstools/css-calc", + "description": "Solve CSS math expressions", + "version": "3.4.3", + "contributors": [ + { + "name": "Antonio Laguna", + "email": "antonio@laguna.es", + "url": "https://antonio.laguna.es" + }, + { + "name": "Romain Menke", + "email": "romainmenke@gmail.com" + } + ], + "license": "MIT", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/csstools" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/csstools" + } + ], + "engines": { + "node": ">=20.19.0" + }, + "type": "module", + "exports": { + ".": { + "types": "./dist/index.d.ts", + "default": "./dist/index.mjs" + } + }, + "files": [ + "CHANGELOG.md", + "LICENSE.md", + "README.md", + "dist" + ], + "peerDependencies": { + "@csstools/css-parser-algorithms": "^4.0.2", + "@csstools/css-tokenizer": "^4.0.2" + }, + "scripts": {}, + "homepage": "https://github.com/csstools/postcss-plugins/tree/main/packages/css-calc#readme", + "repository": { + "type": "git", + "url": "git+https://github.com/csstools/postcss-plugins.git", + "directory": "packages/css-calc" + }, + "bugs": "https://github.com/csstools/postcss-plugins/issues", + "keywords": [ + "calc", + "css", + "math", + "parser" + ] +} diff --git a/node_modules/@csstools/css-color-parser/CHANGELOG.md b/node_modules/@csstools/css-color-parser/CHANGELOG.md new file mode 100644 index 0000000..1beeff1 --- /dev/null +++ b/node_modules/@csstools/css-color-parser/CHANGELOG.md @@ -0,0 +1,9 @@ +# Changes to CSS Color Parser + +### 4.2.6 + +_October 2, 2026_ + +- Updated [`@csstools/css-calc`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-calc) to [`3.4.3`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-calc/CHANGELOG.md#343) (patch) + +[Full CHANGELOG](https://github.com/csstools/postcss-plugins/tree/main/packages/css-color-parser/CHANGELOG.md) diff --git a/node_modules/@csstools/css-color-parser/LICENSE.md b/node_modules/@csstools/css-color-parser/LICENSE.md new file mode 100644 index 0000000..af5411f --- /dev/null +++ b/node_modules/@csstools/css-color-parser/LICENSE.md @@ -0,0 +1,20 @@ +The MIT License (MIT) + +Copyright 2022 Romain Menke, Antonio Laguna + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/@csstools/css-color-parser/README.md b/node_modules/@csstools/css-color-parser/README.md new file mode 100644 index 0000000..f886fc9 --- /dev/null +++ b/node_modules/@csstools/css-color-parser/README.md @@ -0,0 +1,37 @@ +# CSS Color Parser for CSS + +[npm version][npm-url] +[Build Status][cli-url] +[Discord][discord] + +## Usage + +Add [CSS Color Parser] to your project: + +```bash +npm install @csstools/css-color-parser @csstools/css-parser-algorithms @csstools/css-tokenizer --save-dev +``` + +```ts +import { color } from '@csstools/css-color-parser'; +import { isFunctionNode, parseComponentValue } from '@csstools/css-parser-algorithms'; +import { serializeRGB } from '@csstools/css-color-parser'; +import { tokenize } from '@csstools/css-tokenizer'; + +// color() expects a parsed component value. +const hwbComponentValue = parseComponentValue(tokenize({ css: 'hwb(10deg 10% 20%)' })); +const colorData = color(hwbComponentValue); +if (colorData) { + console.log(colorData); + + // serializeRGB() returns a component value. + const rgbComponentValue = serializeRGB(colorData); + console.log(rgbComponentValue.toString()); +} +``` + +[cli-url]: https://github.com/csstools/postcss-plugins/actions/workflows/test.yml?query=workflow/test +[discord]: https://discord.gg/bUadyRwkJS +[npm-url]: https://www.npmjs.com/package/@csstools/css-color-parser + +[CSS Color Parser]: https://github.com/csstools/postcss-plugins/tree/main/packages/css-color-parser diff --git a/node_modules/@csstools/css-color-parser/dist/index.d.ts b/node_modules/@csstools/css-color-parser/dist/index.d.ts new file mode 100644 index 0000000..3e4feb4 --- /dev/null +++ b/node_modules/@csstools/css-color-parser/dist/index.d.ts @@ -0,0 +1,170 @@ +import type { Color } from '@csstools/color-helpers'; +import type { ComponentValue } from '@csstools/css-parser-algorithms'; +import { FunctionNode } from '@csstools/css-parser-algorithms'; + +/** + * Convert a color function to a `ColorData` object. + * + * @param {ComponentValue} colorNode - The color function to be converted. + * @returns {ColorData|false} The color function as a `ColorData` object or `false` if it could not be converted. + */ +export declare function color(colorNode: ComponentValue): ColorData | false; + +/** + * A color data object. + * It contains as much information as possible about the color and the original parsed syntax. + */ +export declare interface ColorData { + /** + * The color notation of the color data. + * + * We use "color notation" and not "color space" because these represent the original notation and not the actual color space. + * The actual color space is however always implied by the color notation. + */ + colorNotation: ColorNotation; + /** + * The color channels. + * This is always an array of three numbers + * but the channels can only be interpreted by looking at the color notation. + */ + channels: Color; + /** + * The alpha channel. + * This is either a number between `0` and `1` or a `ComponentValue` object. + * + * Since most computations are not dependent on the alpha channel, + * we allow things like `var(--some-alpha)` as an alpha channel value for most inputs. + */ + alpha: number | ComponentValue; + /** + * Information about the original syntax. + */ + syntaxFlags: Set; +} + +/** + * Check if a color data object fits the `display-p3` gamut. + * + * @param {ColorData} x - The color data to be checked. + * @returns {boolean} Whether the color data fits the `display-p3` gamut. + */ +export declare function colorDataFitsDisplayP3_Gamut(x: ColorData): boolean; + +/** + * Check if a color data object fits the `sRGB` gamut. + * + * @param {ColorData} x - The color data to be checked. + * @returns {boolean} Whether the color data fits the `sRGB` gamut. + */ +export declare function colorDataFitsRGB_Gamut(x: ColorData): boolean; + +export declare enum ColorNotation { + /** Adobe 1999, expressed through `color(a98-rgb 0 0 0)` */ + A98_RGB = "a98-rgb", + /** Display P3, expressed through `color(display-p3 0 0 0)` */ + Display_P3 = "display-p3", + /** Display P3, expressed through `color(display-p3-linear 0 0 0)` */ + Linear_Display_P3 = "display-p3-linear", + /** Hex, expressed through `#000` */ + HEX = "hex", + /** HSL, expressed through `hsl(0 0% 0%)` */ + HSL = "hsl", + /** HWB, expressed through `hwb(0 0% 0%)` */ + HWB = "hwb", + /** LCH, expressed through `lch(0 0% 0deg)` */ + LCH = "lch", + /** Lab, expressed through `lab(0 0 0)` */ + Lab = "lab", + /** Linear sRGB, expressed through `color(linear-srgb 0 0 0)` */ + Linear_sRGB = "srgb-linear", + /** Oklch, expressed through `oklch(0 0% 0deg)` */ + OKLCH = "oklch", + /** Oklab, expressed through `oklab(0 0 0)` */ + OKLab = "oklab", + /** ProPhoto RGB, expressed through `color(prophoto-rgb 0 0 0)` */ + ProPhoto_RGB = "prophoto-rgb", + /** RGB, expressed through `rgb(0 0 0)` */ + RGB = "rgb", + /** sRGB, expressed through `color(srgb 0 0 0)` */ + sRGB = "srgb", + /** Rec. 2020, expressed through `color(rec2020 0 0 0)` */ + Rec2020 = "rec2020", + /** XYZ, expressed through `color(xyz-d50 0 0 0)` */ + XYZ_D50 = "xyz-d50", + /** XYZ, expressed through `color(xyz-d65 0 0 0)` */ + XYZ_D65 = "xyz-d65" +} + +export declare function computedValue(color: ColorData, convertHslOrHwbToRGB?: boolean): string; + +export declare function serializeHSL(color: ColorData, gamutMapping?: boolean): FunctionNode; + +/** + * Convert color data to component values in the OKLCH color space. + * The return value can be converted to a string by calling `toString()` on it. + * + * @param {ColorData} color - The color data to be serialized. + * @returns {FunctionNode} The serialized color data as a FunctionNode object. + */ +export declare function serializeOKLCH(color: ColorData): FunctionNode; + +/** + * Convert color data to component values in the display-p3 color space. + * The return value can be converted to a string by calling `toString()` on it. + * + * @param {ColorData} color - The color data to be serialized. + * @param {boolean} gamutMapping - Whether to perform gamut mapping, defaults to `true`. + * @returns {FunctionNode} The serialized color data as a FunctionNode object. + */ +export declare function serializeP3(color: ColorData, gamutMapping?: boolean): FunctionNode; + +/** + * Convert color data to component values in the srgb color space. + * The return value can be converted to a string by calling `toString()` on it. + * + * @param {ColorData} color - The color data to be serialized. + * @param {boolean} gamutMapping - Whether to perform gamut mapping, defaults to `true`. + * @returns {FunctionNode} The serialized color data as a FunctionNode object. + */ +export declare function serializeRGB(color: ColorData, gamutMapping?: boolean): FunctionNode; + +export declare enum SyntaxFlag { + /** Is a color keyword, e.g. `transparent`, `currentColor`, ... */ + ColorKeyword = "color-keyword", + /** Has an explicit alpha channel */ + HasAlpha = "has-alpha", + /** Has a channel with a dimension value, e.g. `50deg` */ + HasDimensionValues = "has-dimension-values", + /** Has a channel with the `none` keyword */ + HasNoneKeywords = "has-none-keywords", + /** Has a channel with a number value */ + HasNumberValues = "has-number-values", + /** Has an alpha channel with a percentage value */ + HasPercentageAlpha = "has-percentage-alpha", + /** Has a channel with a percentage value */ + HasPercentageValues = "has-percentage-values", + /** Has an alpha channel with a `var()` function value */ + HasVariableAlpha = "has-variable-alpha", + /** Is Hex notation */ + Hex = "hex", + /** Is legacy HSL, e.g. `hsl(50deg, 0%, 0%)` */ + LegacyHSL = "legacy-hsl", + /** Is legacy RGB, e.g. `rgb(0, 0, 0)` */ + LegacyRGB = "legacy-rgb", + /** Is a named color, e.g. `red`, `blue` */ + NamedColor = "named-color", + /** Is a relative color syntax, e.g. `rgb(from purple r g b)` */ + RelativeColorSyntax = "relative-color-syntax", + /** Is a mixed color, e.g. `color-mix(in oklch, red, blue)` */ + ColorMix = "color-mix", + /** Is a variadic mixed color, e.g. `color-mix(in oklch, red)` `color-mix(in oklch, red, blue, green)` */ + ColorMixVariadic = "color-mix-variadic", + /** Is a contrasting color, e.g. `contrast-color()` */ + ContrastColor = "contrast-color", + /** Is a relative alpha syntax `alpha(from red / 0.5)` */ + RelativeAlphaSyntax = "relative-alpha-syntax", + /** Is an experimental color syntax */ + Experimental = "experimental" +} + +export { } diff --git a/node_modules/@csstools/css-color-parser/dist/index.mjs b/node_modules/@csstools/css-color-parser/dist/index.mjs new file mode 100644 index 0000000..849f888 --- /dev/null +++ b/node_modules/@csstools/css-color-parser/dist/index.mjs @@ -0,0 +1 @@ +import{TokenType as e,NumberType as n,isTokenIdent as a,isTokenPercentage as o,isTokenNumber as r,isTokenDelim as t,isTokenNumeric as l,isTokenComma as s,isTokenDimension as c,isTokenHash as i}from"@csstools/css-tokenizer";import{XYZ_D65_to_XYZ_D65 as u,XYZ_D50_to_XYZ_D65 as h,OKLCH_to_XYZ_D65 as N,LCH_to_XYZ_D65 as m,OKLab_to_XYZ_D65 as p,Lab_to_XYZ_D65 as b,HWB_to_XYZ_D65 as v,HSL_to_XYZ_D65 as f,ProPhoto_RGB_to_XYZ_D65 as g,a98_RGB_to_XYZ_D65 as d,rec_2020_to_XYZ_D65 as y,lin_P3_to_XYZ_D65 as _,P3_to_XYZ_D65 as C,lin_sRGB_to_XYZ_D65 as T,sRGB_to_XYZ_D65 as w,XYZ_D50_to_XYZ_D50 as x,XYZ_D65_to_OKLab as D,XYZ_D65_to_OKLCH as L,XYZ_D50_to_LCH as H,XYZ_D50_to_Lab as P,XYZ_D65_to_HWB as Z,XYZ_D65_to_HSL as M,XYZ_D65_to_a98_RGB as $,XYZ_D50_to_ProPhoto as F,XYZ_D65_to_rec_2020 as S,XYZ_D65_to_lin_P3 as z,XYZ_D65_to_P3 as R,XYZ_D65_to_lin_sRGB as k,XYZ_D65_to_sRGB as B,XYZ_D65_to_XYZ_D50 as X,OKLCH_to_XYZ_D50 as G,LCH_to_XYZ_D50 as A,OKLab_to_XYZ_D50 as Y,Lab_to_XYZ_D50 as V,HWB_to_XYZ_D50 as K,HSL_to_XYZ_D50 as I,ProPhoto_RGB_to_XYZ_D50 as O,a98_RGB_to_XYZ_D50 as W,rec_2020_to_XYZ_D50 as E,lin_P3_to_XYZ_D50 as U,P3_to_XYZ_D50 as j,lin_sRGB_to_XYZ_D50 as q,sRGB_to_XYZ_D50 as J,namedColors as Q,inGamut as ee,clip as ne,gam_sRGB as ae,mapGamutRayTrace as oe,OKLCH_to_OKLab as re,OKLab_to_XYZ as te,XYZ_to_lin_sRGB as le,lin_sRGB_to_XYZ as se,XYZ_to_OKLab as ce,OKLab_to_OKLCH as ie,contrast_ratio_wcag_2_1 as ue,gam_P3 as he,XYZ_to_lin_P3 as Ne,lin_P3_to_XYZ as me}from"@csstools/color-helpers";import{isWhitespaceNode as pe,isCommentNode as be,isTokenNode as ve,isFunctionNode as fe,TokenNode as ge,isWhiteSpaceOrCommentNode as de,replaceComponentValues as ye,FunctionNode as _e,WhitespaceNode as Ce}from"@csstools/css-parser-algorithms";import{mathFunctionNames as Te,calcFromComponentValues as we}from"@csstools/css-calc";var xe,De;function normalize(e,n,a,o){return Math.min(Math.max(e/n,a),o)}function convertNaNToZero(e){return[Number.isNaN(e[0])?0:e[0],Number.isNaN(e[1])?0:e[1],Number.isNaN(e[2])?0:e[2]]}function colorData_to_XYZ_D50(e){switch(e.colorNotation){case xe.HEX:case xe.RGB:case xe.sRGB:return{...e,colorNotation:xe.XYZ_D50,channels:J(convertNaNToZero(e.channels))};case xe.Linear_sRGB:return{...e,colorNotation:xe.XYZ_D50,channels:q(convertNaNToZero(e.channels))};case xe.Display_P3:return{...e,colorNotation:xe.XYZ_D50,channels:j(convertNaNToZero(e.channels))};case xe.Linear_Display_P3:return{...e,colorNotation:xe.XYZ_D50,channels:U(convertNaNToZero(e.channels))};case xe.Rec2020:return{...e,colorNotation:xe.XYZ_D50,channels:E(convertNaNToZero(e.channels))};case xe.A98_RGB:return{...e,colorNotation:xe.XYZ_D50,channels:W(convertNaNToZero(e.channels))};case xe.ProPhoto_RGB:return{...e,colorNotation:xe.XYZ_D50,channels:O(convertNaNToZero(e.channels))};case xe.HSL:return{...e,colorNotation:xe.XYZ_D50,channels:I(convertNaNToZero(e.channels))};case xe.HWB:return{...e,colorNotation:xe.XYZ_D50,channels:K(convertNaNToZero(e.channels))};case xe.Lab:return{...e,colorNotation:xe.XYZ_D50,channels:V(convertNaNToZero(e.channels))};case xe.OKLab:return{...e,colorNotation:xe.XYZ_D50,channels:Y(convertNaNToZero(e.channels))};case xe.LCH:return{...e,colorNotation:xe.XYZ_D50,channels:A(convertNaNToZero(e.channels))};case xe.OKLCH:return{...e,colorNotation:xe.XYZ_D50,channels:G(convertNaNToZero(e.channels))};case xe.XYZ_D50:return{...e,colorNotation:xe.XYZ_D50,channels:x(convertNaNToZero(e.channels))};case xe.XYZ_D65:return{...e,colorNotation:xe.XYZ_D50,channels:X(convertNaNToZero(e.channels))};default:throw new Error("Unsupported color notation")}}function colorData_to_XYZ_D65(e){switch(e.colorNotation){case xe.HEX:case xe.RGB:case xe.sRGB:return{...e,colorNotation:xe.XYZ_D65,channels:w(convertNaNToZero(e.channels))};case xe.Linear_sRGB:return{...e,colorNotation:xe.XYZ_D65,channels:T(convertNaNToZero(e.channels))};case xe.Display_P3:return{...e,colorNotation:xe.XYZ_D65,channels:C(convertNaNToZero(e.channels))};case xe.Linear_Display_P3:return{...e,colorNotation:xe.XYZ_D65,channels:_(convertNaNToZero(e.channels))};case xe.Rec2020:return{...e,colorNotation:xe.XYZ_D65,channels:y(convertNaNToZero(e.channels))};case xe.A98_RGB:return{...e,colorNotation:xe.XYZ_D65,channels:d(convertNaNToZero(e.channels))};case xe.ProPhoto_RGB:return{...e,colorNotation:xe.XYZ_D65,channels:g(convertNaNToZero(e.channels))};case xe.HSL:return{...e,colorNotation:xe.XYZ_D65,channels:f(convertNaNToZero(e.channels))};case xe.HWB:return{...e,colorNotation:xe.XYZ_D65,channels:v(convertNaNToZero(e.channels))};case xe.Lab:return{...e,colorNotation:xe.XYZ_D65,channels:b(convertNaNToZero(e.channels))};case xe.OKLab:return{...e,colorNotation:xe.XYZ_D65,channels:p(convertNaNToZero(e.channels))};case xe.LCH:return{...e,colorNotation:xe.XYZ_D65,channels:m(convertNaNToZero(e.channels))};case xe.OKLCH:return{...e,colorNotation:xe.XYZ_D65,channels:N(convertNaNToZero(e.channels))};case xe.XYZ_D50:return{...e,colorNotation:xe.XYZ_D65,channels:h(convertNaNToZero(e.channels))};case xe.XYZ_D65:return{...e,colorNotation:xe.XYZ_D65,channels:u(convertNaNToZero(e.channels))};default:throw new Error("Unsupported color notation")}}!function(e){e.A98_RGB="a98-rgb",e.Display_P3="display-p3",e.Linear_Display_P3="display-p3-linear",e.HEX="hex",e.HSL="hsl",e.HWB="hwb",e.LCH="lch",e.Lab="lab",e.Linear_sRGB="srgb-linear",e.OKLCH="oklch",e.OKLab="oklab",e.ProPhoto_RGB="prophoto-rgb",e.RGB="rgb",e.sRGB="srgb",e.Rec2020="rec2020",e.XYZ_D50="xyz-d50",e.XYZ_D65="xyz-d65"}(xe||(xe={})),function(e){e.ColorKeyword="color-keyword",e.HasAlpha="has-alpha",e.HasDimensionValues="has-dimension-values",e.HasNoneKeywords="has-none-keywords",e.HasNumberValues="has-number-values",e.HasPercentageAlpha="has-percentage-alpha",e.HasPercentageValues="has-percentage-values",e.HasVariableAlpha="has-variable-alpha",e.Hex="hex",e.LegacyHSL="legacy-hsl",e.LegacyRGB="legacy-rgb",e.NamedColor="named-color",e.RelativeColorSyntax="relative-color-syntax",e.ColorMix="color-mix",e.ColorMixVariadic="color-mix-variadic",e.ContrastColor="contrast-color",e.RelativeAlphaSyntax="relative-alpha-syntax",e.Experimental="experimental"}(De||(De={}));const Le=new Set([xe.A98_RGB,xe.Display_P3,xe.Linear_Display_P3,xe.HEX,xe.Linear_sRGB,xe.ProPhoto_RGB,xe.RGB,xe.sRGB,xe.Rec2020,xe.XYZ_D50,xe.XYZ_D65]);function colorDataToForInterpolation(e,n){if(e.colorNotation===n)return{...e};const a=[...e.channels];let o={...e};return o.channels=convertPowerlessComponentsToMissingComponents(o.channels,e.colorNotation),o=convertToDestination(o,n),o.channels=carryForwardMissingComponentsForColorAndNotation(o,e.colorNotation,n,a),o}function colorDataToForRelativeColorSyntax(e,n){if(e.colorNotation===n)return{...e};const a=[...e.channels];let o={...e};return o.channels=convertPowerlessComponentsToMissingComponents(o.channels,e.colorNotation),o=convertToDestination(o,n),o.channels=carryForwardMissingComponentsForColorAndNotation(o,e.colorNotation,n,a),o}function convertToDestination(e,n){if(e.colorNotation===n)return e.channels=convertNaNToZero(e.channels),e.channels=convertPowerlessComponentsToMissingComponents(e.channels,n),e;switch(n){case xe.HEX:case xe.RGB:{const n=colorData_to_XYZ_D65(e);e.colorNotation=xe.RGB,e.channels=B(n.channels),e.channels=e.channels.map(e=>reducePrecisionOrNaN(e,8)),e.channels=normalizeAfterColorConversion(e.channels);break}case xe.sRGB:{const n=colorData_to_XYZ_D65(e);e.colorNotation=xe.sRGB,e.channels=B(n.channels),e.channels=normalizeAfterColorConversion(e.channels);break}case xe.Linear_sRGB:{const n=colorData_to_XYZ_D65(e);e.colorNotation=xe.Linear_sRGB,e.channels=k(n.channels),e.channels=normalizeAfterColorConversion(e.channels);break}case xe.Display_P3:{const n=colorData_to_XYZ_D65(e);e.colorNotation=xe.Display_P3,e.channels=R(n.channels),e.channels=normalizeAfterColorConversion(e.channels);break}case xe.Linear_Display_P3:{const n=colorData_to_XYZ_D65(e);e.colorNotation=xe.Linear_Display_P3,e.channels=z(n.channels),e.channels=normalizeAfterColorConversion(e.channels);break}case xe.Rec2020:{const n=colorData_to_XYZ_D65(e);e.colorNotation=xe.Rec2020,e.channels=S(n.channels),e.channels=normalizeAfterColorConversion(e.channels);break}case xe.ProPhoto_RGB:{const n=colorData_to_XYZ_D50(e);e.colorNotation=xe.ProPhoto_RGB,e.channels=F(n.channels),e.channels=normalizeAfterColorConversion(e.channels);break}case xe.A98_RGB:{const n=colorData_to_XYZ_D65(e);e.colorNotation=xe.A98_RGB,e.channels=$(n.channels),e.channels=normalizeAfterColorConversion(e.channels);break}case xe.HSL:{const a=colorData_to_XYZ_D65(e);e.colorNotation=xe.HSL,e.channels=M(a.channels),e.channels=e.channels.map(e=>reducePrecisionOrNaN(e,8)),e.channels=normalizeAfterColorConversion(e.channels,0),e.channels=convertPowerlessComponentsToMissingComponents(e.channels,n);break}case xe.HWB:{const a=colorData_to_XYZ_D65(e);e.colorNotation=xe.HWB,e.channels=Z(a.channels),e.channels=e.channels.map(e=>reducePrecisionOrNaN(e,8)),e.channels=normalizeAfterColorConversion(e.channels,0),e.channels=convertPowerlessComponentsToMissingComponents(e.channels,n);break}case xe.Lab:{const n=colorData_to_XYZ_D50(e);e.colorNotation=xe.Lab,e.channels=P(n.channels),e.channels=normalizeAfterColorConversion(e.channels);break}case xe.LCH:{const a=colorData_to_XYZ_D50(e);e.colorNotation=xe.LCH,e.channels=H(a.channels),e.channels=normalizeAfterColorConversion(e.channels,2),e.channels=convertPowerlessComponentsToMissingComponents(e.channels,n);break}case xe.OKLCH:{const a=colorData_to_XYZ_D65(e);e.colorNotation=xe.OKLCH,e.channels=L(a.channels),e.channels=normalizeAfterColorConversion(e.channels,2),e.channels=convertPowerlessComponentsToMissingComponents(e.channels,n);break}case xe.OKLab:{const n=colorData_to_XYZ_D65(e);e.colorNotation=xe.OKLab,e.channels=D(n.channels),e.channels=normalizeAfterColorConversion(e.channels);break}case xe.XYZ_D50:{const n=colorData_to_XYZ_D50(e);e.colorNotation=xe.XYZ_D50,e.channels=x(n.channels),e.channels=normalizeAfterColorConversion(e.channels);break}case xe.XYZ_D65:{const n=colorData_to_XYZ_D65(e);e.colorNotation=xe.XYZ_D65,e.channels=u(n.channels),e.channels=normalizeAfterColorConversion(e.channels);break}default:throw new Error("Unsupported color notation")}return e}function carryForwardMissingComponentsForColorAndNotation(e,n,a,o){if(n===a)return carryForwardMissingComponents(o,[0,1,2],[],e.channels,[0,1,2],[]);if(Le.has(a)&&Le.has(n))return carryForwardMissingComponents(o,[0,1,2],[],e.channels,[0,1,2],[]);switch(a){case xe.HSL:switch(n){case xe.HWB:return carryForwardMissingComponents(o,[0],[1,2],e.channels,[0],[1,2]);case xe.Lab:case xe.OKLab:return carryForwardMissingComponents(o,[0],[1,2],e.channels,[2],[0,1]);case xe.LCH:case xe.OKLCH:return carryForwardMissingComponents(o,[0,1,2],[],e.channels,[2,1,0],[]);default:return carryForwardMissingComponents(o,[],[],e.channels,[],[])}case xe.HWB:switch(n){case xe.HSL:return carryForwardMissingComponents(o,[0],[1,2],e.channels,[0],[1,2]);case xe.LCH:case xe.OKLCH:return carryForwardMissingComponents(o,[2],[0,1],e.channels,[0],[1,2]);default:return carryForwardMissingComponents(o,[],[],e.channels,[],[])}case xe.Lab:case xe.OKLab:switch(n){case xe.HSL:return carryForwardMissingComponents(o,[2],[0,1],e.channels,[0],[1,2]);case xe.Lab:case xe.OKLab:return carryForwardMissingComponents(o,[0,1,2],[],e.channels,[0,1,2],[]);case xe.LCH:case xe.OKLCH:return carryForwardMissingComponents(o,[0],[1,2],e.channels,[0],[1,2]);default:return carryForwardMissingComponents(o,[],[],e.channels,[],[])}case xe.LCH:case xe.OKLCH:switch(n){case xe.HSL:return carryForwardMissingComponents(o,[0,1,2],[],e.channels,[2,1,0],[]);case xe.HWB:return carryForwardMissingComponents(o,[0],[1,2],e.channels,[2],[0,1]);case xe.Lab:case xe.OKLab:return carryForwardMissingComponents(o,[0],[1,2],e.channels,[0],[1,2]);case xe.LCH:case xe.OKLCH:return carryForwardMissingComponents(o,[0,1,2],[],e.channels,[0,1,2],[]);default:return carryForwardMissingComponents(o,[],[],e.channels,[],[])}default:return carryForwardMissingComponents(o,[],[],e.channels,[],[])}}function convertPowerlessComponentsToMissingComponents(e,n){const a=[...e];switch(n){case xe.HSL:(Number.isNaN(a[1])?0:a[1])<=.001&&(a[0]=Number.NaN,!Number.isNaN(a[1])&&a[1]>0&&(a[1]=0));break;case xe.HWB:Math.max(0,Number.isNaN(a[1])?0:a[1])+Math.max(0,Number.isNaN(a[2])?0:a[2])>=99.999&&(a[0]=Number.NaN,Math.max(0,Number.isNaN(a[1])?0:a[1])+Math.max(0,Number.isNaN(a[2])?0:a[2])<100&&(Number.isNaN(a[1])?a[2]=100:Number.isNaN(a[2])?a[1]=100:a[2]=100-a[1]));break;case xe.LCH:(Number.isNaN(a[1])?0:a[1])<=.0015&&(a[2]=Number.NaN,!Number.isNaN(a[1])&&a[1]>0&&(a[1]=0));break;case xe.OKLCH:(Number.isNaN(a[1])?0:a[1])<=4e-6&&(a[2]=Number.NaN,!Number.isNaN(a[1])&&a[1]>0&&(a[1]=0))}return a}function convertPowerlessComponentsToZeroValuesForDisplay(e,n){const a=[...e];switch(n){case xe.HSL:(Number.isNaN(a[1])?0:a[1])<=.001&&(a[0]=Number.NaN),(reducePrecision$1(a[2])<=0||reducePrecision$1(a[2])>=100)&&(a[0]=Number.NaN,a[1]=Number.NaN);break;case xe.HWB:Math.max(0,Number.isNaN(a[1])?0:a[1])+Math.max(0,Number.isNaN(a[2])?0:a[2])>=99.999&&(a[0]=Number.NaN);break;case xe.Lab:(reducePrecision$1(a[0])<=0||reducePrecision$1(a[0])>=100)&&(a[1]=Number.NaN,a[2]=Number.NaN);break;case xe.LCH:(Number.isNaN(a[1])?0:a[1])<=.0015&&(a[2]=Number.NaN),(reducePrecision$1(a[0])<=0||reducePrecision$1(a[0])>=100)&&(a[1]=Number.NaN,a[2]=Number.NaN);break;case xe.OKLab:(reducePrecision$1(a[0])<=0||reducePrecision$1(a[0])>=1)&&(a[1]=Number.NaN,a[2]=Number.NaN);break;case xe.OKLCH:(Number.isNaN(a[1])?0:a[1])<=4e-6&&(a[2]=Number.NaN),(reducePrecision$1(a[0])<=0||reducePrecision$1(a[0])>=1)&&(a[1]=Number.NaN,a[2]=Number.NaN)}return a}function carryForwardMissingComponents(e,n,a,o,r,t){if(n.length<3&&e.every(Number.isNaN))return[Number.NaN,Number.NaN,Number.NaN];const l=[...o];for(let a=0;aNumber.isNaN(e[n])))for(let e=0;ee<-1e-5||e>1.00001)}function colorDataFitsDisplayP3_Gamut(e){const n={...e,channels:[...e.channels]};n.channels=convertPowerlessComponentsToZeroValuesForDisplay(n.channels,n.colorNotation);return!colorDataToForRelativeColorSyntax(n,xe.Display_P3).channels.find(e=>e<-1e-5||e>1.00001)}const He=/[A-Z]/g;function toLowerCaseAZ(e){return e.replace(He,e=>String.fromCharCode(e.charCodeAt(0)+32))}function normalize_Color_ChannelValues(t,l,s){if(a(t)&&"none"===toLowerCaseAZ(t[4].value))return s.syntaxFlags.add(De.HasNoneKeywords),[e.Number,"none",t[2],t[3],{value:Number.NaN,type:n.Number}];if(o(t)){let a;return 3!==l&&s.syntaxFlags.add(De.HasPercentageValues),a=3===l?normalize(t[4].value,100,0,1):normalize(t[4].value,100,-2147483647,2147483647),[e.Number,a.toString(),t[2],t[3],{value:a,type:n.Number}]}if(r(t)){let a;return 3!==l&&s.syntaxFlags.add(De.HasNumberValues),a=3===l?normalize(t[4].value,1,0,1):normalize(t[4].value,1,-2147483647,2147483647),[e.Number,a.toString(),t[2],t[3],{value:a,type:n.Number}]}return!1}const Pe=new Set(["srgb","srgb-linear","display-p3","display-p3-linear","a98-rgb","prophoto-rgb","rec2020","xyz","xyz-d50","xyz-d65"]);function color$1(e,n){const o=[],s=[],c=[],i=[];let u,h,N=!1,m=!1;const p={colorNotation:xe.sRGB,channels:[0,0,0],alpha:1,syntaxFlags:new Set([])};let b=o;for(let r=0;r=0){t=i.value[4].value;continue}}return!1}if(!r)return!1;a.push({color:r,percentage:t}),r=!1,t=!1}}return!!r&&(a.push({color:r,percentage:t}),a)}function colorMixRectangular(e,n){if(!n||!n.length)return!1;for(const e of n)if(e.percentage&&(e.percentage<0||e.percentage>100))return!1;const{items:a,leftover:o}=normalizeMixPercentages(n,!0),r=1-o/100;let t;switch(e){case"srgb":t=xe.RGB;break;case"srgb-linear":t=xe.Linear_sRGB;break;case"display-p3":t=xe.Display_P3;break;case"display-p3-linear":t=xe.Linear_Display_P3;break;case"a98-rgb":t=xe.A98_RGB;break;case"prophoto-rgb":t=xe.ProPhoto_RGB;break;case"rec2020":t=xe.Rec2020;break;case"lab":t=xe.Lab;break;case"oklab":t=xe.OKLab;break;case"xyz-d50":t=xe.XYZ_D50;break;case"xyz":case"xyz-d65":t=xe.XYZ_D65;break;default:return!1}if(1===a.length){const e=colorDataToForInterpolation(a[0].color,t);return e.colorNotation=t,e.syntaxFlags.add(De.ColorMixVariadic),e.syntaxFlags.add(De.ColorMix),"number"!=typeof e.alpha?!1:(e.alpha=e.alpha*r,e)}for(a.reverse();a.length>=2;){const e=a.pop(),n=a.pop();if(!e||!n)return!1;const o=e.percentage+n.percentage,r=o>0?n.percentage/o:.5,l=colorMixRectangularPair(t,e.color,n.color,r);if(!l)return!1;a.push({color:l,percentage:o})}const l=a[0]?.color;return!!l&&("number"==typeof l.alpha&&(l.alpha=l.alpha*r,n.some(e=>e.color.syntaxFlags.has(De.Experimental))&&l.syntaxFlags.add(De.Experimental),2!==n.length&&l.syntaxFlags.add(De.ColorMixVariadic),l))}function colorMixRectangularPair(e,n,a,o){let r=n.alpha;if("number"!=typeof r)return!1;let t=a.alpha;if("number"!=typeof t)return!1;r=Number.isNaN(r)?t:r,t=Number.isNaN(t)?r:t;const l=colorDataToForInterpolation(n,e).channels,s=colorDataToForInterpolation(a,e).channels;l[0]=fillInMissingComponent(l[0],s[0]),s[0]=fillInMissingComponent(s[0],l[0]),l[1]=fillInMissingComponent(l[1],s[1]),s[1]=fillInMissingComponent(s[1],l[1]),l[2]=fillInMissingComponent(l[2],s[2]),s[2]=fillInMissingComponent(s[2],l[2]),l[0]=premultiply(l[0],r),l[1]=premultiply(l[1],r),l[2]=premultiply(l[2],r),s[0]=premultiply(s[0],t),s[1]=premultiply(s[1],t),s[2]=premultiply(s[2],t);const c=interpolate(r,t,o);return{colorNotation:e,channels:[un_premultiply(interpolate(l[0],s[0],o),c),un_premultiply(interpolate(l[1],s[1],o),c),un_premultiply(interpolate(l[2],s[2],o),c)],alpha:c,syntaxFlags:new Set([De.ColorMix])}}function colorMixPolar(e,n,a){if(!a||!a.length)return!1;for(const e of a)if(e.percentage&&(e.percentage<0||e.percentage>100))return!1;const{items:o,leftover:r}=normalizeMixPercentages(a,!0),t=1-r/100;let l;switch(e){case"hsl":l=xe.HSL;break;case"hwb":l=xe.HWB;break;case"lch":l=xe.LCH;break;case"oklch":l=xe.OKLCH;break;default:return!1}if(1===o.length){const e=colorDataToForInterpolation(o[0].color,l);return e.colorNotation=l,e.syntaxFlags.add(De.ColorMixVariadic),e.syntaxFlags.add(De.ColorMix),"number"!=typeof e.alpha?!1:(e.alpha=e.alpha*t,e)}for(o.reverse();o.length>=2;){const e=o.pop(),a=o.pop();if(!e||!a)return!1;const r=e.percentage+a.percentage,t=r>0?a.percentage/r:.5,s=colorMixPolarPair(l,n,e.color,a.color,t);if(!s)return!1;o.push({color:s,percentage:r})}const s=o[0]?.color;return!!s&&("number"==typeof s.alpha&&(s.alpha=s.alpha*t,a.some(e=>e.color.syntaxFlags.has(De.Experimental))&&s.syntaxFlags.add(De.Experimental),2!==a.length&&s.syntaxFlags.add(De.ColorMixVariadic),s))}function colorMixPolarPair(e,n,a,o,r){let t=0,l=0,s=0,c=0,i=0,u=0,h=a.alpha;if("number"!=typeof h)return!1;let N=o.alpha;if("number"!=typeof N)return!1;h=Number.isNaN(h)?N:h,N=Number.isNaN(N)?h:N;const m=colorDataToForInterpolation(a,e).channels,p=colorDataToForInterpolation(o,e).channels;switch(e){case xe.HSL:case xe.HWB:t=m[0],l=p[0],s=m[1],c=p[1],i=m[2],u=p[2];break;case xe.LCH:case xe.OKLCH:s=m[0],c=p[0],i=m[1],u=p[1],t=m[2],l=p[2]}if(s=fillInMissingComponent(s,c),c=fillInMissingComponent(c,s),i=fillInMissingComponent(i,u),u=fillInMissingComponent(u,i),t=fillInMissingComponent(t,l),l=fillInMissingComponent(l,t),Number.isNaN(t)&&Number.isNaN(l));else{const e=l-t;switch(n){case"shorter":e>180?t+=360:e<-180&&(l+=360);break;case"longer":-1800?t+=360:l+=360);break;case"increasing":e<0&&(l+=360);break;case"decreasing":e>0&&(t+=360);break;default:throw new Error("Unknown hue interpolation method")}}s=premultiply(s,h),i=premultiply(i,h),c=premultiply(c,N),u=premultiply(u,N);let b=[0,0,0];const v=interpolate(h,N,r);switch(e){case xe.HSL:case xe.HWB:b=[interpolate(t,l,r),un_premultiply(interpolate(s,c,r),v),un_premultiply(interpolate(i,u,r),v)];break;case xe.LCH:case xe.OKLCH:b=[un_premultiply(interpolate(s,c,r),v),un_premultiply(interpolate(i,u,r),v),interpolate(t,l,r)]}return{colorNotation:e,channels:b,alpha:v,syntaxFlags:new Set([De.ColorMix])}}function fillInMissingComponent(e,n){return Number.isNaN(e)?n:e}function interpolate(e,n,a){return e*(1-a)+n*a}function premultiply(e,n){return Number.isNaN(n)?e:Number.isNaN(e)?Number.NaN:e*n}function un_premultiply(e,n){return 0===n||Number.isNaN(n)?e:Number.isNaN(e)?Number.NaN:e/n}function normalizeMixPercentages(e,n=!1){let a=0,o=0;for(const n of e)n.percentage&&(a+=n.percentage),!1===n.percentage&&o++;a=Math.min(100,a);for(const n of e)!1===n.percentage&&(n.percentage=(100-a)/o);const r=e.slice();let t=0;for(const e of r)t+=e.percentage;if(t>100||t>0&&n)for(const e of r)e.percentage=e.percentage*(100/t);let l=0;return t<100&&(l=100-t),{items:r,leftover:l}}function hex(e){const n=toLowerCaseAZ(e[4].value);if(n.match(/[^a-f0-9]/))return!1;const a={colorNotation:xe.HEX,channels:[0,0,0],alpha:1,syntaxFlags:new Set([De.Hex])},o=n.length;if(3===o){const e=n[0],o=n[1],r=n[2];return a.channels=[parseInt(e+e,16)/255,parseInt(o+o,16)/255,parseInt(r+r,16)/255],a}if(6===o){const e=n[0]+n[1],o=n[2]+n[3],r=n[4]+n[5];return a.channels=[parseInt(e,16)/255,parseInt(o,16)/255,parseInt(r,16)/255],a}if(4===o){const e=n[0],o=n[1],r=n[2],t=n[3];return a.channels=[parseInt(e+e,16)/255,parseInt(o+o,16)/255,parseInt(r+r,16)/255],a.alpha=parseInt(t+t,16)/255,a.syntaxFlags.add(De.HasAlpha),a}if(8===o){const e=n[0]+n[1],o=n[2]+n[3],r=n[4]+n[5],t=n[6]+n[7];return a.channels=[parseInt(e,16)/255,parseInt(o,16)/255,parseInt(r,16)/255],a.alpha=parseInt(t,16)/255,a.syntaxFlags.add(De.HasAlpha),a}return!1}function normalizeHue$1(a){if(r(a))return Number.isNaN(a[4].value)||Number.isFinite(a[4].value)||(a[4].value=0),a[4].value=a[4].value%360,a[4].value<0&&(a[4].value+=360),a[1]=a[4].value.toString(),a;if(c(a)){let o=a[4].value;switch(toLowerCaseAZ(a[4].unit)){case"deg":break;case"rad":o=180*a[4].value/Math.PI;break;case"grad":o=.9*a[4].value;break;case"turn":o=360*a[4].value;break;default:return!1}return Number.isNaN(a[4].value)||Number.isFinite(a[4].value)||(a[4].value=0),o%=360,o<0&&(o+=360),[e.Number,o.toString(),a[2],a[3],{value:o,type:n.Number}]}return!1}function normalize_legacy_HSL_ChannelValues(a,t,l){if(0===t){const e=normalizeHue$1(a);return!1!==e&&(c(a)&&l.syntaxFlags.add(De.HasDimensionValues),e)}if(o(a)){let o;return 3===t?l.syntaxFlags.add(De.HasPercentageAlpha):l.syntaxFlags.add(De.HasPercentageValues),o=3===t?normalize(a[4].value,100,0,1):normalize(a[4].value,1,0,100),[e.Number,o.toString(),a[2],a[3],{value:o,type:n.Number}]}if(r(a)){if(3!==t)return!1;let o;return o=normalize(a[4].value,1,0,3===t?1:100),[e.Number,o.toString(),a[2],a[3],{value:o,type:n.Number}]}return!1}function normalize_modern_HSL_ChannelValues(t,l,s){if(a(t)&&"none"===toLowerCaseAZ(t[4].value))return s.syntaxFlags.add(De.HasNoneKeywords),[e.Number,"none",t[2],t[3],{value:Number.NaN,type:n.Number}];if(0===l){const e=normalizeHue$1(t);return!1!==e&&(c(t)&&s.syntaxFlags.add(De.HasDimensionValues),e)}if(o(t)){let a;return 3===l?s.syntaxFlags.add(De.HasPercentageAlpha):s.syntaxFlags.add(De.HasPercentageValues),a=3===l?normalize(t[4].value,100,0,1):normalize(t[4].value,1,1===l?0:-2147483647,2147483647),[e.Number,a.toString(),t[2],t[3],{value:a,type:n.Number}]}if(r(t)){let a;return 3!==l&&s.syntaxFlags.add(De.HasNumberValues),a=3===l?normalize(t[4].value,1,0,1):normalize(t[4].value,1,1===l?0:-2147483647,2147483647),[e.Number,a.toString(),t[2],t[3],{value:a,type:n.Number}]}return!1}function threeChannelLegacySyntax(e,n,a,o){const t=[],c=[],i=[],u=[],h={colorNotation:a,channels:[0,0,0],alpha:1,syntaxFlags:new Set(o)};let N=t;for(let n=0;nve(e)&&s(e.value))){const n=hslCommaSeparated(e);if(!1!==n)return n}{const a=hslSpaceSeparated(e,n);if(!1!==a)return a}return!1}function hslCommaSeparated(e){return threeChannelLegacySyntax(e,normalize_legacy_HSL_ChannelValues,xe.HSL,[De.LegacyHSL])}function hslSpaceSeparated(e,n){return threeChannelSpaceSeparated(e,normalize_modern_HSL_ChannelValues,xe.HSL,[],n)}function normalize_HWB_ChannelValues(t,l,s){if(a(t)&&"none"===toLowerCaseAZ(t[4].value))return s.syntaxFlags.add(De.HasNoneKeywords),[e.Number,"none",t[2],t[3],{value:Number.NaN,type:n.Number}];if(0===l){const e=normalizeHue$1(t);return!1!==e&&(c(t)&&s.syntaxFlags.add(De.HasDimensionValues),e)}if(o(t)){let a;return 3===l?s.syntaxFlags.add(De.HasPercentageAlpha):s.syntaxFlags.add(De.HasPercentageValues),a=3===l?normalize(t[4].value,100,0,1):normalize(t[4].value,1,-2147483647,2147483647),[e.Number,a.toString(),t[2],t[3],{value:a,type:n.Number}]}if(r(t)){let a;return 3!==l&&s.syntaxFlags.add(De.HasNumberValues),a=3===l?normalize(t[4].value,1,0,1):normalize(t[4].value,1,-2147483647,2147483647),[e.Number,a.toString(),t[2],t[3],{value:a,type:n.Number}]}return!1}function normalize_Lab_ChannelValues(t,l,s){if(a(t)&&"none"===toLowerCaseAZ(t[4].value))return s.syntaxFlags.add(De.HasNoneKeywords),[e.Number,"none",t[2],t[3],{value:Number.NaN,type:n.Number}];if(o(t)){let a;return 3!==l&&s.syntaxFlags.add(De.HasPercentageValues),a=1===l||2===l?normalize(t[4].value,.8,-2147483647,2147483647):3===l?normalize(t[4].value,100,0,1):normalize(t[4].value,1,0,100),[e.Number,a.toString(),t[2],t[3],{value:a,type:n.Number}]}if(r(t)){let a;return 3!==l&&s.syntaxFlags.add(De.HasNumberValues),a=1===l||2===l?normalize(t[4].value,1,-2147483647,2147483647):normalize(t[4].value,1,0,3===l?1:100),[e.Number,a.toString(),t[2],t[3],{value:a,type:n.Number}]}return!1}function lab(e,n){return threeChannelSpaceSeparated(e,normalize_Lab_ChannelValues,xe.Lab,[],n)}function normalize_LCH_ChannelValues(t,l,s){if(a(t)&&"none"===toLowerCaseAZ(t[4].value))return s.syntaxFlags.add(De.HasNoneKeywords),[e.Number,"none",t[2],t[3],{value:Number.NaN,type:n.Number}];if(2===l){const e=normalizeHue$1(t);return!1!==e&&(c(t)&&s.syntaxFlags.add(De.HasDimensionValues),e)}if(o(t)){let a;return 3!==l&&s.syntaxFlags.add(De.HasPercentageValues),a=1===l?normalize(t[4].value,100/150,0,2147483647):3===l?normalize(t[4].value,100,0,1):normalize(t[4].value,1,0,100),[e.Number,a.toString(),t[2],t[3],{value:a,type:n.Number}]}if(r(t)){let a;return 3!==l&&s.syntaxFlags.add(De.HasNumberValues),a=normalize(t[4].value,1,0,1===l?2147483647:3===l?1:100),[e.Number,a.toString(),t[2],t[3],{value:a,type:n.Number}]}return!1}function lch(e,n){return threeChannelSpaceSeparated(e,normalize_LCH_ChannelValues,xe.LCH,[],n)}const Fe=new Map;for(const[e,n]of Object.entries(Q))Fe.set(e,n);function namedColor(e){const n=Fe.get(toLowerCaseAZ(e));return!!n&&{colorNotation:xe.RGB,channels:[n[0]/255,n[1]/255,n[2]/255],alpha:1,syntaxFlags:new Set([De.ColorKeyword,De.NamedColor])}}function normalize_OKLab_ChannelValues(t,l,s){if(a(t)&&"none"===toLowerCaseAZ(t[4].value))return s.syntaxFlags.add(De.HasNoneKeywords),[e.Number,"none",t[2],t[3],{value:Number.NaN,type:n.Number}];if(o(t)){let a;return 3!==l&&s.syntaxFlags.add(De.HasPercentageValues),a=1===l||2===l?normalize(t[4].value,250,-2147483647,2147483647):normalize(t[4].value,100,0,1),[e.Number,a.toString(),t[2],t[3],{value:a,type:n.Number}]}if(r(t)){let a;return 3!==l&&s.syntaxFlags.add(De.HasNumberValues),a=1===l||2===l?normalize(t[4].value,1,-2147483647,2147483647):normalize(t[4].value,1,0,1),[e.Number,a.toString(),t[2],t[3],{value:a,type:n.Number}]}return!1}function oklab(e,n){return threeChannelSpaceSeparated(e,normalize_OKLab_ChannelValues,xe.OKLab,[],n)}function normalize_OKLCH_ChannelValues(t,l,s){if(a(t)&&"none"===toLowerCaseAZ(t[4].value))return s.syntaxFlags.add(De.HasNoneKeywords),[e.Number,"none",t[2],t[3],{value:Number.NaN,type:n.Number}];if(2===l){const e=normalizeHue$1(t);return!1!==e&&(c(t)&&s.syntaxFlags.add(De.HasDimensionValues),e)}if(o(t)){let a;return 3!==l&&s.syntaxFlags.add(De.HasPercentageValues),a=1===l?normalize(t[4].value,250,0,2147483647):normalize(t[4].value,100,0,1),[e.Number,a.toString(),t[2],t[3],{value:a,type:n.Number}]}if(r(t)){let a;return 3!==l&&s.syntaxFlags.add(De.HasNumberValues),a=normalize(t[4].value,1,0,1===l?2147483647:1),[e.Number,a.toString(),t[2],t[3],{value:a,type:n.Number}]}return!1}function oklch(e,n){return threeChannelSpaceSeparated(e,normalize_OKLCH_ChannelValues,xe.OKLCH,[],n)}function normalize_legacy_sRGB_ChannelValues(a,t,l){if(o(a)){3===t?l.syntaxFlags.add(De.HasPercentageAlpha):l.syntaxFlags.add(De.HasPercentageValues);const o=normalize(a[4].value,100,0,1);return[e.Number,o.toString(),a[2],a[3],{value:o,type:n.Number}]}if(r(a)){let o;return 3!==t&&l.syntaxFlags.add(De.HasNumberValues),o=normalize(a[4].value,3===t?1:255,0,1),[e.Number,o.toString(),a[2],a[3],{value:o,type:n.Number}]}return!1}function normalize_modern_sRGB_ChannelValues(t,l,s){if(a(t)&&"none"===t[4].value.toLowerCase())return s.syntaxFlags.add(De.HasNoneKeywords),[e.Number,"none",t[2],t[3],{value:Number.NaN,type:n.Number}];if(o(t)){let a;return 3!==l&&s.syntaxFlags.add(De.HasPercentageValues),a=3===l?normalize(t[4].value,100,0,1):normalize(t[4].value,100,-2147483647,2147483647),[e.Number,a.toString(),t[2],t[3],{value:a,type:n.Number}]}if(r(t)){let a;return 3!==l&&s.syntaxFlags.add(De.HasNumberValues),a=3===l?normalize(t[4].value,1,0,1):normalize(t[4].value,255,-2147483647,2147483647),[e.Number,a.toString(),t[2],t[3],{value:a,type:n.Number}]}return!1}function rgb(e,n){if(e.value.some(e=>ve(e)&&s(e.value))){const n=rgbCommaSeparated(e);if(!1!==n)return(!n.syntaxFlags.has(De.HasNumberValues)||!n.syntaxFlags.has(De.HasPercentageValues))&&n}else{const a=rgbSpaceSeparated(e,n);if(!1!==a)return a}return!1}function rgbCommaSeparated(e){return threeChannelLegacySyntax(e,normalize_legacy_sRGB_ChannelValues,xe.RGB,[De.LegacyRGB])}function rgbSpaceSeparated(e,n){return threeChannelSpaceSeparated(e,normalize_modern_sRGB_ChannelValues,xe.RGB,[],n)}function XYZ_D65_to_sRGB_Gamut(e){const n=B(e);if(ee(n))return ne(n);let a=e;return a=L(a),a[0]<1e-6&&(a=[0,0,0]),a[0]>.999999&&(a=[1,0,0]),ae(oe(a,oklch_to_lin_srgb,lin_srgb_to_oklch))}function oklch_to_lin_srgb(e){return e=re(e),e=te(e),le(e)}function lin_srgb_to_oklch(e){return e=se(e),e=ce(e),ie(e)}function contrastColor(e,n){let a=!1;for(let o=0;ot?[1,1,1]:[0,0,0],o}function alpha(e,n){let o,s,c=!1,i=!1,u=!1;const h={colorNotation:xe.sRGB,channels:[0,0,0],alpha:1,syntaxFlags:new Set([])};for(let N=0;N{if(ve(e)&&a(e.value)&&"alpha"===toLowerCaseAZ(e.value[4].value)&&o&&o.has("alpha"))return new ge(o.get("alpha"))});h.alpha=e[0][0],i=!0;continue}return!1}if(u)return!1;for(;pe(e.value[N+1])||be(e.value[N+1]);)N++;if(N++,m=e.value[N],u=n(m),!1===u)return!1;o=normalizeRelativeColorDataChannels(u),s=noneToZeroInRelativeColorDataChannels(o),h.syntaxFlags=new Set(u.syntaxFlags),h.syntaxFlags.add(De.RelativeAlphaSyntax),h.channels=[...u.channels],h.colorNotation=u.colorNotation,h.alpha=u.alpha}}return!!o&&(!!i&&h)}function XYZ_D65_to_P3_Gamut(e){const n=R(e);if(ee(n))return ne(n);let a=e;return a=L(a),a[0]<1e-6&&(a=[0,0,0]),a[0]>.999999&&(a=[1,0,0]),he(oe(a,oklch_to_lin_p3,lin_p3_to_oklch))}function oklch_to_lin_p3(e){return e=re(e),e=te(e),Ne(e)}function lin_p3_to_oklch(e){return e=me(e),e=ce(e),ie(e)}function toPrecision(e,n=7){e=+e,n=+n;const a=(Math.floor(Math.abs(e))+"").length;if(n>a)return+e.toFixed(n-a);{const o=10**(a-n);return Math.round(e/o)*o}}function serializeWithAlpha(a,o,r,t){const l=[e.CloseParen,")",-1,-1,void 0];if("number"==typeof a.alpha){const s=Math.min(1,Math.max(0,toPrecision(Number.isNaN(a.alpha)?0:a.alpha)));return 1===toPrecision(s,4)?new _e(o,l,t):new _e(o,l,[...t,new Ce([r]),new ge([e.Delim,"/",-1,-1,{value:"/"}]),new Ce([r]),new ge([e.Number,toPrecision(s,4).toString(),-1,-1,{value:a.alpha,type:n.Integer}])])}return new _e(o,l,[...t,new Ce([r]),new ge([e.Delim,"/",-1,-1,{value:"/"}]),new Ce([r]),a.alpha])}function serializeP3(a,o=!0){a.channels=convertPowerlessComponentsToZeroValuesForDisplay(a.channels,a.colorNotation);let r=a.channels.map(e=>Number.isNaN(e)?0:e);o?r=XYZ_D65_to_P3_Gamut(colorData_to_XYZ_D65(a).channels):a.colorNotation!==xe.Display_P3&&(r=R(colorData_to_XYZ_D65(a).channels));const t=o?Math.min(1,Math.max(0,toPrecision(r[0],6))):toPrecision(r[0],6),l=o?Math.min(1,Math.max(0,toPrecision(r[1],6))):toPrecision(r[1],6),s=o?Math.min(1,Math.max(0,toPrecision(r[2],6))):toPrecision(r[2],6),c=[e.Function,"color(",-1,-1,{value:"color"}],i=[e.Whitespace," ",-1,-1,void 0];return serializeWithAlpha(a,c,i,[new ge([e.Ident,"display-p3",-1,-1,{value:"display-p3"}]),new Ce([i]),new ge([e.Number,t.toString(),-1,-1,{value:r[0],type:n.Number}]),new Ce([i]),new ge([e.Number,l.toString(),-1,-1,{value:r[1],type:n.Number}]),new Ce([i]),new ge([e.Number,s.toString(),-1,-1,{value:r[2],type:n.Number}])])}function serializeRGB(a,o=!0){let r;a.channels=convertPowerlessComponentsToZeroValuesForDisplay(a.channels,a.colorNotation),r=o?XYZ_D65_to_sRGB_Gamut(colorData_to_XYZ_D65(a).channels):B(colorData_to_XYZ_D65(a).channels);const t=Math.min(255,Math.max(0,Math.round(255*toPrecision(r[0])))),l=Math.min(255,Math.max(0,Math.round(255*toPrecision(r[1])))),s=Math.min(255,Math.max(0,Math.round(255*toPrecision(r[2])))),c=[e.CloseParen,")",-1,-1,void 0],i=[e.Whitespace," ",-1,-1,void 0],u=[e.Comma,",",-1,-1,void 0],h=[new ge([e.Number,t.toString(),-1,-1,{value:Math.min(255,255*Math.max(0,r[0])),type:n.Integer}]),new ge(u),new Ce([i]),new ge([e.Number,l.toString(),-1,-1,{value:Math.min(255,255*Math.max(0,r[1])),type:n.Integer}]),new ge(u),new Ce([i]),new ge([e.Number,s.toString(),-1,-1,{value:Math.min(255,255*Math.max(0,r[2])),type:n.Integer}])];if("number"==typeof a.alpha){const o=Math.min(1,Math.max(0,toPrecision(Number.isNaN(a.alpha)?0:a.alpha)));return 1===toPrecision(o,4)?new _e([e.Function,"rgb(",-1,-1,{value:"rgb"}],c,h):new _e([e.Function,"rgba(",-1,-1,{value:"rgba"}],c,[...h,new ge(u),new Ce([i]),new ge([e.Number,toPrecision(o,4).toString(),-1,-1,{value:a.alpha,type:n.Number}])])}return new _e([e.Function,"rgba(",-1,-1,{value:"rgba"}],c,[...h,new ge(u),new Ce([i]),a.alpha])}function serializeHSL(a,o=!0){let r;a.channels=convertPowerlessComponentsToZeroValuesForDisplay(a.channels,a.colorNotation),r=M(o?w(XYZ_D65_to_sRGB_Gamut(colorData_to_XYZ_D65(a).channels)):colorData_to_XYZ_D65(a).channels),r=r.map(e=>Number.isNaN(e)?0:e);const t=Math.min(360,Math.max(0,Math.round(toPrecision(r[0]))))%360,l=Math.min(100,Math.max(0,Math.round(toPrecision(r[1])))),s=Math.min(100,Math.max(0,Math.round(toPrecision(r[2])))),c=[e.CloseParen,")",-1,-1,void 0],i=[e.Whitespace," ",-1,-1,void 0],u=[e.Comma,",",-1,-1,void 0],h=[new ge([e.Number,t.toString(),-1,-1,{value:r[0],type:n.Integer}]),new ge(u),new Ce([i]),new ge([e.Percentage,l.toString()+"%",-1,-1,{value:r[1]}]),new ge(u),new Ce([i]),new ge([e.Percentage,s.toString()+"%",-1,-1,{value:r[2]}])];if("number"==typeof a.alpha){const o=Math.min(1,Math.max(0,toPrecision(Number.isNaN(a.alpha)?0:a.alpha)));return 1===toPrecision(o,4)?new _e([e.Function,"hsl(",-1,-1,{value:"hsl"}],c,h):new _e([e.Function,"hsla(",-1,-1,{value:"hsla"}],c,[...h,new ge(u),new Ce([i]),new ge([e.Number,toPrecision(o,4).toString(),-1,-1,{value:a.alpha,type:n.Number}])])}return new _e([e.Function,"hsla(",-1,-1,{value:"hsla"}],c,[...h,new ge(u),new Ce([i]),a.alpha])}function serializeOKLCH(a){a.channels=convertPowerlessComponentsToZeroValuesForDisplay(a.channels,a.colorNotation);let o=a.channels.map(e=>Number.isNaN(e)?0:e);a.colorNotation!==xe.OKLCH&&(o=L(colorData_to_XYZ_D65(a).channels));const r=toPrecision(o[0],6),t=toPrecision(o[1],6),l=toPrecision(o[2],6),s=[e.Function,"oklch(",-1,-1,{value:"oklch"}],c=[e.Whitespace," ",-1,-1,void 0];return serializeWithAlpha(a,s,c,[new ge([e.Number,r.toString(),-1,-1,{value:o[0],type:n.Number}]),new Ce([c]),new ge([e.Number,t.toString(),-1,-1,{value:o[1],type:n.Number}]),new Ce([c]),new ge([e.Number,l.toString(),-1,-1,{value:o[2],type:n.Number}])])}function computedValue(e,n=!0){const a=e.channels;switch(e.colorNotation){case xe.Lab:return a[0]=nanToNone(a[0]),a[1]=nanToNone(a[1]),a[2]=nanToNone(a[2]),1!==e.alpha?`lab(${a[0]} ${a[1]} ${a[2]} / ${nanToNone(e.alpha)})`:`lab(${a[0]} ${a[1]} ${a[2]})`;case xe.LCH:return a[0]=nanToNone(a[0]),a[1]=nanToNone(a[1]),a[2]=nanToNone(normalizeHue(a[2])),1!==e.alpha?`lch(${a[0]} ${a[1]} ${a[2]} / ${nanToNone(e.alpha)})`:`lch(${a[0]} ${a[1]} ${a[2]})`;case xe.OKLab:return a[0]=nanToNone(a[0]),a[1]=nanToNone(a[1]),a[2]=nanToNone(a[2]),1!==e.alpha?`oklab(${a[0]} ${a[1]} ${a[2]} / ${nanToNone(e.alpha)})`:`oklab(${a[0]} ${a[1]} ${a[2]})`;case xe.OKLCH:return a[0]=nanToNone(a[0]),a[1]=nanToNone(a[1]),a[2]=nanToNone(normalizeHue(a[2])),1!==e.alpha?`oklch(${a[0]} ${a[1]} ${a[2]} / ${nanToNone(e.alpha)})`:`oklch(${a[0]} ${a[1]} ${a[2]})`;case xe.RGB:case xe.HEX:return a.some(Number.isNaN)||Number.isNaN(e.alpha)?1!==e.alpha?`color(srgb ${nanToNone(a[0])} ${nanToNone(a[1])} ${nanToNone(a[2])} / ${nanToNone(e.alpha)})`:`color(srgb ${nanToNone(a[0])} ${nanToNone(a[1])} ${nanToNone(a[2])})`:e.syntaxFlags.has(De.RelativeColorSyntax)||e.syntaxFlags.has(De.ColorMix)||e.syntaxFlags.has(De.RelativeAlphaSyntax)?computedValue(colorDataToForRelativeColorSyntax(e,xe.sRGB)):1!==e.alpha?`rgba(${nanToNone(Math.round(255*reducePrecision(e.channels[0],5)))}, ${nanToNone(Math.round(255*reducePrecision(e.channels[1],5)))}, ${nanToNone(Math.round(255*reducePrecision(e.channels[2],5)))}, ${nanToNone(e.alpha)})`:`rgb(${nanToNone(Math.round(255*reducePrecision(e.channels[0],5)))}, ${nanToNone(Math.round(255*reducePrecision(e.channels[1],5)))}, ${nanToNone(Math.round(255*reducePrecision(e.channels[2],5)))})`;case xe.HSL:{if(a.some(Number.isNaN)||Number.isNaN(e.alpha)||!1===n)return 1!==e.alpha?`hsl(${nanToNone(normalizeHue(a[0]))} ${nanToNone(a[1],"%")} ${nanToNone(a[2],"%")} / ${nanToNone(e.alpha)})`:`hsl(${nanToNone(normalizeHue(a[0]))} ${nanToNone(a[1],"%")} ${nanToNone(a[2],"%")})`;if(e.syntaxFlags.has(De.RelativeColorSyntax)||e.syntaxFlags.has(De.ColorMix)||e.syntaxFlags.has(De.RelativeAlphaSyntax))return computedValue(colorDataToForRelativeColorSyntax(e,xe.sRGB));const o=colorDataToForRelativeColorSyntax(e,xe.RGB);return 1!==o.alpha?`rgba(${nanToNone(Math.round(255*reducePrecision(o.channels[0],5)))}, ${nanToNone(Math.round(255*reducePrecision(o.channels[1],5)))}, ${nanToNone(Math.round(255*reducePrecision(o.channels[2],5)))}, ${nanToNone(o.alpha)})`:`rgb(${nanToNone(Math.round(255*reducePrecision(o.channels[0],5)))}, ${nanToNone(Math.round(255*reducePrecision(o.channels[1],5)))}, ${nanToNone(Math.round(255*reducePrecision(o.channels[2],5)))})`}case xe.HWB:{if(a.some(Number.isNaN)||Number.isNaN(e.alpha)||!1===n)return 1!==e.alpha?`hwb(${nanToNone(normalizeHue(a[0]))} ${nanToNone(a[1],"%")} ${nanToNone(a[2],"%")} / ${nanToNone(e.alpha)})`:`hwb(${nanToNone(normalizeHue(a[0]))} ${nanToNone(a[1],"%")} ${nanToNone(a[2],"%")})`;if(e.syntaxFlags.has(De.RelativeColorSyntax)||e.syntaxFlags.has(De.ColorMix)||e.syntaxFlags.has(De.RelativeAlphaSyntax))return computedValue(colorDataToForRelativeColorSyntax(e,xe.sRGB));const o=colorDataToForRelativeColorSyntax(e,xe.RGB);return 1!==o.alpha?`rgba(${nanToNone(Math.round(255*reducePrecision(o.channels[0],5)))}, ${nanToNone(Math.round(255*reducePrecision(o.channels[1],5)))}, ${nanToNone(Math.round(255*reducePrecision(o.channels[2],5)))}, ${nanToNone(o.alpha)})`:`rgb(${nanToNone(Math.round(255*reducePrecision(o.channels[0],5)))}, ${nanToNone(Math.round(255*reducePrecision(o.channels[1],5)))}, ${nanToNone(Math.round(255*reducePrecision(o.channels[2],5)))})`}case xe.sRGB:return 1!==e.alpha?`color(srgb ${nanToNone(a[0])} ${nanToNone(a[1])} ${nanToNone(a[2])} / ${nanToNone(e.alpha)})`:`color(srgb ${nanToNone(a[0])} ${nanToNone(a[1])} ${nanToNone(a[2])})`;case xe.Linear_sRGB:return 1!==e.alpha?`color(srgb-linear ${nanToNone(a[0])} ${nanToNone(a[1])} ${nanToNone(a[2])} / ${nanToNone(e.alpha)})`:`color(srgb-linear ${nanToNone(a[0])} ${nanToNone(a[1])} ${nanToNone(a[2])})`;case xe.Display_P3:return 1!==e.alpha?`color(display-p3 ${nanToNone(a[0])} ${nanToNone(a[1])} ${nanToNone(a[2])} / ${nanToNone(e.alpha)})`:`color(display-p3 ${nanToNone(a[0])} ${nanToNone(a[1])} ${nanToNone(a[2])})`;case xe.Linear_Display_P3:return 1!==e.alpha?`color(display-p3-linear ${nanToNone(a[0])} ${nanToNone(a[1])} ${nanToNone(a[2])} / ${nanToNone(e.alpha)})`:`color(display-p3-linear ${nanToNone(a[0])} ${nanToNone(a[1])} ${nanToNone(a[2])})`;case xe.A98_RGB:return 1!==e.alpha?`color(a98-rgb ${nanToNone(a[0])} ${nanToNone(a[1])} ${nanToNone(a[2])} / ${nanToNone(e.alpha)})`:`color(a98-rgb ${nanToNone(a[0])} ${nanToNone(a[1])} ${nanToNone(a[2])})`;case xe.ProPhoto_RGB:return 1!==e.alpha?`color(prophoto-rgb ${nanToNone(a[0])} ${nanToNone(a[1])} ${nanToNone(a[2])} / ${nanToNone(e.alpha)})`:`color(prophoto-rgb ${nanToNone(a[0])} ${nanToNone(a[1])} ${nanToNone(a[2])})`;case xe.Rec2020:return 1!==e.alpha?`color(rec2020 ${nanToNone(a[0])} ${nanToNone(a[1])} ${nanToNone(a[2])} / ${nanToNone(e.alpha)})`:`color(rec2020 ${nanToNone(a[0])} ${nanToNone(a[1])} ${nanToNone(a[2])})`;case xe.XYZ_D65:return 1!==e.alpha?`color(xyz-d65 ${nanToNone(a[0])} ${nanToNone(a[1])} ${nanToNone(a[2])} / ${nanToNone(e.alpha)})`:`color(xyz-d65 ${nanToNone(a[0])} ${nanToNone(a[1])} ${nanToNone(a[2])})`;case xe.XYZ_D50:return 1!==e.alpha?`color(xyz-d50 ${nanToNone(a[0])} ${nanToNone(a[1])} ${nanToNone(a[2])} / ${nanToNone(e.alpha)})`:`color(xyz-d50 ${nanToNone(a[0])} ${nanToNone(a[1])} ${nanToNone(a[2])})`}throw new Error("unsupported color")}function nanToNone(e,n=""){return"string"==typeof e?e:"number"!=typeof e?e.toString():Number.isNaN(e)?"none":n?e.toString()+n:e.toString()}function normalizeHue(e){return"number"!=typeof e||Number.isNaN(e)?e:e%360}function reducePrecision(e,n=8){return Number.isNaN(e)||!Number.isFinite(e)?e:(n=Math.pow(10,n),Math.round(e*n)/n)}function color(e){if(fe(e)){switch(toLowerCaseAZ(e.getName())){case"rgb":case"rgba":return rgb(e,color);case"hsl":case"hsla":return hsl(e,color);case"hwb":return n=color,threeChannelSpaceSeparated(e,normalize_HWB_ChannelValues,xe.HWB,[],n);case"lab":return lab(e,color);case"lch":return lch(e,color);case"oklab":return oklab(e,color);case"oklch":return oklch(e,color);case"color":return color$1(e,color);case"color-mix":return colorMix(e,color);case"contrast-color":return contrastColor(e,color);case"alpha":return alpha(e,color)}}var n;if(ve(e)){if(i(e.value))return hex(e.value);if(a(e.value)){const n=namedColor(e.value[4].value);return!1!==n?n:"transparent"===toLowerCaseAZ(e.value[4].value)&&{colorNotation:xe.RGB,channels:[0,0,0],alpha:0,syntaxFlags:new Set([De.ColorKeyword])}}}return!1}export{xe as ColorNotation,De as SyntaxFlag,color,colorDataFitsDisplayP3_Gamut,colorDataFitsRGB_Gamut,computedValue,serializeHSL,serializeOKLCH,serializeP3,serializeRGB}; diff --git a/node_modules/@csstools/css-color-parser/package.json b/node_modules/@csstools/css-color-parser/package.json new file mode 100644 index 0000000..f7ad643 --- /dev/null +++ b/node_modules/@csstools/css-color-parser/package.json @@ -0,0 +1,64 @@ +{ + "name": "@csstools/css-color-parser", + "description": "Parse CSS color values", + "version": "4.2.6", + "contributors": [ + { + "name": "Antonio Laguna", + "email": "antonio@laguna.es", + "url": "https://antonio.laguna.es" + }, + { + "name": "Romain Menke", + "email": "romainmenke@gmail.com" + } + ], + "license": "MIT", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/csstools" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/csstools" + } + ], + "engines": { + "node": ">=20.19.0" + }, + "type": "module", + "exports": { + ".": { + "types": "./dist/index.d.ts", + "default": "./dist/index.mjs" + } + }, + "files": [ + "CHANGELOG.md", + "LICENSE.md", + "README.md", + "dist" + ], + "dependencies": { + "@csstools/color-helpers": "^6.1.2", + "@csstools/css-calc": "^3.4.3" + }, + "peerDependencies": { + "@csstools/css-parser-algorithms": "^4.0.2", + "@csstools/css-tokenizer": "^4.0.2" + }, + "scripts": {}, + "homepage": "https://github.com/csstools/postcss-plugins/tree/main/packages/css-color-parser#readme", + "repository": { + "type": "git", + "url": "git+https://github.com/csstools/postcss-plugins.git", + "directory": "packages/css-color-parser" + }, + "bugs": "https://github.com/csstools/postcss-plugins/issues", + "keywords": [ + "color", + "css", + "parser" + ] +} diff --git a/node_modules/@csstools/css-parser-algorithms/CHANGELOG.md b/node_modules/@csstools/css-parser-algorithms/CHANGELOG.md new file mode 100644 index 0000000..040bce2 --- /dev/null +++ b/node_modules/@csstools/css-parser-algorithms/CHANGELOG.md @@ -0,0 +1,9 @@ +# Changes to CSS Parser Algorithms + +### 4.0.2 + +_October 1, 2026_ + +- `parseCommaSeparatedListOfComponentValues` now emits empty lists for cases like `foo,,bar` effectively returning 3 lists of component values instead of only 2. + +[Full CHANGELOG](https://github.com/csstools/postcss-plugins/tree/main/packages/css-parser-algorithms/CHANGELOG.md) diff --git a/node_modules/@csstools/css-parser-algorithms/LICENSE.md b/node_modules/@csstools/css-parser-algorithms/LICENSE.md new file mode 100644 index 0000000..af5411f --- /dev/null +++ b/node_modules/@csstools/css-parser-algorithms/LICENSE.md @@ -0,0 +1,20 @@ +The MIT License (MIT) + +Copyright 2022 Romain Menke, Antonio Laguna + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/@csstools/css-parser-algorithms/README.md b/node_modules/@csstools/css-parser-algorithms/README.md new file mode 100644 index 0000000..a51d668 --- /dev/null +++ b/node_modules/@csstools/css-parser-algorithms/README.md @@ -0,0 +1,119 @@ +# CSS Parser Algorithms for CSS + +[npm version][npm-url] +[Build Status][cli-url] +[Discord][discord] + +Implemented from : https://www.w3.org/TR/2021/CRD-css-syntax-3-20211224/ + +## API + +[Read the API docs](./docs/css-parser-algorithms.md) + +## Usage + +Add [CSS Parser Algorithms] to your project: + +```bash +npm install @csstools/css-parser-algorithms @csstools/css-tokenizer --save-dev +``` + +[CSS Parser Algorithms] only accepts tokenized CSS. +It must be used together with `@csstools/css-tokenizer`. + + +```js +import { tokenizer, TokenType } from '@csstools/css-tokenizer'; +import { parseComponentValue } from '@csstools/css-parser-algorithms'; + +const myCSS = `@media only screen and (min-width: 768rem) { + .foo { + content: 'Some content!' !important; + } +} +`; + +const t = tokenizer({ + css: myCSS, +}); + +const tokens = []; + +{ + while (!t.endOfFile()) { + tokens.push(t.nextToken()); + } + + tokens.push(t.nextToken()); // EOF-token +} + +const options = { + onParseError: ((err) => { + throw err; + }), +}; + +const result = parseComponentValue(tokens, options); + +console.log(result); +``` + +### Available functions + +- [`parseComponentValue`](https://www.w3.org/TR/css-syntax-3/#parse-component-value) +- [`parseListOfComponentValues`](https://www.w3.org/TR/css-syntax-3/#parse-list-of-component-values) +- [`parseCommaSeparatedListOfComponentValues`](https://www.w3.org/TR/css-syntax-3/#parse-comma-separated-list-of-component-values) + +### Utilities + +#### `gatherNodeAncestry` + +The AST does not expose the entire ancestry of each node. +The walker methods do provide access to the current parent, but also not the entire ancestry. + +To gather the entire ancestry for a a given sub tree of the AST you can use `gatherNodeAncestry`. +The result is a `Map` with the child nodes as keys and the parents as values. +This allows you to lookup any ancestor of any node. + +```js +import { parseComponentValue } from '@csstools/css-parser-algorithms'; + +const result = parseComponentValue(tokens, options); +const ancestry = gatherNodeAncestry(result); +``` + +### Options + +```ts +{ + onParseError?: (error: ParseError) => void +} +``` + +#### `onParseError` + +The parser algorithms are forgiving and won't stop when a parse error is encountered. +Parse errors also aren't tokens. + +To receive parsing error information you can set a callback. + +Parser errors will try to inform you about the point in the parsing logic the error happened. +This tells you the kind of error. + +## Goals and non-goals + +Things this package aims to be: +- specification compliant CSS parser +- a reliable low level package to be used in CSS sub-grammars + +What it is not: +- opinionated +- fast +- small +- a replacement for PostCSS (PostCSS is fast and also an ecosystem) + +[cli-url]: https://github.com/csstools/postcss-plugins/actions/workflows/test.yml?query=workflow/test +[discord]: https://discord.gg/bUadyRwkJS +[npm-url]: https://www.npmjs.com/package/@csstools/css-parser-algorithms + +[CSS Parser Algorithms]: https://github.com/csstools/postcss-plugins/tree/main/packages/css-parser-algorithms diff --git a/node_modules/@csstools/css-parser-algorithms/dist/index.d.ts b/node_modules/@csstools/css-parser-algorithms/dist/index.d.ts new file mode 100644 index 0000000..c59d3dd --- /dev/null +++ b/node_modules/@csstools/css-parser-algorithms/dist/index.d.ts @@ -0,0 +1,604 @@ +/** + * Parse CSS following the {@link https://drafts.csswg.org/css-syntax/#parsing | CSS Syntax Level 3 specification}. + * + * @remarks + * The tokenizing and parsing tools provided by CSS Tools are designed to be low level and generic with strong ties to their respective specifications. + * + * Any analysis or mutation of CSS source code should be done with the least powerful tool that can accomplish the task. + * For many applications it is sufficient to work with tokens. + * For others you might need to use {@link https://github.com/csstools/postcss-plugins/tree/main/packages/css-parser-algorithms | @csstools/css-parser-algorithms} or a more specific parser. + * + * The implementation of the AST nodes is kept lightweight and simple. + * Do not expect magic methods, instead assume that arrays and class instances behave like any other JavaScript. + * + * @example + * Parse a string of CSS into a component value: + * ```js + * import { tokenize } from '@csstools/css-tokenizer'; + * import { parseComponentValue } from '@csstools/css-parser-algorithms'; + * + * const myCSS = `calc(1px * 2)`; + * + * const componentValue = parseComponentValue(tokenize({ + * css: myCSS, + * })); + * + * console.log(componentValue); + * ``` + * + * @example + * Use the right algorithm for the job. + * + * Algorithms that can parse larger structures (comma-separated lists, ...) can also parse smaller structures. + * However, the opposite is not true. + * + * If your context allows a list of component values, use {@link parseListOfComponentValues}: + * ```js + * import { tokenize } from '@csstools/css-tokenizer'; + * import { parseListOfComponentValues } from '@csstools/css-parser-algorithms'; + * + * parseListOfComponentValues(tokenize({ css: `10x 20px` })); + * ``` + * + * If your context allows a comma-separated list of component values, use {@link parseCommaSeparatedListOfComponentValues}: + * ```js + * import { tokenize } from '@csstools/css-tokenizer'; + * import { parseCommaSeparatedListOfComponentValues } from '@csstools/css-parser-algorithms'; + * + * parseCommaSeparatedListOfComponentValues(tokenize({ css: `20deg, 50%, 30%` })); + * ``` + * + * @example + * Use the stateful walkers to keep track of the context of a given component value. + * + * ```js + * import { tokenize } from '@csstools/css-tokenizer'; + * import { parseComponentValue, isSimpleBlockNode } from '@csstools/css-parser-algorithms'; + * + * const myCSS = `calc(1px * (5 / 2))`; + * + * const componentValue = parseComponentValue(tokenize({ css: myCSS })); + * + * let state = { inSimpleBlock: false }; + * componentValue.walk((entry) => { + * if (isSimpleBlockNode(entry)) { + * entry.state.inSimpleBlock = true; + * return; + * } + * + * if (entry.state.inSimpleBlock) { + * console.log(entry.node.toString()); // `5`, ... + * } + * }, state); + * ``` + * + * @packageDocumentation + */ + +import type { CSSToken } from '@csstools/css-tokenizer'; +import { ParseError } from '@csstools/css-tokenizer'; +import type { TokenFunction } from '@csstools/css-tokenizer'; + +export declare class CommentNode { + /** + * The node type, always `ComponentValueType.Comment` + */ + type: ComponentValueType; + /** + * The comment token. + */ + value: CSSToken; + constructor(value: CSSToken); + /** + * Retrieve the tokens for the current comment. + * This is the inverse of parsing from a list of tokens. + */ + tokens(): Array; + /** + * Convert the current comment to a string. + * This is not a true serialization. + * It is purely a concatenation of the string representation of the tokens. + */ + toString(): string; + /** + * @internal + * + * A debug helper to convert the current object to a JSON representation. + * This is useful in asserts and to store large ASTs in files. + */ + toJSON(): Record; + /** + * @internal + */ + isCommentNode(): this is CommentNode; + /** + * @internal + */ + static isCommentNode(x: unknown): x is CommentNode; +} + +export declare type ComponentValue = FunctionNode | SimpleBlockNode | WhitespaceNode | CommentNode | TokenNode; + +export declare enum ComponentValueType { + Function = "function", + SimpleBlock = "simple-block", + Whitespace = "whitespace", + Comment = "comment", + Token = "token" +} + +export declare type ContainerNode = FunctionNode | SimpleBlockNode; + +export declare abstract class ContainerNodeBaseClass { + /** + * The contents of the `Function` or `Simple Block`. + * This is a list of component values. + */ + value: Array; + /** + * Retrieve the index of the given item in the current node. + * For most node types this will be trivially implemented as `this.value.indexOf(item)`. + */ + indexOf(item: ComponentValue): number | string; + /** + * Retrieve the item at the given index in the current node. + * For most node types this will be trivially implemented as `this.value[index]`. + */ + at(index: number | string): ComponentValue | undefined; + /** + * Iterates over each item in the `value` array of the current node. + * + * @param cb - The callback function to execute for each item. + * The function receives an object containing the current node (`node`), its parent (`parent`), + * and an optional `state` object. + * A second parameter is the index of the current node. + * The function can return `false` to stop the iteration. + * + * @param state - An optional state object that can be used to pass additional information to the callback function. + * The state object is cloned for each iteration. This means that changes to the state object are not reflected in the next iteration. + * + * @returns `false` if the iteration was halted, `undefined` otherwise. + */ + forEach, U extends ContainerNode>(this: U, cb: (entry: { + node: ComponentValue; + parent: ContainerNode; + state?: T; + }, index: number | string) => boolean | void, state?: T): false | undefined; + /** + * Walks the current node and all its children. + * + * @param cb - The callback function to execute for each item. + * The function receives an object containing the current node (`node`), its parent (`parent`), + * and an optional `state` object. + * A second parameter is the index of the current node. + * The function can return `false` to stop the iteration. + * + * @param state - An optional state object that can be used to pass additional information to the callback function. + * The state object is cloned for each iteration. This means that changes to the state object are not reflected in the next iteration. + * However changes are passed down to child node iterations. + * + * @returns `false` if the iteration was halted, `undefined` otherwise. + */ + walk, U extends ContainerNode>(this: U, cb: (entry: { + node: ComponentValue; + parent: ContainerNode; + state?: T; + }, index: number | string) => boolean | void, state?: T): false | undefined; +} + +/** + * Iterates over each item in a list of component values. + * + * @param cb - The callback function to execute for each item. + * The function receives an object containing the current node (`node`), its parent (`parent`), + * and an optional `state` object. + * A second parameter is the index of the current node. + * The function can return `false` to stop the iteration. + * + * @param state - An optional state object that can be used to pass additional information to the callback function. + * The state object is cloned for each iteration. This means that changes to the state object are not reflected in the next iteration. + * + * @returns `false` if the iteration was halted, `undefined` otherwise. + */ +export declare function forEach>(componentValues: Array, cb: (entry: { + node: ComponentValue; + parent: ContainerNode | { + value: Array; + }; + state?: T; +}, index: number | string) => boolean | void, state?: T): false | undefined; + +/** + * A function node. + * + * @example + * ```js + * const node = parseComponentValue(tokenize('calc(1 + 1)')); + * + * isFunctionNode(node); // true + * node.getName(); // 'calc' + * ``` + */ +export declare class FunctionNode extends ContainerNodeBaseClass { + /** + * The node type, always `ComponentValueType.Function` + */ + type: ComponentValueType; + /** + * The token for the name of the function. + */ + name: TokenFunction; + /** + * The token for the closing parenthesis of the function. + * If the function is unclosed, this will be an EOF token. + */ + endToken: CSSToken; + constructor(name: TokenFunction, endToken: CSSToken, value: Array); + /** + * Retrieve the name of the current function. + * This is the parsed and unescaped name of the function. + */ + getName(): string; + /** + * Normalize the current function: + * 1. if the "endToken" is EOF, replace with a ")-token" + */ + normalize(): void; + /** + * Retrieve the tokens for the current function. + * This is the inverse of parsing from a list of tokens. + */ + tokens(): Array; + /** + * Convert the current function to a string. + * This is not a true serialization. + * It is purely a concatenation of the string representation of the tokens. + */ + toString(): string; + /** + * @internal + * + * A debug helper to convert the current object to a JSON representation. + * This is useful in asserts and to store large ASTs in files. + */ + toJSON(): unknown; + /** + * @internal + */ + isFunctionNode(): this is FunctionNode; + /** + * @internal + */ + static isFunctionNode(x: unknown): x is FunctionNode; +} + +/** + * AST nodes do not have a `parent` property or method. + * This makes it harder to traverse the AST upwards. + * This function builds a `Map` that can be used to lookup ancestors of a node. + * + * @remarks + * There is no magic behind this or the map it returns. + * Mutating the AST will not update the map. + * + * Types are erased and any content of the map has type `unknown`. + * If someone knows a clever way to type this, please let us know. + * + * @example + * ```js + * const ancestry = gatherNodeAncestry(mediaQuery); + * mediaQuery.walk((entry) => { + * const node = entry.node; // directly exposed + * const parent = entry.parent; // directly exposed + * const grandParent: unknown = ancestry.get(parent); // lookup + * + * console.log('node', node); + * console.log('parent', parent); + * console.log('grandParent', grandParent); + * }); + * ``` + */ +export declare function gatherNodeAncestry(node: { + walk(cb: (entry: { + node: unknown; + parent: unknown; + }, index: number | string) => boolean | void): false | undefined; +}): Map; + +/** + * Check if the current object is a `CommentNode`. + * This is a type guard. + */ +export declare function isCommentNode(x: unknown): x is CommentNode; + +/** + * Check if the current object is a `FunctionNode`. + * This is a type guard. + */ +export declare function isFunctionNode(x: unknown): x is FunctionNode; + +/** + * Check if the current object is a `SimpleBlockNode`. + * This is a type guard. + */ +export declare function isSimpleBlockNode(x: unknown): x is SimpleBlockNode; + +/** + * Check if the current object is a `TokenNode`. + * This is a type guard. + */ +export declare function isTokenNode(x: unknown): x is TokenNode; + +/** + * Check if the current object is a `WhitespaceNode`. + * This is a type guard. + */ +export declare function isWhitespaceNode(x: unknown): x is WhitespaceNode; + +/** + * Check if the current object is a `WhiteSpaceNode` or a `CommentNode`. + * This is a type guard. + */ +export declare function isWhiteSpaceOrCommentNode(x: unknown): x is WhitespaceNode | CommentNode; + +/** + * Parse a comma-separated list of component values. + * + * @example + * ```js + * import { tokenize } from '@csstools/css-tokenizer'; + * import { parseCommaSeparatedListOfComponentValues } from '@csstools/css-parser-algorithms'; + * + * parseCommaSeparatedListOfComponentValues(tokenize({ css: `20deg, 50%, 30%` })); + * ``` + */ +export declare function parseCommaSeparatedListOfComponentValues(tokens: Array, options?: { + onParseError?: (error: ParseError) => void; +}): Array>; + +/** + * Parse a single component value. + * + * @example + * ```js + * import { tokenize } from '@csstools/css-tokenizer'; + * import { parseComponentValue } from '@csstools/css-parser-algorithms'; + * + * parseComponentValue(tokenize({ css: `10px` })); + * parseComponentValue(tokenize({ css: `calc((10px + 1x) * 4)` })); + * ``` + */ +export declare function parseComponentValue(tokens: Array, options?: { + onParseError?: (error: ParseError) => void; +}): ComponentValue | undefined; + +/** + * Parse a list of component values. + * + * @example + * ```js + * import { tokenize } from '@csstools/css-tokenizer'; + * import { parseListOfComponentValues } from '@csstools/css-parser-algorithms'; + * + * parseListOfComponentValues(tokenize({ css: `20deg 30%` })); + * ``` + */ +export declare function parseListOfComponentValues(tokens: Array, options?: { + onParseError?: (error: ParseError) => void; +}): Array; + +/** + * Replace specific component values in a list of component values. + * A helper for the most common and simplistic cases when mutating an AST. + */ +export declare function replaceComponentValues(componentValuesList: Array>, replaceWith: (componentValue: ComponentValue) => Array | ComponentValue | void): Array>; + +/** + * A simple block node. + * + * @example + * ```js + * const node = parseComponentValue(tokenize('[foo=bar]')); + * + * isSimpleBlockNode(node); // true + * node.startToken; // [TokenType.OpenSquare, '[', 0, 0, undefined] + * ``` + */ +export declare class SimpleBlockNode extends ContainerNodeBaseClass { + /** + * The node type, always `ComponentValueType.SimpleBlock` + */ + type: ComponentValueType; + /** + * The token for the opening token of the block. + */ + startToken: CSSToken; + /** + * The token for the closing token of the block. + * If the block is closed it will be the mirror variant of the `startToken`. + * If the block is unclosed, this will be an EOF token. + */ + endToken: CSSToken; + constructor(startToken: CSSToken, endToken: CSSToken, value: Array); + /** + * Normalize the current simple block + * 1. if the "endToken" is EOF, replace with the mirror token of the "startToken" + */ + normalize(): void; + /** + * Retrieve the tokens for the current simple block. + * This is the inverse of parsing from a list of tokens. + */ + tokens(): Array; + /** + * Convert the current simple block to a string. + * This is not a true serialization. + * It is purely a concatenation of the string representation of the tokens. + */ + toString(): string; + /** + * @internal + * + * A debug helper to convert the current object to a JSON representation. + * This is useful in asserts and to store large ASTs in files. + */ + toJSON(): unknown; + /** + * @internal + */ + isSimpleBlockNode(): this is SimpleBlockNode; + /** + * @internal + */ + static isSimpleBlockNode(x: unknown): x is SimpleBlockNode; +} + +/** + * Returns the start and end index of a node in the CSS source string. + */ +export declare function sourceIndices(x: { + tokens(): Array; +} | Array<{ + tokens(): Array; +}>): [number, number]; + +/** + * Concatenate the string representation of a collection of component values. + * This is not a proper serializer that will handle escaping and whitespace. + * It only produces valid CSS for token lists that are also valid. + */ +export declare function stringify(componentValueLists: Array>): string; + +export declare class TokenNode { + /** + * The node type, always `ComponentValueType.Token` + */ + type: ComponentValueType; + /** + * The token. + */ + value: CSSToken; + constructor(value: CSSToken); + /** + * This is the inverse of parsing from a list of tokens. + */ + tokens(): [CSSToken]; + /** + * Convert the current token to a string. + * This is not a true serialization. + * It is purely the string representation of token. + */ + toString(): string; + /** + * @internal + * + * A debug helper to convert the current object to a JSON representation. + * This is useful in asserts and to store large ASTs in files. + */ + toJSON(): Record; + /** + * @internal + */ + isTokenNode(): this is TokenNode; + /** + * @internal + */ + static isTokenNode(x: unknown): x is TokenNode; +} + +/** + * Walks each item in a list of component values all of their children. + * + * @param cb - The callback function to execute for each item. + * The function receives an object containing the current node (`node`), its parent (`parent`), + * and an optional `state` object. + * A second parameter is the index of the current node. + * The function can return `false` to stop the iteration. + * + * @param state - An optional state object that can be used to pass additional information to the callback function. + * The state object is cloned for each iteration. This means that changes to the state object are not reflected in the next iteration. + * However changes are passed down to child node iterations. + * + * @returns `false` if the iteration was halted, `undefined` otherwise. + * + * @example + * ```js + * import { tokenize } from '@csstools/css-tokenizer'; + * import { parseListOfComponentValues, isSimpleBlockNode } from '@csstools/css-parser-algorithms'; + * + * const myCSS = `calc(1px * (5 / 2)) 10px`; + * + * const componentValues = parseListOfComponentValues(tokenize({ css: myCSS })); + * + * let state = { inSimpleBlock: false }; + * walk(componentValues, (entry) => { + * if (isSimpleBlockNode(entry)) { + * entry.state.inSimpleBlock = true; + * return; + * } + * + * if (entry.state.inSimpleBlock) { + * console.log(entry.node.toString()); // `5`, ... + * } + * }, state); + * ``` + */ +export declare function walk>(componentValues: Array, cb: (entry: { + node: ComponentValue; + parent: ContainerNode | { + value: Array; + }; + state?: T; +}, index: number | string) => boolean | void, state?: T): false | undefined; + +/** + * Generate a function that finds the next element that should be visited when walking an AST. + * Rules : + * 1. the previous iteration is used as a reference, so any checks are relative to the start of the current iteration. + * 2. the next element always appears after the current index. + * 3. the next element always exists in the list. + * 4. replacing an element does not cause the replaced element to be visited. + * 5. removing an element does not cause elements to be skipped. + * 6. an element added later in the list will be visited. + */ +export declare function walkerIndexGenerator(initialList: Array): (list: Array, child: T, index: number) => number; + +export declare class WhitespaceNode { + /** + * The node type, always `ComponentValueType.WhiteSpace` + */ + type: ComponentValueType; + /** + * The list of consecutive whitespace tokens. + */ + value: Array; + constructor(value: Array); + /** + * Retrieve the tokens for the current whitespace. + * This is the inverse of parsing from a list of tokens. + */ + tokens(): Array; + /** + * Convert the current whitespace to a string. + * This is not a true serialization. + * It is purely a concatenation of the string representation of the tokens. + */ + toString(): string; + /** + * @internal + * + * A debug helper to convert the current object to a JSON representation. + * This is useful in asserts and to store large ASTs in files. + */ + toJSON(): Record; + /** + * @internal + */ + isWhitespaceNode(): this is WhitespaceNode; + /** + * @internal + */ + static isWhitespaceNode(x: unknown): x is WhitespaceNode; +} + +export { } diff --git a/node_modules/@csstools/css-parser-algorithms/dist/index.mjs b/node_modules/@csstools/css-parser-algorithms/dist/index.mjs new file mode 100644 index 0000000..58bdaf9 --- /dev/null +++ b/node_modules/@csstools/css-parser-algorithms/dist/index.mjs @@ -0,0 +1 @@ +import{stringify as e,isTokenEOF as n,TokenType as t,isToken as o,mirrorVariant as s,isTokenOpenParen as i,isTokenOpenCurly as r,isTokenOpenSquare as a,isTokenFunction as c,isTokenWhitespace as u,isTokenComment as l,mirrorVariantType as d,ParseError as h,isTokenWhiteSpaceOrComment as m,isTokenCloseParen as p,isTokenComma as f}from"@csstools/css-tokenizer";var k;function walkerIndexGenerator(e){let n,t=e.slice(),o=-1;return(e,s,i)=>{if(e===n&&e.length===o&&e[i]===s){o=e.length;const n=i+1;return n=e.length)?(n=e,o=e.length,-1):(t=e.slice(),n=e,o=e.length,r)}}!function(e){e.Function="function",e.SimpleBlock="simple-block",e.Whitespace="whitespace",e.Comment="comment",e.Token="token"}(k||(k={}));const N=512;function consumeComponentValue(e,n,t=0,o=0){const s=n[t];if(i(s)||r(s)||a(s)){const s=consumeSimpleBlock(e,n,t,o);return{advance:s.advance,node:s.node}}if(c(s)){const s=consumeFunction(e,n,t,o);return{advance:s.advance,node:s.node}}if(u(s)){const o=consumeWhitespace(e,n,t);return{advance:o.advance,node:o.node}}if(l(s)){const o=consumeComment(e,n,t);return{advance:o.advance,node:o.node}}return{advance:1,node:new TokenNode(s)}}class ContainerNodeBaseClass{value=[];indexOf(e){return this.value.indexOf(e)}at(e){if("number"==typeof e)return e<0&&(e=this.value.length+e),this.value[e]}forEach(e,n){if(0===this.value.length)return;const t=walkerIndexGenerator(this.value);let o=0;for(;o!1!==e(n,t)&&((!("walk"in n.node)||!("number"==typeof t&&this.value[t]===n.node||this.value.includes(n.node))||!1!==n.node.walk(e,n.state))&&void 0),n)}}class FunctionNode extends ContainerNodeBaseClass{type=k.Function;name;endToken;constructor(e,n,t){super(),this.name=e,this.endToken=n,this.value=t}getName(){return this.name[4].value}normalize(){n(this.endToken)&&(this.endToken=[t.CloseParen,")",-1,-1,void 0])}tokens(){return n(this.endToken)?[this.name,...this.value.flatMap(e=>e.tokens())]:[this.name,...this.value.flatMap(e=>e.tokens()),this.endToken]}toString(){const n=this.value.map(n=>o(n)?e(n):n.toString()).join("");return e(this.name)+n+e(this.endToken)}toJSON(){return{type:this.type,name:this.getName(),tokens:this.tokens(),value:this.value.map(e=>e.toJSON())}}isFunctionNode(){return FunctionNode.isFunctionNode(this)}static isFunctionNode(e){return!!e&&(e instanceof FunctionNode&&e.type===k.Function)}}function consumeFunction(e,t,o,s){if(s>=N)throw new Error("Maximum nesting depth of 512 exceeded, reduce the complexity of your stylesheet.");const i=[];let r=o+1;for(;;){const a=t[r];if(!a||n(a))return e.onParseError(new h("Unexpected EOF while consuming a function.",t[o][2],t[t.length-1][3],["5.4.9. Consume a function","Unexpected EOF"])),{advance:t.length-o,node:new FunctionNode(t[o],a,i)};if(p(a))return{advance:r-o+1,node:new FunctionNode(t[o],a,i)};if(m(a)){const n=consumeAllCommentsAndWhitespace(e,t,r);r+=n.advance;for(let e=0;ee.tokens())]:[this.startToken,...this.value.flatMap(e=>e.tokens()),this.endToken]}toString(){const n=this.value.map(n=>o(n)?e(n):n.toString()).join("");return e(this.startToken)+n+e(this.endToken)}toJSON(){return{type:this.type,startToken:this.startToken,tokens:this.tokens(),value:this.value.map(e=>e.toJSON())}}isSimpleBlockNode(){return SimpleBlockNode.isSimpleBlockNode(this)}static isSimpleBlockNode(e){return!!e&&(e instanceof SimpleBlockNode&&e.type===k.SimpleBlock)}}function consumeSimpleBlock(e,t,o,s){if(s>=N)throw new Error("Maximum nesting depth of 512 exceeded, reduce the complexity of your stylesheet.");const i=d(t[o][0]);if(!i)throw new Error("Failed to parse, a mirror variant must exist for all block open tokens.");const r=[];let a=o+1;for(;;){const c=t[a];if(!c||n(c))return e.onParseError(new h("Unexpected EOF while consuming a simple block.",t[o][2],t[t.length-1][3],["5.4.8. Consume a simple block","Unexpected EOF"])),{advance:t.length-o,node:new SimpleBlockNode(t[o],c,r)};if(c[0]===i)return{advance:a-o+1,node:new SimpleBlockNode(t[o],c,r)};if(m(c)){const n=consumeAllCommentsAndWhitespace(e,t,a);a+=n.advance;for(let e=0;e{})},i=[...e];if(0===i.length)return;n(i[i.length-1])||i.push([t.EOF,"",i[i.length-1][2],i[i.length-1][3],void 0]);const r=consumeComponentValue(s,i);if(n(i[Math.min(r.advance,i.length-1)]))return r.node;s.onParseError(new h("Expected EOF after parsing a component value.",e[0][2],e[e.length-1][3],["5.3.9. Parse a component value","Expected EOF"]))}function parseListOfComponentValues(e,o){const s={onParseError:o?.onParseError??(()=>{})},i=[...e];if(0===i.length)return[];n(i[i.length-1])||i.push([t.EOF,"",i[i.length-1][2],i[i.length-1][3],void 0]);const r=[];let a=0;for(;;){if(!i[a]||n(i[a]))return r;const e=consumeComponentValue(s,i,a,0);r.push(e.node),a+=e.advance}}function parseCommaSeparatedListOfComponentValues(e,o){const s={onParseError:o?.onParseError??(()=>{})},i=[...e];if(0===e.length)return[];n(i[i.length-1])||i.push([t.EOF,"",i[i.length-1][2],i[i.length-1][3],void 0]);const r=[];let a=[],c=0;for(;;){if(!i[c]||n(i[c]))return r.push(a),r;if(f(i[c])){r.push(a),a=[],c++;continue}const e=consumeComponentValue(s,i,c,0);a.push(e.node),c+=e.advance}}function gatherNodeAncestry(e){const n=new Map;return e.walk(e=>{Array.isArray(e.node)?e.node.forEach(t=>{n.set(t,e.parent)}):n.set(e.node,e.parent)}),n}function forEach(e,n,t){if(0===e.length)return;const o=walkerIndexGenerator(e);let s=0;for(;s!1!==n(t,o)&&((!("walk"in t.node)||!("number"==typeof o&&e[o]===t.node||e.includes(t.node))||!1!==t.node.walk(n,t.state))&&void 0),t)}function replaceComponentValues(e,n){for(let t=0;t{if("number"!=typeof t)return;const o=n(e.node);o&&(Array.isArray(o)?e.parent.value.splice(t,1,...o):e.parent.value.splice(t,1,o))})}return e}function stringify(n){return n.map(n=>n.map(n=>e(n.tokens())).join("")).join(",")}function isSimpleBlockNode(e){return SimpleBlockNode.isSimpleBlockNode(e)}function isFunctionNode(e){return FunctionNode.isFunctionNode(e)}function isWhitespaceNode(e){return WhitespaceNode.isWhitespaceNode(e)}function isCommentNode(e){return CommentNode.isCommentNode(e)}function isWhiteSpaceOrCommentNode(e){return isWhitespaceNode(e)||isCommentNode(e)}function isTokenNode(e){return TokenNode.isTokenNode(e)}function sourceIndices(e){if(Array.isArray(e)){const n=e[0];if(!n)return[0,0];const t=e[e.length-1]||n;return[sourceIndices(n)[0],sourceIndices(t)[1]]}const n=e.tokens(),t=n[0],o=n[n.length-1];return t&&o?[t[2],o[3]]:[0,0]}export{CommentNode,k as ComponentValueType,ContainerNodeBaseClass,FunctionNode,SimpleBlockNode,TokenNode,WhitespaceNode,forEach,gatherNodeAncestry,isCommentNode,isFunctionNode,isSimpleBlockNode,isTokenNode,isWhiteSpaceOrCommentNode,isWhitespaceNode,parseCommaSeparatedListOfComponentValues,parseComponentValue,parseListOfComponentValues,replaceComponentValues,sourceIndices,stringify,walk,walkerIndexGenerator}; diff --git a/node_modules/@csstools/css-parser-algorithms/package.json b/node_modules/@csstools/css-parser-algorithms/package.json new file mode 100644 index 0000000..2e193a6 --- /dev/null +++ b/node_modules/@csstools/css-parser-algorithms/package.json @@ -0,0 +1,58 @@ +{ + "name": "@csstools/css-parser-algorithms", + "description": "Algorithms to help you parse CSS from an array of tokens.", + "version": "4.0.2", + "contributors": [ + { + "name": "Antonio Laguna", + "email": "antonio@laguna.es", + "url": "https://antonio.laguna.es" + }, + { + "name": "Romain Menke", + "email": "romainmenke@gmail.com" + } + ], + "license": "MIT", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/csstools" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/csstools" + } + ], + "engines": { + "node": ">=20.19.0" + }, + "type": "module", + "exports": { + ".": { + "types": "./dist/index.d.ts", + "default": "./dist/index.mjs" + } + }, + "files": [ + "CHANGELOG.md", + "LICENSE.md", + "README.md", + "dist" + ], + "peerDependencies": { + "@csstools/css-tokenizer": "^4.0.2" + }, + "scripts": {}, + "homepage": "https://github.com/csstools/postcss-plugins/tree/main/packages/css-parser-algorithms#readme", + "repository": { + "type": "git", + "url": "git+https://github.com/csstools/postcss-plugins.git", + "directory": "packages/css-parser-algorithms" + }, + "bugs": "https://github.com/csstools/postcss-plugins/issues", + "keywords": [ + "css", + "parser" + ] +} diff --git a/node_modules/@csstools/css-syntax-patches-for-csstree/CHANGELOG.md b/node_modules/@csstools/css-syntax-patches-for-csstree/CHANGELOG.md new file mode 100644 index 0000000..ed9e28c --- /dev/null +++ b/node_modules/@csstools/css-syntax-patches-for-csstree/CHANGELOG.md @@ -0,0 +1,9 @@ +# Changes to CSS Syntax Patches For CSSTree + +### 1.1.15 + +_October 1, 2026_ + +- Update `@webref/css` to [`v8.7.5`](https://github.com/w3c/webref/releases/tag/%40webref%2Fcss%408.7.5) + +[Full CHANGELOG](https://github.com/csstools/postcss-plugins/tree/main/packages/css-syntax-patches-for-csstree/CHANGELOG.md) diff --git a/node_modules/@csstools/css-syntax-patches-for-csstree/LICENSE.md b/node_modules/@csstools/css-syntax-patches-for-csstree/LICENSE.md new file mode 100644 index 0000000..e8ae93b --- /dev/null +++ b/node_modules/@csstools/css-syntax-patches-for-csstree/LICENSE.md @@ -0,0 +1,18 @@ +MIT No Attribution (MIT-0) + +Copyright © CSSTools Contributors + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the “Software”), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so. + +THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/node_modules/@csstools/css-syntax-patches-for-csstree/README.md b/node_modules/@csstools/css-syntax-patches-for-csstree/README.md new file mode 100644 index 0000000..00e214f --- /dev/null +++ b/node_modules/@csstools/css-syntax-patches-for-csstree/README.md @@ -0,0 +1,43 @@ +# CSS Syntax Patches For CSSTree for CSS + +[npm version][npm-url] +[Build Status][cli-url] + +Patch [csstree](https://github.com/csstree/csstree) syntax definitions with the latest data from CSS specifications. + +## Usage + +```bash +npm install @csstools/css-syntax-patches-for-csstree +``` + +```js +import { fork } from 'css-tree'; +import syntax_patches from '@csstools/css-syntax-patches-for-csstree' with { type: 'json' }; + +const forkedLexer = fork({ + atrules: syntax_patches.next.atrules, + properties: syntax_patches.next.properties, + types: syntax_patches.next.types, +}).lexer; +``` + +## `next` + +```js +import syntax_patches from '@csstools/css-syntax-patches-for-csstree' with { type: 'json' }; + +console.log(syntax_patches.next); +// ^^^^ +``` + +CSS specifications are often still in flux and various parts might change or disappear altogether. +Specifications also contains parts that haven't been implemented yet in a browser. +Only CSS that is widely adopted can be expected to be stable. + +The `next` grouping contains a combination of what is currently valid in browsers and the progress in various specifications. + +_In the future more groupings might be added._ + +[cli-url]: https://github.com/csstools/postcss-plugins/actions/workflows/test.yml?query=workflow/test +[npm-url]: https://www.npmjs.com/package/@csstools/css-syntax-patches-for-csstree diff --git a/node_modules/@csstools/css-syntax-patches-for-csstree/dist/index.d.ts b/node_modules/@csstools/css-syntax-patches-for-csstree/dist/index.d.ts new file mode 100644 index 0000000..05d942a --- /dev/null +++ b/node_modules/@csstools/css-syntax-patches-for-csstree/dist/index.d.ts @@ -0,0 +1,5 @@ +export const next: { + atrules: Record }>, + properties: Record, + types: Record, +} diff --git a/node_modules/@csstools/css-syntax-patches-for-csstree/dist/index.json b/node_modules/@csstools/css-syntax-patches-for-csstree/dist/index.json new file mode 100644 index 0000000..15fda9f --- /dev/null +++ b/node_modules/@csstools/css-syntax-patches-for-csstree/dist/index.json @@ -0,0 +1,863 @@ +{ + "next": { + "atrules": { + "apply": { + "prelude": "[ | ]" + }, + "color-profile": { + "prelude": "[ | device-cmyk ]", + "descriptors": { + "components": "#", + "rendering-intent": "relative-colorimetric | absolute-colorimetric | perceptual | saturation", + "src": "" + } + }, + "container": { + "prelude": "#" + }, + "custom-media": { + "prelude": " [ | true | false ]" + }, + "custom-selector": { + "prelude": " " + }, + "font-feature-values": { + "prelude": "#", + "descriptors": { + "font-display": "auto | block | swap | fallback | optional" + } + }, + "function": { + "prelude": " #? ) [ returns ]?", + "descriptors": { + "result": "?" + } + }, + "import": { + "prelude": "[ | ] [ [ layer | layer( ) ] || [ scope | scope( | ) ] || ]? ?" + }, + "mixin": { + "prelude": "[ #? ) | ]" + }, + "navigation": { + "prelude": "" + }, + "page": { + "prelude": "?", + "descriptors": { + "margin": "<'margin'>", + "margin-bottom": "<'margin-bottom'>", + "margin-left": "<'margin-left'>", + "margin-right": "<'margin-right'>", + "margin-top": "<'margin-top'>", + "page-margin-safety": "none | clamp | add" + } + }, + "property": { + "prelude": "#" + }, + "scope": { + "prelude": "?" + }, + "supports-condition": { + "prelude": "" + }, + "font-face": { + "descriptors": { + "ascent-override": "[ normal | ]{1,2}", + "descent-override": "[ normal | ]{1,2}", + "font-family": "", + "font-language-override": "normal | ", + "font-named-instance": "auto | ", + "font-size": "auto | [ ]{1,2}", + "font-style": "auto | normal | italic | left | right | oblique [ {1,2} ]?", + "font-weight": "| auto", + "font-width": "auto | <'font-width'>{1,2}", + "line-gap-override": "[ normal | ]{1,2}", + "size-adjust": "", + "src": "", + "subscript-position-override": "[ normal | from-font | ]{1,2}", + "subscript-size-override": "[ normal | from-font | ]{1,2}", + "superscript-position-override": "[ normal | from-font | ]{1,2}", + "superscript-size-override": "[ normal | from-font | ]{1,2}", + "unicode-range": "#" + } + }, + "font-palette-values": { + "descriptors": { + "font-family": "#" + } + }, + "position-try": { + "descriptors": { + "position-anchor": "<'position-anchor'>", + "position-area": "<'position-area'>" + } + }, + "view-transition": { + "descriptors": { + "types": "none | +" + } + } + }, + "properties": { + "align-self": "auto | ? [ normal | ] | stretch | | anchor-center", + "alignment-baseline": "auto | before-edge | text-before-edge | after-edge | text-after-edge | baseline | ", + "all": " | revert-rule", + "anchor-name": "none | #", + "anchor-scope": "none | all | #", + "animation-delay": "[ <'animation-delay-start'> <'animation-delay-end'>? ]#", + "animation-delay-end": "