@stylexjs/babel-plugin 0.17.4 → 0.18.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,8 +1,6 @@
1
- 'use strict';
2
-
3
- var standalone = require('@babel/standalone');
4
- var parser = require('postcss-value-parser');
5
- var stylex = require('@stylexjs/stylex');
1
+ import { packages } from '@babel/standalone';
2
+ import parser from 'postcss-value-parser';
3
+ import { legacyMerge, props } from '@stylexjs/stylex';
6
4
 
7
5
  const {
8
6
  arrayExpression, arrowFunctionExpression, binaryExpression, booleanLiteral,
@@ -16,7 +14,7 @@ const {
16
14
  isUpdateExpression, isValidIdentifier, isVariableDeclaration, jsxAttribute,
17
15
  jsxIdentifier, memberExpression, nullLiteral, numericLiteral, objectExpression,
18
16
  objectProperty, stringLiteral, unaryExpression, variableDeclaration, variableDeclarator
19
- } = standalone.packages.types;
17
+ } = packages.types;
20
18
 
21
19
  var types = /*#__PURE__*/Object.freeze({
22
20
  __proto__: null,
@@ -79,7 +77,11 @@ function getAugmentedNamespace(n) {
79
77
  var f = n.default;
80
78
  if (typeof f == "function") {
81
79
  var a = function a () {
82
- if (this instanceof a) {
80
+ var isInstance = false;
81
+ try {
82
+ isInstance = this instanceof a;
83
+ } catch {}
84
+ if (isInstance) {
83
85
  return Reflect.construct(f, arguments, this.constructor);
84
86
  }
85
87
  return f.apply(this, arguments);
@@ -1238,22 +1240,22 @@ var hasRequiredLib$2;
1238
1240
  function requireLib$2 () {
1239
1241
  if (hasRequiredLib$2) return lib$2;
1240
1242
  hasRequiredLib$2 = 1;
1241
- (function (exports) {
1243
+ (function (exports$1) {
1242
1244
 
1243
- Object.defineProperty(exports, "__esModule", {
1245
+ Object.defineProperty(exports$1, "__esModule", {
1244
1246
  value: true
1245
1247
  });
1246
- Object.defineProperty(exports, "ImportInjector", {
1248
+ Object.defineProperty(exports$1, "ImportInjector", {
1247
1249
  enumerable: true,
1248
1250
  get: function () {
1249
1251
  return _importInjector.default;
1250
1252
  }
1251
1253
  });
1252
- exports.addDefault = addDefault;
1253
- exports.addNamed = addNamed;
1254
- exports.addNamespace = addNamespace;
1255
- exports.addSideEffect = addSideEffect;
1256
- Object.defineProperty(exports, "isModule", {
1254
+ exports$1.addDefault = addDefault;
1255
+ exports$1.addNamed = addNamed;
1256
+ exports$1.addNamespace = addNamespace;
1257
+ exports$1.addSideEffect = addSideEffect;
1258
+ Object.defineProperty(exports$1, "isModule", {
1257
1259
  enumerable: true,
1258
1260
  get: function () {
1259
1261
  return _isModule.default;
@@ -1439,6 +1441,7 @@ const defaultOptions = {
1439
1441
  classNamePrefix: 'x',
1440
1442
  dev: false,
1441
1443
  debug: false,
1444
+ propertyValidationMode: 'silent',
1442
1445
  enableDebugClassNames: false,
1443
1446
  enableDevClassNames: false,
1444
1447
  enableDebugDataProp: true,
@@ -1481,6 +1484,12 @@ const checkRuntimeInjection = unionOf3(boolean(), string(), object({
1481
1484
  from: string(),
1482
1485
  as: string()
1483
1486
  }));
1487
+ const checkEnvOption = (value, name = 'options.env') => {
1488
+ if (typeof value !== 'object' || value == null || Array.isArray(value)) {
1489
+ return new Error(`Expected (${name}) to be an object, but got \`${String(JSON.stringify(value))}\`.`);
1490
+ }
1491
+ return value;
1492
+ };
1484
1493
  const DEFAULT_INJECT_PATH = '@stylexjs/stylex/lib/stylex-inject';
1485
1494
  class StateManager {
1486
1495
  importPaths = new Set();
@@ -1500,6 +1509,7 @@ class StateManager {
1500
1509
  stylexViewTransitionClassImport = new Set();
1501
1510
  stylexDefaultMarkerImport = new Set();
1502
1511
  stylexWhenImport = new Set();
1512
+ stylexEnvImport = new Set();
1503
1513
  injectImportInserted = null;
1504
1514
  styleMap = new Map();
1505
1515
  styleVars = new Map();
@@ -1530,8 +1540,13 @@ class StateManager {
1530
1540
  const configuredImportSources = logAndDefault(checkImportSources, options.importSources ?? defaultOptions.importSources, [], 'options.importSources');
1531
1541
  const importSources = [name, 'stylex', ...configuredImportSources];
1532
1542
  const styleResolution = logAndDefault(unionOf3(literal('application-order'), literal('property-specificity'), literal('legacy-expand-shorthands')), options.styleResolution ?? defaultOptions.styleResolution, 'property-specificity', 'options.styleResolution');
1543
+ const propertyValidationMode = logAndDefault(unionOf3(literal('throw'), literal('warn'), literal('silent')), options.propertyValidationMode ?? defaultOptions.propertyValidationMode, 'silent', 'options.propertyValidationMode');
1533
1544
  const unstable_moduleResolution = logAndDefault(unionOf(nullish(), CheckModuleResolution), options.unstable_moduleResolution, null, 'options.unstable_moduleResolution');
1534
1545
  const treeshakeCompensation = logAndDefault(boolean(), options.treeshakeCompensation ?? defaultOptions.treeshakeCompensation, false, 'options.treeshakeCompensation');
1546
+ const envInput = logAndDefault(checkEnvOption, options.env ?? {}, {}, 'options.env');
1547
+ const env = Object.freeze({
1548
+ ...envInput
1549
+ });
1535
1550
  const aliasesOption = logAndDefault(unionOf(nullish(), objectOf(unionOf(string(), array(string())))), options.aliases, null, 'options.aliases');
1536
1551
  const aliases = aliasesOption == null ? aliasesOption : Object.fromEntries(Object.entries(aliasesOption).map(([key, value]) => {
1537
1552
  if (typeof value === 'string') {
@@ -1546,6 +1561,8 @@ class StateManager {
1546
1561
  debug,
1547
1562
  definedStylexCSSVariables: {},
1548
1563
  dev,
1564
+ propertyValidationMode,
1565
+ env,
1549
1566
  enableDebugClassNames,
1550
1567
  enableDebugDataProp,
1551
1568
  enableDevClassNames,
@@ -1587,6 +1604,31 @@ class StateManager {
1587
1604
  }
1588
1605
  return null;
1589
1606
  }
1607
+ applyStylexEnv(identifiers) {
1608
+ const env = this.options.env;
1609
+ this.stylexImport.forEach(importName => {
1610
+ const current = identifiers[importName];
1611
+ if (current != null && typeof current === 'object' && !Array.isArray(current)) {
1612
+ if ('fn' in current) {
1613
+ identifiers[importName] = {
1614
+ env
1615
+ };
1616
+ } else {
1617
+ identifiers[importName] = {
1618
+ ...current,
1619
+ env
1620
+ };
1621
+ }
1622
+ return;
1623
+ }
1624
+ identifiers[importName] = {
1625
+ env
1626
+ };
1627
+ });
1628
+ this.stylexEnvImport.forEach(importName => {
1629
+ identifiers[importName] = env;
1630
+ });
1631
+ }
1590
1632
  get canReferenceTheme() {
1591
1633
  return !!this.inStyleXCreate;
1592
1634
  }
@@ -1905,6 +1947,9 @@ function readImportDeclarations(path, state) {
1905
1947
  if (importedName === 'defaultMarker') {
1906
1948
  state.stylexDefaultMarkerImport.add(localName);
1907
1949
  }
1950
+ if (importedName === 'env') {
1951
+ state.stylexEnvImport.add(localName);
1952
+ }
1908
1953
  }
1909
1954
  }
1910
1955
  }
@@ -1971,6 +2016,9 @@ function readRequires(path, state) {
1971
2016
  if (prop.key.name === 'defaultMarker') {
1972
2017
  state.stylexDefaultMarkerImport.add(value.name);
1973
2018
  }
2019
+ if (prop.key.name === 'env') {
2020
+ state.stylexEnvImport.add(value.name);
2021
+ }
1974
2022
  }
1975
2023
  }
1976
2024
  }
@@ -2066,6 +2114,15 @@ const shorthands$2 = {
2066
2114
  borderTopRightRadius: value => [['borderTopRightRadius', value], ['borderStartStartRadius', null], ['borderStartEndRadius', null]],
2067
2115
  borderBottomLeftRadius: value => [['borderBottomLeftRadius', value], ['borderEndStartRadius', null], ['borderEndEndRadius', null]],
2068
2116
  borderBottomRightRadius: value => [['borderBottomRightRadius', value], ['borderEndStartRadius', null], ['borderEndEndRadius', null]],
2117
+ cornerShape: value => [['cornerShape', value], ['cornerStartStartShape', null], ['cornerStartEndShape', null], ['cornerEndStartShape', null], ['cornerEndEndShape', null], ['cornerTopLeftShape', null], ['cornerTopRightShape', null], ['cornerBottomLeftShape', null], ['cornerBottomRightShape', null]],
2118
+ cornerStartStartShape: value => [['cornerStartStartShape', value], ['cornerTopLeftShape', null], ['cornerTopRightShape', null]],
2119
+ cornerStartEndShape: value => [['cornerStartEndShape', value], ['cornerTopLeftShape', null], ['cornerTopRightShape', null]],
2120
+ cornerEndStartShape: value => [['cornerEndStartShape', value], ['cornerBottomLeftShape', null], ['cornerBottomRightShape', null]],
2121
+ cornerEndEndShape: value => [['cornerEndEndShape', value], ['cornerBottomLeftShape', null], ['cornerBottomRightShape', null]],
2122
+ cornerTopLeftShape: value => [['cornerTopLeftShape', value], ['cornerStartStartShape', null], ['cornerStartEndShape', null]],
2123
+ cornerTopRightShape: value => [['cornerTopRightShape', value], ['cornerStartStartShape', null], ['cornerStartEndShape', null]],
2124
+ cornerBottomLeftShape: value => [['cornerBottomLeftShape', value], ['cornerEndStartShape', null], ['cornerEndEndShape', null]],
2125
+ cornerBottomRightShape: value => [['cornerBottomRightShape', value], ['cornerEndStartShape', null], ['cornerEndEndShape', null]],
2069
2126
  borderImage: value => [['borderImage', value], ['borderImageOutset', null], ['borderImageRepeat', null], ['borderImageSlice', null], ['borderImageSource', null], ['borderImageWidth', null]],
2070
2127
  columnRule: value => [['columnRule', value], ['columnRuleColor', null], ['columnRuleStyle', null], ['columnRuleWidth', null]],
2071
2128
  columns: value => [['columns', value], ['columnCount', null], ['columnWidth', null]],
@@ -2563,7 +2620,19 @@ function flatMapExpandedShorthands(objEntry, options) {
2563
2620
  if (Array.isArray(value)) {
2564
2621
  throw new Error('Cannot use fallbacks for shorthands. Use the expansion instead.');
2565
2622
  }
2566
- return expansion(value);
2623
+ try {
2624
+ return expansion(value);
2625
+ } catch (error) {
2626
+ const validationMode = options.propertyValidationMode ?? 'silent';
2627
+ if (validationMode === 'throw') {
2628
+ throw error;
2629
+ } else if (validationMode === 'warn') {
2630
+ console.warn(`[stylex] ${error.message}`);
2631
+ return [];
2632
+ } else {
2633
+ return [];
2634
+ }
2635
+ }
2567
2636
  }
2568
2637
  return [[key, value]];
2569
2638
  }
@@ -2581,8 +2650,8 @@ var hasRequiredDist;
2581
2650
  function requireDist () {
2582
2651
  if (hasRequiredDist) return dist;
2583
2652
  hasRequiredDist = 1;
2584
- (function (exports) {
2585
- class ParseError extends Error{sourceStart;sourceEnd;parserState;constructor(e,n,o,t){super(e),this.name="ParseError",this.sourceStart=n,this.sourceEnd=o,this.parserState=t;}}class ParseErrorWithToken extends ParseError{token;constructor(e,n,o,t,r){super(e,n,o,t),this.token=r;}}const e={UnexpectedNewLineInString:"Unexpected newline while consuming a string token.",UnexpectedEOFInString:"Unexpected EOF while consuming a string token.",UnexpectedEOFInComment:"Unexpected EOF while consuming a comment.",UnexpectedEOFInURL:"Unexpected EOF while consuming a url token.",UnexpectedEOFInEscapedCodePoint:"Unexpected EOF while consuming an escaped code point.",UnexpectedCharacterInURL:"Unexpected character while consuming a url token.",InvalidEscapeSequenceInURL:"Invalid escape sequence while consuming a url token.",InvalidEscapeSequenceAfterBackslash:'Invalid escape sequence after "\\"'},n="undefined"!=typeof globalThis&&"structuredClone"in globalThis;const o=13,t=45,r=10,s=43,i=65533;function checkIfFourCodePointsWouldStartCDO(e){return 60===e.source.codePointAt(e.cursor)&&33===e.source.codePointAt(e.cursor+1)&&e.source.codePointAt(e.cursor+2)===t&&e.source.codePointAt(e.cursor+3)===t}function isDigitCodePoint(e){return e>=48&&e<=57}function isUppercaseLetterCodePoint(e){return e>=65&&e<=90}function isLowercaseLetterCodePoint(e){return e>=97&&e<=122}function isHexDigitCodePoint(e){return e>=48&&e<=57||e>=97&&e<=102||e>=65&&e<=70}function isLetterCodePoint(e){return isLowercaseLetterCodePoint(e)||isUppercaseLetterCodePoint(e)}function isIdentStartCodePoint(e){return isLetterCodePoint(e)||isNonASCII_IdentCodePoint(e)||95===e}function isIdentCodePoint(e){return isIdentStartCodePoint(e)||isDigitCodePoint(e)||e===t}function isNonASCII_IdentCodePoint(e){return 183===e||8204===e||8205===e||8255===e||8256===e||8204===e||(192<=e&&e<=214||216<=e&&e<=246||248<=e&&e<=893||895<=e&&e<=8191||8304<=e&&e<=8591||11264<=e&&e<=12271||12289<=e&&e<=55295||63744<=e&&e<=64975||65008<=e&&e<=65533||(0===e||(!!isSurrogate(e)||e>=65536)))}function isNewLine(e){return e===r||e===o||12===e}function isWhitespace(e){return 32===e||e===r||9===e||e===o||12===e}function isSurrogate(e){return e>=55296&&e<=57343}function checkIfTwoCodePointsAreAValidEscape(e){return 92===e.source.codePointAt(e.cursor)&&!isNewLine(e.source.codePointAt(e.cursor+1)??-1)}function checkIfThreeCodePointsWouldStartAnIdentSequence(e,n){return n.source.codePointAt(n.cursor)===t?n.source.codePointAt(n.cursor+1)===t||(!!isIdentStartCodePoint(n.source.codePointAt(n.cursor+1)??-1)||92===n.source.codePointAt(n.cursor+1)&&!isNewLine(n.source.codePointAt(n.cursor+2)??-1)):!!isIdentStartCodePoint(n.source.codePointAt(n.cursor)??-1)||checkIfTwoCodePointsAreAValidEscape(n)}function checkIfThreeCodePointsWouldStartANumber(e){return e.source.codePointAt(e.cursor)===s||e.source.codePointAt(e.cursor)===t?!!isDigitCodePoint(e.source.codePointAt(e.cursor+1)??-1)||46===e.source.codePointAt(e.cursor+1)&&isDigitCodePoint(e.source.codePointAt(e.cursor+2)??-1):46===e.source.codePointAt(e.cursor)?isDigitCodePoint(e.source.codePointAt(e.cursor+1)??-1):isDigitCodePoint(e.source.codePointAt(e.cursor)??-1)}function checkIfTwoCodePointsStartAComment(e){return 47===e.source.codePointAt(e.cursor)&&42===e.source.codePointAt(e.cursor+1)}function checkIfThreeCodePointsWouldStartCDC(e){return e.source.codePointAt(e.cursor)===t&&e.source.codePointAt(e.cursor+1)===t&&62===e.source.codePointAt(e.cursor+2)}var c,a,u;function consumeComment(n,o){for(o.advanceCodePoint(2);;){const t=o.readCodePoint();if(void 0===t){const t=[exports.TokenType.Comment,o.source.slice(o.representationStart,o.representationEnd+1),o.representationStart,o.representationEnd,void 0];return n.onParseError(new ParseErrorWithToken(e.UnexpectedEOFInComment,o.representationStart,o.representationEnd,["4.3.2. Consume comments","Unexpected EOF"],t)),t}if(42===t&&(void 0!==o.source.codePointAt(o.cursor)&&47===o.source.codePointAt(o.cursor))){o.advanceCodePoint();break}}return [exports.TokenType.Comment,o.source.slice(o.representationStart,o.representationEnd+1),o.representationStart,o.representationEnd,void 0]}function consumeEscapedCodePoint(n,t){const s=t.readCodePoint();if(void 0===s)return n.onParseError(new ParseError(e.UnexpectedEOFInEscapedCodePoint,t.representationStart,t.representationEnd,["4.3.7. Consume an escaped code point","Unexpected EOF"])),i;if(isHexDigitCodePoint(s)){const e=[s];let n;for(;void 0!==(n=t.source.codePointAt(t.cursor))&&isHexDigitCodePoint(n)&&e.length<6;)e.push(n),t.advanceCodePoint();isWhitespace(t.source.codePointAt(t.cursor)??-1)&&(t.source.codePointAt(t.cursor)===o&&t.source.codePointAt(t.cursor+1)===r&&t.advanceCodePoint(),t.advanceCodePoint());const c=parseInt(String.fromCodePoint(...e),16);return 0===c||isSurrogate(c)||c>1114111?i:c}return 0===s||isSurrogate(s)?i:s}function consumeIdentSequence(e,n){const o=[];for(;;){const t=n.source.codePointAt(n.cursor)??-1;if(0===t||isSurrogate(t))o.push(i),n.advanceCodePoint(+(t>65535)+1);else if(isIdentCodePoint(t))o.push(t),n.advanceCodePoint(+(t>65535)+1);else {if(!checkIfTwoCodePointsAreAValidEscape(n))return o;n.advanceCodePoint(),o.push(consumeEscapedCodePoint(e,n));}}}function consumeHashToken(e,n){n.advanceCodePoint();const o=n.source.codePointAt(n.cursor);if(void 0!==o&&(isIdentCodePoint(o)||checkIfTwoCodePointsAreAValidEscape(n))){let o=exports.HashType.Unrestricted;checkIfThreeCodePointsWouldStartAnIdentSequence(0,n)&&(o=exports.HashType.ID);const t=consumeIdentSequence(e,n);return [exports.TokenType.Hash,n.source.slice(n.representationStart,n.representationEnd+1),n.representationStart,n.representationEnd,{value:String.fromCodePoint(...t),type:o}]}return [exports.TokenType.Delim,"#",n.representationStart,n.representationEnd,{value:"#"}]}function consumeNumber(e,n){let o=exports.NumberType.Integer;for(n.source.codePointAt(n.cursor)!==s&&n.source.codePointAt(n.cursor)!==t||n.advanceCodePoint();isDigitCodePoint(n.source.codePointAt(n.cursor)??-1);)n.advanceCodePoint();if(46===n.source.codePointAt(n.cursor)&&isDigitCodePoint(n.source.codePointAt(n.cursor+1)??-1))for(n.advanceCodePoint(2),o=exports.NumberType.Number;isDigitCodePoint(n.source.codePointAt(n.cursor)??-1);)n.advanceCodePoint();if(101===n.source.codePointAt(n.cursor)||69===n.source.codePointAt(n.cursor)){if(isDigitCodePoint(n.source.codePointAt(n.cursor+1)??-1))n.advanceCodePoint(2);else {if(n.source.codePointAt(n.cursor+1)!==t&&n.source.codePointAt(n.cursor+1)!==s||!isDigitCodePoint(n.source.codePointAt(n.cursor+2)??-1))return o;n.advanceCodePoint(3);}for(o=exports.NumberType.Number;isDigitCodePoint(n.source.codePointAt(n.cursor)??-1);)n.advanceCodePoint();}return o}function consumeNumericToken(e,n){let o;{const e=n.source.codePointAt(n.cursor);e===t?o="-":e===s&&(o="+");}const r=consumeNumber(0,n),i=parseFloat(n.source.slice(n.representationStart,n.representationEnd+1));if(checkIfThreeCodePointsWouldStartAnIdentSequence(0,n)){const t=consumeIdentSequence(e,n);return [exports.TokenType.Dimension,n.source.slice(n.representationStart,n.representationEnd+1),n.representationStart,n.representationEnd,{value:i,signCharacter:o,type:r,unit:String.fromCodePoint(...t)}]}return 37===n.source.codePointAt(n.cursor)?(n.advanceCodePoint(),[exports.TokenType.Percentage,n.source.slice(n.representationStart,n.representationEnd+1),n.representationStart,n.representationEnd,{value:i,signCharacter:o}]):[exports.TokenType.Number,n.source.slice(n.representationStart,n.representationEnd+1),n.representationStart,n.representationEnd,{value:i,signCharacter:o,type:r}]}function consumeWhiteSpace(e){for(;isWhitespace(e.source.codePointAt(e.cursor)??-1);)e.advanceCodePoint();return [exports.TokenType.Whitespace,e.source.slice(e.representationStart,e.representationEnd+1),e.representationStart,e.representationEnd,void 0]}exports.TokenType=void 0,(c=exports.TokenType||(exports.TokenType={})).Comment="comment",c.AtKeyword="at-keyword-token",c.BadString="bad-string-token",c.BadURL="bad-url-token",c.CDC="CDC-token",c.CDO="CDO-token",c.Colon="colon-token",c.Comma="comma-token",c.Delim="delim-token",c.Dimension="dimension-token",c.EOF="EOF-token",c.Function="function-token",c.Hash="hash-token",c.Ident="ident-token",c.Number="number-token",c.Percentage="percentage-token",c.Semicolon="semicolon-token",c.String="string-token",c.URL="url-token",c.Whitespace="whitespace-token",c.OpenParen="(-token",c.CloseParen=")-token",c.OpenSquare="[-token",c.CloseSquare="]-token",c.OpenCurly="{-token",c.CloseCurly="}-token",c.UnicodeRange="unicode-range-token",exports.NumberType=void 0,(a=exports.NumberType||(exports.NumberType={})).Integer="integer",a.Number="number",exports.HashType=void 0,(u=exports.HashType||(exports.HashType={})).Unrestricted="unrestricted",u.ID="id";class Reader{cursor=0;source="";representationStart=0;representationEnd=-1;constructor(e){this.source=e;}advanceCodePoint(e=1){this.cursor=this.cursor+e,this.representationEnd=this.cursor-1;}readCodePoint(){const e=this.source.codePointAt(this.cursor);if(void 0!==e)return this.cursor=this.cursor+1,this.representationEnd=this.cursor-1,e}unreadCodePoint(e=1){this.cursor=this.cursor-e,this.representationEnd=this.cursor-1;}resetRepresentation(){this.representationStart=this.cursor,this.representationEnd=-1;}}function consumeStringToken(n,t){let s="";const c=t.readCodePoint();for(;;){const a=t.readCodePoint();if(void 0===a){const o=[exports.TokenType.String,t.source.slice(t.representationStart,t.representationEnd+1),t.representationStart,t.representationEnd,{value:s}];return n.onParseError(new ParseErrorWithToken(e.UnexpectedEOFInString,t.representationStart,t.representationEnd,["4.3.5. Consume a string token","Unexpected EOF"],o)),o}if(isNewLine(a)){t.unreadCodePoint();const s=[exports.TokenType.BadString,t.source.slice(t.representationStart,t.representationEnd+1),t.representationStart,t.representationEnd,void 0];return n.onParseError(new ParseErrorWithToken(e.UnexpectedNewLineInString,t.representationStart,t.source.codePointAt(t.cursor)===o&&t.source.codePointAt(t.cursor+1)===r?t.representationEnd+2:t.representationEnd+1,["4.3.5. Consume a string token","Unexpected newline"],s)),s}if(a===c)return [exports.TokenType.String,t.source.slice(t.representationStart,t.representationEnd+1),t.representationStart,t.representationEnd,{value:s}];if(92!==a)0===a||isSurrogate(a)?s+=String.fromCodePoint(i):s+=String.fromCodePoint(a);else {if(void 0===t.source.codePointAt(t.cursor))continue;if(isNewLine(t.source.codePointAt(t.cursor)??-1)){t.source.codePointAt(t.cursor)===o&&t.source.codePointAt(t.cursor+1)===r&&t.advanceCodePoint(),t.advanceCodePoint();continue}s+=String.fromCodePoint(consumeEscapedCodePoint(n,t));}}}function checkIfCodePointsMatchURLIdent(e){return !(3!==e.length||117!==e[0]&&85!==e[0]||114!==e[1]&&82!==e[1]||108!==e[2]&&76!==e[2])}function consumeBadURL(e,n){for(;;){const o=n.source.codePointAt(n.cursor);if(void 0===o)return;if(41===o)return void n.advanceCodePoint();checkIfTwoCodePointsAreAValidEscape(n)?(n.advanceCodePoint(),consumeEscapedCodePoint(e,n)):n.advanceCodePoint();}}function consumeUrlToken(n,o){for(;isWhitespace(o.source.codePointAt(o.cursor)??-1);)o.advanceCodePoint();let t="";for(;;){if(void 0===o.source.codePointAt(o.cursor)){const r=[exports.TokenType.URL,o.source.slice(o.representationStart,o.representationEnd+1),o.representationStart,o.representationEnd,{value:t}];return n.onParseError(new ParseErrorWithToken(e.UnexpectedEOFInURL,o.representationStart,o.representationEnd,["4.3.6. Consume a url token","Unexpected EOF"],r)),r}if(41===o.source.codePointAt(o.cursor))return o.advanceCodePoint(),[exports.TokenType.URL,o.source.slice(o.representationStart,o.representationEnd+1),o.representationStart,o.representationEnd,{value:t}];if(isWhitespace(o.source.codePointAt(o.cursor)??-1)){for(o.advanceCodePoint();isWhitespace(o.source.codePointAt(o.cursor)??-1);)o.advanceCodePoint();if(void 0===o.source.codePointAt(o.cursor)){const r=[exports.TokenType.URL,o.source.slice(o.representationStart,o.representationEnd+1),o.representationStart,o.representationEnd,{value:t}];return n.onParseError(new ParseErrorWithToken(e.UnexpectedEOFInURL,o.representationStart,o.representationEnd,["4.3.6. Consume a url token","Consume as much whitespace as possible","Unexpected EOF"],r)),r}return 41===o.source.codePointAt(o.cursor)?(o.advanceCodePoint(),[exports.TokenType.URL,o.source.slice(o.representationStart,o.representationEnd+1),o.representationStart,o.representationEnd,{value:t}]):(consumeBadURL(n,o),[exports.TokenType.BadURL,o.source.slice(o.representationStart,o.representationEnd+1),o.representationStart,o.representationEnd,void 0])}const s=o.source.codePointAt(o.cursor);if(34===s||39===s||40===s||(11===(r=s??-1)||127===r||0<=r&&r<=8||14<=r&&r<=31)){consumeBadURL(n,o);const t=[exports.TokenType.BadURL,o.source.slice(o.representationStart,o.representationEnd+1),o.representationStart,o.representationEnd,void 0];return n.onParseError(new ParseErrorWithToken(e.UnexpectedCharacterInURL,o.representationStart,o.representationEnd,["4.3.6. Consume a url token","Unexpected U+0022 QUOTATION MARK (\"), U+0027 APOSTROPHE ('), U+0028 LEFT PARENTHESIS (() or non-printable code point"],t)),t}if(92===s){if(checkIfTwoCodePointsAreAValidEscape(o)){o.advanceCodePoint(),t+=String.fromCodePoint(consumeEscapedCodePoint(n,o));continue}consumeBadURL(n,o);const r=[exports.TokenType.BadURL,o.source.slice(o.representationStart,o.representationEnd+1),o.representationStart,o.representationEnd,void 0];return n.onParseError(new ParseErrorWithToken(e.InvalidEscapeSequenceInURL,o.representationStart,o.representationEnd,["4.3.6. Consume a url token","U+005C REVERSE SOLIDUS (\\)","The input stream does not start with a valid escape sequence"],r)),r}0===o.source.codePointAt(o.cursor)||isSurrogate(o.source.codePointAt(o.cursor)??-1)?(t+=String.fromCodePoint(i),o.advanceCodePoint()):(t+=o.source[o.cursor],o.advanceCodePoint());}var r;}function consumeIdentLikeToken(e,n){const o=consumeIdentSequence(e,n);if(40!==n.source.codePointAt(n.cursor))return [exports.TokenType.Ident,n.source.slice(n.representationStart,n.representationEnd+1),n.representationStart,n.representationEnd,{value:String.fromCodePoint(...o)}];if(checkIfCodePointsMatchURLIdent(o)){n.advanceCodePoint();let t=0;for(;;){const e=isWhitespace(n.source.codePointAt(n.cursor)??-1),r=isWhitespace(n.source.codePointAt(n.cursor+1)??-1);if(e&&r){t+=1,n.advanceCodePoint(1);continue}const s=e?n.source.codePointAt(n.cursor+1):n.source.codePointAt(n.cursor);if(34===s||39===s)return t>0&&n.unreadCodePoint(t),[exports.TokenType.Function,n.source.slice(n.representationStart,n.representationEnd+1),n.representationStart,n.representationEnd,{value:String.fromCodePoint(...o)}];break}return consumeUrlToken(e,n)}return n.advanceCodePoint(),[exports.TokenType.Function,n.source.slice(n.representationStart,n.representationEnd+1),n.representationStart,n.representationEnd,{value:String.fromCodePoint(...o)}]}function checkIfThreeCodePointsWouldStartAUnicodeRange(e){return !(117!==e.source.codePointAt(e.cursor)&&85!==e.source.codePointAt(e.cursor)||e.source.codePointAt(e.cursor+1)!==s||63!==e.source.codePointAt(e.cursor+2)&&!isHexDigitCodePoint(e.source.codePointAt(e.cursor+2)??-1))}function consumeUnicodeRangeToken(e,n){n.advanceCodePoint(2);const o=[],r=[];let s;for(;void 0!==(s=n.source.codePointAt(n.cursor))&&o.length<6&&isHexDigitCodePoint(s);)o.push(s),n.advanceCodePoint();for(;void 0!==(s=n.source.codePointAt(n.cursor))&&o.length<6&&63===s;)0===r.length&&r.push(...o),o.push(48),r.push(70),n.advanceCodePoint();if(!r.length&&n.source.codePointAt(n.cursor)===t&&isHexDigitCodePoint(n.source.codePointAt(n.cursor+1)??-1))for(n.advanceCodePoint();void 0!==(s=n.source.codePointAt(n.cursor))&&r.length<6&&isHexDigitCodePoint(s);)r.push(s),n.advanceCodePoint();if(!r.length){const e=parseInt(String.fromCodePoint(...o),16);return [exports.TokenType.UnicodeRange,n.source.slice(n.representationStart,n.representationEnd+1),n.representationStart,n.representationEnd,{startOfRange:e,endOfRange:e}]}const i=parseInt(String.fromCodePoint(...o),16),c=parseInt(String.fromCodePoint(...r),16);return [exports.TokenType.UnicodeRange,n.source.slice(n.representationStart,n.representationEnd+1),n.representationStart,n.representationEnd,{startOfRange:i,endOfRange:c}]}function tokenizer(n,i){const c=n.css.valueOf(),a=n.unicodeRangesAllowed??false,u=new Reader(c),d={onParseError:i?.onParseError??noop};return {nextToken:function nextToken(){u.resetRepresentation();const n=u.source.codePointAt(u.cursor);if(void 0===n)return [exports.TokenType.EOF,"",-1,-1,void 0];if(47===n&&checkIfTwoCodePointsStartAComment(u))return consumeComment(d,u);if(a&&(117===n||85===n)&&checkIfThreeCodePointsWouldStartAUnicodeRange(u))return consumeUnicodeRangeToken(0,u);if(isIdentStartCodePoint(n))return consumeIdentLikeToken(d,u);if(isDigitCodePoint(n))return consumeNumericToken(d,u);switch(n){case 44:return u.advanceCodePoint(),[exports.TokenType.Comma,",",u.representationStart,u.representationEnd,void 0];case 58:return u.advanceCodePoint(),[exports.TokenType.Colon,":",u.representationStart,u.representationEnd,void 0];case 59:return u.advanceCodePoint(),[exports.TokenType.Semicolon,";",u.representationStart,u.representationEnd,void 0];case 40:return u.advanceCodePoint(),[exports.TokenType.OpenParen,"(",u.representationStart,u.representationEnd,void 0];case 41:return u.advanceCodePoint(),[exports.TokenType.CloseParen,")",u.representationStart,u.representationEnd,void 0];case 91:return u.advanceCodePoint(),[exports.TokenType.OpenSquare,"[",u.representationStart,u.representationEnd,void 0];case 93:return u.advanceCodePoint(),[exports.TokenType.CloseSquare,"]",u.representationStart,u.representationEnd,void 0];case 123:return u.advanceCodePoint(),[exports.TokenType.OpenCurly,"{",u.representationStart,u.representationEnd,void 0];case 125:return u.advanceCodePoint(),[exports.TokenType.CloseCurly,"}",u.representationStart,u.representationEnd,void 0];case 39:case 34:return consumeStringToken(d,u);case 35:return consumeHashToken(d,u);case s:case 46:return checkIfThreeCodePointsWouldStartANumber(u)?consumeNumericToken(d,u):(u.advanceCodePoint(),[exports.TokenType.Delim,u.source[u.representationStart],u.representationStart,u.representationEnd,{value:u.source[u.representationStart]}]);case r:case o:case 12:case 9:case 32:return consumeWhiteSpace(u);case t:return checkIfThreeCodePointsWouldStartANumber(u)?consumeNumericToken(d,u):checkIfThreeCodePointsWouldStartCDC(u)?(u.advanceCodePoint(3),[exports.TokenType.CDC,"--\x3e",u.representationStart,u.representationEnd,void 0]):checkIfThreeCodePointsWouldStartAnIdentSequence(0,u)?consumeIdentLikeToken(d,u):(u.advanceCodePoint(),[exports.TokenType.Delim,"-",u.representationStart,u.representationEnd,{value:"-"}]);case 60:return checkIfFourCodePointsWouldStartCDO(u)?(u.advanceCodePoint(4),[exports.TokenType.CDO,"\x3c!--",u.representationStart,u.representationEnd,void 0]):(u.advanceCodePoint(),[exports.TokenType.Delim,"<",u.representationStart,u.representationEnd,{value:"<"}]);case 64:if(u.advanceCodePoint(),checkIfThreeCodePointsWouldStartAnIdentSequence(0,u)){const e=consumeIdentSequence(d,u);return [exports.TokenType.AtKeyword,u.source.slice(u.representationStart,u.representationEnd+1),u.representationStart,u.representationEnd,{value:String.fromCodePoint(...e)}]}return [exports.TokenType.Delim,"@",u.representationStart,u.representationEnd,{value:"@"}];case 92:{if(checkIfTwoCodePointsAreAValidEscape(u))return consumeIdentLikeToken(d,u);u.advanceCodePoint();const n=[exports.TokenType.Delim,"\\",u.representationStart,u.representationEnd,{value:"\\"}];return d.onParseError(new ParseErrorWithToken(e.InvalidEscapeSequenceAfterBackslash,u.representationStart,u.representationEnd,["4.3.1. Consume a token","U+005C REVERSE SOLIDUS (\\)","The input stream does not start with a valid escape sequence"],n)),n}}return u.advanceCodePoint(),[exports.TokenType.Delim,u.source[u.representationStart],u.representationStart,u.representationEnd,{value:u.source[u.representationStart]}]},endOfFile:function endOfFile(){return void 0===u.source.codePointAt(u.cursor)}}}function noop(){}function serializeIdent(e){let n=0;if(0===e[0])e.splice(0,1,i),n=1;else if(e[0]===t&&e[1]===t)n=2;else if(e[0]===t&&e[1])n=2,isIdentStartCodePoint(e[1])||(n+=insertEscapedCodePoint(e,1,e[1]));else {if(e[0]===t&&!e[1])return [92,e[0]];isIdentStartCodePoint(e[0])?n=1:(n=1,n+=insertEscapedCodePoint(e,0,e[0]));}for(let o=n;o<e.length;o++)0!==e[o]?isIdentCodePoint(e[o])||(o+=insertEscapedCharacter(e,o,e[o])):(e.splice(o,1,i),o++);return e}function insertEscapedCharacter(e,n,o){return e.splice(n,1,92,o),1}function insertEscapedCodePoint(e,n,o){const t=o.toString(16),r=[];for(const e of t)r.push(e.codePointAt(0));return e.splice(n,1,92,...r,32),1+r.length}const d=Object.values(exports.TokenType);exports.ParseError=ParseError,exports.ParseErrorMessage=e,exports.ParseErrorWithToken=ParseErrorWithToken,exports.cloneTokens=function cloneTokens(e){return n?structuredClone(e):JSON.parse(JSON.stringify(e))},exports.isToken=function isToken(e){return !!Array.isArray(e)&&(!(e.length<4)&&(!!d.includes(e[0])&&("string"==typeof e[1]&&("number"==typeof e[2]&&"number"==typeof e[3]))))},exports.isTokenAtKeyword=function isTokenAtKeyword(e){return !!e&&e[0]===exports.TokenType.AtKeyword},exports.isTokenBadString=function isTokenBadString(e){return !!e&&e[0]===exports.TokenType.BadString},exports.isTokenBadURL=function isTokenBadURL(e){return !!e&&e[0]===exports.TokenType.BadURL},exports.isTokenCDC=function isTokenCDC(e){return !!e&&e[0]===exports.TokenType.CDC},exports.isTokenCDO=function isTokenCDO(e){return !!e&&e[0]===exports.TokenType.CDO},exports.isTokenCloseCurly=function isTokenCloseCurly(e){return !!e&&e[0]===exports.TokenType.CloseCurly},exports.isTokenCloseParen=function isTokenCloseParen(e){return !!e&&e[0]===exports.TokenType.CloseParen},exports.isTokenCloseSquare=function isTokenCloseSquare(e){return !!e&&e[0]===exports.TokenType.CloseSquare},exports.isTokenColon=function isTokenColon(e){return !!e&&e[0]===exports.TokenType.Colon},exports.isTokenComma=function isTokenComma(e){return !!e&&e[0]===exports.TokenType.Comma},exports.isTokenComment=function isTokenComment(e){return !!e&&e[0]===exports.TokenType.Comment},exports.isTokenDelim=function isTokenDelim(e){return !!e&&e[0]===exports.TokenType.Delim},exports.isTokenDimension=function isTokenDimension(e){return !!e&&e[0]===exports.TokenType.Dimension},exports.isTokenEOF=function isTokenEOF(e){return !!e&&e[0]===exports.TokenType.EOF},exports.isTokenFunction=function isTokenFunction(e){return !!e&&e[0]===exports.TokenType.Function},exports.isTokenHash=function isTokenHash(e){return !!e&&e[0]===exports.TokenType.Hash},exports.isTokenIdent=function isTokenIdent(e){return !!e&&e[0]===exports.TokenType.Ident},exports.isTokenNumber=function isTokenNumber(e){return !!e&&e[0]===exports.TokenType.Number},exports.isTokenNumeric=function isTokenNumeric(e){if(!e)return false;switch(e[0]){case exports.TokenType.Dimension:case exports.TokenType.Number:case exports.TokenType.Percentage:return true;default:return false}},exports.isTokenOpenCurly=function isTokenOpenCurly(e){return !!e&&e[0]===exports.TokenType.OpenCurly},exports.isTokenOpenParen=function isTokenOpenParen(e){return !!e&&e[0]===exports.TokenType.OpenParen},exports.isTokenOpenSquare=function isTokenOpenSquare(e){return !!e&&e[0]===exports.TokenType.OpenSquare},exports.isTokenPercentage=function isTokenPercentage(e){return !!e&&e[0]===exports.TokenType.Percentage},exports.isTokenSemicolon=function isTokenSemicolon(e){return !!e&&e[0]===exports.TokenType.Semicolon},exports.isTokenString=function isTokenString(e){return !!e&&e[0]===exports.TokenType.String},exports.isTokenURL=function isTokenURL(e){return !!e&&e[0]===exports.TokenType.URL},exports.isTokenUnicodeRange=function isTokenUnicodeRange(e){return !!e&&e[0]===exports.TokenType.UnicodeRange},exports.isTokenWhiteSpaceOrComment=function isTokenWhiteSpaceOrComment(e){if(!e)return false;switch(e[0]){case exports.TokenType.Whitespace:case exports.TokenType.Comment:return true;default:return false}},exports.isTokenWhitespace=function isTokenWhitespace(e){return !!e&&e[0]===exports.TokenType.Whitespace},exports.mirrorVariant=function mirrorVariant(e){switch(e[0]){case exports.TokenType.OpenParen:return [exports.TokenType.CloseParen,")",-1,-1,void 0];case exports.TokenType.CloseParen:return [exports.TokenType.OpenParen,"(",-1,-1,void 0];case exports.TokenType.OpenCurly:return [exports.TokenType.CloseCurly,"}",-1,-1,void 0];case exports.TokenType.CloseCurly:return [exports.TokenType.OpenCurly,"{",-1,-1,void 0];case exports.TokenType.OpenSquare:return [exports.TokenType.CloseSquare,"]",-1,-1,void 0];case exports.TokenType.CloseSquare:return [exports.TokenType.OpenSquare,"[",-1,-1,void 0];default:return null}},exports.mirrorVariantType=function mirrorVariantType(e){switch(e){case exports.TokenType.OpenParen:return exports.TokenType.CloseParen;case exports.TokenType.CloseParen:return exports.TokenType.OpenParen;case exports.TokenType.OpenCurly:return exports.TokenType.CloseCurly;case exports.TokenType.CloseCurly:return exports.TokenType.OpenCurly;case exports.TokenType.OpenSquare:return exports.TokenType.CloseSquare;case exports.TokenType.CloseSquare:return exports.TokenType.OpenSquare;default:return null}},exports.mutateIdent=function mutateIdent(e,n){const o=[];for(const e of n)o.push(e.codePointAt(0));const t=String.fromCodePoint(...serializeIdent(o));e[1]=t,e[4].value=n;},exports.mutateUnit=function mutateUnit(e,n){const o=[];for(const e of n)o.push(e.codePointAt(0));const t=serializeIdent(o);101===t[0]&&insertEscapedCodePoint(t,0,t[0]);const r=String.fromCodePoint(...t),s="+"===e[4].signCharacter?e[4].signCharacter:"",i=e[4].value.toString();e[1]=`${s}${i}${r}`,e[4].unit=n;},exports.stringify=function stringify(...e){let n="";for(let o=0;o<e.length;o++)n+=e[o][1];return n},exports.tokenize=function tokenize(e,n){const o=tokenizer(e,n),t=[];for(;!o.endOfFile();)t.push(o.nextToken());return t.push(o.nextToken()),t},exports.tokenizer=tokenizer;
2653
+ (function (exports$1) {
2654
+ class ParseError extends Error{sourceStart;sourceEnd;parserState;constructor(e,n,o,t){super(e),this.name="ParseError",this.sourceStart=n,this.sourceEnd=o,this.parserState=t;}}class ParseErrorWithToken extends ParseError{token;constructor(e,n,o,t,r){super(e,n,o,t),this.token=r;}}const e={UnexpectedNewLineInString:"Unexpected newline while consuming a string token.",UnexpectedEOFInString:"Unexpected EOF while consuming a string token.",UnexpectedEOFInComment:"Unexpected EOF while consuming a comment.",UnexpectedEOFInURL:"Unexpected EOF while consuming a url token.",UnexpectedEOFInEscapedCodePoint:"Unexpected EOF while consuming an escaped code point.",UnexpectedCharacterInURL:"Unexpected character while consuming a url token.",InvalidEscapeSequenceInURL:"Invalid escape sequence while consuming a url token.",InvalidEscapeSequenceAfterBackslash:'Invalid escape sequence after "\\"'},n="undefined"!=typeof globalThis&&"structuredClone"in globalThis;const o=13,t=45,r=10,s=43,i=65533;function checkIfFourCodePointsWouldStartCDO(e){return 60===e.source.codePointAt(e.cursor)&&33===e.source.codePointAt(e.cursor+1)&&e.source.codePointAt(e.cursor+2)===t&&e.source.codePointAt(e.cursor+3)===t}function isDigitCodePoint(e){return e>=48&&e<=57}function isUppercaseLetterCodePoint(e){return e>=65&&e<=90}function isLowercaseLetterCodePoint(e){return e>=97&&e<=122}function isHexDigitCodePoint(e){return e>=48&&e<=57||e>=97&&e<=102||e>=65&&e<=70}function isLetterCodePoint(e){return isLowercaseLetterCodePoint(e)||isUppercaseLetterCodePoint(e)}function isIdentStartCodePoint(e){return isLetterCodePoint(e)||isNonASCII_IdentCodePoint(e)||95===e}function isIdentCodePoint(e){return isIdentStartCodePoint(e)||isDigitCodePoint(e)||e===t}function isNonASCII_IdentCodePoint(e){return 183===e||8204===e||8205===e||8255===e||8256===e||8204===e||(192<=e&&e<=214||216<=e&&e<=246||248<=e&&e<=893||895<=e&&e<=8191||8304<=e&&e<=8591||11264<=e&&e<=12271||12289<=e&&e<=55295||63744<=e&&e<=64975||65008<=e&&e<=65533||(0===e||(!!isSurrogate(e)||e>=65536)))}function isNewLine(e){return e===r||e===o||12===e}function isWhitespace(e){return 32===e||e===r||9===e||e===o||12===e}function isSurrogate(e){return e>=55296&&e<=57343}function checkIfTwoCodePointsAreAValidEscape(e){return 92===e.source.codePointAt(e.cursor)&&!isNewLine(e.source.codePointAt(e.cursor+1)??-1)}function checkIfThreeCodePointsWouldStartAnIdentSequence(e,n){return n.source.codePointAt(n.cursor)===t?n.source.codePointAt(n.cursor+1)===t||(!!isIdentStartCodePoint(n.source.codePointAt(n.cursor+1)??-1)||92===n.source.codePointAt(n.cursor+1)&&!isNewLine(n.source.codePointAt(n.cursor+2)??-1)):!!isIdentStartCodePoint(n.source.codePointAt(n.cursor)??-1)||checkIfTwoCodePointsAreAValidEscape(n)}function checkIfThreeCodePointsWouldStartANumber(e){return e.source.codePointAt(e.cursor)===s||e.source.codePointAt(e.cursor)===t?!!isDigitCodePoint(e.source.codePointAt(e.cursor+1)??-1)||46===e.source.codePointAt(e.cursor+1)&&isDigitCodePoint(e.source.codePointAt(e.cursor+2)??-1):46===e.source.codePointAt(e.cursor)?isDigitCodePoint(e.source.codePointAt(e.cursor+1)??-1):isDigitCodePoint(e.source.codePointAt(e.cursor)??-1)}function checkIfTwoCodePointsStartAComment(e){return 47===e.source.codePointAt(e.cursor)&&42===e.source.codePointAt(e.cursor+1)}function checkIfThreeCodePointsWouldStartCDC(e){return e.source.codePointAt(e.cursor)===t&&e.source.codePointAt(e.cursor+1)===t&&62===e.source.codePointAt(e.cursor+2)}var c,a,u;function consumeComment(n,o){for(o.advanceCodePoint(2);;){const t=o.readCodePoint();if(void 0===t){const t=[exports$1.TokenType.Comment,o.source.slice(o.representationStart,o.representationEnd+1),o.representationStart,o.representationEnd,void 0];return n.onParseError(new ParseErrorWithToken(e.UnexpectedEOFInComment,o.representationStart,o.representationEnd,["4.3.2. Consume comments","Unexpected EOF"],t)),t}if(42===t&&(void 0!==o.source.codePointAt(o.cursor)&&47===o.source.codePointAt(o.cursor))){o.advanceCodePoint();break}}return [exports$1.TokenType.Comment,o.source.slice(o.representationStart,o.representationEnd+1),o.representationStart,o.representationEnd,void 0]}function consumeEscapedCodePoint(n,t){const s=t.readCodePoint();if(void 0===s)return n.onParseError(new ParseError(e.UnexpectedEOFInEscapedCodePoint,t.representationStart,t.representationEnd,["4.3.7. Consume an escaped code point","Unexpected EOF"])),i;if(isHexDigitCodePoint(s)){const e=[s];let n;for(;void 0!==(n=t.source.codePointAt(t.cursor))&&isHexDigitCodePoint(n)&&e.length<6;)e.push(n),t.advanceCodePoint();isWhitespace(t.source.codePointAt(t.cursor)??-1)&&(t.source.codePointAt(t.cursor)===o&&t.source.codePointAt(t.cursor+1)===r&&t.advanceCodePoint(),t.advanceCodePoint());const c=parseInt(String.fromCodePoint(...e),16);return 0===c||isSurrogate(c)||c>1114111?i:c}return 0===s||isSurrogate(s)?i:s}function consumeIdentSequence(e,n){const o=[];for(;;){const t=n.source.codePointAt(n.cursor)??-1;if(0===t||isSurrogate(t))o.push(i),n.advanceCodePoint(+(t>65535)+1);else if(isIdentCodePoint(t))o.push(t),n.advanceCodePoint(+(t>65535)+1);else {if(!checkIfTwoCodePointsAreAValidEscape(n))return o;n.advanceCodePoint(),o.push(consumeEscapedCodePoint(e,n));}}}function consumeHashToken(e,n){n.advanceCodePoint();const o=n.source.codePointAt(n.cursor);if(void 0!==o&&(isIdentCodePoint(o)||checkIfTwoCodePointsAreAValidEscape(n))){let o=exports$1.HashType.Unrestricted;checkIfThreeCodePointsWouldStartAnIdentSequence(0,n)&&(o=exports$1.HashType.ID);const t=consumeIdentSequence(e,n);return [exports$1.TokenType.Hash,n.source.slice(n.representationStart,n.representationEnd+1),n.representationStart,n.representationEnd,{value:String.fromCodePoint(...t),type:o}]}return [exports$1.TokenType.Delim,"#",n.representationStart,n.representationEnd,{value:"#"}]}function consumeNumber(e,n){let o=exports$1.NumberType.Integer;for(n.source.codePointAt(n.cursor)!==s&&n.source.codePointAt(n.cursor)!==t||n.advanceCodePoint();isDigitCodePoint(n.source.codePointAt(n.cursor)??-1);)n.advanceCodePoint();if(46===n.source.codePointAt(n.cursor)&&isDigitCodePoint(n.source.codePointAt(n.cursor+1)??-1))for(n.advanceCodePoint(2),o=exports$1.NumberType.Number;isDigitCodePoint(n.source.codePointAt(n.cursor)??-1);)n.advanceCodePoint();if(101===n.source.codePointAt(n.cursor)||69===n.source.codePointAt(n.cursor)){if(isDigitCodePoint(n.source.codePointAt(n.cursor+1)??-1))n.advanceCodePoint(2);else {if(n.source.codePointAt(n.cursor+1)!==t&&n.source.codePointAt(n.cursor+1)!==s||!isDigitCodePoint(n.source.codePointAt(n.cursor+2)??-1))return o;n.advanceCodePoint(3);}for(o=exports$1.NumberType.Number;isDigitCodePoint(n.source.codePointAt(n.cursor)??-1);)n.advanceCodePoint();}return o}function consumeNumericToken(e,n){let o;{const e=n.source.codePointAt(n.cursor);e===t?o="-":e===s&&(o="+");}const r=consumeNumber(0,n),i=parseFloat(n.source.slice(n.representationStart,n.representationEnd+1));if(checkIfThreeCodePointsWouldStartAnIdentSequence(0,n)){const t=consumeIdentSequence(e,n);return [exports$1.TokenType.Dimension,n.source.slice(n.representationStart,n.representationEnd+1),n.representationStart,n.representationEnd,{value:i,signCharacter:o,type:r,unit:String.fromCodePoint(...t)}]}return 37===n.source.codePointAt(n.cursor)?(n.advanceCodePoint(),[exports$1.TokenType.Percentage,n.source.slice(n.representationStart,n.representationEnd+1),n.representationStart,n.representationEnd,{value:i,signCharacter:o}]):[exports$1.TokenType.Number,n.source.slice(n.representationStart,n.representationEnd+1),n.representationStart,n.representationEnd,{value:i,signCharacter:o,type:r}]}function consumeWhiteSpace(e){for(;isWhitespace(e.source.codePointAt(e.cursor)??-1);)e.advanceCodePoint();return [exports$1.TokenType.Whitespace,e.source.slice(e.representationStart,e.representationEnd+1),e.representationStart,e.representationEnd,void 0]}exports$1.TokenType=void 0,(c=exports$1.TokenType||(exports$1.TokenType={})).Comment="comment",c.AtKeyword="at-keyword-token",c.BadString="bad-string-token",c.BadURL="bad-url-token",c.CDC="CDC-token",c.CDO="CDO-token",c.Colon="colon-token",c.Comma="comma-token",c.Delim="delim-token",c.Dimension="dimension-token",c.EOF="EOF-token",c.Function="function-token",c.Hash="hash-token",c.Ident="ident-token",c.Number="number-token",c.Percentage="percentage-token",c.Semicolon="semicolon-token",c.String="string-token",c.URL="url-token",c.Whitespace="whitespace-token",c.OpenParen="(-token",c.CloseParen=")-token",c.OpenSquare="[-token",c.CloseSquare="]-token",c.OpenCurly="{-token",c.CloseCurly="}-token",c.UnicodeRange="unicode-range-token",exports$1.NumberType=void 0,(a=exports$1.NumberType||(exports$1.NumberType={})).Integer="integer",a.Number="number",exports$1.HashType=void 0,(u=exports$1.HashType||(exports$1.HashType={})).Unrestricted="unrestricted",u.ID="id";class Reader{cursor=0;source="";representationStart=0;representationEnd=-1;constructor(e){this.source=e;}advanceCodePoint(e=1){this.cursor=this.cursor+e,this.representationEnd=this.cursor-1;}readCodePoint(){const e=this.source.codePointAt(this.cursor);if(void 0!==e)return this.cursor=this.cursor+1,this.representationEnd=this.cursor-1,e}unreadCodePoint(e=1){this.cursor=this.cursor-e,this.representationEnd=this.cursor-1;}resetRepresentation(){this.representationStart=this.cursor,this.representationEnd=-1;}}function consumeStringToken(n,t){let s="";const c=t.readCodePoint();for(;;){const a=t.readCodePoint();if(void 0===a){const o=[exports$1.TokenType.String,t.source.slice(t.representationStart,t.representationEnd+1),t.representationStart,t.representationEnd,{value:s}];return n.onParseError(new ParseErrorWithToken(e.UnexpectedEOFInString,t.representationStart,t.representationEnd,["4.3.5. Consume a string token","Unexpected EOF"],o)),o}if(isNewLine(a)){t.unreadCodePoint();const s=[exports$1.TokenType.BadString,t.source.slice(t.representationStart,t.representationEnd+1),t.representationStart,t.representationEnd,void 0];return n.onParseError(new ParseErrorWithToken(e.UnexpectedNewLineInString,t.representationStart,t.source.codePointAt(t.cursor)===o&&t.source.codePointAt(t.cursor+1)===r?t.representationEnd+2:t.representationEnd+1,["4.3.5. Consume a string token","Unexpected newline"],s)),s}if(a===c)return [exports$1.TokenType.String,t.source.slice(t.representationStart,t.representationEnd+1),t.representationStart,t.representationEnd,{value:s}];if(92!==a)0===a||isSurrogate(a)?s+=String.fromCodePoint(i):s+=String.fromCodePoint(a);else {if(void 0===t.source.codePointAt(t.cursor))continue;if(isNewLine(t.source.codePointAt(t.cursor)??-1)){t.source.codePointAt(t.cursor)===o&&t.source.codePointAt(t.cursor+1)===r&&t.advanceCodePoint(),t.advanceCodePoint();continue}s+=String.fromCodePoint(consumeEscapedCodePoint(n,t));}}}function checkIfCodePointsMatchURLIdent(e){return !(3!==e.length||117!==e[0]&&85!==e[0]||114!==e[1]&&82!==e[1]||108!==e[2]&&76!==e[2])}function consumeBadURL(e,n){for(;;){const o=n.source.codePointAt(n.cursor);if(void 0===o)return;if(41===o)return void n.advanceCodePoint();checkIfTwoCodePointsAreAValidEscape(n)?(n.advanceCodePoint(),consumeEscapedCodePoint(e,n)):n.advanceCodePoint();}}function consumeUrlToken(n,o){for(;isWhitespace(o.source.codePointAt(o.cursor)??-1);)o.advanceCodePoint();let t="";for(;;){if(void 0===o.source.codePointAt(o.cursor)){const r=[exports$1.TokenType.URL,o.source.slice(o.representationStart,o.representationEnd+1),o.representationStart,o.representationEnd,{value:t}];return n.onParseError(new ParseErrorWithToken(e.UnexpectedEOFInURL,o.representationStart,o.representationEnd,["4.3.6. Consume a url token","Unexpected EOF"],r)),r}if(41===o.source.codePointAt(o.cursor))return o.advanceCodePoint(),[exports$1.TokenType.URL,o.source.slice(o.representationStart,o.representationEnd+1),o.representationStart,o.representationEnd,{value:t}];if(isWhitespace(o.source.codePointAt(o.cursor)??-1)){for(o.advanceCodePoint();isWhitespace(o.source.codePointAt(o.cursor)??-1);)o.advanceCodePoint();if(void 0===o.source.codePointAt(o.cursor)){const r=[exports$1.TokenType.URL,o.source.slice(o.representationStart,o.representationEnd+1),o.representationStart,o.representationEnd,{value:t}];return n.onParseError(new ParseErrorWithToken(e.UnexpectedEOFInURL,o.representationStart,o.representationEnd,["4.3.6. Consume a url token","Consume as much whitespace as possible","Unexpected EOF"],r)),r}return 41===o.source.codePointAt(o.cursor)?(o.advanceCodePoint(),[exports$1.TokenType.URL,o.source.slice(o.representationStart,o.representationEnd+1),o.representationStart,o.representationEnd,{value:t}]):(consumeBadURL(n,o),[exports$1.TokenType.BadURL,o.source.slice(o.representationStart,o.representationEnd+1),o.representationStart,o.representationEnd,void 0])}const s=o.source.codePointAt(o.cursor);if(34===s||39===s||40===s||(11===(r=s??-1)||127===r||0<=r&&r<=8||14<=r&&r<=31)){consumeBadURL(n,o);const t=[exports$1.TokenType.BadURL,o.source.slice(o.representationStart,o.representationEnd+1),o.representationStart,o.representationEnd,void 0];return n.onParseError(new ParseErrorWithToken(e.UnexpectedCharacterInURL,o.representationStart,o.representationEnd,["4.3.6. Consume a url token","Unexpected U+0022 QUOTATION MARK (\"), U+0027 APOSTROPHE ('), U+0028 LEFT PARENTHESIS (() or non-printable code point"],t)),t}if(92===s){if(checkIfTwoCodePointsAreAValidEscape(o)){o.advanceCodePoint(),t+=String.fromCodePoint(consumeEscapedCodePoint(n,o));continue}consumeBadURL(n,o);const r=[exports$1.TokenType.BadURL,o.source.slice(o.representationStart,o.representationEnd+1),o.representationStart,o.representationEnd,void 0];return n.onParseError(new ParseErrorWithToken(e.InvalidEscapeSequenceInURL,o.representationStart,o.representationEnd,["4.3.6. Consume a url token","U+005C REVERSE SOLIDUS (\\)","The input stream does not start with a valid escape sequence"],r)),r}0===o.source.codePointAt(o.cursor)||isSurrogate(o.source.codePointAt(o.cursor)??-1)?(t+=String.fromCodePoint(i),o.advanceCodePoint()):(t+=o.source[o.cursor],o.advanceCodePoint());}var r;}function consumeIdentLikeToken(e,n){const o=consumeIdentSequence(e,n);if(40!==n.source.codePointAt(n.cursor))return [exports$1.TokenType.Ident,n.source.slice(n.representationStart,n.representationEnd+1),n.representationStart,n.representationEnd,{value:String.fromCodePoint(...o)}];if(checkIfCodePointsMatchURLIdent(o)){n.advanceCodePoint();let t=0;for(;;){const e=isWhitespace(n.source.codePointAt(n.cursor)??-1),r=isWhitespace(n.source.codePointAt(n.cursor+1)??-1);if(e&&r){t+=1,n.advanceCodePoint(1);continue}const s=e?n.source.codePointAt(n.cursor+1):n.source.codePointAt(n.cursor);if(34===s||39===s)return t>0&&n.unreadCodePoint(t),[exports$1.TokenType.Function,n.source.slice(n.representationStart,n.representationEnd+1),n.representationStart,n.representationEnd,{value:String.fromCodePoint(...o)}];break}return consumeUrlToken(e,n)}return n.advanceCodePoint(),[exports$1.TokenType.Function,n.source.slice(n.representationStart,n.representationEnd+1),n.representationStart,n.representationEnd,{value:String.fromCodePoint(...o)}]}function checkIfThreeCodePointsWouldStartAUnicodeRange(e){return !(117!==e.source.codePointAt(e.cursor)&&85!==e.source.codePointAt(e.cursor)||e.source.codePointAt(e.cursor+1)!==s||63!==e.source.codePointAt(e.cursor+2)&&!isHexDigitCodePoint(e.source.codePointAt(e.cursor+2)??-1))}function consumeUnicodeRangeToken(e,n){n.advanceCodePoint(2);const o=[],r=[];let s;for(;void 0!==(s=n.source.codePointAt(n.cursor))&&o.length<6&&isHexDigitCodePoint(s);)o.push(s),n.advanceCodePoint();for(;void 0!==(s=n.source.codePointAt(n.cursor))&&o.length<6&&63===s;)0===r.length&&r.push(...o),o.push(48),r.push(70),n.advanceCodePoint();if(!r.length&&n.source.codePointAt(n.cursor)===t&&isHexDigitCodePoint(n.source.codePointAt(n.cursor+1)??-1))for(n.advanceCodePoint();void 0!==(s=n.source.codePointAt(n.cursor))&&r.length<6&&isHexDigitCodePoint(s);)r.push(s),n.advanceCodePoint();if(!r.length){const e=parseInt(String.fromCodePoint(...o),16);return [exports$1.TokenType.UnicodeRange,n.source.slice(n.representationStart,n.representationEnd+1),n.representationStart,n.representationEnd,{startOfRange:e,endOfRange:e}]}const i=parseInt(String.fromCodePoint(...o),16),c=parseInt(String.fromCodePoint(...r),16);return [exports$1.TokenType.UnicodeRange,n.source.slice(n.representationStart,n.representationEnd+1),n.representationStart,n.representationEnd,{startOfRange:i,endOfRange:c}]}function tokenizer(n,i){const c=n.css.valueOf(),a=n.unicodeRangesAllowed??false,u=new Reader(c),d={onParseError:i?.onParseError??noop};return {nextToken:function nextToken(){u.resetRepresentation();const n=u.source.codePointAt(u.cursor);if(void 0===n)return [exports$1.TokenType.EOF,"",-1,-1,void 0];if(47===n&&checkIfTwoCodePointsStartAComment(u))return consumeComment(d,u);if(a&&(117===n||85===n)&&checkIfThreeCodePointsWouldStartAUnicodeRange(u))return consumeUnicodeRangeToken(0,u);if(isIdentStartCodePoint(n))return consumeIdentLikeToken(d,u);if(isDigitCodePoint(n))return consumeNumericToken(d,u);switch(n){case 44:return u.advanceCodePoint(),[exports$1.TokenType.Comma,",",u.representationStart,u.representationEnd,void 0];case 58:return u.advanceCodePoint(),[exports$1.TokenType.Colon,":",u.representationStart,u.representationEnd,void 0];case 59:return u.advanceCodePoint(),[exports$1.TokenType.Semicolon,";",u.representationStart,u.representationEnd,void 0];case 40:return u.advanceCodePoint(),[exports$1.TokenType.OpenParen,"(",u.representationStart,u.representationEnd,void 0];case 41:return u.advanceCodePoint(),[exports$1.TokenType.CloseParen,")",u.representationStart,u.representationEnd,void 0];case 91:return u.advanceCodePoint(),[exports$1.TokenType.OpenSquare,"[",u.representationStart,u.representationEnd,void 0];case 93:return u.advanceCodePoint(),[exports$1.TokenType.CloseSquare,"]",u.representationStart,u.representationEnd,void 0];case 123:return u.advanceCodePoint(),[exports$1.TokenType.OpenCurly,"{",u.representationStart,u.representationEnd,void 0];case 125:return u.advanceCodePoint(),[exports$1.TokenType.CloseCurly,"}",u.representationStart,u.representationEnd,void 0];case 39:case 34:return consumeStringToken(d,u);case 35:return consumeHashToken(d,u);case s:case 46:return checkIfThreeCodePointsWouldStartANumber(u)?consumeNumericToken(d,u):(u.advanceCodePoint(),[exports$1.TokenType.Delim,u.source[u.representationStart],u.representationStart,u.representationEnd,{value:u.source[u.representationStart]}]);case r:case o:case 12:case 9:case 32:return consumeWhiteSpace(u);case t:return checkIfThreeCodePointsWouldStartANumber(u)?consumeNumericToken(d,u):checkIfThreeCodePointsWouldStartCDC(u)?(u.advanceCodePoint(3),[exports$1.TokenType.CDC,"--\x3e",u.representationStart,u.representationEnd,void 0]):checkIfThreeCodePointsWouldStartAnIdentSequence(0,u)?consumeIdentLikeToken(d,u):(u.advanceCodePoint(),[exports$1.TokenType.Delim,"-",u.representationStart,u.representationEnd,{value:"-"}]);case 60:return checkIfFourCodePointsWouldStartCDO(u)?(u.advanceCodePoint(4),[exports$1.TokenType.CDO,"\x3c!--",u.representationStart,u.representationEnd,void 0]):(u.advanceCodePoint(),[exports$1.TokenType.Delim,"<",u.representationStart,u.representationEnd,{value:"<"}]);case 64:if(u.advanceCodePoint(),checkIfThreeCodePointsWouldStartAnIdentSequence(0,u)){const e=consumeIdentSequence(d,u);return [exports$1.TokenType.AtKeyword,u.source.slice(u.representationStart,u.representationEnd+1),u.representationStart,u.representationEnd,{value:String.fromCodePoint(...e)}]}return [exports$1.TokenType.Delim,"@",u.representationStart,u.representationEnd,{value:"@"}];case 92:{if(checkIfTwoCodePointsAreAValidEscape(u))return consumeIdentLikeToken(d,u);u.advanceCodePoint();const n=[exports$1.TokenType.Delim,"\\",u.representationStart,u.representationEnd,{value:"\\"}];return d.onParseError(new ParseErrorWithToken(e.InvalidEscapeSequenceAfterBackslash,u.representationStart,u.representationEnd,["4.3.1. Consume a token","U+005C REVERSE SOLIDUS (\\)","The input stream does not start with a valid escape sequence"],n)),n}}return u.advanceCodePoint(),[exports$1.TokenType.Delim,u.source[u.representationStart],u.representationStart,u.representationEnd,{value:u.source[u.representationStart]}]},endOfFile:function endOfFile(){return void 0===u.source.codePointAt(u.cursor)}}}function noop(){}function serializeIdent(e){let n=0;if(0===e[0])e.splice(0,1,i),n=1;else if(e[0]===t&&e[1]===t)n=2;else if(e[0]===t&&e[1])n=2,isIdentStartCodePoint(e[1])||(n+=insertEscapedCodePoint(e,1,e[1]));else {if(e[0]===t&&!e[1])return [92,e[0]];isIdentStartCodePoint(e[0])?n=1:(n=1,n+=insertEscapedCodePoint(e,0,e[0]));}for(let o=n;o<e.length;o++)0!==e[o]?isIdentCodePoint(e[o])||(o+=insertEscapedCharacter(e,o,e[o])):(e.splice(o,1,i),o++);return e}function insertEscapedCharacter(e,n,o){return e.splice(n,1,92,o),1}function insertEscapedCodePoint(e,n,o){const t=o.toString(16),r=[];for(const e of t)r.push(e.codePointAt(0));return e.splice(n,1,92,...r,32),1+r.length}const d=Object.values(exports$1.TokenType);exports$1.ParseError=ParseError,exports$1.ParseErrorMessage=e,exports$1.ParseErrorWithToken=ParseErrorWithToken,exports$1.cloneTokens=function cloneTokens(e){return n?structuredClone(e):JSON.parse(JSON.stringify(e))},exports$1.isToken=function isToken(e){return !!Array.isArray(e)&&(!(e.length<4)&&(!!d.includes(e[0])&&("string"==typeof e[1]&&("number"==typeof e[2]&&"number"==typeof e[3]))))},exports$1.isTokenAtKeyword=function isTokenAtKeyword(e){return !!e&&e[0]===exports$1.TokenType.AtKeyword},exports$1.isTokenBadString=function isTokenBadString(e){return !!e&&e[0]===exports$1.TokenType.BadString},exports$1.isTokenBadURL=function isTokenBadURL(e){return !!e&&e[0]===exports$1.TokenType.BadURL},exports$1.isTokenCDC=function isTokenCDC(e){return !!e&&e[0]===exports$1.TokenType.CDC},exports$1.isTokenCDO=function isTokenCDO(e){return !!e&&e[0]===exports$1.TokenType.CDO},exports$1.isTokenCloseCurly=function isTokenCloseCurly(e){return !!e&&e[0]===exports$1.TokenType.CloseCurly},exports$1.isTokenCloseParen=function isTokenCloseParen(e){return !!e&&e[0]===exports$1.TokenType.CloseParen},exports$1.isTokenCloseSquare=function isTokenCloseSquare(e){return !!e&&e[0]===exports$1.TokenType.CloseSquare},exports$1.isTokenColon=function isTokenColon(e){return !!e&&e[0]===exports$1.TokenType.Colon},exports$1.isTokenComma=function isTokenComma(e){return !!e&&e[0]===exports$1.TokenType.Comma},exports$1.isTokenComment=function isTokenComment(e){return !!e&&e[0]===exports$1.TokenType.Comment},exports$1.isTokenDelim=function isTokenDelim(e){return !!e&&e[0]===exports$1.TokenType.Delim},exports$1.isTokenDimension=function isTokenDimension(e){return !!e&&e[0]===exports$1.TokenType.Dimension},exports$1.isTokenEOF=function isTokenEOF(e){return !!e&&e[0]===exports$1.TokenType.EOF},exports$1.isTokenFunction=function isTokenFunction(e){return !!e&&e[0]===exports$1.TokenType.Function},exports$1.isTokenHash=function isTokenHash(e){return !!e&&e[0]===exports$1.TokenType.Hash},exports$1.isTokenIdent=function isTokenIdent(e){return !!e&&e[0]===exports$1.TokenType.Ident},exports$1.isTokenNumber=function isTokenNumber(e){return !!e&&e[0]===exports$1.TokenType.Number},exports$1.isTokenNumeric=function isTokenNumeric(e){if(!e)return false;switch(e[0]){case exports$1.TokenType.Dimension:case exports$1.TokenType.Number:case exports$1.TokenType.Percentage:return true;default:return false}},exports$1.isTokenOpenCurly=function isTokenOpenCurly(e){return !!e&&e[0]===exports$1.TokenType.OpenCurly},exports$1.isTokenOpenParen=function isTokenOpenParen(e){return !!e&&e[0]===exports$1.TokenType.OpenParen},exports$1.isTokenOpenSquare=function isTokenOpenSquare(e){return !!e&&e[0]===exports$1.TokenType.OpenSquare},exports$1.isTokenPercentage=function isTokenPercentage(e){return !!e&&e[0]===exports$1.TokenType.Percentage},exports$1.isTokenSemicolon=function isTokenSemicolon(e){return !!e&&e[0]===exports$1.TokenType.Semicolon},exports$1.isTokenString=function isTokenString(e){return !!e&&e[0]===exports$1.TokenType.String},exports$1.isTokenURL=function isTokenURL(e){return !!e&&e[0]===exports$1.TokenType.URL},exports$1.isTokenUnicodeRange=function isTokenUnicodeRange(e){return !!e&&e[0]===exports$1.TokenType.UnicodeRange},exports$1.isTokenWhiteSpaceOrComment=function isTokenWhiteSpaceOrComment(e){if(!e)return false;switch(e[0]){case exports$1.TokenType.Whitespace:case exports$1.TokenType.Comment:return true;default:return false}},exports$1.isTokenWhitespace=function isTokenWhitespace(e){return !!e&&e[0]===exports$1.TokenType.Whitespace},exports$1.mirrorVariant=function mirrorVariant(e){switch(e[0]){case exports$1.TokenType.OpenParen:return [exports$1.TokenType.CloseParen,")",-1,-1,void 0];case exports$1.TokenType.CloseParen:return [exports$1.TokenType.OpenParen,"(",-1,-1,void 0];case exports$1.TokenType.OpenCurly:return [exports$1.TokenType.CloseCurly,"}",-1,-1,void 0];case exports$1.TokenType.CloseCurly:return [exports$1.TokenType.OpenCurly,"{",-1,-1,void 0];case exports$1.TokenType.OpenSquare:return [exports$1.TokenType.CloseSquare,"]",-1,-1,void 0];case exports$1.TokenType.CloseSquare:return [exports$1.TokenType.OpenSquare,"[",-1,-1,void 0];default:return null}},exports$1.mirrorVariantType=function mirrorVariantType(e){switch(e){case exports$1.TokenType.OpenParen:return exports$1.TokenType.CloseParen;case exports$1.TokenType.CloseParen:return exports$1.TokenType.OpenParen;case exports$1.TokenType.OpenCurly:return exports$1.TokenType.CloseCurly;case exports$1.TokenType.CloseCurly:return exports$1.TokenType.OpenCurly;case exports$1.TokenType.OpenSquare:return exports$1.TokenType.CloseSquare;case exports$1.TokenType.CloseSquare:return exports$1.TokenType.OpenSquare;default:return null}},exports$1.mutateIdent=function mutateIdent(e,n){const o=[];for(const e of n)o.push(e.codePointAt(0));const t=String.fromCodePoint(...serializeIdent(o));e[1]=t,e[4].value=n;},exports$1.mutateUnit=function mutateUnit(e,n){const o=[];for(const e of n)o.push(e.codePointAt(0));const t=serializeIdent(o);101===t[0]&&insertEscapedCodePoint(t,0,t[0]);const r=String.fromCodePoint(...t),s="+"===e[4].signCharacter?e[4].signCharacter:"",i=e[4].value.toString();e[1]=`${s}${i}${r}`,e[4].unit=n;},exports$1.stringify=function stringify(...e){let n="";for(let o=0;o<e.length;o++)n+=e[o][1];return n},exports$1.tokenize=function tokenize(e,n){const o=tokenizer(e,n),t=[];for(;!o.endOfFile();)t.push(o.nextToken());return t.push(o.nextToken()),t},exports$1.tokenizer=tokenizer;
2586
2655
  } (dist));
2587
2656
  return dist;
2588
2657
  }
@@ -3858,36 +3927,36 @@ var hasRequiredProperties;
3858
3927
  function requireProperties () {
3859
3928
  if (hasRequiredProperties) return properties;
3860
3929
  hasRequiredProperties = 1;
3861
- (function (exports) {
3930
+ (function (exports$1) {
3862
3931
 
3863
- Object.defineProperty(exports, "__esModule", {
3932
+ Object.defineProperty(exports$1, "__esModule", {
3864
3933
  value: true
3865
3934
  });
3866
- Object.defineProperty(exports, "BorderRadiusIndividual", {
3935
+ Object.defineProperty(exports$1, "BorderRadiusIndividual", {
3867
3936
  enumerable: true,
3868
3937
  get: function () {
3869
3938
  return _borderRadius.BorderRadiusIndividual;
3870
3939
  }
3871
3940
  });
3872
- Object.defineProperty(exports, "BorderRadiusShorthand", {
3941
+ Object.defineProperty(exports$1, "BorderRadiusShorthand", {
3873
3942
  enumerable: true,
3874
3943
  get: function () {
3875
3944
  return _borderRadius.BorderRadiusShorthand;
3876
3945
  }
3877
3946
  });
3878
- Object.defineProperty(exports, "BoxShadow", {
3947
+ Object.defineProperty(exports$1, "BoxShadow", {
3879
3948
  enumerable: true,
3880
3949
  get: function () {
3881
3950
  return _boxShadow.BoxShadow;
3882
3951
  }
3883
3952
  });
3884
- Object.defineProperty(exports, "BoxShadowList", {
3953
+ Object.defineProperty(exports$1, "BoxShadowList", {
3885
3954
  enumerable: true,
3886
3955
  get: function () {
3887
3956
  return _boxShadow.BoxShadowList;
3888
3957
  }
3889
3958
  });
3890
- Object.defineProperty(exports, "Transform", {
3959
+ Object.defineProperty(exports$1, "Transform", {
3891
3960
  enumerable: true,
3892
3961
  get: function () {
3893
3962
  return _transform.Transform;
@@ -4512,22 +4581,22 @@ var hasRequiredLib$1;
4512
4581
  function requireLib$1 () {
4513
4582
  if (hasRequiredLib$1) return lib$1;
4514
4583
  hasRequiredLib$1 = 1;
4515
- (function (exports) {
4584
+ (function (exports$1) {
4516
4585
 
4517
- Object.defineProperty(exports, "__esModule", {
4586
+ Object.defineProperty(exports$1, "__esModule", {
4518
4587
  value: true
4519
4588
  });
4520
- Object.defineProperty(exports, "lastMediaQueryWinsTransform", {
4589
+ Object.defineProperty(exports$1, "lastMediaQueryWinsTransform", {
4521
4590
  enumerable: true,
4522
4591
  get: function () {
4523
4592
  return _mediaQueryTransform.lastMediaQueryWinsTransform;
4524
4593
  }
4525
4594
  });
4526
- exports.tokenParser = exports.properties = void 0;
4595
+ exports$1.tokenParser = exports$1.properties = void 0;
4527
4596
  var _tokenParser = _interopRequireWildcard(requireTokenParser());
4528
- exports.tokenParser = _tokenParser;
4597
+ exports$1.tokenParser = _tokenParser;
4529
4598
  var _properties = _interopRequireWildcard(requireProperties());
4530
- exports.properties = _properties;
4599
+ exports$1.properties = _properties;
4531
4600
  var _mediaQueryTransform = requireMediaQueryTransform();
4532
4601
  function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
4533
4602
  } (lib$1));
@@ -4548,7 +4617,6 @@ const ILLEGAL_NESTED_PSEUDO = "Pseudo objects can't be nested more than one leve
4548
4617
  const ILLEGAL_PROP_VALUE = 'A style value can only contain an array, string or number.';
4549
4618
  const ILLEGAL_PROP_ARRAY_VALUE = 'A style array value can only contain strings or numbers.';
4550
4619
  const ILLEGAL_NAMESPACE_VALUE = 'A StyleX namespace must be an object.';
4551
- const INVALID_CONST_KEY = 'Keys in defineConsts() cannot start with "--".';
4552
4620
  const INVALID_PSEUDO = 'Invalid pseudo selector, not on the whitelist.';
4553
4621
  const INVALID_PSEUDO_OR_AT_RULE = 'Invalid pseudo or at-rule.';
4554
4622
  const INVALID_MEDIA_QUERY_SYNTAX = 'Invalid media query syntax.';
@@ -4571,7 +4639,6 @@ var m = /*#__PURE__*/Object.freeze({
4571
4639
  ILLEGAL_NESTED_PSEUDO: ILLEGAL_NESTED_PSEUDO,
4572
4640
  ILLEGAL_PROP_ARRAY_VALUE: ILLEGAL_PROP_ARRAY_VALUE,
4573
4641
  ILLEGAL_PROP_VALUE: ILLEGAL_PROP_VALUE,
4574
- INVALID_CONST_KEY: INVALID_CONST_KEY,
4575
4642
  INVALID_MEDIA_QUERY_SYNTAX: INVALID_MEDIA_QUERY_SYNTAX,
4576
4643
  INVALID_PSEUDO: INVALID_PSEUDO,
4577
4644
  INVALID_PSEUDO_OR_AT_RULE: INVALID_PSEUDO_OR_AT_RULE,
@@ -4710,7 +4777,10 @@ const angles = ['deg', 'grad', 'turn', 'rad'];
4710
4777
  const timings = ['ms', 's'];
4711
4778
  const fraction = 'fr';
4712
4779
  const percentage$1 = '%';
4713
- function normalizeZeroDimensions(ast, _) {
4780
+ function normalizeZeroDimensions(ast, key) {
4781
+ if (typeof key === 'string' && key.startsWith('--')) {
4782
+ return ast;
4783
+ }
4714
4784
  let endFunction = 0;
4715
4785
  ast.walk(node => {
4716
4786
  if (node.type === 'function' && !endFunction) {
@@ -5155,6 +5225,15 @@ function requirePropertyPriorities () {
5155
5225
  longHandPhysical.add('border-top-right-radius');
5156
5226
  longHandPhysical.add('border-bottom-left-radius');
5157
5227
  longHandPhysical.add('border-bottom-right-radius');
5228
+ shorthandsOfLonghands.add('corner-shape');
5229
+ longHandLogical.add('corner-start-start-shape');
5230
+ longHandLogical.add('corner-start-end-shape');
5231
+ longHandLogical.add('corner-end-start-shape');
5232
+ longHandLogical.add('corner-end-end-shape');
5233
+ longHandPhysical.add('corner-top-left-shape');
5234
+ longHandPhysical.add('corner-top-right-shape');
5235
+ longHandPhysical.add('corner-bottom-left-shape');
5236
+ longHandPhysical.add('corner-bottom-right-shape');
5158
5237
  longHandLogical.add('box-shadow');
5159
5238
  longHandLogical.add('accent-color');
5160
5239
  longHandLogical.add('appearance');
@@ -5560,6 +5639,16 @@ function requirePropertyPriorities () {
5560
5639
  SIBLING_AFTER: /^:where\(:has\(~\s\.[0-9a-zA-Z_-]+(:[a-zA-Z-]+)\)\)$/,
5561
5640
  ANY_SIBLING: /^:where\(\.[0-9a-zA-Z_-]+(:[a-zA-Z-]+)\s+~\s+\*,\s+:has\(~\s\.[0-9a-zA-Z_-]+(:[a-zA-Z-]+)\)\)$/
5562
5641
  };
5642
+ const PSEUDO_PART_REGEX = /::[a-zA-Z-]+|:[a-zA-Z-]+(?:\([^)]*\))?/g;
5643
+ function getCompoundPseudoPriority(key) {
5644
+ const parts = key.match(PSEUDO_PART_REGEX);
5645
+ if (!parts || parts.length <= 1 || parts.some(p => p.includes('('))) return;
5646
+ let total = 0;
5647
+ for (const part of parts) {
5648
+ total += part.startsWith('::') ? PSEUDO_ELEMENT_PRIORITY : PSEUDO_CLASS_PRIORITIES[part] ?? 40;
5649
+ }
5650
+ return total;
5651
+ }
5563
5652
  function getAtRulePriority(key) {
5564
5653
  if (key.startsWith('--')) {
5565
5654
  return 1;
@@ -5600,7 +5689,7 @@ function requirePropertyPriorities () {
5600
5689
  return 40 + pseudoBase(siblingAfterMatch[1]);
5601
5690
  }
5602
5691
  if (key.startsWith(':')) {
5603
- const prop = key.startsWith(':') && key.includes('(') ? key.slice(0, key.indexOf('(')) : key;
5692
+ const prop = key.split('(')[0];
5604
5693
  return PSEUDO_CLASS_PRIORITIES[prop] ?? 40;
5605
5694
  }
5606
5695
  }
@@ -5621,6 +5710,8 @@ function requirePropertyPriorities () {
5621
5710
  function getPriority(key) {
5622
5711
  const atRulePriority = getAtRulePriority(key);
5623
5712
  if (atRulePriority) return atRulePriority;
5713
+ const compoundPriority = getCompoundPseudoPriority(key);
5714
+ if (compoundPriority != null) return compoundPriority;
5624
5715
  const pseudoElementPriority = getPseudoElementPriority(key);
5625
5716
  if (pseudoElementPriority) return pseudoElementPriority;
5626
5717
  const pseudoClassPriority = getPseudoClassPriority(key);
@@ -5831,7 +5922,7 @@ class PreRule {
5831
5922
  this.value = value;
5832
5923
  }
5833
5924
  get pseudos() {
5834
- const unsortedPseudos = this.keyPath.filter(key => key.startsWith(':'));
5925
+ const unsortedPseudos = this.keyPath.filter(key => key.startsWith(':') || key.startsWith('['));
5835
5926
  return sortPseudos(unsortedPseudos);
5836
5927
  }
5837
5928
  get atRules() {
@@ -5936,7 +6027,7 @@ function _flattenRawStyleObject(style, keyPath, options) {
5936
6027
  });
5937
6028
  continue;
5938
6029
  }
5939
- if (typeof value === 'object' && !key.startsWith(':') && !key.startsWith('@')) {
6030
+ if (typeof value === 'object' && !key.startsWith(':') && !key.startsWith('@') && !key.startsWith('[')) {
5940
6031
  const equivalentPairs = {};
5941
6032
  for (const condition in value) {
5942
6033
  const innerValue = value[condition];
@@ -5962,7 +6053,7 @@ function _flattenRawStyleObject(style, keyPath, options) {
5962
6053
  flattened.push([property, PreRuleSet.create(rules)]);
5963
6054
  }
5964
6055
  }
5965
- if (typeof value === 'object' && (key.startsWith(':') || key.startsWith('@'))) {
6056
+ if (typeof value === 'object' && (key.startsWith(':') || key.startsWith('@') || key.startsWith('['))) {
5966
6057
  const pairs = _flattenRawStyleObject(value, [...keyPath, _key], options);
5967
6058
  for (const [property, preRule] of pairs) {
5968
6059
  flattened.push([key + '_' + property, preRule]);
@@ -5992,7 +6083,7 @@ function validateNamespace(namespace, conditions = []) {
5992
6083
  continue;
5993
6084
  }
5994
6085
  if (isPlainObject(val)) {
5995
- if (key.startsWith('@') || key.startsWith(':')) {
6086
+ if (key.startsWith('@') || key.startsWith(':') || key.startsWith('[')) {
5996
6087
  if (conditions.includes(key)) {
5997
6088
  throw new Error(DUPLICATE_CONDITIONAL);
5998
6089
  }
@@ -6008,7 +6099,7 @@ function validateNamespace(namespace, conditions = []) {
6008
6099
  function validateConditionalStyles(val, conditions = []) {
6009
6100
  for (const key in val) {
6010
6101
  const v = val[key];
6011
- if (!(key.startsWith('@') || key.startsWith(':') || key.startsWith('var(--') || key === 'default')) {
6102
+ if (!(key.startsWith('@') || key.startsWith(':') || key.startsWith('[') || key.startsWith('var(--') || key === 'default')) {
6012
6103
  throw new Error(INVALID_PSEUDO_OR_AT_RULE);
6013
6104
  }
6014
6105
  if (conditions.includes(key)) {
@@ -6394,11 +6485,8 @@ function styleXDefineConsts(constants, options) {
6394
6485
  const jsOutput = {};
6395
6486
  const injectableStyles = {};
6396
6487
  for (const [key, value] of Object.entries(constants)) {
6397
- if (key.startsWith('--')) {
6398
- throw new Error(INVALID_CONST_KEY);
6399
- }
6400
6488
  const varSafeKey = (key[0] >= '0' && key[0] <= '9' ? `_${key}` : key).replace(/[^a-zA-Z0-9]/g, '_');
6401
- const constKey = debug && enableDebugClassNames ? `${varSafeKey}-${classNamePrefix}${hash(`${exportId}.${key}`)}` : `${classNamePrefix}${hash(`${exportId}.${key}`)}`;
6489
+ const constKey = key.startsWith('--') ? key.slice(2) : debug && enableDebugClassNames ? `${varSafeKey}-${classNamePrefix}${hash(`${exportId}.${key}`)}` : `${classNamePrefix}${hash(`${exportId}.${key}`)}`;
6402
6490
  jsOutput[key] = value;
6403
6491
  injectableStyles[constKey] = {
6404
6492
  constKey,
@@ -6570,12 +6658,15 @@ function getDefaultMarkerClassName(options = defaultOptions) {
6570
6658
  return `${prefix}default-marker`;
6571
6659
  }
6572
6660
  function validatePseudoSelector(pseudo) {
6573
- if (!pseudo.startsWith(':')) {
6574
- throw new Error('Pseudo selector must start with ":"');
6661
+ if (!(pseudo.startsWith(':') || pseudo.startsWith('['))) {
6662
+ throw new Error('Pseudo selector must start with ":" or "["');
6575
6663
  }
6576
6664
  if (pseudo.startsWith('::')) {
6577
6665
  throw new Error('Pseudo selector cannot start with "::" (pseudo-elements are not supported)');
6578
6666
  }
6667
+ if (pseudo.startsWith('[') && !pseudo.endsWith(']')) {
6668
+ throw new Error('Attribute selector must end with "]"');
6669
+ }
6579
6670
  }
6580
6671
  function ancestor(pseudo, options = defaultOptions) {
6581
6672
  validatePseudoSelector(pseudo);
@@ -6741,9 +6832,9 @@ function convertObjectToAST(obj) {
6741
6832
  return objectExpression(Object.entries(obj).map(([key, value]) => objectProperty(isValidIdentifier(key, false) ? identifier(key) : stringLiteral(key), typeof value === 'string' ? stringLiteral(value) : typeof value === 'number' ? numericLiteral(value) : typeof value === 'boolean' ? booleanLiteral(value) : value === null ? nullLiteral() : convertObjectToAST(value))));
6742
6833
  }
6743
6834
 
6744
- const parseSync = standalone.packages.parser.parse;
6835
+ const parseSync = packages.parser.parse;
6745
6836
 
6746
- var traverse = standalone.packages.traverse.default;
6837
+ var traverse = packages.traverse.default;
6747
6838
 
6748
6839
  const IMPORT_FILE_PARSING_ERROR = `There was error when attempting to parse the imported file.
6749
6840
  Please ensure that the 'babelrc' file is configured to be able to parse this file.
@@ -7613,6 +7704,18 @@ function isSafeToSkipNullCheck(expr) {
7613
7704
  }
7614
7705
  return false;
7615
7706
  }
7707
+ function hasExplicitNullishFallback(expr) {
7708
+ if (isNullLiteral(expr)) return true;
7709
+ if (isIdentifier(expr) && expr.name === 'undefined') return true;
7710
+ if (isUnaryExpression(expr) && expr.operator === 'void') return true;
7711
+ if (isConditionalExpression(expr)) {
7712
+ return hasExplicitNullishFallback(expr.consequent) || hasExplicitNullishFallback(expr.alternate);
7713
+ }
7714
+ if (isLogicalExpression(expr)) {
7715
+ return hasExplicitNullishFallback(expr.left) || hasExplicitNullishFallback(expr.right);
7716
+ }
7717
+ return false;
7718
+ }
7616
7719
  function transformStyleXCreate(path, state) {
7617
7720
  const {
7618
7721
  node
@@ -7681,6 +7784,7 @@ function transformStyleXCreate(path, state) {
7681
7784
  when: stylexWhen
7682
7785
  };
7683
7786
  });
7787
+ state.applyStylexEnv(identifiers);
7684
7788
  const {
7685
7789
  confident,
7686
7790
  value,
@@ -7708,7 +7812,7 @@ function transformStyleXCreate(path, state) {
7708
7812
  const isPseudoElement = path.some(p => p.startsWith('::'));
7709
7813
  injectedInheritStyles[variableName] = {
7710
7814
  priority: 0,
7711
- ltr: `@property ${variableName} { syntax: "*";${isPseudoElement ? '' : ' inherits: false;'}}`,
7815
+ ltr: `@property ${variableName} { syntax: "*"; inherits: ${isPseudoElement ? 'true' : 'false'};}`,
7712
7816
  rtl: null
7713
7817
  };
7714
7818
  });
@@ -7757,14 +7861,21 @@ function transformStyleXCreate(path, state) {
7757
7861
  for (const [className, classPaths] of Object.entries(classPathsPerNamespace[key])) {
7758
7862
  origClassPaths[className] = classPaths.join('_');
7759
7863
  }
7760
- let dynamicStyles = Object.entries(inlineStyles).map(([_key, v]) => ({
7864
+ let dynamicStyles = Object.entries(inlineStyles).map(([varName, v]) => ({
7761
7865
  expression: v.originalExpression,
7762
7866
  key: v.path.slice(0, v.path.findIndex(p => !p.startsWith(':') && !p.startsWith('@')) + 1).join('_'),
7867
+ varName,
7763
7868
  path: v.path.join('_')
7764
7869
  }));
7765
7870
  if (state.options.styleResolution === 'legacy-expand-shorthands') {
7766
7871
  dynamicStyles = legacyExpandShorthands(dynamicStyles);
7767
7872
  }
7873
+ const nullishVarExpressions = new Map();
7874
+ dynamicStyles.forEach(style => {
7875
+ if (hasExplicitNullishFallback(style.expression)) {
7876
+ nullishVarExpressions.set(style.varName, style.expression);
7877
+ }
7878
+ });
7768
7879
  if (isObjectExpression(prop.value)) {
7769
7880
  const value = prop.value;
7770
7881
  let cssTagValue = booleanLiteral(true);
@@ -7788,9 +7899,23 @@ function transformStyleXCreate(path, state) {
7788
7899
  let isStatic = true;
7789
7900
  const exprList = [];
7790
7901
  classList.forEach((cls, index) => {
7791
- const expr = dynamicStyles.find(({
7902
+ let expr = dynamicStyles.find(({
7792
7903
  path
7793
7904
  }) => origClassPaths[cls] === path)?.expression;
7905
+ if (expr == null && nullishVarExpressions.size > 0) {
7906
+ const injectedStyle = injectedStyles[cls];
7907
+ const rule = injectedStyle != null ? typeof injectedStyle.ltr === 'string' ? injectedStyle.ltr : typeof injectedStyle.rtl === 'string' ? injectedStyle.rtl : null : null;
7908
+ if (rule != null) {
7909
+ const matches = rule.matchAll(/var\((--x-[^,)]+)[^)]*\)/g);
7910
+ for (const match of matches) {
7911
+ const varExpr = nullishVarExpressions.get(match[1]);
7912
+ if (varExpr != null) {
7913
+ expr = varExpr;
7914
+ break;
7915
+ }
7916
+ }
7917
+ }
7918
+ }
7794
7919
  const isLast = index === classList.length - 1;
7795
7920
  const clsWithSpace = isLast ? cls : cls + ' ';
7796
7921
  if (expr && !isSafeToSkipNullCheck(expr)) {
@@ -7951,6 +8076,7 @@ function transformStyleXCreateTheme(callExpressionPath, state) {
7951
8076
  types: stylexTypes
7952
8077
  };
7953
8078
  });
8079
+ state.applyStylexEnv(identifiers);
7954
8080
  const {
7955
8081
  confident: confident2,
7956
8082
  value: overrides
@@ -8065,6 +8191,7 @@ function transformStyleXDefineVars(callExpressionPath, state) {
8065
8191
  types: stylexTypes
8066
8192
  };
8067
8193
  });
8194
+ state.applyStylexEnv(identifiers);
8068
8195
  const {
8069
8196
  confident,
8070
8197
  value
@@ -8127,10 +8254,16 @@ function transformStyleXDefineConsts(callExpressionPath, state) {
8127
8254
  const varId = variableDeclaratorNode.id;
8128
8255
  const args = callExpressionPath.get('arguments');
8129
8256
  const firstArg = args[0];
8257
+ const evaluatePathFnConfig = {
8258
+ identifiers: {},
8259
+ memberExpressions: {},
8260
+ disableImports: true
8261
+ };
8262
+ state.applyStylexEnv(evaluatePathFnConfig.identifiers);
8130
8263
  const {
8131
8264
  confident,
8132
8265
  value
8133
- } = evaluate(firstArg, state);
8266
+ } = evaluate(firstArg, state, evaluatePathFnConfig);
8134
8267
  if (!confident) {
8135
8268
  throw callExpressionPath.buildCodeFrameError(messages.nonStaticValue('defineConsts'), SyntaxError);
8136
8269
  }
@@ -8212,6 +8345,7 @@ function transformStyleXKeyframes(path, state) {
8212
8345
  fn: firstThatWorks
8213
8346
  };
8214
8347
  });
8348
+ state.applyStylexEnv(identifiers);
8215
8349
  const {
8216
8350
  confident,
8217
8351
  value
@@ -8283,6 +8417,7 @@ function transformStyleXPositionTry(path, state) {
8283
8417
  fn: firstThatWorks
8284
8418
  };
8285
8419
  });
8420
+ state.applyStylexEnv(identifiers);
8286
8421
  const {
8287
8422
  confident,
8288
8423
  value
@@ -8337,6 +8472,12 @@ function transformStyleXMerge(path, state) {
8337
8472
  if (node == null || node.callee.type !== 'Identifier' || !state.stylexImport.has(node.callee.name)) {
8338
8473
  return;
8339
8474
  }
8475
+ const evaluatePathFnConfig = {
8476
+ identifiers: {},
8477
+ memberExpressions: {},
8478
+ disableImports: true
8479
+ };
8480
+ state.applyStylexEnv(evaluatePathFnConfig.identifiers);
8340
8481
  let bailOut = false;
8341
8482
  let conditional = 0;
8342
8483
  let currentIndex = -1;
@@ -8443,7 +8584,7 @@ function transformStyleXMerge(path, state) {
8443
8584
  const {
8444
8585
  confident,
8445
8586
  value: styleValue
8446
- } = evaluate(path, state);
8587
+ } = evaluate(path, state, evaluatePathFnConfig);
8447
8588
  if (!confident || styleValue == null) {
8448
8589
  nonNullProps = true;
8449
8590
  styleNonNullProps = true;
@@ -8504,7 +8645,7 @@ function parseNullableStyle$1(node, state) {
8504
8645
  function makeStringExpression$1(values) {
8505
8646
  const conditions = values.filter(v => Array.isArray(v)).map(v => v[0]);
8506
8647
  if (conditions.length === 0) {
8507
- return stringLiteral(stylex.legacyMerge(...values));
8648
+ return stringLiteral(legacyMerge(...values));
8508
8649
  }
8509
8650
  const conditionPermutations = genConditionPermutations$1(conditions.length);
8510
8651
  const objEntries = conditionPermutations.map(permutation => {
@@ -8518,7 +8659,7 @@ function makeStringExpression$1(values) {
8518
8659
  }
8519
8660
  });
8520
8661
  const key = permutation.reduce((soFar, bool) => soFar << 1 | (bool ? 1 : 0), 0);
8521
- return objectProperty(numericLiteral(key), stringLiteral(stylex.legacyMerge(...args)));
8662
+ return objectProperty(numericLiteral(key), stringLiteral(legacyMerge(...args)));
8522
8663
  });
8523
8664
  const objExpressions = objectExpression(objEntries);
8524
8665
  const conditionsToKey = genBitwiseOrOfConditions$1(conditions);
@@ -8579,6 +8720,7 @@ function transformStylexProps(path, state) {
8579
8720
  }
8580
8721
  };
8581
8722
  });
8723
+ state.applyStylexEnv(identifiers);
8582
8724
  const evaluatePathFnConfig = {
8583
8725
  identifiers,
8584
8726
  memberExpressions,
@@ -8767,7 +8909,7 @@ function parseNullableStyle(path, state, evaluatePathFnConfig) {
8767
8909
  function makeStringExpression(values) {
8768
8910
  const conditions = values.filter(v => v instanceof ConditionalStyle).map(v => v.test);
8769
8911
  if (conditions.length === 0) {
8770
- const result = stylex.props(values);
8912
+ const result = props(values);
8771
8913
  return convertObjectToAST(result);
8772
8914
  }
8773
8915
  const conditionPermutations = genConditionPermutations(conditions.length);
@@ -8785,7 +8927,7 @@ function makeStringExpression(values) {
8785
8927
  }
8786
8928
  });
8787
8929
  const key = permutation.reduce((soFar, bool) => soFar << 1 | (bool ? 1 : 0), 0);
8788
- return objectProperty(numericLiteral(key), convertObjectToAST(stylex.props(args)));
8930
+ return objectProperty(numericLiteral(key), convertObjectToAST(props(args)));
8789
8931
  });
8790
8932
  const objExpressions = objectExpression(objEntries);
8791
8933
  const conditionsToKey = genBitwiseOrOfConditions(conditions);
@@ -8904,6 +9046,7 @@ function transformStyleXViewTransitionClass(path, state) {
8904
9046
  fn: keyframes$1
8905
9047
  };
8906
9048
  });
9049
+ state.applyStylexEnv(identifiers);
8907
9050
  const {
8908
9051
  confident,
8909
9052
  value
@@ -9363,4 +9506,4 @@ function addSpecificityLevel(selector, index) {
9363
9506
  return `${beforeCurly}${pseudo}${afterCurly}`;
9364
9507
  }
9365
9508
 
9366
- module.exports = styleXTransform;
9509
+ export { styleXTransform as default };