@teacss/core 0.3.5 → 0.3.7
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.
- package/dist/index.d.ts +20 -1
- package/dist/index.js +21 -21
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -273,6 +273,25 @@ declare function clone<T>(val: T): T;
|
|
|
273
273
|
declare function isStaticRule(rule: Rule<any>): rule is StaticRule;
|
|
274
274
|
declare function isStaticShortcut(sc: Shortcut<any>): sc is StaticShortcut;
|
|
275
275
|
//#endregion
|
|
276
|
+
//#region src/utils/selector-target.d.ts
|
|
277
|
+
/**
|
|
278
|
+
* Structural validation for the target selector of a `@>li` / `@_p` / `@+span`
|
|
279
|
+
* condition.
|
|
280
|
+
*
|
|
281
|
+
* Core keeps the target verbatim so state written on the target survives
|
|
282
|
+
* (`@>li:hover`), which means whatever the class carries is what reaches the
|
|
283
|
+
* stylesheet. Text that cannot begin a compound selector — `@_5` produced the
|
|
284
|
+
* selector `.…\@_5 5` — makes the browser drop the whole rule, so the token
|
|
285
|
+
* must not match in the first place.
|
|
286
|
+
*
|
|
287
|
+
* This is CSS *syntax*, not preset vocabulary: it accepts one complex selector
|
|
288
|
+
* built from compounds and the three combinators a class token can spell. It
|
|
289
|
+
* deliberately does not know which type names, pseudo-classes, or attributes
|
|
290
|
+
* exist — that is the preset's business.
|
|
291
|
+
*/
|
|
292
|
+
/** True when `target` is one complex selector that can begin a compound. */
|
|
293
|
+
declare function isValidTargetSelector(target: string): boolean;
|
|
294
|
+
//#endregion
|
|
276
295
|
//#region src/utils/source.d.ts
|
|
277
296
|
declare function getPath(id: string): string;
|
|
278
297
|
declare function isCssId(id: string): boolean;
|
|
@@ -1574,4 +1593,4 @@ interface ParsedClassToken {
|
|
|
1574
1593
|
*/
|
|
1575
1594
|
declare function parseClassToken(raw: string): ParsedClassToken;
|
|
1576
1595
|
//#endregion
|
|
1577
|
-
export { ArgumentType, Arrayable, AutoCompleteExtractor, AutoCompleteExtractorContext, AutoCompleteExtractorResult, AutoCompleteFunction, AutoCompleteTemplate, Awaitable, BaseContext, BetterMap, BlocklistMeta, BlocklistRule, BlocklistValue, BuiltConditionSelector, CSSEntries, CSSEntriesInput, CSSEntry, CSSObject, CSSObjectInput, CSSValue, CSSValueInput, CSSValues, CSS_PLACEHOLDER, CliEntryItem, CliOptions, ConditionKind, ConditionResolveContext, ConditionResolver, ConditionVariantOptions, ConfigBase, ContentOptions, ControlSymbols, ControlSymbolsEntry, ControlSymbolsValue, CountableSet, DEFAULT_LAYERS, DeepPartial, DynamicExpansionMatcher, DynamicMatcher, DynamicRule, DynamicShortcut, DynamicShortcutMatcher, Emitter, ExpansionInlineValue, ExpansionValue, ExtendedTokenInfo, Extractor, ExtractorContext, FilterPattern, FlatObjectTuple, GenerateDiagnostics, GenerateOptions, GenerateResult, GeneratorOptions, HighlightAnnotation, IGNORE_COMMENT, INCLUDE_COMMENT, INCLUDE_COMMENT_IDE, LAYER_IMPORTS, LAYER_MARK_ALL, LAYER_PREFLIGHTS, LAYER_PRIMITIVES, LAYER_PROPERTIES, LAYER_SHORTCUTS, LAYER_UTILITIES, LoadConfigResult, MagicStringLike, NormalizeArbitraryOptions, ObjectToEntry, OutputCssLayersOptions, ParsedClassToken, ParsedCondition, ParsedUtil, PartialByKeys, PluginOptions, Postprocessor, Preflight, PreflightContext, PreparedGeneratorConfig, PreparedRule, Preprocessor, Preset, PresetFactory, PresetFactoryAwaitable, PresetOptions, PresetOrFactory, PresetOrFactoryAwaitable, RESET_KEY, RawUtil, Replacement, RequiredByKey, ResolveConditionsResult, ResolvedCondition, ResolvedConfig, RestArgs, Rule, RuleContext, RuleMeta, SKIP_COMMENT_RE, SKIP_END_COMMENT, SKIP_START_COMMENT, SafeListContext, Shift, Shortcut, ShortcutInlineValue, ShortcutValue, SourceCodeTransformer, SourceCodeTransformerEnforce, SourceMap, StaticRule, StaticShortcut, StaticShortcutMap, StringifiedUtil, SuggestResult, TeacssGenerator, TeacssPluginContext, ThemeExtender, ToArray, TwoKeyMap, UnmatchedTokenDiagnostic, Unsubscribe, UserConfig, UserConfigDefaults, UserOnlyOptions, UserShortcuts, UtilObject, VIRTUAL_ENTRY_ALIAS, Variant, VariantContext, VariantFunction, VariantHandler, VariantHandlerContext, VariantMatchedResult, VariantObject, VirtualKey, attributifyRE, buildConditionSelector, clearIdenticalEntries, clone, collapseVariantGroup, createConditionVariant, createGenerator, createNanoEvents, cssIdRE, defaultSplitRE, definePreset, e, entriesToCss, escapeRegExp, escapeSelector, expandClassGroups, expandGroups, expandUnderscores, expandVariantGroup, extractorSplit as extractorDefault, extractorSplit, getEnvFlags, getHash, getPath, hasScopePlaceholder, hash, isArbitrary, isAttributifySelector, isCountableSet, isCssId, isObject, isRawUtil, isStaticRule, isStaticShortcut, isString, isThenable, isValidSelector, makeRegexClassGroup, mergeConfigs, mergeDeep, noop, normalizeArbitraryValue, normalizeCSSEntries, normalizeCSSValues, normalizeVariant, notNull, parseClassToken, parseCondition, parseConditions, parseVariantGroup, regexScopePlaceholder, replaceAsync, resolveConditions, resolveConfig, resolvePreset, resolvePresets, resolveShortcuts, restoreSkipCode, spaceCalcOperators, splitClassTokens, splitWithVariantGroupRE, symbols, toArray, toEscapedSelector, transformSkipCode, uniq, uniqueBy, validateFilterRE, warnOnce, withLayer };
|
|
1596
|
+
export { ArgumentType, Arrayable, AutoCompleteExtractor, AutoCompleteExtractorContext, AutoCompleteExtractorResult, AutoCompleteFunction, AutoCompleteTemplate, Awaitable, BaseContext, BetterMap, BlocklistMeta, BlocklistRule, BlocklistValue, BuiltConditionSelector, CSSEntries, CSSEntriesInput, CSSEntry, CSSObject, CSSObjectInput, CSSValue, CSSValueInput, CSSValues, CSS_PLACEHOLDER, CliEntryItem, CliOptions, ConditionKind, ConditionResolveContext, ConditionResolver, ConditionVariantOptions, ConfigBase, ContentOptions, ControlSymbols, ControlSymbolsEntry, ControlSymbolsValue, CountableSet, DEFAULT_LAYERS, DeepPartial, DynamicExpansionMatcher, DynamicMatcher, DynamicRule, DynamicShortcut, DynamicShortcutMatcher, Emitter, ExpansionInlineValue, ExpansionValue, ExtendedTokenInfo, Extractor, ExtractorContext, FilterPattern, FlatObjectTuple, GenerateDiagnostics, GenerateOptions, GenerateResult, GeneratorOptions, HighlightAnnotation, IGNORE_COMMENT, INCLUDE_COMMENT, INCLUDE_COMMENT_IDE, LAYER_IMPORTS, LAYER_MARK_ALL, LAYER_PREFLIGHTS, LAYER_PRIMITIVES, LAYER_PROPERTIES, LAYER_SHORTCUTS, LAYER_UTILITIES, LoadConfigResult, MagicStringLike, NormalizeArbitraryOptions, ObjectToEntry, OutputCssLayersOptions, ParsedClassToken, ParsedCondition, ParsedUtil, PartialByKeys, PluginOptions, Postprocessor, Preflight, PreflightContext, PreparedGeneratorConfig, PreparedRule, Preprocessor, Preset, PresetFactory, PresetFactoryAwaitable, PresetOptions, PresetOrFactory, PresetOrFactoryAwaitable, RESET_KEY, RawUtil, Replacement, RequiredByKey, ResolveConditionsResult, ResolvedCondition, ResolvedConfig, RestArgs, Rule, RuleContext, RuleMeta, SKIP_COMMENT_RE, SKIP_END_COMMENT, SKIP_START_COMMENT, SafeListContext, Shift, Shortcut, ShortcutInlineValue, ShortcutValue, SourceCodeTransformer, SourceCodeTransformerEnforce, SourceMap, StaticRule, StaticShortcut, StaticShortcutMap, StringifiedUtil, SuggestResult, TeacssGenerator, TeacssPluginContext, ThemeExtender, ToArray, TwoKeyMap, UnmatchedTokenDiagnostic, Unsubscribe, UserConfig, UserConfigDefaults, UserOnlyOptions, UserShortcuts, UtilObject, VIRTUAL_ENTRY_ALIAS, Variant, VariantContext, VariantFunction, VariantHandler, VariantHandlerContext, VariantMatchedResult, VariantObject, VirtualKey, attributifyRE, buildConditionSelector, clearIdenticalEntries, clone, collapseVariantGroup, createConditionVariant, createGenerator, createNanoEvents, cssIdRE, defaultSplitRE, definePreset, e, entriesToCss, escapeRegExp, escapeSelector, expandClassGroups, expandGroups, expandUnderscores, expandVariantGroup, extractorSplit as extractorDefault, extractorSplit, getEnvFlags, getHash, getPath, hasScopePlaceholder, hash, isArbitrary, isAttributifySelector, isCountableSet, isCssId, isObject, isRawUtil, isStaticRule, isStaticShortcut, isString, isThenable, isValidSelector, isValidTargetSelector, makeRegexClassGroup, mergeConfigs, mergeDeep, noop, normalizeArbitraryValue, normalizeCSSEntries, normalizeCSSValues, normalizeVariant, notNull, parseClassToken, parseCondition, parseConditions, parseVariantGroup, regexScopePlaceholder, replaceAsync, resolveConditions, resolveConfig, resolvePreset, resolvePresets, resolveShortcuts, restoreSkipCode, spaceCalcOperators, splitClassTokens, splitWithVariantGroupRE, symbols, toArray, toEscapedSelector, transformSkipCode, uniq, uniqueBy, validateFilterRE, warnOnce, withLayer };
|
package/dist/index.js
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import e from"node:crypto";const t=[`:before`,`:after`,`:first-line`,`:first-letter`];function n(e){if(!e)return!1;let t=e.codePointAt(0);return e===`-`||e===`_`||e===`\\`||t!==void 0&&(t>=48&&t<=57||t>=65&&t<=90||t>=97&&t<=122||t>=128)}function r(e,r){for(let i of t)if(e.slice(r,r+i.length).toLowerCase()===i&&!n(e[r+i.length]))return!0;return!1}function i(e,t){let n=0,i=0,a;for(let o=0;o<e.length;o++){let s=e[o];if(a)s===`\\`?o++:s===a&&(a=void 0);else if(s===`\\`)o++;else if(s===`/`&&e[o+1]===`*`){let t=e.indexOf(`*/`,o+2);if(t===-1)return;o=t+1}else if(s===`"`||s===`'`)a=s;else if(s===`[`)n++;else if(s===`]`)n>0&&n--;else if(s===`(`)i++;else if(s===`)`)i>0&&i--;else if(s===`:`&&n===0&&i===0){if(e[o+1]===`:`){if(t(o))return;o++}else if(r(e,o)&&t(o))return}}}function a(e){let t=-1;return i(e,e=>(t=e,!0)),t}function o(e){let t=0;return i(e,()=>(t++,!1)),t}function s(e,t){let n=t+(e[t+1]===`:`?2:1);for(;e[n]===`/`&&e[n+1]===`*`;){let t=e.indexOf(`*/`,n+2);if(t===-1)return;n=t+2}let r=n;for(;/[a-z0-9_-]/i.test(e[n]??``);)n++;return n===r?void 0:{end:n,name:e.slice(r,n).toLowerCase()}}function c(e,t,n){let r=0,i;for(let a=t;a<n;a++){let o=e[a];if(i){o===`\\`?a++:o===i&&(i=void 0);continue}if(o===`\\`)a++;else if(o===`/`&&e[a+1]===`*`){let t=e.indexOf(`*/`,a+2);if(t===-1||t>=n)return!1;a=t+1}else if(o===`"`||o===`'`)i=o;else if(o===`(`)r++;else if(o===`)`){if(r--,r===0)return e.slice(t+1,a).replaceAll(/\/\*[\s\S]*?\*\//g,``).trim().length>0&&e.slice(a+1,n).trim().length===0;if(r<0)return!1}}return!1}function l(e){let t=[],n=0,r=!1;if(i(e,i=>{n++;let a=s(e,i);return a?t.push({...a,index:i}):r=!0,n>2}),n<=1)return!0;if(r||n!==2||t.length!==2)return!1;let[a,o]=t,l=a.name,u=o.name;return l!==`part`&&l!==`slotted`||e[a.index+1]!==`:`||e[a.end]!==`(`||!c(e,a.end,o.index)?!1:u===`before`||u===`after`||u===`marker`||u===`placeholder`||u===`file-selector-button`||l===`part`&&(u===`first-line`||u===`first-letter`)}function u(e=void 0){if(e===void 0)return[];if(!Array.isArray(e))return[e];for(let t=0;t<e.length;t++){if(Object.hasOwn(e,t))continue;let n=[],r=0;for(let t=0;t<e.length;t++)Object.hasOwn(e,t)&&Object.defineProperty(n,r++,{configurable:!0,enumerable:!0,value:e[t],writable:!0});return n}return e}function d(e){return Array.from(new Set(u(e)))}function f(e,t){return u(e).reduce((e,n)=>(e.findIndex(e=>t(n,e))===-1&&Object.defineProperty(e,e.length,{configurable:!0,enumerable:!0,value:n,writable:!0}),e),[])}function p(e){return typeof e==`string`}function m(e,t){let n=e;for(;n!==null&&n!==Object.prototype&&n!==Array.prototype&&n!==Function.prototype;){if(Object.hasOwn(n,t))return Reflect.get(e,t);n=Object.getPrototypeOf(n)}}const h={">":` > `,_:` `,"+":` + `,"~":` ~ `};function g(e){let t=e[0];return t!==void 0&&Object.hasOwn(h,t)?h[t]:void 0}function _(e){let t=e.startsWith(`!`),n=t?e.slice(1):e,r;return r=n.startsWith(`::`)?`pseudo-element`:n[0]===`.`||n[0]===`#`?`self`:g(n)===void 0?n[0]===`[`?`arbitrary`:`named`:`target`,{raw:e,kind:r,negate:t,value:n}}function v(e){return u(e).map(_)}function y(e){let t=[],n;for(let r=0;r<e.length;r++){let i=e[r];if(n){if(i===`\\`){if(r+1>=e.length)return!1;r++}else i===n&&(n=void 0);continue}if(i===`\\`){if(r+1>=e.length)return!1;r++;continue}if(i===`/`&&e[r+1]===`*`){let t=e.indexOf(`*/`,r+2);if(t===-1)return!1;r=t+1;continue}if(i===`"`||i===`'`){n=i;continue}if(i===`[`){t.push(i);continue}if(i===`]`){if(t.pop()!==`[`)return!1;continue}if(i===`(`){t.push(i);continue}if(i===`)`){if(t.pop()!==`(`)return!1;continue}if(t.length===0&&(i===`,`||i===`;`||i===`{`||i===`}`||i===`>`||i===`+`||i===`~`||/\s/.test(i)))return!1}return n===void 0&&t.length===0}function b(e){if(e.kind!==`self`&&e.kind!==`pseudo-element`&&e.kind!==`target`)return!1;let t=e.kind===`target`?e.value.slice(1):e.value;return!t||e.kind===`self`&&t.length===1||e.kind===`pseudo-element`&&t.length===2||!y(t)||e.kind===`self`&&e.negate&&a(t)!==-1}function x(e){switch(e.kind){case`self`:{if(e.negate)return{suffix:`:not(${e.value})`};let t=a(e.value);return t===-1?{suffix:e.value}:{suffix:e.value.slice(0,t),pseudoElement:e.value.slice(t)}}case`pseudo-element`:return{pseudoElement:e.value};case`target`:{let t=g(e.value);if(t===void 0)return;let n=e.value.slice(1),r=a(n);return r===-1?{combinator:`${t}${n}`}:{combinator:`${t}${n.slice(0,r)}`,pseudoElement:n.slice(r)}}default:return}}function S(e){let t={},n=m(e,`prefix`),r=m(e,`suffix`),i=m(e,`combinator`),a=m(e,`pseudoElement`),o=m(e,`parent`);return Object.defineProperties(t,{prefix:{configurable:!0,enumerable:n!==void 0,value:n,writable:!0},suffix:{configurable:!0,enumerable:r!==void 0,value:r,writable:!0},combinator:{configurable:!0,enumerable:i!==void 0,value:i,writable:!0},pseudoElement:{configurable:!0,enumerable:a!==void 0,value:a,writable:!0},parent:{configurable:!0,enumerable:o!==void 0,value:o,writable:!0}}),t}function C(e){let t=e.suffix;if(!t)return e;let n=a(t);return n===-1?e:{...e,suffix:t.slice(0,n)||void 0,pseudoElement:`${t.slice(n)}${e.pseudoElement??``}`}}function w(e){let t=e.pseudoElement;if(!t)return e;let n=o(t);if(n>1&&!l(t))throw Error(`[Teacss] a token may use at most one pseudo-element, found ${n}`);return e}function T(e,t=[],n){let r=u(e),i=u(t),a={conditions:r,theme:n},s=[],c=[];for(let e of r){if(b(e)||e.negate&&(e.kind===`pseudo-element`||e.kind===`target`)){c.push(e);continue}if(e.kind===`self`||e.kind===`pseudo-element`||e.kind===`target`){let t=e.kind===`target`?e.value.slice(1):e.value,n=o(t);if(n>1&&!l(t))throw Error(`[Teacss] a token may use at most one pseudo-element, found ${n}`)}let t=x(e);if(!t){for(let n of i)if(t=n(e,a),t||e.negate&&n({...e,raw:e.value,negate:!1},a))break}t?s.push(w(C(S(t)))):c.push(e)}let d=s.map(e=>e.pseudoElement??``).join(``),f=o(d);if(f>1&&!l(d))throw Error(`[Teacss] a token may use at most one pseudo-element, found ${f}`);return{resolved:s,unresolved:c}}function E(e,t){let n=u(t).map(S),r=n.map(e=>e.prefix).filter(Boolean),i=n.map(e=>e.suffix).filter(Boolean),a=n.map(e=>e.combinator).filter(Boolean),o=n.map(e=>e.pseudoElement).filter(Boolean),s=n.map(e=>e.parent).filter(Boolean);return{selector:`${r.join(``)}${e}${i.join(``)}${a.join(``)}${o.join(``)}`,parents:s}}const D=1e4;function O(e,t){return e===t||Object.is(e,t)}var k=class{nodes=new Map;oldest;newest;get size(){return this.nodes.size}peek(){return this.oldest?{done:!1,value:this.oldest.key}:{done:!0,value:void 0}}add(e){if(this.nodes.has(e))return;let t=e===0?0:e,n={key:t,older:this.newest};this.nodes.set(t,n),this.newest?this.newest.newer=n:this.oldest=n,this.newest=n}clear(){this.nodes.clear(),this.oldest=void 0,this.newest=void 0}delete(e){let t=this.nodes.get(e);return t?(this.nodes.delete(e),this.unlink(t),!0):!1}shift(){let e=this.oldest;return e?(this.nodes.delete(e.key),this.unlink(e),{done:!1,value:e.key}):{done:!0,value:void 0}}reset(e){this.clear();for(let t of e)this.add(t)}touch(e){let t=this.nodes.get(e);!t||t===this.newest||(this.unlink(t),t.older=this.newest,this.newest?this.newest.newer=t:this.oldest=t,this.newest=t)}unlink(e){e.older?e.older.newer=e.newer:this.oldest=e.newer,e.newer?e.newer.older=e.older:this.newest=e.older,e.older=void 0,e.newer=void 0}},A=class extends Map{assumeNoPrototypeBypass;maxEntries;order=new k;retained=new Set;_revision=0;constructor(e=D,t,n=!1){if(super(),this.assumeNoPrototypeBypass=n,this.maxEntries=e,t)for(let[e,n]of t)this.set(e,n)}get revision(){return this._revision}get retainedSize(){return this.retained.size}isRetained(e){return this.retained.has(e)}clear(){super.clear(),this.order.clear(),this.retained.clear(),this._revision++}delete(e){this.reconcileOrder();let t=super.delete(e);return this.order.delete(e),this.retained.delete(e),this._revision++,t}set(e,t){this.reconcileOrder();let n=super.has(e);for(super.set(e,t),!n&&!this.retained.has(e)&&this.order.add(e),this._revision++;this.order.size>this.maxEntries&&this.deleteOldest(););return this}getOrInsert(e,t){this.reconcileOrder();let n=super.get(e);return n!==void 0||super.has(e)?(this.enforceInstanceLimit(),n):(this.set(e,t),t)}getOrInsertComputed(e,t){this.reconcileOrder();let n=super.get(e);if(n!==void 0||super.has(e))return this.enforceInstanceLimit(),n;let r=t(e);return this.set(e,r),r}setAndTouch(e,t,n=this.maxEntries){return this.reconcileOrder(),this.retained.has(e)?super.set(e,t):super.delete(e)?(super.set(e,t),this.order.touch(e)):(super.set(e,t),this.order.add(e)),this.order.size>n&&this.deleteOldest(),this}replaceRetained(e,t){if(this._revision!==t)return!1;let n=new Map(e);if(this._revision!==t)return!1;this.reconcileOrder();for(let e of this.retained)n.has(e)||(super.delete(e),this.retained.delete(e));for(let[e,t]of n)this.order.delete(e),super.set(e,t),this.retained.add(e);return this.enforceInstanceLimit(),!0}deleteOldest(){this.reconcileEvictionOrder();let e=this.order.shift();for(;!e.done;){if(super.delete(e.value))return!0;this.resetOrder(),e=this.order.shift()}let t=this.firstOrdinaryKey();return!t.done&&super.delete(t.value)}enforceInstanceLimit(){for(;this.order.size>this.maxEntries&&this.deleteOldest(););}reconcileOrder(){if(!this.assumeNoPrototypeBypass)for(let e of this.retained)super.has(e)||this.retained.delete(e);this.order.size!==this.size-this.retained.size&&this.resetOrder()}reconcileEvictionOrder(){if(this.assumeNoPrototypeBypass)return;let e=this.order.peek(),t=this.firstOrdinaryKey();(e.done!==t.done||!e.done&&!t.done&&!O(e.value,t.value))&&this.resetOrder()}firstOrdinaryKey(){for(let e of super.keys())if(!this.retained.has(e))return{done:!1,value:e};return{done:!0,value:void 0}}resetOrder(){this.order.reset(Array.from(super.keys()).filter(e=>!this.retained.has(e)))}},j=class extends Set{assumeNoPrototypeBypass;maxEntries;order=new k;constructor(e=D,t,n=!1){if(super(),this.assumeNoPrototypeBypass=n,this.maxEntries=e,t)for(let e of t)this.add(e)}add(e){this.reconcileOrder();let t=super.has(e);for(super.add(e),t||this.order.add(e);this.size>this.maxEntries&&this.size&&this.deleteOldest(););return this}addAndTouch(e,t=this.maxEntries){return this.reconcileOrder(),super.delete(e)?(super.add(e),this.order.touch(e)):(super.add(e),this.order.add(e)),this.size>t&&this.deleteOldest(),this}clear(){super.clear(),this.order.clear()}delete(e){this.reconcileOrder();let t=super.delete(e);return this.order.delete(e),t}deleteOldest(){this.reconcileEvictionOrder();let e=this.order.shift();for(;!e.done;){if(super.delete(e.value))return!0;this.order.reset(super.values()),e=this.order.shift()}let t=super.values().next();return!t.done&&super.delete(t.value)}reconcileOrder(){this.order.size!==this.size&&this.order.reset(super.values())}reconcileEvictionOrder(){if(this.assumeNoPrototypeBypass)return;let e=this.order.peek(),t=super.values().next();(e.done!==t.done||!e.done&&!t.done&&!O(e.value,t.value))&&this.order.reset(super.values())}};function M(e){let t=e.keys().next();t.done||e.delete(t.value)}function N(e,t,n,r){if(e instanceof A){e.setAndTouch(t,n,r??e.maxEntries);return}e.delete(t),e.set(t,n),e.size>(r??1e4)&&M(e)}function P(e,t,n){if(e instanceof j){e.addAndTouch(t,n??e.maxEntries);return}e.delete(t),e.add(t),e.size>(n??1e4)&&M(e)}const F=new WeakMap,I=new WeakMap;function ee(e,t){I.set(e,t)}function te(e){return e&&I.get(e)}function ne(e){return(t,n)=>{let r=[e.parent,t.parent].filter(Boolean).join(` $$ `)||t.parent;return n({...t,prefix:`${e.prefix}${t.prefix}`,selector:`${t.selector}${e.suffix}${e.combinator}`,pseudo:`${e.pseudoElement}${t.pseudo}`,parent:r,parentOrder:r===t.parent?t.parentOrder:void 0})}}function re(e,t){return F.set(e,t),e}function ie(e){return F.has(e)}function ae(e,t){let n=F.get(e),r=F.get(t);if(!n||!r)return;let i=`${r.pseudoElement}${n.pseudoElement}`,a=o(i);if(a>1&&!l(i))throw Error(`[Teacss] a token may use at most one pseudo-element, found ${a}`);let s={prefix:`${n.prefix}${r.prefix}`,suffix:`${n.suffix}${r.suffix}`,combinator:`${n.combinator}${r.combinator}`,pseudoElement:i,parent:[n.parent,r.parent].filter(Boolean).join(` $$ `)||void 0};return re({handle:ne(s)},s)}function L(e,t,n){Object.defineProperty(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0})}function oe(e,t){let n=e.length;n in e?L(e,n,t):e[n]=t}function se(e){let t=``,n,r=-1,i=-1,a=-1,o=[];for(let s=0;s<e.length;s++){let c=e[s];if(n){c===`\\`?s++:c===n&&(n=void 0);continue}if(t.length>0&&c===`\\`){s++;continue}if(t.length>0&&(c===`"`||c===`'`)){n=c;continue}if(t.length>0&&c===`/`&&e[s+1]===`*`){let t=e.indexOf(`*/`,s+2);if(t<0)break;s=t+1;continue}c===`(`||c===`[`?t+=c===`(`?`)`:`]`:c===t.at(-1)?t=t.slice(0,-1):t.length===0&&(c===`@`?(i===-1&&(i=s),oe(o,s)):i===-1&&(c===`:`&&r===-1?r=s:c===`!`&&(a=s)))}let s=i===-1?e.length:i,c=e.slice(0,s),l=!1;s>0&&a===s-1&&(l=!0,c=c.slice(0,-1));let u=[];for(let t=0;t<o.length;t++){let n=o[t]+1,r=t+1<o.length?o[t+1]:e.length;oe(u,e.slice(n,r))}return r!==-1&&r<s?{raw:e,body:c,property:e.slice(0,r),value:c.slice(r+1),keyword:!1,important:l,conditions:u}:{raw:e,body:c,keyword:!0,important:l,conditions:u}}function ce(e,t={}){let{name:n=`at-condition`}=t,r={},i=new WeakMap,a=e=>{let t=e??r,n=i.get(t);return n||(n=new A(D,void 0,!0),i.set(t,n)),n},o=(t,n,r)=>{let i=t.map(e=>`${e.length}:${e}`).join(``),o=a(r??n),s=o.get(i);if(s!==void 0)return N(o,i,s),s;let{resolved:c,unresolved:l}=T(v(t),e,n);if(l.length>0||c.length===0)return N(o,i,null),null;let u=e=>c.map(t=>t[e]).filter(Boolean).join(``),d={prefix:u(`prefix`),suffix:u(`suffix`),combinator:u(`combinator`),pseudoElement:u(`pseudoElement`),parent:c.map(e=>e.parent).filter(Boolean).join(` $$ `)||void 0},f={...d,handle:ne(d)};return N(o,i,f),f};return{name:n,match(e,t){if(!e.includes(`@`))return;let n=se(e);if(n.conditions.length===0)return;let r=o(n.conditions,t?.theme,te(t));if(r)return re({matcher:`${n.body}${n.important?`!`:``}`,handle:r.handle},r)},multiPass:!1}}const le=`imports`,ue=`primitives`,de=`properties`,fe=`preflights`,pe=`shortcuts`,me=`utilities`,he=Object.freeze({[le]:-200,[de]:-150,[fe]:-100,[pe]:-50,[ue]:-10,[me]:0});function R(e,t){let n=e.length;n in e?Object.defineProperty(e,n,{configurable:!0,enumerable:!0,value:t,writable:!0}):e[n]=t}function ge(e,t,n=!1,r=t+1){let i=e[t];if(i!==`[`&&i!==`(`)return;let a=i===`[`?`]`:`)`,o=!1,s;for(let i=t+1;i<e.length;i++){let t=e[i];if(t===`
|
|
2
|
-
`||t===`\r`||t===`\u2028`||t===`\u2029`)return;if(o){t===`*`&&e[i+1]===`/`&&(o=!1,i++);continue}if(s){t===`\\`?i++:t===s&&(s=void 0);continue}if(i>=r&&/\s/.test(t))return;if(t===`\\`)i++;else if(t===`/`&&e[i+1]===`*`)o=!0,i++;else if(t===`"`||t===`'`||n&&t==="`")s=t;else if(t===`[`||t===`(`)a+=t===`[`?`]`:`)`;else if(t===a.at(-1)&&(a=a.slice(0,-1),!a))return i+1}}function
|
|
3
|
-
`||t===`\r`||t===`\u2028`||t===`\u2029`)return!1;if(t===`\\`)r++;else if(t===`[`)i=!0;else if(t===`]`&&i)i=!1;else if(t===`/`&&!i){for(r++;/[a-z]/i.test(e[r]??``);)r++;for(;/\s/.test(e[r]??``);)r++;return r===n}}return!1}function
|
|
4
|
-
`||n&&e[r]===`$`&&e[r+1]===`{`)return r+2;if(e[r]===`u`&&e[r+1]===`{`){let t=r+2;for(;/[0-9a-f]/i.test(e[t]??``);)t++;if(t>r+2&&e[t]===`}`)return t+1}return r+1}function
|
|
5
|
-
`||r===`\r`||r===`\u2028`||r===`\u2029`)&&(n.lineComment=!1),t+1):n.blockComment?r===`*`&&e[t+1]===`/`?(n.blockComment=!1,t+2):t+1:n.quote?r===`\\`?
|
|
6
|
-
`||c===`\r`||t&&c==="`")&&(n=s)}return n}function Qe(e){for(let t of e)if((t.codePointAt(0)??0)>127)return!0;return!1}function $e(e,t,n=!1,r=0){let i=e.slice(r,t),a=Ze(i,n),o=i.slice(a+1).trim();if(o.length===0)return!1;let s=o.split(/\s*(?:,|>|\+|~)\s*|\s+/).filter(Boolean),c=o.split(`,`).map(e=>e.trim());return/^@(?:-[a-z]+-)?[a-z][-\w]*\b/i.test(o)||/^%[-_a-z][-\w]*$/i.test(o)||/(?:^|[\s>+~,])(?:&|[-_a-z][-\w]*|\*)?(?:[.#](?=\S)|\[[^\]]*\])/i.test(o)||/(?:^|[\s>+~,])(?:\*|[-\w]+)\|(?:\*|[-\w]+)(?=$|[\s.#:[>+~,])/i.test(o)||/^(?:(?:[a-z][-\w]*)?|&):{1,2}[-\w(]/i.test(o)||/(?:^|[\s>+~,])\\[0-9a-f]{1,6}\s?/i.test(o)||Qe(o)||n&&o.includes("${")||o.includes(`#{`)||o.includes(`@{`)||c.every(Ge)||s.length>0&&s.every(e=>e===`*`||He.test(e))}function et(e,t){let n=t+1;for(;/\s/.test(e[n]??``);)n++;let r=e[n];if(r!==`'`&&r!==`"`)return!1;for(n++;n<e.length;n++){let t=e[n];if(t===`\\`)n++;else if(t===r){for(n++;/\s/.test(e[n]??``);)n++;return e[n]===`:`}}return!1}function tt(e,t){let n=t+1;for(;/\s/.test(e[n]??``);)n++;return e.startsWith(`...`,n)}function nt(e,t){let n=0;for(t--;t>=0&&e[t]===`\\`;t--)n++;return n%2==1}function rt(e,t,n=0){let r=t-1;for(;r>=0&&/\s/.test(e[r]);)r--;if(r<0)return!1;if(Re.includes(e[r]))return!0;let i=r+1;for(;r>=0&&/[\w$]/.test(e[r]);)r--;let a=e.slice(r+1,i);return ze.has(a)||Xe(e,t,n)}const it=new Set([`catch`,`class`,`do`,`else`,`finally`,`switch`,`try`]),at=/^(?:(?:await\s+)?using|break|class|const|continue|debugger|declare|do|enum|export|for|function|if|import|interface|let|namespace|return|switch|throw|try|type|var|while|with)(?=$|[\s;(){}])/,ot=/^(?:await\s+)?[$_\p{ID_Start}][$\p{ID_Continue}]*(?:\s*(?:(?:\.|\?\.)\s*#?[$_\p{ID_Start}][$\p{ID_Continue}]*|(?:\?\.)?\[[^\]]+\]))*\s*(?:(?:\?\.)?\(|\+\+|--|[-+*/%&|^]?=(?!=|>))/u,st=/^(?:await\s+)?[$_\p{ID_Start}][$\p{ID_Continue}]*\s*(?:(?:\.|\?\.)\s*#?[$_\p{ID_Start}][$\p{ID_Continue}]*)+\s*$/u,ct=/^(?:await\s+)?[$_\p{ID_Start}][$\p{ID_Continue}]*(?:\s*(?:\.|\?\.)\s*#?[$_\p{ID_Start}][$\p{ID_Continue}]*)*\s*(?:\?\.)?\[[^\]]+\]\s*$/u,lt=/^new\s+(?:class\b|function\b|[$_\p{ID_Start}])/u,ut=/^\([\s\S]*\)$/,dt=/^\([\s\S]*\)\s*(?:\(|\?\.|\.)/,ft=/^(?:(?:await|delete|typeof|void)\s+\S|yield(?:\s+\S|\s*\*\s*\S))/u,pt=/^(?:\+\+|--|!|~)\s*\S/u,mt=/^\[[\s\S]*\]\s*=(?!=|>)/,ht=new Set([`as`,`in`,`instanceof`,`satisfies`]),gt=/^(?:=(?!=|>)|\+=|-=|\*\*=|\*=|\/=|%=|&&=|&=|\|\|=|\|=|\^=|\?\?=|<<=|>>>=|>>=)/,_t=/^(?:(?:0[xX][\da-fA-F](?:_?[\da-fA-F])*|0[bB][01](?:_?[01])*|0[oO][0-7](?:_?[0-7])*)n?|(?:\d(?:_?\d)*)n|(?:\d(?:_?\d)*\.(?:\d(?:_?\d)*)?|\.\d(?:_?\d)*)(?:[eE][+-]?\d(?:_?\d)*)?|\d(?:_?\d)*(?:[eE][+-]?\d(?:_?\d)*)?)/;function vt(e){let t={closers:[]},n=!1,r=!1;for(let i=0;i<e.length;i++){let a=e[i],o=t.closers.length===0,s=z(e,i,t);if(s!==void 0){o&&(a===`(`||a===`[`)&&(n=!0),i=s;continue}if(!(t.closers.length>0)){if(a===`:`||a===`@`)return!n||r?void 0:a===`:`?`declaration`:`condition`;if(a===`!`&&i===e.length-1)return!n||r?void 0:`important`;/\s/u.test(a)?r=!0:n=!0}}}function yt(e,t){if(ft.test(e))return!0;if(!pt.test(e))return!1;let n=vt(e);return n===void 0||t&&n===`important`}function bt(e,t){if(!mt.test(e))return!1;let n=vt(e);return n===void 0||t&&n===`important`}function xt(e,t){let n={closers:[]};for(let r=t;r<e.length;r++){let t=z(e,r,n);if(t!==void 0&&(r=t,n.closers.length===0))return r+1}}function St(e){let t={closers:[]},n=-1;for(let r=0;r<e.length;r++){let i=z(e,r,t);if(i!==void 0){r=i;continue}if(!(t.closers.length>0)){if(/\s/u.test(e[r]))return-1;n===-1&&(e[r]===`:`||e[r]===`@`)&&r>0&&(n=r)}}return n}function Ct(e,t){let n=t=>{for(;t<e.length&&/\s/u.test(e[t]);)t++;return t},r=0;for(;e[r]===`+`||e[r]===`-`;)r=n(r+1);let i=Jt(e,r);i?.value===`await`&&/\s/u.test(e[i.end]??``)&&(r=n(i.end),i=Jt(e,r));let a;if(i!==void 0)a=`identifier`,r=i.end;else if(e[r]===`[`||e[r]===`(`){let t=xt(e,r);if(t===void 0)return!1;a=e[r]===`[`?`array`:`parenthesized`,r=t}else{let t=_t.exec(e.slice(r));if(t===null)return!1;a=`number`,r+=t[0].length}let o=!1,s=!1;for(;r<e.length;){let t=r;if(r=n(r),e[r]===`!`&&e[r+1]!==`=`){s=!0,r++;continue}if(e[r]===`(`||e.startsWith(`?.(`,r))return!0;if(e.startsWith(`?.`,r))r=n(r+2);else if(e[r]===`.`)r=n(r+1);else if(e[r]!==`[`){r=t;break}if(e[r]===`[`){let t=xt(e,r);if(t===void 0)return!1;o=!0,s=!1,r=t;continue}if(e[r]===`#`&&r++,i=Jt(e,r),i===void 0)return!1;o=!0,s=!1,r=i.end}if(r=n(r),e[r]===`(`||e.startsWith(`?.(`,r))return!0;if(o&&e.slice(r).trim().length===0)return!s||vt(e)!==`important`||t;if(a===`array`&&!o)return!1;if(e.startsWith(`++`,r)||e.startsWith(`--`,r))return e.slice(r+2).trim().length===0;let c=gt.exec(e.slice(r));return c!==null&&e.slice(r+c[0].length).trim().length>0}function wt(e){let t=St(e),n=(t,n)=>{let r=t-1;for(;r>=0&&/\s/.test(e[r]);)r--;let i=t+n;for(;i<e.length&&/\s/.test(e[i]);)i++;return r>=0&&e[r]!==`:`&&i<e.length},r=(t,r,i)=>{let a=e[r-1]??``,o=e[i]??``;return!/\s/u.test(a)&&!`)!]`.includes(a)||!/\s/u.test(o)&&!`([`.includes(o)&&!((t===`in`||t===`instanceof`)&&`!~+-`.includes(o))&&(t!==`as`&&t!==`satisfies`||o!==`-`)?!1:n(r,i-r)},i={closers:[]};for(let a=0;a<e.length;a++){let o=e[a],s=z(e,a,i);if(s!==void 0){a=s;continue}if(i.closers.length>0||t>=0&&a>t)continue;let c=e[a+1],l=Jt(e,a);if(l!==void 0){if(ht.has(l.value)&&r(l.value,a,l.end))return!0;a=l.end-1;continue}if((o===`?`||o===`<`||o===`>`)&&n(a,c===o||c===`=`||o===`?`&&c===`.`?2:1)||(o===`=`&&c===`=`||o===`!`&&c===`=`||o===`&`&&c===`&`||o===`|`&&c===`|`||o===`*`&&c===`*`)&&n(a,2)||`+-*/%&|^`.includes(o)&&(/\s/.test(e[a-1]??``)||/\s/.test(c??``))&&n(a,1)||o===`,`&&(/\s/.test(e[a-1]??``)||/\s/.test(c??``))&&n(a,1))return!0}return!1}function Tt(e,t){let n=Ae(e,t);if(n.kind===`open`)return!0;if(n.kind!==`close`)return!1;let r=Ne(e.slice(t+1,n.index));if(r.length===0)return!0;let i=r.length===1;return r.some(e=>at.test(e)||ot.test(e)||st.test(e)||ct.test(e)||Ct(e,i)||lt.test(e)||ut.test(e)||dt.test(e)||yt(e,i)||bt(e,i)||wt(e))}function Et(e,t,n=0,r=0,i=``){if(`:|&=,(`.includes(i))return!1;let a=t-1;for(;a>=0&&/\s/.test(e[a]);)a--;let o=e.slice(n,t);if(qe(e,t,n))return r>0||`:|&=,(`.includes(e[a]??``)?!1:Ke(e,t,n);if(/\bclass\b[^;]*$/.test(o))return Je(e,t,n);if(e[a]===`)`||e[a]===`>`)return e.slice(Math.max(n,a-1),a+1)!==`=>`;let s=a+1;for(;a>=0&&/[\w$]/.test(e[a]);)a--;let c=e.slice(a+1,s);return it.has(c)?!0:Xe(e,t,n)}function Dt(){return{angleDepth:0,canEnd:!1,classParenRoles:[],forceRegex:!1,labelCandidate:!1,labelColon:-1,lastSignificant:``,lastWord:``,parenKinds:[],pendingFunctions:[],restrictedLineStatement:!1,statementStart:!0,typeDeclaration:!1}}const Ot=new Set([`abstract`,`async`,`declare`,`default`,`export`]),kt=new Set([`abstract`,`asserts`,`extends`,`in`,`infer`,`is`,`keyof`,`new`,`readonly`,`typeof`,`unique`]);function At(e,t){let n=e.pendingFunctions.at(-1);n?.phase===`return-type`&&(n.typeCanEnd=!kt.has(t))}function H(e,t,n){let r=e.pendingFunctions.at(-1);r?.phase===`return-type`&&(`|&?:=,(`.includes(t)||t===`[`||t===`<`?r.typeCanEnd=!1:(n||t===`]`||t===`>`||t===`)`)&&(r.typeCanEnd=!0))}function jt(e){let t=e.pendingFunctions.at(-1);if(t)return t.phase===`after-params`?(e.pendingFunctions.pop(),t.kind):t.phase===`return-type`?t.typeCanEnd?(e.pendingFunctions.pop(),t.kind):`T`:`O`}function Mt(e,t){return!e.restrictedLineStatement&&!(e.typeDeclaration&&t===0&&e.canEnd)?!1:(e.canEnd=!1,e.forceRegex=!0,e.labelCandidate=!1,e.labelColon=-1,e.lastSignificant=``,e.lastWord=``,e.restrictedLineStatement=!1,e.statementStart=!0,e.typeDeclaration=!1,!0)}function Nt(e){e.labelCandidate=!1,e.labelColon=-1,e.lastSignificant=`;`,e.lastWord=``,e.pendingFunctions.length=0,e.restrictedLineStatement=!1,e.statementStart=!0,e.typeDeclaration=!1}function U(e,t){e.canEnd=!0,e.forceRegex=!1,e.labelCandidate=!1,e.labelColon=-1,e.lastSignificant=t,e.lastWord=``,e.statementStart=!1,H(e,t,!0)}function Pt(e,t,n){if(!n||/\s/.test(e[t-1]??``))return!1;let r=t+1;for(;/\s/.test(e[r]??``);)r++;return/[A-Z_$\p{ID_Start}]/u.test(e[r]??``)}function Ft(e,t,n,r){let i=e[t],a=r?.lastWord??``;if(/\s/.test(i??``))return n;if(/[\w$\p{ID_Continue}]/u.test(i??``)){if(/[\w$\p{ID_Continue}]/u.test(e[t+1]??``))return n;let i=t;for(;i>0&&/[\w$\p{ID_Continue}]/u.test(e[i-1]??``);)i--;let a=e.slice(i,t+1),o=i-1;for(;o>=0&&/\s/.test(e[o]??``);)o--;let s=e[o]===`.`||e[o]===`#`;if(r){let e=r.statementStart;r.labelCandidate=e,r.labelColon=-1,r.lastSignificant=`word`,r.lastWord=s?``:a,!s&&a===`function`?B(r.pendingFunctions,{kind:e?`B`:`O`,phase:`before-params`,typeCanEnd:!1}):s||At(r,a),!s&&e&&(a===`type`||a===`import`||a===`interface`||a===`declare`||a===`export`)&&(r.typeDeclaration=!0),!s&&e&&(a===`break`||a===`continue`||a===`debugger`)&&(r.restrictedLineStatement=!0),r.statementStart=!s&&e&&Ot.has(a)}return s||!(ze.has(a)||Ve.has(a))}if(r&&(i!==`:`&&(r.labelCandidate=!1),i!==`{`&&(r.labelColon=-1),r.lastWord=``,r.statementStart=!1),/\d/.test(i??``)||i===`.`&&n&&/\d/.test(e[t-1]??``))return r&&(r.lastSignificant=`number`,H(r,i,!0)),!0;if(i===`]`)return r&&(r.lastSignificant=i,H(r,i,!0)),!0;if(i===`[`)return r&&(r.lastSignificant=i,H(r,i,!1)),!1;if(i===`(`){if(r){let e=r.pendingFunctions.at(-1);B(r.classParenRoles,a===`cn`?`C`:n||e?.phase===`before-params`||Ve.has(a)?`O`:`T`),e?.phase===`before-params`?(e.phase=`params`,B(r.parenKinds,`F`)):B(r.parenKinds,Ve.has(a)?`1`:`0`),r.forceRegex=!1,r.lastSignificant=i,H(r,i,!1)}return!1}if(i===`)`){if(r){r.classParenRoles.pop();let e=r.parenKinds.pop();if(r.forceRegex=e===`1`,e===`F`){let e=r.pendingFunctions.at(-1);e?.phase===`params`&&(e.phase=`after-params`)}r.lastSignificant=i,H(r,i,!0)}return!0}if(i===`<`)return r&&(Pt(e,t,n)&&r.angleDepth++,r.lastSignificant=i,H(r,i,!1)),!1;if(i===`>`)return r?.angleDepth?(r.angleDepth--,r.lastSignificant=i,H(r,i,!0),!0):(r&&(r.lastSignificant=i,H(r,i,!1)),!1);if(i===`+`||i===`-`)return r&&(r.lastSignificant=i),e[t-1]===i||e[t+1]===i?(r&&H(r,i,n),n):(r&&H(r,i,!1),!1);if(i===`:`&&r){let e=r.pendingFunctions.at(-1);return e?.phase===`after-params`&&(e.phase=`return-type`,e.typeCanEnd=!1),r.labelCandidate&&(r.labelColon=t),r.lastSignificant=i,H(r,i,!1),!1}return i===`!`&&e[t+1]!==`=`?(r&&(r.lastSignificant=i,H(r,i,n)),n):i===`}`||i===`'`||i===`"`||i==="`"?(r&&(r.lastSignificant=i,H(r,i,!0)),!0):(r&&(r.lastSignificant=i,H(r,i,!1)),!1)}function It(e,t,n=!1,r){if(e[t+1]===`/`||e[t+1]===`*`)return!1;if(n)return!0;if(r!==void 0)return!r;let i=t-1;for(;i>=0&&/\s/.test(e[i]);)i--;if(i<0)return!0;if((e[i]===`+`||e[i]===`-`)&&e[i-1]===e[i]||e[i]===`!`&&i>0&&/[\w$)\]]/.test(e[i-1]??``)||e[i]===`>`&&i>0&&/[\w$)>]/.test(e[i-1]??``))return!1;if(`=([{,:;!?&|+-*%^~<>`.includes(e[i]))return!0;let a=i+1;for(;i>=0&&/[\w$]/.test(e[i]);)i--;return Be.has(e.slice(i+1,a))}function Lt(e,t){let n=!1;for(let r=t+1;r<e.length;r++){let t=e[r];if(t===`
|
|
7
|
-
`||t===`\r`||t===`\u2028`||t===`\u2029`)return{end:-1,failedUntil:r};if(t===`\\`)r++;else if(t===`[`)n=!0;else if(t===`]`)n=!1;else if(t===`/`&&!n){for(r++;/[a-z]/i.test(e[r]??``);)r++;return{end:r,failedUntil:r}}}return{end:-1,failedUntil:e.length}}function
|
|
8
|
-
`||c===`\r`||c===`\u2028`||c===`\u2029`)&&(a=!1);else if(i)c===`*`&&l===`/`&&(i=!1,r++);else if(s)c===`\\`?r++:c===s&&(s=void 0);else if(c===`/`&&l===`/`)a=!0,r++;else if(c===`/`&&l===`*`)i=!0,r++;else if(c===`'`||c===`"`||c==="`")s=c;else if(c===`<`)
|
|
9
|
-
`||t===`\r`||t===`\u2028`||t===`\u2029`)&&(o=!1);continue}if(i){t===`*`&&n===`/`&&(i=!1,f++);continue}if(d){t===`\\`?f++:t===d&&(d=void 0);continue}if(t===`/`&&n===`/`){o=!0,f++;continue}if(t===`/`&&n===`*`){i=!0,f++;continue}if(t===`'`||t===`"`||t==="`"){if(r.length===0&&l!==`constraint`&&l!=="default")return!1;d=t,u=!0;continue}if(t===`(`||t===`[`||t===`{`||t===`<`){if(r.length===0&&l!==`constraint`&&l!=="default")return!1;
|
|
10
|
-
`&&e[n]!==`\r`&&e[n]!==`\u2028`&&e[n]!==`\u2029`;)n++;else if(e[n]===`/`&&e[n+1]===`*`){let t=e.indexOf(`*/`,n+2);if(t===-1)return e.length;n=t+2}else break;return n}function
|
|
11
|
-
`||s===`\r`||s===`\u2028`||s===`\u2029`)&&(o.lineComment=!1,
|
|
12
|
-
`||s===`\r`||s===`\u2028`||s===`\u2029`)&&
|
|
13
|
-
`||t===`\r`||t===`\u2028`||t===`\u2029`)return n}return e.length}if(n){for(let r=t;r<e.length;r++){let t=e[r];if(t===`\\`)r=
|
|
14
|
-
`||t===`\r`||t===`\u2028`||t===`\u2029`)return r}return e.length}if(i)for(let n=t;n<e.length;n++){let t=e[n];if(t===`\\`)n=
|
|
15
|
-
`||D===`\r`||D===`\u2028`||D===`\u2029`)){s=void 0,l=-1,u=0,
|
|
16
|
-
`||D===`\r`||D===`\u2028`||D===`\u2029`){o=void 0,c=!1,l=-1,u=0,
|
|
17
|
-
`||D===`\r`||D===`\u2028`||D===`\u2029`)&&
|
|
18
|
-
`||u===`\r`||u===`\u2028`||u===`\u2029`)&&(s=!1);continue}if(i){u===`*`&&d===`/`&&(i=!1,l++);continue}if(c){u===`\\`?l++:u===c&&(c=void 0);continue}if(u===`/`&&d===`*`&&
|
|
19
|
-
`?t+2:t+1}function Hn(e,t){let n=t;for(;/\s/.test(e[n]??``);)n++;if(e[n]!==`:`)return!1;for(n++;/\s/.test(e[n]??``);)n++;return e[n]===`[`&&Ee(e,n)}const Un=new Set([`await`,`break`,`case`,`continue`,`debugger`,`delete`,`do`,`else`,`in`,`instanceof`,`new`,`of`,`return`,`throw`,`typeof`,`void`,`yield`]),Wn=new Set([`for`,`if`,`while`,`with`]);function Gn(e,t){let n=0;for(;t>0&&e[--t]===`\\`;)n++;return n%2==1}function Kn(e,t){let n=0;for(let r=t;r>=0;r--){let t=e[r];if(t===`"`||t===`'`||t==="`"){let n=r-1;for(;n>=0&&(e[n]!==t||Gn(e,n));)n--;if(n<0)return!1;r=n}else if(t===`/`&&e[r-1]===`*`){let t=e.lastIndexOf(`/*`,r-2);if(t<0)return!1;r=t}else if(t===`)`)n++;else if(t===`(`){if(n--,n!==0)continue;let t=r;for(;t>0&&/\s/.test(e[t-1]);)t--;let i=t;for(;i>0&&/[\w$]/.test(e[i-1]);)i--;return i>0&&/[\w$.]/.test(e[i-1])?!1:Wn.has(e.slice(i,t))}}return!1}function qn(e,t){let n=0;for(let r=t;r>=0;r--){let t=e[r];if(t===`"`||t===`'`||t==="`"){let n=r-1;for(;n>=0&&(e[n]!==t||Gn(e,n));)n--;if(n<0)return-1;r=n}else if(t===`/`&&e[r-1]===`*`){let t=e.lastIndexOf(`/*`,r-2);if(t<0)return-1;r=t}else if(t===`}`)n++;else if(t===`{`&&(n--,n===0))return r}return-1}function Jn(e,t){for(;t>0&&/\s/.test(e[t-1]);)t--;let n=t;for(;n>0&&/[\w$]/.test(e[n-1]);)n--;return{start:n,value:e.slice(n,t)}}function Yn(e,t){let n=qn(e,t);if(n<0)return!1;let r=n;for(;r>0&&/\s/.test(e[r-1]);)r--;if(r===0)return!0;let i=e[r-1];if(i===`)`||i===`>`&&e[r-2]===`=`||`;{}:`.includes(i))return!0;let a=Jn(e,r);return[`catch`,`class`,`do`,`else`,`finally`,`static`,`try`].includes(a.value)?!0:a.value?Jn(e,a.start).value===`class`:!1}function Xn(e,t){if(e[t+1]===`/`||e[t+1]===`*`||e[t-1]===`<`&&(e[t+1]===`>`||/[A-Z_$]/i.test(e[t+1]??``)))return!1;let n=t-1;for(;n>=0&&/\s/.test(e[n]);)n--;if(n<0)return!0;if((e[n]===`+`||e[n]===`-`)&&e[n-1]===e[n]||e[n]===`!`&&n>0&&/[\w$)\]]/.test(e[n-1]??``)||e[n]===`>`&&n>0&&/[\w$)>]/.test(e[n-1]??``))return!1;if(`=([{,:;!?&|+-*%^~<>`.includes(e[n])||e[n]===`)`&&Kn(e,n)||e[n]===`}`&&Yn(e,n))return!0;let r=n+1;for(;n>=0&&/[\w$]/.test(e[n]);)n--;let i=e.slice(n+1,r);return Un.has(i)?!0:i==="default"&&Jn(e,n+1).value===`export`}function Zn(e,t){let n=!1;for(let r=t+1;r<e.length;r++){let t=e[r];if(Bn(t))return-1;if(t===`\\`)r++;else if(t===`[`)n=!0;else if(t===`]`)n=!1;else if(t===`/`&&!n){for(r++;/[a-z]/i.test(e[r]??``);)r++;return r}}return-1}function Qn(e,t=!1){let n=[],r=[],i=[],a=!1,o=!1,s,c=-1,l,u=-1,d=!1;for(let f=0;f<e.length;f++){let p=e[f];if(!a&&!s&&p===`/`&&Xn(e,f)){let t=Zn(e,f);if(t!==-1){f=t-1,d=!1;continue}}if(n.length===0){zn(p)?d=!1:p===`/`&&(d=!0),p===`[`&&(R(n,f),o=d&&e[f-1]!==`:`&&e[f-1]!==`@`,i=[],l=void 0);continue}if(zn(p)&&(u=f),Bn(p)){n.length=0,i=[],a=!1,o=!1,s=void 0,c=-1,l=void 0;continue}if((a||s)&&/\s/.test(p)&&(l??=ge(e,n.at(-1),!1,f),l===void 0)){n.length=0,i=[],a=!1,o=!1,s=void 0,c=-1;continue}if(!a&&!s&&p===`/`&&o){n.length=0,i=[],o=!1,c=-1;continue}if(a){p===`*`&&e[f+1]===`/`&&(a=!1,f++);continue}if(s){p===`\\`?(Bn(e[f+1])?(n.length=0,i=[],a=!1,s=void 0,c=-1):zn(e[f+1])&&(u=f+1),f++):p===s&&(R(i,[c+1,f]),s=void 0,c=-1);continue}if(p===`/`&&e[f+1]===`*`)a=!0,f++;else if(p===`"`||p===`'`)s=p,c=f;else if(p===`\\`)Bn(e[f+1])&&(n.length=0,i=[],a=!1,s=void 0,c=-1),zn(e[f+1])&&(u=f+1),f++;else if(p===`[`)R(n,f);else if(p===`]`){let a=n.pop(),s=f+1,c=!1;if(s!==a+2&&u>a){let n=e[a-1]===`:`||e[a-1]===`@`,i=e[s]===`:`&&!!e[s+1]&&!Mn.test(e[s+1]);c=n&&!Te(e,a)||i&&!(t&&Hn(e,s)),c&&R(r,[a,s])}if(n.length===0){if(o=!1,l=void 0,!c)for(let[t,n]of i)for(let[i,a]of Qn(e.slice(t,n)))R(r,[t+i,t+a]);i=[]}}}let f=[];for(let e of r.sort(([e,t],[n,r])=>e-n||r-t))(f.length===0||e[0]>=f.at(-1)[1])&&R(f,e);return f}const $n=/^(?:--?[\w-]+|[A-Z_$][\w$-]*|@teacss-skip-bracket-[\da-z]{6})$/i;function er(e,t){let n=t;for(;n>0&&/[\w-]/.test(e[n-1]);)n--;if(n===t||e[n-1]!==`:`)return!1;let r=n-1,i=r;for(;i>0&&/[\w$@-]/.test(e[i-1]);)i--;if(!$n.test(e.slice(i,r)))return!1;let a=i-1;for(;a>=0&&/\s/.test(e[a]);)a--;return a<0||!`{,?`.includes(e[a])}function tr(e){let t=[],n=[],r=[],i=!1,a,o,s=-1,c,l=()=>{if(s<0||n.length===0)return;let e=n.at(-1);e.attached&&e.containsGroupBrace&&R(t,[e.start,s+1]),s=-1};for(let u=0;u<e.length;u++){let d=e[u];if(n.length===0){a?a!=="`"&&Bn(d)?a=void 0:d===`\\`?u=Vn(e,u):d===a?a=void 0:d===`(`&&er(e,u)&&(R(n,{attached:!0,containsGroupBrace:!1,outerQuote:a,start:u}),c=void 0):d===`"`||d===`'`||d==="`"?a=d:d===`(`&&er(e,u)&&(R(n,{attached:!0,containsGroupBrace:!1,outerQuote:void 0,start:u}),c=void 0);continue}if(Bn(d)){l(),n.length=0,r.length=0,i=!1,o=void 0,a!=="`"&&(a=void 0),c=void 0;continue}if((o||i)&&/\s/.test(d)&&(c??=ge(e,n.at(-1).start,!0,u),c===void 0)){n.length=0,r.length=0,i=!1,o=void 0,s=-1;continue}if(o){d===`\\`?u=Vn(e,u):d===o?o=void 0:d===`{`&&(n.at(-1).containsGroupBrace=!0);continue}if(i){d===`*`&&e[u+1]===`/`&&(i=!1,u++);continue}let f=n[0].outerQuote;if(d===`/`&&e[u+1]===`*`)i=!0,u++;else if(f&&d===f)l(),n.length=0,r.length=0,i=!1,a=void 0;else if(d===`"`||d===`'`||d==="`")o=d;else if(d===`\\`)u=Vn(e,u);else if(r.length>0)d===`[`?R(r,`]`):d===`(`?R(r,`)`):d===r.at(-1)?(r.pop(),r.length===0?s=-1:d===`)`&&(s=u)):d===`{`&&(n.at(-1).containsGroupBrace=!0);else if(d===`[`)R(r,`]`);else if(d===`{`)n.at(-1).containsGroupBrace=!0;else if(d===`(`)R(n,{attached:er(e,u),containsGroupBrace:!1,outerQuote:f,start:u});else if(d===`)`){let e=n.pop();e.attached&&e.containsGroupBrace&&R(t,[e.start,u+1]),e.containsGroupBrace&&n.length>0&&(n.at(-1).containsGroupBrace=!0),n.length===0&&(c=void 0)}}l();let u=[];for(let e of t.sort(([e,t],[n,r])=>e-n||r-t))(u.length===0||e[0]>=u.at(-1)[1])&&R(u,e);return u}function nr(e,t,n){if(!t.length)return e;let r=new Set([...e.matchAll(jn)].map(e=>e[0])),i=new Set([...n.keys(),...r]),a=[],o=0;for(let[s,c]of t){let t=e.slice(s,c),l=0,u;for(;u=`${An}${xn(l?`${t}:${l}`:t)}`,l++,!(n.get(u)===t&&!r.has(u)||!i.has(u)););i.add(u),n.set(u,t),R(a,e.slice(o,s)),R(a,u),o=c}return R(a,e.slice(o)),a.join(``)}function rr(e,t,n=!1){return nr(e,Qn(e,n),t)}function ir(e,t){return nr(e,tr(e),t)}function ar(e,t){let n=e;for(let e=0;e<t.size&&n.includes(An);e++){let e=n.replace(jn,e=>t.get(e)??e);if(e===n)break;n=e}return n}function or(e,t){let n=new Map;e.includes(`[`)&&(e=rr(e,n,!0)),e.includes(`(`)&&(e=ir(e,n)),e=ln(e,t),e.includes(`[`)&&(e=rr(e,n)),e.includes(`(`)&&(e=ir(e,n));let r=e.split(Dn);return n.size?r.map(e=>e.includes(An)?ar(e,n):e):r}const sr={name:`@teacss/core/extractor-split`,order:0,extract({code:e,id:t}){return or(In(t)?e:Rn(e,Fn(t)),Ln(t))}};var cr=class extends Set{_map=new Map;constructor(e){if(super(),e)for(let t of e)this.add(t)}add(e){return this._map.set(e,(this._map.get(e)??0)+1),super.add(e)}delete(e){return this._map.has(e)?(this._map.delete(e),super.delete(e)):!1}clear(){this._map.clear(),super.clear()}getCount(e){return this._map.get(e)??0}setCount(e,t){return this._map.set(e,t),super.add(e)}};function W(e){return e instanceof cr}function lr(e,t,n){if(Object.hasOwn(e,t)){if(!Reflect.set(e,t,n))throw TypeError(`Cannot assign event "${String(t)}"`)}else Object.defineProperty(e,t,{value:n,configurable:!0,enumerable:!0,writable:!0})}function ur(){return{events:Object.create(null),emit(e,...t){let n=Object.hasOwn(this.events,e)?this.events[e]:void 0,r=u(Array.isArray(n)?n:[]).map(e=>e);for(let e of r)e(...t)},on(e,t){let n=this.events,r=Object.hasOwn(n,e)?n[e]:void 0,i=Array.isArray(r)?r:[];return Array.isArray(r)||lr(n,e,i),Object.defineProperty(i,i.length,{configurable:!0,enumerable:!0,value:t,writable:!0}),()=>{let r=Object.hasOwn(n,e)?n[e]:void 0;lr(n,e,u(Array.isArray(r)?r:[]).filter(e=>e!==t))}}}}const dr=/^\[(.+?)~?="(.*)"\]$/,fr=/[\w\u00A0-\uFFFF%-?]/,pr=new RegExp(dr.source,dr.flags),mr=/\.(css|postcss|sass|scss|less|stylus|styl)($|\?)/,hr=new RegExp(fr.source,fr.flags);function gr(e){return e.match(dr)}function _r(e=``){return fr.test(e)}function vr(e){return typeof e==`function`?{match:e}:e}function yr(e){return e.length===3&&Object.hasOwn(e,0)&&Object.hasOwn(e,1)&&Object.hasOwn(e,2)}function br(e){return e!=null}function xr(e){return e!=null&&typeof e.then==`function`}function Sr(){}function Cr(e,t){for(let n=0;n<t.length;n++){if(!Object.hasOwn(t,n))continue;let r=t[n],i=Object.hasOwn(r,2),a=i?r[2]:void 0;if(a){let t=a;for(;t!==null&&t!==Object.prototype&&!Object.hasOwn(t,`layer`);)t=Object.getPrototypeOf(t);if(t!==null&&t!==Object.prototype){if(!Reflect.set(a,`layer`,e))throw TypeError(`Cannot assign rule layer`)}else Object.defineProperty(a,"layer",{configurable:!0,enumerable:!0,value:e,writable:!0})}else if(i){if(!Reflect.set(r,2,{layer:e}))throw TypeError(`Cannot assign rule metadata`)}else Object.defineProperty(r,2,{configurable:!0,enumerable:!0,value:{layer:e},writable:!0})}return t}var wr=class{_map=new Map;get(e,t){let n=this._map.get(e);if(n)return n.get(t)}getFallback(e,t,n){let r=this._map.get(e);return r||(r=new Map,this._map.set(e,r)),r.has(t)||r.set(t,n),r.get(t)}set(e,t,n){let r=this._map.get(e);return r||(r=new Map,this._map.set(e,r)),r.set(t,n),this}has(e,t){return this._map.get(e)?.has(t)??!1}delete(e,t){let n=this._map.get(e);if(!n)return!1;let r=n.delete(t);return r&&n.size===0&&this._map.delete(e),r}deleteTop(e){return this._map.delete(e)}map(e){return Array.from(this._map.entries()).flatMap(([t,n])=>Array.from(n.entries()).map(([n,r])=>e(r,t,n)))}},Tr=class extends Map{getFallback(e,t){let n=this.get(e);return n===void 0&&!this.has(e)?(this.set(e,t),t):n}map(e){let t=[];return this.forEach((n,r)=>{Object.defineProperty(t,t.length,{configurable:!0,enumerable:!0,value:e(n,r),writable:!0})}),t}flatMap(e){let t=[];return this.forEach((n,r)=>{for(let i of u(e(n,r)))Object.defineProperty(t,t.length,{configurable:!0,enumerable:!0,value:i,writable:!0})}),t}};function Er(e){if(!Object.hasOwn(e,0))return;let t=e[0];if(typeof t==`string`||typeof t==`symbol`)return[t,Object.hasOwn(e,1)?e[1]:void 0]}function Dr(e){return Reflect.ownKeys(e).filter(t=>Object.getOwnPropertyDescriptor(e,t)?.enumerable)}function Or(e,t){if(Object.getOwnPropertyDescriptor(e,t)?.enumerable)return{value:Reflect.get(e,t)}}function kr(e){let t=[];for(let n of Dr(e)){let r=Or(e,n);r&&Object.defineProperty(t,t.length,{configurable:!0,enumerable:!0,value:[n,r.value],writable:!0})}return t}function Ar(e){return p(e)?e:(Array.isArray(e)?u(e):kr(e)).filter(e=>{let t=Er(e);return t!==void 0&&t[1]!=null})}function jr(e){if(Array.isArray(e)){let t=u(e);return t.every(e=>Array.isArray(e)&&e.length>0&&!Array.isArray(Object.hasOwn(e,0)?e[0]:void 0))||t.length===0?[t]:t.map(e=>Ar(e))}else return[Ar(e)]}function Mr(e){let t=[],n,r;for(let i=0;i<e.length;i++){if(!Object.hasOwn(e,i))continue;let a=e[i],o=Er(a);if(!o)continue;let[s,c]=o;typeof s==`string`&&(s.startsWith(`$$`)||(s===`__virtual_key__`||n!==s||r!==c)&&(Object.defineProperty(t,t.length,{configurable:!0,enumerable:!0,value:a,writable:!0}),n=s,r=c))}return t}const Nr=`__virtual_key__`;function Pr(e,t){return t==null||typeof t==`function`||typeof e!=`string`?``:e===`__virtual_key__`?t?String(t):``:`${e}:${t};`}function Fr(e){if(e==null||e.length===0)return``;let t=``,n,r;for(let i=0;i<e.length;i++){if(!Object.hasOwn(e,i))continue;let a=Er(e[i]);if(!a)continue;let[o,s]=a;typeof o==`string`&&(o.startsWith(`$$`)||(o===`__virtual_key__`||n!==o||r!==s)&&(t+=Pr(o,s),n=o,r=s))}return t}function G(e){if(typeof e!=`object`||!e||Array.isArray(e))return!1;let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null}const Ir=`$reset`;function Lr(e,t,n){Object.defineProperty(e,t,{value:n,configurable:!0,enumerable:!0,writable:!0})}function Rr(e,t,n=!1){let r=e,i=t;if(Array.isArray(i))return n&&Array.isArray(r)?[...u(r),...u(i)]:[...u(i)];if(G(i)&&Object.hasOwn(i,`$reset`)&&i.$reset){let{[Ir]:e,...t}=i;return zr(t)}if(!G(i))return i;if(!G(r))return zr(i);let a={...r};return Dr(i).forEach(e=>{if(e===`$reset`)return;let t=Or(i,e);if(!t)return;let o=t.value,s=Object.hasOwn(r,e)?Reflect.get(r,e):void 0;if(G(o)&&Object.hasOwn(o,`$reset`)&&o.$reset){let{[Ir]:t,...n}=o;Lr(a,e,zr(n))}else G(s)&&G(o)||Array.isArray(s)&&Array.isArray(o)?Lr(a,e,Rr(s,o,n)):Lr(a,e,o)}),a}function zr(e){if(Array.isArray(e))return u(e).map(zr);if(G(e)){let t={};for(let n of Dr(e)){if(n===`$reset`)continue;let r=Or(e,n);r&&Lr(t,n,zr(r.value))}return t}return e}function Br(e){return typeof e!=`object`||!e?e:Vr(e)}function Vr(e){if(Array.isArray(e)){let t=Array.from({length:e.length});for(let n=e.length-1;n>=0;n--)t[n]=Object.hasOwn(e,n)?Br(e[n]):void 0;return t}if(G(e)){let t=e,n={};for(let e of Dr(t)){let r=Or(t,e);r&&Lr(n,e,Br(r.value))}return n}return e}function Hr(e){return Object.hasOwn(e,0)&&p(e[0])}function Ur(e){return Object.hasOwn(e,0)&&p(e[0])}function Wr(e){let t=e.split(/\s+/);return t[0]===``&&t.shift(),t.at(-1)===``&&t.pop(),t}function Gr(e){if(!e.includes(`[`))return Wr(e);let t=Oe(e);if(t.length===0)return Wr(e);let n=[],r=0,i=-1;for(let a=0;a<e.length;a++){let o=t[r];if(o&&a===o.start){i<0&&(i=a),a=o.end-1,r++;continue}/\s/.test(e[a])?(i>=0&&R(n,e.slice(i,a)),i=-1):i<0&&(i=a)}return i>=0&&R(n,e.slice(i)),n}function Kr(e){let t=``,n=0,r;for(let i=0;i<e.length;i++){let a=e[i];if(a===`\\`&&e[i+1]===`_`){t+=`_`,i++;continue}if(a===`\\`&&i+1<e.length){t+=a+e[++i];continue}if(r){a===r&&(r=void 0),t+=a===`_`&&n===0?` `:a;continue}if(a===`/`&&e[i+1]===`*`){let n=e.indexOf(`*/`,i+2);if(n===-1){t+=e.slice(i);break}t+=e.slice(i,n+2),i=n+1;continue}if(a===`"`||a===`'`){r=a,t+=a;continue}if(a===`(`?n++:a===`)`&&n>0&&n--,a===`_`&&n===0){t+=` `;continue}t+=a}return t}const qr=new Set([`calc`,`clamp`,`max`,`min`]);function Jr(e){return e==null?!1:e===`\\`||/[-_a-zA-Z0-9]/.test(e)||e.charCodeAt(0)>=128}function Yr(e,t){if(t>0&&Jr(e[t-1])||!/[-_a-zA-Z]/.test(e[t]))return;let n=t+1;for(;/[-_a-zA-Z0-9]/.test(e[n]??``);)n++;return e[n]===`(`?{name:e.slice(t,n),open:n}:void 0}function Xr(e){let t=new Map,n=[],r=!1,i;for(let a=0;a<e.length;a++){let o=e[a];if(r){o===`*`&&e[a+1]===`/`&&(r=!1,a++);continue}if(i){o===`\\`?a++:o===i&&(i=void 0);continue}if(o===`\\`){a++;continue}if(o===`"`||o===`'`){i=o;continue}if(o===`/`&&e[a+1]===`*`){r=!0,a++;continue}o===`(`?R(n,a):o===`)`&&n.length>0&&t.set(n.pop(),a)}return t}function Zr(e,t){let n=e[t];if(n===`"`||n===`'`){for(let r=t+1;r<e.length;r++)if(e[r]===`\\`)r++;else if(e[r]===n)return r+1;return e.length}if(n===`/`&&e[t+1]===`*`){let n=e.indexOf(`*/`,t+2);return n<0?e.length:n+2}}function Qr(e){let t=e.trimEnd();for(;t.endsWith(`*/`);){let e=t.lastIndexOf(`/*`);if(e<0)break;t=t.slice(0,e).trimEnd()}if(t.endsWith(`)`)||/(?:^|[\s,(+\-*/])(?:e|pi|nan|-?infinity)$/i.test(t))return!0;let n=/[+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?(?:%|[a-z]+)?$/i.exec(t);if(n==null)return!1;let r=n.index;return r===0||/[\s,(+\-*/]/.test(t[r-1])}function $r(e,t,n){return e[t]!==`+`&&e[t]!==`-`||!/\d/.test(e[t+1]??``)?!1:/(?:^|[^-_a-zA-Z0-9.])(?:\d+(?:\.\d*)?|\.\d+)[eE]$/.test(n.trimEnd())}function ei(e){if(!e.includes(`(`))return e;let t=Xr(e),n=[],r=``;for(let i=0;i<e.length;){let a=Zr(e,i);if(a!=null){r+=e.slice(i,a),i=a;continue}let o=Yr(e,i);if(o!=null){let a=t.get(o.open);if(a==null){r+=e.slice(i);break}let s=o.name.toLowerCase();if(s===`url`){r+=e.slice(i,a+1),i=a+1;continue}if(qr.has(s)){r+=`${o.name}(`,R(n,a),i=o.open+1;continue}r+=o.name,i=o.open;continue}let s=e[i],c=s===`+`||s===`-`||s===`*`||s===`/`,l=s===`/`&&e[i+1]===`*`;n.length>0&&c&&!l&&!$r(e,i,r)&&Qr(r)?(/\s/.test(r.at(-1)??``)||(r+=` `),r+=s,/\s/.test(e[i+1]??``)||(r+=` `)):r+=s,i===n.at(-1)&&n.pop(),i++}return r}function ti(e){return e.length>=2&&e[0]===`[`&&e[e.length-1]===`]`}function ni(e,t={}){let{calc:n=!0}=t,r=e;return ti(r)&&(r=Kr(r.slice(1,-1))),n&&(r=ei(r)),r}const ri=new A(256,void 0,!0);function ii(e){return u(e).map(e=>e)}function ai(e,t,n){return n.some(n=>e.startsWith(n,t))}function oi(e,t,n){let r=t-1;for(;r>0&&/[\w$-]/.test(e[r-1]);)r--;let i=r-1;for(;i>=0&&/\s/.test(e[i]);)i--;return e[i]===`(`&&n.some(t=>e.slice(i-t.length,i)===t)}function si(e,t){let n=t+1;for(;/\s/.test(e[n]??``);)n++;return e[n]===`"`||e[n]===`'`||e[n]==="`"}function ci(e,t){let n=new Set,r=[],i=[],a=[],o,s=()=>{let e=o?.bracketStarts.at(-1);if(e)e.containsCandidate=!0;else{let e=i.at(-1);e&&(e.containsCandidate=!0)}};for(let c=0;c<e.length;c++){let l=e[c],u=l===`[`&&(e[c-1]===`:`||e[c-1]===`@`);if(u||l===`[`&&!o){si(e,c)&&(!u||Ee(e,c)&&!oi(e,c,t))&&n.add(c),i.push({containsCandidate:!1,parentQuote:o,start:c}),o=void 0;continue}if(i.length!==0){if(o){if(l===`\\`)c++;else if(l===o.character){if(o.bracketStarts.some(e=>e.containsCandidate)){for(let e of o.bracketStarts)e.containsCandidate&&n.add(e.start);let e=i.at(-1);e&&(e.containsCandidate=!0)}o=void 0}else if(l===`[`)o.bracketStarts.push({containsCandidate:!1,start:c});else if(l===`]`){let i=o.bracketStarts.pop();i&&ai(e,c+1,t)?(r.push({start:i.start,end:c+1}),n.delete(i.start),s()):i?.containsCandidate&&(n.add(i.start),s())}}else if(l===`"`||l===`'`||l==="`")o={bracketStarts:[],character:l},a.push(o);else if(l===`\\`)c++;else if(l===`]`){let a=i.pop(),l=a.start,u=c+1,d=n.has(l)||De(e,l,u)&&!oi(e,l,t),f=(e[l-1]===`:`||e[l-1]===`@`||ai(e,u,t))&&!d;f?(r.push({start:l,end:u}),n.delete(l)):a.containsCandidate&&n.add(l),o=a.parentQuote,(f||a.containsCandidate)&&s()}}}for(let e of i)e.containsCandidate&&n.add(e.start);for(let e of a)for(let t of e.bracketStarts)t.containsCandidate&&n.add(t.start);let c=[];for(let e of r.sort((e,t)=>e.start-t.start||t.end-e.end))(!c.length||e.start>=c.at(-1).end)&&c.push(e);return{barrierStarts:n,ranges:c}}function li(e,t){let{barrierStarts:n,ranges:r}=ci(e,t);if(r.length===0&&n.size===0)return e;let i=e.split(``);for(let e of n)i[e]=`$`;for(let e of r)for(let t=e.start+1;t<e.end-1;t++)i[t]=`$`;return i.join(``)}function ui(e){let t=JSON.stringify(e),n=[...e].sort((e,t)=>t.length-e.length).map(mn).join(`|`),r=`\\[[^\\]]*?\\]`,i=ri.getOrInsert(t,RegExp(n?`((?:[!@*<~\\w+:_-]|${r})+?)(${n})\\(((?:[~!@<>\\w\\s:/\\\\,%#.$?-]|${r})+?)\\)(?!\\s*?=>)`:`(?!)`,`gm`));return i.lastIndex=0,i}function di(e=[`-`,`:`]){let t=ui(ii(e));return new RegExp(t.source,t.flags)}function fi(e,t=[`-`,`:`],n=5){let r=ii(t),i=ui(r),a=!1,o=typeof e==`string`?e:e.original,s=o,c=new Set,l=new Map;if(n>0){let e=li(s,r),t;if(r.some(t=>e.includes(`${t}(`)))do{t=!1;let o=``,u=0;i.lastIndex=0;let d;for(;d=i.exec(e);){let e=d.index,[n,r,i,f]=d;a=!0,t=!0;let p=s.slice(e,e+n.length),m=s.slice(e,e+r.length);c.add(m+i);let h=e+m.length+i.length+1,g=s.slice(h,h+f.length),_={length:p.length,items:[]};l.set(e,_);let v=0;for(let e of Gr(g)){let t=g.indexOf(e,v),n=h+t;v=t+e.length;let r=l.get(n)?.items;r?l.delete(n):r=[{offset:n,length:e.length,className:e}];for(let e of r)e.className=e.className===`~`?i===`:`?`${m}${i}~`:m:e.className.replace(/^(!?)(.*)/,(e,t,n)=>`${t}${m}${i}${n}`),_.items.push(e)}o+=s.slice(u,e),o+=`$`.repeat(p.length),u=e+p.length}t&&(s=o+s.slice(u)),--n,t&&n&&(e=li(s,r))}while(t&&n)}let u=[...l].sort(([e],[t])=>e-t),d;if(typeof e==`string`){d=``;let t=0;for(let[n,r]of u)d+=e.slice(t,n),d+=r.items.map(e=>e.className).join(` `),t=n+r.length;d+=e.slice(t)}else{d=e;for(let[e,t]of u){if(d.slice(e,e+t.length)!==o.slice(e,e+t.length))throw Error(`Cannot expand a variant group that overlaps an existing MagicString edit`);d.overwrite(e,e+t.length,t.items.map(e=>e.className).join(` `))}}return{prefixes:Array.from(c),hasChanged:a,groupsByOffset:new Map(u),get expanded(){return d.toString()}}}function pi(e,t){let n=new Map,r=ii(t).sort((e,t)=>t.length-e.length),i=Gr(e).map(e=>{let t=r.find(t=>e.startsWith(t));if(!t)return e;let i=e.slice(t.length);if(n.has(t))return n.get(t).push(i),null;{let e=[i];return n.set(t,e),{prefix:t,items:e}}}).filter(br).map(e=>typeof e==`string`?e:`${e.prefix}(${e.items.join(` `)})`).join(` `);return i?`${/^\s/.test(e)?` `:``}${i}${/\s$/.test(e)?` `:``}`:e?` `:``}function mi(e,t=[`-`,`:`],n=5){let r=fi(e,t,n);return typeof e==`string`?r.expanded:e}const hi=new Set;function gi(e){if(!hi.has(e)){hi.add(e);try{console.warn(`[Teacss]`,e)}catch(t){throw hi.delete(e),t}}}function _i(e,t,n){let r=e;for(;r!==null&&r!==Object.prototype&&!Object.hasOwn(r,t);)r=Object.getPrototypeOf(r);if(r!==null&&r!==Object.prototype){if(!Reflect.set(e,t,n))throw TypeError(`Cannot assign rule metadata "${String(t)}"`)}else Object.defineProperty(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0})}function vi(e,t){let n=e;for(;n!==null&&n!==Object.prototype;){if(Object.hasOwn(n,t))return Reflect.get(e,t);n=Object.getPrototypeOf(n)}}function yi(e,t){Object.defineProperty(e,e.length,{configurable:!0,enumerable:!0,value:t,writable:!0})}function bi(e){if(!Object.hasOwn(e,0)||!Object.hasOwn(e,1))throw TypeError(`[Teacss] invalid rule or shortcut entry: matcher and body must be own tuple values`);let t=[e[0],e[1],void 0],n=Object.hasOwn(e,2)?e[2]:void 0;if(n!==void 0){let e={...n},r=Object.hasOwn(e,`prefix`)?e.prefix:void 0;Array.isArray(r)&&_i(e,`prefix`,[...u(r)]),t[2]=e}return t}function xi(e){let t=Object.create(null),n=[];for(let[r,i]of e.entries()){let e=Object.hasOwn(i,2)?i[2]:void 0;if(e===void 0)if(e={},Object.hasOwn(i,2)){if(!Reflect.set(i,2,e))throw TypeError(`Cannot assign rule metadata`)}else Object.defineProperty(i,2,{configurable:!0,enumerable:!0,value:e,writable:!0});if(_i(e,`__index`,r),Hr(i)){let n=u(vi(e,`prefix`)??``);for(let e of n)t[e+i[0]]=i}else yi(n,i)}return n.reverse(),{rulesSize:e.length,rulesDynamic:n,rulesStaticMap:t}}function Si(e){let t=u(e.rules).map(bi),n=xi(t);e.rules=t,e.rulesSize=n.rulesSize,e.rulesDynamic=n.rulesDynamic,e.rulesStaticMap=n.rulesStaticMap}function K(e,t){return e!=null&&Object.hasOwn(e,t)?Reflect.get(e,t):void 0}function Ci(e,t){let n=e;for(;n!==null&&n!==Object.prototype&&n!==Array.prototype&&n!==Function.prototype;){if(Object.hasOwn(n,t))return Reflect.get(e,t);n=Object.getPrototypeOf(n)}}function wi(e,t){Object.defineProperty(e,e.length,{configurable:!0,enumerable:!0,value:t,writable:!0})}function Ti(e,t){for(let t=e.length;t>0;t--)Object.defineProperty(e,t,{configurable:!0,enumerable:!0,value:e[t-1],writable:!0});Object.defineProperty(e,0,{configurable:!0,enumerable:!0,value:t,writable:!0})}function Ei(e){let t=new Set,n=[];for(let r of e){let e=r.name;t.has(e)||(t.add(e),wi(n,r))}return n}function Di(e){return Array.from(e,(e,t)=>({index:t,order:Ci(e,`order`)||0,value:e})).sort((e,t)=>e.order-t.order||e.index-t.index).map(({value:e})=>e)}function Oi(e,t){let n={...e};for(let e of Reflect.ownKeys(t)){if(!Object.getOwnPropertyDescriptor(t,e)?.enumerable)continue;let r=Reflect.get(t,e);r!==void 0&&Object.defineProperty(n,e,{value:r,configurable:!0,enumerable:!0,writable:!0})}return n}function ki(e){return u(e).flatMap(e=>Array.isArray(e)?[e]:Object.entries(e))}const Ai=new WeakSet;function ji(e,t){let n={};for(let t of Reflect.ownKeys(e)){if(t===`name`||!Object.getOwnPropertyDescriptor(e,t)?.enumerable)continue;let r=Reflect.get(e,t);Object.defineProperty(n,t,{value:t===`prefix`&&Array.isArray(r)?[...u(r)]:r,configurable:!0,enumerable:!0,writable:!0})}return Object.defineProperty(n,"name",{value:t,configurable:!0,enumerable:!0,writable:!0}),n}async function Mi(e){let t=typeof e==`function`?await e():await e;if(typeof t!=`object`||!t||Array.isArray(t))throw TypeError(`Invalid TeaCSS preset: expected an object, received ${t===null?`null`:Array.isArray(t)?`array`:typeof t}.`);let n=Object.hasOwn(t,`name`)?Reflect.get(t,`name`):void 0;if(typeof n!=`string`||n.trim()===``)throw TypeError(`Invalid TeaCSS preset: expected a non-empty string name.`);if(Ai.has(t))return t;t=ji(t,n),Ai.add(t);let r=K(t,`shortcuts`),i=K(t,`rules`),a=r?ki(r).map(bi):void 0;t.shortcuts=a,t.rules=i?u(i).map(bi):void 0;let o=K(t,`prefix`),s=K(t,`layer`);if(o||s){let e=e=>{e[2]||={};let t=e[2];Ci(t,`prefix`)==null&&o&&Object.defineProperty(t,"prefix",{configurable:!0,enumerable:!0,value:[...u(o)],writable:!0}),Ci(t,`layer`)==null&&s&&Object.defineProperty(t,"layer",{configurable:!0,enumerable:!0,value:s,writable:!0})};a?.forEach(e),t.rules?.forEach(e)}return t}async function Ni(e){return Pi(e,new Set)}async function Pi(e,t){if(t.has(e))throw TypeError(`Circular TeaCSS preset reference detected.`);let n=new Set(t);n.add(e);let r=await Mi(e),i=K(r,`presets`);if(!i)return[r];let a=u(i).flatMap(e=>Array.isArray(e)?[...e]:[e]);return[r,...(await Promise.all(a.map(e=>Pi(e,n)))).flat()]}function Fi(e){if(e.length===0)return{};let t=[],n=[],r=!1,i=!1,a=[],o=[];for(let s of e){let e=K(s,`pipeline`),c=K(s,`filesystem`),l=K(s,`inline`),u=e&&K(e,`include`),d=e&&K(e,`exclude`);e===!1?(i=!0,r=!0):r||(e!==void 0&&(i=!0),u&&wi(t,u),d&&wi(n,d)),c&&wi(a,c),l&&wi(o,l)}let s={};return r?s.pipeline=!1:i&&(s.pipeline={},t.length&&(s.pipeline.include=d(Ki(...t))),n.length&&(s.pipeline.exclude=d(Ki(...n)))),a.length&&(s.filesystem=d(a.flatMap(e=>u(e)))),o.length&&(s.inline=d(o.flatMap(e=>u(e)))),s}async function Ii(e={},t={}){let n=Oi(t,e),r=K(n,`presets`)??[],i=Ei((await Promise.all(u(r).flatMap(e=>u(e)).map(e=>Ni(e)))).flat()),a=Array.from(i,e=>({enforce:K(e,`enforce`),preset:e})),o=[...a.filter(({enforce:e})=>e===`pre`),...a.filter(({enforce:e})=>e==null),...a.filter(({enforce:e})=>e===`post`)].map(({preset:e})=>e),s=[...o,n],c=[...s].reverse(),l=s.reduce((e,t)=>({...e,...K(t,`layers`)}),{...he});function f(e){return d(s.flatMap(t=>u(K(t,e))))}let p=f(`extractors`),m=c.map(e=>K(e,`extractorDefault`)).find(e=>e!==void 0);m===void 0&&(m=sr),m&&!p.includes(m)&&Ti(p,m);let h=Di(p),g=f(`rules`).map(bi),{rulesSize:_,rulesStaticMap:v,rulesDynamic:y}=xi(g),b=s.map(e=>K(e,`autocomplete`)),x=e=>b.flatMap(t=>{let n=K(t,e);return n===void 0?[]:Array.isArray(n)?[...n]:[n]}),S={templates:d(x(`templates`)),extractors:Di(x(`extractors`)),shorthands:Gi(b.map(e=>K(e,`shorthands`)||{}))},C=f(`separators`);C.length||(C=[`:`,`-`]);let w=Fi(f(`content`)),T=c.map(e=>K(e,`details`)).find(e=>e!==void 0),E=c.map(e=>K(e,`outputToCssLayers`)).find(e=>e!==void 0),D=c.map(e=>K(e,`sortLayers`)).find(e=>e!==void 0),O=K(n,`envMode`)||`build`,k={...n,mergeSelectors:K(n,`mergeSelectors`)??!0,warn:K(n,`warn`)??!0,unmatched:K(n,`unmatched`)??`off`,outputToCssLayers:E,sortLayers:D??(e=>e),blocklist:f(`blocklist`),presets:o,envMode:O,shortcutsLayer:K(n,`shortcutsLayer`)||`shortcuts`,layers:l,theme:Wi(s.map(e=>K(e,`theme`))),rules:g,rulesSize:_,rulesDynamic:y,rulesStaticMap:v,preprocess:f(`preprocess`),postprocess:f(`postprocess`),preflights:f(`preflights`),autocomplete:S,variants:Di(f(`variants`).map(vr)),shortcuts:ki(f(`shortcuts`)).map(bi).reverse(),extractors:h,safelist:f(`safelist`),separators:C,details:T??O===`dev`,content:w,transformers:Ei(f(`transformers`))},A=f(`extendTheme`);for(let e of A)k.theme=e(k.theme,k)||k.theme;let j=!1;for(let e of s){let t=K(e,`configResolved`);t!=null&&(j=!0,t(k))}return j&&Si(k),k}function Li(e){let t={};for(let n of Reflect.ownKeys(e))Object.getOwnPropertyDescriptor(e,n)?.enumerable&&Object.defineProperty(t,n,{configurable:!0,enumerable:!0,value:Reflect.get(e,n),writable:!0});return t}function Ri(e,t,n){return Object.hasOwn(t,n)?Reflect.get(t,n):K(e,n)}function zi(e,t,n){Object.defineProperty(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0})}function Bi(e){let t=Li(e);if(Object.hasOwn(e,`templates`)){let n=Ri(e,t,`templates`);n===void 0?delete t.templates:zi(t,`templates`,u(n))}if(Object.hasOwn(e,`extractors`)){let n=Ri(e,t,`extractors`);n===void 0?delete t.extractors:zi(t,`extractors`,u(n))}if(Object.hasOwn(e,`shorthands`)){let n=Ri(e,t,`shorthands`);n===void 0?delete t.shorthands:zi(t,`shorthands`,n)}return t}function Vi(e={},t={}){let n=K(e,`shorthands`),r=K(t,`shorthands`),i={...e},a={...t};delete i.shorthands,delete a.shorthands;let o=Rr(i,a,!0);return(n!==void 0||r!==void 0)&&Object.defineProperty(o,"shorthands",{configurable:!0,enumerable:!0,value:{...n??{},...r??{}},writable:!0}),o}function Hi(e){let t=Li(e);if(Object.hasOwn(e,`entry`)){let n=Ri(e,t,`entry`);n===void 0?delete t.entry:zi(t,`entry`,u(n))}return t}function Ui(e){let t=[`shortcuts`,`preprocess`,`postprocess`,`extendTheme`,`separators`];return u(e).map(e=>Object.entries(e).reduce((e,[n,r])=>{if(r===void 0)return e;let i=n===`autocomplete`&&r?Bi(r):n===`cli`&&r?Hi(r):t.includes(n)?u(r):r;return{...e,[n]:i}},{})).reduce((e,t)=>{let n=K(e,`autocomplete`),r=K(t,`autocomplete`),i=K(e,`content`),a=K(t,`content`),o=K(e,`extractorDefault`),s=K(t,`extractorDefault`),c=K(e,`theme`),l=K(t,`theme`),u={...e},d={...t};delete u.autocomplete,delete u.content,delete u.extractorDefault,delete u.theme,delete d.autocomplete,delete d.content,delete d.extractorDefault,delete d.theme;let f=Rr(u,d,!0);return(n||r)&&Object.defineProperty(f,"autocomplete",{configurable:!0,enumerable:!0,value:Vi(n,r),writable:!0}),(c||l)&&Object.defineProperty(f,"theme",{configurable:!0,enumerable:!0,value:Wi([c,l]),writable:!0}),(i||a)&&Object.defineProperty(f,"content",{configurable:!0,enumerable:!0,value:Fi([i||{},a||{}]),writable:!0}),(o!==void 0||s!==void 0)&&zi(f,`extractorDefault`,s===void 0?o:s),f},{})}function Wi(e){return e.reduce((e,t)=>{if(!t)return e;let n=Vr(t);if(!G(n))return n;if(!G(e)){if(!Reflect.ownKeys(n).some(e=>Object.getOwnPropertyDescriptor(n,e)?.enumerable))return e;if(Object.hasOwn(n,`$reset`)&&Reflect.get(n,`$reset`))return Rr({},n);throw TypeError(`[Teacss] cannot safely merge a plain theme into a non-plain theme; use extendTheme for a class-aware merge or $reset to replace it.`)}return Rr(e,n)},{})}function Gi(e){return e.reduce((e,t)=>{let n=Object.create(null);for(let e of Object.keys(t)){let r=t[e];if(Array.isArray(r)){let t=u(r);n[e]=t.length===1?t[0]??``:`(${t.join(`|`)})`}else n[e]=r}return{...e,...n}},{})}function Ki(...e){return e.flatMap(e=>u(qi(e)))}function qi(e){return Array.isArray(e)?e:e?[e]:[]}function Ji(e){return e}function Yi(){let e=typeof process<`u`&&!!process.stdout;return{isNode:e,isVSCode:e&&!!process.env.VSCODE_CWD,isESLint:e&&!!process.env.ESLINT}}var Xi=`0.3.5`;const Zi=Object.getOwnPropertyDescriptor(RegExp.prototype,`source`).get,Qi=[[`d`,Object.getOwnPropertyDescriptor(RegExp.prototype,`hasIndices`)?.get],[`g`,Object.getOwnPropertyDescriptor(RegExp.prototype,`global`)?.get],[`i`,Object.getOwnPropertyDescriptor(RegExp.prototype,`ignoreCase`)?.get],[`m`,Object.getOwnPropertyDescriptor(RegExp.prototype,`multiline`)?.get],[`s`,Object.getOwnPropertyDescriptor(RegExp.prototype,`dotAll`)?.get],[`u`,Object.getOwnPropertyDescriptor(RegExp.prototype,`unicode`)?.get],[`v`,Object.getOwnPropertyDescriptor(RegExp.prototype,`unicodeSets`)?.get],[`y`,Object.getOwnPropertyDescriptor(RegExp.prototype,`sticky`)?.get]],$i=RegExp.prototype.exec;function q(e){return Reflect.apply(Zi,e,[])}function J(e){let t=``;for(let[n,r]of Qi)r&&Reflect.apply(r,e,[])&&(t+=n);return t}const ea=/[a-zA-Z0-9_-]/;function ta(e,t){let n=e;for(;n!=null&&n!==Object.prototype&&n!==Array.prototype&&n!==Function.prototype;){if(Object.hasOwn(n,t))return Reflect.get(e,t);n=Object.getPrototypeOf(n)}}function na(e,t){if(t.length>0&&e.length>256/t.length)return null;let n=[];for(let r of e)for(let e of t)n.push(r+e);return n}function ra(e){let t=!1,n=0,r=!1;for(let i=1;i<e.length;i++){let a=e[i];if(t)t=!1;else if(a===`\\`)t=!0;else if(r)a===`]`&&(r=!1);else if(a===`[`)r=!0;else if(a===`(`)n++;else if(a===`)`)n>0&&n--;else if(a===`|`&&n===0)return!0}return!1}function ia(e,t){return e[t]===`:`&&!/[?*+{]/.test(e[t+1]??``)}function aa(e){if(!e.startsWith(`^`)||ra(e))return null;let t=1;for(;t<e.length&&ea.test(e[t]);)t++;if(t>1&&ia(e,t))return[e.slice(1,t)];let n=oa(e,1,`:`);if(!n||!ia(e,n.end)||n.combos.some(e=>e.length===0||e.includes(`:`)))return null;let r=[...new Set(n.combos)];return r.length?r:null}function oa(e,t,n){let r=[``];for(;t<e.length;){let i=e[t];if(n.includes(i))break;if(ea.test(i)){let n=``;for(;t<e.length&&ea.test(e[t]);)n+=e[t++];r=r.map(e=>e+n);continue}let a=null;if(i===`(`)a=sa(e,t);else if(i===`[`)a=ca(e,t);else return null;if(!a)return null;t=a.end;let o=a.combos;if(e[t]===`?`)o=[``,...o],t++;else if(e[t]===`*`||e[t]===`+`||e[t]===`{`)return null;let s=na(r,o);if(!s)return null;r=s}return{combos:r,end:t}}function sa(e,t){if(t++,e.startsWith(`?:`,t))t+=2;else if(e[t]===`?`)return null;let n=[];for(;;){let r=oa(e,t,`|)`);if(!r||(n.push(...r.combos),n.length>256))return null;if(t=r.end,e[t]===`|`){t++;continue}return e[t]===`)`?{combos:n,end:t+1}:null}}function ca(e,t){if(t++,e[t]===`^`)return null;let n=[];for(;t<e.length&&e[t]!==`]`;){let r=e[t];if(r===`\\`||r===`-`||(n.push(r),n.length>256))return null;t++}return e[t]===`]`?{combos:n,end:t+1}:null}function la(e){if(ta(e[2],`prefix`))return null;let[t]=e;return!(t instanceof RegExp)||Object.hasOwn(t,`exec`)||Object.getPrototypeOf(t)!==RegExp.prototype||t.exec!==$i||J(t)?null:aa(q(t))}function ua(e){let t=e.map(e=>[e,la(e)]),n=new Map;for(let[,e]of t)if(e!==null)for(let t of e)n.has(t)||n.set(t,[]);let r=[];for(let[e,i]of t){if(i===null){r.push(e);for(let t of n.values())t.push(e);continue}for(let t of i)n.get(t).push(e)}return{map:n,fallback:r}}const da=/^[a-z][a-z0-9-]*$/,fa=new Set([`about`,`blob`,`bun`,`chrome`,`data`,`deno`,`file`,`ftp`,`http`,`https`,`jsr`,`mailto`,`node`,`npm`,`tel`,`urn`,`vscode`,`virtual`,`ws`,`wss`]);function pa(e){let t=0,n;for(let r=0;r<e.length;r++){let i=e[r];if(n){i===`\\`?r++:i===n&&(n=void 0);continue}if(i===`"`||i===`'`)n=i;else if(i===`\\`)r++;else if(i===`[`||i===`(`)t++;else if(i===`]`||i===`)`)t--;else if(i===`@`&&t===0)return e.slice(0,r)}return e}function ma(e){let t=pa(e);if(!t||t.startsWith(`$`)||t.startsWith(`[`))return!1;let n=t.indexOf(`:`);if(n<=0||n===t.length-1)return!1;let r=t.slice(0,n);return!da.test(r)||t.startsWith(`//`,n+1)?!1:!fa.has(r)}function ha(e){if(e.flags)return;let t=e.source;if(!t.startsWith(`^`))return;let n=1;for(;n<t.length&&/[A-Za-z0-9_-]/.test(t[n]);)n++;return t[n]===`:`&&n>1?t.slice(1,n):void 0}const ga=new WeakMap;function _a(e){let t=ga.get(e.rulesStaticMap);if(t)return t;let n=new Map,r=new Set;for(let t of Object.keys(e.rulesStaticMap)){let e=t.indexOf(`:`);if(e<=0)continue;let r=t.slice(0,e),i=n.get(r);i||(i=new Set,n.set(r,i)),i.add(t.slice(e+1))}for(let t of e.rulesDynamic){let e=ha(t[0]);e!=null&&!n.has(e)&&r.add(e)}let i={prefixValues:n,dynamicPrefixes:r};return ga.set(e.rulesStaticMap,i),i}function va(e,t,n){if(e===t)return 0;if(Math.abs(e.length-t.length)>n)return 1/0;let r=Array.from({length:t.length+1},(e,t)=>t);for(let i=1;i<=e.length;i++){let a=[i],o=i;for(let n=1;n<=t.length;n++){let s=e[i-1]===t[n-1]?0:1;a[n]=Math.min(r[n]+1,a[n-1]+1,r[n-1]+s),a[n]<o&&(o=a[n])}if(o>n)return 1/0;r=a}return r[t.length]<=n?r[t.length]:1/0}function ya(e,t){let n=Math.min(e.length,t.length),r=0;for(;r<n&&e[r]===t[r];)r++;return r}function ba(e,t,n){let r=va(e,t,2);if(r!==1/0)return r;let i=e.length<=t.length?e:t,a=e.length<=t.length?t:e;if(i.length>=n&&(a.startsWith(i)||a.endsWith(i)||a.includes(i)))return 3+(a.length-i.length)/100;if(ya(e,t)>=n)return 5+Math.abs(e.length-t.length)/100}function xa(e,t){let n=pa(e),r=n.indexOf(`:`);if(r<=0)return;let i=n.slice(0,r),a=n.slice(r+1),{prefixValues:o,dynamicPrefixes:s}=_a(t),c=[];if(o.has(i)||s.has(i))for(let e of o.get(i)??[]){if(e===a)continue;let t=ba(a,e,3);t!==void 0&&c.push({suggestion:`${i}:${e}`,score:t})}else{if(i.length<3)return;let e=new Set([...o.keys(),...s]);for(let t of e){let e=ba(i,t,4);if(e===void 0)continue;let n=o.get(t)?.has(a)||s.has(t);c.push({suggestion:`${t}:${a}`,score:n?e:e+10})}if(c.length===0)return}c.sort((e,t)=>e.score-t.score||(e.suggestion<t.suggestion?-1:1));let l=new Set,u=[];for(let{suggestion:e}of c)if(!(l.has(e)||e===n)&&(l.add(e),u.push(e),u.length===3))break;return u}const Y=Object.freeze({shortcutsNoMerge:Symbol.for(`@teacss/core/shortcut-no-merge`),noMerge:Symbol.for(`@teacss/core/no-merge`),noScope:Symbol.for(`@teacss/core/no-scope`),variants:Symbol.for(`@teacss/core/variants`),parent:Symbol.for(`@teacss/core/parent`),selector:Symbol.for(`@teacss/core/selector`),layer:Symbol.for(`@teacss/core/layer`),sort:Symbol.for(`@teacss/core/sort`),body:Symbol.for(`@teacss/core/body`)});function Sa(e){let t=e.match(/\(\s*min-width\s*:\s*([\d.]+)(px|rem|em)?\s*\)/i);if(t)return Ca(t[1],t[2]);let n=e.match(/\(\s*max-width\s*:\s*([\d.]+)(px|rem|em)?\s*\)/i);return n?-Ca(n[1],n[2]):null}function Ca(e,t){let n=Number.parseFloat(e),r=t?.toLowerCase();return r===`rem`||r===`em`?n*16:n}function wa(e,t){return e<t?-1:+(e>t)}function Ta(e,t){return wa(e??``,t??``)}function X(e,t){Object.defineProperty(e,e.length,{configurable:!0,enumerable:!0,value:t,writable:!0})}function Ea(e,t){for(let n of t)X(e,n)}function Da(e,t){for(let t=e.length;t>0;t--)Object.hasOwn(e,t-1)?Object.defineProperty(e,t,{configurable:!0,enumerable:!0,value:e[t-1],writable:!0}):delete e[t];Object.defineProperty(e,0,{configurable:!0,enumerable:!0,value:t,writable:!0})}function Oa(e){let t=new cr;for(let n of e)t.setCount(n,e.getCount(n));return t}function ka(e){return W(e)?Oa(e):new Set(e)}function Aa(e,t,n){if(W(e)&&W(t)&&W(n)){let r=new Set([...t,...n]);for(let i of r){let r=e.getCount(i)+n.getCount(i)-t.getCount(i);r>0?e.setCount(i,r):e.delete(i)}return}for(let r of t)n.has(r)||e.delete(r);for(let r of n)t.has(r)||e.add(r)}function*ja(e,t){for(let n=0;n<e.length;n++){let r=t[n];r!=null&&(yield[e[n],r])}}function Ma(e){if(e!==void 0&&(!Number.isSafeInteger(e)||e<1))throw RangeError(`tokenConcurrency must be a positive integer`)}function Na(e,t){return Object.hasOwn(e,t)?Reflect.get(e,t):void 0}function Z(e,t){let n=e;for(;n!==null&&n!==Object.prototype&&n!==Array.prototype&&n!==Function.prototype;){if(Object.hasOwn(n,t))return Reflect.get(e,t);n=Object.getPrototypeOf(n)}}function Pa(e,t){if(Object.hasOwn(e,t))return Reflect.get(e,t);let n=Object.getPrototypeOf(e);if(n===null||n===Object.prototype)return;let r=Object.getOwnPropertyDescriptor(n,`constructor`)?.value;if(typeof r==`function`&&r!==Object)for(;n!==null&&n!==Object.prototype;){if(Object.hasOwn(n,t))return Reflect.get(e,t);n=Object.getPrototypeOf(n)}}function Q(e,t){return e?Z(e,t):void 0}function Fa(e,t){return Na(e,t)}function Ia(e){return{body:Z(e,`body`),handle:Z(e,`handle`),layer:Z(e,`layer`),order:Z(e,`order`),parent:Z(e,`parent`),selector:Z(e,`selector`),sort:Z(e,`sort`),source:e}}async function La(e,t,n){if(t===void 0||t>=e.length)return await Promise.all(e.map(n));let r=Array(e.length),i=0,a=!1,o=Array.from({length:Math.min(t,e.length)},async()=>{for(;!a&&i<e.length;){let t=i++;try{let i=await n(e[t]);Object.defineProperty(r,t,{configurable:!0,enumerable:!0,value:i,writable:!0})}catch(e){throw a=!0,e}}});return await Promise.all(o),r}function Ra(e,t){return e?.replaceAll(Ao(t),`&`)}function za(e,t){let n=t.exec,r=J(t);if(!r.includes(`g`)&&!r.includes(`y`))return n.call(t,e);if(Object.getOwnPropertyDescriptor(t,`lastIndex`)?.writable===!1){if(n!==$i)return n.call(t,e);let i=new RegExp(q(t),r);return $i.call(i,e)}t.lastIndex=0;try{return n.call(t,e)}finally{Object.getOwnPropertyDescriptor(t,`lastIndex`)?.writable!==!1&&(t.lastIndex=0)}}function Ba(e,t,n,r){let i=u(e).filter(Va),a=u(n).filter(Va);if(i.length!==a.length)return!1;for(let e=0;e<i.length;e++){let n=i[e],o=a[e];if(n[2]!==o[2]||Ra(n[1],t)!==Ra(o[1],r)||n[3]!==o[3]||Q(n[4],`layer`)!==Q(o[4],`layer`)||Q(n[4],`sort`)!==Q(o[4],`sort`)||!!Q(n[4],`noScope`)!=!!Q(o[4],`noScope`)||!!(n[6]??Q(n[4],`noMerge`))!=!!(o[6]??Q(o[4],`noMerge`)))return!1}return!0}function Va(e){return Array.isArray(e)&&Object.hasOwn(e,0)&&Object.hasOwn(e,1)&&Object.hasOwn(e,2)&&Object.hasOwn(e,3)&&Object.hasOwn(e,4)&&Object.hasOwn(e,5)&&Object.hasOwn(e,6)}function Ha(e){return Object.hasOwn(e,0)&&e[0]===Y.shortcutsNoMerge}function Ua(e){for(let t=e.length-1;t>=0;t--){if(!Object.hasOwn(e,t))continue;let n=e[t];if(Ha(n))return Object.hasOwn(n,1)?n[1]:void 0}}function Wa(e,t){let n=[...e,...t],r=[];for(let e=t.length-1;e>=0;e--)ie(t[e])&&X(r,t[e]);for(let t=e.length-1;t>=0;t--)ie(e[t])&&X(r,e[t]);if(r.length<2)return n;let i=r[0];for(let e=1;e<r.length;e++)i=ae(i,r[e])??i;let a=[],o=!1;for(let e of n)ie(e)?o||=(X(a,i),!0):X(a,e);return a}function Ga(e){let t;for(let n of e)n.includes(`{`)&&(t??=[],t.push(n));if(!t)return e;for(let n of t){let t=Gr(cn(n));if(t.length===1&&t[0]===n)continue;let r=W(e)?e.getCount(n):1;e.delete(n);for(let n of t)W(e)?e.setCount(n,e.getCount(n)+r):e.add(n)}return e}const Ka=/(?<!\\)::?-[a-zA-Z]/;function qa(e){let t=new Map,n=new Map,r=0,i;for(let a of e){let[o,s,c]=a;if(i!==void 0&&s!==i&&(t.clear(),n.clear()),i=s,c){e[r++]=a;continue}let l=o.length>0,u=l?t:n,d=u.get(s);if(!d){u.set(s,a),e[r++]=a;continue}l&&Ea(d[0],o)}e.length=r}function Ja(e,t,n){let r=(e.get(t)??0)-(e.get(n)??0);if(r)return r;let i=Sa(t),a=Sa(n);return i!=null&&a!=null&&i!==a?i-a:wa(t,n)}function Ya(e,t,n=``){let r=Xa(e);return`${r.join(`{`)}{${n}${t}${n}${`}`.repeat(r.length)}`}function Xa(e){let t=[],n=0,r=!1,i=0,a,o=0;for(let s=0;s<e.length;s++){let c=e[s];r?c===`*`&&e[s+1]===`/`&&(r=!1,s++):a?c===`\\`?s++:c===a&&(a=void 0):c===`/`&&e[s+1]===`*`?(r=!0,s++):c===`"`||c===`'`?a=c:c===`(`?i++:c===`)`?i>0&&i--:c===`[`?n++:c===`]`?n>0&&n--:n===0&&i===0&&e.startsWith(` $$ `,s)&&(X(t,e.slice(o,s)),s+=3,o=s+1)}return X(t,e.slice(o)),t}function Za(e){let t=[],n=!1,r;for(let i=0;i<e.length;i++){let a=e[i];if(n){a===`*`&&e[i+1]===`/`&&(n=!1,i++);continue}if(r){a===`\\`?i++:a===r&&(r=void 0);continue}if(a===`/`&&e[i+1]===`*`){n=!0,i++;continue}if(a===`\\`){i++;continue}if(a===`"`||a===`'`){r=a;continue}if(!/\s/.test(a)||e[i+1]!==`$`||e[i+2]!==`$`||!/\s/.test(e[i+3]??``))continue;let o=i+4;for(;o<e.length&&/\s/.test(e[o]);)o++;X(t,[i,o]),i=o-1}return t}function Qa(e,t){let n=Za(e);if(!n.length)return e;let r=0,i=``;for(let[a,o]of n)i+=e.slice(r,a),i+=a===0||e[a-1]===`{`||e[a-1]===`,`?t?`${t} `:``:t?` ${t} `:` `,r=o;return i+e.slice(r)}const $a=new Set([Function.prototype,Object.getPrototypeOf(async()=>{}),Object.getPrototypeOf(function*(){}),Object.getPrototypeOf(async function*(){})]),eo=new Set([`arguments`,`caller`,`length`,`name`,`prototype`]);function to(e){return Reflect.ownKeys(e).every(e=>eo.has(e))}function no(e){let t=e;for(;t!==null;){let e=Object.getOwnPropertyDescriptor(t,`exec`);if(e)return{configurable:!!e.configurable,enumerable:!!e.enumerable,get:`get`in e?e.get:void 0,owner:t,set:`set`in e?e.set:void 0,value:`value`in e?e.value:void 0,writable:`value`in e?!!e.writable:void 0};t=Object.getPrototypeOf(t)}}function ro(e,t){let n=no(e);return n?.owner===t?.owner&&n?.configurable===t?.configurable&&n?.enumerable===t?.enumerable&&n?.get===t?.get&&n?.set===t?.set&&n?.value===t?.value&&n?.writable===t?.writable}function io(e){return Reflect.ownKeys(e).every(e=>e===`lastIndex`)}function $(e,t=new WeakMap,n={}){if(e===null||typeof e!=`object`&&typeof e!=`function`)return{kind:`primitive`,value:e};if(n.functionsByIdentity&&typeof e==`function`)return{complete:to(e),kind:`identity`,value:e};if(n.ignoreRegExpLastIndex&&e instanceof RegExp){let t=no(e);return{complete:t?.owner===RegExp.prototype&&t.value===$i&&Object.getPrototypeOf(e)===RegExp.prototype&&io(e),exec:t,flags:J(e),kind:`regexp-identity`,source:q(e),value:e}}let r=t.get(e);if(r)return r;let i=Object.getPrototypeOf(e),a=i===RegExp.prototype?e:void 0,o={complete:i===null||i===Object.prototype||i===Array.prototype||$a.has(i)||i===RegExp.prototype,kind:`object`,properties:[],prototype:i,regexpFlags:a&&J(a),regexpSource:a&&q(a),value:e};t.set(e,o);for(let r of Reflect.ownKeys(e)){if(n.ignoreRegExpLastIndex&&a&&r===`lastIndex`)continue;let i=Object.getOwnPropertyDescriptor(e,r);if(!i)continue;let s={configurable:!!i.configurable,enumerable:!!i.enumerable,key:r};if(`value`in i){s.value=$(i.value,t,n),oo(s.value)||(o.complete=!1);try{let a=Reflect.get(e,r);s.observedValue=$(a,t,n),(!Object.is(a,i.value)||!oo(s.observedValue))&&(o.complete=!1)}catch{o.complete=!1}s.writable=!!i.writable}else o.complete=!1,s.get=i.get,s.set=i.set;X(o.properties,s)}return o}function ao(e,t,n=new Map){if(t.kind===`primitive`)return Object.is(e,t.value);if(t.kind===`identity`)return e===t.value&&(!t.complete||to(t.value));if(t.kind===`regexp-identity`)return e===t.value&&e instanceof RegExp&&ro(e,t.exec)&&q(e)===t.source&&J(e)===t.flags&&(!t.complete||io(e));if(e!==t.value||e===null||typeof e!=`object`&&typeof e!=`function`||Object.getPrototypeOf(e)!==t.prototype||t.regexpSource!==void 0&&(q(e)!==t.regexpSource||J(e)!==t.regexpFlags))return!1;let r=n.get(t);if(r)return r===e;n.set(t,e);let i=Reflect.ownKeys(e).filter(e=>!(t.regexpSource!==void 0&&e===`lastIndex`&&!t.properties.some(t=>t.key===e)));if(i.length!==t.properties.length)return!1;for(let r=0;r<i.length;r++){let a=t.properties[r],o=i[r];if(o!==a.key)return!1;let s=Object.getOwnPropertyDescriptor(e,o);if(!s||!!s.configurable!==a.configurable||!!s.enumerable!==a.enumerable)return!1;if(`value`in s){if(a.value===void 0||!!s.writable!==a.writable||!ao(s.value,a.value,n))return!1;if(a.observedValue!==void 0){let t;try{t=Reflect.get(e,o)}catch{return!1}if(!ao(t,a.observedValue,n))return!1}}else if(a.value!==void 0||s.get!==a.get||s.set!==a.set)return!1}return!0}function oo(e){return e.kind===`primitive`||e.complete}function so(e){let t=Array(e.length);for(let n=0;n<e.length;n++){if(!Object.hasOwn(e,n))continue;let r=e[n],i=Object.hasOwn(r,2),a=i?r[2]:void 0,o=$(r[0],void 0,{functionsByIdentity:!0,ignoreRegExpLastIndex:!0}),s={body:r[1],bodySnapshot:$(r[1],void 0,{functionsByIdentity:!0,ignoreRegExpLastIndex:!0}),matcherFlags:r[0]instanceof RegExp?J(r[0]):void 0,matcherSnapshot:o,matcherSource:r[0]instanceof RegExp?q(r[0]):void 0,matcher:r[0],meta:a,metaOwn:i,metaSnapshot:$(a,void 0,{functionsByIdentity:!0,ignoreRegExpLastIndex:!0}),rule:r};Object.defineProperty(t,n,{configurable:!0,enumerable:!0,value:s,writable:!0})}return t}function co(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++){let r=Object.hasOwn(e,n);if(r!==Object.hasOwn(t,n))return!1;if(!r)continue;let i=e[n],a=t[n],o=Object.hasOwn(i,2),s=o?i[2]:void 0;if(!Object.hasOwn(i,0)||!Object.hasOwn(i,1)||o!==a.metaOwn||i!==a.rule||i[0]!==a.matcher||i[1]!==a.body||s!==a.meta||!ao(i[0],a.matcherSnapshot)||i[0]instanceof RegExp&&(q(i[0])!==a.matcherSource||J(i[0])!==a.matcherFlags)||!ao(i[1],a.bodySnapshot)||!ao(s,a.metaSnapshot))return!1}return!0}function lo(e){for(let t=0;t<e.length;t++){if(!Object.hasOwn(e,t))continue;let{bodySnapshot:n,matcherSnapshot:r,metaSnapshot:i}=e[t];if(!oo(n)||!oo(r)||!oo(i))return!1}return!0}const uo=[`blocklist`,`details`,`envMode`,`extractors`,`layers`,`mergeSelectors`,`outputToCssLayers`,`postprocess`,`preflights`,`preprocess`,`safelist`,`separators`,`shortcuts`,`shortcutsLayer`,`sortLayers`,`theme`,`unmatched`,`variants`,`warn`];function fo(e,t,n={}){let r=$(e[t],void 0,n);return{complete:oo(r),isCurrent:e=>ao(e[t],r),key:t}}function po(e,t){let n=e;for(;n!==null&&n!==Object.prototype&&n!==Array.prototype&&n!==Function.prototype;){let e=Object.getOwnPropertyDescriptor(n,t);if(e)return{descriptor:e,owner:n};n=Object.getPrototypeOf(n)}}function mo(e,t){let n=po(e,t);if(!n)return{complete:!0,value:$(void 0)};let{descriptor:r,owner:i}=n;if(!(`value`in r))return{complete:!1,configurable:!!r.configurable,enumerable:!!r.enumerable,get:r.get,owner:i,set:r.set};let a=$(r.value,void 0,{functionsByIdentity:!0,ignoreRegExpLastIndex:!0});return{complete:oo(a),configurable:!!r.configurable,enumerable:!!r.enumerable,owner:i,value:a,writable:!!r.writable}}function ho(e,t,n){let r=po(e,t);if(!r)return n.owner===void 0&&n.value!==void 0&&ao(void 0,n.value);let{descriptor:i,owner:a}=r;return a!==n.owner||!!i.configurable!==n.configurable||!!i.enumerable!==n.enumerable?!1:`value`in i?n.value!==void 0&&!!i.writable===n.writable&&ao(i.value,n.value):n.value===void 0&&i.get===n.get&&i.set===n.set}function go(e,t,n){let r=e[t];if(!Array.isArray(r))return fo(e,t,{functionsByIdentity:!0,ignoreRegExpLastIndex:!0});let i=Array.from({length:r.length},(e,t)=>{let i=Object.hasOwn(r,t),a=i?r[t]:void 0;return{entry:a,own:i,values:i&&a!=null&&(typeof a==`object`||typeof a==`function`)?n.map(e=>mo(a,e)):n.map(()=>mo(Object.create(null),``))}}),a=new Set(n),o=i.every(({entry:e,own:t,values:n})=>{if(!t||e==null||typeof e!=`object`&&typeof e!=`function`)return!0;let r=Object.getPrototypeOf(e);return(r===Object.prototype||r===null)&&Reflect.ownKeys(e).every(e=>a.has(e))&&n.every(e=>e.complete)});return{complete:o,isCurrent(e){let s=e[t];if(s!==r||!Array.isArray(s)||s.length!==i.length)return!1;for(let e=0;e<i.length;e++){let t=i[e];if(Object.hasOwn(s,e)!==t.own)return!1;if(!t.own)continue;let r=s[e];if(r!==t.entry)return!1;if(r!=null&&(typeof r==`object`||typeof r==`function`)){if(o&&(Object.getPrototypeOf(r)!==Object.prototype&&Object.getPrototypeOf(r)!==null||!Reflect.ownKeys(r).every(e=>a.has(e))))return!1;for(let e=0;e<n.length;e++)if(!ho(r,n[e],t.values[e]))return!1}}return!0},key:t}}function _o(e,t,n){let r=e[t];if(r==null||typeof r!=`object`&&typeof r!=`function`)return{complete:!0,isCurrent:e=>Object.is(e[t],r),key:t};let i=n.map(e=>mo(r,e)),a=new Set(n),o=Object.getPrototypeOf(r),s=(o===Object.prototype||o===null)&&Reflect.ownKeys(r).every(e=>a.has(e))&&i.every(e=>e.complete);return{complete:s,isCurrent(e){let o=e[t];return o!==r||o==null||typeof o!=`object`&&typeof o!=`function`||s&&(Object.getPrototypeOf(o)!==Object.prototype&&Object.getPrototypeOf(o)!==null||!Reflect.ownKeys(o).every(e=>a.has(e)))?!1:n.every((e,t)=>ho(o,e,i[t]))},key:t}}function vo(e){return uo.map(t=>{switch(t){case`extractors`:return go(e,t,[`name`,`order`,`extract`]);case`preflights`:return go(e,t,[`getCSS`,`layer`]);case`variants`:return go(e,t,[`match`,`multiPass`,`order`]);case`outputToCssLayers`:return _o(e,t,[`allLayers`,`cssLayerName`]);case`shortcuts`:{let n=e.shortcuts,r=so(n);return{complete:lo(r),isCurrent:t=>t.shortcuts===e.shortcuts&&co(t.shortcuts,r),key:t}}case`sortLayers`:return fo(e,t,{functionsByIdentity:!0,ignoreRegExpLastIndex:!0});case`blocklist`:case`postprocess`:case`preprocess`:case`safelist`:return fo(e,t,{functionsByIdentity:!0,ignoreRegExpLastIndex:!0});default:return fo(e,t)}})}function yo(e,t){return t.every(t=>t.isCurrent(e))}function bo(e){return e.every(({complete:e})=>e)}function xo({authoredOutputOrders:e,config:t,currentSelectors:n,layerSet:r,matched:i,minify:a,parentOrders:o,preflights:s,preflightsMap:c,scope:l,sheet:f,shortcutMergeOrders:p,resolveUnmatched:m}){let h=a?``:`
|
|
20
|
-
`,g={...t.layers},_=t.mergeSelectors,v=t.sortLayers,y=e=>Object.hasOwn(g,e)?g[e]??0:0,b=e=>u(v.call(t,e.sort((e,t)=>y(e)-y(t)||wa(e,t)))).map(e=>e),x=b(Array.from(r)),S=Object.create(null),C=r.size===1?r.values().next().value:void 0,w,T,E=t.outputToCssLayers,D=typeof E==`object`?Pa(E,`cssLayerName`):void 0,O=typeof E==`object`&&Pa(E,`allLayers`)?b(Object.keys(g)):void 0,k=new Map,A=e=>{let t=k.get(e);if(t!==void 0||k.has(e))return t;let n=e;D&&typeof E==`object`&&(n=D.call(E,e));let r=n===null?null:n??e;return k.set(e,r),r};if(E)for(let e of d([...x,...O??[]]))A(e);let j=t=>{let r=(e,t)=>e.ruleIndex-t.ruleIndex||e.sort-t.sort||Ta(e.currentSelector,t.currentSelector)||Number(t.noScope)-Number(e.noScope)||Number(t.noMerge)-Number(e.noMerge)||Ta(e.selector,t.selector)||Ta(e.body,t.body)||0,i=(e,t)=>e.ruleIndex===t.ruleIndex&&e.sort===t.sort,a=[],o=new Map,s=t.flatMap(e=>p.get(e)?.components??[e]);for(let t of s){let s={authored:e.get(t),body:t[2],currentSelector:n.get(t)??t[5]?.currentSelector,item:t,noMerge:!!(t[6]??Q(t[4],`noMerge`)),noScope:!!Q(t[4],`noScope`),ruleIndex:t[0],selector:t[1],sort:Q(t[4],`sort`)||0},c=s.authored?.group;if(!c){X(a,{authoredGroup:void 0,records:[s],representative:s});continue}let l=o.get(c),u=l?.find(e=>i(e.records[0],s));if(u)X(u.records,s),r(s,u.representative)<0&&(u.representative=s);else{let e={authoredGroup:c,records:[s],representative:s};X(a,e),l?X(l,e):o.set(c,[e])}}for(let e of a)e.authoredGroup&&e.records.sort((e,t)=>e.authored.index-t.authored.index||r(e,t));a.sort((e,t)=>{let n=r(e.representative,t.representative);if(n)return n;let i=[...e.records].sort(r),a=[...t.records].sort(r),o=Math.min(i.length,a.length);for(let e=0;e<o;e++){let t=r(i[e],a[e]);if(t)return t}if(i.length!==a.length)return i.length-a.length;for(let n=0;n<e.records.length;n++){let i=r(e.records[n],t.records[n]);if(i)return i}return 0});let c=a.flatMap(e=>e.records.map(e=>e.item)),l=new Map;for(let e=0;e<c.length;e++){let t=c[e];l.set(t,e)}let u=new Set;for(let e of c){let t=p.get(e),n=t?.components;if(!t?.flatten||!t.original||!n?.length||u.has(t.group))continue;let r=l.get(n[0]);r!==void 0&&n.every((e,t)=>c[r+t]===e)&&u.add(t.group)}let d=new Set,f=[];for(let e of c){let t=p.get(e);if(!t||!u.has(t.group)){X(f,e);continue}d.has(t.group)||(d.add(t.group),X(f,t.original))}return f},M=()=>{if(T)return T;let e=new Map,t=Array.from(f).sort((e,t)=>Ja(o,e[0]||``,t[0]||``));for(let[n,r]of t)for(let t of r){let r=Q(t[4],`layer`)||`utilities`,i=e.get(r),a=i?.[i.length-1];a?.[0]===n?X(a[1],t):i?X(i,[n,[t]]):e.set(r,[[n,[t]]])}return f.clear(),T=e,e},N=e=>{if(C===void 0)return M().get(e)||[];if(e!==C)return[];if(w)return w;let t=Array.from(f).sort((e,t)=>Ja(o,e[0]||``,t[0]||``));return f.clear(),w=t,t},P=(e=me)=>{if(Object.hasOwn(S,e))return S[e];let t=N(e).map(([e,t])=>{let n=[];for(let[,e,r,,i,,a]of j(t)){if(e===``)continue;let t=Q(i,`noScope`)?void 0:l,o=e&&Oo(e,t);X(n,[o==null?[]:[[o,Q(i,`sort`)??0]],r,!!(a??Q(i,`noMerge`))||o!=null&&Ka.test(o)])}if(!n.length)return;_&&qa(n);let r=[];for(let e=n.length-1;e>=0;e--){let[t,i]=n[e],a=t.length===1?t[0][0]:``;if(t.length>1){t.sort((e,t)=>e[1]-t[1]||Ta(e[0],t[0]));let e=new Set,n=[];for(let[r]of t)!r||e.has(r)||(e.add(r),X(n,r));a=n.join(`,${h}`)}let o=a?`${a}{${i}}`:i;o&&X(r,o)}let i=Array.from(new Set(r)).reverse().join(h);return e?Ya(e,i,h):i}).filter(Boolean).join(h);s&&(t=[c[e],t].filter(Boolean).join(h));let n;E&&t&&(n=A(e),n!==null&&(t=`@layer ${n}{${h}${t}${h}}`));let r=a?``:`/* layer: ${e}${n&&n!==e?`, alias: ${n}`:``} */${h}`;return S[e]=t?r+t:``},F=(e=x,t)=>{let n=u(e).map(e=>e),r=new Set(u(t).map(e=>e)),i=n.filter(e=>!r.has(e)),a=i.map(P).filter(Boolean);if(E){let e=i;O&&(e=O);let t=d(e.map(A).filter(br));t.length>0&&Da(a,`@layer ${t.join(`, `)};`)}return a.join(h)},I=async(e,t)=>{let n=await t(P(e));return S[e]=n,n},ee;return{get css(){return F()},layers:[...x],matched:i,getLayers:F,getLayer:P,setLayer:I,get diagnostics(){return ee??={unmatched:m()},ee}}}var So=class e{userConfig;defaults;version=Xi;events=ur();config=void 0;cache=new A(D,void 0,!0);blocked=new j(D,void 0,!0);_warnedUnmatched=new j(D);parentOrders=new Map;activatedRules=new Set;_dynamicIndex;_contextConfigs=new WeakMap;_expansionPrefixes=new WeakMap;_generationContexts=new WeakSet;_configVersion=0;_collectionGeneration=0;_preparedConfigs=new WeakSet;_indexedRules;_indexedRuleSnapshot;_preparedCacheSnapshot;_preparedConfigMutable=!1;_preparedCacheReliable=!0;_startingGenerationParse=0;_runtimeRevision=0;_variantCacheOwner={};_initialization;_constructedCSSResults=new WeakMap;_constructedCSSSequence=0;_parsedOutputOrders=new WeakMap;_rawUtilMetadata=new WeakMap;_stringifiedCurrentSelectors=new WeakMap;_stringifiedOutputOrders=new WeakMap;_stringifiedParentOrders=new WeakMap;_shortcutMergeOrders=new WeakMap;_utilParentOrders=new WeakMap;reportConfigObserverErrors(e){console.error(`[@teacss/core] Configuration observer failed:`,AggregateError(e,`Configuration observers failed`))}dispatchConfig(e){let t=Object.hasOwn(this.events.events,`config`)?this.events.events.config:void 0,n=Array.isArray(t)?u(t).map(e=>e):[],r=[];for(let t of n)try{let n=t(e);xr(n)&&Promise.resolve(n).catch(e=>{this.reportConfigObserverErrors([e])})}catch(e){X(r,e)}r.length&&this.reportConfigObserverErrors(r)}clearRuntimeCaches(e){e&&this._runtimeRevision++,this._variantCacheOwner={},this.blocked.clear(),this._warnedUnmatched.clear(),this.parentOrders.clear(),this.activatedRules.clear(),this.cache.clear()}ensureRuleIndexesCurrent(e=!1){let t=!1,n=!1,r=!0;this._preparedConfigMutable&&e&&this._preparedCacheSnapshot&&(yo(this.config,this._preparedCacheSnapshot)||(n=!0,this._preparedCacheSnapshot=vo(this.config),t=!0),r=bo(this._preparedCacheSnapshot));let i=this._indexedRules===this.config.rules;if(!e&&i)return;let a=i&&!!this._indexedRuleSnapshot&&co(this.config.rules,this._indexedRuleSnapshot);(!i||!a)&&(n||=!!this._indexedRules,Si(this.config),this._indexedRules=this.config.rules,this._indexedRuleSnapshot=so(this.config.rules),this._dynamicIndex=void 0,t=!0),this._preparedConfigMutable&&(r=r&&!!this._indexedRuleSnapshot&&lo(this._indexedRuleSnapshot),this._preparedCacheReliable=r),t&&this.clearRuntimeCaches(n)}collectParentOrders(e,t){for(let n of u(e).filter(Va)){let e=n[3],r=this._stringifiedParentOrders.get(n);if(e!=null&&r!=null){let n=t.get(e);(n===void 0||r<n)&&t.set(e,r)}}}transferOutputOrder(e,t){let n=this._parsedOutputOrders.get(e);n&&this._stringifiedOutputOrders.set(t,n)}recordStringifiedContext(e,t){t?.currentSelector!==void 0&&this._stringifiedCurrentSelectors.set(e,t.currentSelector)}copyStringifiedUtil(e,t,n=!1){let r=e[4],i;if(r){let e=Object.getOwnPropertyDescriptors(r);if(n)for(let t of Reflect.ownKeys(e)){let n=Object.getOwnPropertyDescriptor(r,t);if(!n){delete e[t];continue}let i=`value`in n?n.value:Reflect.get(r,t);e[t]={configurable:!!n.configurable,enumerable:!!n.enumerable,value:i,writable:!0}}let t=e.prefix;t&&`value`in t&&Array.isArray(t.value)&&(t.value=[...u(t.value)]);let a=e.autocomplete;a&&`value`in a&&Array.isArray(a.value)&&(a.value=[...u(a.value)]),i=Object.defineProperties(Object.create(null),e)}let a=e[5],o=a?{...a,theme:Vr(a.theme),variantHandlers:[...u(a.variantHandlers)],variantMatch:[a.variantMatch[0],a.variantMatch[1],[...u(a.variantMatch[2])],new Set(a.variantMatch[3])]}:void 0;a&&o&&(Object.hasOwn(a,`rules`)?o.rules=a.rules?Vr(u(a.rules)):a.rules:delete o.rules,Object.hasOwn(a,`shortcuts`)?o.shortcuts=a.shortcuts?Vr(u(a.shortcuts)):a.shortcuts:delete o.shortcuts,Object.hasOwn(a,`variants`)?o.variants=a.variants?Vr(u(a.variants)):a.variants:delete o.variants);let s=[e[0],e[1],e[2],e[3],i,o,e[6]];if(t){let t=this._stringifiedCurrentSelectors.get(e);t!==void 0&&this._stringifiedCurrentSelectors.set(s,t);let n=this._stringifiedOutputOrders.get(e);n&&this._stringifiedOutputOrders.set(s,n);let r=this._stringifiedParentOrders.get(e);r!==void 0&&this._stringifiedParentOrders.set(s,r)}return s}copyStringifiedUtils(e,t,n=!1){let r=u(e).filter(Va),i=r.map(e=>this.copyStringifiedUtil(e,t,n));if(t){let e=new Map;for(let t=0;t<r.length;t++)e.set(r[t],i[t]);let t=new Map;for(let a=0;a<r.length;a++){let o=this._shortcutMergeOrders.get(r[a]);if(!o)continue;let s=t.get(o.group);if(!s){let r=t=>{let r=e.get(t);return r||(r=this.copyStringifiedUtil(t,!0,n),e.set(t,r)),r},i=o.components?.map(r),a=o.original?r(o.original):void 0;s={...o,components:i,group:{},original:a},t.set(o.group,s);for(let e of i??[])this._shortcutMergeOrders.set(e,s);a&&this._shortcutMergeOrders.set(a,s)}this._shortcutMergeOrders.set(i[a],s)}}return i}getDynamicIndex(e){return this._dynamicIndex?.config!==e&&(this._dynamicIndex={config:e,...ua(e.rulesDynamic)}),this._dynamicIndex}constructor(e={},t={}){this.userConfig=e,this.defaults=t}async ensureInitialized(){this.config||(this._initialization||=(async()=>{let e=await Ii(this.userConfig,this.defaults);this.config||(this.config=e,this._indexedRules=e.rules,this._indexedRuleSnapshot=so(e.rules),this.dispatchConfig(e))})(),await this._initialization)}static constructPublic(e,t){return new Co(e,t)}static async create(t={},n={}){let r=e.constructPublic(t,n);return await r.ensureInitialized(),r}async setConfig(e,t){if(await this.ensureInitialized(),!e)return;let n=await this.prepareConfig(e,t);this.commitConfig(n)}async prepareConfig(t,n){await this.ensureInitialized();let r=++this._configVersion,i=n??this.defaults,a=await Ii(t,i),o=e.constructPublic(t,i);o.config=a,o._indexedRules=a.rules,o._indexedRuleSnapshot=so(a.rules),o._preparedCacheSnapshot=vo(a),o._preparedConfigMutable=!0,o._preparedCacheReliable=bo(o._preparedCacheSnapshot)&&lo(o._indexedRuleSnapshot);let s=Object.freeze({config:a,defaults:i,generator:o,userConfig:t,version:r});return this._preparedConfigs.add(s),s}commitConfig(e){if(!this._preparedConfigs.delete(e)||e.version!==this._configVersion||e.generator.config!==e.config)return!1;let t=e.generator;return t.ensureRuleIndexesCurrent(!0),this.defaults=e.defaults,this.userConfig=e.userConfig,this.clearRuntimeCaches(!0),this.config=e.config,this._indexedRules=t._indexedRules,this._indexedRuleSnapshot=t._indexedRuleSnapshot,this._preparedCacheSnapshot=t._preparedCacheSnapshot,this._preparedConfigMutable=t._preparedConfigMutable,this._preparedCacheReliable=t._preparedCacheReliable,this._dynamicIndex=void 0,this.dispatchConfig(this.config),!0}async applyExtractors(e,t,n=new Set){return this.applyExtractorsCurrent(e,t,n,!1)}async applyExtractorsCurrent(e,t,n,r){await this.ensureInitialized(),this.ensureRuleIndexesCurrent(this._preparedConfigMutable);let i=this.config,a=this._runtimeRevision,o=ka(n),s=ka(o),c;try{c=await this.applyExtractorsForConfig(i,e,t,s)}catch(r){if(this._preparedConfigMutable&&this.ensureRuleIndexesCurrent(!0),this.config!==i||this._runtimeRevision!==a)return this.applyExtractorsCurrent(e,t,n,!0);throw r}return this._preparedConfigMutable&&this.ensureRuleIndexesCurrent(!0),this.config!==i||this._runtimeRevision!==a?this.applyExtractorsCurrent(e,t,n,!0):(Aa(n,o,c),n)}async applyExtractorsForConfig(e,t,n,r){let i={original:t,code:t,id:n,extracted:r,envMode:e.envMode};for(let t of u(e.extractors)){let e=await Z(t,`extract`)?.call(t,i);if(!(!e||e===r))if(W(e)&&W(r))for(let t of e)r.setCount(t,r.getCount(t)+e.getCount(t));else for(let t of Array.isArray(e)?u(e):e)r.add(t)}return r}requireInitialized(e){if(this.config)return this.config;throw Error(`[Teacss] TeacssGenerator is not initialized; use await createGenerator() before calling ${e}().`)}makeContextForConfig(e,t,n){let r={rawSelector:e,currentSelector:t[1],theme:n.theme,generator:this,symbols:Y,variantHandlers:t[2],constructCSS:(...e)=>this.constructCustomCSS(r,...e),variantMatch:t};return this._contextConfigs.set(r,n),r}makeContext(e,t){return this.makeContextForConfig(e,t,this.requireInitialized(`makeContext`))}getContextConfig(e){return e&&this._contextConfigs.get(e)||this.requireInitialized(`this synchronous entrypoint`)}async parseToken(e,t){let n=this._startingGenerationParse>0,r=await this.parseTokenInternal(e,t,n,!1);return r&&!n?this.copyStringifiedUtils(r,!0):r}async parseTokenInternal(e,t,n,r){await this.ensureInitialized(),this.ensureRuleIndexesCurrent(this._preparedConfigMutable&&!n);let i=this.config,a=this._runtimeRevision,o=!this._preparedConfigMutable||this._preparedCacheReliable,s=o&&!t,c=()=>this.config!==i||this._runtimeRevision!==a,l=()=>(this._preparedConfigMutable&&this.ensureRuleIndexesCurrent(!0),c()),d=()=>this.parseTokenInternal(e,t,n,!0);if(o&&this.blocked.has(e)){P(this.blocked,e);return}let f=e,p=s?this.cache.get(f):void 0;if(s&&(p!==void 0||this.cache.has(f))){N(this.cache,f,p);let e=p&&u(p);if(!e||e.length===0)return e;let t=e.filter(Va);if(t.length>0)return n||this.collectParentOrders(t,this.parentOrders),t;this.cache.delete(f)}let m=e,h=m;for(let t of u(i.preprocess)){let n;try{n=t(h)}catch(e){if(l())return d();throw e}if(c())return d();if(!n){s&&(P(this.blocked,e),N(this.cache,f,null));return}h=n}let g;try{g=this.isBlocked(h)}catch(e){if(l())return d();throw e}if(c())return d();if(g){s&&(P(this.blocked,e),N(this.cache,f,null));return}let _;try{_=await this.matchVariantsForConfig(m,h,i)}catch(e){if(l())return d();throw e}if(c())return d();let v;try{v=_.every(e=>!e||this.isBlocked(e[1]))}catch(e){if(l())return d();throw e}if(c())return d();if(v){s&&(P(this.blocked,e),N(this.cache,f,null));return}let y=async e=>{let r=this.makeContextForConfig(m,[t||e[0],e[1],e[2],e[3]],i);n&&this._generationContexts.add(r),i.details&&(r.variants=[...e[3]]);let a=await this.expandMatchedShortcut(r),o=a?await this.stringifyShortcuts(r.variantMatch,r,a[0],a[1],a[2]):(await this.parseUtil(r.variantMatch,r))?.flatMap(e=>this.stringifyUtil(e,r)).filter(br);return{direct:!a,utils:o}},b;try{b=_.length===1?[await y(_[0])]:await Promise.all(_.map(e=>y(e)))}catch(e){if(l())return d();throw e}if(c()||this._preparedConfigMutable&&!n&&(this.ensureRuleIndexesCurrent(!0),c()))return d();let x=[],S={},C=0;for(let{direct:e,utils:t}of b)for(let n of t??[])e&&this._stringifiedOutputOrders.set(n,{group:S,index:C++}),X(x,n);if(x?.length)return n||this.collectParentOrders(x,this.parentOrders),s&&N(this.cache,f,x),x;s&&N(this.cache,f,null)}parseTokenForGeneration(e){this._startingGenerationParse++;try{return this.parseToken(e)}finally{this._startingGenerationParse--}}getCachedEquivalentTokens(e){this.config&&this._preparedConfigMutable&&this.ensureRuleIndexesCurrent(!0);let t=this.cache.get(e);if(!t)return[e];let n=new Set([e]);for(let[r,i]of this.cache.entries())i&&!r.endsWith(` -`)&&Ba(i,r,t,e)&&n.add(r);return[...n]}generate(e,t={}){let n=p(e)?void 0:++this._collectionGeneration;return this.generateInternal(e,t,!1,n)}async generateInternal(e,t,n,r){await this.ensureInitialized(),this.ensureRuleIndexesCurrent(this._preparedConfigMutable);let i=this.config,a=this._runtimeRevision,o=!this._preparedConfigMutable||this._preparedCacheReliable,s=()=>this.config!==i||this._runtimeRevision!==a,c=()=>(this._preparedConfigMutable&&this.ensureRuleIndexesCurrent(!0),s()),l=new Map,d=!o||r===void 0||!(this.cache instanceof A)?void 0:this.cache,f=d?.revision,m=Fa(t,`id`),h=Fa(t,`scope`),g=Fa(t,`preflights`),_=Fa(t,`safelist`),v=Fa(t,`minify`),y=Fa(t,`extendedInfo`),b=Fa(t,`tokenConcurrency`),x=g===void 0||g,S=_===void 0||_,C=v!==void 0&&v,w=y!==void 0&&y,T=()=>this.generateInternal(e,t,!0,r);Ma(b);let E;try{E=p(e)?await this.applyExtractorsForConfig(i,e,m,w?new cr:new Set):Array.isArray(e)?Ga(new Set(u(e))):W(e)?Ga(Oa(e)):Ga(new Set(e))}catch(e){if(c())return T();throw e}if(s())return T();try{if(S){let e={generator:this,theme:i.theme};for(let t=0;t<i.safelist.length;t++){if(!Object.hasOwn(i.safelist,t))continue;let n=i.safelist[t],r=typeof n==`function`?n(e):n;for(let e of u(r)){let t=e.trim();t&&!E.has(t)&&E.add(t)}}}}catch(e){if(c())return T();throw e}if(s())return T();let D=C?``:`
|
|
21
|
-
`,O=new Set([me]),k=w?new Map:new Set,j=new Map,M=[],N=new Map,F=Object.create(null),I=Array.from(E),ee;try{ee=await La(I,b,e=>this.parseTokenForGeneration(e))}catch(e){if(c())return T();throw e}if(s())return T();let te=0,ne=d!==void 0,re=i.unmatched===`warn`||i.unmatched===`error`,ie=[];try{for(let e=0;e<I.length;e++){let t=I[e],n=ee[e];if(n==null){re&&ma(t)&&!this.blocked.has(t)&&!this.isBlocked(t)&&!Object.hasOwn(i.rulesStaticMap,pa(t))&&X(ie,t);continue}let r=this.copyStringifiedUtils(n,!0,!0);te++,ne&&!d.isRetained(t)&&(ne=!1),k instanceof Map?k.set(t,{data:this.copyStringifiedUtils(r,!1),count:W(E)?E.getCount(t):-1}):k.add(t),this.collectParentOrders(r,N);for(let e of r){X(M,e);let t=e[3]||``,n=Q(e[4],`layer`);j.has(t)||j.set(t,[]),X(j.get(t),e),n&&O.add(n)}}}catch(e){if(c())return T();throw e}if(s())return T();for(let[e,t]of N){l.set(e,t);let n=this.parentOrders.get(e);(n===void 0||t<n)&&this.parentOrders.set(e,t)}try{await(async()=>{let e=u(i.preflights);if(!x||!e.length)return;let t={generator:this,generated:this.copyStringifiedUtils(M,!1),theme:i.theme},n=new Set,r=new Map;for(let t of e){let e=Z(t,`layer`)||`preflights`;O.add(e),n.add(e);let i=r.get(e);i?X(i,t):r.set(e,[t])}F=Object.assign(Object.create(null),Object.fromEntries(await Promise.all(Array.from(n).map(async e=>[e,(await Promise.all(u(r.get(e)||[]).map(async e=>{let n=Z(e,`getCSS`);return n?await n.call(e,t):void 0}))).filter(Boolean).join(D)]))))})()}catch(e){if(c())return T();throw e}if(s())return T();let ae,L=()=>(ae??=ie.flatMap(e=>{let t=xa(e,i);return t===void 0?[]:[{token:e,suggestions:t}]}),ae);if(ie.length&&i.unmatched!==`off`&&i.unmatched!==void 0){let e=L(),t=({token:e,suggestions:t})=>t.length?`"${e}" (did you mean ${t.map(e=>`"${e}"`).join(`, `)}?)`:`"${e}"`;if(i.unmatched===`error`){if(e.length)throw Error(`[@teacss/core] ${e.length} token${e.length===1?``:`s`} matched no rule: ${e.map(t).join(`; `)}`)}else if(i.warn)for(let n of e)this._warnedUnmatched.has(n.token)||(P(this._warnedUnmatched,n.token),console.warn(`[Teacss]`,`unmatched token ${t(n)}`))}let oe;try{oe=xo({authoredOutputOrders:this._stringifiedOutputOrders,config:i,currentSelectors:this._stringifiedCurrentSelectors,layerSet:O,matched:k,minify:C,parentOrders:l,preflights:x,preflightsMap:F,scope:h,sheet:j,shortcutMergeOrders:this._shortcutMergeOrders,resolveUnmatched:L}),await Promise.resolve(),this._preparedConfigMutable&&this.ensureRuleIndexesCurrent(!0)}catch(e){if(c())return T();throw e}return s()?T():(d&&f!==void 0&&this.cache===d&&r===this._collectionGeneration&&(!ne||te!==d.retainedSize)&&d.replaceRetained(ja(I,ee),f),oe)}async matchVariants(e,t){return this.matchVariantsCurrent(e,t,!1)}async matchVariantsCurrent(e,t,n){await this.ensureInitialized(),this.ensureRuleIndexesCurrent(this._preparedConfigMutable);let r=this.config,i=this._runtimeRevision,a;try{a=await this.matchVariantsForConfig(e,t,r)}catch(n){if(this._preparedConfigMutable&&this.ensureRuleIndexesCurrent(!0),this.config!==r||this._runtimeRevision!==i)return this.matchVariantsCurrent(e,t,!0);throw n}return this._preparedConfigMutable&&this.ensureRuleIndexesCurrent(!0),this.config!==r||this._runtimeRevision!==i?this.matchVariantsCurrent(e,t,!0):a}async matchVariantsForConfig(e,t,n){let r={rawSelector:e,theme:n.theme,generator:this};ee(r,this._variantCacheOwner);let i=u(n.variants),a=async t=>{let n=!0,[,,o,s]=t;for(;n;){n=!1;let c=t[1];for(let e of i){let i=Z(e,`multiPass`)??!1;if(!i&&s.has(e))continue;let l=Z(e,`match`);if(!l)continue;let d=l.call(e,c,r),f=xr(d)?await d:d;if(f){if(p(f)){if(f===c)continue;f={matcher:f}}if(Array.isArray(f)){let n=u(f).map(e=>e);if(!n.length)continue;if(n.length===1)f=n[0];else{if(i)throw Error(`multiPass can not be used together with array return variants`);let r=n.map(n=>{let r=Z(n,`matcher`)??c,i=[n,...o],a=new Set(s);return a.add(e),[t[0],r,i,a]});return(await Promise.all(r.map(e=>a(e)))).flat()}}t[1]=Z(f,`matcher`)??c,Da(o,f),s.add(e),n=!0;break}}if(!n)break;if(o.length>500)throw Error(`Too many variants applied to "${e}"`)}return[t]};return await a([e,t||e,[],new Set])}applyVariants(e,t=e[4],n=e[1],r=Ao(n),i){let a=u(t).map(Ia),o=a.length>1?a.sort((e,t)=>(e.order||0)-(t.order||0)):a,s={prefix:``,selector:r,pseudo:``,entries:e[2]},c=o.length?o.reduceRight((e,t)=>n=>{let r=Z(n,`entries`)??[],i=Z(n,`parent`),a=Z(n,`parentOrder`),o=Z(n,`selector`)??``,s=t.body?.call(t.source,r)||r,c=Array.isArray(t.parent)?Object.hasOwn(t.parent,0)?t.parent[0]:void 0:t.parent,l=Array.isArray(t.parent)&&Object.hasOwn(t.parent,1)?t.parent[1]:void 0,u=c||i,d=t.selector?.call(t.source,o,s);return(t.handle??jo).call(t.source,{...n,entries:s,selector:d??o,parent:u,parentOrder:l??(u===i?a:void 0),layer:t.layer||Z(n,`layer`),sort:t.sort??Z(n,`sort`)},e)},e=>e)(s):s,l=Z(c,`parent`),d=Z(c,`parentOrder`),f=this.getContextConfig(i),p={selector:[Z(c,`prefix`)??``,Z(c,`selector`)??``,Z(c,`pseudo`)??``].join(``),entries:Z(c,`entries`)??[],parent:l,layer:Z(c,`layer`),sort:Z(c,`sort`),noMerge:Z(c,`noMerge`)};l!=null&&d!=null&&this._utilParentOrders.set(p,d);let m=u(f.postprocess);return m.length?m.reduce((e,t)=>{let n=[];for(let r of e){let e=this._utilParentOrders.get(r),i=r.parent;e!=null&&this._utilParentOrders.delete(r);let a=t(r);if(Array.isArray(a))for(let t of u(a).filter(br))e!=null&&t.parent===i&&this._utilParentOrders.set(t,e),X(n,t);else{let t=a||r;e!=null&&t.parent===i&&this._utilParentOrders.set(t,e),X(n,t)}}return n},[p]):[p]}constructCustomCSS(e,t,n){let r=Ar(t);return this.constructNormalizedCSS(e,r,n)}constructNormalizedCSS(e,t,n){if(p(t))return t;let r=[];for(let e=0;e<t.length;e++){if(!Object.hasOwn(t,e))continue;let n=t[e];if(!Object.hasOwn(n,0))continue;let i=n[0];typeof i==`string`?X(r,n):i===Y.body&&X(r,[Nr,Object.hasOwn(n,1)?n[1]:void 0])}let i=this.applyVariants([0,n||e.rawSelector,r,void 0,e.variantHandlers],void 0,void 0,void 0,e).map(e=>{let{selector:t,entries:n,parent:r,layer:i,sort:a,noMerge:o}=e;return{body:Fr(n),layer:i,noMerge:o,parent:r,parentOrder:this._utilParentOrders.get(e),selector:t,sort:a}}).filter(e=>!!e.body);if(!i.length)return``;let a=i.map(e=>{let t=`${e.selector}{${e.body}}`;return e.parent?Ya(e.parent,t):t}).join(``),o=e,s=this._constructedCSSResults.get(o);s||(s=new Map,this._constructedCSSResults.set(o,s));let c=a;return s.has(c)&&(c=`${a}\n${(++this._constructedCSSSequence).toString(2).replaceAll(`0`,` `).replaceAll(`1`,` `)}\n`),s.set(c,i),c}async parseUtil(e,t,n=!1,r){await this.ensureInitialized();let i=Object.hasOwn(t,`rules`),a=t.rules,o=a?.length,s=()=>{a&&o!==void 0?(a.length=o,t.rules=a):i?t.rules=a:delete t.rules};this.getContextConfig(t)===this.config&&this._preparedConfigMutable&&!this._generationContexts.has(t)&&this.ensureRuleIndexesCurrent(!0);let c=this.getContextConfig(t),l=c===this.config&&this._preparedConfigMutable&&!this._generationContexts.has(t),d=this._runtimeRevision,f=p(e)?await this.matchVariantsForConfig(e,void 0,c):[e],m=async([e,i,a])=>{c.details&&(t.rules=t.rules??[]);let o={...t,variantHandlers:a};this._contextConfigs.set(o,this.getContextConfig(t));let s;o.constructCSS=(...e)=>{if(!n||!t.variantHandlers.length)return this.constructCustomCSS(o,...e);let r=Ar(e[0]);if(!p(r)&&Ua(r))return this.constructNormalizedCSS(o,r,e[1]);s||(s={...o,variantHandlers:Wa(o.variantHandlers,t.variantHandlers)},this._contextConfigs.set(s,this.getContextConfig(t)));let i=this.constructNormalizedCSS(s,r,e[1]),a=this._constructedCSSResults.get(s)?.get(i);if(a){let e=this._constructedCSSResults.get(o);e||(e=new Map,this._constructedCSSResults.set(o,e)),e.set(i,a)}return i};let l=c.rulesStaticMap[i];if(r){l=void 0;let e=u(r);for(let t=c.rules.length-1;t>=0;t--){let n=c.rules[t];if(!Hr(n)||n[0]!==i)continue;let r=Q(n[2],`prefix`);if(!r||u(r).some(t=>e.includes(t))){l=n;break}}}let d=l,f=()=>{let t=d;if(d=void 0,!(!t?.[1]||!n&&Q(t[2],`internal`)))return this.resolveCSSResult(e,t[1],t,o)},m=i.indexOf(`:`),h=this.getDynamicIndex(c),g=m>0&&h.map.get(i.slice(0,m))||h.fallback;for(let t of g){let[a,s,c]=t;if((Q(d?.[2],`__index`)??-1)>(Q(c,`__index`)??-1)){let e=f();if(e)return e}if(Q(c,`internal`)&&!n)continue;let l=[i],p=Q(c,`prefix`);if(p){let e=u(p);if(r){let t=u(r);if(!e.some(e=>t.includes(e)))continue}else if(l=e.filter(e=>i.startsWith(e)).map(e=>i.slice(e.length)),!l.length)continue}for(let n of l){let r=za(n,a);if(!r)continue;let i=s(r,o),c=xr(i)?await i:i;if(!c)continue;if(typeof c!=`string`&&(typeof c==`object`||typeof c==`function`)){let e=Array.isArray(c)?void 0:Z(c,Symbol.asyncIterator),t=Array.isArray(c)?void 0:Z(c,Symbol.iterator);if(e){let t=[],n=e.call(c);for(;;){let e=await n.next();if(e.done)break;e.value&&X(t,e.value)}c=t}else if(t){let e=[],n=t.call(c);for(;;){let t=n.next();if(t.done)break;t.value!=null&&X(e,t.value)}c=e}}let l=this.resolveCSSResult(e,c,t,o);if(l)return l}}return f()},h=f.length===1?await m(f[0])??[]:(await Promise.all(f.map(e=>m(e)))).flat().filter(e=>!!e);if(l&&(this.ensureRuleIndexesCurrent(!0),this.config===c&&this._runtimeRevision!==d))return s(),this.parseUtil(e,t,n,r);if(h.length)return h}resolveCSSResult=(e,t,n,r)=>{let i=jr(t).filter(e=>e.length);if(i.length){let t=this.getContextConfig(r);t.details&&X(r.rules,n),t===this.config&&r.generator.activatedRules.add(n);let a=n[2],o={},s=0,c=e=>(this._parsedOutputOrders.set(e,{group:o,index:s++}),e);return i.flatMap(t=>{let n;if(p(t)){let e=this._constructedCSSResults.get(r)?.get(t);return e?e.map(e=>{let t=[Q(a,`__index`),e.body,a];return this._rawUtilMetadata.set(t,e),c(t)}):(n=[Q(a,`__index`),t,a],[c(n)])}let i=[],o=r.variantHandlers,s=a,l=e=>{o=[e,...o]},d=e=>{s={...s,...e}};for(let e=0;e<t.length;e++){if(!Object.hasOwn(t,e))continue;let n=t[e],r=Object.hasOwn(n,0)?n[0]:void 0,a=()=>Object.hasOwn(n,1)?n[1]:void 0;switch(r){case Y.variants:{let e=a();if(typeof e==`function`){let t=e(o);t&&(o=u(t).map(e=>e))}else o=[...u(e),...o];break}case Y.parent:l({parent:a()});break;case Y.selector:l({selector:a()});break;case Y.layer:l({layer:a()});break;case Y.sort:d({sort:a()});break;case Y.noMerge:d({noMerge:a()});break;case Y.noScope:d({noScope:a()});break;case Y.shortcutsNoMerge:X(i,n);break;case Y.body:X(i,[Nr,a()]);break;default:typeof r==`string`&&X(i,n)}}return n=[Q(a,`__index`),e,i,s,o],[c(n)]})}};stringifyUtil(e,t){if(!e)return;let n=this.getContextConfig(t);if(yr(e)){let r=this._rawUtilMetadata.get(e),i=e[2];if(r?.layer!==void 0||r?.sort!==void 0){let t={...e[2]??{}},n=Q(e[2],`layer`),a=Q(e[2],`sort`);delete t.layer,delete t.sort,i={...t,layer:r.layer??n,sort:r.sort??a}}let a=[e[0],r?.selector,r?.body??e[1],r?.parent,i,n.details?t:void 0,r?.noMerge];return this.transferOutputOrder(e,a),this.recordStringifiedContext(a,t),r?.parent!=null&&r.parentOrder!=null&&this._stringifiedParentOrders.set(a,r.parentOrder),[a]}let r=this.applyVariants(e,void 0,void 0,void 0,t),i=[];for(let a of r){let{selector:r,entries:o,parent:s,layer:c,sort:l,noMerge:u}=a,d=Fr(o);if(!d)continue;let f=e[3];if(c!==void 0||l!==void 0){let{layer:t,sort:n,...r}=e[3]??{};f={...r,layer:c??t,sort:l??n}}let p=[e[0],r,d,s,f,n.details?t:void 0,u];this.transferOutputOrder(e,p),this.recordStringifiedContext(p,t);let m=this._utilParentOrders.get(a);s!=null&&m!=null&&this._stringifiedParentOrders.set(p,m),X(i,p)}return i}async expandShortcut(e,t,n=5){return await this.ensureInitialized(),this.expandConfiguredExpansions(e,t,n,this.getContextConfig(t).shortcuts,`shortcut`)}async expandMatchedShortcut(e,t=5){return this.expandConfiguredExpansionsForInput(e.variantMatch,e,t,this.getContextConfig(e).shortcuts,`shortcut`)}async expandConfiguredExpansions(e,t,n,r,i,a,o){await this.ensureInitialized();let s=await this.expandConfiguredExpansionsForInput(e,t,n,r,i,a,o);if(!s)return;let c=[s[0],s[1]];return this._expansionPrefixes.set(c,s[2]),this._expansionPrefixes.set(c[0],s[2]),c}async expandConfiguredExpansionsForInput(e,t,n,r,i,a,o){let s=u(r);if(n<=0||!s.length)return;let c=this.getContextConfig(t),l=p(e)?e:e[1],d=c.details?e=>{t.shortcuts=t.shortcuts??[],X(t.shortcuts,e)}:Sr,f,m,h,g,_=o;expansionLoop:for(let e of s){if(!Array.isArray(e)||!Object.hasOwn(e,0)||!Object.hasOwn(e,1))continue;let n=Object.hasOwn(e,2)?e[2]:void 0,r=[{prefix:o,value:l}];if(n?.prefix){let e=u(n.prefix);if(r=e.filter(e=>l.startsWith(e)).map(e=>({prefix:e,value:l.slice(e.length)})),o&&e.includes(o)&&X(r,{prefix:o,value:l}),!r.length)continue}for(let i of r){if(p(e[0])){if(e[0]!==i.value)continue;m=e[1]}else{let n=za(i.value,e[0]);n&&(m=e[1](n,t))}if(m){_=i.prefix,f||=n,d(e);break expansionLoop}}}if(m){let e=p(m)?[m]:u(m);h=e.filter(e=>p(e)).flatMap(e=>Gr(mi(e.trim(),c.separators))).map(e=>({prefix:_,value:e})),g=e.filter(e=>!p(e)).map(e=>({handles:[],value:e}))}if(!m&&p(e)){let s=await this.matchVariantsForConfig(e,void 0,c);for(let e of s){let[s,c,l]=e;if(s!==c){let e=await this.expandConfiguredExpansions(c,t,n-1,r,i,a,o);if(e){let t=this._expansionPrefixes.get(e)??[];h??=[];for(let n=0;n<e[0].length;n++){let r=e[0][n];p(r)&&X(h,{prefix:t[n]??o,value:s.replace(c,()=>r)})}g??=[],Ea(g,e[0].filter(e=>!p(e)).map(e=>({handles:[...e.handles,...l],value:e.value})))}}}}if(!h?.length&&!g?.length)return;let v=new Map,y=(h??[]).filter(({prefix:e,value:t})=>{let n=v.get(e);return n||(n=new Set,v.set(e,n)),n.has(t)?!1:(n.add(t),!0)}),b=[...(await Promise.all(y.map(async({prefix:e,value:o})=>{let s=await this.expandConfiguredExpansions(o,t,n-1,r,i,a,e),c=s?void 0:await a?.(o,t,n-1),l=s??c;if(!l)return[{prefix:e,value:o}];let u=this._expansionPrefixes.get(l)??[];return l[0].map((t,n)=>({prefix:u[n]??e,value:t}))}))).flat(),...(g??[]).map(e=>({prefix:_,value:e}))].filter(({value:e})=>!!e);return[b.map(({value:e})=>e),f,b.map(({prefix:e})=>e)]}async stringifyShortcuts(e,t,n,r,i){await this.ensureInitialized();let a=this.getContextConfig(t);r={...r,layer:Q(r,`layer`)??a.shortcutsLayer};let o=i??this._expansionPrefixes.get(n)??[],s=new Tr,c=(await Promise.all(n.map(async(n,i)=>{let s=p(n)?await this.parseUtil(n,t,!0,o[i]??Q(r,`prefix`)):[[1/0,`{inline}`,Ar(n.value),void 0,n.handles]];return!s&&a.warn&&gi(`unmatched utility "${n}" in shortcut "${e[1]}"`),s||[]}))).flat(1).filter(Boolean).sort((e,t)=>e[0]-t[0]);a.details&&t.rules&&t.rules.length>1&&t.rules.sort((e,t)=>(Q(e[2],`__index`)??1/0)-(Q(t[2],`__index`)??1/0));let[l,,d]=e,f=c.some(yr),m={},h=0,g=[],_=e=>{let t=this._shortcutMergeOrders.get(e)?.components;if(!t?.length){this._stringifiedOutputOrders.set(e,{group:m,index:h++});return}let n;for(let e of t){let t={group:m,index:h++};n??=t,this._stringifiedOutputOrders.set(e,t)}n&&this._stringifiedOutputOrders.set(e,n)};for(let e of c){if(yr(e)){let n=this._rawUtilMetadata.get(e),i={...e[2],...r,layer:n?.layer??Q(r,`layer`),sort:n?.sort??Q(r,`sort`)??Q(e[2],`sort`)},o=[e[0],n?.selector,n?.body??e[1],n?.parent,i,a.details?t:void 0,n?.noMerge];this.recordStringifiedContext(o,t),n?.parent!=null&&n.parentOrder!=null&&this._stringifiedParentOrders.set(o,n.parentOrder),_(o),X(g,o);continue}let n=Ua(e[2]),i=n?e[4]:Wa(e[4],d);for(let o of this.applyVariants(e,i,l,void 0,t)){let{selector:i,entries:c,parent:l,sort:u,noMerge:d,layer:p}=o,m=!!(d??Q(r,`noMerge`)??Q(e[3],`noMerge`)),h=!!(Q(r,`noScope`)??Q(e[3],`noScope`)),v=Q(r,`sort`),y=Q(r,`layer`),b=n?v??0:u??v??Q(e[3],`sort`)??0;if(f){let n=Fr(c);if(!n)continue;let s=[e[0],i,n,l,{...r,noMerge:m,noScope:h,sort:b,layer:p??y},a.details?t:void 0,void 0];this.recordStringifiedContext(s,t);let u=this._utilParentOrders.get(o);l!=null&&u!=null&&this._stringifiedParentOrders.set(s,u),_(s),X(g,s);continue}let x=s.getFallback(p??y,{ordered:[],streams:new Map}),S=x.streams.get(l);S||(S=[],x.streams.set(l,S));let C=S[S.length-1];(!C||C.selector!==i||C.noScope!==h)&&(C={entries:[],noScope:h,parent:l,parentOrder:void 0,selector:i},X(S,C),X(x.ordered,C)),X(C.entries,[c,m,b,e[0]]);let w=this._utilParentOrders.get(o);w!=null&&(C.parentOrder==null||w<C.parentOrder)&&(C.parentOrder=w)}}let v=s.flatMap((e,n)=>e.ordered.map(({entries:e,noScope:i,parentOrder:o,selector:s,parent:c})=>{let l=(e,l,u)=>{if(!u.length)return[];let d=Math.max(...u.map(e=>e[1])),f=Math.max(...u.map(e=>e[2])),p=e&&u.length>1?u.map(([e,t,n])=>[e.map(e=>[e[0],e[1]]),t,n]):u,m=p.map(e=>e[0]);return(e?[m.flat(1)]:m).map((u,m)=>{let h=Fr(u);if(h){let u={...r,noMerge:l,noScope:i,sort:d,layer:n},g=[f,s,h,c,u,a.details?t:void 0,void 0];this.recordStringifiedContext(g,t),c!=null&&o!=null&&this._stringifiedParentOrders.set(g,o);let _=e?p:[p[m]],v={flatten:e,group:{}};return v.components=e&&_.length>1?_.map(([n,r,i])=>{let l=e?Fr(n):h;if(!l)return;let d=[i,s,l,c,{...u,sort:r},a.details?t:void 0,void 0];return this.recordStringifiedContext(d,t),c!=null&&o!=null&&this._stringifiedParentOrders.set(d,o),this._shortcutMergeOrders.set(d,v),d}).filter(br):void 0,v.original=g,this._shortcutMergeOrders.set(g,v),g}})},d=[],f=[],p=[],m=[];for(let[t,n,r,i]of e){let e=u(t).some(Ha);X(n?e?d:f:e?p:m,[t,r,i])}return[...l(!1,!0,d),...l(!0,!0,f),...l(!1,!1,p),...l(!0,!1,m)].filter(br)}).flat(1).filter(Boolean));for(let e of v)_(e);return g.concat(v)}isBlocked(e){if(!e)return!0;let{blocklist:t}=this.requireInitialized(`isBlocked`);for(let n=0;n<t.length;n++){if(!Object.hasOwn(t,n))continue;let r=t[n],i=Array.isArray(r)?Object.hasOwn(r,0)?r[0]:void 0:r;if(i!==void 0&&this.matchesBlocklist(i,e))return!0}return!1}getBlocked(e){let{blocklist:t}=this.requireInitialized(`getBlocked`);for(let n=0;n<t.length;n++){if(!Object.hasOwn(t,n))continue;let r=t[n],i=Array.isArray(r)?Object.hasOwn(r,0)?r[0]:void 0:r;if(!(i===void 0||!this.matchesBlocklist(i,e)))return[i,Array.isArray(r)&&Object.hasOwn(r,1)?r[1]:void 0]}}matchesBlocklist(e,t){return typeof e==`function`?!!e(t):p(e)?e===t:za(t,e)!==null}},Co=class extends So{constructor(e={},t={}){super(e,t)}};async function wo(e,t){return await So.create(e,t)}const To=/\s\$\$\s+/g;function Eo(e){return Za(e).length>0}function Do(e){let t=[],n=0,r=!1,i=0,a,o=0;for(let s=0;s<e.length;s++){let c=e[s];r?c===`*`&&e[s+1]===`/`&&(r=!1,s++):a?c===`\\`?s++:c===a&&(a=void 0):c===`/`&&e[s+1]===`*`?(r=!0,s++):c===`\\`?s++:c===`"`||c===`'`?a=c:c===`[`?n++:c===`]`?n>0&&n--:c===`(`?i++:c===`)`?i>0&&i--:c===`,`&&n===0&&i===0&&(X(t,e.slice(o,s).trim()),o=s+1)}return X(t,e.slice(o).trim()),t}function Oo(e,t){return Do(e).map(e=>{let n=e.startsWith(`$$`)&&/\s/.test(e[2]??``)?` ${e}`:e;return t?Eo(n)?Qa(n,t):`${t} ${e}`:Qa(n)}).join(`,`)}const ko=/^\[(.+?)(~?=)"(.*)"\]$/;function Ao(e){return ko.test(e)?e.replace(ko,(e,t,n,r)=>`[${gn(t)}${n}"${gn(r)}"]`):`.${gn(e)}`}function jo(e,t){return t(e)}const Mo=e.hash??((t,n,r)=>e.createHash(t).update(n).digest(r));function No(e,t=8){return Mo(`sha256`,e,`hex`).substring(0,t)}const Po=`@teacss-include`,Fo=`@teacss-ignore`,Io=`@teacss-ide-include`,Lo=`@teacss-placeholder`,Ro=`@teacss-skip-start`,zo=`@teacss-skip-end`,Bo=RegExp(`(//\\s*?${Ro}\\s*?|\\/\\*\\s*?${Ro}\\s*?\\*\\/|<!--\\s*?${Ro}\\s*?-->)[\\s\\S]*?(//\\s*?${zo}\\s*?|\\/\\*\\s*?${zo}\\s*?\\*\\/|<!--\\s*?${zo}\\s*?-->)`,`g`),Vo=[/^(?:virtual:)?tea(?::(.+))?\.css(\?.*)?$/],Ho=`__ALL__`;export{Tr as BetterMap,Lo as CSS_PLACEHOLDER,cr as CountableSet,he as DEFAULT_LAYERS,Fo as IGNORE_COMMENT,Po as INCLUDE_COMMENT,Io as INCLUDE_COMMENT_IDE,le as LAYER_IMPORTS,Ho as LAYER_MARK_ALL,fe as LAYER_PREFLIGHTS,ue as LAYER_PRIMITIVES,de as LAYER_PROPERTIES,pe as LAYER_SHORTCUTS,me as LAYER_UTILITIES,Ir as RESET_KEY,Bo as SKIP_COMMENT_RE,zo as SKIP_END_COMMENT,Ro as SKIP_START_COMMENT,Co as TeacssGenerator,wr as TwoKeyMap,Vo as VIRTUAL_ENTRY_ALIAS,Nr as VirtualKey,pr as attributifyRE,E as buildConditionSelector,Mr as clearIdenticalEntries,Vr as clone,pi as collapseVariantGroup,ce as createConditionVariant,wo as createGenerator,ur as createNanoEvents,mr as cssIdRE,On as defaultSplitRE,Ji as definePreset,gn as e,Fr as entriesToCss,mn as escapeRegExp,hn as escapeSelector,pn as expandClassGroups,cn as expandGroups,Kr as expandUnderscores,mi as expandVariantGroup,sr as extractorDefault,sr as extractorSplit,Yi as getEnvFlags,No as getHash,yn as getPath,Eo as hasScopePlaceholder,xn as hash,ti as isArbitrary,gr as isAttributifySelector,W as isCountableSet,bn as isCssId,G as isObject,yr as isRawUtil,Hr as isStaticRule,Ur as isStaticShortcut,p as isString,xr as isThenable,_r as isValidSelector,di as makeRegexClassGroup,Ui as mergeConfigs,Rr as mergeDeep,Sr as noop,ni as normalizeArbitraryValue,Ar as normalizeCSSEntries,jr as normalizeCSSValues,vr as normalizeVariant,br as notNull,se as parseClassToken,_ as parseCondition,v as parseConditions,fi as parseVariantGroup,To as regexScopePlaceholder,En as replaceAsync,T as resolveConditions,Ii as resolveConfig,Mi as resolvePreset,Ni as resolvePresets,ki as resolveShortcuts,Tn as restoreSkipCode,ei as spaceCalcOperators,Gr as splitClassTokens,kn as splitWithVariantGroupRE,Y as symbols,u as toArray,Ao as toEscapedSelector,wn as transformSkipCode,d as uniq,f as uniqueBy,hr as validateFilterRE,gi as warnOnce,Cr as withLayer};
|
|
1
|
+
import e from"node:crypto";const t=[`:before`,`:after`,`:first-line`,`:first-letter`];function n(e){if(!e)return!1;let t=e.codePointAt(0);return e===`-`||e===`_`||e===`\\`||t!==void 0&&(t>=48&&t<=57||t>=65&&t<=90||t>=97&&t<=122||t>=128)}function r(e,r){for(let i of t)if(e.slice(r,r+i.length).toLowerCase()===i&&!n(e[r+i.length]))return!0;return!1}function i(e,t){let n=0,i=0,a;for(let o=0;o<e.length;o++){let s=e[o];if(a)s===`\\`?o++:s===a&&(a=void 0);else if(s===`\\`)o++;else if(s===`/`&&e[o+1]===`*`){let t=e.indexOf(`*/`,o+2);if(t===-1)return;o=t+1}else if(s===`"`||s===`'`)a=s;else if(s===`[`)n++;else if(s===`]`)n>0&&n--;else if(s===`(`)i++;else if(s===`)`)i>0&&i--;else if(s===`:`&&n===0&&i===0){if(e[o+1]===`:`){if(t(o))return;o++}else if(r(e,o)&&t(o))return}}}function a(e){let t=-1;return i(e,e=>(t=e,!0)),t}function o(e){let t=0;return i(e,()=>(t++,!1)),t}function s(e,t){let n=t+(e[t+1]===`:`?2:1);for(;e[n]===`/`&&e[n+1]===`*`;){let t=e.indexOf(`*/`,n+2);if(t===-1)return;n=t+2}let r=n;for(;/[a-z0-9_-]/i.test(e[n]??``);)n++;return n===r?void 0:{end:n,name:e.slice(r,n).toLowerCase()}}function c(e,t,n){let r=0,i;for(let a=t;a<n;a++){let o=e[a];if(i){o===`\\`?a++:o===i&&(i=void 0);continue}if(o===`\\`)a++;else if(o===`/`&&e[a+1]===`*`){let t=e.indexOf(`*/`,a+2);if(t===-1||t>=n)return!1;a=t+1}else if(o===`"`||o===`'`)i=o;else if(o===`(`)r++;else if(o===`)`){if(r--,r===0)return e.slice(t+1,a).replaceAll(/\/\*[\s\S]*?\*\//g,``).trim().length>0&&e.slice(a+1,n).trim().length===0;if(r<0)return!1}}return!1}function l(e){let t=[],n=0,r=!1;if(i(e,i=>{n++;let a=s(e,i);return a?t.push({...a,index:i}):r=!0,n>2}),n<=1)return!0;if(r||n!==2||t.length!==2)return!1;let[a,o]=t,l=a.name,u=o.name;return l!==`part`&&l!==`slotted`||e[a.index+1]!==`:`||e[a.end]!==`(`||!c(e,a.end,o.index)?!1:u===`before`||u===`after`||u===`marker`||u===`placeholder`||u===`file-selector-button`||l===`part`&&(u===`first-line`||u===`first-letter`)}function u(e=void 0){if(e===void 0)return[];if(!Array.isArray(e))return[e];for(let t=0;t<e.length;t++){if(Object.hasOwn(e,t))continue;let n=[],r=0;for(let t=0;t<e.length;t++)Object.hasOwn(e,t)&&Object.defineProperty(n,r++,{configurable:!0,enumerable:!0,value:e[t],writable:!0});return n}return e}function d(e){return Array.from(new Set(u(e)))}function f(e,t){return u(e).reduce((e,n)=>(e.findIndex(e=>t(n,e))===-1&&Object.defineProperty(e,e.length,{configurable:!0,enumerable:!0,value:n,writable:!0}),e),[])}function p(e){return typeof e==`string`}const m=new Set([`>`,`+`,`~`]);function h(e){if(e===void 0)return!1;let t=e.charCodeAt(0);return t>=97&&t<=122||t>=65&&t<=90||t>=48&&t<=57||e===`-`||e===`_`||t>=128}function g(e){if(e===void 0)return!1;let t=e.charCodeAt(0);return t>=97&&t<=122||t>=65&&t<=90||e===`-`||e===`_`||t>=128}function _(e,t){let n=t;if(e[n]===`\\`)n+=2;else if(g(e[n]))n++;else return;for(;n<e.length;){if(e[n]===`\\`){n+=2;continue}if(!h(e[n]))break;n++}return n>t?n:void 0}function v(e,t,n,r){if(e[t]!==n)return;let i=0,a;for(let o=t;o<e.length;o++){let t=e[o];if(a){t===`\\`?o++:t===a&&(a=void 0);continue}if(t===`\\`)o++;else if(t===`"`||t===`'`)a=t;else if(t===n)i++;else if(t===r&&--i===0)return o+1}}function y(e,t){let n=t;for(;e[n]===`/`&&e[n+1]===`*`;){let t=e.indexOf(`*/`,n+2);if(t===-1)return n;n=t+2}return n}function b(e,t){let n=y(e,t),r=n;if(e[n]===`*`&&!(e[n+1]===`/`&&n>t))n++;else{let t=_(e,n);t!==void 0&&(n=t)}let i=+(n>r);for(;n<e.length;){let t=y(e,n);if(t!==n){n=t;continue}let r=e[n];if(r===`.`||r===`#`){let t=_(e,n+1);if(t===void 0)return;n=t}else if(r===`[`){let t=v(e,n,`[`,`]`);if(t===void 0)return;n=t}else if(r===`:`){let t=_(e,n+1);if(t===void 0)return;if(n=t,e[n]===`(`){let t=v(e,n,`(`,`)`);if(t===void 0)return;n=t}}else break;i++}return i>0?n:void 0}function x(e){if(!e)return!1;let t=0;for(;;){let n=b(e,t);if(n===void 0)return!1;if(t=y(e,n),t===e.length)return!0;if(!m.has(e[t])||(t=y(e,t+1),t===e.length))return!1}}function S(e,t){let n=e;for(;n!==null&&n!==Object.prototype&&n!==Array.prototype&&n!==Function.prototype;){if(Object.hasOwn(n,t))return Reflect.get(e,t);n=Object.getPrototypeOf(n)}}const C={">":` > `,_:` `,"+":` + `,"~":` ~ `};function w(e){let t=e[0];return t!==void 0&&Object.hasOwn(C,t)?C[t]:void 0}function T(e){let t=e.startsWith(`!`),n=t?e.slice(1):e,r;return r=n.startsWith(`::`)?`pseudo-element`:n[0]===`.`||n[0]===`#`?`self`:w(n)===void 0?n[0]===`[`?`arbitrary`:`named`:`target`,{raw:e,kind:r,negate:t,value:n}}function E(e){return u(e).map(T)}function D(e){let t=[],n;for(let r=0;r<e.length;r++){let i=e[r];if(n){if(i===`\\`){if(r+1>=e.length)return!1;r++}else i===n&&(n=void 0);continue}if(i===`\\`){if(r+1>=e.length)return!1;r++;continue}if(i===`/`&&e[r+1]===`*`){let t=e.indexOf(`*/`,r+2);if(t===-1)return!1;r=t+1;continue}if(i===`"`||i===`'`){n=i;continue}if(i===`[`){t.push(i);continue}if(i===`]`){if(t.pop()!==`[`)return!1;continue}if(i===`(`){t.push(i);continue}if(i===`)`){if(t.pop()!==`(`)return!1;continue}if(t.length===0&&(i===`,`||i===`;`||i===`{`||i===`}`||i===`>`||i===`+`||i===`~`||/\s/.test(i)))return!1}return n===void 0&&t.length===0}function O(e){if(e.kind!==`self`&&e.kind!==`pseudo-element`&&e.kind!==`target`)return!1;let t=e.kind===`target`?e.value.slice(1):e.value;return!t||e.kind===`self`&&t.length===1||e.kind===`pseudo-element`&&t.length===2||!D(t)||e.kind===`self`&&e.negate&&a(t)!==-1}function k(e){switch(e.kind){case`self`:{if(e.negate)return{suffix:`:not(${e.value})`};let t=a(e.value);return t===-1?{suffix:e.value}:{suffix:e.value.slice(0,t),pseudoElement:e.value.slice(t)}}case`pseudo-element`:return{pseudoElement:e.value};case`target`:{let t=w(e.value);if(t===void 0)return;let n=e.value.slice(1),r=a(n);return x(r===-1?n:n.slice(0,r))?r===-1?{combinator:`${t}${n}`}:{combinator:`${t}${n.slice(0,r)}`,pseudoElement:n.slice(r)}:void 0}default:return}}function A(e){let t={},n=S(e,`prefix`),r=S(e,`suffix`),i=S(e,`combinator`),a=S(e,`pseudoElement`),o=S(e,`parent`);return Object.defineProperties(t,{prefix:{configurable:!0,enumerable:n!==void 0,value:n,writable:!0},suffix:{configurable:!0,enumerable:r!==void 0,value:r,writable:!0},combinator:{configurable:!0,enumerable:i!==void 0,value:i,writable:!0},pseudoElement:{configurable:!0,enumerable:a!==void 0,value:a,writable:!0},parent:{configurable:!0,enumerable:o!==void 0,value:o,writable:!0}}),t}function j(e){let t=e.suffix;if(!t)return e;let n=a(t);return n===-1?e:{...e,suffix:t.slice(0,n)||void 0,pseudoElement:`${t.slice(n)}${e.pseudoElement??``}`}}function M(e){let t=e.pseudoElement;if(!t)return e;let n=o(t);if(n>1&&!l(t))throw Error(`[Teacss] a token may use at most one pseudo-element, found ${n}`);return e}function N(e,t=[],n){let r=u(e),i=u(t),a={conditions:r,theme:n},s=[],c=[];for(let e of r){if(O(e)||e.negate&&(e.kind===`pseudo-element`||e.kind===`target`)){c.push(e);continue}if(e.kind===`self`||e.kind===`pseudo-element`||e.kind===`target`){let t=e.kind===`target`?e.value.slice(1):e.value,n=o(t);if(n>1&&!l(t))throw Error(`[Teacss] a token may use at most one pseudo-element, found ${n}`)}let t=k(e);if(!t){for(let n of i)if(t=n(e,a),t||e.negate&&n({...e,raw:e.value,negate:!1},a))break}t?s.push(M(j(A(t)))):c.push(e)}let d=s.map(e=>e.pseudoElement??``).join(``),f=o(d);if(f>1&&!l(d))throw Error(`[Teacss] a token may use at most one pseudo-element, found ${f}`);return{resolved:s,unresolved:c}}function P(e,t){let n=u(t).map(A),r=n.map(e=>e.prefix).filter(Boolean),i=n.map(e=>e.suffix).filter(Boolean),a=n.map(e=>e.combinator).filter(Boolean),o=n.map(e=>e.pseudoElement).filter(Boolean),s=n.map(e=>e.parent).filter(Boolean);return{selector:`${r.join(``)}${e}${i.join(``)}${a.join(``)}${o.join(``)}`,parents:s}}const F=1e4;function ee(e,t){return e===t||Object.is(e,t)}var I=class{nodes=new Map;oldest;newest;get size(){return this.nodes.size}peek(){return this.oldest?{done:!1,value:this.oldest.key}:{done:!0,value:void 0}}add(e){if(this.nodes.has(e))return;let t=e===0?0:e,n={key:t,older:this.newest};this.nodes.set(t,n),this.newest?this.newest.newer=n:this.oldest=n,this.newest=n}clear(){this.nodes.clear(),this.oldest=void 0,this.newest=void 0}delete(e){let t=this.nodes.get(e);return t?(this.nodes.delete(e),this.unlink(t),!0):!1}shift(){let e=this.oldest;return e?(this.nodes.delete(e.key),this.unlink(e),{done:!1,value:e.key}):{done:!0,value:void 0}}reset(e){this.clear();for(let t of e)this.add(t)}touch(e){let t=this.nodes.get(e);!t||t===this.newest||(this.unlink(t),t.older=this.newest,this.newest?this.newest.newer=t:this.oldest=t,this.newest=t)}unlink(e){e.older?e.older.newer=e.newer:this.oldest=e.newer,e.newer?e.newer.older=e.older:this.newest=e.older,e.older=void 0,e.newer=void 0}},te=class extends Map{assumeNoPrototypeBypass;maxEntries;order=new I;retained=new Set;_revision=0;constructor(e=F,t,n=!1){if(super(),this.assumeNoPrototypeBypass=n,this.maxEntries=e,t)for(let[e,n]of t)this.set(e,n)}get revision(){return this._revision}get retainedSize(){return this.retained.size}isRetained(e){return this.retained.has(e)}clear(){super.clear(),this.order.clear(),this.retained.clear(),this._revision++}delete(e){this.reconcileOrder();let t=super.delete(e);return this.order.delete(e),this.retained.delete(e),this._revision++,t}set(e,t){this.reconcileOrder();let n=super.has(e);for(super.set(e,t),!n&&!this.retained.has(e)&&this.order.add(e),this._revision++;this.order.size>this.maxEntries&&this.deleteOldest(););return this}getOrInsert(e,t){this.reconcileOrder();let n=super.get(e);return n!==void 0||super.has(e)?(this.enforceInstanceLimit(),n):(this.set(e,t),t)}getOrInsertComputed(e,t){this.reconcileOrder();let n=super.get(e);if(n!==void 0||super.has(e))return this.enforceInstanceLimit(),n;let r=t(e);return this.set(e,r),r}setAndTouch(e,t,n=this.maxEntries){return this.reconcileOrder(),this.retained.has(e)?super.set(e,t):super.delete(e)?(super.set(e,t),this.order.touch(e)):(super.set(e,t),this.order.add(e)),this.order.size>n&&this.deleteOldest(),this}replaceRetained(e,t){if(this._revision!==t)return!1;let n=new Map(e);if(this._revision!==t)return!1;this.reconcileOrder();for(let e of this.retained)n.has(e)||(super.delete(e),this.retained.delete(e));for(let[e,t]of n)this.order.delete(e),super.set(e,t),this.retained.add(e);return this.enforceInstanceLimit(),!0}deleteOldest(){this.reconcileEvictionOrder();let e=this.order.shift();for(;!e.done;){if(super.delete(e.value))return!0;this.resetOrder(),e=this.order.shift()}let t=this.firstOrdinaryKey();return!t.done&&super.delete(t.value)}enforceInstanceLimit(){for(;this.order.size>this.maxEntries&&this.deleteOldest(););}reconcileOrder(){if(!this.assumeNoPrototypeBypass)for(let e of this.retained)super.has(e)||this.retained.delete(e);this.order.size!==this.size-this.retained.size&&this.resetOrder()}reconcileEvictionOrder(){if(this.assumeNoPrototypeBypass)return;let e=this.order.peek(),t=this.firstOrdinaryKey();(e.done!==t.done||!e.done&&!t.done&&!ee(e.value,t.value))&&this.resetOrder()}firstOrdinaryKey(){for(let e of super.keys())if(!this.retained.has(e))return{done:!1,value:e};return{done:!0,value:void 0}}resetOrder(){this.order.reset(Array.from(super.keys()).filter(e=>!this.retained.has(e)))}},ne=class extends Set{assumeNoPrototypeBypass;maxEntries;order=new I;constructor(e=F,t,n=!1){if(super(),this.assumeNoPrototypeBypass=n,this.maxEntries=e,t)for(let e of t)this.add(e)}add(e){this.reconcileOrder();let t=super.has(e);for(super.add(e),t||this.order.add(e);this.size>this.maxEntries&&this.size&&this.deleteOldest(););return this}addAndTouch(e,t=this.maxEntries){return this.reconcileOrder(),super.delete(e)?(super.add(e),this.order.touch(e)):(super.add(e),this.order.add(e)),this.size>t&&this.deleteOldest(),this}clear(){super.clear(),this.order.clear()}delete(e){this.reconcileOrder();let t=super.delete(e);return this.order.delete(e),t}deleteOldest(){this.reconcileEvictionOrder();let e=this.order.shift();for(;!e.done;){if(super.delete(e.value))return!0;this.order.reset(super.values()),e=this.order.shift()}let t=super.values().next();return!t.done&&super.delete(t.value)}reconcileOrder(){this.order.size!==this.size&&this.order.reset(super.values())}reconcileEvictionOrder(){if(this.assumeNoPrototypeBypass)return;let e=this.order.peek(),t=super.values().next();(e.done!==t.done||!e.done&&!t.done&&!ee(e.value,t.value))&&this.order.reset(super.values())}};function re(e){let t=e.keys().next();t.done||e.delete(t.value)}function L(e,t,n,r){if(e instanceof te){e.setAndTouch(t,n,r??e.maxEntries);return}e.delete(t),e.set(t,n),e.size>(r??1e4)&&re(e)}function ie(e,t,n){if(e instanceof ne){e.addAndTouch(t,n??e.maxEntries);return}e.delete(t),e.add(t),e.size>(n??1e4)&&re(e)}const R=new WeakMap,ae=new WeakMap;function oe(e,t){ae.set(e,t)}function se(e){return e&&ae.get(e)}function ce(e){return(t,n)=>{let r=[e.parent,t.parent].filter(Boolean).join(` $$ `)||t.parent;return n({...t,prefix:`${e.prefix}${t.prefix}`,selector:`${t.selector}${e.suffix}${e.combinator}`,pseudo:`${e.pseudoElement}${t.pseudo}`,parent:r,parentOrder:r===t.parent?t.parentOrder:void 0})}}function le(e,t){return R.set(e,t),e}function ue(e){return R.has(e)}function de(e,t){let n=R.get(e),r=R.get(t);if(!n||!r)return;let i=`${r.pseudoElement}${n.pseudoElement}`,a=o(i);if(a>1&&!l(i))throw Error(`[Teacss] a token may use at most one pseudo-element, found ${a}`);let s={prefix:`${n.prefix}${r.prefix}`,suffix:`${n.suffix}${r.suffix}`,combinator:`${n.combinator}${r.combinator}`,pseudoElement:i,parent:[n.parent,r.parent].filter(Boolean).join(` $$ `)||void 0};return le({handle:ce(s)},s)}function fe(e,t,n){Object.defineProperty(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0})}function pe(e,t){let n=e.length;n in e?fe(e,n,t):e[n]=t}function me(e){let t=``,n,r=-1,i=-1,a=-1,o=[];for(let s=0;s<e.length;s++){let c=e[s];if(n){c===`\\`?s++:c===n&&(n=void 0);continue}if(t.length>0&&c===`\\`){s++;continue}if(t.length>0&&(c===`"`||c===`'`)){n=c;continue}if(t.length>0&&c===`/`&&e[s+1]===`*`){let t=e.indexOf(`*/`,s+2);if(t<0)break;s=t+1;continue}c===`(`||c===`[`?t+=c===`(`?`)`:`]`:c===t.at(-1)?t=t.slice(0,-1):t.length===0&&(c===`@`?(i===-1&&(i=s),pe(o,s)):i===-1&&(c===`:`&&r===-1?r=s:c===`!`&&(a=s)))}let s=i===-1?e.length:i,c=e.slice(0,s),l=!1;s>0&&a===s-1&&(l=!0,c=c.slice(0,-1));let u=[];for(let t=0;t<o.length;t++){let n=o[t]+1,r=t+1<o.length?o[t+1]:e.length;pe(u,e.slice(n,r))}return r!==-1&&r<s?{raw:e,body:c,property:e.slice(0,r),value:c.slice(r+1),keyword:!1,important:l,conditions:u}:{raw:e,body:c,keyword:!0,important:l,conditions:u}}function he(e,t={}){let{name:n=`at-condition`}=t,r={},i=new WeakMap,a=e=>{let t=e??r,n=i.get(t);return n||(n=new te(F,void 0,!0),i.set(t,n)),n},o=(t,n,r)=>{let i=t.map(e=>`${e.length}:${e}`).join(``),o=a(r??n),s=o.get(i);if(s!==void 0)return L(o,i,s),s;let{resolved:c,unresolved:l}=N(E(t),e,n);if(l.length>0||c.length===0)return L(o,i,null),null;let u=e=>c.map(t=>t[e]).filter(Boolean).join(``),d={prefix:u(`prefix`),suffix:u(`suffix`),combinator:u(`combinator`),pseudoElement:u(`pseudoElement`),parent:c.map(e=>e.parent).filter(Boolean).join(` $$ `)||void 0},f={...d,handle:ce(d)};return L(o,i,f),f};return{name:n,match(e,t){if(!e.includes(`@`))return;let n=me(e);if(n.conditions.length===0)return;let r=o(n.conditions,t?.theme,se(t));if(r)return le({matcher:`${n.body}${n.important?`!`:``}`,handle:r.handle},r)},multiPass:!1}}const ge=`imports`,_e=`primitives`,ve=`properties`,ye=`preflights`,be=`shortcuts`,xe=`utilities`,Se=Object.freeze({[ge]:-200,[ve]:-150,[ye]:-100,[be]:-50,[_e]:-10,[xe]:0});function z(e,t){let n=e.length;n in e?Object.defineProperty(e,n,{configurable:!0,enumerable:!0,value:t,writable:!0}):e[n]=t}function Ce(e,t,n=!1,r=t+1){let i=e[t];if(i!==`[`&&i!==`(`)return;let a=i===`[`?`]`:`)`,o=!1,s;for(let i=t+1;i<e.length;i++){let t=e[i];if(t===`
|
|
2
|
+
`||t===`\r`||t===`\u2028`||t===`\u2029`)return;if(o){t===`*`&&e[i+1]===`/`&&(o=!1,i++);continue}if(s){t===`\\`?i++:t===s&&(s=void 0);continue}if(i>=r&&/\s/.test(t))return;if(t===`\\`)i++;else if(t===`/`&&e[i+1]===`*`)o=!0,i++;else if(t===`"`||t===`'`||n&&t==="`")s=t;else if(t===`[`||t===`(`)a+=t===`[`?`]`:`)`;else if(t===a.at(-1)&&(a=a.slice(0,-1),!a))return i+1}}function we(e,t){let n=0;for(;e[t-n-1]===`\\`;)n++;return n%2==1}const Te=/^(?:[\p{ID_Continue}$-]|\u200C|\u200D)+$/u,Ee=/^(?:\d(?:_?\d)*(?:\.\d(?:_?\d)*)?|\d(?:_?\d)*\.|\.\d(?:_?\d)*)(?:e[+-]?\d(?:_?\d)*)?$/i;function De(e,t){let n=t-1;for(;n>=0&&/\s/.test(e[n]);)n--;return n>=0&&`{,`.includes(e[n])}function Oe(e,t,n){let r=t+1;for(;/\s/.test(e[r]??``);)r++;if(e[r]!==`/`||e[r+1]===`/`||e[r+1]===`*`)return!1;let i=!1;for(r++;r<n;r++){let t=e[r];if(t===`
|
|
3
|
+
`||t===`\r`||t===`\u2028`||t===`\u2029`)return!1;if(t===`\\`)r++;else if(t===`[`)i=!0;else if(t===`]`&&i)i=!1;else if(t===`/`&&!i){for(r++;/[a-z]/i.test(e[r]??``);)r++;for(;/\s/.test(e[r]??``);)r++;return r===n}}return!1}function ke(e,t){let n=0,r;for(let i=t;i>=0;i--){let a=e[i];if(r)a===r&&!we(e,i)&&(r=void 0);else if(a===`"`||a===`'`||a==="`")r=a;else if(a===`]`)n++;else if(a===`[`&&(n--,De(e,i)&&(n===0||Oe(e,i,t))))return i}}function Ae(e,t){let n=e[t];if(n===`"`||n===`'`||n==="`"){for(let r=t-1;r>=0;r--)if(e[r]===n&&!we(e,r))return r;return}if(n===`]`)return ke(e,t);let r=t;for(;r>0&&!/\s/.test(e[r-1])&&!`({,[`.includes(e[r-1]);)r--;let i=e.slice(r,t+1);return Te.test(i)||Ee.test(i)?r:void 0}function je(e,t){let n=t-1;for(;n>=0&&/\s/.test(e[n]);)n--;if(n<0)return!1;if(`=({,[`.includes(e[n]))return!0;if(e[n]!==`:`)return!1;for(n--;n>=0&&/\s/.test(e[n]);)n--;let r=Ae(e,n);if(r===void 0)return!1;for(n=r-1;n>=0&&/\s/.test(e[n]);)n--;return n>=0&&`{,[?`.includes(e[n])}function Me(e,t){return je(e,t)}function Ne(e,t){let n=t+1;for(;/\s/.test(e[n]??``);)n++;return e[n]!==`"`&&e[n]!==`'`&&e[n]!=="`"?!1:Me(e,t)}function Pe(e,t,n){if(!Ne(e,t))return!1;let r=t+1,i=0;for(;r<n-1;){for(;/\s/.test(e[r]??``);)r++;let t=e[r];if(t!==`"`&&t!==`'`&&t!=="`")return!1;r++;let a=!1;for(;r<n-1;){let n=e[r];if(n===`\\`)r+=2;else if(n===t){r++,a=!0;break}else r++}if(!a)return!1;for(i++;/\s/.test(e[r]??``);)r++;if(r===n-1)break;if(e[r]!==`,`)return!1;for(r++;/\s/.test(e[r]??``);)r++;if(r===n-1)break}return i!==0}function Fe(e){let t=[],n=[],r=new Map,i=!1,a,o;for(let s=0;s<e.length;s++){let c=e[s];if(n.length===0){c===`\\`?(/\s/.test(e[s+1]??``)&&(a=void 0),s++):/\s/.test(c)?a=void 0:c===`"`||c===`'`?a=a===c?void 0:a??c:!a&&c===`[`&&z(n,s);continue}if((o||i)&&c===`[`&&/[:@\s]/.test(e[s-1])){z(n,s),r.set(s,o??i),i=!1,o=void 0;continue}if(i){c===`*`&&e[s+1]===`/`&&(i=!1,s++);continue}if(o){c===`\\`?s++:c===o&&(o=void 0);continue}if(c===`/`&&e[s+1]===`*`)i=!0,s++;else if(c===`"`||c===`'`)o=c;else if(c===`\\`)s++;else if(c===`[`)z(n,s);else if(c===`]`){let a=n.pop(),c=r.get(a);(/[:@]/.test(e[a-1])||e[s+1]===`:`)&&z(t,{end:s+1,start:a}),c===!0?i=!0:c&&(o=c)}}let s=[];for(let e of t.sort((e,t)=>e.start-t.start||t.end-e.end))(!s.length||e.start>=s.at(-1).end)&&z(s,e);return s}function B(e,t,n){let r=e[t];if(n.blockComment)return r===`*`&&e[t+1]===`/`?(n.blockComment=!1,t+1):t;if(n.quote)return r===`\\`?t+1:(r===n.quote&&(n.quote=void 0),t);if(n.closers.length>0&&r===`/`&&e[t+1]===`*`)return n.blockComment=!0,t+1;if(n.closers.length>0&&(r===`"`||r===`'`))return n.quote=r,t;if(n.closers.length>0&&r===`\\`)return t+1;if(r===`(`||r===`[`)return V(n.closers,r===`(`?`)`:`]`),t;if(r===n.closers.at(-1))return n.closers.pop(),t}function Ie(e,t,n=e.length){let r={closers:[]};for(let i=t+1;i<n;i++){let t=e[i],n=B(e,i,r);if(n!==void 0){i=n;continue}if(r.closers.length===0){if(t===`}`)return{index:i,kind:`close`};if(t===`{`)return{index:i,kind:`open`}}}return{index:n,kind:`limit`}}function Le(e,t,n=e.length){let r={closers:[]},i=Pt();for(let a=t+1;a<n;a++){let t=e[a],n=B(e,a,r);if(n!==void 0){a=n;continue}if(!(r.closers.length>0)){if(t===`}`)return{index:a,kind:`close`};if(t===`{`)return{index:a,kind:`open`};if(t===`'`||t===`"`||t==="`"||t===`/`&&(e[a+1]===`/`||e[a+1]===`*`||Ut(e,a,i.forceRegex,i.canEnd)))return{index:a,kind:`host`};/\s/.test(t)||(i.forceRegex=!1),i.canEnd=Ht(e,a,i.canEnd,i)}}return{index:n,kind:`limit`}}const Re=/[\s'"`;{},\])]/;function ze(e,t,n=e.length){if(e[t]!==`@`)return{conds:``,end:t};let r={closers:[]},i=t;for(;i<n;i++){let t=e[i],n=B(e,i,r);if(n!==void 0){i=n;continue}if(t===`/`&&(e[i+1]===`/`||e[i+1]===`*`)&&r.closers.length===0||Re.test(t)&&r.closers.length===0)break}return{conds:e.slice(t,i),end:i}}function Be(e){let t=[],n={closers:[]},r=0;for(let i=0;i<e.length;i++){let a=e[i],o=B(e,i,n);if(o!==void 0){i=o;continue}a===`;`&&n.closers.length===0&&(V(t,e.slice(r,i)),r=i+1)}return V(t,e.slice(r)),t.map(e=>e.trim()).filter(Boolean)}function Ve(e){let t={closers:[]},n=!1,r=!1;for(let i=0;i<e.length;i++){let a=e[i],o=B(e,i,t);if(o!==void 0){i=o;continue}if(!(t.closers.length>0)){if(a===`<`&&Gt(e,i))return!1;if(a===`;`)return!0;a===`:`?n=!0:a===`?`&&(r=!0)}}return n&&!r}function He(e,t){let n=Le(e,t);if(n.kind!==`close`)return;let r=e.slice(t+1,n.index);if(!Ve(r))return;let i=Be(r);if(i.length===0)return;let{conds:a,end:o}=ze(e,n.index+1);return{end:o,value:i.map(e=>`${e}${a}`).join(` `)}}function V(e,t){Object.defineProperty(e,e.length,{configurable:!0,enumerable:!0,value:t,writable:!0})}function H(e,t,n=!1){let r=t+1;if(r>=e.length)return e.length;if(e[r]===`\r`&&e[r+1]===`
|
|
4
|
+
`||n&&e[r]===`$`&&e[r+1]===`{`)return r+2;if(e[r]===`u`&&e[r+1]===`{`){let t=r+2;for(;/[0-9a-f]/i.test(e[t]??``);)t++;if(t>r+2&&e[t]===`}`)return t+1}return r+1}function Ue(e,t,n){let r=e[t];return n.lineComment?((r===`
|
|
5
|
+
`||r===`\r`||r===`\u2028`||r===`\u2029`)&&(n.lineComment=!1),t+1):n.blockComment?r===`*`&&e[t+1]===`/`?(n.blockComment=!1,t+2):t+1:n.quote?r===`\\`?H(e,t):(r===n.quote&&(n.quote=void 0),t+1):r===`\\`?H(e,t):r===`/`&&e[t+1]===`*`?(n.blockComment=!0,t+2):r===`/`&&e[t+1]===`/`&&n.parenDepth===0?(n.lineComment=!0,t+2):(r===`'`||r===`"`?n.quote=r:r===`(`?n.parenDepth++:r===`)`&&n.parenDepth>0?n.parenDepth--:r===`{`&&n.parenDepth===0?n.depth++:r===`}`&&n.parenDepth===0&&n.depth--,t+1)}function We(e,t,n){let r={blockComment:!1,depth:1,lineComment:!1,parenDepth:0};for(let i=t+1;i<n;){let t=i;if(i=Ue(e,i,r),r.depth===0)return t}return-1}const Ge=`=([{,:>)$?|&.!~+-*/%^<`,Ke=new Set(`as.assert.await.case.catch.class.const.default.delete.do.else.export.extends.finally.implements.import.in.instanceof.is.keyof.let.new.of.return.satisfies.static.throw.type.typeof.try.var.void.with.yield`.split(`.`)),qe=new Set([`await`,`case`,`delete`,`do`,`else`,`in`,`new`,`of`,`return`,`throw`,`typeof`,`void`,`yield`]),Je=new Set([`catch`,`for`,`if`,`switch`,`while`,`with`]),Ye=/^(?:a|abbr|address|animate|animateMotion|animateTransform|annotation|area|article|aside|audio|b|base|bdi|bdo|blockquote|body|br|button|canvas|caption|circle|cite|clipPath|code|col|colgroup|data|datalist|dd|defs|del|desc|details|dfn|dialog|discard|div|dl|dt|ellipse|em|embed|feBlend|feColorMatrix|feComponentTransfer|feComposite|feConvolveMatrix|feDiffuseLighting|feDisplacementMap|feDistantLight|feDropShadow|feFlood|feFuncA|feFuncB|feFuncG|feFuncR|feGaussianBlur|feImage|feMerge|feMergeNode|feMorphology|feOffset|fePointLight|feSpecularLighting|feSpotLight|feTile|feTurbulence|fieldset|figcaption|figure|filter|footer|foreignObject|form|g|h[1-6]|head|header|hgroup|hr|html|i|iframe|image|img|input|ins|kbd|label|legend|li|line|linearGradient|link|maction|maligngroup|malignmark|main|map|mark|marker|mask|math|menu|meta|metadata|meter|menclose|merror|mfenced|mfrac|mglyph|mi|mlabeledtr|mlongdiv|mmultiscripts|mn|mo|mover|mpadded|mpath|mphantom|mprescripts|mroot|mrow|ms|mscarries|mscarry|msgroup|msline|mspace|msqrt|msrow|mstack|mstyle|msub|msubsup|msup|mtable|mtd|mtext|mtr|munder|munderover|nav|noscript|object|ol|optgroup|option|output|p|path|pattern|picture|polygon|polyline|pre|progress|q|radialGradient|rect|rp|rt|ruby|s|samp|script|search|section|select|selectedcontent|semantics|set|slot|small|source|span|stop|strong|style|sub|summary|sup|svg|switch|symbol|table|tbody|td|template|text|textPath|textarea|tfoot|th|thead|time|title|tr|track|tspan|u|ul|use|var|video|view|wbr|[a-z][-\w]*-[\w-]+)$/i,Xe=/^(?:--|-?)[_a-z][-\w]*$/i,Ze=/^[+-]?(?:(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?)%$/i;function Qe(e){if(/^(?:from|to)$/i.test(e)||Ze.test(e))return!0;let t=e.search(/\s/u);if(t<1)return!1;let n=e.slice(t).trim();return Xe.test(e.slice(0,t))&&Ze.test(n)}function $e(e,t,n=0){let r=e.slice(n,t);return/(?:^|[;}\n\r])\s*(?:(?:export|default|declare|async)\s+)*function(?:\s*\*)?[\s\S]*$/.test(r)}function et(e,t,n=0){return/\bfunction(?:\s*\*)?[\s\S]*$/.test(e.slice(n,t))}function tt(e,t,n=0){let r=e.slice(n,t);return/(?:^|[;{}\n\r])\s*(?:(?:export|default|declare|abstract)\s+)*(?:class|interface|namespace|enum|module|global)\b[^{};]*$/.test(r)}function nt(e,t,n=0){return/(?:^|[^\w$])(?:abstract\s+)?class\b[^{};]*$/.test(e.slice(n,t))}function rt(e,t,n=0){return tt(e,t,n)||nt(e,t,n)||et(e,t,n)}function it(e,t){let n=-1,r=0,i=0,a=0,o;for(let s=0;s<e.length;s++){let c=e[s];if(o){c===`\\`?s++:c===o&&(o=void 0);continue}if(i>0){c===`\\`?s++:c===`'`||c===`"`?o=c:c===`{`?i++:c===`}`&&i--;continue}if((t&&c===`$`||c===`#`||c===`@`)&&e[s+1]===`{`){i=1,s++;continue}if(c===`\\`){s++;continue}if(c===`'`||c===`"`){o=c;continue}c===`[`?r++:c===`]`&&r>0?r--:c===`(`?a++:c===`)`&&a>0?a--:r===0&&a===0&&(c===`;`||c===`{`||c===`}`||c===`
|
|
6
|
+
`||c===`\r`||t&&c==="`")&&(n=s)}return n}function at(e){for(let t of e)if((t.codePointAt(0)??0)>127)return!0;return!1}function ot(e,t,n=!1,r=0){let i=e.slice(r,t),a=it(i,n),o=i.slice(a+1).trim();if(o.length===0)return!1;let s=o.split(/\s*(?:,|>|\+|~)\s*|\s+/).filter(Boolean),c=o.split(`,`).map(e=>e.trim());return/^@(?:-[a-z]+-)?[a-z][-\w]*\b/i.test(o)||/^%[-_a-z][-\w]*$/i.test(o)||/(?:^|[\s>+~,])(?:&|[-_a-z][-\w]*|\*)?(?:[.#](?=\S)|\[[^\]]*\])/i.test(o)||/(?:^|[\s>+~,])(?:\*|[-\w]+)\|(?:\*|[-\w]+)(?=$|[\s.#:[>+~,])/i.test(o)||/^(?:(?:[a-z][-\w]*)?|&):{1,2}[-\w(]/i.test(o)||/(?:^|[\s>+~,])\\[0-9a-f]{1,6}\s?/i.test(o)||at(o)||n&&o.includes("${")||o.includes(`#{`)||o.includes(`@{`)||c.every(Qe)||s.length>0&&s.every(e=>e===`*`||Ye.test(e))}function st(e,t){let n=t+1;for(;/\s/.test(e[n]??``);)n++;let r=e[n];if(r!==`'`&&r!==`"`)return!1;for(n++;n<e.length;n++){let t=e[n];if(t===`\\`)n++;else if(t===r){for(n++;/\s/.test(e[n]??``);)n++;return e[n]===`:`}}return!1}function ct(e,t){let n=t+1;for(;/\s/.test(e[n]??``);)n++;return e.startsWith(`...`,n)}function lt(e,t){let n=0;for(t--;t>=0&&e[t]===`\\`;t--)n++;return n%2==1}function ut(e,t,n=0){let r=t-1;for(;r>=0&&/\s/.test(e[r]);)r--;if(r<0)return!1;if(Ge.includes(e[r]))return!0;let i=r+1;for(;r>=0&&/[\w$]/.test(e[r]);)r--;let a=e.slice(r+1,i);return Ke.has(a)||rt(e,t,n)}const dt=new Set([`catch`,`class`,`do`,`else`,`finally`,`switch`,`try`]),ft=/^(?:(?:await\s+)?using|break|class|const|continue|debugger|declare|do|enum|export|for|function|if|import|interface|let|namespace|return|switch|throw|try|type|var|while|with)(?=$|[\s;(){}])/,pt=/^(?:await\s+)?[$_\p{ID_Start}][$\p{ID_Continue}]*(?:\s*(?:(?:\.|\?\.)\s*#?[$_\p{ID_Start}][$\p{ID_Continue}]*|(?:\?\.)?\[[^\]]+\]))*\s*(?:(?:\?\.)?\(|\+\+|--|[-+*/%&|^]?=(?!=|>))/u,mt=/^(?:await\s+)?[$_\p{ID_Start}][$\p{ID_Continue}]*\s*(?:(?:\.|\?\.)\s*#?[$_\p{ID_Start}][$\p{ID_Continue}]*)+\s*$/u,ht=/^(?:await\s+)?[$_\p{ID_Start}][$\p{ID_Continue}]*(?:\s*(?:\.|\?\.)\s*#?[$_\p{ID_Start}][$\p{ID_Continue}]*)*\s*(?:\?\.)?\[[^\]]+\]\s*$/u,gt=/^new\s+(?:class\b|function\b|[$_\p{ID_Start}])/u,_t=/^\([\s\S]*\)$/,vt=/^\([\s\S]*\)\s*(?:\(|\?\.|\.)/,yt=/^(?:(?:await|delete|typeof|void)\s+\S|yield(?:\s+\S|\s*\*\s*\S))/u,bt=/^(?:\+\+|--|!|~)\s*\S/u,xt=/^\[[\s\S]*\]\s*=(?!=|>)/,St=new Set([`as`,`in`,`instanceof`,`satisfies`]),Ct=/^(?:=(?!=|>)|\+=|-=|\*\*=|\*=|\/=|%=|&&=|&=|\|\|=|\|=|\^=|\?\?=|<<=|>>>=|>>=)/,wt=/^(?:(?:0[xX][\da-fA-F](?:_?[\da-fA-F])*|0[bB][01](?:_?[01])*|0[oO][0-7](?:_?[0-7])*)n?|(?:\d(?:_?\d)*)n|(?:\d(?:_?\d)*\.(?:\d(?:_?\d)*)?|\.\d(?:_?\d)*)(?:[eE][+-]?\d(?:_?\d)*)?|\d(?:_?\d)*(?:[eE][+-]?\d(?:_?\d)*)?)/;function Tt(e){let t={closers:[]},n=!1,r=!1;for(let i=0;i<e.length;i++){let a=e[i],o=t.closers.length===0,s=B(e,i,t);if(s!==void 0){o&&(a===`(`||a===`[`)&&(n=!0),i=s;continue}if(!(t.closers.length>0)){if(a===`:`||a===`@`)return!n||r?void 0:a===`:`?`declaration`:`condition`;if(a===`!`&&i===e.length-1)return!n||r?void 0:`important`;/\s/u.test(a)?r=!0:n=!0}}}function Et(e,t){if(yt.test(e))return!0;if(!bt.test(e))return!1;let n=Tt(e);return n===void 0||t&&n===`important`}function Dt(e,t){if(!xt.test(e))return!1;let n=Tt(e);return n===void 0||t&&n===`important`}function Ot(e,t){let n={closers:[]};for(let r=t;r<e.length;r++){let t=B(e,r,n);if(t!==void 0&&(r=t,n.closers.length===0))return r+1}}function kt(e){let t={closers:[]},n=-1;for(let r=0;r<e.length;r++){let i=B(e,r,t);if(i!==void 0){r=i;continue}if(!(t.closers.length>0)){if(/\s/u.test(e[r]))return-1;n===-1&&(e[r]===`:`||e[r]===`@`)&&r>0&&(n=r)}}return n}function At(e,t){let n=t=>{for(;t<e.length&&/\s/u.test(e[t]);)t++;return t},r=0;for(;e[r]===`+`||e[r]===`-`;)r=n(r+1);let i=tn(e,r);i?.value===`await`&&/\s/u.test(e[i.end]??``)&&(r=n(i.end),i=tn(e,r));let a;if(i!==void 0)a=`identifier`,r=i.end;else if(e[r]===`[`||e[r]===`(`){let t=Ot(e,r);if(t===void 0)return!1;a=e[r]===`[`?`array`:`parenthesized`,r=t}else{let t=wt.exec(e.slice(r));if(t===null)return!1;a=`number`,r+=t[0].length}let o=!1,s=!1;for(;r<e.length;){let t=r;if(r=n(r),e[r]===`!`&&e[r+1]!==`=`){s=!0,r++;continue}if(e[r]===`(`||e.startsWith(`?.(`,r))return!0;if(e.startsWith(`?.`,r))r=n(r+2);else if(e[r]===`.`)r=n(r+1);else if(e[r]!==`[`){r=t;break}if(e[r]===`[`){let t=Ot(e,r);if(t===void 0)return!1;o=!0,s=!1,r=t;continue}if(e[r]===`#`&&r++,i=tn(e,r),i===void 0)return!1;o=!0,s=!1,r=i.end}if(r=n(r),e[r]===`(`||e.startsWith(`?.(`,r))return!0;if(o&&e.slice(r).trim().length===0)return!s||Tt(e)!==`important`||t;if(a===`array`&&!o)return!1;if(e.startsWith(`++`,r)||e.startsWith(`--`,r))return e.slice(r+2).trim().length===0;let c=Ct.exec(e.slice(r));return c!==null&&e.slice(r+c[0].length).trim().length>0}function jt(e){let t=kt(e),n=(t,n)=>{let r=t-1;for(;r>=0&&/\s/.test(e[r]);)r--;let i=t+n;for(;i<e.length&&/\s/.test(e[i]);)i++;return r>=0&&e[r]!==`:`&&i<e.length},r=(t,r,i)=>{let a=e[r-1]??``,o=e[i]??``;return!/\s/u.test(a)&&!`)!]`.includes(a)||!/\s/u.test(o)&&!`([`.includes(o)&&!((t===`in`||t===`instanceof`)&&`!~+-`.includes(o))&&(t!==`as`&&t!==`satisfies`||o!==`-`)?!1:n(r,i-r)},i={closers:[]};for(let a=0;a<e.length;a++){let o=e[a],s=B(e,a,i);if(s!==void 0){a=s;continue}if(i.closers.length>0||t>=0&&a>t)continue;let c=e[a+1],l=tn(e,a);if(l!==void 0){if(St.has(l.value)&&r(l.value,a,l.end))return!0;a=l.end-1;continue}if((o===`?`||o===`<`||o===`>`)&&n(a,c===o||c===`=`||o===`?`&&c===`.`?2:1)||(o===`=`&&c===`=`||o===`!`&&c===`=`||o===`&`&&c===`&`||o===`|`&&c===`|`||o===`*`&&c===`*`)&&n(a,2)||`+-*/%&|^`.includes(o)&&(/\s/.test(e[a-1]??``)||/\s/.test(c??``))&&n(a,1)||o===`,`&&(/\s/.test(e[a-1]??``)||/\s/.test(c??``))&&n(a,1))return!0}return!1}function Mt(e,t){let n=Le(e,t);if(n.kind===`open`)return!0;if(n.kind!==`close`)return!1;let r=Be(e.slice(t+1,n.index));if(r.length===0)return!0;let i=r.length===1;return r.some(e=>ft.test(e)||pt.test(e)||mt.test(e)||ht.test(e)||At(e,i)||gt.test(e)||_t.test(e)||vt.test(e)||Et(e,i)||Dt(e,i)||jt(e))}function Nt(e,t,n=0,r=0,i=``){if(`:|&=,(`.includes(i))return!1;let a=t-1;for(;a>=0&&/\s/.test(e[a]);)a--;let o=e.slice(n,t);if(et(e,t,n))return r>0||`:|&=,(`.includes(e[a]??``)?!1:$e(e,t,n);if(/\bclass\b[^;]*$/.test(o))return tt(e,t,n);if(e[a]===`)`||e[a]===`>`)return e.slice(Math.max(n,a-1),a+1)!==`=>`;let s=a+1;for(;a>=0&&/[\w$]/.test(e[a]);)a--;let c=e.slice(a+1,s);return dt.has(c)?!0:rt(e,t,n)}function Pt(){return{angleDepth:0,canEnd:!1,classParenRoles:[],forceRegex:!1,labelCandidate:!1,labelColon:-1,lastSignificant:``,lastWord:``,parenKinds:[],pendingFunctions:[],restrictedLineStatement:!1,statementStart:!0,typeDeclaration:!1}}const Ft=new Set([`abstract`,`async`,`declare`,`default`,`export`]),It=new Set([`abstract`,`asserts`,`extends`,`in`,`infer`,`is`,`keyof`,`new`,`readonly`,`typeof`,`unique`]);function Lt(e,t){let n=e.pendingFunctions.at(-1);n?.phase===`return-type`&&(n.typeCanEnd=!It.has(t))}function U(e,t,n){let r=e.pendingFunctions.at(-1);r?.phase===`return-type`&&(`|&?:=,(`.includes(t)||t===`[`||t===`<`?r.typeCanEnd=!1:(n||t===`]`||t===`>`||t===`)`)&&(r.typeCanEnd=!0))}function Rt(e){let t=e.pendingFunctions.at(-1);if(t)return t.phase===`after-params`?(e.pendingFunctions.pop(),t.kind):t.phase===`return-type`?t.typeCanEnd?(e.pendingFunctions.pop(),t.kind):`T`:`O`}function zt(e,t){return!e.restrictedLineStatement&&!(e.typeDeclaration&&t===0&&e.canEnd)?!1:(e.canEnd=!1,e.forceRegex=!0,e.labelCandidate=!1,e.labelColon=-1,e.lastSignificant=``,e.lastWord=``,e.restrictedLineStatement=!1,e.statementStart=!0,e.typeDeclaration=!1,!0)}function Bt(e){e.labelCandidate=!1,e.labelColon=-1,e.lastSignificant=`;`,e.lastWord=``,e.pendingFunctions.length=0,e.restrictedLineStatement=!1,e.statementStart=!0,e.typeDeclaration=!1}function W(e,t){e.canEnd=!0,e.forceRegex=!1,e.labelCandidate=!1,e.labelColon=-1,e.lastSignificant=t,e.lastWord=``,e.statementStart=!1,U(e,t,!0)}function Vt(e,t,n){if(!n||/\s/.test(e[t-1]??``))return!1;let r=t+1;for(;/\s/.test(e[r]??``);)r++;return/[A-Z_$\p{ID_Start}]/u.test(e[r]??``)}function Ht(e,t,n,r){let i=e[t],a=r?.lastWord??``;if(/\s/.test(i??``))return n;if(/[\w$\p{ID_Continue}]/u.test(i??``)){if(/[\w$\p{ID_Continue}]/u.test(e[t+1]??``))return n;let i=t;for(;i>0&&/[\w$\p{ID_Continue}]/u.test(e[i-1]??``);)i--;let a=e.slice(i,t+1),o=i-1;for(;o>=0&&/\s/.test(e[o]??``);)o--;let s=e[o]===`.`||e[o]===`#`;if(r){let e=r.statementStart;r.labelCandidate=e,r.labelColon=-1,r.lastSignificant=`word`,r.lastWord=s?``:a,!s&&a===`function`?V(r.pendingFunctions,{kind:e?`B`:`O`,phase:`before-params`,typeCanEnd:!1}):s||Lt(r,a),!s&&e&&(a===`type`||a===`import`||a===`interface`||a===`declare`||a===`export`)&&(r.typeDeclaration=!0),!s&&e&&(a===`break`||a===`continue`||a===`debugger`)&&(r.restrictedLineStatement=!0),r.statementStart=!s&&e&&Ft.has(a)}return s||!(Ke.has(a)||Je.has(a))}if(r&&(i!==`:`&&(r.labelCandidate=!1),i!==`{`&&(r.labelColon=-1),r.lastWord=``,r.statementStart=!1),/\d/.test(i??``)||i===`.`&&n&&/\d/.test(e[t-1]??``))return r&&(r.lastSignificant=`number`,U(r,i,!0)),!0;if(i===`]`)return r&&(r.lastSignificant=i,U(r,i,!0)),!0;if(i===`[`)return r&&(r.lastSignificant=i,U(r,i,!1)),!1;if(i===`(`){if(r){let e=r.pendingFunctions.at(-1);V(r.classParenRoles,a===`cn`?`C`:n||e?.phase===`before-params`||Je.has(a)?`O`:`T`),e?.phase===`before-params`?(e.phase=`params`,V(r.parenKinds,`F`)):V(r.parenKinds,Je.has(a)?`1`:`0`),r.forceRegex=!1,r.lastSignificant=i,U(r,i,!1)}return!1}if(i===`)`){if(r){r.classParenRoles.pop();let e=r.parenKinds.pop();if(r.forceRegex=e===`1`,e===`F`){let e=r.pendingFunctions.at(-1);e?.phase===`params`&&(e.phase=`after-params`)}r.lastSignificant=i,U(r,i,!0)}return!0}if(i===`<`)return r&&(Vt(e,t,n)&&r.angleDepth++,r.lastSignificant=i,U(r,i,!1)),!1;if(i===`>`)return r?.angleDepth?(r.angleDepth--,r.lastSignificant=i,U(r,i,!0),!0):(r&&(r.lastSignificant=i,U(r,i,!1)),!1);if(i===`+`||i===`-`)return r&&(r.lastSignificant=i),e[t-1]===i||e[t+1]===i?(r&&U(r,i,n),n):(r&&U(r,i,!1),!1);if(i===`:`&&r){let e=r.pendingFunctions.at(-1);return e?.phase===`after-params`&&(e.phase=`return-type`,e.typeCanEnd=!1),r.labelCandidate&&(r.labelColon=t),r.lastSignificant=i,U(r,i,!1),!1}return i===`!`&&e[t+1]!==`=`?(r&&(r.lastSignificant=i,U(r,i,n)),n):i===`}`||i===`'`||i===`"`||i==="`"?(r&&(r.lastSignificant=i,U(r,i,!0)),!0):(r&&(r.lastSignificant=i,U(r,i,!1)),!1)}function Ut(e,t,n=!1,r){if(e[t+1]===`/`||e[t+1]===`*`)return!1;if(n)return!0;if(r!==void 0)return!r;let i=t-1;for(;i>=0&&/\s/.test(e[i]);)i--;if(i<0)return!0;if((e[i]===`+`||e[i]===`-`)&&e[i-1]===e[i]||e[i]===`!`&&i>0&&/[\w$)\]]/.test(e[i-1]??``)||e[i]===`>`&&i>0&&/[\w$)>]/.test(e[i-1]??``))return!1;if(`=([{,:;!?&|+-*%^~<>`.includes(e[i]))return!0;let a=i+1;for(;i>=0&&/[\w$]/.test(e[i]);)i--;return qe.has(e.slice(i+1,a))}function Wt(e,t){let n=!1;for(let r=t+1;r<e.length;r++){let t=e[r];if(t===`
|
|
7
|
+
`||t===`\r`||t===`\u2028`||t===`\u2029`)return{end:-1,failedUntil:r};if(t===`\\`)r++;else if(t===`[`)n=!0;else if(t===`]`)n=!1;else if(t===`/`&&!n){for(r++;/[a-z]/i.test(e[r]??``);)r++;return{end:r,failedUntil:r}}}return{end:-1,failedUntil:e.length}}function Gt(e,t){let n=e[t+1]===`/`,r=t+(n?2:1),i=r;if(e[r]!==`>`){let t=e.codePointAt(r);if(t===void 0)return;let a=String.fromCodePoint(t);if(!Qt.test(a))return;for(i+=a.length;i<e.length;){let t=e.codePointAt(i);if(t===void 0)break;let n=String.fromCodePoint(t);if(!$t.test(n)&&!`:.-`.includes(n))break;i+=n.length}let o=e[i];if(!/[\s/>]/.test(o??``)&&!(o===`<`&&!n))return}return{closing:n,name:e.slice(r,i),nameEnd:i}}function Kt(e,t,n){let r=n.get(t);if(r!==void 0)return r;let i=!1,a=!1,o=[],s;for(let r=t;r<e.length;r++){let c=e[r],l=e[r+1];if(a)(c===`
|
|
8
|
+
`||c===`\r`||c===`\u2028`||c===`\u2029`)&&(a=!1);else if(i)c===`*`&&l===`/`&&(i=!1,r++);else if(s)c===`\\`?r++:c===s&&(s=void 0);else if(c===`/`&&l===`/`)a=!0,r++;else if(c===`/`&&l===`*`)i=!0,r++;else if(c===`'`||c===`"`||c==="`")s=c;else if(c===`<`)V(o,r);else if(c===`>`&&e[r-1]!==`=`){let e=o.pop();if(e!==void 0&&(n.set(e,r),e===t))return r}}for(let e of o)n.set(e,-1);return-1}function qt(e,t,n){return!t.closing&&e[t.nameEnd]===`<`?Kt(e,t.nameEnd,n):-1}function Jt(e,t=0){return{blockComment:!1,braceDepth:+!!e,braceKinds:[],declarationBoundary:t,expression:Pt(),failedRegexUntil:-1,kind:`host`,lineComment:!1,terminating:e}}function Yt(e){let t=e.at(-1);t?.kind===`host`&&W(t.expression,`jsx`)}function Xt(e,t,n){for(let r=t+1;r<e.length;r++){let t=e[r];if(t===`\\`)r=H(e,r,n==="`")-1;else if(t===n)return r+1}return-1}const Zt=new Set(`break.case.catch.class.const.continue.debugger.default.delete.do.else.enum.export.extends.false.finally.for.function.if.import.in.instanceof.new.null.return.super.switch.this.throw.true.try.typeof.var.void.while.with`.split(`.`)),Qt=/^[$_\p{ID_Start}]$/u,$t=/^(?:[$\p{ID_Continue}]|\u200c|\u200d)$/u;function en(e,t){if(e[t]!==`\\`||e[t+1]!==`u`)return;if(e[t+2]===`{`){let n=0,r=t+3,i=0;for(;/^[0-9a-f]$/i.test(e[r]??``);){if(i=i*16+Number.parseInt(e[r],16),i>1114111)return;n++,r++}return n===0||e[r]!==`}`?void 0:{character:String.fromCodePoint(i),end:r+1}}let n=e.slice(t+2,t+6);if(/^[0-9a-f]{4}$/i.test(n))return{character:String.fromCodePoint(Number.parseInt(n,16)),end:t+6}}function tn(e,t){let n=[],r=!1,i=t,a=!0;for(;i<e.length;){let t=en(e,i),o=t?.character??String.fromCodePoint(e.codePointAt(i));if(!(a?Qt.test(o):$t.test(o)))break;V(n,o),r||=t!==void 0,i=t?.end??i+o.length,a=!1}return a?void 0:{end:i,escaped:r,value:n.join(``)}}function nn(e,t,n){let r=[],i=!1,a=!1,o=!1,s=!0,c=!1,l=`start`,u=!1,d;for(let f=t+1;f<n;f++){let t=e[f],n=e[f+1];if(o){(t===`
|
|
9
|
+
`||t===`\r`||t===`\u2028`||t===`\u2029`)&&(o=!1);continue}if(i){t===`*`&&n===`/`&&(i=!1,f++);continue}if(d){t===`\\`?f++:t===d&&(d=void 0);continue}if(t===`/`&&n===`/`){o=!0,f++;continue}if(t===`/`&&n===`*`){i=!0,f++;continue}if(t===`'`||t===`"`||t==="`"){if(r.length===0&&l!==`constraint`&&l!=="default")return!1;d=t,u=!0;continue}if(t===`(`||t===`[`||t===`{`||t===`<`){if(r.length===0&&l!==`constraint`&&l!=="default")return!1;V(r,t===`(`?`)`:t===`[`?`]`:t===`{`?`}`:`>`),u=!0;continue}if(t===r.at(-1)){r.pop();continue}if(r.length>0||/\s/.test(t))continue;if(t===`,`)return!(l===`start`||l===`after-const`||(l===`constraint`||l==="default")&&!u);if(t===`=`){if(n===`>`){if(l!==`constraint`&&l!=="default")return!1;u=!0,f++;continue}if(l===`constraint`&&!u||l!==`after-name`&&l!==`constraint`)return!1;a=!0,l=`default`,u=!1;continue}let p=tn(e,f);if(p){let e=p.value;if(l===`start`)!p.escaped&&e===`const`?l=`after-const`:(c=!0,s=!Zt.has(e),l=`after-name`);else if(l===`after-const`)c=!0,s=!Zt.has(e),l=`after-name`;else if(l===`after-name`){if(p.escaped||e!==`extends`)return!1;a=!0,l=`constraint`,u=!1}else u=!0;f=p.end-1}else{if(t===`/`||l!==`constraint`&&l!=="default")return!1;u=!0}}return!c||!s||!a||l===`after-const`||(l===`constraint`||l==="default")&&!u?!1:l===`after-name`||l===`constraint`||l==="default"}function rn(e,t){let n=t;for(;n<e.length;)if(/\s/.test(e[n]))n++;else if(e[n]===`/`&&e[n+1]===`/`)for(n+=2;n<e.length&&e[n]!==`
|
|
10
|
+
`&&e[n]!==`\r`&&e[n]!==`\u2028`&&e[n]!==`\u2029`;)n++;else if(e[n]===`/`&&e[n+1]===`*`){let t=e.indexOf(`*/`,n+2);if(t===-1)return e.length;n=t+2}else break;return n}function an(e,t,n){let r=Kt(e,t,n);return r===-1||!nn(e,t,r)?-1:e[rn(e,r+1)]===`(`?r:-1}function on(e,t,n){let r=new Set,i=[Jt(!1)],a=0;for(;a<e.length;){let o=i.at(-1),s=e[a],c=e[a+1];if(o.kind===`template`){s===`\\`?a=H(e,a,!0):s==="`"?(i.pop(),Yt(i),a++):s===`$`&&c===`{`?(V(i,Jt(!0)),a+=2):a++;continue}if(o.kind===`element`){if(n===`auto`&&(s===`'`||s===`"`||s==="`")&&a>=o.failedQuoteUntil[s]){let t=Xt(e,a,s);if(t!==-1){a=t;continue}o.failedQuoteUntil[s]=e.length}if(n===`auto`&&s===`/`&&c===`*`&&a>=o.failedBlockCommentUntil){let t=e.indexOf(`*/`,a+2);if(t!==-1){a=t+2;continue}o.failedBlockCommentUntil=e.length}if(s===`{`){V(i,Jt(!0,a+1)),a++;continue}if(s!==`<`){a++;continue}let r=Gt(e,a);if(!r){a++;continue}V(i,{blockComment:!1,closing:r.closing,kind:`tag`,name:r.name,opening:a,typeEnd:qt(e,r,t)}),a=r.nameEnd;continue}if(o.kind===`tag`){if(o.blockComment){s===`*`&&c===`/`?(o.blockComment=!1,a+=2):a++;continue}if(o.quote){s===`\\`?a=H(e,a):(s===o.quote&&(o.quote=void 0),a++);continue}if(s===`/`&&c===`*`){o.blockComment=!0,a+=2;continue}if(s===`'`||s===`"`){o.quote=s,a++;continue}if(a<=o.typeEnd){a++;continue}if(s===`<`){i.pop();continue}if(s===`{`){V(i,Jt(!0,a+1)),a++;continue}if(s!==`>`){a++;continue}let t=a-1;for(;/\s/.test(e[t]??``);)t--;let n=!o.closing&&e[t]===`/`;if(i.pop(),o.closing){let e=i.at(-1);e?.kind===`element`&&e.name===o.name&&(i.pop(),r.add(e.opening),Yt(i))}else n?(r.add(o.opening),Yt(i)):V(i,{failedBlockCommentUntil:-1,failedQuoteUntil:{'"':-1,"'":-1,"`":-1},kind:`element`,name:o.name,opening:o.opening});a++;continue}if(o.lineComment){(s===`
|
|
11
|
+
`||s===`\r`||s===`\u2028`||s===`\u2029`)&&(o.lineComment=!1,zt(o.expression,o.braceDepth)),a++;continue}if(o.blockComment){s===`*`&&c===`/`?(o.blockComment=!1,a+=2):a++;continue}if(o.quote){s===`\\`?a=H(e,a):(s===o.quote&&(o.quote=void 0,W(o.expression,`string`)),a++);continue}if(s===`/`&&c===`/`){o.lineComment=!0,a+=2;continue}if(s===`/`&&c===`*`){o.blockComment=!0,a+=2;continue}if(s===`'`||s===`"`){o.quote=s,a++;continue}if(s==="`"){V(i,{kind:`template`}),a++;continue}if(s===`\\`){let t=en(e,a);if(t){a=t.end,W(o.expression,`word`);continue}}if(s===`/`&&a>=o.failedRegexUntil&&Ut(e,a,o.expression.forceRegex,o.expression.canEnd)){let t=Wt(e,a);if(t.end!==-1){a=t.end,W(o.expression,`regex`);continue}o.failedRegexUntil=t.failedUntil}if(s===`<`&&!o.expression.canEnd){let r=Gt(e,a);if(r&&!r.closing){let o=n===`tsx`?an(e,a,t):-1;if(o!==-1){a=o+1;continue}V(i,{blockComment:!1,closing:!1,kind:`tag`,name:r.name,opening:a,typeEnd:qt(e,r,t)}),a=r.nameEnd;continue}}if(s===`{`){let t=Rt(o.expression),n=o.expression.labelColon>=0,r=o.expression.statementStart&&(o.braceKinds.at(-1)===`B`||o.declarationBoundary>0||o.braceKinds.length===0&&Mt(e,a)),i=o.expression.forceRegex||n||r?`B`:t??(Nt(e,a,o.declarationBoundary,o.expression.parenKinds.length,o.expression.lastSignificant)?`B`:`O`);V(o.braceKinds,i),o.braceDepth++,o.expression.canEnd=!1,o.expression.forceRegex=!1,o.expression.labelCandidate=!1,o.expression.labelColon=-1,o.expression.lastSignificant=`{`,o.expression.lastWord=``,o.expression.statementStart=i===`B`,a++;continue}if(s===`}`&&o.braceDepth>0){if(o.braceDepth--,o.terminating&&o.braceDepth===0)i.pop();else{let e=o.braceKinds.pop();o.expression.canEnd=e!==`B`,o.expression.forceRegex=e===`B`,o.expression.labelCandidate=!1,o.expression.labelColon=-1,o.expression.lastSignificant=`}`,o.expression.lastWord=``,o.expression.statementStart=e===`B`,e===`B`&&(o.declarationBoundary=a+1)}a++;continue}if((s===`
|
|
12
|
+
`||s===`\r`||s===`\u2028`||s===`\u2029`)&&zt(o.expression,o.braceDepth)){a++;continue}/\s/.test(s)||(o.expression.forceRegex=!1),o.expression.canEnd=Ht(e,a,o.expression.canEnd,o.expression),s===`;`&&(Bt(o.expression),o.braceKinds.length===0&&(o.declarationBoundary=a+1)),a++}return r}function sn(e,t,n){return!t&&n.has(e)}function cn(e,t){for(;t>=0&&/\s/.test(e[t]??``);)t--;if(e[t]!==`=`)return!1;for(t--;t>=0&&/\s/.test(e[t]??``);)t--;let n=t+1;for(;t>=0&&/[\w$-]/.test(e[t]??``);)t--;let r=e.slice(t+1,n);return r===`class`||r===`className`}function ln(e,t){return cn(e,t-1)}function un(e,t){let n=t-1;for(;n>=0&&/\s/.test(e[n]??``);)n--;return e[n]===`{`?cn(e,n-1):cn(e,n)}function dn(e){for(let t=e.classParenRoles.length-1;t>=0;t--){let n=e.classParenRoles[t];if(n!==`T`)return n===`C`}return!1}function fn(e,t,n){let r=t-1;for(;r>=0&&/\s/.test(e[r]??``);)r--;return e[r]===`(`?n.classParenRoles.at(-1)===`T`:e[r]===`[`||e[r]===`?`||e[r]===`:`||e[r]===`&`&&e[r-1]===`&`||e[r]===`|`&&e[r-1]===`|`}function pn(e,t,n,r,i){if(r===`block`){let n=e.indexOf(`*/`,t);return n===-1?e.length:n}if(r===`line`){for(let n=t;n<e.length;n++){let t=e[n];if(t===`
|
|
13
|
+
`||t===`\r`||t===`\u2028`||t===`\u2029`)return n}return e.length}if(n){for(let r=t;r<e.length;r++){let t=e[r];if(t===`\\`)r=H(e,r)-1;else if(t===n||t===`
|
|
14
|
+
`||t===`\r`||t===`\u2028`||t===`\u2029`)return r}return e.length}if(i)for(let n=t;n<e.length;n++){let t=e[n];if(t===`\\`)n=H(e,n,!0)-1;else if(t==="`"||t===`$`&&e[n+1]===`{`)return n}return e.length}function mn(e,t){if(!e.includes(`{`))return e;let n=new Map,r=t!==`none`&&e.includes(`<`)?on(e,n,t):new Set,i=``,a=0,o,s,c=!1,l=-1,u=0,d=[],f=0,p=-1,m=Pt(),h,g=0,_=!1,v=0,y=0,b,x=-1,S=[],C=[],w=[],T=[],E=-1;for(;a<e.length;){let D=e[a];if(h){let t=Ue(e,a,h);i+=e.slice(a,t),a=t,h.depth===0&&(h=void 0,g=t);continue}if(s){if(s===`line`&&(D===`
|
|
15
|
+
`||D===`\r`||D===`\u2028`||D===`\u2029`)){s=void 0,l=-1,u=0,zt(m,d.length)&&(f=a+1),i+=D,a++;continue}if(s===`block`&&D===`*`&&e[a+1]===`/`){s=void 0,l=-1,u=0,i+=`*/`,a+=2;continue}if(D!==`{`){i+=D,a++;continue}}else if(o){if(D===`
|
|
16
|
+
`||D===`\r`||D===`\u2028`||D===`\u2029`){o=void 0,c=!1,l=-1,u=0,W(m,`string`),i+=D,a++;continue}if(D===`\\`){let t=H(e,a);i+=e.slice(a,t),a=t;continue}if(D===o){o=void 0,c=!1,l=-1,u=0,W(m,`string`),i+=D,a++;continue}if(D!==`{`){i+=D,a++;continue}}else if(T.at(-1)?.inText){let t=T.at(-1);if(D===`\\`){let t=H(e,a,!0);i+=e.slice(a,t),a=t;continue}if(D==="`"){T.pop(),W(m,`template`),i+=D,a++;continue}if(D===`{`&&e[a-1]===`$`){t.groupLimit=-1,t.inText=!1,t.interpolationDepth=1,V(d,`I`),m.canEnd=!1,m.forceRegex=!1,m.lastSignificant=`{`,m.lastWord=``,i+=D,a++;continue}if(t.css){let n=Ue(e,a,t.css);i+=e.slice(a,n),a=n,t.css.depth===0&&(t.css=void 0,t.cssBoundary=n);continue}if(D!==`{`){i+=D,a++;continue}}else if(b===`text`){if(D===`{`){let n=t===`auto`?He(e,a):void 0;if(n){E===a&&i.length>0&&!/\s/.test(i.at(-1))&&(i+=` `),i+=n.value,E=n.end,a=n.end;continue}V(C,`T`),b=void 0,V(d,`J`),y++,V(S,!1),m.canEnd=!1,m.forceRegex=!1,m.lastSignificant=`{`,m.lastWord=``}else if(D===`<`&&(e[a+1]===`/`||e[a+1]===`>`||/[A-Z_$a-z]/.test(e[a+1]??``))){_=e[a+1]===`/`,b=`tag`;let t=Gt(e,a);x=t?qt(e,t,n):-1}i+=D,a++;continue}else if(b===`tag`&&a<=x){i+=D,a++;continue}else if(b===`tag`&&D===`{`){V(C,`G`),b=void 0,V(d,`J`),y++,V(S,ln(e,a)),m.canEnd=!1,m.forceRegex=!1,m.lastSignificant=`{`,m.lastWord=``,i+=D,a++;continue}else if(b===`tag`&&D===`>`){let t=a-1;for(;/\s/.test(e[t]??``);)t--;let n=e[t]===`/`;_?v=Math.max(0,v-1):n||v++;let r=w.at(-1);r&&v===r.baseDepth&&(_||n)?(w.pop(),b=r.resumeExpression?void 0:v>0?`text`:void 0,W(m,`jsx`)):b=`text`,_=!1,x=-1,i+=D,a++;continue}else if(b===`tag`&&D!==`'`&&D!==`"`){i+=D,a++;continue}else if(D===`<`&&sn(a,m.canEnd,r)){V(w,{baseDepth:v,resumeExpression:y>0}),_=!1,b=`tag`;let t=Gt(e,a);x=t?qt(e,t,n):-1,i+=D,a++;continue}else if(D===`\\`){let t=en(e,a);if(t){i+=e.slice(a,t.end),a=t.end,W(m,`word`);continue}}else if(D===`'`||D===`"`){o=D,c=un(e,a)||dn(m)||b===void 0&&S.at(-1)===!0&&fn(e,a,m),l=-1,u=a+1,i+=D,a++;continue}else if(D==="`"){V(T,{classLiteral:un(e,a)||dn(m)||b===void 0&&S.at(-1)===!0&&fn(e,a,m),cssBoundary:a+1,groupLimit:-1,inText:!0,interpolationDepth:0}),i+=D,a++;continue}else if(D===`/`&&e[a+1]===`/`){s=`line`,l=-1,u=a+2,i+=`//`,a+=2;continue}else if(D===`/`&&e[a+1]===`*`){s=`block`,l=-1,u=a+2,i+=`/*`,a+=2;continue}else if(D===`/`&&a>=p&&Ut(e,a,m.forceRegex,m.canEnd)){let t=Wt(e,a);if(t.end!==-1){i+=e.slice(a,t.end),a=t.end,W(m,`regex`);continue}p=t.failedUntil}if(D===`}`){let e=d.pop(),t=T.at(-1);if(t&&!t.inText&&(t.interpolationDepth--,t.interpolationDepth===0&&(t.groupLimit=-1,t.inText=!0)),e===`J`&&(y--,S.pop(),b=C.at(-1)===`G`?`tag`:`text`,C.pop()),e===`T`){let e=m.pendingFunctions.at(-1);e?.phase===`return-type`&&(e.typeCanEnd=!0)}m.canEnd=e!==`B`,m.forceRegex=e===`B`,m.labelCandidate=!1,m.labelColon=-1,m.lastSignificant=`}`,m.lastWord=``,m.statementStart=e===`B`,e===`B`&&(f=a+1),i+=D,a++;continue}if(D!==`{`){(D===`
|
|
17
|
+
`||D===`\r`||D===`\u2028`||D===`\u2029`)&&zt(m,d.length)&&(f=a+1),/\s/.test(D)||(m.forceRegex=!1),m.canEnd=Ht(e,a,m.canEnd,m),D===`;`&&(Bt(m),d.length===0&&(f=a+1)),i+=D,a++;continue}let O=s===void 0&&o===void 0&&!T.at(-1)?.inText,k=O?Rt(m):void 0,A=O&&m.labelColon>=0,j=O&&m.statementStart&&(d.at(-1)===`B`||f>0||d.length===0&&Mt(e,a));if(O&&(d.length>0||k!==void 0||A||j||m.forceRegex||m.lastSignificant&&Ge.includes(m.lastSignificant)||Ke.has(m.lastWord)||ut(e,a,Math.max(f,g))||st(e,a)||ct(e,a))){let t=m.forceRegex||A||j?`B`:k??(Nt(e,a,f,m.parenKinds.length,m.lastSignificant)?`B`:`O`);V(d,t);let n=T.at(-1);n&&!n.inText&&n.interpolationDepth++,m.canEnd=!1,m.forceRegex=!1,m.labelCandidate=!1,m.labelColon=-1,m.lastSignificant=`{`,m.lastWord=``,m.statementStart=t===`B`,i+=D,a++;continue}let M=T.at(-1),N=e.length;if(o||s?(l<a&&(l=pn(e,a+1,o,s,!1)),N=l):M?.inText&&(M.groupLimit<a&&(M.groupLimit=pn(e,a+1,void 0,void 0,!0)),N=M.groupLimit),(e[a-1]===`#`||e[a-1]===`@`)&&!lt(e,a-1)){let t=We(e,a,N);if(t!==-1){i+=e.slice(a,t+1),a=t+1;continue}}let P=M?.inText===!0,F=o===void 0&&s===void 0&&!P?Le(e,a,N):Ie(e,a,N),ee=F.kind===`close`?F.index:-1,I=M===void 0||P||o!==void 0||s!==void 0,te=P?M.cssBoundary:o||s?u:g,ne=I&&!c&&!(P&&M.classLiteral)&&ot(e,a,P,te),re=ne?We(e,a,N):-1;if(ne&&(o===void 0&&s===void 0||re!==-1)&&(re===-1||e[re+1]!==`@`)){let e={blockComment:!1,depth:1,lineComment:!1,parenDepth:0};P?M.css=e:h=e,i+=D,a++;continue}if(F.kind!==`close`){i+=e.slice(a,F.index),a=F.index,P?M.cssBoundary=F.index:o||s?u=F.index:g=F.index;continue}let L=e.slice(a+1,ee),{conds:ie,end:R}=ze(e,ee+1,N),ae=Be(L);if(ae.length===0){i+=D,a++;continue}E===a&&i.length>0&&!/\s/.test(i.at(-1))&&(i+=` `),i+=ae.map(e=>`${e}${ie}`).join(` `),E=R,P?M.cssBoundary=R:o||s?u=R:g=R,a=R}return i}function hn(e){return mn(e,`auto`)}function gn(e,t){return mn(e,t)}const _n=/^(?:--?[\w-]+|[A-Z_$][\w$-]*|@teacss-skip-bracket-[\da-z]{6})$/i;function vn(e,t){let n=t;for(;n>0&&/[\w-]/.test(e[n-1]);)n--;if(n===t||e[n-1]!==`:`)return!1;let r=n-1,i=r;for(;i>0&&/[\w$@-]/.test(e[i-1]);)i--;if(!_n.test(e.slice(i,r)))return!1;let a=i-1;for(;a>=0&&/\s/.test(e[a]);)a--;return a<0||!`{,?`.includes(e[a])}function yn(e){let t=[],n=[],r=[],i=!1,a;for(let o=0;o<e.length;o++){let s=e[o],c=e[o+1];if(n.length===0){s===`(`&&vn(e,o)&&V(n,{attached:!0,start:o});continue}if(i)s===`*`&&c===`/`&&(i=!1,o++);else if(a)s===`\\`?o++:s===a&&(a=void 0);else if(s===`\\`)o++;else if(s===`/`&&c===`*`)i=!0,o++;else if(s===`'`||s===`"`||s==="`")a=s;else if(r.length>0)s===`[`||s===`(`?V(r,s===`[`?`]`:`)`):s===r.at(-1)&&r.pop();else if(s===`[`)V(r,`]`);else if(s===`(`)V(n,{attached:vn(e,o),start:o});else if(s===`)`){let e=n.pop();e.attached&&V(t,{end:o+1,start:e.start})}}let o=[];for(let e of t.sort((e,t)=>e.start-t.start||t.end-e.end))(o.length===0||e.start>=o.at(-1).end)&&V(o,e);return o}function bn(e){if(!e.includes(`{`))return e;let t=``,n=0,r=-1,i=0,a=0,o=e.includes(`[`)?Fe(e):[],s=e.includes(`(`)?yn(e):[],c={closers:[]};for(;n<e.length;){for(;i<o.length&&o[i].end<=n;)i++;for(;a<s.length&&s[a].end<=n;)a++;let l=i<o.length?o[i]:void 0,u=a<s.length?s[a]:void 0,d=l?.start===n?l:u?.start===n?u:void 0;if(d&&c.blockComment!==!0&&c.quote===void 0){t+=e.slice(n,d.end),n=d.end;continue}c.closers.length>0&&/\s/.test(e[n])&&(c.blockComment=!1,c.closers.length=0,c.quote=void 0);let f=B(e,n,c);if(f!==void 0){t+=e.slice(n,f+1),n=f+1;continue}let p=e[n];if(c.closers.length>0||p!==`{`){t+=p,n++;continue}let m=Ie(e,n);if(m.kind!==`close`){t+=e.slice(n,m.index),n=m.index;continue}let h=m.index,g=e.slice(n+1,h),{conds:_,end:v}=ze(e,h+1),y=Be(g);if(y.length===0){t+=p,n++;continue}r===n&&t.length>0&&!/\s/.test(t.at(-1))&&(t+=` `),t+=y.map(e=>`${e}${_}`).join(` `),r=v,n=v}return t}function xn(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function Sn(e){let t=e.length,n=-1,r,i=``,a=e.charCodeAt(0);for(;++n<t;){if(r=e.charCodeAt(n),r===0){i+=`�`;continue}if(r===37){i+=`\\%`;continue}if(r===44){i+=`\\,`;continue}if(r>=1&&r<=31||r===127||n===0&&r>=48&&r<=57||n===1&&r>=48&&r<=57&&a===45){i+=`\\${r.toString(16)} `;continue}if(n===0&&t===1&&r===45){i+=`\\${e.charAt(n)}`;continue}if(r>=128||r===45||r===95||r>=48&&r<=57||r>=65&&r<=90||r>=97&&r<=122){i+=e.charAt(n);continue}i+=`\\${e.charAt(n)}`}return i}const Cn=Sn,wn=/^[\da-z]{6}$/,Tn=/\.(css|postcss|sass|scss|less|stylus|styl)($|\?)/;function En(e){return e.replace(/\?.*$/,``)}function Dn(e){return Tn.test(e)}function On(e){let t,n,r=2166136261;for(t=0,n=e.length;t<n;t++)r^=e.charCodeAt(t),r+=(r<<1)+(r<<4)+(r<<7)+(r<<8)+(r<<24);return`00000${(r>>>0).toString(36)}`.slice(-6)}function kn(e,t){let n=new Set,r=t.length+6;for(let i=0;i+r<=e.length;){let a=e.indexOf(t,i);if(a===-1||a+r>e.length)break;let o=e.slice(a,a+r);wn.test(o.slice(t.length))&&n.add(o),i=a+1}return n}function An(e){let t=e.keys().next().value;if(t===void 0||t.length<6)return;let n=t.slice(0,-6);if(!(!n||/[\da-z]/.test(n[0]))){for(let t of e.keys())if(t.length!==n.length+6||!t.startsWith(n)||!wn.test(t.slice(n.length)))return;return RegExp(`${xn(n)}[\\da-z]{6}`,`g`)}}function jn(e,t,n,r){let i=kn(e,r),a=new Set([...t.keys(),...i]);return e.replace(n,e=>{let n=0,o;for(;o=`${r}${On(n?`${e}:${n}`:e)}`,n++,!(t.get(o)===e&&!i.has(o)||!a.has(o)););return a.add(o),t.set(o,e),o})}function Mn(e,t){let n=An(t);if(n!==void 0)return e.replace(n,e=>t.get(e)??e);let r=[...t.keys()].filter(Boolean).sort((e,t)=>t.length-e.length);if(!r.length)return e;let i=new RegExp(r.map(xn).join(`|`),`g`);return e.replace(i,e=>t.get(e)??e)}function Nn(e,t,n){try{let r=[];return String.prototype.replace.call(e,t,(...e)=>{let t=e.length>0&&typeof e.at(-1)==`object`,n=e[e.length-(t?3:2)];return Object.defineProperty(r,r.length,{configurable:!0,enumerable:!0,value:{args:e,end:n+String(e[0]).length,start:n},writable:!0}),e[0]}),Promise.all(r.map(({args:e})=>Promise.resolve(n(e[0],...e.slice(1))))).then(t=>{let n=0,i=``;for(let a=0;a<r.length;a++){let o=r[a];o.start<n||(i+=e.slice(n,o.start)+t[a],n=o.end)}return i+e.slice(n)})}catch(e){return Promise.reject(e)}}const Pn=/[\\:]?[\s'"`;{}]+/g,Fn=new RegExp(Pn.source,Pn.flags),In=/([\\:]?[\s"'`;<>]|:\(|\)"|\)\s)/g,Ln=`@teacss-skip-bracket-`,Rn=/@teacss-skip-bracket-[\da-z]{6}/g,zn=/[\s'"`;{}]/;function Bn(e,t){return e[t+1]!==`/`&&/[A-Z_$]/i.test(e[t+1]??``)}function Vn(e,t,n){if(n>0)return!0;if(!/\s/.test(e[t-1]??``))return!1;let r=t-1;for(;r>=0&&/\s/.test(e[r]);)r--;return e[r]!==`=`}function Hn(e){return e!==void 0&&/\.html?$/i.test(e.split(/[?#]/,1)[0])}function Un(e){return e!==void 0&&/\.(?:[cm]?[jt]sx?|mdx)$/i.test(e.split(/[?#]/,1)[0])}function Wn(e){if(e===void 0)return`auto`;let t=e.split(/[?#]/,1)[0];return/\.(?:[cm]?ts)$/i.test(t)?`none`:/\.tsx$/i.test(t)?`tsx`:/\.(?:jsx|mdx)$/i.test(t)?`raw`:`auto`}function Gn(e,t){let n=[],r=[],i=!1,a=0,o=!1,s=!1,c;for(let l=0;l<e.length;l++){let u=e[l],d=e[l+1];if(!o){if(e.startsWith(`<!--`,l)){let t=e.indexOf(`-->`,l+4);if(t===-1)break;l=t+2}else u===`<`&&Bn(e,l)&&(o=!0,r=[]);continue}if(s){(u===`
|
|
18
|
+
`||u===`\r`||u===`\u2028`||u===`\u2029`)&&(s=!1);continue}if(i){u===`*`&&d===`/`&&(i=!1,l++);continue}if(c){u===`\\`?l++:u===c&&(c=void 0);continue}if(u===`/`&&d===`*`&&Vn(e,l,a)){i=!0,l++;continue}if(u===`/`&&d===`/`&&Vn(e,l,a)){s=!0,l++;continue}if(u===`"`||u===`'`||u==="`"){c=u;continue}if(a>0){u===`{`?a++:u===`}`&&a--;continue}if(u===`{`){a=1;continue}if(u===`>`){for(let e of r)z(n,e);r=[],o=!1;continue}if(!/\s/.test(e[l-1]??``)||e.slice(l,l+5).toLowerCase()!==`class`)continue;let f=l+5;for(;/\s/.test(e[f]??``);)f++;if(e[f]!==`=`)continue;for(f++;/\s/.test(e[f]??``);)f++;if(!e[f]||(t?/[\s"'`=<>]/:/[\s"'`={<>]/).test(e[f]))continue;let p=f+1;for(;p<e.length&&!/[\s"'`=<>]/.test(e[p]);)p++;z(r,{end:p,start:l,valueStart:f}),l=p-1}if(n.length===0)return e;let l=[],u=0;for(let{end:t,start:r,valueStart:i}of n){let n=e.slice(i,t);z(l,e.slice(u,r)),z(l,` `.repeat(t-r-n.length-2)),z(l,`"${n}"`),u=t}return z(l,e.slice(u)),l.join(``)}function Kn(e){if(!e)return!1;let t=e.charCodeAt(0);switch(t){case 9:case 10:case 11:case 12:case 13:case 32:case 34:case 39:case 59:case 96:case 123:case 125:return!0;default:return t>127&&zn.test(e)}}function qn(e){let t=e?.charCodeAt(0);return t===10||t===13||t===8232||t===8233}function Jn(e,t){return e[t+1]===`\r`&&e[t+2]===`
|
|
19
|
+
`?t+2:t+1}function Yn(e,t){let n=t;for(;/\s/.test(e[n]??``);)n++;if(e[n]!==`:`)return!1;for(n++;/\s/.test(e[n]??``);)n++;return e[n]===`[`&&Ne(e,n)}const Xn=new Set([`await`,`break`,`case`,`continue`,`debugger`,`delete`,`do`,`else`,`in`,`instanceof`,`new`,`of`,`return`,`throw`,`typeof`,`void`,`yield`]),Zn=new Set([`for`,`if`,`while`,`with`]);function Qn(e,t){let n=0;for(;t>0&&e[--t]===`\\`;)n++;return n%2==1}function $n(e,t){let n=0;for(let r=t;r>=0;r--){let t=e[r];if(t===`"`||t===`'`||t==="`"){let n=r-1;for(;n>=0&&(e[n]!==t||Qn(e,n));)n--;if(n<0)return!1;r=n}else if(t===`/`&&e[r-1]===`*`){let t=e.lastIndexOf(`/*`,r-2);if(t<0)return!1;r=t}else if(t===`)`)n++;else if(t===`(`){if(n--,n!==0)continue;let t=r;for(;t>0&&/\s/.test(e[t-1]);)t--;let i=t;for(;i>0&&/[\w$]/.test(e[i-1]);)i--;return i>0&&/[\w$.]/.test(e[i-1])?!1:Zn.has(e.slice(i,t))}}return!1}function er(e,t){let n=0;for(let r=t;r>=0;r--){let t=e[r];if(t===`"`||t===`'`||t==="`"){let n=r-1;for(;n>=0&&(e[n]!==t||Qn(e,n));)n--;if(n<0)return-1;r=n}else if(t===`/`&&e[r-1]===`*`){let t=e.lastIndexOf(`/*`,r-2);if(t<0)return-1;r=t}else if(t===`}`)n++;else if(t===`{`&&(n--,n===0))return r}return-1}function tr(e,t){for(;t>0&&/\s/.test(e[t-1]);)t--;let n=t;for(;n>0&&/[\w$]/.test(e[n-1]);)n--;return{start:n,value:e.slice(n,t)}}function nr(e,t){let n=er(e,t);if(n<0)return!1;let r=n;for(;r>0&&/\s/.test(e[r-1]);)r--;if(r===0)return!0;let i=e[r-1];if(i===`)`||i===`>`&&e[r-2]===`=`||`;{}:`.includes(i))return!0;let a=tr(e,r);return[`catch`,`class`,`do`,`else`,`finally`,`static`,`try`].includes(a.value)?!0:a.value?tr(e,a.start).value===`class`:!1}function rr(e,t){if(e[t+1]===`/`||e[t+1]===`*`||e[t-1]===`<`&&(e[t+1]===`>`||/[A-Z_$]/i.test(e[t+1]??``)))return!1;let n=t-1;for(;n>=0&&/\s/.test(e[n]);)n--;if(n<0)return!0;if((e[n]===`+`||e[n]===`-`)&&e[n-1]===e[n]||e[n]===`!`&&n>0&&/[\w$)\]]/.test(e[n-1]??``)||e[n]===`>`&&n>0&&/[\w$)>]/.test(e[n-1]??``))return!1;if(`=([{,:;!?&|+-*%^~<>`.includes(e[n])||e[n]===`)`&&$n(e,n)||e[n]===`}`&&nr(e,n))return!0;let r=n+1;for(;n>=0&&/[\w$]/.test(e[n]);)n--;let i=e.slice(n+1,r);return Xn.has(i)?!0:i==="default"&&tr(e,n+1).value===`export`}function ir(e,t){let n=!1;for(let r=t+1;r<e.length;r++){let t=e[r];if(qn(t))return-1;if(t===`\\`)r++;else if(t===`[`)n=!0;else if(t===`]`)n=!1;else if(t===`/`&&!n){for(r++;/[a-z]/i.test(e[r]??``);)r++;return r}}return-1}function ar(e,t=!1){let n=[],r=[],i=[],a=!1,o=!1,s,c=-1,l,u=-1,d=!1;for(let f=0;f<e.length;f++){let p=e[f];if(!a&&!s&&p===`/`&&rr(e,f)){let t=ir(e,f);if(t!==-1){f=t-1,d=!1;continue}}if(n.length===0){Kn(p)?d=!1:p===`/`&&(d=!0),p===`[`&&(z(n,f),o=d&&e[f-1]!==`:`&&e[f-1]!==`@`,i=[],l=void 0);continue}if(Kn(p)&&(u=f),qn(p)){n.length=0,i=[],a=!1,o=!1,s=void 0,c=-1,l=void 0;continue}if((a||s)&&/\s/.test(p)&&(l??=Ce(e,n.at(-1),!1,f),l===void 0)){n.length=0,i=[],a=!1,o=!1,s=void 0,c=-1;continue}if(!a&&!s&&p===`/`&&o){n.length=0,i=[],o=!1,c=-1;continue}if(a){p===`*`&&e[f+1]===`/`&&(a=!1,f++);continue}if(s){p===`\\`?(qn(e[f+1])?(n.length=0,i=[],a=!1,s=void 0,c=-1):Kn(e[f+1])&&(u=f+1),f++):p===s&&(z(i,[c+1,f]),s=void 0,c=-1);continue}if(p===`/`&&e[f+1]===`*`)a=!0,f++;else if(p===`"`||p===`'`)s=p,c=f;else if(p===`\\`)qn(e[f+1])&&(n.length=0,i=[],a=!1,s=void 0,c=-1),Kn(e[f+1])&&(u=f+1),f++;else if(p===`[`)z(n,f);else if(p===`]`){let a=n.pop(),s=f+1,c=!1;if(s!==a+2&&u>a){let n=e[a-1]===`:`||e[a-1]===`@`,i=e[s]===`:`&&!!e[s+1]&&!zn.test(e[s+1]);c=n&&!Me(e,a)||i&&!(t&&Yn(e,s)),c&&z(r,[a,s])}if(n.length===0){if(o=!1,l=void 0,!c)for(let[t,n]of i)for(let[i,a]of ar(e.slice(t,n)))z(r,[t+i,t+a]);i=[]}}}let f=[];for(let e of r.sort(([e,t],[n,r])=>e-n||r-t))(f.length===0||e[0]>=f.at(-1)[1])&&z(f,e);return f}const or=/^(?:--?[\w-]+|[A-Z_$][\w$-]*|@teacss-skip-bracket-[\da-z]{6})$/i;function sr(e,t){let n=t;for(;n>0&&/[\w-]/.test(e[n-1]);)n--;if(n===t||e[n-1]!==`:`)return!1;let r=n-1,i=r;for(;i>0&&/[\w$@-]/.test(e[i-1]);)i--;if(!or.test(e.slice(i,r)))return!1;let a=i-1;for(;a>=0&&/\s/.test(e[a]);)a--;return a<0||!`{,?`.includes(e[a])}function cr(e){let t=[],n=[],r=[],i=!1,a,o,s=-1,c,l=()=>{if(s<0||n.length===0)return;let e=n.at(-1);e.attached&&e.containsGroupBrace&&z(t,[e.start,s+1]),s=-1};for(let u=0;u<e.length;u++){let d=e[u];if(n.length===0){a?a!=="`"&&qn(d)?a=void 0:d===`\\`?u=Jn(e,u):d===a?a=void 0:d===`(`&&sr(e,u)&&(z(n,{attached:!0,containsGroupBrace:!1,outerQuote:a,start:u}),c=void 0):d===`"`||d===`'`||d==="`"?a=d:d===`(`&&sr(e,u)&&(z(n,{attached:!0,containsGroupBrace:!1,outerQuote:void 0,start:u}),c=void 0);continue}if(qn(d)){l(),n.length=0,r.length=0,i=!1,o=void 0,a!=="`"&&(a=void 0),c=void 0;continue}if((o||i)&&/\s/.test(d)&&(c??=Ce(e,n.at(-1).start,!0,u),c===void 0)){n.length=0,r.length=0,i=!1,o=void 0,s=-1;continue}if(o){d===`\\`?u=Jn(e,u):d===o?o=void 0:d===`{`&&(n.at(-1).containsGroupBrace=!0);continue}if(i){d===`*`&&e[u+1]===`/`&&(i=!1,u++);continue}let f=n[0].outerQuote;if(d===`/`&&e[u+1]===`*`)i=!0,u++;else if(f&&d===f)l(),n.length=0,r.length=0,i=!1,a=void 0;else if(d===`"`||d===`'`||d==="`")o=d;else if(d===`\\`)u=Jn(e,u);else if(r.length>0)d===`[`?z(r,`]`):d===`(`?z(r,`)`):d===r.at(-1)?(r.pop(),r.length===0?s=-1:d===`)`&&(s=u)):d===`{`&&(n.at(-1).containsGroupBrace=!0);else if(d===`[`)z(r,`]`);else if(d===`{`)n.at(-1).containsGroupBrace=!0;else if(d===`(`)z(n,{attached:sr(e,u),containsGroupBrace:!1,outerQuote:f,start:u});else if(d===`)`){let e=n.pop();e.attached&&e.containsGroupBrace&&z(t,[e.start,u+1]),e.containsGroupBrace&&n.length>0&&(n.at(-1).containsGroupBrace=!0),n.length===0&&(c=void 0)}}l();let u=[];for(let e of t.sort(([e,t],[n,r])=>e-n||r-t))(u.length===0||e[0]>=u.at(-1)[1])&&z(u,e);return u}function lr(e,t,n){if(!t.length)return e;let r=new Set([...e.matchAll(Rn)].map(e=>e[0])),i=new Set([...n.keys(),...r]),a=[],o=0;for(let[s,c]of t){let t=e.slice(s,c),l=0,u;for(;u=`${Ln}${On(l?`${t}:${l}`:t)}`,l++,!(n.get(u)===t&&!r.has(u)||!i.has(u)););i.add(u),n.set(u,t),z(a,e.slice(o,s)),z(a,u),o=c}return z(a,e.slice(o)),a.join(``)}function ur(e,t,n=!1){return lr(e,ar(e,n),t)}function dr(e,t){return lr(e,cr(e),t)}function fr(e,t){let n=e;for(let e=0;e<t.size&&n.includes(Ln);e++){let e=n.replace(Rn,e=>t.get(e)??e);if(e===n)break;n=e}return n}function pr(e,t){let n=new Map;e.includes(`[`)&&(e=ur(e,n,!0)),e.includes(`(`)&&(e=dr(e,n)),e=gn(e,t),e.includes(`[`)&&(e=ur(e,n)),e.includes(`(`)&&(e=dr(e,n));let r=e.split(Pn);return n.size?r.map(e=>e.includes(Ln)?fr(e,n):e):r}const mr={name:`@teacss/core/extractor-split`,order:0,extract({code:e,id:t}){return pr(Un(t)?e:Gn(e,Hn(t)),Wn(t))}};var hr=class extends Set{_map=new Map;constructor(e){if(super(),e)for(let t of e)this.add(t)}add(e){return this._map.set(e,(this._map.get(e)??0)+1),super.add(e)}delete(e){return this._map.has(e)?(this._map.delete(e),super.delete(e)):!1}clear(){this._map.clear(),super.clear()}getCount(e){return this._map.get(e)??0}setCount(e,t){return this._map.set(e,t),super.add(e)}};function G(e){return e instanceof hr}function gr(e,t,n){if(Object.hasOwn(e,t)){if(!Reflect.set(e,t,n))throw TypeError(`Cannot assign event "${String(t)}"`)}else Object.defineProperty(e,t,{value:n,configurable:!0,enumerable:!0,writable:!0})}function _r(){return{events:Object.create(null),emit(e,...t){let n=Object.hasOwn(this.events,e)?this.events[e]:void 0,r=u(Array.isArray(n)?n:[]).map(e=>e);for(let e of r)e(...t)},on(e,t){let n=this.events,r=Object.hasOwn(n,e)?n[e]:void 0,i=Array.isArray(r)?r:[];return Array.isArray(r)||gr(n,e,i),Object.defineProperty(i,i.length,{configurable:!0,enumerable:!0,value:t,writable:!0}),()=>{let r=Object.hasOwn(n,e)?n[e]:void 0;gr(n,e,u(Array.isArray(r)?r:[]).filter(e=>e!==t))}}}}const vr=/^\[(.+?)~?="(.*)"\]$/,yr=/[\w\u00A0-\uFFFF%-?]/,br=new RegExp(vr.source,vr.flags),xr=/\.(css|postcss|sass|scss|less|stylus|styl)($|\?)/,Sr=new RegExp(yr.source,yr.flags);function Cr(e){return e.match(vr)}function wr(e=``){return yr.test(e)}function Tr(e){return typeof e==`function`?{match:e}:e}function Er(e){return e.length===3&&Object.hasOwn(e,0)&&Object.hasOwn(e,1)&&Object.hasOwn(e,2)}function Dr(e){return e!=null}function Or(e){return e!=null&&typeof e.then==`function`}function kr(){}function Ar(e,t){for(let n=0;n<t.length;n++){if(!Object.hasOwn(t,n))continue;let r=t[n],i=Object.hasOwn(r,2),a=i?r[2]:void 0;if(a){let t=a;for(;t!==null&&t!==Object.prototype&&!Object.hasOwn(t,`layer`);)t=Object.getPrototypeOf(t);if(t!==null&&t!==Object.prototype){if(!Reflect.set(a,`layer`,e))throw TypeError(`Cannot assign rule layer`)}else Object.defineProperty(a,"layer",{configurable:!0,enumerable:!0,value:e,writable:!0})}else if(i){if(!Reflect.set(r,2,{layer:e}))throw TypeError(`Cannot assign rule metadata`)}else Object.defineProperty(r,2,{configurable:!0,enumerable:!0,value:{layer:e},writable:!0})}return t}var jr=class{_map=new Map;get(e,t){let n=this._map.get(e);if(n)return n.get(t)}getFallback(e,t,n){let r=this._map.get(e);return r||(r=new Map,this._map.set(e,r)),r.has(t)||r.set(t,n),r.get(t)}set(e,t,n){let r=this._map.get(e);return r||(r=new Map,this._map.set(e,r)),r.set(t,n),this}has(e,t){return this._map.get(e)?.has(t)??!1}delete(e,t){let n=this._map.get(e);if(!n)return!1;let r=n.delete(t);return r&&n.size===0&&this._map.delete(e),r}deleteTop(e){return this._map.delete(e)}map(e){return Array.from(this._map.entries()).flatMap(([t,n])=>Array.from(n.entries()).map(([n,r])=>e(r,t,n)))}},Mr=class extends Map{getFallback(e,t){let n=this.get(e);return n===void 0&&!this.has(e)?(this.set(e,t),t):n}map(e){let t=[];return this.forEach((n,r)=>{Object.defineProperty(t,t.length,{configurable:!0,enumerable:!0,value:e(n,r),writable:!0})}),t}flatMap(e){let t=[];return this.forEach((n,r)=>{for(let i of u(e(n,r)))Object.defineProperty(t,t.length,{configurable:!0,enumerable:!0,value:i,writable:!0})}),t}};function Nr(e){if(!Object.hasOwn(e,0))return;let t=e[0];if(typeof t==`string`||typeof t==`symbol`)return[t,Object.hasOwn(e,1)?e[1]:void 0]}function Pr(e){return Reflect.ownKeys(e).filter(t=>Object.getOwnPropertyDescriptor(e,t)?.enumerable)}function Fr(e,t){if(Object.getOwnPropertyDescriptor(e,t)?.enumerable)return{value:Reflect.get(e,t)}}function Ir(e){let t=[];for(let n of Pr(e)){let r=Fr(e,n);r&&Object.defineProperty(t,t.length,{configurable:!0,enumerable:!0,value:[n,r.value],writable:!0})}return t}function Lr(e){return p(e)?e:(Array.isArray(e)?u(e):Ir(e)).filter(e=>{let t=Nr(e);return t!==void 0&&t[1]!=null})}function Rr(e){if(Array.isArray(e)){let t=u(e);return t.every(e=>Array.isArray(e)&&e.length>0&&!Array.isArray(Object.hasOwn(e,0)?e[0]:void 0))||t.length===0?[t]:t.map(e=>Lr(e))}else return[Lr(e)]}function zr(e){let t=[],n,r;for(let i=0;i<e.length;i++){if(!Object.hasOwn(e,i))continue;let a=e[i],o=Nr(a);if(!o)continue;let[s,c]=o;typeof s==`string`&&(s.startsWith(`$$`)||(s===`__virtual_key__`||n!==s||r!==c)&&(Object.defineProperty(t,t.length,{configurable:!0,enumerable:!0,value:a,writable:!0}),n=s,r=c))}return t}const Br=`__virtual_key__`;function Vr(e,t){return t==null||typeof t==`function`||typeof e!=`string`?``:e===`__virtual_key__`?t?String(t):``:`${e}:${t};`}function Hr(e){if(e==null||e.length===0)return``;let t=``,n,r;for(let i=0;i<e.length;i++){if(!Object.hasOwn(e,i))continue;let a=Nr(e[i]);if(!a)continue;let[o,s]=a;typeof o==`string`&&(o.startsWith(`$$`)||(o===`__virtual_key__`||n!==o||r!==s)&&(t+=Vr(o,s),n=o,r=s))}return t}function K(e){if(typeof e!=`object`||!e||Array.isArray(e))return!1;let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null}const Ur=`$reset`;function Wr(e,t,n){Object.defineProperty(e,t,{value:n,configurable:!0,enumerable:!0,writable:!0})}function Gr(e,t,n=!1){let r=e,i=t;if(Array.isArray(i))return n&&Array.isArray(r)?[...u(r),...u(i)]:[...u(i)];if(K(i)&&Object.hasOwn(i,`$reset`)&&i.$reset){let{[Ur]:e,...t}=i;return Kr(t)}if(!K(i))return i;if(!K(r))return Kr(i);let a={...r};return Pr(i).forEach(e=>{if(e===`$reset`)return;let t=Fr(i,e);if(!t)return;let o=t.value,s=Object.hasOwn(r,e)?Reflect.get(r,e):void 0;if(K(o)&&Object.hasOwn(o,`$reset`)&&o.$reset){let{[Ur]:t,...n}=o;Wr(a,e,Kr(n))}else K(s)&&K(o)||Array.isArray(s)&&Array.isArray(o)?Wr(a,e,Gr(s,o,n)):Wr(a,e,o)}),a}function Kr(e){if(Array.isArray(e))return u(e).map(Kr);if(K(e)){let t={};for(let n of Pr(e)){if(n===`$reset`)continue;let r=Fr(e,n);r&&Wr(t,n,Kr(r.value))}return t}return e}function qr(e){return typeof e!=`object`||!e?e:Jr(e)}function Jr(e){if(Array.isArray(e)){let t=Array.from({length:e.length});for(let n=e.length-1;n>=0;n--)t[n]=Object.hasOwn(e,n)?qr(e[n]):void 0;return t}if(K(e)){let t=e,n={};for(let e of Pr(t)){let r=Fr(t,e);r&&Wr(n,e,qr(r.value))}return n}return e}function Yr(e){return Object.hasOwn(e,0)&&p(e[0])}function Xr(e){return Object.hasOwn(e,0)&&p(e[0])}function Zr(e){let t=e.split(/\s+/);return t[0]===``&&t.shift(),t.at(-1)===``&&t.pop(),t}function Qr(e){if(!e.includes(`[`))return Zr(e);let t=Fe(e);if(t.length===0)return Zr(e);let n=[],r=0,i=-1;for(let a=0;a<e.length;a++){let o=t[r];if(o&&a===o.start){i<0&&(i=a),a=o.end-1,r++;continue}/\s/.test(e[a])?(i>=0&&z(n,e.slice(i,a)),i=-1):i<0&&(i=a)}return i>=0&&z(n,e.slice(i)),n}function $r(e){let t=``,n=0,r;for(let i=0;i<e.length;i++){let a=e[i];if(a===`\\`&&e[i+1]===`_`){t+=`_`,i++;continue}if(a===`\\`&&i+1<e.length){t+=a+e[++i];continue}if(r){a===r&&(r=void 0),t+=a===`_`&&n===0?` `:a;continue}if(a===`/`&&e[i+1]===`*`){let n=e.indexOf(`*/`,i+2);if(n===-1){t+=e.slice(i);break}t+=e.slice(i,n+2),i=n+1;continue}if(a===`"`||a===`'`){r=a,t+=a;continue}if(a===`(`?n++:a===`)`&&n>0&&n--,a===`_`&&n===0){t+=` `;continue}t+=a}return t}const ei=new Set([`calc`,`clamp`,`max`,`min`]);function ti(e){return e==null?!1:e===`\\`||/[-_a-zA-Z0-9]/.test(e)||e.charCodeAt(0)>=128}function ni(e,t){if(t>0&&ti(e[t-1])||!/[-_a-zA-Z]/.test(e[t]))return;let n=t+1;for(;/[-_a-zA-Z0-9]/.test(e[n]??``);)n++;return e[n]===`(`?{name:e.slice(t,n),open:n}:void 0}function ri(e){let t=new Map,n=[],r=!1,i;for(let a=0;a<e.length;a++){let o=e[a];if(r){o===`*`&&e[a+1]===`/`&&(r=!1,a++);continue}if(i){o===`\\`?a++:o===i&&(i=void 0);continue}if(o===`\\`){a++;continue}if(o===`"`||o===`'`){i=o;continue}if(o===`/`&&e[a+1]===`*`){r=!0,a++;continue}o===`(`?z(n,a):o===`)`&&n.length>0&&t.set(n.pop(),a)}return t}function ii(e,t){let n=e[t];if(n===`"`||n===`'`){for(let r=t+1;r<e.length;r++)if(e[r]===`\\`)r++;else if(e[r]===n)return r+1;return e.length}if(n===`/`&&e[t+1]===`*`){let n=e.indexOf(`*/`,t+2);return n<0?e.length:n+2}}function ai(e){let t=e.trimEnd();for(;t.endsWith(`*/`);){let e=t.lastIndexOf(`/*`);if(e<0)break;t=t.slice(0,e).trimEnd()}if(t.endsWith(`)`)||/(?:^|[\s,(+\-*/])(?:e|pi|nan|-?infinity)$/i.test(t))return!0;let n=/[+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?(?:%|[a-z]+)?$/i.exec(t);if(n==null)return!1;let r=n.index;return r===0||/[\s,(+\-*/]/.test(t[r-1])}function oi(e,t,n){return e[t]!==`+`&&e[t]!==`-`||!/\d/.test(e[t+1]??``)?!1:/(?:^|[^-_a-zA-Z0-9.])(?:\d+(?:\.\d*)?|\.\d+)[eE]$/.test(n.trimEnd())}function si(e){if(!e.includes(`(`))return e;let t=ri(e),n=[],r=``;for(let i=0;i<e.length;){let a=ii(e,i);if(a!=null){r+=e.slice(i,a),i=a;continue}let o=ni(e,i);if(o!=null){let a=t.get(o.open);if(a==null){r+=e.slice(i);break}let s=o.name.toLowerCase();if(s===`url`){r+=e.slice(i,a+1),i=a+1;continue}if(ei.has(s)){r+=`${o.name}(`,z(n,a),i=o.open+1;continue}r+=o.name,i=o.open;continue}let s=e[i],c=s===`+`||s===`-`||s===`*`||s===`/`,l=s===`/`&&e[i+1]===`*`;n.length>0&&c&&!l&&!oi(e,i,r)&&ai(r)?(/\s/.test(r.at(-1)??``)||(r+=` `),r+=s,/\s/.test(e[i+1]??``)||(r+=` `)):r+=s,i===n.at(-1)&&n.pop(),i++}return r}function ci(e){return e.length>=2&&e[0]===`[`&&e[e.length-1]===`]`}function li(e,t={}){let{calc:n=!0}=t,r=e;return ci(r)&&(r=$r(r.slice(1,-1))),n&&(r=si(r)),r}const ui=new te(256,void 0,!0);function di(e){return u(e).map(e=>e)}function fi(e,t,n){return n.some(n=>e.startsWith(n,t))}function pi(e,t,n){let r=t-1;for(;r>0&&/[\w$-]/.test(e[r-1]);)r--;let i=r-1;for(;i>=0&&/\s/.test(e[i]);)i--;return e[i]===`(`&&n.some(t=>e.slice(i-t.length,i)===t)}function mi(e,t){let n=t+1;for(;/\s/.test(e[n]??``);)n++;return e[n]===`"`||e[n]===`'`||e[n]==="`"}function hi(e,t){let n=new Set,r=[],i=[],a=[],o,s=()=>{let e=o?.bracketStarts.at(-1);if(e)e.containsCandidate=!0;else{let e=i.at(-1);e&&(e.containsCandidate=!0)}};for(let c=0;c<e.length;c++){let l=e[c],u=l===`[`&&(e[c-1]===`:`||e[c-1]===`@`);if(u||l===`[`&&!o){mi(e,c)&&(!u||Ne(e,c)&&!pi(e,c,t))&&n.add(c),i.push({containsCandidate:!1,parentQuote:o,start:c}),o=void 0;continue}if(i.length!==0){if(o){if(l===`\\`)c++;else if(l===o.character){if(o.bracketStarts.some(e=>e.containsCandidate)){for(let e of o.bracketStarts)e.containsCandidate&&n.add(e.start);let e=i.at(-1);e&&(e.containsCandidate=!0)}o=void 0}else if(l===`[`)o.bracketStarts.push({containsCandidate:!1,start:c});else if(l===`]`){let i=o.bracketStarts.pop();i&&fi(e,c+1,t)?(r.push({start:i.start,end:c+1}),n.delete(i.start),s()):i?.containsCandidate&&(n.add(i.start),s())}}else if(l===`"`||l===`'`||l==="`")o={bracketStarts:[],character:l},a.push(o);else if(l===`\\`)c++;else if(l===`]`){let a=i.pop(),l=a.start,u=c+1,d=n.has(l)||Pe(e,l,u)&&!pi(e,l,t),f=(e[l-1]===`:`||e[l-1]===`@`||fi(e,u,t))&&!d;f?(r.push({start:l,end:u}),n.delete(l)):a.containsCandidate&&n.add(l),o=a.parentQuote,(f||a.containsCandidate)&&s()}}}for(let e of i)e.containsCandidate&&n.add(e.start);for(let e of a)for(let t of e.bracketStarts)t.containsCandidate&&n.add(t.start);let c=[];for(let e of r.sort((e,t)=>e.start-t.start||t.end-e.end))(!c.length||e.start>=c.at(-1).end)&&c.push(e);return{barrierStarts:n,ranges:c}}function gi(e,t){let{barrierStarts:n,ranges:r}=hi(e,t);if(r.length===0&&n.size===0)return e;let i=e.split(``);for(let e of n)i[e]=`$`;for(let e of r)for(let t=e.start+1;t<e.end-1;t++)i[t]=`$`;return i.join(``)}function _i(e){let t=JSON.stringify(e),n=[...e].sort((e,t)=>t.length-e.length).map(xn).join(`|`),r=`\\[[^\\]]*?\\]`,i=ui.getOrInsert(t,RegExp(n?`((?:[!@*<~\\w+:_-]|${r})+?)(${n})\\(((?:[~!@<>\\w\\s:/\\\\,%#.$?-]|${r})+?)\\)(?!\\s*?=>)`:`(?!)`,`gm`));return i.lastIndex=0,i}function vi(e=[`-`,`:`]){let t=_i(di(e));return new RegExp(t.source,t.flags)}function yi(e,t=[`-`,`:`],n=5){let r=di(t),i=_i(r),a=!1,o=typeof e==`string`?e:e.original,s=o,c=new Set,l=new Map;if(n>0){let e=gi(s,r),t;if(r.some(t=>e.includes(`${t}(`)))do{t=!1;let o=``,u=0;i.lastIndex=0;let d;for(;d=i.exec(e);){let e=d.index,[n,r,i,f]=d;a=!0,t=!0;let p=s.slice(e,e+n.length),m=s.slice(e,e+r.length);c.add(m+i);let h=e+m.length+i.length+1,g=s.slice(h,h+f.length),_={length:p.length,items:[]};l.set(e,_);let v=0;for(let e of Qr(g)){let t=g.indexOf(e,v),n=h+t;v=t+e.length;let r=l.get(n)?.items;r?l.delete(n):r=[{offset:n,length:e.length,className:e}];for(let e of r)e.className=e.className===`~`?i===`:`?`${m}${i}~`:m:e.className.replace(/^(!?)(.*)/,(e,t,n)=>`${t}${m}${i}${n}`),_.items.push(e)}o+=s.slice(u,e),o+=`$`.repeat(p.length),u=e+p.length}t&&(s=o+s.slice(u)),--n,t&&n&&(e=gi(s,r))}while(t&&n)}let u=[...l].sort(([e],[t])=>e-t),d;if(typeof e==`string`){d=``;let t=0;for(let[n,r]of u)d+=e.slice(t,n),d+=r.items.map(e=>e.className).join(` `),t=n+r.length;d+=e.slice(t)}else{d=e;for(let[e,t]of u){if(d.slice(e,e+t.length)!==o.slice(e,e+t.length))throw Error(`Cannot expand a variant group that overlaps an existing MagicString edit`);d.overwrite(e,e+t.length,t.items.map(e=>e.className).join(` `))}}return{prefixes:Array.from(c),hasChanged:a,groupsByOffset:new Map(u),get expanded(){return d.toString()}}}function bi(e,t){let n=new Map,r=di(t).sort((e,t)=>t.length-e.length),i=Qr(e).map(e=>{let t=r.find(t=>e.startsWith(t));if(!t)return e;let i=e.slice(t.length);if(n.has(t))return n.get(t).push(i),null;{let e=[i];return n.set(t,e),{prefix:t,items:e}}}).filter(Dr).map(e=>typeof e==`string`?e:`${e.prefix}(${e.items.join(` `)})`).join(` `);return i?`${/^\s/.test(e)?` `:``}${i}${/\s$/.test(e)?` `:``}`:e?` `:``}function xi(e,t=[`-`,`:`],n=5){let r=yi(e,t,n);return typeof e==`string`?r.expanded:e}const Si=new Set;function Ci(e){if(!Si.has(e)){Si.add(e);try{console.warn(`[Teacss]`,e)}catch(t){throw Si.delete(e),t}}}function wi(e,t,n){let r=e;for(;r!==null&&r!==Object.prototype&&!Object.hasOwn(r,t);)r=Object.getPrototypeOf(r);if(r!==null&&r!==Object.prototype){if(!Reflect.set(e,t,n))throw TypeError(`Cannot assign rule metadata "${String(t)}"`)}else Object.defineProperty(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0})}function Ti(e,t){let n=e;for(;n!==null&&n!==Object.prototype;){if(Object.hasOwn(n,t))return Reflect.get(e,t);n=Object.getPrototypeOf(n)}}function Ei(e,t){Object.defineProperty(e,e.length,{configurable:!0,enumerable:!0,value:t,writable:!0})}function Di(e){if(!Object.hasOwn(e,0)||!Object.hasOwn(e,1))throw TypeError(`[Teacss] invalid rule or shortcut entry: matcher and body must be own tuple values`);let t=[e[0],e[1],void 0],n=Object.hasOwn(e,2)?e[2]:void 0;if(n!==void 0){let e={...n},r=Object.hasOwn(e,`prefix`)?e.prefix:void 0;Array.isArray(r)&&wi(e,`prefix`,[...u(r)]),t[2]=e}return t}function Oi(e){let t=Object.create(null),n=[];for(let[r,i]of e.entries()){let e=Object.hasOwn(i,2)?i[2]:void 0;if(e===void 0)if(e={},Object.hasOwn(i,2)){if(!Reflect.set(i,2,e))throw TypeError(`Cannot assign rule metadata`)}else Object.defineProperty(i,2,{configurable:!0,enumerable:!0,value:e,writable:!0});if(wi(e,`__index`,r),Yr(i)){let n=u(Ti(e,`prefix`)??``);for(let e of n)t[e+i[0]]=i}else Ei(n,i)}return n.reverse(),{rulesSize:e.length,rulesDynamic:n,rulesStaticMap:t}}function ki(e){let t=u(e.rules).map(Di),n=Oi(t);e.rules=t,e.rulesSize=n.rulesSize,e.rulesDynamic=n.rulesDynamic,e.rulesStaticMap=n.rulesStaticMap}function q(e,t){return e!=null&&Object.hasOwn(e,t)?Reflect.get(e,t):void 0}function Ai(e,t){let n=e;for(;n!==null&&n!==Object.prototype&&n!==Array.prototype&&n!==Function.prototype;){if(Object.hasOwn(n,t))return Reflect.get(e,t);n=Object.getPrototypeOf(n)}}function ji(e,t){Object.defineProperty(e,e.length,{configurable:!0,enumerable:!0,value:t,writable:!0})}function Mi(e,t){for(let t=e.length;t>0;t--)Object.defineProperty(e,t,{configurable:!0,enumerable:!0,value:e[t-1],writable:!0});Object.defineProperty(e,0,{configurable:!0,enumerable:!0,value:t,writable:!0})}function Ni(e){let t=new Set,n=[];for(let r of e){let e=r.name;t.has(e)||(t.add(e),ji(n,r))}return n}function Pi(e){return Array.from(e,(e,t)=>({index:t,order:Ai(e,`order`)||0,value:e})).sort((e,t)=>e.order-t.order||e.index-t.index).map(({value:e})=>e)}function Fi(e,t){let n={...e};for(let e of Reflect.ownKeys(t)){if(!Object.getOwnPropertyDescriptor(t,e)?.enumerable)continue;let r=Reflect.get(t,e);r!==void 0&&Object.defineProperty(n,e,{value:r,configurable:!0,enumerable:!0,writable:!0})}return n}function Ii(e){return u(e).flatMap(e=>Array.isArray(e)?[e]:Object.entries(e))}const Li=new WeakSet;function Ri(e,t){let n={};for(let t of Reflect.ownKeys(e)){if(t===`name`||!Object.getOwnPropertyDescriptor(e,t)?.enumerable)continue;let r=Reflect.get(e,t);Object.defineProperty(n,t,{value:t===`prefix`&&Array.isArray(r)?[...u(r)]:r,configurable:!0,enumerable:!0,writable:!0})}return Object.defineProperty(n,"name",{value:t,configurable:!0,enumerable:!0,writable:!0}),n}async function zi(e){let t=typeof e==`function`?await e():await e;if(typeof t!=`object`||!t||Array.isArray(t))throw TypeError(`Invalid TeaCSS preset: expected an object, received ${t===null?`null`:Array.isArray(t)?`array`:typeof t}.`);let n=Object.hasOwn(t,`name`)?Reflect.get(t,`name`):void 0;if(typeof n!=`string`||n.trim()===``)throw TypeError(`Invalid TeaCSS preset: expected a non-empty string name.`);if(Li.has(t))return t;t=Ri(t,n),Li.add(t);let r=q(t,`shortcuts`),i=q(t,`rules`),a=r?Ii(r).map(Di):void 0;t.shortcuts=a,t.rules=i?u(i).map(Di):void 0;let o=q(t,`prefix`),s=q(t,`layer`);if(o||s){let e=e=>{e[2]||={};let t=e[2];Ai(t,`prefix`)==null&&o&&Object.defineProperty(t,"prefix",{configurable:!0,enumerable:!0,value:[...u(o)],writable:!0}),Ai(t,`layer`)==null&&s&&Object.defineProperty(t,"layer",{configurable:!0,enumerable:!0,value:s,writable:!0})};a?.forEach(e),t.rules?.forEach(e)}return t}async function Bi(e){return Vi(e,new Set)}async function Vi(e,t){if(t.has(e))throw TypeError(`Circular TeaCSS preset reference detected.`);let n=new Set(t);n.add(e);let r=await zi(e),i=q(r,`presets`);if(!i)return[r];let a=u(i).flatMap(e=>Array.isArray(e)?[...e]:[e]);return[r,...(await Promise.all(a.map(e=>Vi(e,n)))).flat()]}function Hi(e){if(e.length===0)return{};let t=[],n=[],r=!1,i=!1,a=[],o=[];for(let s of e){let e=q(s,`pipeline`),c=q(s,`filesystem`),l=q(s,`inline`),u=e&&q(e,`include`),d=e&&q(e,`exclude`);e===!1?(i=!0,r=!0):r||(e!==void 0&&(i=!0),u&&ji(t,u),d&&ji(n,d)),c&&ji(a,c),l&&ji(o,l)}let s={};return r?s.pipeline=!1:i&&(s.pipeline={},t.length&&(s.pipeline.include=d($i(...t))),n.length&&(s.pipeline.exclude=d($i(...n)))),a.length&&(s.filesystem=d(a.flatMap(e=>u(e)))),o.length&&(s.inline=d(o.flatMap(e=>u(e)))),s}async function Ui(e={},t={}){let n=Fi(t,e),r=q(n,`presets`)??[],i=Ni((await Promise.all(u(r).flatMap(e=>u(e)).map(e=>Bi(e)))).flat()),a=Array.from(i,e=>({enforce:q(e,`enforce`),preset:e})),o=[...a.filter(({enforce:e})=>e===`pre`),...a.filter(({enforce:e})=>e==null),...a.filter(({enforce:e})=>e===`post`)].map(({preset:e})=>e),s=[...o,n],c=[...s].reverse(),l=s.reduce((e,t)=>({...e,...q(t,`layers`)}),{...Se});function f(e){return d(s.flatMap(t=>u(q(t,e))))}let p=f(`extractors`),m=c.map(e=>q(e,`extractorDefault`)).find(e=>e!==void 0);m===void 0&&(m=mr),m&&!p.includes(m)&&Mi(p,m);let h=Pi(p),g=f(`rules`).map(Di),{rulesSize:_,rulesStaticMap:v,rulesDynamic:y}=Oi(g),b=s.map(e=>q(e,`autocomplete`)),x=e=>b.flatMap(t=>{let n=q(t,e);return n===void 0?[]:Array.isArray(n)?[...n]:[n]}),S={templates:d(x(`templates`)),extractors:Pi(x(`extractors`)),shorthands:Qi(b.map(e=>q(e,`shorthands`)||{}))},C=f(`separators`);C.length||(C=[`:`,`-`]);let w=Hi(f(`content`)),T=c.map(e=>q(e,`details`)).find(e=>e!==void 0),E=c.map(e=>q(e,`outputToCssLayers`)).find(e=>e!==void 0),D=c.map(e=>q(e,`sortLayers`)).find(e=>e!==void 0),O=q(n,`envMode`)||`build`,k={...n,mergeSelectors:q(n,`mergeSelectors`)??!0,warn:q(n,`warn`)??!0,unmatched:q(n,`unmatched`)??`off`,outputToCssLayers:E,sortLayers:D??(e=>e),blocklist:f(`blocklist`),presets:o,envMode:O,shortcutsLayer:q(n,`shortcutsLayer`)||`shortcuts`,layers:l,theme:Zi(s.map(e=>q(e,`theme`))),rules:g,rulesSize:_,rulesDynamic:y,rulesStaticMap:v,preprocess:f(`preprocess`),postprocess:f(`postprocess`),preflights:f(`preflights`),autocomplete:S,variants:Pi(f(`variants`).map(Tr)),shortcuts:Ii(f(`shortcuts`)).map(Di).reverse(),extractors:h,safelist:f(`safelist`),separators:C,details:T??O===`dev`,content:w,transformers:Ni(f(`transformers`))},A=f(`extendTheme`);for(let e of A)k.theme=e(k.theme,k)||k.theme;let j=!1;for(let e of s){let t=q(e,`configResolved`);t!=null&&(j=!0,t(k))}return j&&ki(k),k}function Wi(e){let t={};for(let n of Reflect.ownKeys(e))Object.getOwnPropertyDescriptor(e,n)?.enumerable&&Object.defineProperty(t,n,{configurable:!0,enumerable:!0,value:Reflect.get(e,n),writable:!0});return t}function Gi(e,t,n){return Object.hasOwn(t,n)?Reflect.get(t,n):q(e,n)}function Ki(e,t,n){Object.defineProperty(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0})}function qi(e){let t=Wi(e);if(Object.hasOwn(e,`templates`)){let n=Gi(e,t,`templates`);n===void 0?delete t.templates:Ki(t,`templates`,u(n))}if(Object.hasOwn(e,`extractors`)){let n=Gi(e,t,`extractors`);n===void 0?delete t.extractors:Ki(t,`extractors`,u(n))}if(Object.hasOwn(e,`shorthands`)){let n=Gi(e,t,`shorthands`);n===void 0?delete t.shorthands:Ki(t,`shorthands`,n)}return t}function Ji(e={},t={}){let n=q(e,`shorthands`),r=q(t,`shorthands`),i={...e},a={...t};delete i.shorthands,delete a.shorthands;let o=Gr(i,a,!0);return(n!==void 0||r!==void 0)&&Object.defineProperty(o,"shorthands",{configurable:!0,enumerable:!0,value:{...n??{},...r??{}},writable:!0}),o}function Yi(e){let t=Wi(e);if(Object.hasOwn(e,`entry`)){let n=Gi(e,t,`entry`);n===void 0?delete t.entry:Ki(t,`entry`,u(n))}return t}function Xi(e){let t=[`shortcuts`,`preprocess`,`postprocess`,`extendTheme`,`separators`];return u(e).map(e=>Object.entries(e).reduce((e,[n,r])=>{if(r===void 0)return e;let i=n===`autocomplete`&&r?qi(r):n===`cli`&&r?Yi(r):t.includes(n)?u(r):r;return{...e,[n]:i}},{})).reduce((e,t)=>{let n=q(e,`autocomplete`),r=q(t,`autocomplete`),i=q(e,`content`),a=q(t,`content`),o=q(e,`extractorDefault`),s=q(t,`extractorDefault`),c=q(e,`theme`),l=q(t,`theme`),u={...e},d={...t};delete u.autocomplete,delete u.content,delete u.extractorDefault,delete u.theme,delete d.autocomplete,delete d.content,delete d.extractorDefault,delete d.theme;let f=Gr(u,d,!0);return(n||r)&&Object.defineProperty(f,"autocomplete",{configurable:!0,enumerable:!0,value:Ji(n,r),writable:!0}),(c||l)&&Object.defineProperty(f,"theme",{configurable:!0,enumerable:!0,value:Zi([c,l]),writable:!0}),(i||a)&&Object.defineProperty(f,"content",{configurable:!0,enumerable:!0,value:Hi([i||{},a||{}]),writable:!0}),(o!==void 0||s!==void 0)&&Ki(f,`extractorDefault`,s===void 0?o:s),f},{})}function Zi(e){return e.reduce((e,t)=>{if(!t)return e;let n=Jr(t);if(!K(n))return n;if(!K(e)){if(!Reflect.ownKeys(n).some(e=>Object.getOwnPropertyDescriptor(n,e)?.enumerable))return e;if(Object.hasOwn(n,`$reset`)&&Reflect.get(n,`$reset`))return Gr({},n);throw TypeError(`[Teacss] cannot safely merge a plain theme into a non-plain theme; use extendTheme for a class-aware merge or $reset to replace it.`)}return Gr(e,n)},{})}function Qi(e){return e.reduce((e,t)=>{let n=Object.create(null);for(let e of Object.keys(t)){let r=t[e];if(Array.isArray(r)){let t=u(r);n[e]=t.length===1?t[0]??``:`(${t.join(`|`)})`}else n[e]=r}return{...e,...n}},{})}function $i(...e){return e.flatMap(e=>u(ea(e)))}function ea(e){return Array.isArray(e)?e:e?[e]:[]}function ta(e){return e}function na(){let e=typeof process<`u`&&!!process.stdout;return{isNode:e,isVSCode:e&&!!process.env.VSCODE_CWD,isESLint:e&&!!process.env.ESLINT}}var ra=`0.3.7`;const ia=Object.getOwnPropertyDescriptor(RegExp.prototype,`source`).get,aa=[[`d`,Object.getOwnPropertyDescriptor(RegExp.prototype,`hasIndices`)?.get],[`g`,Object.getOwnPropertyDescriptor(RegExp.prototype,`global`)?.get],[`i`,Object.getOwnPropertyDescriptor(RegExp.prototype,`ignoreCase`)?.get],[`m`,Object.getOwnPropertyDescriptor(RegExp.prototype,`multiline`)?.get],[`s`,Object.getOwnPropertyDescriptor(RegExp.prototype,`dotAll`)?.get],[`u`,Object.getOwnPropertyDescriptor(RegExp.prototype,`unicode`)?.get],[`v`,Object.getOwnPropertyDescriptor(RegExp.prototype,`unicodeSets`)?.get],[`y`,Object.getOwnPropertyDescriptor(RegExp.prototype,`sticky`)?.get]],oa=RegExp.prototype.exec;function J(e){return Reflect.apply(ia,e,[])}function Y(e){let t=``;for(let[n,r]of aa)r&&Reflect.apply(r,e,[])&&(t+=n);return t}const sa=/[a-zA-Z0-9_-]/;function ca(e,t){let n=e;for(;n!=null&&n!==Object.prototype&&n!==Array.prototype&&n!==Function.prototype;){if(Object.hasOwn(n,t))return Reflect.get(e,t);n=Object.getPrototypeOf(n)}}function la(e,t){if(t.length>0&&e.length>256/t.length)return null;let n=[];for(let r of e)for(let e of t)n.push(r+e);return n}function ua(e){let t=!1,n=0,r=!1;for(let i=1;i<e.length;i++){let a=e[i];if(t)t=!1;else if(a===`\\`)t=!0;else if(r)a===`]`&&(r=!1);else if(a===`[`)r=!0;else if(a===`(`)n++;else if(a===`)`)n>0&&n--;else if(a===`|`&&n===0)return!0}return!1}function da(e,t){return e[t]===`:`&&!/[?*+{]/.test(e[t+1]??``)}function fa(e){if(!e.startsWith(`^`)||ua(e))return null;let t=1;for(;t<e.length&&sa.test(e[t]);)t++;if(t>1&&da(e,t))return[e.slice(1,t)];let n=pa(e,1,`:`);if(!n||!da(e,n.end)||n.combos.some(e=>e.length===0||e.includes(`:`)))return null;let r=[...new Set(n.combos)];return r.length?r:null}function pa(e,t,n){let r=[``];for(;t<e.length;){let i=e[t];if(n.includes(i))break;if(sa.test(i)){let n=``;for(;t<e.length&&sa.test(e[t]);)n+=e[t++];r=r.map(e=>e+n);continue}let a=null;if(i===`(`)a=ma(e,t);else if(i===`[`)a=ha(e,t);else return null;if(!a)return null;t=a.end;let o=a.combos;if(e[t]===`?`)o=[``,...o],t++;else if(e[t]===`*`||e[t]===`+`||e[t]===`{`)return null;let s=la(r,o);if(!s)return null;r=s}return{combos:r,end:t}}function ma(e,t){if(t++,e.startsWith(`?:`,t))t+=2;else if(e[t]===`?`)return null;let n=[];for(;;){let r=pa(e,t,`|)`);if(!r||(n.push(...r.combos),n.length>256))return null;if(t=r.end,e[t]===`|`){t++;continue}return e[t]===`)`?{combos:n,end:t+1}:null}}function ha(e,t){if(t++,e[t]===`^`)return null;let n=[];for(;t<e.length&&e[t]!==`]`;){let r=e[t];if(r===`\\`||r===`-`||(n.push(r),n.length>256))return null;t++}return e[t]===`]`?{combos:n,end:t+1}:null}function ga(e){if(ca(e[2],`prefix`))return null;let[t]=e;return!(t instanceof RegExp)||Object.hasOwn(t,`exec`)||Object.getPrototypeOf(t)!==RegExp.prototype||t.exec!==oa||Y(t)?null:fa(J(t))}function _a(e){let t=e.map(e=>[e,ga(e)]),n=new Map;for(let[,e]of t)if(e!==null)for(let t of e)n.has(t)||n.set(t,[]);let r=[];for(let[e,i]of t){if(i===null){r.push(e);for(let t of n.values())t.push(e);continue}for(let t of i)n.get(t).push(e)}return{map:n,fallback:r}}const va=/^[a-z][a-z0-9-]*$/,ya=new Set([`about`,`blob`,`bun`,`chrome`,`data`,`deno`,`file`,`ftp`,`http`,`https`,`jsr`,`mailto`,`node`,`npm`,`tel`,`urn`,`vscode`,`virtual`,`ws`,`wss`]);function ba(e){let t=0,n;for(let r=0;r<e.length;r++){let i=e[r];if(n){i===`\\`?r++:i===n&&(n=void 0);continue}if(i===`"`||i===`'`)n=i;else if(i===`\\`)r++;else if(i===`[`||i===`(`)t++;else if(i===`]`||i===`)`)t--;else if(i===`@`&&t===0)return e.slice(0,r)}return e}function xa(e){let t=ba(e);if(!t||t.startsWith(`$`)||t.startsWith(`[`))return!1;let n=t.indexOf(`:`);if(n<=0||n===t.length-1)return!1;let r=t.slice(0,n);return!va.test(r)||t.startsWith(`//`,n+1)?!1:!ya.has(r)}function Sa(e){if(e.flags)return;let t=e.source;if(!t.startsWith(`^`))return;let n=1;for(;n<t.length&&/[A-Za-z0-9_-]/.test(t[n]);)n++;return t[n]===`:`&&n>1?t.slice(1,n):void 0}const Ca=new WeakMap;function wa(e){let t=Ca.get(e.rulesStaticMap);if(t)return t;let n=new Map,r=new Set;for(let t of Object.keys(e.rulesStaticMap)){let e=t.indexOf(`:`);if(e<=0)continue;let r=t.slice(0,e),i=n.get(r);i||(i=new Set,n.set(r,i)),i.add(t.slice(e+1))}for(let t of e.rulesDynamic){let e=Sa(t[0]);e!=null&&!n.has(e)&&r.add(e)}let i={prefixValues:n,dynamicPrefixes:r};return Ca.set(e.rulesStaticMap,i),i}function Ta(e,t,n){if(e===t)return 0;if(Math.abs(e.length-t.length)>n)return 1/0;let r=Array.from({length:t.length+1},(e,t)=>t);for(let i=1;i<=e.length;i++){let a=[i],o=i;for(let n=1;n<=t.length;n++){let s=e[i-1]===t[n-1]?0:1;a[n]=Math.min(r[n]+1,a[n-1]+1,r[n-1]+s),a[n]<o&&(o=a[n])}if(o>n)return 1/0;r=a}return r[t.length]<=n?r[t.length]:1/0}function Ea(e,t){let n=Math.min(e.length,t.length),r=0;for(;r<n&&e[r]===t[r];)r++;return r}function Da(e,t,n){let r=Ta(e,t,2);if(r!==1/0)return r;let i=e.length<=t.length?e:t,a=e.length<=t.length?t:e;if(i.length>=n&&(a.startsWith(i)||a.endsWith(i)||a.includes(i)))return 3+(a.length-i.length)/100;if(Ea(e,t)>=n)return 5+Math.abs(e.length-t.length)/100}function Oa(e,t){let n=ba(e),r=n.indexOf(`:`);if(r<=0)return;let i=n.slice(0,r),a=n.slice(r+1),{prefixValues:o,dynamicPrefixes:s}=wa(t),c=[];if(o.has(i)||s.has(i))for(let e of o.get(i)??[]){if(e===a)continue;let t=Da(a,e,3);t!==void 0&&c.push({suggestion:`${i}:${e}`,score:t})}else{if(i.length<3)return;let e=new Set([...o.keys(),...s]);for(let t of e){let e=Da(i,t,4);if(e===void 0)continue;let n=o.get(t)?.has(a)||s.has(t);c.push({suggestion:`${t}:${a}`,score:n?e:e+10})}if(c.length===0)return}c.sort((e,t)=>e.score-t.score||(e.suggestion<t.suggestion?-1:1));let l=new Set,u=[];for(let{suggestion:e}of c)if(!(l.has(e)||e===n)&&(l.add(e),u.push(e),u.length===3))break;return u}const X=Object.freeze({shortcutsNoMerge:Symbol.for(`@teacss/core/shortcut-no-merge`),noMerge:Symbol.for(`@teacss/core/no-merge`),noScope:Symbol.for(`@teacss/core/no-scope`),variants:Symbol.for(`@teacss/core/variants`),parent:Symbol.for(`@teacss/core/parent`),selector:Symbol.for(`@teacss/core/selector`),layer:Symbol.for(`@teacss/core/layer`),sort:Symbol.for(`@teacss/core/sort`),body:Symbol.for(`@teacss/core/body`)});function ka(e){let t=e.match(/\(\s*min-width\s*:\s*([\d.]+)(px|rem|em)?\s*\)/i);if(t)return Aa(t[1],t[2]);let n=e.match(/\(\s*max-width\s*:\s*([\d.]+)(px|rem|em)?\s*\)/i);return n?-Aa(n[1],n[2]):null}function Aa(e,t){let n=Number.parseFloat(e),r=t?.toLowerCase();return r===`rem`||r===`em`?n*16:n}function ja(e,t){return e<t?-1:+(e>t)}function Ma(e,t){return ja(e??``,t??``)}function Z(e,t){Object.defineProperty(e,e.length,{configurable:!0,enumerable:!0,value:t,writable:!0})}function Na(e,t){for(let n of t)Z(e,n)}function Pa(e,t){for(let t=e.length;t>0;t--)Object.hasOwn(e,t-1)?Object.defineProperty(e,t,{configurable:!0,enumerable:!0,value:e[t-1],writable:!0}):delete e[t];Object.defineProperty(e,0,{configurable:!0,enumerable:!0,value:t,writable:!0})}function Fa(e){let t=new hr;for(let n of e)t.setCount(n,e.getCount(n));return t}function Ia(e){return G(e)?Fa(e):new Set(e)}function La(e,t,n){if(G(e)&&G(t)&&G(n)){let r=new Set([...t,...n]);for(let i of r){let r=e.getCount(i)+n.getCount(i)-t.getCount(i);r>0?e.setCount(i,r):e.delete(i)}return}for(let r of t)n.has(r)||e.delete(r);for(let r of n)t.has(r)||e.add(r)}function*Ra(e,t){for(let n=0;n<e.length;n++){let r=t[n];r!=null&&(yield[e[n],r])}}function za(e){if(e!==void 0&&(!Number.isSafeInteger(e)||e<1))throw RangeError(`tokenConcurrency must be a positive integer`)}function Ba(e,t){return Object.hasOwn(e,t)?Reflect.get(e,t):void 0}function Q(e,t){let n=e;for(;n!==null&&n!==Object.prototype&&n!==Array.prototype&&n!==Function.prototype;){if(Object.hasOwn(n,t))return Reflect.get(e,t);n=Object.getPrototypeOf(n)}}function Va(e,t){if(Object.hasOwn(e,t))return Reflect.get(e,t);let n=Object.getPrototypeOf(e);if(n===null||n===Object.prototype)return;let r=Object.getOwnPropertyDescriptor(n,`constructor`)?.value;if(typeof r==`function`&&r!==Object)for(;n!==null&&n!==Object.prototype;){if(Object.hasOwn(n,t))return Reflect.get(e,t);n=Object.getPrototypeOf(n)}}function $(e,t){return e?Q(e,t):void 0}function Ha(e,t){return Ba(e,t)}function Ua(e){return{body:Q(e,`body`),handle:Q(e,`handle`),layer:Q(e,`layer`),order:Q(e,`order`),parent:Q(e,`parent`),selector:Q(e,`selector`),sort:Q(e,`sort`),source:e}}async function Wa(e,t,n){if(t===void 0||t>=e.length)return await Promise.all(e.map(n));let r=Array(e.length),i=0,a=!1,o=Array.from({length:Math.min(t,e.length)},async()=>{for(;!a&&i<e.length;){let t=i++;try{let i=await n(e[t]);Object.defineProperty(r,t,{configurable:!0,enumerable:!0,value:i,writable:!0})}catch(e){throw a=!0,e}}});return await Promise.all(o),r}function Ga(e,t){return e?.replaceAll(Ro(t),`&`)}function Ka(e,t){let n=t.exec,r=Y(t);if(!r.includes(`g`)&&!r.includes(`y`))return n.call(t,e);if(Object.getOwnPropertyDescriptor(t,`lastIndex`)?.writable===!1){if(n!==oa)return n.call(t,e);let i=new RegExp(J(t),r);return oa.call(i,e)}t.lastIndex=0;try{return n.call(t,e)}finally{Object.getOwnPropertyDescriptor(t,`lastIndex`)?.writable!==!1&&(t.lastIndex=0)}}function qa(e,t,n,r){let i=u(e).filter(Ja),a=u(n).filter(Ja);if(i.length!==a.length)return!1;for(let e=0;e<i.length;e++){let n=i[e],o=a[e];if(n[2]!==o[2]||Ga(n[1],t)!==Ga(o[1],r)||n[3]!==o[3]||$(n[4],`layer`)!==$(o[4],`layer`)||$(n[4],`sort`)!==$(o[4],`sort`)||!!$(n[4],`noScope`)!=!!$(o[4],`noScope`)||!!(n[6]??$(n[4],`noMerge`))!=!!(o[6]??$(o[4],`noMerge`)))return!1}return!0}function Ja(e){return Array.isArray(e)&&Object.hasOwn(e,0)&&Object.hasOwn(e,1)&&Object.hasOwn(e,2)&&Object.hasOwn(e,3)&&Object.hasOwn(e,4)&&Object.hasOwn(e,5)&&Object.hasOwn(e,6)}function Ya(e){return Object.hasOwn(e,0)&&e[0]===X.shortcutsNoMerge}function Xa(e){for(let t=e.length-1;t>=0;t--){if(!Object.hasOwn(e,t))continue;let n=e[t];if(Ya(n))return Object.hasOwn(n,1)?n[1]:void 0}}function Za(e,t){let n=[...e,...t],r=[];for(let e=t.length-1;e>=0;e--)ue(t[e])&&Z(r,t[e]);for(let t=e.length-1;t>=0;t--)ue(e[t])&&Z(r,e[t]);if(r.length<2)return n;let i=r[0];for(let e=1;e<r.length;e++)i=de(i,r[e])??i;let a=[],o=!1;for(let e of n)ue(e)?o||=(Z(a,i),!0):Z(a,e);return a}function Qa(e){let t;for(let n of e)n.includes(`{`)&&(t??=[],t.push(n));if(!t)return e;for(let n of t){let t=Qr(hn(n));if(t.length===1&&t[0]===n)continue;let r=G(e)?e.getCount(n):1;e.delete(n);for(let n of t)G(e)?e.setCount(n,e.getCount(n)+r):e.add(n)}return e}const $a=/(?<!\\)::?-[a-zA-Z]/;function eo(e){let t=new Map,n=new Map,r=0,i;for(let a of e){let[o,s,c]=a;if(i!==void 0&&s!==i&&(t.clear(),n.clear()),i=s,c){e[r++]=a;continue}let l=o.length>0,u=l?t:n,d=u.get(s);if(!d){u.set(s,a),e[r++]=a;continue}l&&Na(d[0],o)}e.length=r}function to(e,t,n){let r=(e.get(t)??0)-(e.get(n)??0);if(r)return r;let i=ka(t),a=ka(n);return i!=null&&a!=null&&i!==a?i-a:ja(t,n)}function no(e,t,n=``){let r=ro(e);return`${r.join(`{`)}{${n}${t}${n}${`}`.repeat(r.length)}`}function ro(e){let t=[],n=0,r=!1,i=0,a,o=0;for(let s=0;s<e.length;s++){let c=e[s];r?c===`*`&&e[s+1]===`/`&&(r=!1,s++):a?c===`\\`?s++:c===a&&(a=void 0):c===`/`&&e[s+1]===`*`?(r=!0,s++):c===`"`||c===`'`?a=c:c===`(`?i++:c===`)`?i>0&&i--:c===`[`?n++:c===`]`?n>0&&n--:n===0&&i===0&&e.startsWith(` $$ `,s)&&(Z(t,e.slice(o,s)),s+=3,o=s+1)}return Z(t,e.slice(o)),t}function io(e){let t=[],n=!1,r;for(let i=0;i<e.length;i++){let a=e[i];if(n){a===`*`&&e[i+1]===`/`&&(n=!1,i++);continue}if(r){a===`\\`?i++:a===r&&(r=void 0);continue}if(a===`/`&&e[i+1]===`*`){n=!0,i++;continue}if(a===`\\`){i++;continue}if(a===`"`||a===`'`){r=a;continue}if(!/\s/.test(a)||e[i+1]!==`$`||e[i+2]!==`$`||!/\s/.test(e[i+3]??``))continue;let o=i+4;for(;o<e.length&&/\s/.test(e[o]);)o++;Z(t,[i,o]),i=o-1}return t}function ao(e,t){let n=io(e);if(!n.length)return e;let r=0,i=``;for(let[a,o]of n)i+=e.slice(r,a),i+=a===0||e[a-1]===`{`||e[a-1]===`,`?t?`${t} `:``:t?` ${t} `:` `,r=o;return i+e.slice(r)}const oo=new Set([Function.prototype,Object.getPrototypeOf(async()=>{}),Object.getPrototypeOf(function*(){}),Object.getPrototypeOf(async function*(){})]),so=new Set([`arguments`,`caller`,`length`,`name`,`prototype`]);function co(e){return Reflect.ownKeys(e).every(e=>so.has(e))}function lo(e){let t=e;for(;t!==null;){let e=Object.getOwnPropertyDescriptor(t,`exec`);if(e)return{configurable:!!e.configurable,enumerable:!!e.enumerable,get:`get`in e?e.get:void 0,owner:t,set:`set`in e?e.set:void 0,value:`value`in e?e.value:void 0,writable:`value`in e?!!e.writable:void 0};t=Object.getPrototypeOf(t)}}function uo(e,t){let n=lo(e);return n?.owner===t?.owner&&n?.configurable===t?.configurable&&n?.enumerable===t?.enumerable&&n?.get===t?.get&&n?.set===t?.set&&n?.value===t?.value&&n?.writable===t?.writable}function fo(e){return Reflect.ownKeys(e).every(e=>e===`lastIndex`)}function po(e,t=new WeakMap,n={}){if(e===null||typeof e!=`object`&&typeof e!=`function`)return{kind:`primitive`,value:e};if(n.functionsByIdentity&&typeof e==`function`)return{complete:co(e),kind:`identity`,value:e};if(n.ignoreRegExpLastIndex&&e instanceof RegExp){let t=lo(e);return{complete:t?.owner===RegExp.prototype&&t.value===oa&&Object.getPrototypeOf(e)===RegExp.prototype&&fo(e),exec:t,flags:Y(e),kind:`regexp-identity`,source:J(e),value:e}}let r=t.get(e);if(r)return r;let i=Object.getPrototypeOf(e),a=i===RegExp.prototype?e:void 0,o={complete:i===null||i===Object.prototype||i===Array.prototype||oo.has(i)||i===RegExp.prototype,kind:`object`,properties:[],prototype:i,regexpFlags:a&&Y(a),regexpSource:a&&J(a),value:e};t.set(e,o);for(let r of Reflect.ownKeys(e)){if(n.ignoreRegExpLastIndex&&a&&r===`lastIndex`)continue;let i=Object.getOwnPropertyDescriptor(e,r);if(!i)continue;let s={configurable:!!i.configurable,enumerable:!!i.enumerable,key:r};if(`value`in i){s.value=po(i.value,t,n),ho(s.value)||(o.complete=!1);try{let a=Reflect.get(e,r);s.observedValue=po(a,t,n),(!Object.is(a,i.value)||!ho(s.observedValue))&&(o.complete=!1)}catch{o.complete=!1}s.writable=!!i.writable}else o.complete=!1,s.get=i.get,s.set=i.set;Z(o.properties,s)}return o}function mo(e,t,n=new Map){if(t.kind===`primitive`)return Object.is(e,t.value);if(t.kind===`identity`)return e===t.value&&(!t.complete||co(t.value));if(t.kind===`regexp-identity`)return e===t.value&&e instanceof RegExp&&uo(e,t.exec)&&J(e)===t.source&&Y(e)===t.flags&&(!t.complete||fo(e));if(e!==t.value||e===null||typeof e!=`object`&&typeof e!=`function`||Object.getPrototypeOf(e)!==t.prototype||t.regexpSource!==void 0&&(J(e)!==t.regexpSource||Y(e)!==t.regexpFlags))return!1;let r=n.get(t);if(r)return r===e;n.set(t,e);let i=Reflect.ownKeys(e).filter(e=>!(t.regexpSource!==void 0&&e===`lastIndex`&&!t.properties.some(t=>t.key===e)));if(i.length!==t.properties.length)return!1;for(let r=0;r<i.length;r++){let a=t.properties[r],o=i[r];if(o!==a.key)return!1;let s=Object.getOwnPropertyDescriptor(e,o);if(!s||!!s.configurable!==a.configurable||!!s.enumerable!==a.enumerable)return!1;if(`value`in s){if(a.value===void 0||!!s.writable!==a.writable||!mo(s.value,a.value,n))return!1;if(a.observedValue!==void 0){let t;try{t=Reflect.get(e,o)}catch{return!1}if(!mo(t,a.observedValue,n))return!1}}else if(a.value!==void 0||s.get!==a.get||s.set!==a.set)return!1}return!0}function ho(e){return e.kind===`primitive`||e.complete}function go(e){let t=Array(e.length);for(let n=0;n<e.length;n++){if(!Object.hasOwn(e,n))continue;let r=e[n],i=Object.hasOwn(r,2),a=i?r[2]:void 0,o=po(r[0],void 0,{functionsByIdentity:!0,ignoreRegExpLastIndex:!0}),s={body:r[1],bodySnapshot:po(r[1],void 0,{functionsByIdentity:!0,ignoreRegExpLastIndex:!0}),matcherFlags:r[0]instanceof RegExp?Y(r[0]):void 0,matcherSnapshot:o,matcherSource:r[0]instanceof RegExp?J(r[0]):void 0,matcher:r[0],meta:a,metaOwn:i,metaSnapshot:po(a,void 0,{functionsByIdentity:!0,ignoreRegExpLastIndex:!0}),rule:r};Object.defineProperty(t,n,{configurable:!0,enumerable:!0,value:s,writable:!0})}return t}function _o(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++){let r=Object.hasOwn(e,n);if(r!==Object.hasOwn(t,n))return!1;if(!r)continue;let i=e[n],a=t[n],o=Object.hasOwn(i,2),s=o?i[2]:void 0;if(!Object.hasOwn(i,0)||!Object.hasOwn(i,1)||o!==a.metaOwn||i!==a.rule||i[0]!==a.matcher||i[1]!==a.body||s!==a.meta||!mo(i[0],a.matcherSnapshot)||i[0]instanceof RegExp&&(J(i[0])!==a.matcherSource||Y(i[0])!==a.matcherFlags)||!mo(i[1],a.bodySnapshot)||!mo(s,a.metaSnapshot))return!1}return!0}function vo(e){for(let t=0;t<e.length;t++){if(!Object.hasOwn(e,t))continue;let{bodySnapshot:n,matcherSnapshot:r,metaSnapshot:i}=e[t];if(!ho(n)||!ho(r)||!ho(i))return!1}return!0}const yo=[`blocklist`,`details`,`envMode`,`extractors`,`layers`,`mergeSelectors`,`outputToCssLayers`,`postprocess`,`preflights`,`preprocess`,`safelist`,`separators`,`shortcuts`,`shortcutsLayer`,`sortLayers`,`theme`,`unmatched`,`variants`,`warn`];function bo(e,t,n={}){let r=po(e[t],void 0,n);return{complete:ho(r),isCurrent:e=>mo(e[t],r),key:t}}function xo(e,t){let n=e;for(;n!==null&&n!==Object.prototype&&n!==Array.prototype&&n!==Function.prototype;){let e=Object.getOwnPropertyDescriptor(n,t);if(e)return{descriptor:e,owner:n};n=Object.getPrototypeOf(n)}}function So(e,t){let n=xo(e,t);if(!n)return{complete:!0,value:po(void 0)};let{descriptor:r,owner:i}=n;if(!(`value`in r))return{complete:!1,configurable:!!r.configurable,enumerable:!!r.enumerable,get:r.get,owner:i,set:r.set};let a=po(r.value,void 0,{functionsByIdentity:!0,ignoreRegExpLastIndex:!0});return{complete:ho(a),configurable:!!r.configurable,enumerable:!!r.enumerable,owner:i,value:a,writable:!!r.writable}}function Co(e,t,n){let r=xo(e,t);if(!r)return n.owner===void 0&&n.value!==void 0&&mo(void 0,n.value);let{descriptor:i,owner:a}=r;return a!==n.owner||!!i.configurable!==n.configurable||!!i.enumerable!==n.enumerable?!1:`value`in i?n.value!==void 0&&!!i.writable===n.writable&&mo(i.value,n.value):n.value===void 0&&i.get===n.get&&i.set===n.set}function wo(e,t,n){let r=e[t];if(!Array.isArray(r))return bo(e,t,{functionsByIdentity:!0,ignoreRegExpLastIndex:!0});let i=Array.from({length:r.length},(e,t)=>{let i=Object.hasOwn(r,t),a=i?r[t]:void 0;return{entry:a,own:i,values:i&&a!=null&&(typeof a==`object`||typeof a==`function`)?n.map(e=>So(a,e)):n.map(()=>So(Object.create(null),``))}}),a=new Set(n),o=i.every(({entry:e,own:t,values:n})=>{if(!t||e==null||typeof e!=`object`&&typeof e!=`function`)return!0;let r=Object.getPrototypeOf(e);return(r===Object.prototype||r===null)&&Reflect.ownKeys(e).every(e=>a.has(e))&&n.every(e=>e.complete)});return{complete:o,isCurrent(e){let s=e[t];if(s!==r||!Array.isArray(s)||s.length!==i.length)return!1;for(let e=0;e<i.length;e++){let t=i[e];if(Object.hasOwn(s,e)!==t.own)return!1;if(!t.own)continue;let r=s[e];if(r!==t.entry)return!1;if(r!=null&&(typeof r==`object`||typeof r==`function`)){if(o&&(Object.getPrototypeOf(r)!==Object.prototype&&Object.getPrototypeOf(r)!==null||!Reflect.ownKeys(r).every(e=>a.has(e))))return!1;for(let e=0;e<n.length;e++)if(!Co(r,n[e],t.values[e]))return!1}}return!0},key:t}}function To(e,t,n){let r=e[t];if(r==null||typeof r!=`object`&&typeof r!=`function`)return{complete:!0,isCurrent:e=>Object.is(e[t],r),key:t};let i=n.map(e=>So(r,e)),a=new Set(n),o=Object.getPrototypeOf(r),s=(o===Object.prototype||o===null)&&Reflect.ownKeys(r).every(e=>a.has(e))&&i.every(e=>e.complete);return{complete:s,isCurrent(e){let o=e[t];return o!==r||o==null||typeof o!=`object`&&typeof o!=`function`||s&&(Object.getPrototypeOf(o)!==Object.prototype&&Object.getPrototypeOf(o)!==null||!Reflect.ownKeys(o).every(e=>a.has(e)))?!1:n.every((e,t)=>Co(o,e,i[t]))},key:t}}function Eo(e){return yo.map(t=>{switch(t){case`extractors`:return wo(e,t,[`name`,`order`,`extract`]);case`preflights`:return wo(e,t,[`getCSS`,`layer`]);case`variants`:return wo(e,t,[`match`,`multiPass`,`order`]);case`outputToCssLayers`:return To(e,t,[`allLayers`,`cssLayerName`]);case`shortcuts`:{let n=e.shortcuts,r=go(n);return{complete:vo(r),isCurrent:t=>t.shortcuts===e.shortcuts&&_o(t.shortcuts,r),key:t}}case`sortLayers`:return bo(e,t,{functionsByIdentity:!0,ignoreRegExpLastIndex:!0});case`blocklist`:case`postprocess`:case`preprocess`:case`safelist`:return bo(e,t,{functionsByIdentity:!0,ignoreRegExpLastIndex:!0});default:return bo(e,t)}})}function Do(e,t){return t.every(t=>t.isCurrent(e))}function Oo(e){return e.every(({complete:e})=>e)}function ko({authoredOutputOrders:e,config:t,currentSelectors:n,layerSet:r,matched:i,minify:a,parentOrders:o,preflights:s,preflightsMap:c,scope:l,sheet:f,shortcutMergeOrders:p,resolveUnmatched:m}){let h=a?``:`
|
|
20
|
+
`,g={...t.layers},_=t.mergeSelectors,v=t.sortLayers,y=e=>Object.hasOwn(g,e)?g[e]??0:0,b=e=>u(v.call(t,e.sort((e,t)=>y(e)-y(t)||ja(e,t)))).map(e=>e),x=b(Array.from(r)),S=Object.create(null),C=r.size===1?r.values().next().value:void 0,w,T,E=t.outputToCssLayers,D=typeof E==`object`?Va(E,`cssLayerName`):void 0,O=typeof E==`object`&&Va(E,`allLayers`)?b(Object.keys(g)):void 0,k=new Map,A=e=>{let t=k.get(e);if(t!==void 0||k.has(e))return t;let n=e;D&&typeof E==`object`&&(n=D.call(E,e));let r=n===null?null:n??e;return k.set(e,r),r};if(E)for(let e of d([...x,...O??[]]))A(e);let j=t=>{let r=(e,t)=>e.ruleIndex-t.ruleIndex||e.sort-t.sort||Ma(e.currentSelector,t.currentSelector)||Number(t.noScope)-Number(e.noScope)||Number(t.noMerge)-Number(e.noMerge)||Ma(e.selector,t.selector)||Ma(e.body,t.body)||0,i=(e,t)=>e.ruleIndex===t.ruleIndex&&e.sort===t.sort,a=[],o=new Map,s=t.flatMap(e=>p.get(e)?.components??[e]);for(let t of s){let s={authored:e.get(t),body:t[2],currentSelector:n.get(t)??t[5]?.currentSelector,item:t,noMerge:!!(t[6]??$(t[4],`noMerge`)),noScope:!!$(t[4],`noScope`),ruleIndex:t[0],selector:t[1],sort:$(t[4],`sort`)||0},c=s.authored?.group;if(!c){Z(a,{authoredGroup:void 0,records:[s],representative:s});continue}let l=o.get(c),u=l?.find(e=>i(e.records[0],s));if(u)Z(u.records,s),r(s,u.representative)<0&&(u.representative=s);else{let e={authoredGroup:c,records:[s],representative:s};Z(a,e),l?Z(l,e):o.set(c,[e])}}for(let e of a)e.authoredGroup&&e.records.sort((e,t)=>e.authored.index-t.authored.index||r(e,t));a.sort((e,t)=>{let n=r(e.representative,t.representative);if(n)return n;let i=[...e.records].sort(r),a=[...t.records].sort(r),o=Math.min(i.length,a.length);for(let e=0;e<o;e++){let t=r(i[e],a[e]);if(t)return t}if(i.length!==a.length)return i.length-a.length;for(let n=0;n<e.records.length;n++){let i=r(e.records[n],t.records[n]);if(i)return i}return 0});let c=a.flatMap(e=>e.records.map(e=>e.item)),l=new Map;for(let e=0;e<c.length;e++){let t=c[e];l.set(t,e)}let u=new Set;for(let e of c){let t=p.get(e),n=t?.components;if(!t?.flatten||!t.original||!n?.length||u.has(t.group))continue;let r=l.get(n[0]);r!==void 0&&n.every((e,t)=>c[r+t]===e)&&u.add(t.group)}let d=new Set,f=[];for(let e of c){let t=p.get(e);if(!t||!u.has(t.group)){Z(f,e);continue}d.has(t.group)||(d.add(t.group),Z(f,t.original))}return f},M=()=>{if(T)return T;let e=new Map,t=Array.from(f).sort((e,t)=>to(o,e[0]||``,t[0]||``));for(let[n,r]of t)for(let t of r){let r=$(t[4],`layer`)||`utilities`,i=e.get(r),a=i?.[i.length-1];a?.[0]===n?Z(a[1],t):i?Z(i,[n,[t]]):e.set(r,[[n,[t]]])}return f.clear(),T=e,e},N=e=>{if(C===void 0)return M().get(e)||[];if(e!==C)return[];if(w)return w;let t=Array.from(f).sort((e,t)=>to(o,e[0]||``,t[0]||``));return f.clear(),w=t,t},P=(e=xe)=>{if(Object.hasOwn(S,e))return S[e];let t=N(e).map(([e,t])=>{let n=[];for(let[,e,r,,i,,a]of j(t)){if(e===``)continue;let t=$(i,`noScope`)?void 0:l,o=e&&Io(e,t);Z(n,[o==null?[]:[[o,$(i,`sort`)??0]],r,!!(a??$(i,`noMerge`))||o!=null&&$a.test(o)])}if(!n.length)return;_&&eo(n);let r=[];for(let e=n.length-1;e>=0;e--){let[t,i]=n[e],a=t.length===1?t[0][0]:``;if(t.length>1){t.sort((e,t)=>e[1]-t[1]||Ma(e[0],t[0]));let e=new Set,n=[];for(let[r]of t)!r||e.has(r)||(e.add(r),Z(n,r));a=n.join(`,${h}`)}let o=a?`${a}{${i}}`:i;o&&Z(r,o)}let i=Array.from(new Set(r)).reverse().join(h);return e?no(e,i,h):i}).filter(Boolean).join(h);s&&(t=[c[e],t].filter(Boolean).join(h));let n;E&&t&&(n=A(e),n!==null&&(t=`@layer ${n}{${h}${t}${h}}`));let r=a?``:`/* layer: ${e}${n&&n!==e?`, alias: ${n}`:``} */${h}`;return S[e]=t?r+t:``},F=(e=x,t)=>{let n=u(e).map(e=>e),r=new Set(u(t).map(e=>e)),i=n.filter(e=>!r.has(e)),a=i.map(P).filter(Boolean);if(E){let e=i;O&&(e=O);let t=d(e.map(A).filter(Dr));t.length>0&&Pa(a,`@layer ${t.join(`, `)};`)}return a.join(h)},ee=async(e,t)=>{let n=await t(P(e));return S[e]=n,n},I;return{get css(){return F()},layers:[...x],matched:i,getLayers:F,getLayer:P,setLayer:ee,get diagnostics(){return I??={unmatched:m()},I}}}var Ao=class e{userConfig;defaults;version=ra;events=_r();config=void 0;cache=new te(F,void 0,!0);blocked=new ne(F,void 0,!0);_warnedUnmatched=new ne(F);parentOrders=new Map;activatedRules=new Set;_dynamicIndex;_contextConfigs=new WeakMap;_expansionPrefixes=new WeakMap;_generationContexts=new WeakSet;_configVersion=0;_collectionGeneration=0;_preparedConfigs=new WeakSet;_indexedRules;_indexedRuleSnapshot;_preparedCacheSnapshot;_preparedConfigMutable=!1;_preparedCacheReliable=!0;_startingGenerationParse=0;_runtimeRevision=0;_variantCacheOwner={};_initialization;_constructedCSSResults=new WeakMap;_constructedCSSSequence=0;_parsedOutputOrders=new WeakMap;_rawUtilMetadata=new WeakMap;_stringifiedCurrentSelectors=new WeakMap;_stringifiedOutputOrders=new WeakMap;_stringifiedParentOrders=new WeakMap;_shortcutMergeOrders=new WeakMap;_utilParentOrders=new WeakMap;reportConfigObserverErrors(e){console.error(`[@teacss/core] Configuration observer failed:`,AggregateError(e,`Configuration observers failed`))}dispatchConfig(e){let t=Object.hasOwn(this.events.events,`config`)?this.events.events.config:void 0,n=Array.isArray(t)?u(t).map(e=>e):[],r=[];for(let t of n)try{let n=t(e);Or(n)&&Promise.resolve(n).catch(e=>{this.reportConfigObserverErrors([e])})}catch(e){Z(r,e)}r.length&&this.reportConfigObserverErrors(r)}clearRuntimeCaches(e){e&&this._runtimeRevision++,this._variantCacheOwner={},this.blocked.clear(),this._warnedUnmatched.clear(),this.parentOrders.clear(),this.activatedRules.clear(),this.cache.clear()}ensureRuleIndexesCurrent(e=!1){let t=!1,n=!1,r=!0;this._preparedConfigMutable&&e&&this._preparedCacheSnapshot&&(Do(this.config,this._preparedCacheSnapshot)||(n=!0,this._preparedCacheSnapshot=Eo(this.config),t=!0),r=Oo(this._preparedCacheSnapshot));let i=this._indexedRules===this.config.rules;if(!e&&i)return;let a=i&&!!this._indexedRuleSnapshot&&_o(this.config.rules,this._indexedRuleSnapshot);(!i||!a)&&(n||=!!this._indexedRules,ki(this.config),this._indexedRules=this.config.rules,this._indexedRuleSnapshot=go(this.config.rules),this._dynamicIndex=void 0,t=!0),this._preparedConfigMutable&&(r=r&&!!this._indexedRuleSnapshot&&vo(this._indexedRuleSnapshot),this._preparedCacheReliable=r),t&&this.clearRuntimeCaches(n)}collectParentOrders(e,t){for(let n of u(e).filter(Ja)){let e=n[3],r=this._stringifiedParentOrders.get(n);if(e!=null&&r!=null){let n=t.get(e);(n===void 0||r<n)&&t.set(e,r)}}}transferOutputOrder(e,t){let n=this._parsedOutputOrders.get(e);n&&this._stringifiedOutputOrders.set(t,n)}recordStringifiedContext(e,t){t?.currentSelector!==void 0&&this._stringifiedCurrentSelectors.set(e,t.currentSelector)}copyStringifiedUtil(e,t,n=!1){let r=e[4],i;if(r){let e=Object.getOwnPropertyDescriptors(r);if(n)for(let t of Reflect.ownKeys(e)){let n=Object.getOwnPropertyDescriptor(r,t);if(!n){delete e[t];continue}let i=`value`in n?n.value:Reflect.get(r,t);e[t]={configurable:!!n.configurable,enumerable:!!n.enumerable,value:i,writable:!0}}let t=e.prefix;t&&`value`in t&&Array.isArray(t.value)&&(t.value=[...u(t.value)]);let a=e.autocomplete;a&&`value`in a&&Array.isArray(a.value)&&(a.value=[...u(a.value)]),i=Object.defineProperties(Object.create(null),e)}let a=e[5],o=a?{...a,theme:Jr(a.theme),variantHandlers:[...u(a.variantHandlers)],variantMatch:[a.variantMatch[0],a.variantMatch[1],[...u(a.variantMatch[2])],new Set(a.variantMatch[3])]}:void 0;a&&o&&(Object.hasOwn(a,`rules`)?o.rules=a.rules?Jr(u(a.rules)):a.rules:delete o.rules,Object.hasOwn(a,`shortcuts`)?o.shortcuts=a.shortcuts?Jr(u(a.shortcuts)):a.shortcuts:delete o.shortcuts,Object.hasOwn(a,`variants`)?o.variants=a.variants?Jr(u(a.variants)):a.variants:delete o.variants);let s=[e[0],e[1],e[2],e[3],i,o,e[6]];if(t){let t=this._stringifiedCurrentSelectors.get(e);t!==void 0&&this._stringifiedCurrentSelectors.set(s,t);let n=this._stringifiedOutputOrders.get(e);n&&this._stringifiedOutputOrders.set(s,n);let r=this._stringifiedParentOrders.get(e);r!==void 0&&this._stringifiedParentOrders.set(s,r)}return s}copyStringifiedUtils(e,t,n=!1){let r=u(e).filter(Ja),i=r.map(e=>this.copyStringifiedUtil(e,t,n));if(t){let e=new Map;for(let t=0;t<r.length;t++)e.set(r[t],i[t]);let t=new Map;for(let a=0;a<r.length;a++){let o=this._shortcutMergeOrders.get(r[a]);if(!o)continue;let s=t.get(o.group);if(!s){let r=t=>{let r=e.get(t);return r||(r=this.copyStringifiedUtil(t,!0,n),e.set(t,r)),r},i=o.components?.map(r),a=o.original?r(o.original):void 0;s={...o,components:i,group:{},original:a},t.set(o.group,s);for(let e of i??[])this._shortcutMergeOrders.set(e,s);a&&this._shortcutMergeOrders.set(a,s)}this._shortcutMergeOrders.set(i[a],s)}}return i}getDynamicIndex(e){return this._dynamicIndex?.config!==e&&(this._dynamicIndex={config:e,..._a(e.rulesDynamic)}),this._dynamicIndex}constructor(e={},t={}){this.userConfig=e,this.defaults=t}async ensureInitialized(){this.config||(this._initialization||=(async()=>{let e=await Ui(this.userConfig,this.defaults);this.config||(this.config=e,this._indexedRules=e.rules,this._indexedRuleSnapshot=go(e.rules),this.dispatchConfig(e))})(),await this._initialization)}static constructPublic(e,t){return new jo(e,t)}static async create(t={},n={}){let r=e.constructPublic(t,n);return await r.ensureInitialized(),r}async setConfig(e,t){if(await this.ensureInitialized(),!e)return;let n=await this.prepareConfig(e,t);this.commitConfig(n)}async prepareConfig(t,n){await this.ensureInitialized();let r=++this._configVersion,i=n??this.defaults,a=await Ui(t,i),o=e.constructPublic(t,i);o.config=a,o._indexedRules=a.rules,o._indexedRuleSnapshot=go(a.rules),o._preparedCacheSnapshot=Eo(a),o._preparedConfigMutable=!0,o._preparedCacheReliable=Oo(o._preparedCacheSnapshot)&&vo(o._indexedRuleSnapshot);let s=Object.freeze({config:a,defaults:i,generator:o,userConfig:t,version:r});return this._preparedConfigs.add(s),s}commitConfig(e){if(!this._preparedConfigs.delete(e)||e.version!==this._configVersion||e.generator.config!==e.config)return!1;let t=e.generator;return t.ensureRuleIndexesCurrent(!0),this.defaults=e.defaults,this.userConfig=e.userConfig,this.clearRuntimeCaches(!0),this.config=e.config,this._indexedRules=t._indexedRules,this._indexedRuleSnapshot=t._indexedRuleSnapshot,this._preparedCacheSnapshot=t._preparedCacheSnapshot,this._preparedConfigMutable=t._preparedConfigMutable,this._preparedCacheReliable=t._preparedCacheReliable,this._dynamicIndex=void 0,this.dispatchConfig(this.config),!0}async applyExtractors(e,t,n=new Set){return this.applyExtractorsCurrent(e,t,n,!1)}async applyExtractorsCurrent(e,t,n,r){await this.ensureInitialized(),this.ensureRuleIndexesCurrent(this._preparedConfigMutable);let i=this.config,a=this._runtimeRevision,o=Ia(n),s=Ia(o),c;try{c=await this.applyExtractorsForConfig(i,e,t,s)}catch(r){if(this._preparedConfigMutable&&this.ensureRuleIndexesCurrent(!0),this.config!==i||this._runtimeRevision!==a)return this.applyExtractorsCurrent(e,t,n,!0);throw r}return this._preparedConfigMutable&&this.ensureRuleIndexesCurrent(!0),this.config!==i||this._runtimeRevision!==a?this.applyExtractorsCurrent(e,t,n,!0):(La(n,o,c),n)}async applyExtractorsForConfig(e,t,n,r){let i={original:t,code:t,id:n,extracted:r,envMode:e.envMode};for(let t of u(e.extractors)){let e=await Q(t,`extract`)?.call(t,i);if(!(!e||e===r))if(G(e)&&G(r))for(let t of e)r.setCount(t,r.getCount(t)+e.getCount(t));else for(let t of Array.isArray(e)?u(e):e)r.add(t)}return r}requireInitialized(e){if(this.config)return this.config;throw Error(`[Teacss] TeacssGenerator is not initialized; use await createGenerator() before calling ${e}().`)}makeContextForConfig(e,t,n){let r={rawSelector:e,currentSelector:t[1],theme:n.theme,generator:this,symbols:X,variantHandlers:t[2],constructCSS:(...e)=>this.constructCustomCSS(r,...e),variantMatch:t};return this._contextConfigs.set(r,n),r}makeContext(e,t){return this.makeContextForConfig(e,t,this.requireInitialized(`makeContext`))}getContextConfig(e){return e&&this._contextConfigs.get(e)||this.requireInitialized(`this synchronous entrypoint`)}async parseToken(e,t){let n=this._startingGenerationParse>0,r=await this.parseTokenInternal(e,t,n,!1);return r&&!n?this.copyStringifiedUtils(r,!0):r}async parseTokenInternal(e,t,n,r){await this.ensureInitialized(),this.ensureRuleIndexesCurrent(this._preparedConfigMutable&&!n);let i=this.config,a=this._runtimeRevision,o=!this._preparedConfigMutable||this._preparedCacheReliable,s=o&&!t,c=()=>this.config!==i||this._runtimeRevision!==a,l=()=>(this._preparedConfigMutable&&this.ensureRuleIndexesCurrent(!0),c()),d=()=>this.parseTokenInternal(e,t,n,!0);if(o&&this.blocked.has(e)){ie(this.blocked,e);return}let f=e,p=s?this.cache.get(f):void 0;if(s&&(p!==void 0||this.cache.has(f))){L(this.cache,f,p);let e=p&&u(p);if(!e||e.length===0)return e;let t=e.filter(Ja);if(t.length>0)return n||this.collectParentOrders(t,this.parentOrders),t;this.cache.delete(f)}let m=e,h=m;for(let t of u(i.preprocess)){let n;try{n=t(h)}catch(e){if(l())return d();throw e}if(c())return d();if(!n){s&&(ie(this.blocked,e),L(this.cache,f,null));return}h=n}let g;try{g=this.isBlocked(h)}catch(e){if(l())return d();throw e}if(c())return d();if(g){s&&(ie(this.blocked,e),L(this.cache,f,null));return}let _;try{_=await this.matchVariantsForConfig(m,h,i)}catch(e){if(l())return d();throw e}if(c())return d();let v;try{v=_.every(e=>!e||this.isBlocked(e[1]))}catch(e){if(l())return d();throw e}if(c())return d();if(v){s&&(ie(this.blocked,e),L(this.cache,f,null));return}let y=async e=>{let r=this.makeContextForConfig(m,[t||e[0],e[1],e[2],e[3]],i);n&&this._generationContexts.add(r),i.details&&(r.variants=[...e[3]]);let a=await this.expandMatchedShortcut(r),o=a?await this.stringifyShortcuts(r.variantMatch,r,a[0],a[1],a[2]):(await this.parseUtil(r.variantMatch,r))?.flatMap(e=>this.stringifyUtil(e,r)).filter(Dr);return{direct:!a,utils:o}},b;try{b=_.length===1?[await y(_[0])]:await Promise.all(_.map(e=>y(e)))}catch(e){if(l())return d();throw e}if(c()||this._preparedConfigMutable&&!n&&(this.ensureRuleIndexesCurrent(!0),c()))return d();let x=[],S={},C=0;for(let{direct:e,utils:t}of b)for(let n of t??[])e&&this._stringifiedOutputOrders.set(n,{group:S,index:C++}),Z(x,n);if(x?.length)return n||this.collectParentOrders(x,this.parentOrders),s&&L(this.cache,f,x),x;s&&L(this.cache,f,null)}parseTokenForGeneration(e){this._startingGenerationParse++;try{return this.parseToken(e)}finally{this._startingGenerationParse--}}getCachedEquivalentTokens(e){this.config&&this._preparedConfigMutable&&this.ensureRuleIndexesCurrent(!0);let t=this.cache.get(e);if(!t)return[e];let n=new Set([e]);for(let[r,i]of this.cache.entries())i&&!r.endsWith(` -`)&&qa(i,r,t,e)&&n.add(r);return[...n]}generate(e,t={}){let n=p(e)?void 0:++this._collectionGeneration;return this.generateInternal(e,t,!1,n)}async generateInternal(e,t,n,r){await this.ensureInitialized(),this.ensureRuleIndexesCurrent(this._preparedConfigMutable);let i=this.config,a=this._runtimeRevision,o=!this._preparedConfigMutable||this._preparedCacheReliable,s=()=>this.config!==i||this._runtimeRevision!==a,c=()=>(this._preparedConfigMutable&&this.ensureRuleIndexesCurrent(!0),s()),l=new Map,d=!o||r===void 0||!(this.cache instanceof te)?void 0:this.cache,f=d?.revision,m=Ha(t,`id`),h=Ha(t,`scope`),g=Ha(t,`preflights`),_=Ha(t,`safelist`),v=Ha(t,`minify`),y=Ha(t,`extendedInfo`),b=Ha(t,`tokenConcurrency`),x=g===void 0||g,S=_===void 0||_,C=v!==void 0&&v,w=y!==void 0&&y,T=()=>this.generateInternal(e,t,!0,r);za(b);let E;try{E=p(e)?await this.applyExtractorsForConfig(i,e,m,w?new hr:new Set):Array.isArray(e)?Qa(new Set(u(e))):G(e)?Qa(Fa(e)):Qa(new Set(e))}catch(e){if(c())return T();throw e}if(s())return T();try{if(S){let e={generator:this,theme:i.theme};for(let t=0;t<i.safelist.length;t++){if(!Object.hasOwn(i.safelist,t))continue;let n=i.safelist[t],r=typeof n==`function`?n(e):n;for(let e of u(r)){let t=e.trim();t&&!E.has(t)&&E.add(t)}}}}catch(e){if(c())return T();throw e}if(s())return T();let D=C?``:`
|
|
21
|
+
`,O=new Set([xe]),k=w?new Map:new Set,A=new Map,j=[],M=new Map,N=Object.create(null),P=Array.from(E),F;try{F=await Wa(P,b,e=>this.parseTokenForGeneration(e))}catch(e){if(c())return T();throw e}if(s())return T();let ee=0,I=d!==void 0,ne=i.unmatched===`warn`||i.unmatched===`error`,re=[];try{for(let e=0;e<P.length;e++){let t=P[e],n=F[e];if(n==null){ne&&xa(t)&&!this.blocked.has(t)&&!this.isBlocked(t)&&!Object.hasOwn(i.rulesStaticMap,ba(t))&&Z(re,t);continue}let r=this.copyStringifiedUtils(n,!0,!0);ee++,I&&!d.isRetained(t)&&(I=!1),k instanceof Map?k.set(t,{data:this.copyStringifiedUtils(r,!1),count:G(E)?E.getCount(t):-1}):k.add(t),this.collectParentOrders(r,M);for(let e of r){Z(j,e);let t=e[3]||``,n=$(e[4],`layer`);A.has(t)||A.set(t,[]),Z(A.get(t),e),n&&O.add(n)}}}catch(e){if(c())return T();throw e}if(s())return T();for(let[e,t]of M){l.set(e,t);let n=this.parentOrders.get(e);(n===void 0||t<n)&&this.parentOrders.set(e,t)}try{await(async()=>{let e=u(i.preflights);if(!x||!e.length)return;let t={generator:this,generated:this.copyStringifiedUtils(j,!1),theme:i.theme},n=new Set,r=new Map;for(let t of e){let e=Q(t,`layer`)||`preflights`;O.add(e),n.add(e);let i=r.get(e);i?Z(i,t):r.set(e,[t])}N=Object.assign(Object.create(null),Object.fromEntries(await Promise.all(Array.from(n).map(async e=>[e,(await Promise.all(u(r.get(e)||[]).map(async e=>{let n=Q(e,`getCSS`);return n?await n.call(e,t):void 0}))).filter(Boolean).join(D)]))))})()}catch(e){if(c())return T();throw e}if(s())return T();let L,R=()=>(L??=re.flatMap(e=>{let t=Oa(e,i);return t===void 0?[]:[{token:e,suggestions:t}]}),L);if(re.length&&i.unmatched!==`off`&&i.unmatched!==void 0){let e=R(),t=({token:e,suggestions:t})=>t.length?`"${e}" (did you mean ${t.map(e=>`"${e}"`).join(`, `)}?)`:`"${e}"`;if(i.unmatched===`error`){if(e.length)throw Error(`[@teacss/core] ${e.length} token${e.length===1?``:`s`} matched no rule: ${e.map(t).join(`; `)}`)}else if(i.warn)for(let n of e)this._warnedUnmatched.has(n.token)||(ie(this._warnedUnmatched,n.token),console.warn(`[Teacss]`,`unmatched token ${t(n)}`))}let ae;try{ae=ko({authoredOutputOrders:this._stringifiedOutputOrders,config:i,currentSelectors:this._stringifiedCurrentSelectors,layerSet:O,matched:k,minify:C,parentOrders:l,preflights:x,preflightsMap:N,scope:h,sheet:A,shortcutMergeOrders:this._shortcutMergeOrders,resolveUnmatched:R}),await Promise.resolve(),this._preparedConfigMutable&&this.ensureRuleIndexesCurrent(!0)}catch(e){if(c())return T();throw e}return s()?T():(d&&f!==void 0&&this.cache===d&&r===this._collectionGeneration&&(!I||ee!==d.retainedSize)&&d.replaceRetained(Ra(P,F),f),ae)}async matchVariants(e,t){return this.matchVariantsCurrent(e,t,!1)}async matchVariantsCurrent(e,t,n){await this.ensureInitialized(),this.ensureRuleIndexesCurrent(this._preparedConfigMutable);let r=this.config,i=this._runtimeRevision,a;try{a=await this.matchVariantsForConfig(e,t,r)}catch(n){if(this._preparedConfigMutable&&this.ensureRuleIndexesCurrent(!0),this.config!==r||this._runtimeRevision!==i)return this.matchVariantsCurrent(e,t,!0);throw n}return this._preparedConfigMutable&&this.ensureRuleIndexesCurrent(!0),this.config!==r||this._runtimeRevision!==i?this.matchVariantsCurrent(e,t,!0):a}async matchVariantsForConfig(e,t,n){let r={rawSelector:e,theme:n.theme,generator:this};oe(r,this._variantCacheOwner);let i=u(n.variants),a=async t=>{let n=!0,[,,o,s]=t;for(;n;){n=!1;let c=t[1];for(let e of i){let i=Q(e,`multiPass`)??!1;if(!i&&s.has(e))continue;let l=Q(e,`match`);if(!l)continue;let d=l.call(e,c,r),f=Or(d)?await d:d;if(f){if(p(f)){if(f===c)continue;f={matcher:f}}if(Array.isArray(f)){let n=u(f).map(e=>e);if(!n.length)continue;if(n.length===1)f=n[0];else{if(i)throw Error(`multiPass can not be used together with array return variants`);let r=n.map(n=>{let r=Q(n,`matcher`)??c,i=[n,...o],a=new Set(s);return a.add(e),[t[0],r,i,a]});return(await Promise.all(r.map(e=>a(e)))).flat()}}t[1]=Q(f,`matcher`)??c,Pa(o,f),s.add(e),n=!0;break}}if(!n)break;if(o.length>500)throw Error(`Too many variants applied to "${e}"`)}return[t]};return await a([e,t||e,[],new Set])}applyVariants(e,t=e[4],n=e[1],r=Ro(n),i){let a=u(t).map(Ua),o=a.length>1?a.sort((e,t)=>(e.order||0)-(t.order||0)):a,s={prefix:``,selector:r,pseudo:``,entries:e[2]},c=o.length?o.reduceRight((e,t)=>n=>{let r=Q(n,`entries`)??[],i=Q(n,`parent`),a=Q(n,`parentOrder`),o=Q(n,`selector`)??``,s=t.body?.call(t.source,r)||r,c=Array.isArray(t.parent)?Object.hasOwn(t.parent,0)?t.parent[0]:void 0:t.parent,l=Array.isArray(t.parent)&&Object.hasOwn(t.parent,1)?t.parent[1]:void 0,u=c||i,d=t.selector?.call(t.source,o,s);return(t.handle??zo).call(t.source,{...n,entries:s,selector:d??o,parent:u,parentOrder:l??(u===i?a:void 0),layer:t.layer||Q(n,`layer`),sort:t.sort??Q(n,`sort`)},e)},e=>e)(s):s,l=Q(c,`parent`),d=Q(c,`parentOrder`),f=this.getContextConfig(i),p={selector:[Q(c,`prefix`)??``,Q(c,`selector`)??``,Q(c,`pseudo`)??``].join(``),entries:Q(c,`entries`)??[],parent:l,layer:Q(c,`layer`),sort:Q(c,`sort`),noMerge:Q(c,`noMerge`)};l!=null&&d!=null&&this._utilParentOrders.set(p,d);let m=u(f.postprocess);return m.length?m.reduce((e,t)=>{let n=[];for(let r of e){let e=this._utilParentOrders.get(r),i=r.parent;e!=null&&this._utilParentOrders.delete(r);let a=t(r);if(Array.isArray(a))for(let t of u(a).filter(Dr))e!=null&&t.parent===i&&this._utilParentOrders.set(t,e),Z(n,t);else{let t=a||r;e!=null&&t.parent===i&&this._utilParentOrders.set(t,e),Z(n,t)}}return n},[p]):[p]}constructCustomCSS(e,t,n){let r=Lr(t);return this.constructNormalizedCSS(e,r,n)}constructNormalizedCSS(e,t,n){if(p(t))return t;let r=[];for(let e=0;e<t.length;e++){if(!Object.hasOwn(t,e))continue;let n=t[e];if(!Object.hasOwn(n,0))continue;let i=n[0];typeof i==`string`?Z(r,n):i===X.body&&Z(r,[Br,Object.hasOwn(n,1)?n[1]:void 0])}let i=this.applyVariants([0,n||e.rawSelector,r,void 0,e.variantHandlers],void 0,void 0,void 0,e).map(e=>{let{selector:t,entries:n,parent:r,layer:i,sort:a,noMerge:o}=e;return{body:Hr(n),layer:i,noMerge:o,parent:r,parentOrder:this._utilParentOrders.get(e),selector:t,sort:a}}).filter(e=>!!e.body);if(!i.length)return``;let a=i.map(e=>{let t=`${e.selector}{${e.body}}`;return e.parent?no(e.parent,t):t}).join(``),o=e,s=this._constructedCSSResults.get(o);s||(s=new Map,this._constructedCSSResults.set(o,s));let c=a;return s.has(c)&&(c=`${a}\n${(++this._constructedCSSSequence).toString(2).replaceAll(`0`,` `).replaceAll(`1`,` `)}\n`),s.set(c,i),c}async parseUtil(e,t,n=!1,r){await this.ensureInitialized();let i=Object.hasOwn(t,`rules`),a=t.rules,o=a?.length,s=()=>{a&&o!==void 0?(a.length=o,t.rules=a):i?t.rules=a:delete t.rules};this.getContextConfig(t)===this.config&&this._preparedConfigMutable&&!this._generationContexts.has(t)&&this.ensureRuleIndexesCurrent(!0);let c=this.getContextConfig(t),l=c===this.config&&this._preparedConfigMutable&&!this._generationContexts.has(t),d=this._runtimeRevision,f=p(e)?await this.matchVariantsForConfig(e,void 0,c):[e],m=async([e,i,a])=>{c.details&&(t.rules=t.rules??[]);let o={...t,variantHandlers:a};this._contextConfigs.set(o,this.getContextConfig(t));let s;o.constructCSS=(...e)=>{if(!n||!t.variantHandlers.length)return this.constructCustomCSS(o,...e);let r=Lr(e[0]);if(!p(r)&&Xa(r))return this.constructNormalizedCSS(o,r,e[1]);s||(s={...o,variantHandlers:Za(o.variantHandlers,t.variantHandlers)},this._contextConfigs.set(s,this.getContextConfig(t)));let i=this.constructNormalizedCSS(s,r,e[1]),a=this._constructedCSSResults.get(s)?.get(i);if(a){let e=this._constructedCSSResults.get(o);e||(e=new Map,this._constructedCSSResults.set(o,e)),e.set(i,a)}return i};let l=c.rulesStaticMap[i];if(r){l=void 0;let e=u(r);for(let t=c.rules.length-1;t>=0;t--){let n=c.rules[t];if(!Yr(n)||n[0]!==i)continue;let r=$(n[2],`prefix`);if(!r||u(r).some(t=>e.includes(t))){l=n;break}}}let d=l,f=()=>{let t=d;if(d=void 0,!(!t?.[1]||!n&&$(t[2],`internal`)))return this.resolveCSSResult(e,t[1],t,o)},m=i.indexOf(`:`),h=this.getDynamicIndex(c),g=m>0&&h.map.get(i.slice(0,m))||h.fallback;for(let t of g){let[a,s,c]=t;if(($(d?.[2],`__index`)??-1)>($(c,`__index`)??-1)){let e=f();if(e)return e}if($(c,`internal`)&&!n)continue;let l=[i],p=$(c,`prefix`);if(p){let e=u(p);if(r){let t=u(r);if(!e.some(e=>t.includes(e)))continue}else if(l=e.filter(e=>i.startsWith(e)).map(e=>i.slice(e.length)),!l.length)continue}for(let n of l){let r=Ka(n,a);if(!r)continue;let i=s(r,o),c=Or(i)?await i:i;if(!c)continue;if(typeof c!=`string`&&(typeof c==`object`||typeof c==`function`)){let e=Array.isArray(c)?void 0:Q(c,Symbol.asyncIterator),t=Array.isArray(c)?void 0:Q(c,Symbol.iterator);if(e){let t=[],n=e.call(c);for(;;){let e=await n.next();if(e.done)break;e.value&&Z(t,e.value)}c=t}else if(t){let e=[],n=t.call(c);for(;;){let t=n.next();if(t.done)break;t.value!=null&&Z(e,t.value)}c=e}}let l=this.resolveCSSResult(e,c,t,o);if(l)return l}}return f()},h=f.length===1?await m(f[0])??[]:(await Promise.all(f.map(e=>m(e)))).flat().filter(e=>!!e);if(l&&(this.ensureRuleIndexesCurrent(!0),this.config===c&&this._runtimeRevision!==d))return s(),this.parseUtil(e,t,n,r);if(h.length)return h}resolveCSSResult=(e,t,n,r)=>{let i=Rr(t).filter(e=>e.length);if(i.length){let t=this.getContextConfig(r);t.details&&Z(r.rules,n),t===this.config&&r.generator.activatedRules.add(n);let a=n[2],o={},s=0,c=e=>(this._parsedOutputOrders.set(e,{group:o,index:s++}),e);return i.flatMap(t=>{let n;if(p(t)){let e=this._constructedCSSResults.get(r)?.get(t);return e?e.map(e=>{let t=[$(a,`__index`),e.body,a];return this._rawUtilMetadata.set(t,e),c(t)}):(n=[$(a,`__index`),t,a],[c(n)])}let i=[],o=r.variantHandlers,s=a,l=e=>{o=[e,...o]},d=e=>{s={...s,...e}};for(let e=0;e<t.length;e++){if(!Object.hasOwn(t,e))continue;let n=t[e],r=Object.hasOwn(n,0)?n[0]:void 0,a=()=>Object.hasOwn(n,1)?n[1]:void 0;switch(r){case X.variants:{let e=a();if(typeof e==`function`){let t=e(o);t&&(o=u(t).map(e=>e))}else o=[...u(e),...o];break}case X.parent:l({parent:a()});break;case X.selector:l({selector:a()});break;case X.layer:l({layer:a()});break;case X.sort:d({sort:a()});break;case X.noMerge:d({noMerge:a()});break;case X.noScope:d({noScope:a()});break;case X.shortcutsNoMerge:Z(i,n);break;case X.body:Z(i,[Br,a()]);break;default:typeof r==`string`&&Z(i,n)}}return n=[$(a,`__index`),e,i,s,o],[c(n)]})}};stringifyUtil(e,t){if(!e)return;let n=this.getContextConfig(t);if(Er(e)){let r=this._rawUtilMetadata.get(e),i=e[2];if(r?.layer!==void 0||r?.sort!==void 0){let t={...e[2]??{}},n=$(e[2],`layer`),a=$(e[2],`sort`);delete t.layer,delete t.sort,i={...t,layer:r.layer??n,sort:r.sort??a}}let a=[e[0],r?.selector,r?.body??e[1],r?.parent,i,n.details?t:void 0,r?.noMerge];return this.transferOutputOrder(e,a),this.recordStringifiedContext(a,t),r?.parent!=null&&r.parentOrder!=null&&this._stringifiedParentOrders.set(a,r.parentOrder),[a]}let r=this.applyVariants(e,void 0,void 0,void 0,t),i=[];for(let a of r){let{selector:r,entries:o,parent:s,layer:c,sort:l,noMerge:u}=a,d=Hr(o);if(!d)continue;let f=e[3];if(c!==void 0||l!==void 0){let{layer:t,sort:n,...r}=e[3]??{};f={...r,layer:c??t,sort:l??n}}let p=[e[0],r,d,s,f,n.details?t:void 0,u];this.transferOutputOrder(e,p),this.recordStringifiedContext(p,t);let m=this._utilParentOrders.get(a);s!=null&&m!=null&&this._stringifiedParentOrders.set(p,m),Z(i,p)}return i}async expandShortcut(e,t,n=5){return await this.ensureInitialized(),this.expandConfiguredExpansions(e,t,n,this.getContextConfig(t).shortcuts,`shortcut`)}async expandMatchedShortcut(e,t=5){return this.expandConfiguredExpansionsForInput(e.variantMatch,e,t,this.getContextConfig(e).shortcuts,`shortcut`)}async expandConfiguredExpansions(e,t,n,r,i,a,o){await this.ensureInitialized();let s=await this.expandConfiguredExpansionsForInput(e,t,n,r,i,a,o);if(!s)return;let c=[s[0],s[1]];return this._expansionPrefixes.set(c,s[2]),this._expansionPrefixes.set(c[0],s[2]),c}async expandConfiguredExpansionsForInput(e,t,n,r,i,a,o){let s=u(r);if(n<=0||!s.length)return;let c=this.getContextConfig(t),l=p(e)?e:e[1],d=c.details?e=>{t.shortcuts=t.shortcuts??[],Z(t.shortcuts,e)}:kr,f,m,h,g,_=o;expansionLoop:for(let e of s){if(!Array.isArray(e)||!Object.hasOwn(e,0)||!Object.hasOwn(e,1))continue;let n=Object.hasOwn(e,2)?e[2]:void 0,r=[{prefix:o,value:l}];if(n?.prefix){let e=u(n.prefix);if(r=e.filter(e=>l.startsWith(e)).map(e=>({prefix:e,value:l.slice(e.length)})),o&&e.includes(o)&&Z(r,{prefix:o,value:l}),!r.length)continue}for(let i of r){if(p(e[0])){if(e[0]!==i.value)continue;m=e[1]}else{let n=Ka(i.value,e[0]);n&&(m=e[1](n,t))}if(m){_=i.prefix,f||=n,d(e);break expansionLoop}}}if(m){let e=p(m)?[m]:u(m);h=e.filter(e=>p(e)).flatMap(e=>Qr(xi(e.trim(),c.separators))).map(e=>({prefix:_,value:e})),g=e.filter(e=>!p(e)).map(e=>({handles:[],value:e}))}if(!m&&p(e)){let s=await this.matchVariantsForConfig(e,void 0,c);for(let e of s){let[s,c,l]=e;if(s!==c){let e=await this.expandConfiguredExpansions(c,t,n-1,r,i,a,o);if(e){let t=this._expansionPrefixes.get(e)??[];h??=[];for(let n=0;n<e[0].length;n++){let r=e[0][n];p(r)&&Z(h,{prefix:t[n]??o,value:s.replace(c,()=>r)})}g??=[],Na(g,e[0].filter(e=>!p(e)).map(e=>({handles:[...e.handles,...l],value:e.value})))}}}}if(!h?.length&&!g?.length)return;let v=new Map,y=(h??[]).filter(({prefix:e,value:t})=>{let n=v.get(e);return n||(n=new Set,v.set(e,n)),n.has(t)?!1:(n.add(t),!0)}),b=[...(await Promise.all(y.map(async({prefix:e,value:o})=>{let s=await this.expandConfiguredExpansions(o,t,n-1,r,i,a,e),c=s?void 0:await a?.(o,t,n-1),l=s??c;if(!l)return[{prefix:e,value:o}];let u=this._expansionPrefixes.get(l)??[];return l[0].map((t,n)=>({prefix:u[n]??e,value:t}))}))).flat(),...(g??[]).map(e=>({prefix:_,value:e}))].filter(({value:e})=>!!e);return[b.map(({value:e})=>e),f,b.map(({prefix:e})=>e)]}async stringifyShortcuts(e,t,n,r,i){await this.ensureInitialized();let a=this.getContextConfig(t);r={...r,layer:$(r,`layer`)??a.shortcutsLayer};let o=i??this._expansionPrefixes.get(n)??[],s=new Mr,c=(await Promise.all(n.map(async(n,i)=>{let s=p(n)?await this.parseUtil(n,t,!0,o[i]??$(r,`prefix`)):[[1/0,`{inline}`,Lr(n.value),void 0,n.handles]];return!s&&a.warn&&Ci(`unmatched utility "${n}" in shortcut "${e[1]}"`),s||[]}))).flat(1).filter(Boolean).sort((e,t)=>e[0]-t[0]);a.details&&t.rules&&t.rules.length>1&&t.rules.sort((e,t)=>($(e[2],`__index`)??1/0)-($(t[2],`__index`)??1/0));let[l,,d]=e,f=c.some(Er),m={},h=0,g=[],_=e=>{let t=this._shortcutMergeOrders.get(e)?.components;if(!t?.length){this._stringifiedOutputOrders.set(e,{group:m,index:h++});return}let n;for(let e of t){let t={group:m,index:h++};n??=t,this._stringifiedOutputOrders.set(e,t)}n&&this._stringifiedOutputOrders.set(e,n)};for(let e of c){if(Er(e)){let n=this._rawUtilMetadata.get(e),i={...e[2],...r,layer:n?.layer??$(r,`layer`),sort:n?.sort??$(r,`sort`)??$(e[2],`sort`)},o=[e[0],n?.selector,n?.body??e[1],n?.parent,i,a.details?t:void 0,n?.noMerge];this.recordStringifiedContext(o,t),n?.parent!=null&&n.parentOrder!=null&&this._stringifiedParentOrders.set(o,n.parentOrder),_(o),Z(g,o);continue}let n=Xa(e[2]),i=n?e[4]:Za(e[4],d);for(let o of this.applyVariants(e,i,l,void 0,t)){let{selector:i,entries:c,parent:l,sort:u,noMerge:d,layer:p}=o,m=!!(d??$(r,`noMerge`)??$(e[3],`noMerge`)),h=!!($(r,`noScope`)??$(e[3],`noScope`)),v=$(r,`sort`),y=$(r,`layer`),b=n?v??0:u??v??$(e[3],`sort`)??0;if(f){let n=Hr(c);if(!n)continue;let s=[e[0],i,n,l,{...r,noMerge:m,noScope:h,sort:b,layer:p??y},a.details?t:void 0,void 0];this.recordStringifiedContext(s,t);let u=this._utilParentOrders.get(o);l!=null&&u!=null&&this._stringifiedParentOrders.set(s,u),_(s),Z(g,s);continue}let x=s.getFallback(p??y,{ordered:[],streams:new Map}),S=x.streams.get(l);S||(S=[],x.streams.set(l,S));let C=S[S.length-1];(!C||C.selector!==i||C.noScope!==h)&&(C={entries:[],noScope:h,parent:l,parentOrder:void 0,selector:i},Z(S,C),Z(x.ordered,C)),Z(C.entries,[c,m,b,e[0]]);let w=this._utilParentOrders.get(o);w!=null&&(C.parentOrder==null||w<C.parentOrder)&&(C.parentOrder=w)}}let v=s.flatMap((e,n)=>e.ordered.map(({entries:e,noScope:i,parentOrder:o,selector:s,parent:c})=>{let l=(e,l,u)=>{if(!u.length)return[];let d=Math.max(...u.map(e=>e[1])),f=Math.max(...u.map(e=>e[2])),p=e&&u.length>1?u.map(([e,t,n])=>[e.map(e=>[e[0],e[1]]),t,n]):u,m=p.map(e=>e[0]);return(e?[m.flat(1)]:m).map((u,m)=>{let h=Hr(u);if(h){let u={...r,noMerge:l,noScope:i,sort:d,layer:n},g=[f,s,h,c,u,a.details?t:void 0,void 0];this.recordStringifiedContext(g,t),c!=null&&o!=null&&this._stringifiedParentOrders.set(g,o);let _=e?p:[p[m]],v={flatten:e,group:{}};return v.components=e&&_.length>1?_.map(([n,r,i])=>{let l=e?Hr(n):h;if(!l)return;let d=[i,s,l,c,{...u,sort:r},a.details?t:void 0,void 0];return this.recordStringifiedContext(d,t),c!=null&&o!=null&&this._stringifiedParentOrders.set(d,o),this._shortcutMergeOrders.set(d,v),d}).filter(Dr):void 0,v.original=g,this._shortcutMergeOrders.set(g,v),g}})},d=[],f=[],p=[],m=[];for(let[t,n,r,i]of e){let e=u(t).some(Ya);Z(n?e?d:f:e?p:m,[t,r,i])}return[...l(!1,!0,d),...l(!0,!0,f),...l(!1,!1,p),...l(!0,!1,m)].filter(Dr)}).flat(1).filter(Boolean));for(let e of v)_(e);return g.concat(v)}isBlocked(e){if(!e)return!0;let{blocklist:t}=this.requireInitialized(`isBlocked`);for(let n=0;n<t.length;n++){if(!Object.hasOwn(t,n))continue;let r=t[n],i=Array.isArray(r)?Object.hasOwn(r,0)?r[0]:void 0:r;if(i!==void 0&&this.matchesBlocklist(i,e))return!0}return!1}getBlocked(e){let{blocklist:t}=this.requireInitialized(`getBlocked`);for(let n=0;n<t.length;n++){if(!Object.hasOwn(t,n))continue;let r=t[n],i=Array.isArray(r)?Object.hasOwn(r,0)?r[0]:void 0:r;if(!(i===void 0||!this.matchesBlocklist(i,e)))return[i,Array.isArray(r)&&Object.hasOwn(r,1)?r[1]:void 0]}}matchesBlocklist(e,t){return typeof e==`function`?!!e(t):p(e)?e===t:Ka(t,e)!==null}},jo=class extends Ao{constructor(e={},t={}){super(e,t)}};async function Mo(e,t){return await Ao.create(e,t)}const No=/\s\$\$\s+/g;function Po(e){return io(e).length>0}function Fo(e){let t=[],n=0,r=!1,i=0,a,o=0;for(let s=0;s<e.length;s++){let c=e[s];r?c===`*`&&e[s+1]===`/`&&(r=!1,s++):a?c===`\\`?s++:c===a&&(a=void 0):c===`/`&&e[s+1]===`*`?(r=!0,s++):c===`\\`?s++:c===`"`||c===`'`?a=c:c===`[`?n++:c===`]`?n>0&&n--:c===`(`?i++:c===`)`?i>0&&i--:c===`,`&&n===0&&i===0&&(Z(t,e.slice(o,s).trim()),o=s+1)}return Z(t,e.slice(o).trim()),t}function Io(e,t){return Fo(e).map(e=>{let n=e.startsWith(`$$`)&&/\s/.test(e[2]??``)?` ${e}`:e;return t?Po(n)?ao(n,t):`${t} ${e}`:ao(n)}).join(`,`)}const Lo=/^\[(.+?)(~?=)"(.*)"\]$/;function Ro(e){return Lo.test(e)?e.replace(Lo,(e,t,n,r)=>`[${Cn(t)}${n}"${Cn(r)}"]`):`.${Cn(e)}`}function zo(e,t){return t(e)}const Bo=e.hash??((t,n,r)=>e.createHash(t).update(n).digest(r));function Vo(e,t=8){return Bo(`sha256`,e,`hex`).substring(0,t)}const Ho=`@teacss-include`,Uo=`@teacss-ignore`,Wo=`@teacss-ide-include`,Go=`@teacss-placeholder`,Ko=`@teacss-skip-start`,qo=`@teacss-skip-end`,Jo=RegExp(`(//\\s*?${Ko}\\s*?|\\/\\*\\s*?${Ko}\\s*?\\*\\/|<!--\\s*?${Ko}\\s*?-->)[\\s\\S]*?(//\\s*?${qo}\\s*?|\\/\\*\\s*?${qo}\\s*?\\*\\/|<!--\\s*?${qo}\\s*?-->)`,`g`),Yo=[/^(?:virtual:)?tea(?::(.+))?\.css(\?.*)?$/],Xo=`__ALL__`;export{Mr as BetterMap,Go as CSS_PLACEHOLDER,hr as CountableSet,Se as DEFAULT_LAYERS,Uo as IGNORE_COMMENT,Ho as INCLUDE_COMMENT,Wo as INCLUDE_COMMENT_IDE,ge as LAYER_IMPORTS,Xo as LAYER_MARK_ALL,ye as LAYER_PREFLIGHTS,_e as LAYER_PRIMITIVES,ve as LAYER_PROPERTIES,be as LAYER_SHORTCUTS,xe as LAYER_UTILITIES,Ur as RESET_KEY,Jo as SKIP_COMMENT_RE,qo as SKIP_END_COMMENT,Ko as SKIP_START_COMMENT,jo as TeacssGenerator,jr as TwoKeyMap,Yo as VIRTUAL_ENTRY_ALIAS,Br as VirtualKey,br as attributifyRE,P as buildConditionSelector,zr as clearIdenticalEntries,Jr as clone,bi as collapseVariantGroup,he as createConditionVariant,Mo as createGenerator,_r as createNanoEvents,xr as cssIdRE,Fn as defaultSplitRE,ta as definePreset,Cn as e,Hr as entriesToCss,xn as escapeRegExp,Sn as escapeSelector,bn as expandClassGroups,hn as expandGroups,$r as expandUnderscores,xi as expandVariantGroup,mr as extractorDefault,mr as extractorSplit,na as getEnvFlags,Vo as getHash,En as getPath,Po as hasScopePlaceholder,On as hash,ci as isArbitrary,Cr as isAttributifySelector,G as isCountableSet,Dn as isCssId,K as isObject,Er as isRawUtil,Yr as isStaticRule,Xr as isStaticShortcut,p as isString,Or as isThenable,wr as isValidSelector,x as isValidTargetSelector,vi as makeRegexClassGroup,Xi as mergeConfigs,Gr as mergeDeep,kr as noop,li as normalizeArbitraryValue,Lr as normalizeCSSEntries,Rr as normalizeCSSValues,Tr as normalizeVariant,Dr as notNull,me as parseClassToken,T as parseCondition,E as parseConditions,yi as parseVariantGroup,No as regexScopePlaceholder,Nn as replaceAsync,N as resolveConditions,Ui as resolveConfig,zi as resolvePreset,Bi as resolvePresets,Ii as resolveShortcuts,Mn as restoreSkipCode,si as spaceCalcOperators,Qr as splitClassTokens,In as splitWithVariantGroupRE,X as symbols,u as toArray,Ro as toEscapedSelector,jn as transformSkipCode,d as uniq,f as uniqueBy,Sr as validateFilterRE,Ci as warnOnce,Ar as withLayer};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@teacss/core",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.7",
|
|
4
4
|
"description": "TeaCSS engine core — token parsing, condition resolution, rule matching, and CSS generation.",
|
|
5
5
|
"homepage": "https://css.teasim.com",
|
|
6
6
|
"funding": "https://github.com/sponsors/billgo",
|