@teacss/core 0.4.6 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +358 -131
- package/dist/index.d.ts +274 -263
- package/dist/index.js +21 -21
- package/package.json +1 -1
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,n=>c(e,n)?!1:(t=!1,!0)),t}function s(e){let t=0;return i(e,()=>(t++,!1)),t}function c(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 l(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 u(e){let t=[],n=0,r=!1;if(i(e,i=>{n++;let a=c(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,s=a.name,u=o.name;return s!==`part`&&s!==`slotted`||e[a.index+1]!==`:`||e[a.end]!==`(`||!l(e,a.end,o.index)?!1:u===`before`||u===`after`||u===`marker`||u===`placeholder`||u===`file-selector-button`||s===`part`&&(u===`first-line`||u===`first-letter`)}function d(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 f(e){return Array.from(new Set(d(e)))}function p(e,t){return d(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 m(e){return typeof e==`string`}const h=new Set([`>`,`+`,`~`]);function g(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 _(e){if(e===void 0)return!1;let t=e.charCodeAt(0);return t>=97&&t<=122||t>=65&&t<=90||e===`_`||t>=128}function v(e,t){let n=e[t];if(n===`-`){let n=e[t+1];return n===`-`||n===`\\`||_(n)}return _(n)}function y(e,t){let n=t;if(e[n]===`\\`)n+=2;else if(v(e,n))n++;else return;for(;n<e.length;){if(e[n]===`\\`){n+=2;continue}if(!g(e[n]))break;n++}return n>t?n:void 0}function b(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 x(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 S(e,t){let n=x(e,t),r=n;if(e[n]===`*`&&!(e[n+1]===`/`&&n>t))n++;else{let t=y(e,n);t!==void 0&&(n=t)}let i=+(n>r);for(;n<e.length;){let t=x(e,n);if(t!==n){n=t;continue}let r=e[n];if(r===`.`||r===`#`){let t=y(e,n+1);if(t===void 0)return;n=t}else if(r===`[`){let t=b(e,n,`[`,`]`);if(t===void 0)return;n=t}else if(r===`:`){let t=y(e,n+1);if(t===void 0)return;if(n=t,e[n]===`(`){let t=b(e,n,`(`,`)`);if(t===void 0)return;n=t}}else break;i++}return i>0?n:void 0}function C(e){if(!e)return!1;let t=0;for(;;){let n=S(e,t);if(n===void 0)return!1;if(t=x(e,n),t===e.length)return!0;if(!h.has(e[t])||(t=x(e,t+1),t===e.length))return!1}}function w(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 T={">":` > `,_:` `,"+":` + `,"~":` ~ `};function E(e){let t=e[0];return t!==void 0&&Object.hasOwn(T,t)?T[t]:void 0}function D(e){let t=e.startsWith(`!`),n=t?e.slice(1):e,r;return r=n.startsWith(`::`)?`pseudo-element`:n[0]===`.`||n[0]===`#`?`self`:E(n)===void 0?n[0]===`[`?`arbitrary`:`named`:`target`,{raw:e,kind:r,negate:t,value:n}}function O(e){return d(e).map(D)}function k(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 A(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||!o(t)||!k(t)||e.kind===`self`&&e.negate&&a(t)!==-1}function j(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=E(e.value);if(t===void 0)return;let n=e.value.slice(1),r=a(n);return C(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 ee(e){let t={},n=w(e,`prefix`),r=w(e,`suffix`),i=w(e,`combinator`),a=w(e,`pseudoElement`),o=w(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 M(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 N(e){let t=e.pseudoElement;if(!t)return e;let n=s(t);if(n>1&&!u(t))throw Error(`[Teacss] a token may use at most one pseudo-element, found ${n}`);return e}function P(e,t=[],n){let r=d(e),i=d(t),a={conditions:r,theme:n},o=[],c=[];for(let e of r){if(A(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=s(t);if(n>1&&!u(t))throw Error(`[Teacss] a token may use at most one pseudo-element, found ${n}`)}let t=j(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?o.push(N(M(ee(t)))):c.push(e)}let l=o.map(e=>e.pseudoElement??``).join(``),f=s(l);if(f>1&&!u(l))throw Error(`[Teacss] a token may use at most one pseudo-element, found ${f}`);return{resolved:o,unresolved:c}}function F(e,t){let n=d(t).map(ee),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 I=1e4;function te(e,t){return e===t||Object.is(e,t)}var ne=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}},re=class extends Map{assumeNoPrototypeBypass;maxEntries;order=new ne;retained=new Set;_revision=0;constructor(e=I,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&&!te(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)))}},ie=class extends Set{assumeNoPrototypeBypass;maxEntries;order=new ne;constructor(e=I,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&&!te(e.value,t.value))&&this.order.reset(super.values())}};function ae(e){let t=e.keys().next();t.done||e.delete(t.value)}function L(e,t,n,r){if(e instanceof re){e.setAndTouch(t,n,r??e.maxEntries);return}e.delete(t),e.set(t,n),e.size>(r??1e4)&&ae(e)}function R(e,t,n){if(e instanceof ie){e.addAndTouch(t,n??e.maxEntries);return}e.delete(t),e.add(t),e.size>(n??1e4)&&ae(e)}const oe=new WeakMap,se=new WeakMap;function ce(e,t){se.set(e,t)}function le(e){return e&&se.get(e)}function ue(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 de(e,t){return oe.set(e,t),e}function fe(e){return oe.has(e)}function pe(e,t){let n=oe.get(e),r=oe.get(t);if(!n||!r)return;let i=`${r.pseudoElement}${n.pseudoElement}`,a=s(i);if(a>1&&!u(i))throw Error(`[Teacss] a token may use at most one pseudo-element, found ${a}`);let o={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 de({handle:ue(o)},o)}function me(e,t,n){Object.defineProperty(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0})}function he(e,t){let n=e.length;n in e?me(e,n,t):e[n]=t}function ge(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),he(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;he(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 _e(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 re(I,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}=P(O(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:ue(d)};return L(o,i,f),f};return{name:n,match(e,t){if(!e.includes(`@`))return;let n=ge(e);if(n.conditions.length===0)return;let r=o(n.conditions,t?.theme,le(t));if(r)return de({matcher:`${n.body}${n.important?`!`:``}`,handle:r.handle},r)},multiPass:!1}}const ve=`imports`,ye=`primitives`,be=`properties`,xe=`preflights`,Se=`shortcuts`,Ce=`utilities`,we=Object.freeze({[ve]:-200,[be]:-150,[xe]:-100,[Se]:-50,[ye]:-10,[Ce]: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 Te(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 st(e){for(let t of e)if((t.codePointAt(0)??0)>127)return!0;return!1}function ct(e,t,n=!1,r=0){let i=e.slice(r,t),a=ot(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)||st(o)||n&&o.includes("${")||o.includes(`#{`)||o.includes(`@{`)||c.every(et)||s.length>0&&s.every(e=>e===`*`||Ze.test(e))}function lt(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 ut(e,t){let n=t+1;for(;/\s/.test(e[n]??``);)n++;return e.startsWith(`...`,n)}function dt(e,t){let n=0;for(t--;t>=0&&e[t]===`\\`;t--)n++;return n%2==1}function ft(e,t,n=0){let r=t-1;for(;r>=0&&/\s/.test(e[r]);)r--;if(r<0)return!1;if(qe.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 Je.has(a)||at(e,t,n)}const pt=new Set([`catch`,`class`,`do`,`else`,`finally`,`switch`,`try`]),mt=/^(?:(?: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;(){}])/,ht=/^(?:await\s+)?[$_\p{ID_Start}][$\p{ID_Continue}]*(?:\s*(?:(?:\.|\?\.)\s*#?[$_\p{ID_Start}][$\p{ID_Continue}]*|(?:\?\.)?\[[^\]]+\]))*\s*(?:(?:\?\.)?\(|\+\+|--|[-+*/%&|^]?=(?!=|>))/u,gt=/^(?:await\s+)?[$_\p{ID_Start}][$\p{ID_Continue}]*\s*(?:(?:\.|\?\.)\s*#?[$_\p{ID_Start}][$\p{ID_Continue}]*)+\s*$/u,_t=/^(?:await\s+)?[$_\p{ID_Start}][$\p{ID_Continue}]*(?:\s*(?:\.|\?\.)\s*#?[$_\p{ID_Start}][$\p{ID_Continue}]*)*\s*(?:\?\.)?\[[^\]]+\]\s*$/u,vt=/^new\s+(?:class\b|function\b|[$_\p{ID_Start}])/u,yt=/^\([\s\S]*\)$/,bt=/^\([\s\S]*\)\s*(?:\(|\?\.|\.)/,xt=/^(?:(?:await|delete|typeof|void)\s+\S|yield(?:\s+\S|\s*\*\s*\S))/u,St=/^(?:\+\+|--|!|~)\s*\S/u,Ct=/^\[[\s\S]*\]\s*=(?!=|>)/,wt=new Set([`as`,`in`,`instanceof`,`satisfies`]),Tt=/^(?:=(?!=|>)|\+=|-=|\*\*=|\*=|\/=|%=|&&=|&=|\|\|=|\|=|\^=|\?\?=|<<=|>>>=|>>=)/,Et=/^(?:(?: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 Dt(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 Ot(e,t){if(xt.test(e))return!0;if(!St.test(e))return!1;let n=Dt(e);return n===void 0||t&&n===`important`}function kt(e,t){if(!Ct.test(e))return!1;let n=Dt(e);return n===void 0||t&&n===`important`}function At(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 jt(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 Mt(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=rn(e,r);i?.value===`await`&&/\s/u.test(e[i.end]??``)&&(r=n(i.end),i=rn(e,r));let a;if(i!==void 0)a=`identifier`,r=i.end;else if(e[r]===`[`||e[r]===`(`){let t=At(e,r);if(t===void 0)return!1;a=e[r]===`[`?`array`:`parenthesized`,r=t}else{let t=Et.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=At(e,r);if(t===void 0)return!1;o=!0,s=!1,r=t;continue}if(e[r]===`#`&&r++,i=rn(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||Dt(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=Tt.exec(e.slice(r));return c!==null&&e.slice(r+c[0].length).trim().length>0}function Nt(e){let t=jt(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=rn(e,a);if(l!==void 0){if(wt.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 Pt(e,t){let n=ze(e,t);if(n.kind===`open`)return!0;if(n.kind!==`close`)return!1;let r=He(e.slice(t+1,n.index));if(r.length===0)return!0;let i=r.length===1;return r.some(e=>mt.test(e)||ht.test(e)||gt.test(e)||_t.test(e)||Mt(e,i)||vt.test(e)||yt.test(e)||bt.test(e)||Ot(e,i)||kt(e,i)||Nt(e))}function Ft(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(nt(e,t,n))return r>0||`:|&=,(`.includes(e[a]??``)?!1:tt(e,t,n);if(/\bclass\b[^;]*$/.test(o))return rt(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 pt.has(c)?!0:at(e,t,n)}function It(){return{angleDepth:0,canEnd:!1,classParenRoles:[],forceRegex:!1,labelCandidate:!1,labelColon:-1,lastSignificant:``,lastWord:``,parenKinds:[],pendingFunctions:[],restrictedLineStatement:!1,statementStart:!0,typeDeclaration:!1}}const Lt=new Set([`abstract`,`async`,`declare`,`default`,`export`]),Rt=new Set([`abstract`,`asserts`,`extends`,`in`,`infer`,`is`,`keyof`,`new`,`readonly`,`typeof`,`unique`]);function zt(e,t){let n=e.pendingFunctions.at(-1);n?.phase===`return-type`&&(n.typeCanEnd=!Rt.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 Bt(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 Vt(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 Ht(e,t=!1){e.labelCandidate=!1,e.labelColon=-1,e.lastSignificant=`;`,e.lastWord=``,t||(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 Ut(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 Wt(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||zt(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&&Lt.has(a)}return s||!(Je.has(a)||Xe.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`||Xe.has(a)?`O`:`T`),e?.phase===`before-params`?(e.phase=`params`,V(r.parenKinds,`F`)):V(r.parenKinds,Xe.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&&(Ut(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 Gt(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 Ye.has(e.slice(i+1,a))}function Kt(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
|
-
`||
|
|
9
|
-
`||
|
|
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
|
-
`||
|
|
12
|
-
`||
|
|
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
|
-
`||
|
|
16
|
-
`||
|
|
17
|
-
`||
|
|
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===`*`&&Wn(e,l,a)){i=!0,l++;continue}if(u===`/`&&d===`/`&&Wn(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 Yn(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&&Hn.test(e)}}function Xn(e){let t=e?.charCodeAt(0);return t===10||t===13||t===8232||t===8233}function Zn(e,t){return e[t+1]===`\r`&&e[t+2]===`
|
|
19
|
-
`?t+2:t+1}function Qn(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]===`[`&&Fe(e,n)}const $n=new Set([`await`,`break`,`case`,`continue`,`debugger`,`delete`,`do`,`else`,`in`,`instanceof`,`new`,`of`,`return`,`throw`,`typeof`,`void`,`yield`]),er=new Set([`for`,`if`,`while`,`with`]);function tr(e,t){let n=0;for(;t>0&&e[--t]===`\\`;)n++;return n%2==1}function nr(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||tr(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:er.has(e.slice(i,t))}}return!1}function rr(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||tr(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 ir(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 ar(e,t){let n=rr(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=ir(e,r);return[`catch`,`class`,`do`,`else`,`finally`,`static`,`try`].includes(a.value)?!0:a.value?ir(e,a.start).value===`class`:!1}function or(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]===`)`&&nr(e,n)||e[n]===`}`&&ar(e,n))return!0;let r=n+1;for(;n>=0&&/[\w$]/.test(e[n]);)n--;let i=e.slice(n+1,r);return $n.has(i)?!0:i==="default"&&ir(e,n+1).value===`export`}function sr(e,t){let n=!1;for(let r=t+1;r<e.length;r++){let t=e[r];if(Xn(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 cr(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===`/`&&or(e,f)){let t=sr(e,f);if(t!==-1){f=t-1,d=!1;continue}}if(n.length===0){Yn(p)?d=!1:p===`/`&&(d=!0),p===`[`&&(z(n,f),o=d&&e[f-1]!==`:`&&e[f-1]!==`@`,i=[],l=void 0);continue}if(Yn(p)&&(u=f),Xn(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??=Te(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===`\\`?(Xn(e[f+1])?(n.length=0,i=[],a=!1,s=void 0,c=-1):Yn(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===`\\`)Xn(e[f+1])&&(n.length=0,i=[],a=!1,s=void 0,c=-1),Yn(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]&&!Hn.test(e[s+1]);c=n&&!Pe(e,a)||i&&!(t&&Qn(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 cr(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 lr=/^(?:--?[\w-]+|[A-Z_$][\w$-]*|@teacss-skip-bracket-[\da-z]{6})$/i;function ur(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(!lr.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 dr(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!=="`"&&Xn(d)?a=void 0:d===`\\`?u=Zn(e,u):d===a?a=void 0:d===`(`&&ur(e,u)&&(z(n,{attached:!0,containsGroupBrace:!1,outerQuote:a,start:u}),c=void 0):d===`"`||d===`'`||d==="`"?a=d:d===`(`&&ur(e,u)&&(z(n,{attached:!0,containsGroupBrace:!1,outerQuote:void 0,start:u}),c=void 0);continue}if(Xn(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??=Te(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=Zn(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=Zn(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:ur(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 fr(e,t,n){if(!t.length)return e;let r=new Set([...e.matchAll(Vn)].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=`${Bn}${jn(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 pr(e,t,n=!1){return fr(e,cr(e,n),t)}function mr(e,t){return fr(e,dr(e),t)}function hr(e,t){let n=e;for(let e=0;e<t.size&&n.includes(Bn);e++){let e=n.replace(Vn,e=>t.get(e)??e);if(e===n)break;n=e}return n}function gr(e,t){let n=new Map;e.includes(`[`)&&(e=pr(e,n,!0)),e.includes(`(`)&&(e=mr(e,n));let r=vn(e,t);e=r.code;for(let i=1;i<5&&r.nestedOpening;i++){let i=e;if(i.includes(`[`)&&(i=pr(i,n)),i.includes(`(`)&&(i=mr(i,n)),r=vn(i,t),r.code===i)break;e=r.code}e.includes(`[`)&&(e=pr(e,n)),e.includes(`(`)&&(e=mr(e,n));let i=e.split(Ln);return n.size?i.map(e=>e.includes(Bn)?hr(e,n):e):i}const _r={name:`@teacss/core/extractor-split`,order:0,extract({code:e,id:t}){return gr(Kn(t)?e:Jn(e,Gn(t)),qn(t))}};var vr=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 vr}function yr(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 br(){return{events:Object.create(null),emit(e,...t){let n=Object.hasOwn(this.events,e)?this.events[e]:void 0,r=d(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)||yr(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;yr(n,e,d(Array.isArray(r)?r:[]).filter(e=>e!==t))}}}}const xr=/^\[(.+?)~?="(.*)"\]$/,Sr=/[\w\u00A0-\uFFFF%-?]/,Cr=new RegExp(xr.source,xr.flags),wr=/\.(css|postcss|sass|scss|less|stylus|styl)($|\?)/,Tr=new RegExp(Sr.source,Sr.flags);function Er(e){return e.match(xr)}function Dr(e=``){return Sr.test(e)}function Or(e){return typeof e==`function`?{match:e}:e}function kr(e){return e.length===3&&Object.hasOwn(e,0)&&Object.hasOwn(e,1)&&Object.hasOwn(e,2)}function Ar(e){return e!=null}function jr(e){return e!=null&&typeof e.then==`function`}function Mr(){}function Nr(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 Pr=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)))}},Fr=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 d(e(n,r)))Object.defineProperty(t,t.length,{configurable:!0,enumerable:!0,value:i,writable:!0})}),t}};function Ir(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 Lr(e){return Reflect.ownKeys(e).filter(t=>Object.getOwnPropertyDescriptor(e,t)?.enumerable)}function Rr(e,t){if(Object.getOwnPropertyDescriptor(e,t)?.enumerable)return{value:Reflect.get(e,t)}}function zr(e){let t=[];for(let n of Lr(e)){let r=Rr(e,n);r&&Object.defineProperty(t,t.length,{configurable:!0,enumerable:!0,value:[n,r.value],writable:!0})}return t}function Br(e){return m(e)?e:(Array.isArray(e)?d(e):zr(e)).filter(e=>{let t=Ir(e);return t!==void 0&&t[1]!=null})}function Vr(e){if(Array.isArray(e)){let t=d(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=>Br(e))}else return[Br(e)]}function Hr(e){let t=[],n,r;for(let i=0;i<e.length;i++){if(!Object.hasOwn(e,i))continue;let a=e[i],o=Ir(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 Ur=`__virtual_key__`;function Wr(e,t){return t==null||typeof t==`function`||typeof e!=`string`?``:e===`__virtual_key__`?t?String(t):``:`${e}:${t};`}function Gr(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=Ir(e[i]);if(!a)continue;let[o,s]=a;typeof o==`string`&&(o.startsWith(`$$`)||(o===`__virtual_key__`||n!==o||r!==s)&&(t+=Wr(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 Kr=`$reset`;function qr(e,t,n){Object.defineProperty(e,t,{value:n,configurable:!0,enumerable:!0,writable:!0})}function Jr(e,t,n=!1){let r=e,i=t;if(Array.isArray(i))return n&&Array.isArray(r)?[...d(r),...d(i)]:[...d(i)];if(K(i)&&Object.hasOwn(i,`$reset`)&&i.$reset){let{[Kr]:e,...t}=i;return Yr(t)}if(!K(i))return i;if(!K(r))return Yr(i);let a={...r};return Lr(i).forEach(e=>{if(e===`$reset`)return;let t=Rr(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{[Kr]:t,...n}=o;qr(a,e,Yr(n))}else K(s)&&K(o)||Array.isArray(s)&&Array.isArray(o)?qr(a,e,Jr(s,o,n)):qr(a,e,o)}),a}function Yr(e){if(Array.isArray(e))return d(e).map(Yr);if(K(e)){let t={};for(let n of Lr(e)){if(n===`$reset`)continue;let r=Rr(e,n);r&&qr(t,n,Yr(r.value))}return t}return e}function Xr(e){return typeof e!=`object`||!e?e:Zr(e)}function Zr(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)?Xr(e[n]):void 0;return t}if(K(e)){let t=e,n={};for(let e of Lr(t)){let r=Rr(t,e);r&&qr(n,e,Xr(r.value))}return n}return e}function Qr(e){return Object.hasOwn(e,0)&&m(e[0])}function $r(e){return Object.hasOwn(e,0)&&m(e[0])}const ei=/^[a-z][a-z0-9-]*$/,ti={minAffix:4,maxDistance:1,minDistanceLength:6,segmentAffix:!0},ni={minAffix:3,maxDistance:1,minDistanceLength:0,segmentAffix:!1},ri={minAffix:3,maxDistance:2,minDistanceLength:0,segmentAffix:!1},ii=new Set([`about`,`blob`,`bun`,`chrome`,`data`,`deno`,`file`,`ftp`,`http`,`https`,`jsr`,`mailto`,`node`,`npm`,`tel`,`urn`,`vscode`,`virtual`,`ws`,`wss`]);function ai(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 oi(e){let t=ai(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!ei.test(r)||t.startsWith(`//`,n+1)?!1:!ii.has(r)}function si(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}function ci(e,t){for(let n of t){let t=n[0];if((t.global||t.sticky)&&(t.lastIndex=0),t.test(e))return!0}return!1}const li=new WeakMap;function ui(e){let t=li.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=si(t[0]);e!=null&&!n.has(e)&&r.add(e)}let i={prefixValues:n,dynamicPrefixes:r};return li.set(e.rulesStaticMap,i),i}function di(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 fi(e,t){let n=Math.min(e.length,t.length),r=0;for(;r<n&&e[r]===t[r];)r++;return r}function pi(e,t){return(t.startsWith(e)?t[e.length]===`-`:t.endsWith(e)&&t[t.length-e.length-1]===`-`)&&(e.includes(`-`)||e.length>=6)}function mi(e,t,n){if(e.length>=n.minDistanceLength){let r=di(e,t,n.maxDistance);if(r!==1/0)return r}let r=e.length<=t.length?e:t,i=e.length<=t.length?t:e;if(r.length>=n.minAffix&&(n.segmentAffix?pi(r,i):i.startsWith(r)||i.endsWith(r)||i.includes(r)))return 3+(i.length-r.length)/100;if(!n.segmentAffix&&fi(e,t)>=n.minAffix)return 5+Math.abs(e.length-t.length)/100}function hi(e,t,n={}){let r=ai(e),i=r.indexOf(`:`);if(i<=0)return;let a=r.slice(0,i),o=r.slice(i+1),{prefixValues:s,dynamicPrefixes:c}=ui(t),l=[];if(s.has(a)||c.has(a)||ci(r,t.rulesDynamic))for(let e of s.get(a)??[]){if(e===o)continue;let t=mi(o,e,ri);t!==void 0&&l.push({suggestion:`${a}:${e}`,score:t})}else{if(!n.confirmedIntent&&a.length<3)return;let e=new Set([...s.keys(),...c]);for(let t of e){let e=mi(a,t,n.confirmedIntent?ni:ti);if(e===void 0)continue;let r=s.get(t)?.has(o)||c.has(t);l.push({suggestion:`${t}:${o}`,score:r?e:e+10})}if(l.length===0)return}l.sort((e,t)=>e.score-t.score||(e.suggestion<t.suggestion?-1:1));let u=new Set,d=[];for(let{suggestion:e}of l)if(!(u.has(e)||e===r)&&(u.add(e),d.push(e),d.length===3))break;return d}function gi(e){let t=e.split(/\s+/);return t[0]===``&&t.shift(),t.at(-1)===``&&t.pop(),t}function _i(e){if(!e.includes(`[`))return gi(e);let t=Le(e);if(t.length===0)return gi(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 vi(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 yi=new Set([`calc`,`clamp`,`max`,`min`]);function bi(e){return e==null?!1:e===`\\`||/[-_a-zA-Z0-9]/.test(e)||e.charCodeAt(0)>=128}function xi(e,t){if(t>0&&bi(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 Si(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 Ci(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 wi(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?!0:n[0].startsWith(`-`)&&t[r-1]===`-`?!1:/[\s,(+\-*/]/.test(t[r-1])}function Ti(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=Si(e),n=[],r=``;for(let i=0;i<e.length;){let a=Ci(e,i);if(a!=null){r+=e.slice(i,a),i=a;continue}let o=xi(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(yi.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&&!Ti(e,i,r)&&wi(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 Di(e){return e.length>=2&&e[0]===`[`&&e[e.length-1]===`]`}function Oi(e,t={}){let{calc:n=!0}=t,r=e;return Di(r)&&(r=vi(r.slice(1,-1))),n&&(r=Ei(r)),r}const ki=new re(256,void 0,!0);function Ai(e){return d(e).map(e=>e)}function ji(e,t,n){return n.some(n=>e.startsWith(n,t))}function Mi(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 Ni(e,t){let n=t+1;for(;/\s/.test(e[n]??``);)n++;return e[n]===`"`||e[n]===`'`||e[n]==="`"}function Pi(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){Ni(e,c)&&(!u||Fe(e,c)&&!Mi(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&&ji(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)||Ie(e,l,u)&&!Mi(e,l,t),f=(e[l-1]===`:`||e[l-1]===`@`||ji(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 Fi(e,t){let{barrierStarts:n,ranges:r}=Pi(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 Ii(e){let t=JSON.stringify(e),n=[...e].sort((e,t)=>t.length-e.length).map(wn).join(`|`),r=`\\[[^\\]]*?\\]`,i=ki.getOrInsert(t,RegExp(n?`((?:[!@*<~\\w+:_-]|${r})+?)(${n})\\(((?:[~!@<>\\w\\s:/\\\\,%#.$?-]|${r})+?)\\)(?!\\s*?=>)`:`(?!)`,`gm`));return i.lastIndex=0,i}function Li(e=[`-`,`:`]){let t=Ii(Ai(e));return new RegExp(t.source,t.flags)}function Ri(e,t=[`-`,`:`],n=5){let r=Ai(t),i=Ii(r),a=!1,o=typeof e==`string`?e:e.original,s=o,c=new Set,l=new Map;if(n>0){let e=Fi(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 _i(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=Fi(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 zi(e,t){let n=new Map,r=Ai(t).sort((e,t)=>t.length-e.length),i=_i(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(Ar).map(e=>typeof e==`string`?e:`${e.prefix}(${e.items.join(` `)})`).join(` `);return i?`${/^\s/.test(e)?` `:``}${i}${/\s$/.test(e)?` `:``}`:e?` `:``}function Bi(e,t=[`-`,`:`],n=5){let r=Ri(e,t,n);return typeof e==`string`?r.expanded:e}const Vi=new Set;function Hi(e){if(!Vi.has(e)){Vi.add(e);try{console.warn(`[Teacss]`,e)}catch(t){throw Vi.delete(e),t}}}function Ui(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 Wi(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 Gi(e,t){Object.defineProperty(e,e.length,{configurable:!0,enumerable:!0,value:t,writable:!0})}function Ki(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)&&Ui(e,`prefix`,[...d(r)]),t[2]=e}return t}function qi(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(Ui(e,`__index`,r),Qr(i)){let n=d(Wi(e,`prefix`)??``);for(let e of n)t[e+i[0]]=i}else Gi(n,i)}return n.reverse(),{rulesSize:e.length,rulesDynamic:n,rulesStaticMap:t}}function Ji(e){let t=d(e.rules).map(Ki),n=qi(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 Yi(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 Xi(e,t){Object.defineProperty(e,e.length,{configurable:!0,enumerable:!0,value:t,writable:!0})}function Zi(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 Qi(e){let t=new Set,n=[];for(let r of e){let e=r.name;t.has(e)||(t.add(e),Xi(n,r))}return n}function $i(e){return Array.from(e,(e,t)=>({index:t,order:Yi(e,`order`)||0,value:e})).sort((e,t)=>e.order-t.order||e.index-t.index).map(({value:e})=>e)}function ea(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 ta(e){return d(e).flatMap(e=>Array.isArray(e)?[e]:Object.entries(e))}const na=new WeakSet;function ra(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)?[...d(r)]:r,configurable:!0,enumerable:!0,writable:!0})}return Object.defineProperty(n,"name",{value:t,configurable:!0,enumerable:!0,writable:!0}),n}async function ia(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(na.has(t))return t;t=ra(t,n),na.add(t);let r=q(t,`shortcuts`),i=q(t,`rules`),a=r?ta(r).map(Ki):void 0;t.shortcuts=a,t.rules=i?d(i).map(Ki):void 0;let o=q(t,`prefix`),s=q(t,`layer`);if(o||s){let e=e=>{e[2]||={};let t=e[2];Yi(t,`prefix`)==null&&o&&Object.defineProperty(t,"prefix",{configurable:!0,enumerable:!0,value:[...d(o)],writable:!0}),Yi(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 aa(e){return oa(e,new Set)}async function oa(e,t){if(t.has(e))throw TypeError(`Circular TeaCSS preset reference detected.`);let n=new Set(t);n.add(e);let r=await ia(e),i=q(r,`presets`);if(!i)return[r];let a=d(i).flatMap(e=>Array.isArray(e)?[...e]:[e]);return[r,...(await Promise.all(a.map(e=>oa(e,n)))).flat()]}function sa(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&&Xi(t,u),d&&Xi(n,d)),c&&Xi(a,c),l&&Xi(o,l)}let s={};return r?s.pipeline=!1:i&&(s.pipeline={},t.length&&(s.pipeline.include=f(va(...t))),n.length&&(s.pipeline.exclude=f(va(...n)))),a.length&&(s.filesystem=f(a.flatMap(e=>d(e)))),o.length&&(s.inline=f(o.flatMap(e=>d(e)))),s}async function ca(e={},t={}){let n=ea(t,e),r=q(n,`presets`)??[],i=Qi((await Promise.all(d(r).flatMap(e=>d(e)).map(e=>aa(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`)}),{...we});function u(e){return f(s.flatMap(t=>d(q(t,e))))}let p=u(`extractors`),m=c.map(e=>q(e,`extractorDefault`)).find(e=>e!==void 0);m===void 0&&(m=_r),m&&!p.includes(m)&&Zi(p,m);let h=$i(p),g=u(`rules`).map(Ki),{rulesSize:_,rulesStaticMap:v,rulesDynamic:y}=qi(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:f(x(`templates`)),extractors:$i(x(`extractors`)),shorthands:_a(b.map(e=>q(e,`shorthands`)||{}))},C=u(`separators`);C.length||(C=[`:`,`-`]);let w=sa(u(`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:u(`blocklist`),presets:o,envMode:O,shortcutsLayer:q(n,`shortcutsLayer`)||`shortcuts`,layers:l,theme:ga(s.map(e=>q(e,`theme`))),rules:g,rulesSize:_,rulesDynamic:y,rulesStaticMap:v,preprocess:u(`preprocess`),postprocess:u(`postprocess`),preflights:u(`preflights`),autocomplete:S,variants:$i(u(`variants`).map(Or)),shortcuts:ta(u(`shortcuts`)).map(Ki).reverse(),extractors:h,safelist:u(`safelist`),separators:C,details:T??O===`dev`,content:w,transformers:Qi(u(`transformers`))},A=u(`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&&Ji(k),k}function la(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 ua(e,t,n){return Object.hasOwn(t,n)?Reflect.get(t,n):q(e,n)}function da(e,t,n){Object.defineProperty(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0})}function fa(e){let t=la(e);if(Object.hasOwn(e,`templates`)){let n=ua(e,t,`templates`);n===void 0?delete t.templates:da(t,`templates`,d(n))}if(Object.hasOwn(e,`extractors`)){let n=ua(e,t,`extractors`);n===void 0?delete t.extractors:da(t,`extractors`,d(n))}if(Object.hasOwn(e,`shorthands`)){let n=ua(e,t,`shorthands`);n===void 0?delete t.shorthands:da(t,`shorthands`,n)}return t}function pa(e={},t={}){let n=q(e,`shorthands`),r=q(t,`shorthands`),i={...e},a={...t};delete i.shorthands,delete a.shorthands;let o=Jr(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 ma(e){let t=la(e);if(Object.hasOwn(e,`entry`)){let n=ua(e,t,`entry`);n===void 0?delete t.entry:da(t,`entry`,d(n))}return t}function ha(e){let t=[`shortcuts`,`preprocess`,`postprocess`,`extendTheme`,`separators`];return d(e).map(e=>Object.entries(e).reduce((e,[n,r])=>{if(r===void 0)return e;let i=n===`autocomplete`&&r?fa(r):n===`cli`&&r?ma(r):t.includes(n)?d(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=Jr(u,d,!0);return(n||r)&&Object.defineProperty(f,"autocomplete",{configurable:!0,enumerable:!0,value:pa(n,r),writable:!0}),(c||l)&&Object.defineProperty(f,"theme",{configurable:!0,enumerable:!0,value:ga([c,l]),writable:!0}),(i||a)&&Object.defineProperty(f,"content",{configurable:!0,enumerable:!0,value:sa([i||{},a||{}]),writable:!0}),(o!==void 0||s!==void 0)&&da(f,`extractorDefault`,s===void 0?o:s),f},{})}function ga(e){return e.reduce((e,t)=>{if(!t)return e;let n=Zr(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 Jr({},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 Jr(e,n)},{})}function _a(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=d(r);n[e]=t.length===1?t[0]??``:`(${t.join(`|`)})`}else n[e]=r}return{...e,...n}},{})}function va(...e){return e.flatMap(e=>d(ya(e)))}function ya(e){return Array.isArray(e)?e:e?[e]:[]}function ba(e){return e}function xa(){let e=typeof process<`u`&&!!process.stdout;return{isNode:e,isVSCode:e&&!!process.env.VSCODE_CWD,isESLint:e&&!!process.env.ESLINT}}var Sa=`0.4.6`;const Ca=Object.getOwnPropertyDescriptor(RegExp.prototype,`source`).get,wa=[[`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]],Ta=Object.getOwnPropertyDescriptor(RegExp.prototype,`global`)?.get,Ea=Object.getOwnPropertyDescriptor(RegExp.prototype,`sticky`)?.get,Da=RegExp.prototype.exec;function J(e){return Reflect.apply(Ca,e,[])}function Oa(e){return!!(Ta&&Reflect.apply(Ta,e,[])||Ea&&Reflect.apply(Ea,e,[]))}function Y(e){let t=``;for(let[n,r]of wa)r&&Reflect.apply(r,e,[])&&(t+=n);return t}const ka=/[a-zA-Z0-9_-]/;function Aa(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 ja(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 Ma(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 Na(e,t){return e[t]===`:`&&!/[?*+{]/.test(e[t+1]??``)}function Pa(e){if(!e.startsWith(`^`)||Ma(e))return null;let t=1;for(;t<e.length&&ka.test(e[t]);)t++;if(t>1&&Na(e,t))return[e.slice(1,t)];let n=Fa(e,1,`:`);if(!n||!Na(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 Fa(e,t,n){let r=[``];for(;t<e.length;){let i=e[t];if(n.includes(i))break;if(ka.test(i)){let n=``;for(;t<e.length&&ka.test(e[t]);)n+=e[t++];r=r.map(e=>e+n);continue}let a=null;if(i===`(`)a=Ia(e,t);else if(i===`[`)a=La(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=ja(r,o);if(!s)return null;r=s}return{combos:r,end:t}}function Ia(e,t){if(t++,e.startsWith(`?:`,t))t+=2;else if(e[t]===`?`)return null;let n=[];for(;;){let r=Fa(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 La(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 Ra(e){if(Aa(e[2],`prefix`))return null;let[t]=e;return!(t instanceof RegExp)||Object.hasOwn(t,`exec`)||Object.getPrototypeOf(t)!==RegExp.prototype||t.exec!==Da||Y(t)?null:Pa(J(t))}function za(e){let t=e.map(e=>[e,Ra(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 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 Ba(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}const Va={px:1,rem:16,em:16,in:96,pt:96/72,pc:16,cm:96/2.54,mm:96/25.4,q:96/101.6},Ha=`vw.vh.vi.vb.vmin.vmax.svw.svh.svmin.svmax.lvw.lvh.lvmin.lvmax.dvw.dvh.dvmin.dvmax.cqw.cqh.cqi.cqb.cqmin.cqmax.ch.ex.cap.ic.lh.rlh.%`.split(`.`),Ua=RegExp(`^([+-]?(?:\\d+(?:\\.\\d+)?|\\.\\d+)(?:e[+-]?\\d+)?)(${[...Object.keys(Va),...Ha].sort((e,t)=>t.length-e.length).join(`|`)})?$`,`i`);function Wa(e){let t=Ua.exec(e.trim());if(!t)return null;let n=Number.parseFloat(t[1]);if(!Number.isFinite(n))return null;let r=(t[2]??`px`).toLowerCase();if(!Object.hasOwn(Va,r))return{unit:r,value:n};let i=Math.round(n*Va[r]*1e6)/1e6;return{unit:`px`,value:Number.isFinite(i)?i:n*Va[r]}}function Ga(e){let t=e.indexOf(` $$ `),n=t<0?e:e.slice(0,t);if(!/^@media\b/i.test(n)||/\bnot\b/i.test(n))return null;for(let e of n.matchAll(/\(\s*min-width\s*:\s*([^)]*?)\s*\)/gi)){let t=Wa(e[1]);if(t)return t}for(let e of n.matchAll(/\(\s*max-width\s*:\s*([^)]*?)\s*\)/gi)){let t=Wa(e[1]);if(t)return{unit:t.unit,value:-t.value}}return null}function Ka(e,t){return e<t?-1:+(e>t)}function qa(e,t){return Ka(e??``,t??``)}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 Ja(e,t){for(let n of t)Z(e,n)}function Ya(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 Xa(e){let t=new vr;for(let n of e)t.setCount(n,e.getCount(n));return t}function Za(e){return G(e)?Xa(e):new Set(e)}function Qa(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*$a(e,t){for(let n=0;n<e.length;n++){let r=t[n];r!=null&&(yield[e[n],r])}}function eo(e){if(e!==void 0&&(!Number.isSafeInteger(e)||e<1))throw RangeError(`tokenConcurrency must be a positive integer`)}function to(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 no(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 ro(e,t){return to(e,t)}function io(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 ao(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 oo(e,t){return e?.replaceAll($o(t),`&`)}function so(e,t){let n=t.exec;if(!Oa(t))return n.call(t,e);if(Object.getOwnPropertyDescriptor(t,`lastIndex`)?.writable===!1){if(n!==Da)return n.call(t,e);let r=new RegExp(J(t),Y(t));return Da.call(r,e)}t.lastIndex=0;try{return n.call(t,e)}finally{Object.getOwnPropertyDescriptor(t,`lastIndex`)?.writable!==!1&&(t.lastIndex=0)}}function co(e,t,n,r){let i=d(e).filter(lo),a=d(n).filter(lo);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]||oo(n[1],t)!==oo(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 lo(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 uo(e){return Object.hasOwn(e,0)&&e[0]===X.shortcutsNoMerge}function fo(e){for(let t=e.length-1;t>=0;t--){if(!Object.hasOwn(e,t))continue;let n=e[t];if(uo(n))return Object.hasOwn(n,1)?n[1]:void 0}}function po(e,t){let n=[...e,...t],r=[];for(let e=t.length-1;e>=0;e--)fe(t[e])&&Z(r,t[e]);for(let t=e.length-1;t>=0;t--)fe(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=pe(i,r[e])??i;let a=[],o=!1;for(let e of n)fe(e)?o||=(Z(a,i),!0):Z(a,e);return a}function mo(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=_i(Sn(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}function ho(e){for(let t=e.indexOf(`:`);t!==-1;t=e.indexOf(`:`,t+1)){if(t>0&&e[t-1]===`\\`)continue;let n=t+1;if(e.charCodeAt(n)===58&&n++,e.charCodeAt(n)!==45)continue;let r=e.charCodeAt(n+1)|32;if(r>=97&&r<=122)return!0}return!1}function go(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&&Ja(d[0],o)}e.length=r}function _o(e,t,n){let r=(e.get(t)??0)-(e.get(n)??0);if(r)return r;let i=Ga(t),a=Ga(n);if(i==null!=(a==null))return i==null?-1:1;if(i!=null&&a!=null){if(i.unit!==a.unit)return Ka(i.unit,a.unit);if(i.value!==a.value)return i.value-a.value}return Ka(t,n)}function vo(e,t,n=``){let r=yo(e);return`${r.join(`{`)}{${n}${t}${n}${`}`.repeat(r.length)}`}function yo(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 bo(e){let t=[];if(!e.includes(`$$`))return t;let 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 xo(e,t){let n=bo(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 So=new Set([Function.prototype,Object.getPrototypeOf(async()=>{}),Object.getPrototypeOf(function*(){}),Object.getPrototypeOf(async function*(){})]),Co=new Set([`arguments`,`caller`,`length`,`name`,`prototype`]);function wo(e){return Reflect.ownKeys(e).every(e=>Co.has(e))}function To(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 Eo(e,t){let n=To(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 Do(e){return Reflect.ownKeys(e).every(e=>e===`lastIndex`)}function Oo(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:wo(e),kind:`identity`,value:e};if(n.ignoreRegExpLastIndex&&e instanceof RegExp){let t=To(e);return{complete:t?.owner===RegExp.prototype&&t.value===Da&&Object.getPrototypeOf(e)===RegExp.prototype&&Do(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||So.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=Oo(i.value,t,n),Ao(s.value)||(o.complete=!1);try{let a=Reflect.get(e,r);s.observedValue=Oo(a,t,n),(!Object.is(a,i.value)||!Ao(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 ko(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||wo(t.value));if(t.kind===`regexp-identity`)return e===t.value&&e instanceof RegExp&&Eo(e,t.exec)&&J(e)===t.source&&Y(e)===t.flags&&(!t.complete||Do(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||!ko(s.value,a.value,n))return!1;if(a.observedValue!==void 0){let t;try{t=Reflect.get(e,o)}catch{return!1}if(!ko(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 Ao(e){return e.kind===`primitive`||e.complete}function jo(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=Oo(r[0],void 0,{functionsByIdentity:!0,ignoreRegExpLastIndex:!0}),s={body:r[1],bodySnapshot:Oo(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:Oo(a,void 0,{functionsByIdentity:!0,ignoreRegExpLastIndex:!0}),rule:r};Object.defineProperty(t,n,{configurable:!0,enumerable:!0,value:s,writable:!0})}return t}function Mo(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||!ko(i[0],a.matcherSnapshot)||i[0]instanceof RegExp&&(J(i[0])!==a.matcherSource||Y(i[0])!==a.matcherFlags)||!ko(i[1],a.bodySnapshot)||!ko(s,a.metaSnapshot))return!1}return!0}function No(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(!Ao(n)||!Ao(r)||!Ao(i))return!1}return!0}const Po=[`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=Oo(e[t],void 0,n);return{complete:Ao(r),isCurrent:e=>ko(e[t],r),key:t}}function Io(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 Lo(e,t){let n=Io(e,t);if(!n)return{complete:!0,value:Oo(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=Oo(r.value,void 0,{functionsByIdentity:!0,ignoreRegExpLastIndex:!0});return{complete:Ao(a),configurable:!!r.configurable,enumerable:!!r.enumerable,owner:i,value:a,writable:!!r.writable}}function Ro(e,t,n){let r=Io(e,t);if(!r)return n.owner===void 0&&n.value!==void 0&&ko(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&&ko(i.value,n.value):n.value===void 0&&i.get===n.get&&i.set===n.set}function zo(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=>Lo(a,e)):n.map(()=>Lo(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(!Ro(r,n[e],t.values[e]))return!1}}return!0},key:t}}function Bo(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=>Lo(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)=>Ro(o,e,i[t]))},key:t}}function Vo(e){return Po.map(t=>{switch(t){case`extractors`:return zo(e,t,[`name`,`order`,`extract`]);case`preflights`:return zo(e,t,[`getCSS`,`layer`]);case`variants`:return zo(e,t,[`match`,`multiPass`,`order`]);case`outputToCssLayers`:return Bo(e,t,[`allLayers`,`cssLayerName`]);case`shortcuts`:{let n=e.shortcuts,r=jo(n);return{complete:No(r),isCurrent:t=>t.shortcuts===e.shortcuts&&Mo(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 Ho(e,t){return t.every(t=>t.isCurrent(e))}function Uo(e){return e.every(({complete:e})=>e)}function Wo({authoredOutputOrders:e,config:t,currentSelectors:n,layerSet:r,matched:i,minify:a,parentOrders:o,preflights:s,preflightsMap:c,scope:l,sheet:u,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=>d(v.call(t,e.sort((e,t)=>y(e)-y(t)||Ka(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`?no(E,`cssLayerName`):void 0,O=typeof E==`object`&&no(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 f([...x,...O??[]]))A(e);let j=t=>{let r=(e,t)=>e.ruleIndex-t.ruleIndex||e.sort-t.sort||qa(e.currentSelector,t.currentSelector)||Number(t.noScope)-Number(e.noScope)||Number(t.noMerge)-Number(e.noMerge)||qa(e.selector,t.selector)||qa(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},ee=()=>{if(T)return T;let e=new Map,t=Array.from(u).sort((e,t)=>_o(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 u.clear(),T=e,e},M=e=>{if(C===void 0)return ee().get(e)||[];if(e!==C)return[];if(w)return w;let t=Array.from(u).sort((e,t)=>_o(o,e[0]||``,t[0]||``));return u.clear(),w=t,t},N=(e=Ce)=>{if(Object.hasOwn(S,e))return S[e];let t=M(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&&Zo(e,t);Z(n,[o==null?[]:[[o,$(i,`sort`)??0]],r,!!(a??$(i,`noMerge`))||o!=null&&ho(o)])}if(!n.length)return;_&&go(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]||qa(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?vo(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:``},P=(e=x,t)=>{let n=d(e).map(e=>e),r=new Set(d(t).map(e=>e)),i=n.filter(e=>!r.has(e)),a=i.map(N).filter(Boolean);if(E){let e=i;O&&(e=O);let t=f(e.map(A).filter(Ar));t.length>0&&Ya(a,`@layer ${t.join(`, `)};`)}return a.join(h)},F=async(e,t)=>{let n=await t(N(e));return S[e]=n,n},I;return{get css(){return P()},layers:[...x],matched:i,getLayers:P,getLayer:N,setLayer:F,get diagnostics(){return I??={unmatched:m()},I}}}var Go=class e{userConfig;defaults;version=Sa;events=br();config=void 0;cache=new re(I,void 0,!0);blocked=new ie(I,void 0,!0);_warnedUnmatched=new ie(I);parentOrders=new Map;activatedRules=new Set;_dynamicIndex;_expansionIndex;_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)?d(t).map(e=>e):[],r=[];for(let t of n)try{let n=t(e);jr(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._expansionIndex=void 0,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&&(Ho(this.config,this._preparedCacheSnapshot)||(n=!0,this._preparedCacheSnapshot=Vo(this.config),t=!0),r=Uo(this._preparedCacheSnapshot));let i=this._indexedRules===this.config.rules;if(!e&&i)return;let a=i&&!!this._indexedRuleSnapshot&&Mo(this.config.rules,this._indexedRuleSnapshot);(!i||!a)&&(n||=!!this._indexedRules,Ji(this.config),this._indexedRules=this.config.rules,this._indexedRuleSnapshot=jo(this.config.rules),this._dynamicIndex=void 0,t=!0),this._preparedConfigMutable&&(r=r&&!!this._indexedRuleSnapshot&&No(this._indexedRuleSnapshot),this._preparedCacheReliable=r),t&&this.clearRuntimeCaches(n)}collectValidatedParentOrders(e,t){for(let n of e){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,r=!1){let i=e[4],a;if(i){let e=Object.getOwnPropertyDescriptors(i),t=Reflect.ownKeys(e),r=!0;for(let n of t){let t=e[n];if(t.writable!==!0||t.enumerable!==!0||t.configurable!==!0||!Object.hasOwn(t,`value`)){r=!1;break}}if(r){let n=Object.create(null);for(let r of t){let t=e[r].value;n[r]=(r===`prefix`||r===`autocomplete`)&&Array.isArray(t)?[...d(t)]:t}a=n}else{let r=Object.create(null);for(let a of t){let t=e[a];n&&(t={configurable:!!t.configurable,enumerable:!!t.enumerable,value:`value`in t?t.value:Reflect.get(i,a),writable:!0}),(a===`prefix`||a===`autocomplete`)&&`value`in t&&Array.isArray(t.value)&&(t={...t,value:[...d(t.value)]}),r[a]=t}a=Object.defineProperties(Object.create(null),r)}}let o=e[5];if(r){let n=[e[0],e[1],e[2],e[3],a,o,e[6]];return t&&this.transferStringifiedMetadata(e,n),n}let s=o?{...o,theme:Zr(o.theme),variantHandlers:[...d(o.variantHandlers)],variantMatch:[o.variantMatch[0],o.variantMatch[1],[...d(o.variantMatch[2])],new Set(o.variantMatch[3])]}:void 0;o&&s&&(Object.hasOwn(o,`rules`)?s.rules=o.rules?Zr(d(o.rules)):o.rules:delete s.rules,Object.hasOwn(o,`shortcuts`)?s.shortcuts=o.shortcuts?Zr(d(o.shortcuts)):o.shortcuts:delete s.shortcuts,Object.hasOwn(o,`variants`)?s.variants=o.variants?Zr(d(o.variants)):o.variants:delete s.variants);let c=[e[0],e[1],e[2],e[3],a,s,e[6]];return t&&this.transferStringifiedMetadata(e,c),c}transferStringifiedMetadata(e,t){let n=this._stringifiedCurrentSelectors.get(e);n!==void 0&&this._stringifiedCurrentSelectors.set(t,n);let r=this._stringifiedOutputOrders.get(e);r&&this._stringifiedOutputOrders.set(t,r);let i=this._stringifiedParentOrders.get(e);i!==void 0&&this._stringifiedParentOrders.set(t,i)}copyValidatedStringifiedUtils(e,t,n=!1,r=!1){let i=e,a=i.map(e=>this.copyStringifiedUtil(e,t,n,r));if(t){let e,t;for(let o=0;o<i.length;o++){let s=this._shortcutMergeOrders.get(i[o]);if(!s)continue;if(!e||!t){e=new Map;for(let t=0;t<i.length;t++)e.set(i[t],a[t]);t=new Map}let c=e,l=t.get(s.group);if(!l){let e=e=>{let t=c.get(e);return t||(t=this.copyStringifiedUtil(e,!0,n,r),c.set(e,t)),t},i=s.components?.map(e),a=s.original?e(s.original):void 0;l={...s,components:i,group:{},original:a},t.set(s.group,l);for(let e of i??[])this._shortcutMergeOrders.set(e,l);a&&this._shortcutMergeOrders.set(a,l)}this._shortcutMergeOrders.set(a[o],l)}}return a}getExpansionIndex(e){let t=this._expansionIndex;if(t&&t.entries===e&&Ba(t.slots,e))return t;let n=new Map,r=[],i=(e,t)=>{let r=n.get(e);r?Z(r,t):n.set(e,[t])};for(let t=0;t<e.length;t++){if(!Object.hasOwn(e,t))continue;let n=e[t];if(!Array.isArray(n)||!Object.hasOwn(n,0)||!Object.hasOwn(n,1))continue;let a=Object.hasOwn(n,2)?n[2]:void 0;if(!m(n[0])){Z(r,{entry:n,order:t});continue}let o=n[0],s=a?.prefix?d(a.prefix):void 0;if(!s){i(o,{candidateRank:0,entry:n,kind:`inherited`,order:t,prefix:void 0});continue}for(let e=0;e<s.length;e++)i(s[e]+o,{candidateRank:e,entry:n,kind:`fixed`,order:t,prefix:s[e]});i(o,{candidateRank:s.length,entry:n,kind:`inherited`,order:t,prefix:void 0,requiresPrefixes:s})}return this._expansionIndex={dynamics:r,entries:e,slots:Array.from(e),statics:n},this._expansionIndex}getDynamicIndex(e){return this._dynamicIndex?.config!==e&&(this._dynamicIndex={config:e,...za(e.rulesDynamic)}),this._dynamicIndex}constructor(e={},t={}){this.userConfig=e,this.defaults=t}async ensureInitialized(){this.config||(this._initialization||=(async()=>{let e=await ca(this.userConfig,this.defaults);this.config||(this.config=e,this._indexedRules=e.rules,this._indexedRuleSnapshot=jo(e.rules),this.dispatchConfig(e))})(),await this._initialization)}static constructPublic(e,t){return new Ko(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 ca(t,i),o=e.constructPublic(t,i);o.config=a,o._indexedRules=a.rules,o._indexedRuleSnapshot=jo(a.rules),o._preparedCacheSnapshot=Vo(a),o._preparedConfigMutable=!0,o._preparedCacheReliable=Uo(o._preparedCacheSnapshot)&&No(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=Za(n),s=Za(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):(Qa(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 d(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)?d(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.copyValidatedStringifiedUtils(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()),u=()=>this.parseTokenInternal(e,t,n,!0);if(o&&this.blocked.has(e)){R(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&&d(p);if(!e||e.length===0)return e;let t=!0;for(let n=0;n<e.length;n++)if(!lo(e[n])){t=!1;break}let r=t?e:e.filter(lo);if(r.length>0)return n||this.collectValidatedParentOrders(r,this.parentOrders),r;this.cache.delete(f)}let m=e,h=m;for(let t of d(i.preprocess)){let n;try{n=t(h)}catch(e){if(l())return u();throw e}if(c())return u();if(!n){s&&(R(this.blocked,e),L(this.cache,f,null));return}h=n}let g;try{g=this.isBlocked(h)}catch(e){if(l())return u();throw e}if(c())return u();if(g){s&&(R(this.blocked,e),L(this.cache,f,null));return}let _;try{_=await this.matchVariantsForConfig(m,h,i)}catch(e){if(l())return u();throw e}if(c())return u();let v;try{v=_.every(e=>!e||this.isBlocked(e[1]))}catch(e){if(l())return u();throw e}if(c())return u();if(v){s&&(R(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(Ar);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 u();throw e}if(c()||this._preparedConfigMutable&&!n&&(this.ensureRuleIndexesCurrent(!0),c()))return u();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.collectValidatedParentOrders(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(` -`)&&co(i,r,t,e)&&n.add(r);return[...n]}generate(e,t={}){let n=m(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,u=!o||r===void 0||!(this.cache instanceof re)?void 0:this.cache,f=u?.revision,p=ro(t,`id`),h=ro(t,`scope`),g=ro(t,`preflights`),_=ro(t,`safelist`),v=ro(t,`minify`),y=ro(t,`extendedInfo`),b=ro(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);eo(b);let E;try{E=m(e)?await this.applyExtractorsForConfig(i,e,p,w?new vr:new Set):Array.isArray(e)?mo(new Set(d(e))):G(e)?mo(Xa(e)):mo(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 d(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([Ce]),k=w?new Map:new Set,A=new Map,j=[],ee=new Map,M=Object.create(null),N=Array.from(E),P;try{P=await ao(N,b,e=>this.parseTokenForGeneration(e))}catch(e){if(c())return T();throw e}if(s())return T();let F=0,I=u!==void 0,te=i.unmatched===`warn`||i.unmatched===`error`,ne=[];try{for(let e=0;e<N.length;e++){let t=N[e],n=P[e];if(n==null){te&&oi(t)&&!this.blocked.has(t)&&!this.isBlocked(t)&&!Object.hasOwn(i.rulesStaticMap,ai(t))&&Z(ne,t);continue}let r=this.copyValidatedStringifiedUtils(n,!0,!0,!0);F++,I&&!u.isRetained(t)&&(I=!1),k instanceof Map?k.set(t,{data:this.copyValidatedStringifiedUtils(r,!1),count:G(E)?E.getCount(t):-1}):k.add(t),this.collectValidatedParentOrders(r,ee);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 ee){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=d(i.preflights);if(!x||!e.length)return;let t={generator:this,generated:this.copyValidatedStringifiedUtils(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])}M=Object.assign(Object.create(null),Object.fromEntries(await Promise.all(Array.from(n).map(async e=>[e,(await Promise.all(d(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 ie,ae=()=>(ie??=ne.flatMap(e=>{let t=hi(e,i);return t===void 0?[]:[{token:e,suggestions:t}]}),ie);if(ne.length&&i.unmatched!==`off`&&i.unmatched!==void 0){let e=ae(),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)||(R(this._warnedUnmatched,n.token),console.warn(`[Teacss]`,`unmatched token ${t(n)}`))}let L;try{L=Wo({authoredOutputOrders:this._stringifiedOutputOrders,config:i,currentSelectors:this._stringifiedCurrentSelectors,layerSet:O,matched:k,minify:C,parentOrders:l,preflights:x,preflightsMap:M,scope:h,sheet:A,shortcutMergeOrders:this._shortcutMergeOrders,resolveUnmatched:ae}),await Promise.resolve(),this._preparedConfigMutable&&this.ensureRuleIndexesCurrent(!0)}catch(e){if(c())return T();throw e}return s()?T():(u&&f!==void 0&&this.cache===u&&r===this._collectionGeneration&&(!I||F!==u.retainedSize)&&u.replaceRetained($a(N,P),f),L)}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};ce(r,this._variantCacheOwner);let i=d(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 u=l.call(e,c,r),f=jr(u)?await u:u;if(f){if(m(f)){if(f===c)continue;f={matcher:f}}if(Array.isArray(f)){let n=d(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,Ya(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=$o(n),i){let a=d(t).map(io),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??es).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`),u=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&&u!=null&&this._utilParentOrders.set(p,u);let m=d(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 d(a).filter(Ar))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=Br(t);return this.constructNormalizedCSS(e,r,n)}constructNormalizedCSS(e,t,n){if(m(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,[Ur,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:Gr(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?vo(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),u=this._runtimeRevision,f=m(e)?await this.matchVariantsForConfig(e,void 0,c):[e],p=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=Br(e[0]);if(!m(r)&&fo(r))return this.constructNormalizedCSS(o,r,e[1]);s||(s={...o,variantHandlers:po(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=d(r);for(let t=c.rules.length-1;t>=0;t--){let n=c.rules[t];if(!Qr(n)||n[0]!==i)continue;let r=$(n[2],`prefix`);if(!r||d(r).some(t=>e.includes(t))){l=n;break}}}let u=l,f=()=>{let t=u;if(u=void 0,!(!t?.[1]||!n&&$(t[2],`internal`)))return this.resolveCSSResult(e,t[1],t,o)},p=i.indexOf(`:`),h=this.getDynamicIndex(c),g=p>0&&h.map.get(i.slice(0,p))||h.fallback;for(let t of g){let[a,s,c]=t;if(($(u?.[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=d(p);if(r){let t=d(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=so(n,a);if(!r)continue;let i=s(r,o),c=jr(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 p(f[0])??[]:(await Promise.all(f.map(e=>p(e)))).flat().filter(e=>!!e);if(l&&(this.ensureRuleIndexesCurrent(!0),this.config===c&&this._runtimeRevision!==u))return s(),this.parseUtil(e,t,n,r);if(h.length)return h}resolveCSSResult=(e,t,n,r)=>{let i=Vr(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(m(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]},u=e=>{o=[...o,e]},f=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=d(t).map(e=>e))}else o=[...d(e),...o];break}case X.parent:l({parent:a()});break;case X.selector:u({selector:a()});break;case X.layer:l({layer:a()});break;case X.sort:f({sort:a()});break;case X.noMerge:f({noMerge:a()});break;case X.noScope:f({noScope:a()});break;case X.shortcutsNoMerge:Z(i,n);break;case X.body:Z(i,[Ur,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(kr(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=Gr(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=d(r);if(n<=0||!s.length)return;let c=this.getContextConfig(t),l=m(e)?e:e[1],u=c.details?e=>{t.shortcuts=t.shortcuts??[],Z(t.shortcuts,e)}:Mr,f,p,h,g,_=o,v=this.getExpansionIndex(s),y,b=v.statics.get(l);if(b){for(let e of b)if(!(e.requiresPrefixes&&!(o&&e.requiresPrefixes.includes(o)))&&e.entry[1]){y=e;break}}let x=y?y.order:1/0,S=[{prefix:o,value:l}];expansionLoop:for(let{entry:e,order:n}of v.dynamics){if(n>=x)break;let r=Object.hasOwn(e,2)?e[2]:void 0,i=S;if(r?.prefix){let e=d(r.prefix);if(i=e.filter(e=>l.startsWith(e)).map(e=>({prefix:e,value:l.slice(e.length)})),o&&e.includes(o)&&Z(i,{prefix:o,value:l}),!i.length)continue}for(let n of i){if(m(e[0])){if(e[0]!==n.value)continue;p=e[1]}else{let r=so(n.value,e[0]);r&&(p=e[1](r,t))}if(p){_=n.prefix,f||=r,u(e);break expansionLoop}}}if(!p&&y){let e=y.entry;p=e[1],p&&(_=y.kind===`fixed`?y.prefix:o,f=Object.hasOwn(e,2)?e[2]:void 0,u(e))}if(p){let e=m(p)?[p]:d(p);h=e.filter(e=>m(e)).flatMap(e=>_i(Bi(e.trim(),c.separators))).map(e=>({prefix:_,value:e})),g=e.filter(e=>!m(e)).map(e=>({handles:[],value:e}))}if(!p&&m(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];m(r)&&Z(h,{prefix:t[n]??o,value:s.replace(c,()=>r)})}g??=[],Ja(g,e[0].filter(e=>!m(e)).map(e=>({handles:[...e.handles,...l],value:e.value})))}}}}if(!h?.length&&!g?.length)return;let C=new Map,w=(h??[]).filter(({prefix:e,value:t})=>{let n=C.get(e);return n||(n=new Set,C.set(e,n)),n.has(t)?!1:(n.add(t),!0)}),T=[...(await Promise.all(w.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[T.map(({value:e})=>e),f,T.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 Fr,c=(await Promise.all(n.map(async(n,i)=>{let s=m(n)?await this.parseUtil(n,t,!0,o[i]??$(r,`prefix`)):[[1/0,`{inline}`,Br(n.value),void 0,n.handles]];return!s&&a.warn&&Hi(`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,,u]=e,f=c.some(kr),p={},h=0,g=[],_=e=>{let t=this._shortcutMergeOrders.get(e)?.components;if(!t?.length){this._stringifiedOutputOrders.set(e,{group:p,index:h++});return}let n;for(let e of t){let t={group:p,index:h++};n??=t,this._stringifiedOutputOrders.set(e,t)}n&&this._stringifiedOutputOrders.set(e,n)};for(let e of c){if(kr(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=fo(e[2]),i=n?e[4]:po(e[4],u);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=Gr(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=Gr(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?Gr(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(Ar):void 0,v.original=g,this._shortcutMergeOrders.set(g,v),g}})},u=[],f=[],p=[],m=[];for(let[t,n,r,i]of e){let e=d(t).some(uo);Z(n?e?u:f:e?p:m,[t,r,i])}return[...l(!1,!0,u),...l(!0,!0,f),...l(!1,!1,p),...l(!0,!1,m)].filter(Ar)}).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):m(e)?e===t:so(t,e)!==null}},Ko=class extends Go{constructor(e={},t={}){super(e,t)}};async function qo(e,t){return await Go.create(e,t)}const Jo=/\s\$\$\s+/g;function Yo(e){return bo(e).length>0}function Xo(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 Zo(e,t){return Xo(e).map(e=>{let n=e.startsWith(`$$`)&&/\s/.test(e[2]??``)?` ${e}`:e;return t?Yo(n)?xo(n,t):`${t} ${e}`:xo(n)}).join(`,`)}const Qo=/^\[(.+?)(~?=)"(.*)"\]$/;function $o(e){return Qo.test(e)?e.replace(Qo,(e,t,n,r)=>`[${En(t)}${n}"${En(r)}"]`):`.${En(e)}`}function es(e,t){return t(e)}const ts=e.hash??((t,n,r)=>e.createHash(t).update(n).digest(r));function ns(e,t=8){return ts(`sha256`,e,`hex`).substring(0,t)}const rs=`@teacss-include`,is=`@teacss-ignore`,as=`@teacss-ide-include`,os=`@teacss-placeholder`,ss=`@teacss-skip-start`,cs=`@teacss-skip-end`,ls=RegExp(`(//\\s*?${ss}\\s*?|\\/\\*\\s*?${ss}\\s*?\\*\\/|<!--\\s*?${ss}\\s*?-->)[\\s\\S]*?(//\\s*?${cs}\\s*?|\\/\\*\\s*?${cs}\\s*?\\*\\/|<!--\\s*?${cs}\\s*?-->)`,`g`),us=[/^(?:virtual:)?tea(?::(.+))?\.css(\?.*)?$/],ds=`__ALL__`;export{Fr as BetterMap,os as CSS_PLACEHOLDER,vr as CountableSet,we as DEFAULT_LAYERS,is as IGNORE_COMMENT,rs as INCLUDE_COMMENT,as as INCLUDE_COMMENT_IDE,ve as LAYER_IMPORTS,ds as LAYER_MARK_ALL,xe as LAYER_PREFLIGHTS,ye as LAYER_PRIMITIVES,be as LAYER_PROPERTIES,Se as LAYER_SHORTCUTS,Ce as LAYER_UTILITIES,Kr as RESET_KEY,ls as SKIP_COMMENT_RE,cs as SKIP_END_COMMENT,ss as SKIP_START_COMMENT,Ko as TeacssGenerator,Pr as TwoKeyMap,us as VIRTUAL_ENTRY_ALIAS,Ur as VirtualKey,Cr as attributifyRE,F as buildConditionSelector,Hr as clearIdenticalEntries,Zr as clone,zi as collapseVariantGroup,Wa as comparableWidth,_o as compareParentAtRules,_e as createConditionVariant,qo as createGenerator,br as createNanoEvents,wr as cssIdRE,Rn as defaultSplitRE,ba as definePreset,hi as diagnoseUnmatchedToken,En as e,Gr as entriesToCss,wn as escapeRegExp,Tn as escapeSelector,Sn as expandClassGroups,_n as expandGroups,vi as expandUnderscores,Bi as expandVariantGroup,_r as extractorDefault,_r as extractorSplit,xa as getEnvFlags,ns as getHash,kn as getPath,Yo as hasScopePlaceholder,jn as hash,Di as isArbitrary,Er as isAttributifySelector,G as isCountableSet,An as isCssId,K as isObject,kr as isRawUtil,Qr as isStaticRule,$r as isStaticShortcut,m as isString,jr as isThenable,oi as isTokenShaped,Dr as isValidSelector,C as isValidTargetSelector,Li as makeRegexClassGroup,ha as mergeConfigs,Jr as mergeDeep,Mr as noop,Oi as normalizeArbitraryValue,Br as normalizeCSSEntries,Vr as normalizeCSSValues,Or as normalizeVariant,Ar as notNull,ge as parseClassToken,D as parseCondition,O as parseConditions,Ri as parseVariantGroup,Jo as regexScopePlaceholder,In as replaceAsync,P as resolveConditions,ca as resolveConfig,ia as resolvePreset,aa as resolvePresets,ta as resolveShortcuts,Fn as restoreSkipCode,Ei as spaceCalcOperators,_i as splitClassTokens,zn as splitWithVariantGroupRE,X as symbols,d as toArray,$o as toEscapedSelector,ai as tokenConditionBase,Pn as transformSkipCode,f as uniq,p as uniqueBy,Tr as validateFilterRE,Hi as warnOnce,Nr as withLayer};
|
|
1
|
+
import e from"node:crypto";function t(e,t){Object.defineProperty(e,e.length,{configurable:!0,enumerable:!0,value:t,writable:!0})}function*n(e){if(Array.isArray(e))for(let t=0,n=e.length;t<n;t++)Object.hasOwn(e,t)&&(yield e[t])}const r=new Set([`>`,`+`,`~`]);function i(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 a(e){if(e===void 0)return!1;let t=e.charCodeAt(0);return t>=97&&t<=122||t>=65&&t<=90||e===`_`||t>=128}function o(e,t){let n=e[t];if(n===`-`){let n=e[t+1];return n===`-`||n===`\\`||a(n)}return a(n)}function s(e,t){let n=/^(?:[\da-f]{1,6}(?:\r\n|[ \t\n\r\f])?|[^\n\r\f])/i.exec(e.slice(t+1));return n?t+1+n[0].length:void 0}function c(e,t){let n=t;if(e[n]===`\\`||o(e,n)){for(;n<e.length;){if(e[n]===`\\`){let t=s(e,n);if(t===void 0)return;n=t;continue}if(!i(e[n]))break;n++}return n>t?n:void 0}}function l(e){return e.replace(/\\([\da-f]{1,6})(?:\r\n|[ \t\n\r\f])?|\\([^\n\r\f])/gi,(e,t,n)=>{if(!t)return n;let r=Number.parseInt(t,16);return String.fromCodePoint(r===0||r>1114111||r>=55296&&r<=57343?65533:r)})}function u(e,t){let n=e[t];for(let r=t+1;r<e.length;r++){let t=e[r];if(t===n)return r+1;if(t===`\\`){let t=/^(?:[\da-f]{1,6}(?:\r\n|[ \t\n\r\f])?|\r\n|[\s\S])/i.exec(e.slice(r+1));if(!t)return;r+=t[0].length}else if(/[\n\r\f]/.test(t))return}}function d(e,t,n,r){if(e[t]!==n)return;let i=0;for(let a=t;a<e.length;a++){let t=e[a];if(t===`\\`){let t=s(e,a);if(t===void 0)return;a=t-1}else if(t===`/`&&e[a+1]===`*`){let t=e.indexOf(`*/`,a+2);if(t===-1)return;a=t+1}else if(t===`"`||t===`'`){let t=u(e,a);if(t===void 0)return;a=t-1}else if(t===n)i++;else if(t===r&&--i===0)return a+1}}function f(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 p(e,t){let n=c(e,f(e,t+1));if(n!==void 0)return e[n]===`(`?d(e,n,`(`,`)`):n}function m(e,t){let n=f(e,t),r=n;if(e[n]===`*`&&!(e[n+1]===`/`&&n>t))n++;else{let t=c(e,n);t!==void 0&&(n=t)}let i=+(n>r);for(;n<e.length;){let t=f(e,n);if(t!==n){n=t;continue}let r=e[n];if(r===`.`||r===`#`){let t=c(e,r===`.`?f(e,n+1):n+1);if(t===void 0)return;n=t}else if(r===`[`){let t=d(e,n,`[`,`]`);if(t===void 0||!/[^ \t\n\r\f]/.test(e.slice(n+1,t-1).replace(/\/\*[\s\S]*?\*\//g,``)))return;n=t}else if(r===`:`){let t=p(e,n);if(t===void 0)return;n=t}else break;i++}return i>0?n:void 0}function h(e){let t=f(e,0);if(t===e.length)return!1;for(;t<e.length;){if(e[t]!==`:`)return!1;let n=p(e,t);if(n===void 0)return!1;t=f(e,n)}return!0}function g(e){if(!e)return!1;let t=0;for(;;){let n=m(e,t);if(n===void 0)return!1;if(t=f(e,n),t===e.length)return!0;if(!r.has(e[t])||(t=f(e,t+1),t===e.length))return!1}}const _=new Set([`before`,`after`,`first-line`,`first-letter`]);function v(e,t){let n=C(e,t);return n!==void 0&&_.has(n.name)}function y(e,t){let n=0,r=0,i;for(let a=0;a<e.length;a++){let o=e[a];if(i)o===`\\`?a++:o===i&&(i=void 0);else if(o===`\\`)a++;else if(o===`/`&&e[a+1]===`*`){let t=e.indexOf(`*/`,a+2);if(t===-1)return;a=t+1}else if(o===`"`||o===`'`)i=o;else if(o===`[`)n++;else if(o===`]`)n>0&&n--;else if(o===`(`)r++;else if(o===`)`)r>0&&r--;else if(o===`:`&&n===0&&r===0){let n=f(e,a+1);if(e[n]===`:`){if(t(a))return;a=n}else if(v(e,a)&&t(a))return}}}function b(e){let t=-1;return y(e,e=>(t=e,!0)),t}function x(e){let t=!0;return y(e,n=>!C(e,n)&&(t=!1,!0)),t}function S(e){let t=0;return y(e,()=>(t++,!1)),t}function C(e,t){let n=f(e,t+1);e[n]===`:`&&(n=f(e,n+1));let r=c(e,n);if(r!==void 0)return{end:r,name:l(e.slice(n,r)).toLowerCase()}}function w(e,t,n,r){let i=0,a;for(let o=t;o<n;o++){let s=e[o];if(a){s===`\\`?o++:s===a&&(a=void 0);continue}if(s===`\\`)o++;else if(s===`/`&&e[o+1]===`*`){let t=e.indexOf(`*/`,o+2);if(t===-1||t>=n)return!1;o=t+1}else if(s===`"`||s===`'`)a=s;else if(s===`(`)i++;else if(s===`)`){if(i--,i===0){let i=e.slice(t+1,o).replaceAll(/\/\*[\s\S]*?\*\//g,``),a=e.slice(o+1,n),s=f(a,0)===a.length;return/[^ \t\n\r\f]/.test(i)&&(s||r&&h(a))}if(i<0)return!1}}return!1}function T(e){let n=[],r=0,i=!1;if(y(e,a=>{r++;let o=C(e,a);return o?t(n,{...o,index:a}):i=!0,r>2}),r<=1)return!0;if(i||r!==2||n.length!==2)return!1;let[a,o]=n,s=a.name,c=o.name;return s!==`part`&&s!==`slotted`||e[f(e,a.index+1)]!==`:`||e[a.end]!==`(`||!w(e,a.end,o.index,s===`part`)?!1:c===`before`||c===`after`||c===`marker`||c===`placeholder`||c===`file-selector-button`||s===`part`&&(c===`first-line`||c===`first-letter`)}function E(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 D(e,t,n){Object.defineProperty(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0})}function O(e=void 0){if(e===void 0)return[];if(!Array.isArray(e))return[e];for(let t=0,n=e.length;t<n;t++){if(Object.hasOwn(e,t))continue;let r=[],i=0;for(let t=0;t<n;t++)Object.hasOwn(e,t)&&D(r,i++,e[t]);return r}return e}function k(e){return Array.from(new Set(n(e)))}function A(e,r){let i=[];for(let a of n(e))i.findIndex(e=>r(a,e))===-1&&t(i,a);return i}function j(e){return typeof e==`string`}const M={">":` > `,_:` `,"+":` + `,"~":` ~ `};function N(e){let t=e[0];return t!==void 0&&Object.hasOwn(M,t)?M[t]:void 0}function P(e){let t=e.startsWith(`!`),n=t?e.slice(1):e,r;return r=n[0]===`:`&&n[f(n,1)]===`:`?`pseudo-element`:n[0]===`.`||n[0]===`#`?`self`:N(n)===void 0?n[0]===`[`?`arbitrary`:`named`:`target`,{raw:e,kind:r,negate:t,value:n}}function F(e){return Array.from(n(e),P)}function I(e){let n=[];for(let r=0;r<e.length;r++){let i=e[r];if(i===`\\`){let t=s(e,r);if(t===void 0)return!1;r=t-1;continue}if(i===`/`&&e[r+1]===`*`){let t=e.indexOf(`*/`,r+2);if(t===-1)return!1;r=t+1;continue}if(i===`"`||i===`'`){let t=u(e,r);if(t===void 0)return!1;r=t-1;continue}if(i===`[`||i===`(`){t(n,i);continue}if(i===`]`||i===`)`){if(n.pop()!==(i===`]`?`[`:`(`))return!1;continue}if(n.length===0&&/[,;{}>+~ \t\n\r\f]/.test(i))return!1}return n.length===0}function L(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;if(!t||e.kind===`self`&&t.length===1||!x(t)||!I(t))return!0;if(e.kind===`self`){let n=b(t);return e.negate&&n!==-1?!0:!g(n===-1?t:t.slice(0,n))}return!1}function ee(e){switch(e.kind){case`self`:{if(e.negate)return{suffix:`:not(${e.value})`};let t=b(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=N(e.value);if(t===void 0)return;let n=e.value.slice(1),r=b(n);return g(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 te(e){let t={},n=E(e,`prefix`),r=E(e,`suffix`),i=E(e,`combinator`),a=E(e,`pseudoElement`),o=E(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 ne(e){let t=e.suffix;if(!t)return e;let n=b(t);return n===-1?e:{...e,suffix:t.slice(0,n)||void 0,pseudoElement:`${t.slice(n)}${e.pseudoElement??``}`}}function re(e){let t=e.pseudoElement;if(!t)return e;let n=S(t);if(n>1&&!T(t))throw Error(`[Teacss] a token may use at most one pseudo-element, found ${n}`);return e}function ie(e,r=[],i){let a=O(e),o=O(r),s={conditions:a,theme:i},c=[],l=[];for(let e of n(a)){if(L(e)||e.negate&&(e.kind===`pseudo-element`||e.kind===`target`)){t(l,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=S(t);if(n>1&&!T(t))throw Error(`[Teacss] a token may use at most one pseudo-element, found ${n}`)}let r=ee(e);if(!r){for(let t of n(o))if(r=t(e,s),r||e.negate&&t({...e,raw:e.value,negate:!1},s))break}r?t(c,re(ne(te(r)))):t(l,e)}let u=c.map(e=>e.pseudoElement??``).join(``),d=S(u);if(d>1&&!T(u))throw Error(`[Teacss] a token may use at most one pseudo-element, found ${d}`);return{resolved:c,unresolved:l}}function ae(e,t){let r=Array.from(n(t),te),i=r.map(e=>e.prefix).filter(Boolean),a=r.map(e=>e.suffix).filter(Boolean),o=r.map(e=>e.combinator).filter(Boolean),s=r.map(e=>e.pseudoElement).filter(Boolean),c=r.map(e=>e.parent).filter(Boolean);return{selector:`${i.join(``)}${e}${a.join(``)}${o.join(``)}${s.join(``)}`,parents:c}}const R=1e4;function z(e,t){return e===t||Object.is(e,t)}var oe=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}},se=class extends Map{assumeNoPrototypeBypass;maxEntries;order=new oe;retained=new Set;_revision=0;constructor(e=R,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);return super.set(e,t),!n&&!this.retained.has(e)&&this.order.add(e),this._revision++,this.enforceInstanceLimit(),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){if(typeof t!=`function`)throw TypeError(`Map insertion callback must be callable`);this.reconcileOrder();let n=super.get(e);if(n!==void 0||super.has(e))return this.enforceInstanceLimit(),n;let r=e===0?0:e,i=t(r);return this.set(r,i),i}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.size-this.retained.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.size-this.retained.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&&!z(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)))}},ce=class extends Set{assumeNoPrototypeBypass;maxEntries;order=new oe;constructor(e=R,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&&!z(e.value,t.value))&&this.order.reset(super.values())}};function le(e){let t=e.keys().next();t.done||e.delete(t.value)}function B(e,t,n,r){if(e instanceof se){e.setAndTouch(t,n,r??e.maxEntries);return}e.delete(t),e.set(t,n),e.size>(r??1e4)&&le(e)}function ue(e,t,n){if(e instanceof ce){e.addAndTouch(t,n??e.maxEntries);return}e.delete(t),e.add(t),e.size>(n??1e4)&&le(e)}const de=new WeakMap,fe=new WeakMap;function pe(e,t){fe.set(e,t)}function me(e){return e&&fe.get(e)}function he(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 ge(e,t){return de.set(e,t),e}function _e(e){return de.has(e)}function ve(e,t){let n=de.get(e),r=de.get(t);if(!n||!r)return;let i=`${r.pseudoElement}${n.pseudoElement}`,a=S(i);if(a>1&&!T(i))throw Error(`[Teacss] a token may use at most one pseudo-element, found ${a}`);let o={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 ge({handle:he(o)},o)}function V(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 ye(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 be(e,t){let n=0;for(;e[t-n-1]===`\\`;)n++;return n%2==1}const xe=/^(?:[\p{ID_Continue}$-]|\u200C|\u200D)+$/u,Se=/^(?:\d(?:_?\d)*(?:\.\d(?:_?\d)*)?|\d(?:_?\d)*\.|\.\d(?:_?\d)*)(?:e[+-]?\d(?:_?\d)*)?$/i;function Ce(e,t){let n=t-1;for(;n>=0&&/\s/.test(e[n]);)n--;return n>=0&&`{,`.includes(e[n])}function we(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 Te(e,t){let n=0,r;for(let i=t;i>=0;i--){let a=e[i];if(r)a===r&&!be(e,i)&&(r=void 0);else if(a===`"`||a===`'`||a==="`")r=a;else if(a===`]`)n++;else if(a===`[`&&(n--,Ce(e,i)&&(n===0||we(e,i,t))))return i}}function Ee(e,t){let n=e[t];if(n===`"`||n===`'`||n==="`"){for(let r=t-1;r>=0;r--)if(e[r]===n&&!be(e,r))return r;return}if(n===`]`)return Te(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 xe.test(i)||Se.test(i)?r:void 0}function De(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=Ee(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 Oe(e,t){return De(e,t)}function ke(e,t){let n=t+1;for(;/\s/.test(e[n]??``);)n++;return e[n]!==`"`&&e[n]!==`'`&&e[n]!=="`"?!1:Oe(e,t)}function Ae(e,t,n){if(!ke(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 je(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===`[`&&V(n,s);continue}if((o||i)&&c===`[`&&/[:@\s]/.test(e[s-1])){V(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===`[`)V(n,s);else if(c===`]`){let a=n.pop(),c=r.get(a);(/[:@]/.test(e[a-1])||e[s+1]===`:`)&&V(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)&&V(s,e);return s}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||i!==-1)&&c===`\\`){s++;continue}if(t.length>0&&(c===`"`||c===`'`)){n=c;continue}if((t.length>0||i!==-1)&&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),V(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;V(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 Ne(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 se(R,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 B(o,i,s),s;let{resolved:c,unresolved:l}=ie(F(t),e,n);if(l.length>0||c.length===0)return B(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:he(d)};return B(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,me(t));return r?ge({matcher:`${n.body}${n.important?`!`:``}`,handle:r.handle},r):void 0},multiPass:!1}}const Pe=`imports`,Fe=`primitives`,Ie=`properties`,Le=`preflights`,Re=`shortcuts`,ze=`utilities`,Be=Object.freeze({[Pe]:-200,[Ie]:-150,[Le]:-100,[Re]:-50,[Fe]:-10,[ze]:0});function H(e,n,r){let i=e[n];if(r.blockComment)return i===`*`&&e[n+1]===`/`?(r.blockComment=!1,n+1):n;if(r.quote)return i===`\\`?n+1:(i===r.quote&&(r.quote=void 0),n);if(r.closers.length>0&&i===`/`&&e[n+1]===`*`)return r.blockComment=!0,n+1;if(r.closers.length>0&&(i===`"`||i===`'`))return r.quote=i,n;if(i===`\\`)return n+1;if(i===`(`||i===`[`)return t(r.closers,i===`(`?`)`:`]`),n;if(i===r.closers.at(-1))return r.closers.pop(),n}function Ve(e,t,n=e.length){let r={closers:[]};for(let i=t+1;i<n;i++){let t=e[i],n=H(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 He(e,t,n=e.length){let r={closers:[]},i=zt();for(let a=t+1;a<n;a++){let t=e[a],n=H(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]===`*`||Jt(e,a,i.forceRegex,i.canEnd)))return{index:a,kind:`host`};/\s/.test(t)||(i.forceRegex=!1),i.canEnd=qt(e,a,i.canEnd,i)}}return{index:n,kind:`limit`}}const Ue=/[\s'"`;{},\])]/;function We(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=H(e,i,r);if(n!==void 0){i=n;continue}if(t===`/`&&(e[i+1]===`/`||e[i+1]===`*`)&&r.closers.length===0||Ue.test(t)&&r.closers.length===0)break}return{conds:e.slice(t,i),end:i}}function Ge(e,n=!1){let r=[],i={closers:[]},a=0;for(let o=0;o<e.length;o++){let s=e[o],c=H(e,o,i);if(c!==void 0){o=c;continue}(s===`;`||n&&/\s/.test(s))&&i.closers.length===0&&(t(r,e.slice(a,o)),a=o+1)}return t(r,e.slice(a)),r.map(e=>e.trim()).filter(Boolean)}function Ke(e){let t={closers:[]},n=!1,r=!1;for(let i=0;i<e.length;i++){let a=e[i],o=H(e,i,t);if(o!==void 0){i=o;continue}if(!(t.closers.length>0)){if(a===`<`&&Xt(e,i))return!1;if(a===`;`)return!0;a===`:`?n=!0:a===`?`&&(r=!0)}}return n&&!r}function qe(e,t){let n=He(e,t);if(n.kind!==`close`)return;let r=e.slice(t+1,n.index);if(!Ke(r))return;let i=Ge(r,!0);if(i.length===0)return;let{conds:a,end:o}=We(e,n.index+1);return{end:o,value:i.map(e=>`${e}${a}`).join(` `)}}function U(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 Je(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===`\\`?U(e,t):(r===n.quote&&(n.quote=void 0),t+1):r===`\\`?U(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 Ye(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=Je(e,i,r),r.depth===0)return t}return-1}const Xe=`=([{,:>)$?|&.!~+-*/%^<`,Ze=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`]),$e=new Set([`catch`,`for`,`if`,`switch`,`while`,`with`]),et=/^(?: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,tt=/^(?:--|-?)[_a-z][-\w]*$/i,nt=/^[+-]?(?:(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?)%$/i;function rt(e){if(/^(?:from|to)$/i.test(e)||nt.test(e))return!0;let t=e.search(/\s/u);if(t<1)return!1;let n=e.slice(t).trim();return tt.test(e.slice(0,t))&&nt.test(n)}function it(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 at(e,t,n=0){return/\bfunction(?:\s*\*)?[\s\S]*$/.test(e.slice(n,t))}function ot(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 st(e,t,n=0){return/(?:^|[^\w$])(?:abstract\s+)?class\b[^{};]*$/.test(e.slice(n,t))}function ct(e,t,n=0){return ot(e,t,n)||st(e,t,n)||at(e,t,n)}function lt(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 ut(e){for(let t of e)if((t.codePointAt(0)??0)>127)return!0;return!1}function dt(e,t,n=!1,r=0){let i=e.slice(r,t),a=lt(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)||ut(o)||n&&o.includes("${")||o.includes(`#{`)||o.includes(`@{`)||c.every(rt)||s.length>0&&s.every(e=>e===`*`||et.test(e))}function ft(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 pt(e,t){let n=t+1;for(;/\s/.test(e[n]??``);)n++;return e.startsWith(`...`,n)}function mt(e,t){let n=0;for(t--;t>=0&&e[t]===`\\`;t--)n++;return n%2==1}function ht(e,t,n=0){let r=t-1;for(;r>=0&&/\s/.test(e[r]);)r--;if(r<0)return!1;if(Xe.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)||ct(e,t,n)}const gt=new Set([`catch`,`class`,`do`,`else`,`finally`,`switch`,`try`]),_t=/^(?:(?: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;(){}])/,vt=/^(?:await\s+)?[$_\p{ID_Start}][$\p{ID_Continue}]*(?:\s*(?:(?:\.|\?\.)\s*#?[$_\p{ID_Start}][$\p{ID_Continue}]*|(?:\?\.)?\[[^\]]+\]))*\s*(?:(?:\?\.)?\(|\+\+|--|[-+*/%&|^]?=(?!=|>))/u,yt=/^(?:await\s+)?[$_\p{ID_Start}][$\p{ID_Continue}]*\s*(?:(?:\.|\?\.)\s*#?[$_\p{ID_Start}][$\p{ID_Continue}]*)+\s*$/u,bt=/^(?:await\s+)?[$_\p{ID_Start}][$\p{ID_Continue}]*(?:\s*(?:\.|\?\.)\s*#?[$_\p{ID_Start}][$\p{ID_Continue}]*)*\s*(?:\?\.)?\[[^\]]+\]\s*$/u,xt=/^new\s+(?:class\b|function\b|[$_\p{ID_Start}])/u,St=/^\([\s\S]*\)$/,Ct=/^\([\s\S]*\)\s*(?:\(|\?\.|\.)/,wt=/^(?:(?:await|delete|typeof|void)\s+\S|yield(?:\s+\S|\s*\*\s*\S))/u,Tt=/^(?:\+\+|--|!|~)\s*\S/u,Et=/^\[[\s\S]*\]\s*=(?!=|>)/,Dt=new Set([`as`,`in`,`instanceof`,`satisfies`]),Ot=/^(?:=(?!=|>)|\+=|-=|\*\*=|\*=|\/=|%=|&&=|&=|\|\|=|\|=|\^=|\?\?=|<<=|>>>=|>>=)/,kt=/^(?:(?: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 At(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=H(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 jt(e,t){if(wt.test(e))return!0;if(!Tt.test(e))return!1;let n=At(e);return n===void 0||t&&n===`important`}function Mt(e,t){if(!Et.test(e))return!1;let n=At(e);return n===void 0||t&&n===`important`}function Nt(e,t){let n={closers:[]};for(let r=t;r<e.length;r++){let t=H(e,r,n);if(t!==void 0&&(r=t,n.closers.length===0))return r+1}}function Pt(e){let t={closers:[]},n=-1;for(let r=0;r<e.length;r++){let i=H(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 Ft(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=sn(e,r);i?.value===`await`&&/\s/u.test(e[i.end]??``)&&(r=n(i.end),i=sn(e,r));let a;if(i!==void 0)a=`identifier`,r=i.end;else if(e[r]===`[`||e[r]===`(`){let t=Nt(e,r);if(t===void 0)return!1;a=e[r]===`[`?`array`:`parenthesized`,r=t}else{let t=kt.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=Nt(e,r);if(t===void 0)return!1;o=!0,s=!1,r=t;continue}if(e[r]===`#`&&r++,i=sn(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||At(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=Ot.exec(e.slice(r));return c!==null&&e.slice(r+c[0].length).trim().length>0}function It(e){let t=Pt(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=H(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=sn(e,a);if(l!==void 0){if(Dt.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 Lt(e,t){let n=He(e,t);if(n.kind===`open`)return!0;if(n.kind!==`close`)return!1;let r=Ge(e.slice(t+1,n.index));if(r.length===0)return!0;let i=r.length===1;return r.some(e=>_t.test(e)||vt.test(e)||yt.test(e)||bt.test(e)||Ft(e,i)||xt.test(e)||St.test(e)||Ct.test(e)||jt(e,i)||Mt(e,i)||It(e))}function Rt(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(at(e,t,n))return r>0||`:|&=,(`.includes(e[a]??``)?!1:it(e,t,n);if(/\bclass\b[^;]*$/.test(o))return ot(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 gt.has(c)?!0:ct(e,t,n)}function zt(){return{angleDepth:0,canEnd:!1,classParenRoles:[],forceRegex:!1,labelCandidate:!1,labelColon:-1,lastSignificant:``,lastWord:``,parenKinds:[],pendingFunctions:[],restrictedLineStatement:!1,statementStart:!0,typeDeclaration:!1}}const Bt=new Set([`abstract`,`async`,`declare`,`default`,`export`]),Vt=new Set([`abstract`,`asserts`,`extends`,`in`,`infer`,`is`,`keyof`,`new`,`readonly`,`typeof`,`unique`]);function Ht(e,t){let n=e.pendingFunctions.at(-1);n?.phase===`return-type`&&(n.typeCanEnd=!Vt.has(t))}function W(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 Ut(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 Wt(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 Gt(e,t=!1){e.labelCandidate=!1,e.labelColon=-1,e.lastSignificant=`;`,e.lastWord=``,t||(e.pendingFunctions.length=0),e.restrictedLineStatement=!1,e.statementStart=!0,e.typeDeclaration=!1}function G(e,t){e.canEnd=!0,e.forceRegex=!1,e.labelCandidate=!1,e.labelColon=-1,e.lastSignificant=t,e.lastWord=``,e.statementStart=!1,W(e,t,!0)}function Kt(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 qt(e,n,r,i){let a=e[n],o=i?.lastWord??``;if(/\s/.test(a??``))return r;if(/[\w$\p{ID_Continue}]/u.test(a??``)){if(/[\w$\p{ID_Continue}]/u.test(e[n+1]??``))return r;let a=n;for(;a>0&&/[\w$\p{ID_Continue}]/u.test(e[a-1]??``);)a--;let o=e.slice(a,n+1),s=a-1;for(;s>=0&&/\s/.test(e[s]??``);)s--;let c=e[s]===`.`||e[s]===`#`;if(i){let e=i.statementStart;i.labelCandidate=e,i.labelColon=-1,i.lastSignificant=`word`,i.lastWord=c?``:o,!c&&o===`function`?t(i.pendingFunctions,{kind:e?`B`:`O`,phase:`before-params`,typeCanEnd:!1}):c||Ht(i,o),!c&&e&&(o===`type`||o===`import`||o===`interface`||o===`declare`||o===`export`)&&(i.typeDeclaration=!0),!c&&e&&(o===`break`||o===`continue`||o===`debugger`)&&(i.restrictedLineStatement=!0),i.statementStart=!c&&e&&Bt.has(o)}return c||!(Ze.has(o)||$e.has(o))}if(i&&(a!==`:`&&(i.labelCandidate=!1),a!==`{`&&(i.labelColon=-1),i.lastWord=``,i.statementStart=!1),/\d/.test(a??``)||a===`.`&&r&&/\d/.test(e[n-1]??``))return i&&(i.lastSignificant=`number`,W(i,a,!0)),!0;if(a===`]`)return i&&(i.lastSignificant=a,W(i,a,!0)),!0;if(a===`[`)return i&&(i.lastSignificant=a,W(i,a,!1)),!1;if(a===`(`){if(i){let e=i.pendingFunctions.at(-1);t(i.classParenRoles,o===`cn`?`C`:r||e?.phase===`before-params`||$e.has(o)?`O`:`T`),e?.phase===`before-params`?(e.phase=`params`,t(i.parenKinds,`F`)):t(i.parenKinds,$e.has(o)?`1`:`0`),i.forceRegex=!1,i.lastSignificant=a,W(i,a,!1)}return!1}if(a===`)`){if(i){i.classParenRoles.pop();let e=i.parenKinds.pop();if(i.forceRegex=e===`1`,e===`F`){let e=i.pendingFunctions.at(-1);e?.phase===`params`&&(e.phase=`after-params`)}i.lastSignificant=a,W(i,a,!0)}return!0}if(a===`<`)return i&&(Kt(e,n,r)&&i.angleDepth++,i.lastSignificant=a,W(i,a,!1)),!1;if(a===`>`)return i?.angleDepth?(i.angleDepth--,i.lastSignificant=a,W(i,a,!0),!0):(i&&(i.lastSignificant=a,W(i,a,!1)),!1);if(a===`+`||a===`-`)return i&&(i.lastSignificant=a),e[n-1]===a||e[n+1]===a?(i&&W(i,a,r),r):(i&&W(i,a,!1),!1);if(a===`:`&&i){let e=i.pendingFunctions.at(-1);return e?.phase===`after-params`&&(e.phase=`return-type`,e.typeCanEnd=!1),i.labelCandidate&&(i.labelColon=n),i.lastSignificant=a,W(i,a,!1),!1}return a===`!`&&e[n+1]!==`=`?(i&&(i.lastSignificant=a,W(i,a,r)),r):a===`}`||a===`'`||a===`"`||a==="`"?(i&&(i.lastSignificant=a,W(i,a,!0)),!0):(i&&(i.lastSignificant=a,W(i,a,!1)),!1)}function Jt(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 Yt(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 Xt(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(!rn.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(!an.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 Zt(e,n,r){let i=r.get(n);if(i!==void 0)return i;let a=!1,o=!1,s=[],c;for(let i=n;i<e.length;i++){let l=e[i],u=e[i+1];if(o)(l===`
|
|
8
|
+
`||l===`\r`||l===`\u2028`||l===`\u2029`)&&(o=!1);else if(a)l===`*`&&u===`/`&&(a=!1,i++);else if(c)l===`\\`?i++:l===c&&(c=void 0);else if(l===`/`&&u===`/`)o=!0,i++;else if(l===`/`&&u===`*`)a=!0,i++;else if(l===`'`||l===`"`||l==="`")c=l;else if(l===`<`)t(s,i);else if(l===`>`&&e[i-1]!==`=`){let e=s.pop();if(e!==void 0&&(r.set(e,i),e===n))return i}}for(let e of s)r.set(e,-1);return-1}function Qt(e,t,n){return!t.closing&&e[t.nameEnd]===`<`?Zt(e,t.nameEnd,n):-1}function $t(e,t=0){return{blockComment:!1,braceDepth:+!!e,braceKinds:[],declarationBoundary:t,expression:zt(),failedRegexUntil:-1,kind:`host`,lineComment:!1,terminating:e}}function en(e){let t=e.at(-1);t?.kind===`host`&&G(t.expression,`jsx`)}function tn(e,t,n){for(let r=t+1;r<e.length;r++){let t=e[r];if(t===`\\`)r=U(e,r,n==="`")-1;else if(t===n)return r+1}return-1}const nn=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(`.`)),rn=/^[$_\p{ID_Start}]$/u,an=/^(?:[$\p{ID_Continue}]|\u200c|\u200d)$/u;function on(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 sn(e,n){let r=[],i=!1,a=n,o=!0;for(;a<e.length;){let n=on(e,a),s=n?.character??String.fromCodePoint(e.codePointAt(a));if(!(o?rn.test(s):an.test(s)))break;t(r,s),i||=n!==void 0,a=n?.end??a+s.length,o=!1}return o?void 0:{end:a,escaped:i,value:r.join(``)}}function cn(e,n,r){let i=[],a=!1,o=!1,s=!1,c=!0,l=!1,u=`start`,d=!1,f;for(let p=n+1;p<r;p++){let n=e[p],r=e[p+1];if(s){(n===`
|
|
9
|
+
`||n===`\r`||n===`\u2028`||n===`\u2029`)&&(s=!1);continue}if(a){n===`*`&&r===`/`&&(a=!1,p++);continue}if(f){n===`\\`?p++:n===f&&(f=void 0);continue}if(n===`/`&&r===`/`){s=!0,p++;continue}if(n===`/`&&r===`*`){a=!0,p++;continue}if(n===`'`||n===`"`||n==="`"){if(i.length===0&&u!==`constraint`&&u!=="default")return!1;f=n,d=!0;continue}if(n===`(`||n===`[`||n===`{`||n===`<`){if(i.length===0&&u!==`constraint`&&u!=="default")return!1;t(i,n===`(`?`)`:n===`[`?`]`:n===`{`?`}`:`>`),d=!0;continue}if(n===i.at(-1)){i.pop();continue}if(i.length>0||/\s/.test(n))continue;if(n===`,`)return!(u===`start`||u===`after-const`||(u===`constraint`||u==="default")&&!d);if(n===`=`){if(r===`>`){if(u!==`constraint`&&u!=="default")return!1;d=!0,p++;continue}if(u===`constraint`&&!d||u!==`after-name`&&u!==`constraint`)return!1;o=!0,u=`default`,d=!1;continue}let m=sn(e,p);if(m){let e=m.value;if(u===`start`)!m.escaped&&e===`const`?u=`after-const`:(l=!0,c=!nn.has(e),u=`after-name`);else if(u===`after-const`)l=!0,c=!nn.has(e),u=`after-name`;else if(u===`after-name`){if(m.escaped||e!==`extends`)return!1;o=!0,u=`constraint`,d=!1}else d=!0;p=m.end-1}else{if(n===`/`||u!==`constraint`&&u!=="default")return!1;d=!0}}return!l||!c||!o||u===`after-const`||(u===`constraint`||u==="default")&&!d?!1:u===`after-name`||u===`constraint`||u==="default"}function ln(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 un(e,t,n){let r=Zt(e,t,n);return r===-1||!cn(e,t,r)?-1:e[ln(e,r+1)]===`(`?r:-1}function dn(e,n,r){let i=new Set,a=[$t(!1)],o=0;for(;o<e.length;){let s=a.at(-1),c=e[o],l=e[o+1];if(s.kind===`template`){c===`\\`?o=U(e,o,!0):c==="`"?(a.pop(),en(a),o++):c===`$`&&l===`{`?(t(a,$t(!0)),o+=2):o++;continue}if(s.kind===`element`){if(r===`auto`&&(c===`'`||c===`"`||c==="`")&&o>=s.failedQuoteUntil[c]){let t=tn(e,o,c);if(t!==-1){o=t;continue}s.failedQuoteUntil[c]=e.length}if(r===`auto`&&c===`/`&&l===`*`&&o>=s.failedBlockCommentUntil){let t=e.indexOf(`*/`,o+2);if(t!==-1){o=t+2;continue}s.failedBlockCommentUntil=e.length}if(c===`{`){t(a,$t(!0,o+1)),o++;continue}if(c!==`<`){o++;continue}let i=Xt(e,o);if(!i){o++;continue}t(a,{blockComment:!1,closing:i.closing,kind:`tag`,name:i.name,opening:o,typeEnd:Qt(e,i,n)}),o=i.nameEnd;continue}if(s.kind===`tag`){if(s.blockComment){c===`*`&&l===`/`?(s.blockComment=!1,o+=2):o++;continue}if(s.quote){c===`\\`?o=U(e,o):(c===s.quote&&(s.quote=void 0),o++);continue}if(c===`/`&&l===`*`){s.blockComment=!0,o+=2;continue}if(c===`'`||c===`"`){s.quote=c,o++;continue}if(o<=s.typeEnd){o++;continue}if(c===`<`){a.pop();continue}if(c===`{`){t(a,$t(!0,o+1)),o++;continue}if(c!==`>`){o++;continue}let n=o-1;for(;/\s/.test(e[n]??``);)n--;let r=!s.closing&&e[n]===`/`;if(a.pop(),s.closing){let e=a.at(-1);e?.kind===`element`&&e.name===s.name&&(a.pop(),i.add(e.opening),en(a))}else r?(i.add(s.opening),en(a)):t(a,{failedBlockCommentUntil:-1,failedQuoteUntil:{'"':-1,"'":-1,"`":-1},kind:`element`,name:s.name,opening:s.opening});o++;continue}if(s.lineComment){(c===`
|
|
11
|
+
`||c===`\r`||c===`\u2028`||c===`\u2029`)&&(s.lineComment=!1,Wt(s.expression,s.braceDepth)),o++;continue}if(s.blockComment){c===`*`&&l===`/`?(s.blockComment=!1,o+=2):o++;continue}if(s.quote){c===`\\`?o=U(e,o):(c===s.quote&&(s.quote=void 0,G(s.expression,`string`)),o++);continue}if(c===`/`&&l===`/`){s.lineComment=!0,o+=2;continue}if(c===`/`&&l===`*`){s.blockComment=!0,o+=2;continue}if(c===`'`||c===`"`){s.quote=c,o++;continue}if(c==="`"){t(a,{kind:`template`}),o++;continue}if(c===`\\`){let t=on(e,o);if(t){o=t.end,G(s.expression,`word`);continue}}if(c===`/`&&o>=s.failedRegexUntil&&Jt(e,o,s.expression.forceRegex,s.expression.canEnd)){let t=Yt(e,o);if(t.end!==-1){o=t.end,G(s.expression,`regex`);continue}s.failedRegexUntil=t.failedUntil}if(c===`<`&&!s.expression.canEnd){let i=Xt(e,o);if(i&&!i.closing){let s=r===`tsx`?un(e,o,n):-1;if(s!==-1){o=s+1;continue}t(a,{blockComment:!1,closing:!1,kind:`tag`,name:i.name,opening:o,typeEnd:Qt(e,i,n)}),o=i.nameEnd;continue}}if(c===`{`){let n=Ut(s.expression),r=s.expression.labelColon>=0,i=s.expression.statementStart&&(s.braceKinds.at(-1)===`B`||s.declarationBoundary>0||s.braceKinds.length===0&&Lt(e,o)),a=s.expression.forceRegex||r||i?`B`:n??(Rt(e,o,s.declarationBoundary,s.expression.parenKinds.length,s.expression.lastSignificant)?`B`:`O`);t(s.braceKinds,a),s.braceDepth++,s.expression.canEnd=!1,s.expression.forceRegex=!1,s.expression.labelCandidate=!1,s.expression.labelColon=-1,s.expression.lastSignificant=`{`,s.expression.lastWord=``,s.expression.statementStart=a===`B`,o++;continue}if(c===`}`&&s.braceDepth>0){if(s.braceDepth--,s.terminating&&s.braceDepth===0)a.pop();else{let e=s.braceKinds.pop();s.expression.canEnd=e!==`B`,s.expression.forceRegex=e===`B`,s.expression.labelCandidate=!1,s.expression.labelColon=-1,s.expression.lastSignificant=`}`,s.expression.lastWord=``,s.expression.statementStart=e===`B`,e===`B`&&(s.declarationBoundary=o+1)}o++;continue}if((c===`
|
|
12
|
+
`||c===`\r`||c===`\u2028`||c===`\u2029`)&&Wt(s.expression,s.braceDepth)){o++;continue}/\s/.test(c)||(s.expression.forceRegex=!1),s.expression.canEnd=qt(e,o,s.expression.canEnd,s.expression),c===`;`&&(Gt(s.expression,s.braceKinds.at(-1)===`T`),s.braceKinds.length===0&&(s.declarationBoundary=o+1)),o++}return i}function fn(e,t,n){return!t&&n.has(e)}function pn(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 mn(e,t){return pn(e,t-1)}function hn(e,t){let n=t-1;for(;n>=0&&/\s/.test(e[n]??``);)n--;return e[n]===`{`?pn(e,n-1):pn(e,n)}function gn(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 _n(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 vn(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=U(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=U(e,n,!0)-1;else if(t==="`"||t===`$`&&e[n+1]===`{`)return n}return e.length}function yn(e,n,r){if(!e.includes(`{`))return e;let i=new Map,a=n!==`none`&&e.includes(`<`)?dn(e,i,n):new Set,o=``,s=0,c,l,u=!1,d=-1,f=0,p=[],m=0,h=-1,g=zt(),_,v=0,y=!1,b=0,x=0,S,C=-1,w=[],T=[],E=[],D=[],O=-1;for(;s<e.length;){let k=e[s];if(_){let t=Je(e,s,_);o+=e.slice(s,t),s=t,_.depth===0&&(_=void 0,v=t);continue}if(l){if(l===`line`&&(k===`
|
|
15
|
+
`||k===`\r`||k===`\u2028`||k===`\u2029`)){l=void 0,d=-1,f=0,Wt(g,p.length)&&(m=s+1),o+=k,s++;continue}if(l===`block`&&k===`*`&&e[s+1]===`/`){l=void 0,d=-1,f=0,o+=`*/`,s+=2;continue}if(k!==`{`){o+=k,s++;continue}}else if(c){if(k===`
|
|
16
|
+
`||k===`\r`||k===`\u2028`||k===`\u2029`){c=void 0,u=!1,d=-1,f=0,G(g,`string`),o+=k,s++;continue}if(k===`\\`){let t=U(e,s);o+=e.slice(s,t),s=t;continue}if(k===c){c=void 0,u=!1,d=-1,f=0,G(g,`string`),o+=k,s++;continue}if(k!==`{`){o+=k,s++;continue}}else if(D.at(-1)?.inText){let n=D.at(-1);if(k===`\\`){let t=U(e,s,!0);o+=e.slice(s,t),s=t;continue}if(k==="`"){D.pop(),G(g,`template`),o+=k,s++;continue}if(k===`{`&&e[s-1]===`$`){n.groupLimit=-1,n.inText=!1,n.interpolationDepth=1,t(p,`I`),g.canEnd=!1,g.forceRegex=!1,g.lastSignificant=`{`,g.lastWord=``,o+=k,s++;continue}if(n.css){let t=Je(e,s,n.css);o+=e.slice(s,t),s=t,n.css.depth===0&&(n.css=void 0,n.cssBoundary=t);continue}if(k!==`{`){o+=k,s++;continue}}else if(S===`text`){if(k===`{`){let r=n===`auto`?qe(e,s):void 0;if(r){O===s&&o.length>0&&!/\s/.test(o.at(-1))&&(o+=` `),o+=r.value,O=r.end,s=r.end;continue}t(T,`T`),S=void 0,t(p,`J`),x++,t(w,!1),g.canEnd=!1,g.forceRegex=!1,g.lastSignificant=`{`,g.lastWord=``}else if(k===`<`&&(e[s+1]===`/`||e[s+1]===`>`||/[A-Z_$a-z]/.test(e[s+1]??``))){y=e[s+1]===`/`,S=`tag`;let t=Xt(e,s);C=t?Qt(e,t,i):-1}o+=k,s++;continue}else if(S===`tag`&&s<=C){o+=k,s++;continue}else if(S===`tag`&&k===`{`){t(T,`G`),S=void 0,t(p,`J`),x++,t(w,mn(e,s)),g.canEnd=!1,g.forceRegex=!1,g.lastSignificant=`{`,g.lastWord=``,o+=k,s++;continue}else if(S===`tag`&&k===`>`){let t=s-1;for(;/\s/.test(e[t]??``);)t--;let n=e[t]===`/`;y?b=Math.max(0,b-1):n||b++;let r=E.at(-1);r&&b===r.baseDepth&&(y||n)?(E.pop(),S=r.resumeExpression?void 0:b>0?`text`:void 0,G(g,`jsx`)):S=`text`,y=!1,C=-1,o+=k,s++;continue}else if(S===`tag`&&k!==`'`&&k!==`"`){o+=k,s++;continue}else if(k===`<`&&fn(s,g.canEnd,a)){t(E,{baseDepth:b,resumeExpression:x>0}),y=!1,S=`tag`;let n=Xt(e,s);C=n?Qt(e,n,i):-1,o+=k,s++;continue}else if(k===`\\`){let t=on(e,s);if(t){o+=e.slice(s,t.end),s=t.end,G(g,`word`);continue}}else if(k===`'`||k===`"`){c=k,u=hn(e,s)||gn(g)||S===void 0&&w.at(-1)===!0&&_n(e,s,g),d=-1,f=s+1,o+=k,s++;continue}else if(k==="`"){t(D,{classLiteral:hn(e,s)||gn(g)||S===void 0&&w.at(-1)===!0&&_n(e,s,g),cssBoundary:s+1,groupLimit:-1,inText:!0,interpolationDepth:0}),o+=k,s++;continue}else if(k===`/`&&e[s+1]===`/`){l=`line`,d=-1,f=s+2,o+=`//`,s+=2;continue}else if(k===`/`&&e[s+1]===`*`){l=`block`,d=-1,f=s+2,o+=`/*`,s+=2;continue}else if(k===`/`&&s>=h&&Jt(e,s,g.forceRegex,g.canEnd)){let t=Yt(e,s);if(t.end!==-1){o+=e.slice(s,t.end),s=t.end,G(g,`regex`);continue}h=t.failedUntil}if(k===`}`){let e=p.pop(),t=D.at(-1);if(t&&!t.inText&&(t.interpolationDepth--,t.interpolationDepth===0&&(t.groupLimit=-1,t.inText=!0)),e===`J`&&(x--,w.pop(),S=T.at(-1)===`G`?`tag`:`text`,T.pop()),e===`T`){let e=g.pendingFunctions.at(-1);e?.phase===`return-type`&&(e.typeCanEnd=!0)}g.canEnd=e!==`B`,g.forceRegex=e===`B`,g.labelCandidate=!1,g.labelColon=-1,g.lastSignificant=`}`,g.lastWord=``,g.statementStart=e===`B`,e===`B`&&(m=s+1),o+=k,s++;continue}if(k!==`{`){(k===`
|
|
17
|
+
`||k===`\r`||k===`\u2028`||k===`\u2029`)&&Wt(g,p.length)&&(m=s+1),/\s/.test(k)||(g.forceRegex=!1),g.canEnd=qt(e,s,g.canEnd,g),k===`;`&&(Gt(g,p.at(-1)===`T`),p.length===0&&(m=s+1)),o+=k,s++;continue}let A=l===void 0&&c===void 0&&!D.at(-1)?.inText,j=A?Ut(g):void 0,M=A&&g.labelColon>=0,N=A&&g.statementStart&&(p.at(-1)===`B`||m>0||p.length===0&&Lt(e,s));if(A&&(p.length>0||j!==void 0||M||N||g.forceRegex||g.lastSignificant&&Xe.includes(g.lastSignificant)||Ze.has(g.lastWord)||ht(e,s,Math.max(m,v))||ft(e,s)||pt(e,s))){let n=g.forceRegex||M||N?`B`:j??(Rt(e,s,m,g.parenKinds.length,g.lastSignificant)?`B`:`O`);t(p,n);let r=D.at(-1);r&&!r.inText&&r.interpolationDepth++,g.canEnd=!1,g.forceRegex=!1,g.labelCandidate=!1,g.labelColon=-1,g.lastSignificant=`{`,g.lastWord=``,g.statementStart=n===`B`,o+=k,s++;continue}let P=D.at(-1),F=e.length;if(c||l?(d<s&&(d=vn(e,s+1,c,l,!1)),F=d):P?.inText&&(P.groupLimit<s&&(P.groupLimit=vn(e,s+1,void 0,void 0,!0)),F=P.groupLimit),(e[s-1]===`#`||e[s-1]===`@`)&&!mt(e,s-1)){let t=Ye(e,s,F);if(t!==-1){o+=e.slice(s,t+1),s=t+1;continue}}let I=P?.inText===!0,L=c===void 0&&l===void 0&&!I?He(e,s,F):Ve(e,s,F),ee=L.kind===`close`?L.index:-1,te=P===void 0||I||c!==void 0||l!==void 0,ne=I?P.cssBoundary:c||l?f:v,re=te&&!u&&!(I&&P.classLiteral)&&dt(e,s,I,ne),ie=re?Ye(e,s,F):-1;if(re&&(c===void 0&&l===void 0||ie!==-1)&&(ie===-1||e[ie+1]!==`@`)){let e={blockComment:!1,depth:1,lineComment:!1,parenDepth:0};I?P.css=e:_=e,o+=k,s++;continue}if(L.kind!==`close`){L.kind===`open`&&r&&(r.seen=!0),o+=e.slice(s,L.index),s=L.index,I?P.cssBoundary=L.index:c||l?f=L.index:v=L.index;continue}let ae=e.slice(s+1,ee),{conds:R,end:z}=We(e,ee+1,F),oe=Ge(ae,!0);if(oe.length===0){o+=k,s++;continue}O===s&&o.length>0&&!/\s/.test(o.at(-1))&&(o+=` `),o+=oe.map(e=>`${e}${R}`).join(` `),O=z,I?P.cssBoundary=z:c||l?f=z:v=z,s=z}return o}function bn(e){return yn(e,`auto`)}function xn(e,t){let n={seen:!1};return{code:yn(e,t,n),nestedOpening:n.seen}}const Sn=/^(?:--?[\w-]+|[A-Z_$][\w$-]*|@teacss-skip-bracket-[\da-z]{6})$/i;function Cn(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(!Sn.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 wn(e){let n=[],r=[],i=[],a=!1,o;for(let s=0;s<e.length;s++){let c=e[s],l=e[s+1];if(r.length===0){c===`(`&&Cn(e,s)&&t(r,{attached:!0,start:s});continue}if(a)c===`*`&&l===`/`&&(a=!1,s++);else if(o)c===`\\`?s++:c===o&&(o=void 0);else if(c===`\\`)s++;else if(c===`/`&&l===`*`)a=!0,s++;else if(c===`'`||c===`"`||c==="`")o=c;else if(i.length>0)c===`[`||c===`(`?t(i,c===`[`?`]`:`)`):c===i.at(-1)&&i.pop();else if(c===`[`)t(i,`]`);else if(c===`(`)t(r,{attached:Cn(e,s),start:s});else if(c===`)`){let e=r.pop();e.attached&&t(n,{end:s+1,start:e.start})}}let s=[];for(let e of n.sort((e,t)=>e.start-t.start||t.end-e.end))(s.length===0||e.start>=s.at(-1).end)&&t(s,e);return s}function Tn(e){let t={seen:!1},n=En(e,t);for(let e=1;e<5&&t.seen;e++){t.seen=!1;let e=En(n,t);if(e===n)break;n=e}return n}function En(e,t){if(!e.includes(`{`))return e;let n=``,r=0,i=-1,a=0,o=0,s=e.includes(`[`)?je(e):[],c=e.includes(`(`)?wn(e):[],l={closers:[]};for(;r<e.length;){for(;a<s.length&&s[a].end<=r;)a++;for(;o<c.length&&c[o].end<=r;)o++;let u=a<s.length?s[a]:void 0,d=o<c.length?c[o]:void 0,f=u?.start===r?u:d?.start===r?d:void 0;if(f&&l.blockComment!==!0&&l.quote===void 0){n+=e.slice(r,f.end),r=f.end;continue}l.closers.length>0&&/\s/.test(e[r])&&(l.blockComment=!1,l.closers.length=0,l.quote=void 0);let p=H(e,r,l);if(p!==void 0){n+=e.slice(r,p+1),r=p+1;continue}let m=e[r];if(l.closers.length>0||m!==`{`){n+=m,r++;continue}let h=Ve(e,r);if(h.kind!==`close`){h.kind===`open`&&t&&(t.seen=!0),n+=e.slice(r,h.index),r=h.index;continue}let g=h.index,_=e.slice(r+1,g),{conds:v,end:y}=We(e,g+1),b=Ge(_,!0);if(b.length===0){n+=m,r++;continue}i===r&&n.length>0&&!/\s/.test(n.at(-1))&&(n+=` `),n+=b.map(e=>`${e}${v}`).join(` `),i=y,r=y}return n}function Dn(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function On(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>=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 kn=On,An=/^[\da-z]{6}$/,jn=/\.(css|postcss|sass|scss|less|stylus|styl)($|\?)/;function Mn(e){return e.replace(/\?.*$/s,``)}function Nn(e){return jn.test(e)}function Pn(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 Fn(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);An.test(o.slice(t.length))&&n.add(o),i=a+1}return n}function In(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)||!An.test(t.slice(n.length)))return;return RegExp(`${Dn(n)}[\\da-z]{6}`,`g`)}}function Ln(e,t,n,r){let i=Fn(e,r),a=new Set([...t.keys(),...i]);return e.replace(n,e=>{let n=0,o;for(;o=`${r}${Pn(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 Rn(e,t){let n=In(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(Dn).join(`|`),`g`);return e.replace(i,e=>t.get(e)??e)}function zn(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(async({args:e})=>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 Bn=/[\\:]?[\s'"`;{}]+/g,Vn=new RegExp(Bn),Hn=/([\\:]?[\s"'`;<>]|:\(|\)"|\)\s)/g,Un=`@teacss-skip-bracket-`,Wn=/@teacss-skip-bracket-[\da-z]{6}/g,Gn=/[\s'"`;{}]/,Kn=/^!?[.#>_+~:]/,qn=/[^\S\t\n\v\f\r \u2028\u2029]/;function Jn(e,t){return/[A-Z_$]/i.test(e[t+1]??``)}function Yn(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 Xn(e){return e!==void 0&&/\.html?$/i.test(e.split(/[?#]/,1)[0])}function Zn(e){return e!==void 0&&/\.(?:[cm]?[jt]sx?|mdx)$/i.test(e.split(/[?#]/,1)[0])}function Qn(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 $n(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===`<`&&Jn(e,l)&&(o=!0,r=[]);continue}if(s){tr(u)&&(s=!1);continue}if(i){u===`*`&&d===`/`&&(i=!1,l++);continue}if(c){u===`\\`?l++:u===c&&(c=void 0);continue}if(u===`/`&&d===`*`&&Yn(e,l,a)){i=!0,l++;continue}if(u===`/`&&d===`/`&&Yn(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)V(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&&!/[ \t\n\r\f"'`=<>]/.test(e[p]);)p++;V(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);V(l,e.slice(u,r)),V(l,` `.repeat(t-r-n.length-2)),V(l,`"${n}"`),u=t}return V(l,e.slice(u)),l.join(``)}function er(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&&Gn.test(e)}}function tr(e){let t=e?.charCodeAt(0);return t===10||t===13||t===8232||t===8233}function nr(e,t){return e[t+1]===`\r`&&e[t+2]===`
|
|
18
|
+
`?t+2:t+1}function rr(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]===`[`&&ke(e,n)}const ir=new Set([`await`,`break`,`case`,`continue`,`debugger`,`delete`,`do`,`else`,`in`,`instanceof`,`new`,`of`,`return`,`throw`,`typeof`,`void`,`yield`]),ar=new Set([`for`,`if`,`while`,`with`]);function or(e,t){let n=0;for(;t>0&&e[--t]===`\\`;)n++;return n%2==1}function sr(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||or(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:ar.has(e.slice(i,t))}}return!1}function cr(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||or(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 lr(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 ur(e,t){let n=cr(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=lr(e,r);return[`catch`,`class`,`do`,`else`,`finally`,`static`,`try`].includes(a.value)?!0:a.value?lr(e,a.start).value===`class`:!1}function dr(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]===`)`&&sr(e,n)||e[n]===`}`&&ur(e,n))return!0;let r=n+1;for(;n>=0&&/[\w$]/.test(e[n]);)n--;let i=e.slice(n+1,r);return ir.has(i)?!0:i==="default"&&lr(e,n+1).value===`export`}function fr(e,t){let n=!1;for(let r=t+1;r<e.length;r++){let t=e[r];if(tr(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 pr(e,t=!1){let n=[],r=[],i=[],a=!1,o=!1,s,c=-1,l,u=-1,d=!1,f=!1;function p(){f=!1,n.length=0,i=[],a=!1,o=!1,s=void 0,l=void 0}for(let m=0;m<e.length;m++){let h=e[m];if(!a&&!s&&h===`/`&&dr(e,m)){let t=fr(e,m);if(t!==-1){m=t-1,d=!1,f=!1;continue}}if(n.length===0){if(er(h)?f=d=!1:h===`/`&&(d=!0),h===`@`&&!e.startsWith(Un,m)&&!or(e,m)&&(f=m>0&&(!er(e[m-1])||e[m-1]===`}`)&&Kn.test(e.slice(m+1))),f&&h===`\\`){/\s/.test(e[m+1])&&(f=!1),m++;continue}h===`[`&&(V(n,m),o=d&&e[m-1]!==`:`&&e[m-1]!==`@`);continue}if(er(h)&&(u=m),tr(h)){p();continue}if((a||s)&&/\s/.test(h)&&(l??=ye(e,n.at(-1),!1,f?e.length:m),l===void 0)){p();continue}if(!a&&!s&&h===`/`&&o){p();continue}if(a){h===`*`&&e[m+1]===`/`&&(a=!1,m++);continue}if(s){h===`\\`?(tr(e[m+1])?p():er(e[m+1])&&(u=m+1),m++):h===s&&(V(i,[c+1,m]),s=void 0);continue}if(h===`/`&&e[m+1]===`*`)a=!0,m++;else if(h===`"`||h===`'`)s=h,c=m;else if(h===`\\`)tr(e[m+1])&&p(),er(e[m+1])&&(u=m+1),m++;else if(h===`[`)V(n,m);else if(h===`]`){let a=n.pop(),s=m+1,c=!1;if(u>a){let n=f||e[a-1]===`:`||e[a-1]===`@`,i=e[s]===`:`&&!!e[s+1]&&!Gn.test(e[s+1]);c=n&&!Oe(e,a)||i&&!(t&&rr(e,s)),c&&V(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 pr(e.slice(t,n)))V(r,[t+i,t+a]);i=[]}}}let m=[];for(let e of r.sort(([e,t],[n,r])=>e-n||r-t))(m.length===0||e[0]>=m.at(-1)[1])&&V(m,e);return m}const mr=/^(?:--?[\w-]+|[A-Z_$][\w$-]*|@teacss-skip-bracket-[\da-z]{6})$/i;function hr(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(!mr.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 gr(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&&V(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!=="`"&&tr(d)?a=void 0:d===`\\`?u=nr(e,u):d===a?a=void 0:d===`(`&&hr(e,u)&&(V(n,{attached:!0,containsGroupBrace:!1,outerQuote:a,start:u}),c=void 0):d===`"`||d===`'`||d==="`"?a=d:d===`(`&&hr(e,u)&&(V(n,{attached:!0,containsGroupBrace:!1,outerQuote:void 0,start:u}),c=void 0);continue}if(tr(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??=ye(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=nr(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=nr(e,u);else if(r.length>0)d===`[`?V(r,`]`):d===`(`?V(r,`)`):d===r.at(-1)?(r.pop(),r.length===0?s=-1:d===`)`&&(s=u)):d===`{`&&(n.at(-1).containsGroupBrace=!0);else if(d===`[`)V(r,`]`);else if(d===`{`)n.at(-1).containsGroupBrace=!0;else if(d===`(`)V(n,{attached:hr(e,u),containsGroupBrace:!1,outerQuote:f,start:u});else if(d===`)`){let e=n.pop();e.attached&&e.containsGroupBrace&&V(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])&&V(u,e);return u}function _r(e,t,n){if(!t.length)return e;let r=new Set(e.match(Wn)),i=[],a=0;for(let[o,s]of t){let t=e.slice(o,s),c=0,l;for(;l=`${Un}${Pn(c?`${t}:${c}`:t)}`,c++,r.has(l)||n.has(l)&&n.get(l)!==t;);n.set(l,t),V(i,e.slice(a,o)),V(i,l),a=s}return V(i,e.slice(a)),i.join(``)}function vr(e,t,n=!1){return _r(e,pr(e,n),t)}function yr(e,t){return _r(e,gr(e),t)}function br(e,t){let n=[],r=0;for(let t=0;t<e.length;t++){let i=e[t];if(i===`\\`){let i=e[t+1];r&&i&&(/['"`;{}]/.test(i)||r===2&&qn.test(i))?V(n,[t,t+2]):er(i)&&(r=0),t++}else er(i)?r===2&&qn.test(i)?V(n,[t,t+1]):r=0:i===`@`&&(r=Kn.test(e.slice(t+1))?2:1)}return _r(e,n,t)}function xr(e,t){let n=e;for(let e=0;e<t.size&&n.includes(Un);e++){let e=n.replace(Wn,e=>t.get(e)??e);if(e===n)break;n=e}return n}function Sr(e,t){let n=new Map;qn.test(e)&&(e=br(e,n)),e.includes(`[`)&&(e=vr(e,n,!0)),e.includes(`(`)&&(e=yr(e,n));let r=xn(e,t);e=r.code;for(let i=1;i<5&&r.nestedOpening;i++){let i=e;if(i.includes(`[`)&&(i=vr(i,n)),i.includes(`(`)&&(i=yr(i,n)),r=xn(i,t),r.code===i)break;e=r.code}e.includes(`[`)&&(e=vr(e,n)),e.includes(`(`)&&(e=yr(e,n)),e.includes(`\\`)&&(e=br(e,n));let i=e.split(Bn);return n.size?i.map(e=>e.includes(Un)?xr(e,n):e):i}const Cr={name:`@teacss/core/extractor-split`,order:0,extract({code:e,id:t}){return Sr(Zn(t)?e:$n(e,Xn(t)),Qn(t))}};var wr=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 K(e){return e instanceof wr}function Tr(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 Er(){return{events:Object.create(null),emit(e,...t){let r=this.events,i=Array.from(n(Object.hasOwn(r,e)?r[e]:void 0));for(let e of i)e(...t)},on(e,r){let i=this.events,a=Object.hasOwn(i,e)?i[e]:void 0,o=Array.isArray(a)?a:[];o!==a&&Tr(i,e,o),t(o,r);let s=!0;return()=>{s&&=(Tr(i,e,Array.from(n(Object.hasOwn(i,e)?i[e]:void 0)).filter(e=>e!==r)),!1)}}}}const Dr=/^\[(.+?)~?="(.*)"\]$/,Or=/[\w\u00A0-\uFFFF%-?]/,kr=new RegExp(Dr.source,Dr.flags),Ar=/\.(css|postcss|sass|scss|less|stylus|styl)($|\?)/,jr=new RegExp(Or.source,Or.flags);function Mr(e){return e.match(Dr)}function Nr(e=``){return Or.test(e)}function Pr(e){return typeof e==`function`?{match:e}:e}function Fr(e){return e.length===3&&Object.hasOwn(e,0)&&Object.hasOwn(e,1)&&Object.hasOwn(e,2)}function Ir(e){return e!=null}function Lr(e){return e!=null&&(typeof e==`object`||typeof e==`function`)&&typeof e.then==`function`}function Rr(){}function zr(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)?r[2]:void 0;if(i){let t=i;for(;t!==null&&t!==Object.prototype&&!Object.hasOwn(t,`layer`);)t=Object.getPrototypeOf(t);if(t!==null&&t!==Object.prototype){if(!Reflect.set(i,`layer`,e))throw TypeError(`Cannot assign rule layer`)}else D(i,`layer`,e)}else if(Object.hasOwn(r,2)){if(!Reflect.set(r,2,{layer:e}))throw TypeError(`Cannot assign rule metadata`)}else D(r,2,{layer:e})}return t}var Br=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)))}},Vr=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)=>{D(t,t.length,e(n,r))}),t}flatMap(e){let r=[];return this.forEach((i,a)=>{for(let o of n(e(i,a)))t(r,o)}),r}};function Hr(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 Ur(e){return Reflect.ownKeys(e).filter(t=>Object.getOwnPropertyDescriptor(e,t)?.enumerable)}function Wr(e,t){if(Object.getOwnPropertyDescriptor(e,t)?.enumerable)return{value:Reflect.get(e,t)}}function Gr(e){let n=[];for(let r of Ur(e)){let i=Wr(e,r);i&&t(n,[r,i.value])}return n}function Kr(e){if(j(e))return e;let r=[];for(let i of Array.isArray(e)?n(e):Gr(e)){let e=Hr(i);e!==void 0&&e[1]!=null&&t(r,i)}return r}function qr(e){if(Array.isArray(e)){let t=Array.from(n(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=>Kr(e))}return[Kr(e)]}function Jr(e){let r=[],i,a;for(let o of n(e)){let e=Hr(o);if(!e)continue;let[n,s]=e;typeof n==`string`&&(n.startsWith(`$$`)||(n===`__virtual_key__`||i!==n||a!==s)&&(t(r,o),i=n,a=s))}return r}const Yr=`__virtual_key__`;function Xr(e,t){return t==null||typeof t==`function`||typeof e!=`string`?``:e===`__virtual_key__`?t?String(t):``:`${e}:${t};`}function Zr(e){if(e==null||e.length===0)return``;let t=``,r,i;for(let a of n(e)){let e=Hr(a);if(!e)continue;let[n,o]=e;typeof n==`string`&&(n.startsWith(`$$`)||(n===`__virtual_key__`||r!==n||i!==o)&&(t+=Xr(n,o),r=n,i=o))}return t}function q(e){if(typeof e!=`object`||!e||Array.isArray(e))return!1;let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null}const Qr=`$reset`;function $r(e,t,r=!1){let i=e,a=t;if(Array.isArray(a))return[...r&&Array.isArray(i)?n(i):[],...n(a)];if(q(a)&&Object.hasOwn(a,`$reset`)&&a.$reset)return ei(a);if(!q(a))return a;if(!q(i))return ei(a);let o={...i};return Ur(a).forEach(e=>{if(e===`$reset`)return;let t=Wr(a,e);if(!t)return;let n=t.value,i=Object.hasOwn(o,e)?Reflect.get(o,e):void 0;q(n)||Array.isArray(n)?D(o,e,$r(i,n,r)):D(o,e,n)}),o}function ei(e){if(Array.isArray(e))return Array.from(n(e),ei);if(q(e)){let t={};for(let n of Ur(e)){if(n===`$reset`)continue;let r=Wr(e,n);r&&D(t,n,ei(r.value))}return t}return e}function ti(e){return typeof e!=`object`||!e?e:ni(e)}function ni(e){if(Array.isArray(e)){let t=Array.from({length:e.length});for(let n=t.length-1;n>=0;n--)t[n]=Object.hasOwn(e,n)?ti(e[n]):void 0;return t}if(q(e)){let t=e,n={};for(let e of Ur(t)){let r=Wr(t,e);r&&D(n,e,ti(r.value))}return n}return e}function ri(e){return Object.hasOwn(e,0)&&j(e[0])}function ii(e){return Object.hasOwn(e,0)&&j(e[0])}const ai=Object.getOwnPropertyDescriptor(RegExp.prototype,`source`).get,oi=[[`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]],si=Object.getOwnPropertyDescriptor(RegExp.prototype,`global`)?.get,ci=Object.getOwnPropertyDescriptor(RegExp.prototype,`sticky`)?.get,li=RegExp.prototype.exec;function J(e){return Reflect.apply(ai,e,[])}function ui(e){return!!(si&&Reflect.apply(si,e,[])||ci&&Reflect.apply(ci,e,[]))}function Y(e){let t=``;for(let[n,r]of oi)r&&Reflect.apply(r,e,[])&&(t+=n);return t}function di(e,t){let n=t.exec;if(!ui(t))return Reflect.apply(n,t,[e]);if(Object.getOwnPropertyDescriptor(t,`lastIndex`)?.writable===!1){if(n!==li)return Reflect.apply(n,t,[e]);let r=new RegExp(J(t),Y(t));return Reflect.apply(li,r,[e])}t.lastIndex=0;try{return Reflect.apply(n,t,[e])}finally{Object.getOwnPropertyDescriptor(t,`lastIndex`)?.writable!==!1&&(t.lastIndex=0)}}const fi=/^[a-z][a-z0-9-]*$/,pi={minAffix:4,maxDistance:1,minDistanceLength:6,segmentAffix:!0},mi={minAffix:3,maxDistance:1,minDistanceLength:0,segmentAffix:!1},hi={minAffix:3,maxDistance:2,minDistanceLength:0,segmentAffix:!1},gi=new Set([`about`,`blob`,`bun`,`chrome`,`data`,`deno`,`file`,`ftp`,`http`,`https`,`jsr`,`mailto`,`node`,`npm`,`tel`,`urn`,`vscode`,`virtual`,`ws`,`wss`]);function _i(e){let{body:t,important:n}=Me(e);return n?`${t}!`:t}function vi(e){let t=_i(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!fi.test(r)||t.startsWith(`//`,n+1)?!1:!gi.has(r)}function yi(e){if(Y(e))return;let t=J(e);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}function bi(e,t){let n=Object.hasOwn(e,2)?e[2]:void 0,r=n;for(;r!=null&&r!==Object.prototype&&r!==Array.prototype&&r!==Function.prototype;){if(Object.hasOwn(r,t))return Reflect.get(n,t);r=Object.getPrototypeOf(r)}}function xi(e){return n(O(bi(e,`prefix`)||``))}function Si(e,t){for(let r of n(t))for(let t of xi(r))if(e.startsWith(t)&&di(e.slice(t.length),r[0]))return!0;return!1}const Ci=new WeakMap;function wi(e){let t=e.rulesStaticMap,r=Ci.get(t);if(r)return r;let i=new Map,a=new Set,o=new Set;for(let e of Object.keys(t)){let n=e.indexOf(`:`);if(n<=0)continue;let r=e.slice(0,n),a=Object.hasOwn(t,e)&&t[e];if(!a)continue;if(bi(a,`internal`)){o.add(r);continue}let s=i.get(r);s||(s=new Set,i.set(r,s)),s.add(e.slice(n+1))}for(let t of n(e.rulesDynamic)){let e=yi(t[0]);if(e!=null)for(let n of xi(t)){let r=(n+e).split(`:`,1)[0];bi(t,`internal`)?o.add(r):i.has(r)||a.add(r)}}let s={prefixValues:i,dynamicPrefixes:a,internalPrefixes:o};return Ci.set(t,s),s}function Ti(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),i=[...r];for(let a=1;a<=e.length;a++){i[0]=a;let o=a;for(let n=1;n<=t.length;n++){let s=e[a-1]===t[n-1]?0:1;i[n]=Math.min(r[n]+1,i[n-1]+1,r[n-1]+s),i[n]<o&&(o=i[n])}if(o>n)return 1/0;[r,i]=[i,r]}return r[t.length]<=n?r[t.length]:1/0}function Ei(e,t){let n=Math.min(e.length,t.length),r=0;for(;r<n&&e[r]===t[r];)r++;return r}function Di(e,t){return(t.startsWith(e)?t[e.length]===`-`:t.endsWith(e)&&t[t.length-e.length-1]===`-`)&&(e.includes(`-`)||e.length>=6)}function Oi(e,t,n){if(e.length>=n.minDistanceLength){let r=Ti(e,t,n.maxDistance);if(r!==1/0)return r}let r=e.length<=t.length?e:t,i=e.length<=t.length?t:e;if(r.length>=n.minAffix&&(n.segmentAffix?Di(r,i):i.startsWith(r)||i.endsWith(r)||i.includes(r)))return 3+(i.length-r.length)/100;if(!n.segmentAffix&&Ei(e,t)>=n.minAffix)return 5+Math.abs(e.length-t.length)/100}function ki(e,t,n={}){let{body:r,important:i}=Me(e),a=r.indexOf(`:`);if(a<=0)return;let o=r.slice(0,a),s=r.slice(a+1),{prefixValues:c,dynamicPrefixes:l,internalPrefixes:u}=wi(t),d=[];if(c.has(o)||l.has(o)||u.has(o)||Si(r,t.rulesDynamic))for(let e of c.get(o)??[]){if(e===s)continue;let t=Oi(s,e,hi);t!==void 0&&V(d,{suggestion:`${o}:${e}`,score:t})}else{if(!n.confirmedIntent&&o.length<3)return;let e=new Set([...c.keys(),...l]);for(let t of e){let e=Oi(o,t,n.confirmedIntent?mi:pi);if(e===void 0)continue;let r=c.get(t)?.has(s)||l.has(t);V(d,{suggestion:`${t}:${s}`,score:r?e:e+10})}if(d.length===0)return}d.sort((e,t)=>e.score-t.score||(e.suggestion<t.suggestion?-1:1));let f=new Set,p=[];for(let{suggestion:e}of d)if(!(f.has(e)||e===r)&&(f.add(e),V(p,i?`${e}!`:e),p.length===3))break;return p}function Ai(e){let t=e.split(/\s+/);return t[0]===``&&t.shift(),t.at(-1)===``&&t.pop(),t}function ji(e){if(!e.includes(`[`))return Ai(e);let t=je(e);if(t.length===0)return Ai(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&&V(n,e.slice(i,a)),i=-1):i<0&&(i=a)}return i>=0&&V(n,e.slice(i)),n}function Mi(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 Ni=new Set([`calc`,`clamp`,`max`,`min`]);function Pi(e){return e==null?!1:e===`\\`||/[-_a-zA-Z0-9]/.test(e)||e.charCodeAt(0)>=128}function Fi(e,t){if(t>0&&Pi(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 Ii(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===`(`?V(n,a):o===`)`&&n.length>0&&t.set(n.pop(),a)}return t}function Li(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 Ri(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?!0:n[0].startsWith(`-`)&&t[r-1]===`-`?!1:/[\s,(+\-*/]/.test(t[r-1])}function zi(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 Bi(e){if(!e.includes(`(`))return e;let t=Ii(e),n=[],r=``;for(let i=0;i<e.length;){let a=Li(e,i);if(a!=null){r+=e.slice(i,a),i=a;continue}let o=Fi(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(Ni.has(s)){r+=`${o.name}(`,V(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&&!zi(e,i,r)&&Ri(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 Vi(e){return e.length>=2&&e[0]===`[`&&e[e.length-1]===`]`}function Hi(e,t={}){let{calc:n=!0}=t,r=e;return Vi(r)&&(r=Mi(r.slice(1,-1))),n&&(r=Bi(r)),r}const Ui=new se(256,void 0,!0);function Wi(e){return[...n(e)]}function Gi(e,t,n){return n.some(n=>e.startsWith(n,t))}function Ki(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 qi(e,t){let n=t+1;for(;/\s/.test(e[n]??``);)n++;return e[n]===`"`||e[n]===`'`||e[n]==="`"}function Ji(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){qi(e,c)&&(!u||ke(e,c)&&!Ki(e,c,t))&&n.add(c),V(i,{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===`[`)V(o.bracketStarts,{containsCandidate:!1,start:c});else if(l===`]`){let i=o.bracketStarts.pop();i&&Gi(e,c+1,t)?(V(r,{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},V(a,o);else if(l===`\\`)c++;else if(l===`]`){let a=i.pop(),l=a.start,u=c+1,d=n.has(l)||Ae(e,l,u)&&!Ki(e,l,t),f=(e[l-1]===`:`||e[l-1]===`@`||Gi(e,u,t))&&!d;f?(V(r,{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)&&V(c,e);return{barrierStarts:n,ranges:c}}function Yi(e,t){let{barrierStarts:n,ranges:r}=Ji(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 Xi(e){let t=JSON.stringify(e),n=Ui.getOrInsertComputed(t,()=>{let t=[...e].sort((e,t)=>t.length-e.length).map(Dn).join(`|`),n=`\\[[^\\]]*?\\]`;return RegExp(t?`((?:[!@*<~\\w+:_-]|${n})+?)(${t})\\(((?:[~!@<>\\w\\s:/\\\\,%#.$?-]|${n})+?)\\)(?!\\s*?=>)`:`(?!)`,`gm`)});return n.lastIndex=0,n}function Zi(e=[`-`,`:`]){let t=Xi(Wi(e));return new RegExp(t.source,t.flags)}function Qi(e,t=[`-`,`:`],n=5){let r=Wi(t),i=Xi(r),a=!1,o=typeof e==`string`?e:e.original,s=o,c=new Set,l=new Map;if(n>0){let e=Yi(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=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,items:[]};l.set(e,_);let v=0;for(let e of ji(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}`),V(_.items,e)}o+=s.slice(u,e),o+=`$`.repeat(p),u=e+p}t&&(s=o+s.slice(u)),--n,t&&n&&(e=Yi(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){let n=e+t.length;if(d.slice(e,n)!==o.slice(e,n))throw Error(`Cannot expand a variant group that overlaps an existing MagicString edit`)}for(let[e,t]of u)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 $i(e,t){let n=new Map,r=Wi(t).sort((e,t)=>t.length-e.length),i=ji(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 V(n.get(t),i),null;{let e=[i];return n.set(t,e),{prefix:t,items:e}}}).filter(Ir).map(e=>typeof e==`string`?e:`${e.prefix}(${e.items.join(` `)})`).join(` `);return i?`${/^\s/.test(e)?` `:``}${i}${/\s$/.test(e)?` `:``}`:e?` `:``}function ea(e,t=[`-`,`:`],n=5){let r=Qi(e,t,n);return typeof e==`string`?r.expanded:e}const ta=new Set;function na(e){if(!ta.has(e)){ta.add(e);try{console.warn(`[Teacss]`,e)}catch(t){throw ta.delete(e),t}}}function ra(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 D(e,t,n)}function ia(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 aa(e){let t=[void 0,void 0,void 0];for(let n=0;n<2;n++){if(!Object.hasOwn(e,n))throw TypeError(`[Teacss] invalid rule or shortcut entry: matcher and body must be own tuple values`);t[n]=e[n]}let r=Object.hasOwn(e,2)?e[2]:void 0;if(r!==void 0){let e={...r},i=Object.hasOwn(e,`prefix`)&&e.prefix;Array.isArray(i)&&(e.prefix=[...n(i)]),t[2]=e}return t}function oa(e){return Array.from(n(e),aa)}function sa(e){let n=Object.create(null),r=[];for(let[i,a]of e.entries()){let e=Object.hasOwn(a,2)?a[2]:void 0;if(e===void 0){if(e={},Object.hasOwn(a,2)){if(!Reflect.set(a,2,e))throw TypeError(`Cannot assign rule metadata`)}else D(a,2,e)}if(ra(e,`__index`,i),ri(a)){let t=O(ia(e,`prefix`)??``);for(let e of t)n[e+a[0]]=a}else t(r,a)}return r.reverse(),{rulesSize:e.length,rulesDynamic:r,rulesStaticMap:n}}function ca(e){let t=oa(e.rules),n=sa(t);e.rules=t,e.rulesSize=n.rulesSize,e.rulesDynamic=n.rulesDynamic,e.rulesStaticMap=n.rulesStaticMap}function X(e,t){return e!=null&&Object.hasOwn(e,t)?Reflect.get(e,t):void 0}function la(e){return[...n(O(e))]}function ua(e,t){for(let t=e.length;t>0;t--)Object.defineProperty(e,t,{configurable:!0,enumerable:!0,value:e[t-1],writable:!0});D(e,0,t)}function da(e){let n=new Set,r=[];for(let i of e){let e=i.name;n.has(e)||(n.add(e),t(r,i))}return r}function fa(e){return Array.from(e,(e,t)=>({index:t,order:E(e,`order`)||0,value:e})).sort((e,t)=>e.order-t.order||e.index-t.index).map(({value:e})=>e)}function pa(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&&D(n,e,r)}return n}function ma(e){return Array.from(n(O(e)),e=>Array.isArray(e)?[e]:Object.entries(e)).flat()}const ha=new WeakSet;function ga(e,t){let r={};for(let t of Reflect.ownKeys(e)){if(t===`name`||!Object.getOwnPropertyDescriptor(e,t)?.enumerable)continue;let i=Reflect.get(e,t);D(r,t,t===`prefix`&&Array.isArray(i)?[...n(i)]:i)}return D(r,`name`,t),r}async function _a(e){return va(e)}async function va(e,t){let n=typeof e==`function`?await e():await e;if(typeof n!=`object`||!n||Array.isArray(n))throw TypeError(`Invalid TeaCSS preset: expected an object, received ${n===null?`null`:Array.isArray(n)?`array`:typeof n}.`);t?.(n);let r=Object.hasOwn(n,`name`)?Reflect.get(n,`name`):void 0;if(typeof r!=`string`||r.trim()===``)throw TypeError(`Invalid TeaCSS preset: expected a non-empty string name.`);if(ha.has(n))return n;n=ga(n,r),ha.add(n);let i=X(n,`shortcuts`),a=X(n,`rules`),o=i?oa(ma(i)):void 0;n.shortcuts=o,n.rules=a?oa(a):void 0;let s=X(n,`prefix`),c=X(n,`layer`);if(s||c){let e=e=>{e[2]||={};let t=e[2];E(t,`prefix`)==null&&s&&D(t,`prefix`,[...O(s)]),E(t,`layer`)==null&&c&&D(t,`layer`,c)};o?.forEach(e),n.rules?.forEach(e)}return n}async function ya(e){return ba(e,new Set)}async function ba(e,t){let r=new Set(t),i=e=>{if(t.has(e))throw TypeError(`Circular TeaCSS preset reference detected.`);r.add(e)};i(e);let a=await va(e,i),o=X(a,`presets`);if(!o)return[a];let s=Array.from(n(O(o)),e=>Array.isArray(e)?[...n(e)]:[e]).flat();return[a,...(await Promise.all(s.map(e=>ba(e,r)))).flat()]}function xa(e){if(e.length===0)return{};let n=[],r=[],i=!1,a=!1,o=[],s=[];for(let c of e){let e=X(c,`pipeline`),l=X(c,`filesystem`),u=X(c,`inline`),d=e&&X(e,`include`),f=e&&X(e,`exclude`);e===!1?(a=!0,i=!0):i||(e!==void 0&&(a=!0),d&&t(n,d),f&&t(r,f)),l&&t(o,l),u&&t(s,u)}let c={};return i?c.pipeline=!1:a&&(c.pipeline={},n.length&&(c.pipeline.include=k(ja(n))),r.length&&(c.pipeline.exclude=k(ja(r)))),o.length&&(c.filesystem=k(o.flatMap(la))),s.length&&(c.inline=k(s.flatMap(la))),c}async function Sa(e={},t={}){let r=pa(t,e),i=X(r,`presets`)??[],a=Array.from(n(O(i)),la).flat(),o=da((await Promise.all(a.map(ya))).flat()),s=Array.from(o,e=>({enforce:X(e,`enforce`),preset:e})),c=[...s.filter(({enforce:e})=>e===`pre`),...s.filter(({enforce:e})=>e==null),...s.filter(({enforce:e})=>e===`post`)].map(({preset:e})=>e),l=[...c,r],u=[...l].reverse(),d=l.reduce((e,t)=>({...e,...X(t,`layers`)}),{...Be});function f(e){return k(l.flatMap(t=>la(X(t,e))))}let p=f(`extractors`),m=u.map(e=>X(e,`extractorDefault`)).find(e=>e!==void 0);m===void 0&&(m=Cr),m&&!p.includes(m)&&ua(p,m);let h=fa(p),g=oa(f(`rules`)),{rulesSize:_,rulesStaticMap:v,rulesDynamic:y}=sa(g),b=l.map(e=>X(e,`autocomplete`)),x=e=>b.flatMap(t=>la(X(t,e))),S={templates:k(x(`templates`)),extractors:fa(x(`extractors`)),shorthands:Aa(b.map(e=>X(e,`shorthands`)||{}))},C=f(`separators`);C.length||(C=[`:`,`-`]);let w=xa(f(`content`)),T=u.map(e=>X(e,`details`)).find(e=>e!==void 0),E=u.map(e=>X(e,`outputToCssLayers`)).find(e=>e!==void 0),D=u.map(e=>X(e,`sortLayers`)).find(e=>e!==void 0),A=X(r,`envMode`)||`build`,j={...r,mergeSelectors:X(r,`mergeSelectors`)??!0,warn:X(r,`warn`)??!0,unmatched:X(r,`unmatched`)??`off`,outputToCssLayers:E,sortLayers:D??(e=>e),blocklist:f(`blocklist`),presets:c,envMode:A,shortcutsLayer:X(r,`shortcutsLayer`)||`shortcuts`,layers:d,theme:ka(l.map(e=>X(e,`theme`))),rules:g,rulesSize:_,rulesDynamic:y,rulesStaticMap:v,preprocess:f(`preprocess`),postprocess:f(`postprocess`),preflights:f(`preflights`),autocomplete:S,variants:fa(f(`variants`).map(Pr)),shortcuts:oa(ma(f(`shortcuts`))).reverse(),extractors:h,safelist:f(`safelist`),separators:C,details:T??A===`dev`,content:w,transformers:da(f(`transformers`))},M=f(`extendTheme`);for(let e of M)j.theme=e(j.theme,j)||j.theme;let N=!1;for(let e of l){let t=X(e,`configResolved`);t!=null&&(N=!0,await t(j))}return N&&ca(j),j}function Ca(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 wa(e,t,n){return Object.hasOwn(t,n)?Reflect.get(t,n):X(e,n)}function Ta(e){let t=Ca(e),n=wa(e,t,`templates`);n===void 0?delete t.templates:D(t,`templates`,O(n));let r=wa(e,t,`extractors`);if(r===void 0?delete t.extractors:D(t,`extractors`,O(r)),Object.hasOwn(e,`shorthands`)){let n=wa(e,t,`shorthands`);n===void 0?delete t.shorthands:D(t,`shorthands`,n)}return t}function Ea(e={},t={}){let n=X(e,`shorthands`),r=X(t,`shorthands`),i={...e},a={...t};delete i.shorthands,delete a.shorthands;let o=$r(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 Da(e){let t=Ca(e),n=wa(e,t,`entry`);return n===void 0?delete t.entry:D(t,`entry`,O(n)),t}function Oa(e){let t=[`shortcuts`,`preprocess`,`postprocess`,`extendTheme`,`separators`];return Array.from(n(e),e=>Object.entries(e).reduce((e,[n,r])=>{if(r===void 0)return e;let i=n===`autocomplete`&&r?Ta(r):n===`cli`&&r?Da(r):t.includes(n)?O(r):r;return{...e,[n]:i}},{})).reduce((e,t)=>{let n=X(e,`autocomplete`),r=X(t,`autocomplete`),i=X(e,`content`),a=X(t,`content`),o=X(e,`extractorDefault`),s=X(t,`extractorDefault`),c=X(e,`theme`),l=X(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=$r(u,d,!0);return(n||r)&&Object.defineProperty(f,"autocomplete",{configurable:!0,enumerable:!0,value:Ea(n,r),writable:!0}),(c||l)&&Object.defineProperty(f,"theme",{configurable:!0,enumerable:!0,value:ka([c,l]),writable:!0}),(i||a)&&Object.defineProperty(f,"content",{configurable:!0,enumerable:!0,value:xa([i||{},a||{}]),writable:!0}),(o!==void 0||s!==void 0)&&D(f,`extractorDefault`,s===void 0?o:s),f},{})}function ka(e){return e.reduce((e,t)=>{if(!t)return e;let n=ni(t);if(!q(n))return n;if(!q(e)){if(!Reflect.ownKeys(n).some(e=>Object.getOwnPropertyDescriptor(n,e)?.enumerable))return e;if(Object.hasOwn(n,`$reset`)&&Reflect.get(n,`$reset`))return $r({},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 $r(e,n)},{})}function Aa(e){return e.reduce((e,t)=>{let n=Object.create(null);for(let e of Object.keys(t)){if(!Object.hasOwn(t,e))continue;let r=t[e];if(Array.isArray(r)){let t=la(r);n[e]=t.length===1?t[0]??``:`(${t.join(`|`)})`}else n[e]=r}return{...e,...n}},{})}function ja(e){return e.flatMap(e=>la(Ma(e)))}function Ma(e){return Array.isArray(e)?e:e?[e]:[]}function Na(e){return e}function Pa(){let e=typeof process<`u`&&!!process.stdout;return{isNode:e,isVSCode:e&&!!process.env.VSCODE_CWD,isESLint:e&&!!process.env.ESLINT}}var Fa=`0.5.0`;const Ia=/[a-zA-Z0-9_-]/;function La(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 Ra(e,n){if(n.length>0&&e.length>256/n.length)return null;let r=[];for(let i of e)for(let e of n)t(r,i+e);return r}function za(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 Ba(e,t){return e[t]===`:`&&!/[?*+{]/.test(e[t+1]??``)}function Va(e){if(!e.startsWith(`^`)||za(e))return null;let t=1;for(;t<e.length&&Ia.test(e[t]);)t++;if(t>1&&Ba(e,t))return[e.slice(1,t)];let n=Ha(e,1,`:`);if(!n||!Ba(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 Ha(e,t,n,r=0){let i=[``];for(;t<e.length;){let a=e[t];if(n.includes(a))break;if(Ia.test(a)){let n=``;for(;t<e.length&&Ia.test(e[t]);)n+=e[t++];i=i.map(e=>e+n);continue}let o=null;if(a===`(`)o=r<64?Ua(e,t,r+1):null;else if(a===`[`)o=Wa(e,t);else return null;if(!o)return null;t=o.end;let s=o.combos;if(e[t]===`?`)s=[``,...s],t++;else if(e[t]===`*`||e[t]===`+`||e[t]===`{`)return null;let c=Ra(i,s);if(!c)return null;i=c}return{combos:i,end:t}}function Ua(e,n,r){if(n++,e.startsWith(`?:`,n))n+=2;else if(e[n]===`?`)return null;let i=[];for(;;){let a=Ha(e,n,`|)`,r);if(!a)return null;for(let e of a.combos)t(i,e);if(i.length>256)return null;if(n=a.end,e[n]===`|`){n++;continue}return e[n]===`)`?{combos:i,end:n+1}:null}}function Wa(e,n){if(n++,e[n]===`^`)return null;let r=[];for(;n<e.length&&e[n]!==`]`;){let i=e[n];if(i===`\\`||i===`-`||(t(r,i),r.length>256))return null;n++}return e[n]===`]`?{combos:r,end:n+1}:null}function Ga(e){if(La(e[2],`prefix`))return null;let[t]=e;return!(t instanceof RegExp)||Object.hasOwn(t,`exec`)||Object.getPrototypeOf(t)!==RegExp.prototype||t.exec!==li||Y(t)?null:Va(J(t))}function Ka(e){let n=e.map(e=>[e,Ga(e)]),r=new Map;for(let[,e]of n)if(e!==null)for(let t of e)r.has(t)||r.set(t,[]);let i=[];for(let[e,a]of n){if(a===null){t(i,e);for(let n of r.values())t(n,e);continue}for(let n of a)t(r.get(n),e)}return{map:r,fallback:i}}const Z=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 qa(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}const Ja={px:1,rem:16,em:16,in:96,pt:96/72,pc:16,cm:96/2.54,mm:96/25.4,q:96/101.6},Ya=RegExp(`^[ \\t\\n\\r\\f]*([+-]?(?:\\d+(?:\\.\\d+)?|\\.\\d+)(?:e[+-]?\\d+)?)(${Object.keys(Ja).join(`|`)}|[sld]?v(?:[whib]|min|max)|cq(?:[whib]|min|max)|r?(?:ch|ex|cap|ic|lh)|%)?[ \\t\\n\\r\\f]*(?![\\s\\S])`,`i`);function Xa(e){let t=Ya.exec(e);if(!t)return null;let n=Number.parseFloat(t[1]),r=(t[2]??`px`).toLowerCase();if(Object.hasOwn(Ja,r)&&(n*=Ja[r],r=`px`),!Number.isFinite(n))return null;let i=r===`px`?Math.round(n*1e6)/1e6:n;return{unit:r,value:Number.isFinite(i)?i:n}}function Za(e){let t=!1,n=wo(e)[0];if(/["'\\/]|not/i.test(n)&&(n=n.replace(/"(?:\\[\s\S]|[^"\\])*(?:"|$)|'(?:\\[\s\S]|[^'\\])*(?:'|$)|\/\*[\s\S]*?(?:\*\/|$)|((?:[-\w\u0080-\uffff]|\\(?:[\da-f]{1,6}(?:\r\n|[ \t\n\r\f])?|[^\n\r\f]))+)|\\[\s\S]/gi,(e,n)=>n?(l(n).toLowerCase()===`not`&&(t=!0),n.includes(`\\`)?`_`:n):` `)),!/^@media(?=[ \t\n\r\f(])/i.test(n)||t)return null;let r=null;for(let e of n.matchAll(/\([ \t\n\r\f]*(min|max)-width[ \t\n\r\f]*:([^)]*)\)/gi)){let t=Xa(e[2]);if(t){if(/min/i.test(e[1]))return t;r??={unit:t.unit,value:-t.value}}}return r}function Qa(e,t){return e<t?-1:+(e>t)}function $a(e,t){return Qa(e??``,t??``)}function eo(e,t){for(let n of t)V(e,n)}function to(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];D(e,0,t)}function no(e){let t=new wr;for(let n of e)t.setCount(n,e.getCount(n));return t}function ro(e){return K(e)?no(e):new Set(e)}function io(e,t,n){if(K(e)&&K(t)&&K(n)){for(let r of new Set([...t,...n])){let i=n.getCount(r),a=t.getCount(r);if(Object.is(i,a)&&n.has(r)===t.has(r))continue;let o=e.getCount(r)+(i-a);o>0||o===0&&i===0&&n.has(r)?e.setCount(r,o):e.delete(r)}return}for(let r of t)n.has(r)||e.delete(r);for(let r of n)t.has(r)||e.add(r)}function*ao(e,t){for(let n=0;n<e.length;n++){let r=t[n];r!=null&&(yield[e[n],r])}}function oo(e){if(e!==void 0&&(!Number.isSafeInteger(e)||e<1))throw RangeError(`tokenConcurrency must be a positive integer`)}function so(e,t){return Object.hasOwn(e,t)?Reflect.get(e,t):void 0}function co(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?E(e,t):void 0}function $(e,t){return so(e,t)}function lo(e){let t=E(e,`parent`);return{body:E(e,`body`),handle:E(e,`handle`),layer:E(e,`layer`),order:E(e,`order`),parent:Array.isArray(t)?so(t,0):t,parentOrder:Array.isArray(t)?so(t,1):void 0,selector:E(e,`selector`),sort:E(e,`sort`),source:e}}function uo(e){if(e===null||typeof e!=`object`&&typeof e!=`function`)return;let t=Reflect.get(e,`then`);if(typeof t==`function`)return{then(n,r){return Reflect.apply(t,e,[n,r])}}}async function fo(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]);D(r,t,i)}catch(e){throw a=!0,e}}});return await Promise.all(o),r}function po(e,t){if(e===void 0)return;let n=is(t),r=n.startsWith(`[`),i=0,a,o=0,s=``;for(let t=0;t<e.length;t++){let c=e[t];if(a){c===`\\`?t++:c===a&&(a=void 0);continue}if(c===`/`&&e[t+1]===`*`){let n=e.indexOf(`*/`,t+2);if(n===-1)break;t=n+1;continue}if(c===`\\`){t++;continue}if(c===`"`||c===`'`){a=c;continue}if(i===0&&c===n[0]&&e.startsWith(n,t)){let i=e[t+n.length],a=i!==void 0&&(/[\w-]/.test(i)||i===`\\`||i.charCodeAt(0)>=128);if(r||!a){s+=`${e.slice(o,t)}&`,o=t+n.length,t=o-1;continue}}c===`[`?i++:c===`]`&&i>0&&i--}return s+e.slice(o)}function mo(e,t,n,r){let i=O(e).filter(ho),a=O(n).filter(ho);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]||po(n[1],t)!==po(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 ho(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 go(e){return Object.hasOwn(e,0)&&e[0]===Z.shortcutsNoMerge}function _o(e){for(let t=e.length-1;t>=0;t--){if(!Object.hasOwn(e,t))continue;let n=e[t];if(go(n))return Object.hasOwn(n,1)?n[1]:void 0}}function vo(e,t){let n=[...e,...t],r=[];for(let e=t.length-1;e>=0;e--)_e(t[e])&&V(r,t[e]);for(let t=e.length-1;t>=0;t--)_e(e[t])&&V(r,e[t]);if(r.length<2)return n;let i=r[0];for(let e=1;e<r.length;e++)i=ve(i,r[e])??i;let a=[],o=!1;for(let e of n)_e(e)?o||=(V(a,i),!0):V(a,e);return a}function yo(e){let t;for(let n of e)n.includes(`{`)&&(t??=[],V(t,n));if(!t)return e;for(let n of t){let t=ji(Tn(n));if(t.length===1&&t[0]===n)continue;let r=K(e)?e.getCount(n):1;e.delete(n);for(let n of t)K(e)?e.setCount(n,e.getCount(n)+r):e.add(n)}return e}function bo(e){let t=0;for(let[n,r]of e.matchAll(/\\(?:([\da-f]{1,6})(?:\r\n|[ \t\n\r\f])?|.)|(["'])(?:\\.|(?!\2)[^\\])*\2|\/\*.*?(?:\*\/|$)|[^:\\/"'-]+|./gis)){if(n.startsWith(`/*`)&&t!==2)continue;let e=r?Number.parseInt(r,16):n.charCodeAt(+(n[0]===`\\`));if(t===2&&(e|32)>=97&&(e|32)<=122)return!0;t=n===`:`?1:t===1&&e===45?2:0}return!1}function xo(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&&eo(d[0],o)}e.length=r}function So(e,t,n){let r=(e.get(t)??0)-(e.get(n)??0);if(r)return r;let i=Za(t),a=Za(n);if(i==null!=(a==null))return i==null?-1:1;if(i!=null&&a!=null){if(i.unit!==a.unit)return Qa(i.unit,a.unit);if(i.value!==a.value)return i.value-a.value}return Qa(t,n)}function Co(e,t,n=``){let r=wo(e);return`${r.join(`{`)}{${n}${t}${n}${`}`.repeat(r.length)}`}function wo(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===`\\`?s++: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)&&(V(t,e.slice(o,s)),s+=3,o=s+1)}return V(t,e.slice(o)),t}function To(e){let t=[];if(!e.includes(`$$`))return t;let 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++;V(t,[i,o]),i=o-2}return t}function Eo(e,t){let n=To(e);if(!n.length)return e;let r=0,i=``;for(let[a,o]of n)i+=e.slice(r,a),i+=a===0||a<r?t?`${t} `:``:t?` ${t} `:` `,r=o;return i+e.slice(r)}const Do=new Set([Function.prototype,Object.getPrototypeOf(async()=>{}),Object.getPrototypeOf(function*(){}),Object.getPrototypeOf(async function*(){})]),Oo=new Set([`arguments`,`caller`,`length`,`name`,`prototype`]);function ko(e){return Reflect.ownKeys(e).every(e=>Oo.has(e))}function Ao(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 jo(e,t){let n=Ao(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 Mo(e){return Reflect.ownKeys(e).every(e=>e===`lastIndex`)}function No(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:ko(e),kind:`identity`,value:e};if(n.ignoreRegExpLastIndex&&e instanceof RegExp){let t=Ao(e);return{complete:t?.owner===RegExp.prototype&&t.value===li&&Object.getPrototypeOf(e)===RegExp.prototype&&Mo(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||Do.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=No(i.value,t,n),Fo(s.value)||(o.complete=!1);try{let a=Reflect.get(e,r);s.observedValue=No(a,t,n),(!Object.is(a,i.value)||!Fo(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;V(o.properties,s)}return o}function Po(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||ko(t.value));if(t.kind===`regexp-identity`)return e===t.value&&e instanceof RegExp&&jo(e,t.exec)&&J(e)===t.source&&Y(e)===t.flags&&(!t.complete||Mo(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||!Po(s.value,a.value,n))return!1;if(a.observedValue!==void 0){let t;try{t=Reflect.get(e,o)}catch{return!1}if(!Po(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 Fo(e){return e.kind===`primitive`||e.complete}function Io(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=No(r[0],void 0,{functionsByIdentity:!0,ignoreRegExpLastIndex:!0}),s={body:r[1],bodySnapshot:No(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:No(a,void 0,{functionsByIdentity:!0,ignoreRegExpLastIndex:!0}),rule:r};D(t,n,s)}return t}function Lo(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||!Po(i[0],a.matcherSnapshot)||i[0]instanceof RegExp&&(J(i[0])!==a.matcherSource||Y(i[0])!==a.matcherFlags)||!Po(i[1],a.bodySnapshot)||!Po(s,a.metaSnapshot))return!1}return!0}function Ro(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(!Fo(n)||!Fo(r)||!Fo(i))return!1}return!0}const zo=[`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=No(e[t],void 0,n);return{complete:Fo(r),isCurrent:e=>Po(e[t],r),key:t}}function Vo(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 Ho(e,t){let n=Vo(e,t);if(!n)return{complete:!0,value:No(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=No(r.value,void 0,{functionsByIdentity:!0,ignoreRegExpLastIndex:!0});return{complete:Fo(a),configurable:!!r.configurable,enumerable:!!r.enumerable,owner:i,value:a,writable:!!r.writable}}function Uo(e,t,n){let r=Vo(e,t);if(!r)return n.owner===void 0&&n.value!==void 0&&Po(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&&Po(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=>Ho(a,e)):n.map(()=>Ho(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(!Uo(r,n[e],t.values[e]))return!1}}return!0},key:t}}function Go(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=>Ho(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)=>Uo(o,e,i[t]))},key:t}}function Ko(e){return zo.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 Go(e,t,[`allLayers`,`cssLayerName`]);case`shortcuts`:{let n=e.shortcuts,r=Io(n);return{complete:Ro(r),isCurrent:t=>t.shortcuts===e.shortcuts&&Lo(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 qo(e,t){return t.every(t=>t.isCurrent(e))}function Jo(e){return e.every(({complete:e})=>e)}function Yo({authoredOutputOrders:e,config:t,currentSelectors:r,layerSet:i,matched:a,minify:o,parentOrders:s,preflights:c,preflightsMap:l,scope:u,sheet:d,shortcutMergeOrders:f,resolveUnmatched:p}){let m=o?``:`
|
|
19
|
+
`,h=u?u.includes(`,`)?ts(u):[u]:void 0;if(h?.some(e=>!/[^ \t\n\r\f]/.test(e.replace(/\/\*[\s\S]*?\*\//g,``))))throw TypeError(`[Teacss] scope selector list must not contain empty selectors`);let g={...t.layers},_=t.mergeSelectors,v=t.sortLayers,y=e=>Object.hasOwn(g,e)?g[e]??0:0,b=e=>Array.from(n(Reflect.apply(v,t,[e.sort((e,t)=>y(e)-y(t)||Qa(e,t))]))),x=b(Array.from(i)),S=Object.create(null),C=i.size===1?i.values().next().value:void 0,w,T,E=t.outputToCssLayers,D=typeof E==`object`?co(E,`cssLayerName`):void 0,O=typeof E==`object`&&co(E,`allLayers`)?b(k([...Object.keys(g),...x])):void 0,A=new Map,j=e=>{let t=A.get(e);if(t!==void 0)return t;let n=e;D&&typeof E==`object`&&(n=Reflect.apply(D,E,[e]));let r=n===null?null:n??e;return A.set(e,r),r};if(E)for(let e of k([...x,...O??[]]))j(e);let M=t=>{let n=(e,t)=>e.ruleIndex-t.ruleIndex||e.sort-t.sort||$a(e.currentSelector,t.currentSelector)||Number(t.noScope)-Number(e.noScope)||Number(t.noMerge)-Number(e.noMerge)||$a(e.selector,t.selector)||$a(e.body,t.body)||0,i=(e,t)=>e.ruleIndex===t.ruleIndex&&e.sort===t.sort,a=[],o=new Map,s=t.flatMap(e=>f.get(e)?.components??[e]);for(let t of s){let s={authored:e.get(t),body:t[2],currentSelector:r.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){V(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)V(u.records,s),n(s,u.representative)<0&&(u.representative=s);else{let e={authoredGroup:c,records:[s],representative:s};V(a,e),l?V(l,e):o.set(c,[e])}}for(let e of a)e.authoredGroup&&e.records.sort((e,t)=>e.authored.index-t.authored.index||n(e,t));a.sort((e,t)=>{let r=n(e.representative,t.representative);if(r)return r;let i=[...e.records].sort(n),a=[...t.records].sort(n),o=Math.min(i.length,a.length);for(let e=0;e<o;e++){let t=n(i[e],a[e]);if(t)return t}if(i.length!==a.length)return i.length-a.length;for(let r=0;r<e.records.length;r++){let i=n(e.records[r],t.records[r]);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=f.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,p=[];for(let e of c){let t=f.get(e);if(!t||!u.has(t.group)){V(p,e);continue}d.has(t.group)||(d.add(t.group),V(p,t.original))}return p},N=()=>{if(T)return T;let e=new Map,t=Array.from(d).sort((e,t)=>So(s,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?V(a[1],t):i?V(i,[n,[t]]):e.set(r,[[n,[t]]])}return d.clear(),T=e,e},P=e=>{if(C===void 0)return N().get(e)||[];if(e!==C)return[];if(w)return w;let t=Array.from(d).sort((e,t)=>So(s,e[0]||``,t[0]||``));return d.clear(),w=t,t},F=(e=ze)=>{if(Object.hasOwn(S,e))return S[e];let t=P(e).map(([e,t])=>{let n=[];for(let[,e,r,,i,,a]of M(t)){if(e===``)continue;let t=Q(i,`noScope`)?void 0:h,o=e&&ns(e,t);V(n,[o==null?[]:[[o,Q(i,`sort`)??0]],r,!!(a??Q(i,`noMerge`))||o!=null&&bo(o)])}if(!n.length)return;_&&xo(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]||$a(e[0],t[0]));let e=new Set,n=[];for(let[r]of t)r&&!e.has(r)&&(e.add(r),V(n,r));a=n.join(`,${m}`)}let o=a?`${a}{${i}}`:i;o&&V(r,o)}let i=Array.from(new Set(r)).reverse().join(m);return e?Co(e,i,m):i}).filter(Boolean).join(m);c&&(t=[l[e],t].filter(Boolean).join(m));let n;E&&t&&(n=j(e),n!==null&&(t=`@layer ${n}{${m}${t}${m}}`));let r=o?``:`/* layer: ${e}${n&&n!==e?`, alias: ${n}`:``} */${m}`;return S[e]=t?r+t:``},I=(e=x,t)=>{let r=Array.from(n(e)),i=new Set(n(t)),a=r.filter(e=>!i.has(e)),o=a.map(F).filter(Boolean);if(E){let e=k((O??a).map(j).filter(Ir));e.length>0&&to(o,`@layer ${e.join(`, `)};`)}return o.join(m)},L=async(e,t)=>{let n=await t(F(e));return S[e]=n,n},ee;return{get css(){return I()},layers:[...x],matched:a,getLayers:I,getLayer:F,setLayer:L,get diagnostics(){return ee??={unmatched:p()},ee}}}var Xo=class e{userConfig;defaults;version=Fa;events=Er();config=void 0;cache=new se(R,void 0,!0);blocked=new ce(R,void 0,!0);_warnedUnmatched=new ce(R);parentOrders=new Map;activatedRules=new Set;_dynamicIndex;_expansionIndex;_contextConfigs=new WeakMap;_expansionPrefixes=new WeakMap;_generationContexts=new WeakSet;_matchedStaticContexts=new WeakSet;_emptyStaticPayloads=new WeakSet;_configVersion=0;_collectionGeneration=0;_preparedConfigs=new WeakSet;_indexedRules;_indexedRuleSnapshot;_preparedCacheSnapshot;_preparedConfigMutable=!1;_preparedCacheReliable=!0;_startingGenerationParse=0;_startingInputCheck;_contextInputChecks=new WeakMap;_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){try{console.error(`[@teacss/core] Configuration observer failed:`,AggregateError(e,`Configuration observers failed`))}catch{}}dispatchConfig(e){let t=[];try{let r=this.events.events,i=Array.from(n(Object.hasOwn(r,`config`)?r.config:void 0));for(let n of i)try{let t=uo(n(e));t&&Promise.resolve(t).catch(e=>{this.reportConfigObserverErrors([e])})}catch(e){V(t,e)}}catch(e){V(t,e)}t.length&&this.reportConfigObserverErrors(t)}clearRuntimeCaches(e){e&&this._runtimeRevision++,this._expansionIndex=void 0,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&&(qo(this.config,this._preparedCacheSnapshot)||(n=!0,this._preparedCacheSnapshot=Ko(this.config),t=!0),r=Jo(this._preparedCacheSnapshot));let i=this._indexedRules===this.config.rules;if(!e&&i)return;let a=i&&!!this._indexedRuleSnapshot&&Lo(this.config.rules,this._indexedRuleSnapshot);(!i||!a)&&(n||=!!this._indexedRules,ca(this.config),this._indexedRules=this.config.rules,this._indexedRuleSnapshot=Io(this.config.rules),this._dynamicIndex=void 0,t=!0),this._preparedConfigMutable&&(r=r&&!!this._indexedRuleSnapshot&&Ro(this._indexedRuleSnapshot),this._preparedCacheReliable=r),t&&this.clearRuntimeCaches(n)}collectValidatedParentOrders(e,t){for(let n of e){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,r=!1,i=!1){let a=e[4],o;if(a){let e=Object.getOwnPropertyDescriptors(a),t=Reflect.ownKeys(e),i=!0;for(let n of t){let t=e[n];if(t.writable!==!0||t.enumerable!==!0||t.configurable!==!0||!Object.hasOwn(t,`value`)){i=!1;break}}if(i){let r=Object.create(null);for(let i of t){let t=e[i].value;r[i]=(i===`prefix`||i===`autocomplete`)&&Array.isArray(t)?[...n(t)]:t}o=r}else{let i=Object.create(null);for(let o of t){let t=e[o];r&&(t={configurable:!!t.configurable,enumerable:!!t.enumerable,value:Object.hasOwn(t,`value`)?t.value:Reflect.get(a,o),writable:!0}),(o===`prefix`||o===`autocomplete`)&&Object.hasOwn(t,`value`)&&Array.isArray(t.value)&&(t={...t,value:[...n(t.value)]}),i[o]=Object.assign(Object.create(null),t)}o=Object.defineProperties(Object.create(null),i)}}let s=e[5];if(i){let n=[e[0],e[1],e[2],e[3],o,s,e[6]];return t&&this.transferStringifiedMetadata(e,n),n}let c=s?{...s,theme:ni(s.theme),variantHandlers:[...n(s.variantHandlers)],variantMatch:[s.variantMatch[0],s.variantMatch[1],[...n(s.variantMatch[2])],new Set(s.variantMatch[3])]}:void 0;s&&c&&(this._contextConfigs.set(c,this.getContextConfig(s)),Object.hasOwn(s,`rules`)?c.rules=s.rules?ni(O(s.rules)):s.rules:delete c.rules,Object.hasOwn(s,`shortcuts`)?c.shortcuts=s.shortcuts?ni(O(s.shortcuts)):s.shortcuts:delete c.shortcuts,Object.hasOwn(s,`variants`)?c.variants=s.variants?ni(O(s.variants)):s.variants:delete c.variants);let l=[e[0],e[1],e[2],e[3],o,c,e[6]];return t&&this.transferStringifiedMetadata(e,l),l}transferStringifiedMetadata(e,t){let n=this._stringifiedCurrentSelectors.get(e);n!==void 0&&this._stringifiedCurrentSelectors.set(t,n);let r=this._stringifiedOutputOrders.get(e);r&&this._stringifiedOutputOrders.set(t,r);let i=this._stringifiedParentOrders.get(e);i!==void 0&&this._stringifiedParentOrders.set(t,i)}copyValidatedStringifiedUtils(e,t,n=!1,r=!1){let i=e,a=i.map(e=>this.copyStringifiedUtil(e,t,n,r));if(t){let e,t;for(let o=0;o<i.length;o++){let s=this._shortcutMergeOrders.get(i[o]);if(!s)continue;if(!e||!t){e=new Map;for(let t=0;t<i.length;t++)e.set(i[t],a[t]);t=new Map}let c=e,l=t.get(s.group);if(!l){let e=e=>{let t=c.get(e);return t||(t=this.copyStringifiedUtil(e,!0,n,r),c.set(e,t)),t},i=s.components?.map(e),a=s.original?e(s.original):void 0;l={...s,components:i,group:{},original:a},t.set(s.group,l);for(let e of i??[])this._shortcutMergeOrders.set(e,l);a&&this._shortcutMergeOrders.set(a,l)}this._shortcutMergeOrders.set(a[o],l)}}return a}getExpansionIndex(e,t){let n=t?this._expansionIndex:void 0;if(n&&n.entries===e&&qa(n.slots,e))return n;let r=new Map,i=[],a=(e,t)=>{let n=r.get(e);n?V(n,t):r.set(e,[t])};for(let t=0;t<e.length;t++){if(!Object.hasOwn(e,t))continue;let n=e[t];if(!Array.isArray(n)||!Object.hasOwn(n,0)||!Object.hasOwn(n,1))continue;let r=Object.hasOwn(n,2)?n[2]:void 0;if(!j(n[0])){V(i,{entry:n,order:t});continue}let o=n[0],s=Q(r,`prefix`),c=s?O(s):void 0;if(!c){a(o,{candidateRank:0,entry:n,kind:`inherited`,order:t,prefix:void 0});continue}for(let e=0;e<c.length;e++)a(c[e]+o,{candidateRank:e,entry:n,kind:`fixed`,order:t,prefix:c[e]});a(o,{candidateRank:c.length,entry:n,kind:`inherited`,order:t,prefix:void 0,requiresPrefixes:c})}let o={dynamics:i,entries:e,slots:Array.from(e),statics:r};return t&&(this._expansionIndex=o),o}getDynamicIndex(e){return this._dynamicIndex?.config!==e&&(this._dynamicIndex={config:e,...Ka(e.rulesDynamic)}),this._dynamicIndex}constructor(e={},t={}){this.userConfig=e,this.defaults=t}async ensureInitialized(){this.config||(this._initialization||=Sa(this.userConfig,this.defaults).then(e=>{if(this.config)return;let t=e.rules,n=Io(t);this.config||(this.config=e,this._indexedRules=t,this._indexedRuleSnapshot=n,this.dispatchConfig(e))}).finally(()=>this._initialization=void 0),await this._initialization)}static constructPublic(e,t){return new Zo(e,t)}static async create(t={},n={}){let r=e.constructPublic(t,n);return await r.ensureInitialized(),r}async setConfig(e,t){e&&this.commitConfig(await this.prepareConfig(e,t))}async prepareConfig(t,n){await Promise.resolve();let r=++this._configVersion,i=n??this.defaults,a=await Sa(t,i),o=e.constructPublic(t,i);o.config=a,o._indexedRules=a.rules,o._indexedRuleSnapshot=Io(a.rules),o._preparedCacheSnapshot=Ko(a),o._preparedConfigMutable=!0,o._preparedCacheReliable=Jo(o._preparedCacheSnapshot)&&Ro(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)return!1;let t=e.generator,n=e.config;return t.config!==n||(t.ensureRuleIndexesCurrent(!0),t.config!==n)?!1:(this.defaults=e.defaults,this.userConfig=e.userConfig,this.clearRuntimeCaches(!0),this.config=n,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)}async applyExtractorsCurrent(e,t,n){await this.ensureInitialized(),this.ensureRuleIndexesCurrent(this._preparedConfigMutable);let r=this.config,i=this._runtimeRevision,a=ro(n),o=ro(a),s;try{s=await this.applyExtractorsForConfig(r,e,t,o)}catch(a){if(this._preparedConfigMutable&&this.ensureRuleIndexesCurrent(!0),this.config!==r||this._runtimeRevision!==i)return this.applyExtractorsCurrent(e,t,n);throw a}return this._preparedConfigMutable&&this.ensureRuleIndexesCurrent(!0),this.config!==r||this._runtimeRevision!==i?this.applyExtractorsCurrent(e,t,n):(io(n,a,s),n)}async applyExtractorsForConfig(e,t,r,i){let a={original:t,code:t,id:r,extracted:i,envMode:e.envMode};for(let t of n(e.extractors)){let e=E(t,`extract`),r=await(e==null?void 0:Reflect.apply(e,t,[a]));if(r&&r!==i){if(K(r)&&K(i))for(let e of r)i.setCount(e,i.getCount(e)+r.getCount(e));else for(let e of Array.isArray(r)?n(r):r)i.add(e)}}return i}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:Z,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,this._startingInputCheck);if(n||r?.length!==0||!this._emptyStaticPayloads.has(r))return r&&!n?this.copyValidatedStringifiedUtils(r,!0):r}async parseTokenInternal(e,t,r,i){await this.ensureInitialized(),i?.(),this.ensureRuleIndexesCurrent(this._preparedConfigMutable&&!r);let a=this.config,o=this._runtimeRevision,s=!this._preparedConfigMutable||this._preparedCacheReliable,c=s&&!t,l=()=>this.config!==a||this._runtimeRevision!==o,u=()=>(this._preparedConfigMutable&&this.ensureRuleIndexesCurrent(!0),l()),d=()=>this.parseTokenInternal(e,t,r,i);if(s&&this.blocked.has(e)){ue(this.blocked,e);return}let f=e,p=c?this.cache.get(f):void 0;if(c&&(p!==void 0||this.cache.has(f))){B(this.cache,f,p);let e=p&&O(p);if(!e||e.length===0)return e;let t=!0;for(let n=0;n<e.length;n++)if(!ho(e[n])){t=!1;break}let n=t?e:e.filter(ho);if(n.length>0)return r||this.collectValidatedParentOrders(n,this.parentOrders),n;this.cache.delete(f)}let m=e,h=m;for(let t of n(a.preprocess)){let n;try{n=t(h)}catch(e){if(u())return d();throw e}if(l())return d();if(!n){c&&(ue(this.blocked,e),B(this.cache,f,null));return}h=n}let g;try{g=this.isBlocked(h)}catch(e){if(u())return d();throw e}if(l())return d();if(g){c&&(ue(this.blocked,e),B(this.cache,f,null));return}let _;try{_=await this.matchVariantsForConfig(m,h,a)}catch(e){if(u())return d();throw e}if(l())return d();try{_=_.filter(e=>e&&!this.isBlocked(e[1]))}catch(e){if(u())return d();throw e}if(l())return d();if(!_.length){c&&(ue(this.blocked,e),B(this.cache,f,null));return}let v=async e=>{let n=this.makeContextForConfig(m,[t||e[0],e[1],e[2],e[3]],a);r&&this._generationContexts.add(n),i&&this._contextInputChecks.set(n,i);try{a.details&&(n.variants=[...e[3]]);let t=await this.expandMatchedShortcut(n),r=t?await this.stringifyShortcuts(n.variantMatch,n,t[0],t[1],t[2]):(await this.parseUtil(n.variantMatch,n))?.flatMap(e=>this.stringifyUtil(e,n)).filter(Ir);return{direct:!t,utils:r,staticMatched:(a.unmatched===`warn`||a.unmatched===`error`)&&this._matchedStaticContexts.has(n)}}finally{r&&this._generationContexts.delete(n),this._contextInputChecks.delete(n)}},y;try{y=_.length===1?[await v(_[0])]:await Promise.all(_.map(e=>v(e)))}catch(e){if(u())return d();throw e}if(l()||this._preparedConfigMutable&&!r&&(this.ensureRuleIndexesCurrent(!0),l()))return d();let b=[],x={},S=0;for(let{direct:e,utils:t}of y)for(let n of t??[])e&&this._stringifiedOutputOrders.set(n,{group:x,index:S++}),V(b,n);if(b?.length)return r||this.collectValidatedParentOrders(b,this.parentOrders),c&&B(this.cache,f,b),b;if(y.some(({direct:e,staticMatched:t})=>e&&t))return this._emptyStaticPayloads.add(b),c&&B(this.cache,f,b),b;c&&B(this.cache,f,null)}parseTokenForGeneration(e,t){let n=this._startingInputCheck;this._startingInputCheck=t,this._startingGenerationParse++;try{return this.parseToken(e)}finally{this._startingGenerationParse--,this._startingInputCheck=n}}getCachedEquivalentTokens(e){this.config&&this._preparedConfigMutable&&this.ensureRuleIndexesCurrent(!0);let t=this.cache.get(e);if(!t?.length)return[e];let n=new Set([e]);for(let[r,i]of this.cache.entries())i&&!r.endsWith(` -`)&&mo(i,r,t,e)&&n.add(r);return[...n]}async generate(e,t={}){let n=j(e)?void 0:++this._collectionGeneration,r=$(t,`isInputCurrent`);if(r!==void 0&&typeof r!=`function`)throw TypeError(`[@teacss/core] isInputCurrent must be a function.`);let i,a=r===void 0?void 0:()=>{if(i)throw i.error;try{let e=r();if(typeof e!=`boolean`)throw Promise.resolve(e).catch(Rr),TypeError(`[@teacss/core] isInputCurrent must return a boolean synchronously.`);if(!e)throw Error(`[@teacss/core] Generation input is no longer current.`)}catch(e){throw i={error:e},e}};return this.generateInternal(e,t,n,a)}async generateInternal(e,t,r,i){await this.ensureInitialized(),i?.(),this.ensureRuleIndexesCurrent(this._preparedConfigMutable);let a=this.config,o=this._runtimeRevision,s=!this._preparedConfigMutable||this._preparedCacheReliable,c=()=>(i?.(),this.config!==a||this._runtimeRevision!==o),l=()=>(this._preparedConfigMutable&&this.ensureRuleIndexesCurrent(!0),c()),u=new Map,d=!s||r===void 0||!(this.cache instanceof se)?void 0:this.cache,f=d?.revision,p=$(t,`id`),m=$(t,`scope`),h=$(t,`preflights`),g=$(t,`safelist`),_=$(t,`minify`),v=$(t,`extendedInfo`),y=$(t,`tokenConcurrency`),b=h===void 0||h,x=g===void 0||g,S=_!==void 0&&_,C=v!==void 0&&v,w=()=>this.generateInternal(e,t,r,i);oo(y);let T;try{T=j(e)?await this.applyExtractorsForConfig(a,e,p,C?new wr:new Set):Array.isArray(e)?yo(new Set(n(e))):K(e)?yo(no(e)):yo(new Set(e))}catch(e){if(l())return w();throw e}if(c())return w();try{if(x){let e={generator:this,theme:a.theme};for(let t=0;t<a.safelist.length;t++){if(!Object.hasOwn(a.safelist,t))continue;let r=a.safelist[t],i=typeof r==`function`?r(e):r;for(let e of n(O(i))){let t=e.trim();if(!t)continue;let n=t.includes(`{`)?yo(new Set([t])):[t];for(let e of n)T.has(e)||T.add(e)}}}}catch(e){if(l())return w();throw e}if(c())return w();let D=S?``:`
|
|
20
|
+
`,k=new Set([ze]),A=C?new Map:new Set,M=new Map,N=[],P=new Map,F=Object.create(null),I=Array.from(T),L;try{L=await fo(I,y,e=>this.parseTokenForGeneration(e,i))}catch(e){if(l())return w();throw e}if(c())return w();let ee=0,te=d!==void 0,ne=a.unmatched===`warn`||a.unmatched===`error`,re=[];try{for(let e=0;e<I.length;e++){let t=I[e],n=L[e];if(n?.length===0&&this._emptyStaticPayloads.has(n)){L[e]=null;continue}if(n==null){ne&&vi(t)&&!this.blocked.has(t)&&!this.isBlocked(t)&&V(re,t);continue}let r=this.copyValidatedStringifiedUtils(n,!0,!0,!0);ee++,te&&!d.isRetained(t)&&(te=!1),A instanceof Map?A.set(t,{data:this.copyValidatedStringifiedUtils(r,!1),count:K(T)?T.getCount(t):-1}):A.add(t),this.collectValidatedParentOrders(r,P);for(let e of r){V(N,e);let t=e[3]||``,n=Q(e[4],`layer`);M.has(t)||M.set(t,[]),V(M.get(t),e),n&&k.add(n)}}}catch(e){if(l())return w();throw e}if(c())return w();for(let[e,t]of P){u.set(e,t);let n=this.parentOrders.get(e);(n===void 0||t<n)&&this.parentOrders.set(e,t)}try{await(async()=>{if(!b)return;let e=O(a.preflights);if(!e.length)return;let t={generator:this,generated:this.copyValidatedStringifiedUtils(N,!1),theme:a.theme},r=new Set,i=new Map;for(let t of n(e)){let e=E(t,`layer`)||`preflights`;k.add(e),r.add(e);let n=i.get(e);n?V(n,t):i.set(e,[t])}F=Object.assign(Object.create(null),Object.fromEntries(await Promise.all(Array.from(r).map(async e=>[e,(await Promise.all(O(i.get(e)||[]).map(async e=>{let n=E(e,`getCSS`);return n?await Reflect.apply(n,e,[t]):void 0}))).filter(Boolean).join(D)]))))})()}catch(e){if(l())return w();throw e}if(c())return w();let ie,ae,R=()=>(ie??=re.flatMap(e=>{let t=ki(e,a);return t===void 0?[]:[{token:e,suggestions:t}]}),ie);if(re.length&&a.unmatched!==`off`&&a.unmatched!==void 0){let e;try{e=await Promise.resolve().then(R),this._preparedConfigMutable&&this.ensureRuleIndexesCurrent(!0)}catch(e){if(l())return w();throw e}if(c())return w();let t=({token:e,suggestions:t})=>t.length?`"${e}" (did you mean ${t.map(e=>`"${e}"`).join(`, `)}?)`:`"${e}"`;if(a.unmatched===`error`){if(e.length)throw Error(`[@teacss/core] ${e.length} token${e.length===1?``:`s`} matched no rule: ${e.map(t).join(`; `)}`)}else a.warn&&(ae=()=>{for(let n of e)if(i?.(),!this._warnedUnmatched.has(n.token)){if(console.warn(`[Teacss]`,`unmatched token ${t(n)}`),c())return;ue(this._warnedUnmatched,n.token)}})}let z;try{z=Yo({authoredOutputOrders:this._stringifiedOutputOrders,config:a,currentSelectors:this._stringifiedCurrentSelectors,layerSet:k,matched:A,minify:S,parentOrders:u,preflights:b,preflightsMap:F,scope:m,sheet:M,shortcutMergeOrders:this._shortcutMergeOrders,resolveUnmatched:R}),await Promise.resolve(),this._preparedConfigMutable&&this.ensureRuleIndexesCurrent(!0)}catch(e){if(l())return w();throw e}if(c())return w();if(ae){try{ae(),await Promise.resolve(),this._preparedConfigMutable&&this.ensureRuleIndexesCurrent(!0)}catch(e){if(l())return w();throw e}if(c())return w()}return d&&f!==void 0&&this.cache===d&&r===this._collectionGeneration&&(!te||ee!==d.retainedSize)&&d.replaceRetained(ao(I,L),f),z}async matchVariants(e,t){return this.matchVariantsCurrent(e,t)}async matchVariantsCurrent(e,t){await this.ensureInitialized(),this.ensureRuleIndexesCurrent(this._preparedConfigMutable);let n=this.config,r=this._runtimeRevision,i;try{i=await this.matchVariantsForConfig(e,t,n)}catch(i){if(this._preparedConfigMutable&&this.ensureRuleIndexesCurrent(!0),this.config!==n||this._runtimeRevision!==r)return this.matchVariantsCurrent(e,t);throw i}return this._preparedConfigMutable&&this.ensureRuleIndexesCurrent(!0),this.config!==n||this._runtimeRevision!==r?this.matchVariantsCurrent(e,t):i}async matchVariantsForConfig(e,t,r){let i={rawSelector:e,theme:r.theme,generator:this};pe(i,r===this.config?this._variantCacheOwner:r);let a=r.variants,o=async t=>{let r=!0,[,,s,c]=t;for(;r;){r=!1;let l=t[1];for(let e of n(a)){let a=E(e,`multiPass`)??!1;if(!a&&c.has(e))continue;let u=E(e,`match`);if(!u)continue;let d=Reflect.apply(u,e,[l,i]),f=uo(d),p=f?await f:d;if(p){if(j(p)){if(p===l)continue;p={matcher:p}}if(Array.isArray(p)){let r=Array.from(n(p));if(!r.length)continue;if(r.length===1)p=r[0];else{if(a)throw Error(`multiPass can not be used together with array return variants`);let n=r.map(n=>{let r=E(n,`matcher`)??l,i=[n,...s],a=new Set(c);return a.add(e),[t[0],r,i,a]});return(await Promise.all(n.map(e=>o(e)))).flat()}}t[1]=E(p,`matcher`)??l,to(s,p),c.add(e),r=!0;break}}if(!r)break;if(s.length>500)throw Error(`Too many variants applied to "${e}"`)}return[t]};return await o([e,t||e,[],new Set])}applyVariants(e,t=e[4],r=e[1],i=is(r),a){let o=Array.from(n(t),lo),s=o.length>1?o.sort((e,t)=>(e.order||0)-(t.order||0)):o,c=O(this.getContextConfig(a).postprocess),l={prefix:``,selector:i,pseudo:``,entries:s.length||c.length?ni(O(e[2])):e[2]},u=s.length?s.reduceRight((e,t)=>n=>{let r=E(n,`entries`)??[],i=E(n,`parent`),a=E(n,`parentOrder`),o=E(n,`selector`)??``,s=(t.body==null?void 0:Reflect.apply(t.body,t.source,[r]))||r,c=t.parent||i,l=t.selector==null?void 0:Reflect.apply(t.selector,t.source,[o,s]);return Reflect.apply(t.handle??as,t.source,[{...n,entries:s,selector:l??o,parent:c,parentOrder:t.parentOrder??(c===i?a:void 0),layer:t.layer||E(n,`layer`),sort:t.sort??E(n,`sort`)},e])},e=>e)(l):l,d=E(u,`parent`),f=E(u,`parentOrder`),p={selector:[E(u,`prefix`)??``,E(u,`selector`)??``,E(u,`pseudo`)??``].join(``),entries:E(u,`entries`)??[],parent:d,layer:E(u,`layer`),sort:E(u,`sort`),noMerge:E(u,`noMerge`)};d!=null&&f!=null&&this._utilParentOrders.set(p,f);let m=[p];for(let e of n(c)){let t=[];for(let r of m){let i=this._utilParentOrders.get(r),a=r.parent;i!=null&&this._utilParentOrders.delete(r);let o=e(r);if(Array.isArray(o))for(let e of n(o))e!=null&&(i!=null&&e.parent===a&&this._utilParentOrders.set(e,i),V(t,e));else{let e=o||r;i!=null&&e.parent===a&&this._utilParentOrders.set(e,i),V(t,e)}}m=t}return m}constructCustomCSS(e,t,n){let r=Kr(t);return this.constructNormalizedCSS(e,r,n)}constructNormalizedCSS(e,t,n){if(j(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`?V(r,n):i===Z.body&&V(r,[Yr,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:Zr(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?Co(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;this.getContextConfig(t)===this.config&&this._preparedConfigMutable&&!this._generationContexts.has(t)&&this.ensureRuleIndexesCurrent(!0);let s=this.getContextConfig(t),c=s===this.config&&this._preparedConfigMutable&&!this._generationContexts.has(t),l=this._runtimeRevision,u=async e=>{let[i,a,o]=e;s.details&&(t.rules=t.rules??[]);let c={...t,currentSelector:a,variantHandlers:o,variantMatch:e};this._contextConfigs.set(c,s);let u;c.constructCSS=(...e)=>{if(!n||!t.variantHandlers.length)return this.constructCustomCSS(c,...e);let r=Kr(e[0]);if(!j(r)&&_o(r))return this.constructNormalizedCSS(c,r,e[1]);u||(u={...c,variantHandlers:vo(c.variantHandlers,t.variantHandlers)},this._contextConfigs.set(u,s));let i=this.constructNormalizedCSS(u,r,e[1]),a=this._constructedCSSResults.get(u)?.get(i);if(a){let e=this._constructedCSSResults.get(c);e||(e=new Map,this._constructedCSSResults.set(c,e)),e.set(i,a)}return i};let d=s.rulesStaticMap[a];if(r){d=void 0;let e=O(r);for(let t=s.rules.length-1;t>=0;t--){let n=s.rules[t];if(!ri(n)||n[0]!==a)continue;let r=Q(n[2],`prefix`);if(!r||O(r).some(t=>e.includes(t))){d=n;break}}}let f=d,p=()=>{let e=f;if(f=void 0,!(!e?.[1]||!n&&Q(e[2],`internal`)))return!n&&(s.unmatched===`warn`||s.unmatched===`error`)&&this._matchedStaticContexts.add(t),this.resolveCSSResult(i,e[1],e,c,l)},m=a.indexOf(`:`),h=this.getDynamicIndex(s),g=m>0&&h.map.get(a.slice(0,m))||h.fallback;for(let e of g){let[t,o,s]=e;if((Q(f?.[2],`__index`)??-1)>(Q(s,`__index`)??-1)){let e=p();if(e)return e}if(Q(s,`internal`)&&!n)continue;let u=[a],d=Q(s,`prefix`);if(d){let e=O(d);if(r){let t=O(r);if(!e.some(e=>t.includes(e)))continue}else if(u=e.filter(e=>a.startsWith(e)).map(e=>a.slice(e.length)),!u.length)continue}for(let n of u){let r=di(n,t);if(!r)continue;let a=o(r,c),s=uo(a),u=s?await s:a;if(!u)continue;if(typeof u==`object`||typeof u==`function`){let e=Array.isArray(u)?void 0:E(u,Symbol.asyncIterator);if(e){let t=[];for await(let n of{[Symbol.asyncIterator]:()=>Reflect.apply(e,u,[])})n&&V(t,n);u=t}else{let e=Array.isArray(u)?void 0:E(u,Symbol.iterator);if(e){let t=[];for(let n of{[Symbol.iterator]:()=>Reflect.apply(e,u,[])})n!=null&&V(t,n);u=t}}}let d=this.resolveCSSResult(i,u,e,c,l);if(d)return d}}return p()},d,f;try{let t=j(e)?await this.matchVariantsForConfig(e,void 0,s):[e];d=t.length===1?await u(t[0]):(await Promise.all(t.map(u))).flat().filter(Ir)}catch(e){f=[e]}if(c&&(this.ensureRuleIndexesCurrent(!0),this.config===s&&this._runtimeRevision!==l))return a&&o!==void 0?(a.length=o,t.rules=a):i?t.rules=a:delete t.rules,this.parseUtil(e,t,n,r);if(f)throw f[0];if(d?.length)return d}resolveCSSResult=(e,t,r,i,a)=>{let o=qr(t).filter(e=>e.length);if(o.length){let t=this.getContextConfig(i);t.details&&(t!==this.config||a===this._runtimeRevision)&&V(i.rules,r),t===this.config&&a===this._runtimeRevision&&i.generator.activatedRules.add(r);let s=r[2],c=Q(s,`__index`),l={},u=0,d=e=>(this._parsedOutputOrders.set(e,{group:l,index:u++}),e);return o.flatMap(t=>{if(j(t)){let e=this._constructedCSSResults.get(i)?.get(t);return e?e.map(e=>{let t=[c,e.body,s];return this._rawUtilMetadata.set(t,e),d(t)}):[d([c,t,s])]}let r=[],a=i.variantHandlers,o=s,l=e=>{a=[e,...a]},u=e=>{a=[...a,e]},f=e=>{o={...o,...e}};for(let e=0;e<t.length;e++){if(!Object.hasOwn(t,e))continue;let i=t[e],o=Object.hasOwn(i,0)?i[0]:void 0,s=()=>Object.hasOwn(i,1)?i[1]:void 0;switch(o){case Z.variants:{let e=s();if(typeof e==`function`){let t=e([...n(a)]);t&&(a=[...n(t)])}else a=[...n(e),...a];break}case Z.parent:l({parent:s()});break;case Z.selector:u({selector:s()});break;case Z.layer:l({layer:s()});break;case Z.sort:f({sort:s()});break;case Z.noMerge:f({noMerge:s()});break;case Z.noScope:f({noScope:s()});break;case Z.shortcutsNoMerge:V(r,i);break;case Z.body:V(r,[Yr,s()]);break;default:j(o)&&V(r,i)}}return[d([c,e,r,o,a])]})}};stringifyUtil(e,t){if(!e)return;let n=this.getContextConfig(t);if(Fr(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=Zr(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),V(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(),this.getContextConfig(t)===this.config&&this._preparedConfigMutable&&!this._generationContexts.has(t)&&this.ensureRuleIndexesCurrent(!0);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,r,i,a,o,s){let c=O(i);if(r<=0||!c.length)return;let l=this.getContextConfig(t),u=j(e)?e:e[1],d=l.details?e=>{t.shortcuts=t.shortcuts??[],V(t.shortcuts,e)}:Rr,f,p,m,h,g=s,_=this.getExpansionIndex(c,i===l.shortcuts),v,y=_.statics.get(u);if(y){for(let e of y)if((!e.requiresPrefixes||s&&e.requiresPrefixes.includes(s))&&e.entry[1]){v=e;break}}let b=v?v.order:1/0,x=[{prefix:s,value:u}];expansionLoop:for(let{entry:e,order:n}of _.dynamics){if(n>=b)break;let r=Object.hasOwn(e,2)?e[2]:void 0,i=x,a=Q(r,`prefix`);if(a){let e=O(a);if(i=e.filter(e=>u.startsWith(e)).map(e=>({prefix:e,value:u.slice(e.length)})),s&&e.includes(s)&&V(i,{prefix:s,value:u}),!i.length)continue}for(let n of i){if(j(e[0])){if(e[0]!==n.value)continue;p=e[1]}else{let r=di(n.value,e[0]);r&&(p=e[1](r,t))}if(p){g=n.prefix,f||=r,d(e);break expansionLoop}}}if(!p&&v){let e=v.entry;p=e[1],p&&(g=v.kind===`fixed`?v.prefix:s,f=Object.hasOwn(e,2)?e[2]:void 0,d(e))}if(p){let e=[...n(O(p))];m=e.filter(e=>j(e)).flatMap(e=>ji(ea(Tn(e.trim()),l.separators))).map(e=>({prefix:g,value:e})),h=e.filter(e=>!j(e)).map(e=>({handles:[],value:e}))}if(!p&&j(e)){let n=await this.matchVariantsForConfig(e,void 0,l);for(let e of n){let[n,c,l]=e;if(n!==c){let e=await this.expandConfiguredExpansions(c,t,r-1,i,a,o,s);if(e){let t=this._expansionPrefixes.get(e)??[];m??=[];for(let r=0;r<e[0].length;r++){let i=e[0][r];j(i)&&V(m,{prefix:t[r]??s,value:n.replace(c,()=>i)})}h??=[],eo(h,e[0].filter(e=>!j(e)).map(e=>({handles:[...e.handles,...l],value:e.value})))}}}}if(!m?.length&&!h?.length)return;let S=new Map,C=(m??[]).filter(({prefix:e,value:t})=>{let n=S.get(e);return n||(n=new Set,S.set(e,n)),!n.has(t)&&(n.add(t),!0)}),w=[...(await Promise.all(C.map(async({prefix:e,value:n})=>{let s=await this.expandConfiguredExpansions(n,t,r-1,i,a,o,e),c=s?void 0:await o?.(n,t,r-1),l=s??c;if(!l)return[{prefix:e,value:n}];let u=this._expansionPrefixes.get(l)??[];return l[0].map((t,n)=>({prefix:u[n]??e,value:t}))}))).flat(),...(h??[]).map(e=>({prefix:g,value:e}))].filter(({value:e})=>!!e);return[w.map(({value:e})=>e),f,w.map(({prefix:e})=>e)]}async stringifyShortcuts(e,t,n,r,i){await this.ensureInitialized();let a=this.getContextConfig(t),o=this._runtimeRevision,s=[];r={...r,layer:Q(r,`layer`)??a.shortcutsLayer};let c=i??this._expansionPrefixes.get(n)??[],l=new Vr,u=(await Promise.all(n.map(async(n,i)=>{let o=j(n)?await this.parseUtil(n,t,!0,c[i]??Q(r,`prefix`)):[[1/0,`{inline}`,Kr(n.value),void 0,n.handles]];return!o&&a.warn&&V(s,[i,`unmatched utility "${n}" in shortcut "${e[1]}"`]),o||[]}))).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[d,,f]=e,p=u.some(Fr),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 u){if(Fr(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),V(g,o);continue}let n=_o(e[2]),i=n?e[4]:vo(e[4],f);for(let o of this.applyVariants(e,i,d,void 0,t)){let{selector:i,entries:s,parent:c,sort:u,noMerge:d,layer:f}=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(p){let n=Zr(s);if(!n)continue;let l=[e[0],i,n,c,{...r,noMerge:m,noScope:h,sort:b,layer:f??y},a.details?t:void 0,void 0];this.recordStringifiedContext(l,t);let u=this._utilParentOrders.get(o);c!=null&&u!=null&&this._stringifiedParentOrders.set(l,u),_(l),V(g,l);continue}let x=l.getFallback(f??y,{ordered:[],streams:new Map}),S=x.streams.get(c);S||(S=[],x.streams.set(c,S));let C=S[S.length-1];(!C||C.selector!==i||C.noScope!==h)&&(C={entries:[],noScope:h,parent:c,parentOrder:void 0,selector:i},V(S,C),V(x.ordered,C)),V(C.entries,[s,m,b,e[0]]);let w=this._utilParentOrders.get(o);w!=null&&(C.parentOrder==null||w<C.parentOrder)&&(C.parentOrder=w)}}let v=l.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=-1/0,f=-1/0;for(let[,e,t]of u)d=Math.max(d,e),f=Math.max(f,t);let 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=Zr(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?Zr(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(Ir):void 0,v.original=g,this._shortcutMergeOrders.set(g,v),g}})},u=[],d=[],f=[],p=[];for(let[t,n,r,i]of e){let e=O(t).some(go);V(n?e?u:d:e?f:p,[t,r,i])}return[...l(!1,!0,u),...l(!0,!0,d),...l(!1,!1,f),...l(!0,!1,p)].filter(Ir)}).flat(1).filter(Boolean));for(let e of v)_(e);let y=g.concat(v);if(s.length){await Promise.resolve(),a===this.config&&this._preparedConfigMutable&&this.ensureRuleIndexesCurrent(!0);for(let[,e]of s.sort((e,t)=>e[0]-t[0])){if(this._contextInputChecks.get(t)?.(),a!==this.config||o!==this._runtimeRevision)break;na(e)}}return y}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):j(e)?e===t:di(t,e)!==null}},Zo=class extends Xo{constructor(e={},t={}){super(e,t)}};async function Qo(e,t){return await Xo.create(e,t)}const $o=/\s\$\$\s+/g;function es(e){return To(e).length>0}function ts(e){let t=[],n=0,r=!1,i=0,a,o=0,s=0;for(let c=0;c<e.length;c++){let l=e[c];if(r)l===`*`&&e[c+1]===`/`&&(r=!1,c++);else if(a)l===`\\`?c++:l===a&&(a=void 0);else if(l===`/`&&e[c+1]===`*`)r=!0,c++;else if(l===`\\`){let t=c+1;for(;t<c+7&&/[\da-f]/i.test(e[t]??``);)t++;t>c+1?(/[ \t\n\r\f]/.test(e[t]??``)&&(e[t]===`\r`&&e[t+1]===`
|
|
21
|
+
`&&t++,t++),c=t-1):c++}else if(l===`"`||l===`'`)a=l;else if(l===`[`)n++;else if(l===`]`)n>0&&n--;else if(l===`(`)i++;else if(l===`)`)i>0&&i--;else if(l===`,`&&n===0&&i===0){V(t,e.slice(o,s).replace(/^[ \t\n\r\f]+/,``)),o=c+1,s=o;continue}(r||a||!/[ \t\n\r\f]/.test(l))&&(s=c+1)}return V(t,e.slice(o,s).replace(/^[ \t\n\r\f]+/,``)),t}function ns(e,t){return ts(e).flatMap(e=>{let n=e.startsWith(`$$`)&&/\s/.test(e[2]??``)?` ${e}`:e;if(!t)return Eo(n);let r=es(n);return t.map(t=>r?Eo(n,t):`${t} ${e}`)}).join(`,`)}const rs=/^\[(.+?)(~?=)"(.*)"\]$/;function is(e){return rs.test(e)?e.replace(rs,(e,t,n,r)=>`[${kn(t)}${n}"${kn(r)}"]`):`.${kn(e)}`}function as(e,t){return t(e)}const os=e.hash??((t,n,r)=>e.createHash(t).update(n).digest(r));function ss(e,t=8){return os(`sha256`,e,`hex`).substring(0,t)}const cs=`@teacss-include`,ls=`@teacss-ignore`,us=`@teacss-ide-include`,ds=`@teacss-placeholder`,fs=`@teacss-skip-start`,ps=`@teacss-skip-end`,ms=RegExp(`(//\\s*?${fs}\\s*?|\\/\\*\\s*?${fs}\\s*?\\*\\/|<!--\\s*?${fs}\\s*?-->)[\\s\\S]*?(//\\s*?${ps}\\s*?|\\/\\*\\s*?${ps}\\s*?\\*\\/|<!--\\s*?${ps}\\s*?-->)`,`g`),hs=[/^(?:virtual:)?tea(?::(.+))?\.css(\?.*)?$/],gs=`__ALL__`;export{Vr as BetterMap,ds as CSS_PLACEHOLDER,wr as CountableSet,Be as DEFAULT_LAYERS,ls as IGNORE_COMMENT,cs as INCLUDE_COMMENT,us as INCLUDE_COMMENT_IDE,Pe as LAYER_IMPORTS,gs as LAYER_MARK_ALL,Le as LAYER_PREFLIGHTS,Fe as LAYER_PRIMITIVES,Ie as LAYER_PROPERTIES,Re as LAYER_SHORTCUTS,ze as LAYER_UTILITIES,Qr as RESET_KEY,ms as SKIP_COMMENT_RE,ps as SKIP_END_COMMENT,fs as SKIP_START_COMMENT,Zo as TeacssGenerator,Br as TwoKeyMap,hs as VIRTUAL_ENTRY_ALIAS,Yr as VirtualKey,kr as attributifyRE,ae as buildConditionSelector,Jr as clearIdenticalEntries,ni as clone,$i as collapseVariantGroup,Xa as comparableWidth,So as compareParentAtRules,Ne as createConditionVariant,Qo as createGenerator,Er as createNanoEvents,Ar as cssIdRE,Vn as defaultSplitRE,Na as definePreset,ki as diagnoseUnmatchedToken,kn as e,Zr as entriesToCss,Dn as escapeRegExp,On as escapeSelector,Tn as expandClassGroups,bn as expandGroups,Mi as expandUnderscores,ea as expandVariantGroup,Cr as extractorDefault,Cr as extractorSplit,Pa as getEnvFlags,ss as getHash,Mn as getPath,es as hasScopePlaceholder,Pn as hash,Vi as isArbitrary,Mr as isAttributifySelector,K as isCountableSet,Nn as isCssId,q as isObject,Fr as isRawUtil,ri as isStaticRule,ii as isStaticShortcut,j as isString,Lr as isThenable,vi as isTokenShaped,Nr as isValidSelector,g as isValidTargetSelector,Zi as makeRegexClassGroup,Oa as mergeConfigs,$r as mergeDeep,Rr as noop,Hi as normalizeArbitraryValue,Kr as normalizeCSSEntries,qr as normalizeCSSValues,Pr as normalizeVariant,Ir as notNull,Me as parseClassToken,P as parseCondition,F as parseConditions,Qi as parseVariantGroup,$o as regexScopePlaceholder,zn as replaceAsync,ie as resolveConditions,Sa as resolveConfig,_a as resolvePreset,ya as resolvePresets,ma as resolveShortcuts,Rn as restoreSkipCode,Bi as spaceCalcOperators,ji as splitClassTokens,Hn as splitWithVariantGroupRE,Z as symbols,O as toArray,is as toEscapedSelector,_i as tokenConditionBase,Ln as transformSkipCode,k as uniq,A as uniqueBy,jr as validateFilterRE,na as warnOnce,zr as withLayer};
|