@teacss/language-server 0.3.8 → 0.4.1

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.
Files changed (2) hide show
  1. package/dist/server.js +11 -10
  2. package/package.json +7 -7
package/dist/server.js CHANGED
@@ -1,15 +1,16 @@
1
- import{a as e,i as t,n,r,t as i}from"./semanticTokens-D6dlGQyV.js";import{createRequire as a}from"node:module";import o from"node:process";import s from"magic-string";import c,{existsSync as l}from"node:fs";import u from"node:path";import{diagnoseCustom as d,entryDiscoveryFiles as f,findEntry as p,scanCustomBlocks as m}from"@teacss/config";import{createContext as h}from"@teacss/runtime";import{fileURLToPath as g,pathToFileURL as _}from"node:url";import{channel as v,tracingChannel as y}from"node:diagnostics_channel";import{TextDocument as b}from"vscode-languageserver-textdocument";import{CompletionItemKind as x,DiagnosticSeverity as S}from"vscode-languageserver-types";import{colordx as C,extend as w}from"@colordx/core";import T from"@colordx/core/plugins/cmyk";import E from"@colordx/core/plugins/hwb";import ee from"@colordx/core/plugins/lab";import te from"@colordx/core/plugins/lch";import ne from"@colordx/core/plugins/names";import D from"@colordx/core/plugins/p3";import{DidChangeWatchedFilesNotification as O,ProposedFeatures as k,TextDocumentSyncKind as A,TextDocuments as re,WatchKind as ie,createConnection as ae}from"vscode-languageserver/node";var j=a(import.meta.url);function M(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 oe(e){return Array.from(new Set(M(e)))}function se(e,t,n){Object.defineProperty(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0})}function ce(e,t){let n=e.length;n in e?se(e,n,t):e[n]=t}function le(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),ce(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;ce(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}}const ue=`utilities`;Object.freeze({imports:-200,properties:-150,preflights:-100,shortcuts:-50,primitives:-10,[ue]:0});function N(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}const de=/\.(css|postcss|sass|scss|less|stylus|styl)($|\?)/;function fe(e){return de.test(e)}function pe(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 me(){return{events:Object.create(null),emit(e,...t){let n=Object.hasOwn(this.events,e)?this.events[e]:void 0,r=M(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)||pe(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;pe(n,e,M(Array.isArray(r)?r:[]).filter(e=>e!==t))}}}}const he=/^\[(.+?)~?="(.*)"\]$/,ge=/[\w\u00A0-\uFFFF%-?]/;new RegExp(he.source,he.flags),new RegExp(ge.source,ge.flags);function _e(e){return e.match(he)}function ve(e){return e!=null}const ye=`@teacss-skip-start`,be=`@teacss-skip-end`;RegExp(`(//\\s*?${ye}\\s*?|\\/\\*\\s*?${ye}\\s*?\\*\\/|<!--\\s*?${ye}\\s*?-->)[\\s\\S]*?(//\\s*?${be}\\s*?|\\/\\*\\s*?${be}\\s*?\\*\\/|<!--\\s*?${be}\\s*?-->)`,`g`);const xe=RegExp(`(//\\s*?${ye}\\s*?|\\/\\*\\s*?${ye}\\s*?\\*\\/|<!--\\s*?${ye}\\s*?-->)[\\s\\S]*?(//\\s*?${be}\\s*?|\\/\\*\\s*?${be}\\s*?\\*\\/|<!--\\s*?${be}\\s*?-->)`,`g`);function Se(e,t,n){for(let r=t+1;r<e.length;r++){let t=e[r];if(t===`\\`){r++;continue}if(t===n)return r+1}return e.length}const Ce=/\.(?:[cm]?[jt]sx?|vue|svelte|astro|marko|php|phtml|scss|sass|less|styl(?:us)?)(?:$|\?)/i,we=/\.(?:html?|vue|svelte|astro|marko|mdx?|php|phtml)(?:$|\?)/i;function Te(e,t){let n=[],r=t===void 0||Ce.test(t),i=t===void 0||we.test(t);for(let t=0;t<e.length;){let a=e[t];if(a===`"`||a===`'`||a==="`"){t=Se(e,t,a);continue}if(e.startsWith(`{/*`,t)){let r=e.indexOf(`*/}`,t+3);n.push([t,r<0?e.length:r+3]),t=n[n.length-1][1];continue}if(i&&e.startsWith(`<!--`,t)){let r=e.indexOf(`-->`,t+4);n.push([t,r<0?e.length:r+3]),t=n[n.length-1][1];continue}if(e.startsWith(`/*`,t)){let r=e.indexOf(`*/`,t+2);n.push([t,r<0?e.length:r+2]),t=n[n.length-1][1];continue}if(r&&e.startsWith(`//`,t)){let r=e.slice(t+2).search(/[\n\r]/),i=r<0?e.length:t+2+r;n.push([t,i]),t=n[n.length-1][1];continue}t++}return n}const Ee=[/"(?:\\[\s\S]|[^"\\])*"|'(?:\\[\s\S]|[^'\\])*'|`(?:\\[\s\S]|[^`\\])*`/g,/<[^/?<>0-9$_!"'](?:"[^"]*"|'[^']*'|[^>])+>/g,/(@apply|--at-apply)[^;]*;/g],De=[xe],Oe=/([\\:]?[\s"'`;<>]|:\(|\)"|\)\s)/g,ke=/(?:[\w&:[\]-]|\[\S{1,64}=\S{1,64}\]){1,64}\[\\?['"]?\S{0,64}?['"]\]\]?[\w:@-]{0,64}/g,Ae=/\[(\\\W|[\w-]){1,64}:[^\s:]{0,64}?("\S{1,64}?"|'\S{1,64}?'|`\S{1,64}?`|[^\s:]{1,64}?)[^\s:]{0,64}?\)?\]/g;async function je(e,t,n=``){let r=e.config.extractors?.find(e=>e.name===`pug`);if(!r)return{pug:!1,code:``};let i={code:t,id:n};await r.extract?.(i);let a=i.code.startsWith(t)?i.code.substring(t.length+2):i.code;return i.code===t?{pug:!1,code:``}:{pug:!0,code:a}}function Me(e,t,n){let r=[];t.has(e)&&r.push([n,n+e.length,e]);let i=new Set;for(let a of e.matchAll(/\.([^.#=\s(]+)(?=[.#=\s(]|$)/g)){let e=a[1];if(e.includes(`:`)||i.has(e)||!t.has(e))continue;i.add(e);let o=n+a.index+1;r.push([o,o+e.length,e])}return r}function Ne(e,t){let n=e.flags.includes(`g`)?e.flags:`${e.flags}g`;return t.matchAll(new RegExp(e.source,n))}function Pe(e,t){let n=t.map(([t,n])=>[Math.max(0,t),Math.min(e.length,n)]).filter(([e,t])=>t>e).sort((e,t)=>e[0]-t[0]||e[1]-t[1]);if(!n.length)return e;let r=[];for(let[e,t]of n){let n=r.at(-1);n&&e<=n[1]?n[1]=Math.max(n[1],t):r.push([e,t])}let i=[],a=0;for(let[t,n]of r)i.push(e.slice(a,t),` `.repeat(n-t)),a=n;return i.push(e.slice(a)),i.join(``)}function Fe(e){let t=[...e].sort((e,t)=>e[0]-t[0]||t[1]-e[1]),n=[],r=[],i=-1;for(let[e,a]of t)n.push(e),i=Math.max(i,a),r.push(i);return{starts:n,maxEnds:r}}function Ie(e,t,n){let r=0,i=e.starts.length;for(;r<i;){let n=r+i>>>1;e.starts[n]<=t?r=n+1:i=n}return r>0&&e.maxEnds[r-1]>=n}function Le(e){return e===void 0||/[\s'"`;<>]/.test(e)}function Re(e,t){if(!t.size)return[];let n={children:new Map};for(let e of t){let t=n;for(let n=0;n<e.length;n++){let r=e[n],i=t.children.get(r);i||(i={children:new Map},t.children.set(r,i)),t=i}t.value=e}let r=[];for(let t=0;t<e.length;t++){if(!Le(e[t-1]))continue;let i=n;for(let n=t;n<e.length;n++){let a=i.children.get(e[n]);if(!a)break;i=a,i.value&&Le(e[n+1])&&r.push([t,n+1,i.value])}}return r}function ze(e,t,n){for(let r=t+1;r<e.length;r++)if(e[r]===`\\`)r++;else if(e[r]===n)return r;return-1}function Be(e,t,n){if(!n)return[];let r=[],i=RegExp(`(^|[^\\w:-])${N(t)}\\s*=\\s*(['"])`,`g`);for(let t of e.matchAll(i)){let i=t.index+t[0].length-1,a=ze(e,i,t[2]);if(!(a<0))for(let t=e.indexOf(n,i+1);t>=0&&t+n.length<=a;t=e.indexOf(n,t+n.length)){let o=t===i+1||/\s/.test(e[t-1]),s=t+n.length===a||/\s/.test(e[t+n.length]);o&&s&&r.push(t)}}return r}function Ve(e,t){let n=0,r=0,i=!1;for(let a=t+1;a<e.length;a++){let t=e[a];if(t===`(`){if(n===0&&r===0&&!i)return-1;n++}else if(t===`)`)n>0&&n--;else if(t===`[`)r++;else if(t===`]`)r>0&&r--;else if((t===`:`||t===`;`)&&n===0&&r===0)i=!0;else if(t===`}`&&n===0&&r===0)return a}return-1}function He(e,t){let n=t;if(e[n]===`!`&&n++,e[n]!==`@`)return{suffix:e.slice(t,n),end:n};let r=0,i=0;for(;n<e.length;n++){let t=e[n];if(t===`(`)r++;else if(t===`)`)r>0&&r--;else if(t===`[`)i++;else if(t===`]`)i>0&&i--;else if((/\s/.test(t)||t===`"`||t===`'`||t==="`"||t===`{`||t===`}`)&&r===0&&i===0)break}return{suffix:e.slice(t,n),end:n}}function Ue(e){let t=[],n=0,r=0,i=0;for(let a=0;a<e.length;a++){let o=e[a];o===`(`?n++:o===`)`?n>0&&n--:o===`[`?r++:o===`]`?r>0&&r--:o===`;`&&n===0&&r===0&&(t.push(e.slice(i,a).trim()),i=a+1)}return t.push(e.slice(i).trim()),t.filter(Boolean)}function We(e,t,n){let r=Ve(e,t);if(r<0)return null;let i=Ue(e.slice(t+1,r));if(!i.length)return null;let{suffix:a,end:o}=He(e,r+1);return i.every(e=>n.has(e)||n.has(`${e}${a}`))?[t,o,e.slice(t,o)]:null}function Ge(e,t,n=[],r={}){let i=[],a=[],o=new Set,s=new Set,c=[];if(r.excludeRanges&&(e=Pe(e,r.excludeRanges)),r.excludeRegex)for(let t of r.excludeRegex){let n=Array.from(Ne(t,e),e=>[e.index,e.index+e[0].length]);e=Pe(e,n)}if(r.includeRegex)for(let t of r.includeRegex)for(let n of Ne(t,e))c.push([n.index,n.index+n[0].length]);else c.push([0,e.length]);let l=Fe(c);Array.from(t).forEach(e=>{let t=_e(e);t?t[2]?a.push(t):(/[><()]|\[\\?['"`]/.test(t[1])&&s.add(t[1]),o.add(t[1])):(/[><()]|\[\\?['"`]/.test(e)&&s.add(e),o.add(e))}),i.push(...Re(e,s));let u=0;e.split(Oe).forEach(e=>{let t=u+e.length;r.isPug?i.push(...Me(e,o,u)):o.has(e)&&i.push([u,t,e]),u=t});for(let t of e.matchAll(ke)){let e=t.index,n=e+t[0].length;o.has(t[0])&&i.push([e,n,t[0]])}let d=new Set(i.map(([e,t])=>`${e}:${t}`));for(let t of e.matchAll(Ae)){let e=t.index,n=e+t[0].length;if(o.has(t[0])){let r=`${e}:${n}`;d.has(r)||(d.add(r),i.push([e,n,t[0]]))}}a.forEach(([,t,n])=>{for(let r of Be(e,t,n)){let e=r+n.length;i.push([r,e,`[${t}="${n}"]`])}});for(let t=e.indexOf(`{`);t>=0;t=e.indexOf(`{`,t+1)){let n=We(e,t,o);if(!n)continue;let[r,a]=n;for(let e=i.length-1;e>=0;e--){let[t,n]=i[e];t>=r&&n<=a&&i.splice(e,1)}i.some(([e,t])=>e===r&&t===a)||i.push(n)}i.push(...n.map(e=>[e.offset,e.offset+e.length,e.className]));let f=new Set;return i.filter(([e,t])=>Ie(l,e,t)).filter(([e,t,n])=>{let r=`${e}:${t}:${n}`;return f.has(r)?!1:(f.add(r),!0)}).sort((e,t)=>e[0]-t[0])}const Ke=[`@teacss/directives`,`@teacss/transformer-compile-class`];async function qe(e,t,n=``,r={}){let i=new s(t),a={generator:e,tokens:new Set},o=e.config.transformers?.filter(e=>!Ke.includes(e.name)),c=[];for(let e of[`pre`,`default`,`post`])for(let t of o?.filter(t=>(t.enforce??`default`)===e)||[]){let e=(await t.transform(i,n,a))?.highlightAnnotations;e&&c.push(...e)}let{pug:l,code:u}=await je(e,i.toString(),n);return Ge(t,[...(await e.generate(l?u:i.toString(),{preflights:!1,safelist:!1})).matched],c,{isPug:l,...r})}function P(e,t,n,r){if(!(r<1)){if(e.delete(t),e.size>=r){let t=e.keys().next();t.done||e.delete(t.value)}e.set(t,n)}}function Je(e,t,n,r){let i=e.get(t);if(i)return P(e,t,i,n),i;let a;return a=r().catch(n=>{throw e.get(t)===a&&e.delete(t),n}),P(e,t,a,n),a}const Ye=new Map;function Xe(e){Ye.delete(e)}function Ze(){Ye.clear()}function Qe(e,t,n,r=!1,i=!1){i&&Ye.delete(n);let a=Ye.get(n);if(a&&a.code===t&&a.config===e.config&&a.generator===e&&a.strictAnnotationMatch===r)return P(Ye,n,a,100),a.result;let o=qe(e,t,n,{excludeRanges:Te(t,n),excludeRegex:De,...r?{includeRegex:Ee}:null});return P(Ye,n,{code:t,config:e.config,generator:e,strictAnnotationMatch:r,result:o},100),o}
1
+ import{a as e,i as t,n,r,t as i}from"./semanticTokens-D6dlGQyV.js";import{createRequire as a}from"node:module";import o from"node:process";import s from"magic-string";import c,{existsSync as l}from"node:fs";import u from"node:path";import{diagnoseCustom as d,entryDiscoveryFiles as f,findEntry as p,scaleThemeKeys as m,scanCustomBlocks as h}from"@teacss/config";import{createContext as g}from"@teacss/runtime";import{fileURLToPath as _,pathToFileURL as v}from"node:url";import{channel as y,tracingChannel as b}from"node:diagnostics_channel";import{TextDocument as x}from"vscode-languageserver-textdocument";import{CompletionItemKind as S,DiagnosticSeverity as ee}from"vscode-languageserver-types";import{colordx as C,extend as w}from"@colordx/core";import T from"@colordx/core/plugins/cmyk";import te from"@colordx/core/plugins/hwb";import ne from"@colordx/core/plugins/lab";import re from"@colordx/core/plugins/lch";import E from"@colordx/core/plugins/names";import D from"@colordx/core/plugins/p3";import{DidChangeWatchedFilesNotification as O,ProposedFeatures as k,TextDocumentSyncKind as ie,TextDocuments as ae,WatchKind as oe,createConnection as A}from"vscode-languageserver/node";var se=a(import.meta.url);function j(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 ce(e){return Array.from(new Set(j(e)))}function le(e,t,n){Object.defineProperty(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0})}function ue(e,t){let n=e.length;n in e?le(e,n,t):e[n]=t}function de(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),ue(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;ue(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}}const M=`utilities`;Object.freeze({imports:-200,properties:-150,preflights:-100,shortcuts:-50,primitives:-10,[M]:0});function fe(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}const pe=/\.(css|postcss|sass|scss|less|stylus|styl)($|\?)/;function me(e){return pe.test(e)}function he(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 ge(){return{events:Object.create(null),emit(e,...t){let n=Object.hasOwn(this.events,e)?this.events[e]:void 0,r=j(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)||he(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;he(n,e,j(Array.isArray(r)?r:[]).filter(e=>e!==t))}}}}const _e=/^\[(.+?)~?="(.*)"\]$/,ve=/[\w\u00A0-\uFFFF%-?]/;new RegExp(_e.source,_e.flags),new RegExp(ve.source,ve.flags);function ye(e){return e.match(_e)}function be(e){return e!=null}const xe=`@teacss-skip-start`,Se=`@teacss-skip-end`;RegExp(`(//\\s*?${xe}\\s*?|\\/\\*\\s*?${xe}\\s*?\\*\\/|<!--\\s*?${xe}\\s*?-->)[\\s\\S]*?(//\\s*?${Se}\\s*?|\\/\\*\\s*?${Se}\\s*?\\*\\/|<!--\\s*?${Se}\\s*?-->)`,`g`);const Ce=RegExp(`(//\\s*?${xe}\\s*?|\\/\\*\\s*?${xe}\\s*?\\*\\/|<!--\\s*?${xe}\\s*?-->)[\\s\\S]*?(//\\s*?${Se}\\s*?|\\/\\*\\s*?${Se}\\s*?\\*\\/|<!--\\s*?${Se}\\s*?-->)`,`g`);function we(e){return e===`
2
+ `||e===`\r`||e===`\u2028`||e===`\u2029`}function Te(e,t,n){for(let r=t+1;r<e.length;r++){let t=e[r];if(t===`\\`){r++;continue}if(t===n)return r+1;if(n!=="`"&&we(t))return r}return e.length}const Ee=/\.(?:[cm]?[jt]sx?|vue|svelte|astro|marko|php|phtml|scss|sass|less|styl(?:us)?)(?:$|\?)/i,De=/\.(?:html?|vue|svelte|astro|marko|mdx?|php|phtml)(?:$|\?)/i;function Oe(e,t){let n=[],r=t===void 0||Ee.test(t),i=t===void 0||De.test(t);for(let t=0;t<e.length;){let a=e[t];if(a===`"`||a===`'`||a==="`"){t=Te(e,t,a);continue}if(e.startsWith(`{/*`,t)){let r=e.indexOf(`*/}`,t+3);n.push([t,r<0?e.length:r+3]),t=n[n.length-1][1];continue}if(i&&e.startsWith(`<!--`,t)){let r=e.indexOf(`-->`,t+4);n.push([t,r<0?e.length:r+3]),t=n[n.length-1][1];continue}if(e.startsWith(`/*`,t)){let r=e.indexOf(`*/`,t+2);n.push([t,r<0?e.length:r+2]),t=n[n.length-1][1];continue}if(r&&e.startsWith(`//`,t)){let r=e.slice(t+2).search(/[\n\r]/),i=r<0?e.length:t+2+r;n.push([t,i]),t=n[n.length-1][1];continue}t++}return n}const ke=[/"(?:\\[\s\S]|[^"\\])*"|'(?:\\[\s\S]|[^'\\])*'|`(?:\\[\s\S]|[^`\\])*`/g,/<[^/?<>0-9$_!"'](?:"[^"]*"|'[^']*'|[^>])+>/g,/(@apply|--at-apply)[^;]*;/g],Ae=[Ce],je=/([\\:]?[\s"'`;<>]|:\(|\)"|\)\s)/g,Me=/(?:[\w&:[\]-]|\[\S{1,64}=\S{1,64}\]){1,64}\[\\?['"]?\S{0,64}?['"]\]\]?[\w:@-]{0,64}/g,Ne=/\[(\\\W|[\w-]){1,64}:[^\s:]{0,64}?("\S{1,64}?"|'\S{1,64}?'|`\S{1,64}?`|[^\s:]{1,64}?)[^\s:]{0,64}?\)?\]/g;async function Pe(e,t,n=``){let r=e.config.extractors?.find(e=>e.name===`pug`);if(!r)return{pug:!1,code:``};let i={code:t,id:n};await r.extract?.(i);let a=i.code.startsWith(t)?i.code.substring(t.length+2):i.code;return i.code===t?{pug:!1,code:``}:{pug:!0,code:a}}function Fe(e,t,n){let r=[];t.has(e)&&r.push([n,n+e.length,e]);let i=new Set;for(let a of e.matchAll(/\.([^.#=\s(]+)(?=[.#=\s(]|$)/g)){let e=a[1];if(e.includes(`:`)||i.has(e)||!t.has(e))continue;i.add(e);let o=n+a.index+1;r.push([o,o+e.length,e])}return r}function Ie(e,t){let n=e.flags.includes(`g`)?e.flags:`${e.flags}g`;return t.matchAll(new RegExp(e.source,n))}function Le(e,t){let n=t.map(([t,n])=>[Math.max(0,t),Math.min(e.length,n)]).filter(([e,t])=>t>e).sort((e,t)=>e[0]-t[0]||e[1]-t[1]);if(!n.length)return e;let r=[];for(let[e,t]of n){let n=r.at(-1);n&&e<=n[1]?n[1]=Math.max(n[1],t):r.push([e,t])}let i=[],a=0;for(let[t,n]of r)i.push(e.slice(a,t),` `.repeat(n-t)),a=n;return i.push(e.slice(a)),i.join(``)}function Re(e){let t=[...e].sort((e,t)=>e[0]-t[0]||t[1]-e[1]),n=[],r=[],i=-1;for(let[e,a]of t)n.push(e),i=Math.max(i,a),r.push(i);return{starts:n,maxEnds:r}}function ze(e,t,n){let r=0,i=e.starts.length;for(;r<i;){let n=r+i>>>1;e.starts[n]<=t?r=n+1:i=n}return r>0&&e.maxEnds[r-1]>=n}function Be(e){return e===void 0||/[\s'"`;<>]/.test(e)}function Ve(e,t){if(!t.size)return[];let n={children:new Map};for(let e of t){let t=n;for(let n=0;n<e.length;n++){let r=e[n],i=t.children.get(r);i||(i={children:new Map},t.children.set(r,i)),t=i}t.value=e}let r=[];for(let t=0;t<e.length;t++){if(!Be(e[t-1]))continue;let i=n;for(let n=t;n<e.length;n++){let a=i.children.get(e[n]);if(!a)break;i=a,i.value&&Be(e[n+1])&&r.push([t,n+1,i.value])}}return r}function He(e,t,n){for(let r=t+1;r<e.length;r++)if(e[r]===`\\`)r++;else if(e[r]===n)return r;return-1}function Ue(e,t,n){if(!n)return[];let r=[],i=RegExp(`(^|[^\\w:-])${fe(t)}\\s*=\\s*(['"])`,`g`);for(let t of e.matchAll(i)){let i=t.index+t[0].length-1,a=He(e,i,t[2]);if(!(a<0))for(let t=e.indexOf(n,i+1);t>=0&&t+n.length<=a;t=e.indexOf(n,t+n.length)){let o=t===i+1||/\s/.test(e[t-1]),s=t+n.length===a||/\s/.test(e[t+n.length]);o&&s&&r.push(t)}}return r}function We(e,t){let n=0,r=0,i=!1;for(let a=t+1;a<e.length;a++){let t=e[a];if(t===`(`){if(n===0&&r===0&&!i)return-1;n++}else if(t===`)`)n>0&&n--;else if(t===`[`)r++;else if(t===`]`)r>0&&r--;else if((t===`:`||t===`;`)&&n===0&&r===0)i=!0;else if(t===`}`&&n===0&&r===0)return a}return-1}function Ge(e,t){let n=t;if(e[n]===`!`&&n++,e[n]!==`@`)return{suffix:e.slice(t,n),end:n};let r=0,i=0;for(;n<e.length;n++){let t=e[n];if(t===`(`)r++;else if(t===`)`)r>0&&r--;else if(t===`[`)i++;else if(t===`]`)i>0&&i--;else if((/\s/.test(t)||t===`"`||t===`'`||t==="`"||t===`{`||t===`}`)&&r===0&&i===0)break}return{suffix:e.slice(t,n),end:n}}function Ke(e){let t=[],n=0,r=0,i=0;for(let a=0;a<e.length;a++){let o=e[a];o===`(`?n++:o===`)`?n>0&&n--:o===`[`?r++:o===`]`?r>0&&r--:o===`;`&&n===0&&r===0&&(t.push(e.slice(i,a).trim()),i=a+1)}return t.push(e.slice(i).trim()),t.filter(Boolean)}function qe(e,t,n){let r=We(e,t);if(r<0)return null;let i=Ke(e.slice(t+1,r));if(!i.length)return null;let{suffix:a,end:o}=Ge(e,r+1);return i.every(e=>n.has(e)||n.has(`${e}${a}`))?[t,o,e.slice(t,o)]:null}function Je(e,t,n=[],r={}){let i=[],a=[],o=new Set,s=new Set,c=[];if(r.excludeRanges&&(e=Le(e,r.excludeRanges)),r.excludeRegex)for(let t of r.excludeRegex){let n=Array.from(Ie(t,e),e=>[e.index,e.index+e[0].length]);e=Le(e,n)}if(r.includeRegex)for(let t of r.includeRegex)for(let n of Ie(t,e))c.push([n.index,n.index+n[0].length]);else c.push([0,e.length]);let l=Re(c);Array.from(t).forEach(e=>{let t=ye(e);t?t[2]?a.push(t):(/[><()]|\[\\?['"`]/.test(t[1])&&s.add(t[1]),o.add(t[1])):(/[><()]|\[\\?['"`]/.test(e)&&s.add(e),o.add(e))}),i.push(...Ve(e,s));let u=0;e.split(je).forEach(e=>{let t=u+e.length;r.isPug?i.push(...Fe(e,o,u)):o.has(e)&&i.push([u,t,e]),u=t});for(let t of e.matchAll(Me)){let e=t.index,n=e+t[0].length;o.has(t[0])&&i.push([e,n,t[0]])}let d=new Set(i.map(([e,t])=>`${e}:${t}`));for(let t of e.matchAll(Ne)){let e=t.index,n=e+t[0].length;if(o.has(t[0])){let r=`${e}:${n}`;d.has(r)||(d.add(r),i.push([e,n,t[0]]))}}a.forEach(([,t,n])=>{for(let r of Ue(e,t,n)){let e=r+n.length;i.push([r,e,`[${t}="${n}"]`])}});for(let t=e.indexOf(`{`);t>=0;t=e.indexOf(`{`,t+1)){let n=qe(e,t,o);if(!n)continue;let[r,a]=n;for(let e=i.length-1;e>=0;e--){let[t,n]=i[e];t>=r&&n<=a&&i.splice(e,1)}i.some(([e,t])=>e===r&&t===a)||i.push(n)}i.push(...n.map(e=>[e.offset,e.offset+e.length,e.className]));let f=new Set;return i.filter(([e,t])=>ze(l,e,t)).filter(([e,t,n])=>{let r=`${e}:${t}:${n}`;return f.has(r)?!1:(f.add(r),!0)}).sort((e,t)=>e[0]-t[0])}const Ye=[`@teacss/directives`,`@teacss/transformer-compile-class`];async function Xe(e,t,n=``,r={}){let i=new s(t),a={generator:e,tokens:new Set},o=e.config.transformers?.filter(e=>!Ye.includes(e.name)),c=[];for(let e of[`pre`,`default`,`post`])for(let t of o?.filter(t=>(t.enforce??`default`)===e)||[]){let e=(await t.transform(i,n,a))?.highlightAnnotations;e&&c.push(...e)}let{pug:l,code:u}=await Pe(e,i.toString(),n);return Je(t,[...(await e.generate(l?u:i.toString(),{preflights:!1,safelist:!1})).matched],c,{isPug:l,...r})}function N(e,t,n,r){if(!(r<1)){if(e.delete(t),e.size>=r){let t=e.keys().next();t.done||e.delete(t.value)}e.set(t,n)}}function Ze(e,t,n,r){let i=e.get(t);if(i)return N(e,t,i,n),i;let a;return a=r().catch(n=>{throw e.get(t)===a&&e.delete(t),n}),N(e,t,a,n),a}const Qe=new Map;function $e(e){Qe.delete(e)}function et(){Qe.clear()}function tt(e,t,n,r=!1,i=!1){i&&Qe.delete(n);let a=Qe.get(n);if(a&&a.code===t&&a.config===e.config&&a.generator===e&&a.strictAnnotationMatch===r)return N(Qe,n,a,100),a.result;let o=Xe(e,t,n,{excludeRanges:Oe(t,n),excludeRegex:Ae,...r?{includeRegex:ke}:null});return N(Qe,n,{code:t,config:e.config,generator:e,strictAnnotationMatch:r,result:o},100),o}
2
3
  /** @license
3
4
  * fzf v0.5.2
4
5
  * Copyright (c) 2021 Ajit
5
6
  * Licensed under BSD 3-Clause
6
7
  */
7
- const $e={216:`O`,223:`s`,248:`o`,273:`d`,295:`h`,305:`i`,320:`l`,322:`l`,359:`t`,383:`s`,384:`b`,385:`B`,387:`b`,390:`O`,392:`c`,393:`D`,394:`D`,396:`d`,398:`E`,400:`E`,402:`f`,403:`G`,407:`I`,409:`k`,410:`l`,412:`M`,413:`N`,414:`n`,415:`O`,421:`p`,427:`t`,429:`t`,430:`T`,434:`V`,436:`y`,438:`z`,477:`e`,485:`g`,544:`N`,545:`d`,549:`z`,564:`l`,565:`n`,566:`t`,567:`j`,570:`A`,571:`C`,572:`c`,573:`L`,574:`T`,575:`s`,576:`z`,579:`B`,580:`U`,581:`V`,582:`E`,583:`e`,584:`J`,585:`j`,586:`Q`,587:`q`,588:`R`,589:`r`,590:`Y`,591:`y`,592:`a`,593:`a`,595:`b`,596:`o`,597:`c`,598:`d`,599:`d`,600:`e`,603:`e`,604:`e`,605:`e`,606:`e`,607:`j`,608:`g`,609:`g`,610:`G`,613:`h`,614:`h`,616:`i`,618:`I`,619:`l`,620:`l`,621:`l`,623:`m`,624:`m`,625:`m`,626:`n`,627:`n`,628:`N`,629:`o`,633:`r`,634:`r`,635:`r`,636:`r`,637:`r`,638:`r`,639:`r`,640:`R`,641:`R`,642:`s`,647:`t`,648:`t`,649:`u`,651:`v`,652:`v`,653:`w`,654:`y`,655:`Y`,656:`z`,657:`z`,663:`c`,665:`B`,666:`e`,667:`G`,668:`H`,669:`j`,670:`k`,671:`L`,672:`q`,686:`h`,867:`a`,868:`e`,869:`i`,870:`o`,871:`u`,872:`c`,873:`d`,874:`h`,875:`m`,876:`r`,877:`t`,878:`v`,879:`x`,7424:`A`,7427:`B`,7428:`C`,7429:`D`,7431:`E`,7432:`e`,7433:`i`,7434:`J`,7435:`K`,7436:`L`,7437:`M`,7438:`N`,7439:`O`,7440:`O`,7441:`o`,7442:`o`,7443:`o`,7446:`o`,7447:`o`,7448:`P`,7449:`R`,7450:`R`,7451:`T`,7452:`U`,7453:`u`,7454:`u`,7455:`m`,7456:`V`,7457:`W`,7458:`Z`,7522:`i`,7523:`r`,7524:`u`,7525:`v`,7834:`a`,7835:`s`,8305:`i`,8341:`h`,8342:`k`,8343:`l`,8344:`m`,8345:`n`,8346:`p`,8347:`s`,8348:`t`,8580:`c`};for(let e=`̀`.codePointAt(0);e<=`ͯ`.codePointAt(0);++e){let t=String.fromCodePoint(e);for(let e of`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz`){let n=(e+t).normalize().codePointAt(0);n>126&&($e[n]=e)}}const et={a:[7844,7863],e:[7870,7879],o:[7888,7907],u:[7912,7921]};for(let e of Object.keys(et)){let t=e.toUpperCase();for(let n=et[e][0];n<=et[e][1];++n)$e[n]=n%2==0?t:e}function tt(e){if(e<192||e>8580)return e;let t=$e[e];return t===void 0?e:t.codePointAt(0)}function nt(e){return e}function rt(e){return e}function it(e,t){return e>t?e:t}const at=e=>e.split(``).map(e=>e.codePointAt(0)),ot=new Set(` \f
8
- \r \v\xA0 \u2028\u2029   `.split(``).map(e=>e.codePointAt(0)));for(let e=` `.codePointAt(0);e<=` `.codePointAt(0);e++)ot.add(e);const st=``.codePointAt(0),ct=`A`.codePointAt(0),lt=`Z`.codePointAt(0),ut=`a`.codePointAt(0),dt=`z`.codePointAt(0),ft=`0`.codePointAt(0),pt=`9`.codePointAt(0);function mt(e,t,n){return n?e:t-e-1}function ht(e){return e?new Set:null}function gt(e,t,n){if(t!==null&&t.i16.length>e+n){let r=t.i16.subarray(e,e+n);return[e+n,r]}return[e,new Int16Array(n)]}function _t(e,t,n){if(t!==null&&t.i32.length>e+n){let r=t.i32.subarray(e,e+n);return[e+n,r]}return[e,new Int32Array(n)]}function vt(e){return e>=ut&&e<=dt?1:e>=ct&&e<=lt?2:e>=ft&&e<=pt?4:0}function yt(e){let t=String.fromCodePoint(e);return t===t.toUpperCase()?t===t.toLowerCase()?t.match(/\p{Number}/gu)===null?t.match(/\p{Letter}/gu)===null?0:3:4:2:1}function bt(e){return e<=st?vt(e):yt(e)}function xt(e,t){return e===0&&t!==0?8:e===1&&t===2||e!==4&&t===4?7:t===0?8:0}function St(e,t){return t===0?8:xt(bt(e[t-1]),bt(e[t]))}function Ct(e,t,n,r){let i=e.slice(r),a=i.indexOf(n);if(a===0)return r;if(!t&&n>=ut&&n<=dt){a>0&&(i=i.slice(0,a));let e=i.indexOf(n-32);e>=0&&(a=e)}return a<0?-1:r+a}function wt(e){for(let t of e)if(t>=128)return!1;return!0}function Tt(e,t,n){if(!wt(e))return 0;if(!wt(t))return-1;let r=0,i=0;for(let a=0;a<t.length;a++){if(i=Ct(e,n,t[a],i),i<0)return-1;a===0&&i>0&&(r=i-1),i++}return r}const Et=(e,t,n,r,i,a,o)=>{let s=i.length;if(s===0)return[{start:0,end:0,score:0},ht(a)];let c=r.length;if(o!==null&&c*s>o.i16.length)return Ot(e,t,n,r,i,a);let l=Tt(r,i,e);if(l<0)return[{start:-1,end:-1,score:0},null];let u=0,d=0,f=null,p=null,m=null,h=null;[u,f]=gt(u,o,c),[u,p]=gt(u,o,c),[u,m]=gt(u,o,c),[d,h]=_t(d,o,s);let[,g]=_t(d,o,c);for(let e=0;e<g.length;e++)g[e]=r[e];let _=nt(0),v=0,y=0,b=0,x=i[0],S=i[0],C=nt(0),w=0,T=!1,E=g.subarray(l),ee=f.subarray(l).subarray(0,E.length),te=p.subarray(l).subarray(0,E.length),ne=m.subarray(l).subarray(0,E.length);for(let[r,a]of E.entries()){let o=null;a<=st?(o=vt(a),!e&&o===2&&(a+=32)):(o=yt(a),!e&&o===2&&(a=String.fromCodePoint(a).toLowerCase().codePointAt(0)),t&&(a=tt(a))),E[r]=a;let c=xt(w,o);if(ne[r]=c,w=o,a===S&&(y<s&&(h[y]=rt(l+r),y++,S=i[Math.min(y,s-1)]),b=l+r),a===x){let e=16+c*2;if(ee[r]=e,te[r]=1,s===1&&(n&&e>_||!n&&e>=_)&&(_=e,v=l+r,n&&c===8))break;T=!1}else T?ee[r]=it(C+-1,0):ee[r]=it(C+-3,0),te[r]=0,T=!0;C=ee[r]}if(y!==s)return[{start:-1,end:-1,score:0},null];if(s===1){let e={start:v,end:v+1,score:_};if(!a)return[e,null];let t=new Set;return t.add(v),[e,t]}let D=h[0],O=b-D+1,k=null;[u,k]=gt(u,o,O*s);{let e=f.subarray(D,b+1);for(let[t,n]of e.entries())k[t]=n}let[,A]=gt(u,o,O*s);{let e=p.subarray(D,b+1);for(let[t,n]of e.entries())A[t]=n}let re=h.subarray(1),ie=i.slice(1).slice(0,re.length);for(let[e,t]of re.entries()){let r=!1,i=ie[e],a=e+1,o=a*O,c=g.subarray(t,b+1),l=m.subarray(t).subarray(0,c.length),u=A.subarray(o+t-D).subarray(0,c.length),d=A.subarray(o+t-D-1-O).subarray(0,c.length),f=k.subarray(o+t-D).subarray(0,c.length),p=k.subarray(o+t-D-1-O).subarray(0,c.length),h=k.subarray(o+t-D-1).subarray(0,c.length);h[0]=0;for(let[e,o]of c.entries()){let c=e+t,g=0,y=0,b=0;if(y=r?h[e]+-1:h[e]+-3,i===o){g=p[e]+16;let t=l[e];b=d[e]+1,t===8?b=1:b>1&&(t=it(t,it(4,m[c-b+1]))),g+t<y?(g+=l[e],b=0):g+=t}u[e]=b,r=g<y;let x=it(it(g,y),0);a===s-1&&(n&&x>_||!n&&x>=_)&&(_=x,v=c),f[e]=x}}let ae=ht(a),j=D;if(a&&ae!==null){let e=s-1;j=v;let t=!0;for(;;){let n=e*O,r=j-D,i=k[n+r],a=0,o=0;if(e>0&&j>=h[e]&&(a=k[n-O+r-1]),j>h[e]&&(o=k[n+r-1]),i>a&&(i>o||i===o&&t)){if(ae.add(j),e===0)break;e--}t=A[n+r]>1||n+O+r+1<A.length&&A[n+O+r+1]>0,j--}}return[{start:j,end:v+1,score:_},ae]};function Dt(e,t,n,r,i,a,o){let s=0,c=0,l=!1,u=0,d=nt(0),f=ht(o),p=0;i>0&&(p=bt(n[i-1]));for(let m=i;m<a;m++){let i=n[m],a=bt(i);if(e||(i>=ct&&i<=lt?i+=32:i>st&&(i=String.fromCodePoint(i).toLowerCase().codePointAt(0))),t&&(i=tt(i)),i===r[s]){o&&f!==null&&f.add(m),c+=16;let e=xt(p,a);u===0?d=e:(e===8&&(d=e),e=it(it(e,d),4)),s===0?c+=e*2:c+=e,l=!1,u++,s++}else l?c+=-1:c+=-3,l=!0,u=0,d=0;p=a}return[c,f]}const Ot=(e,t,n,r,i,a,o)=>{if(i.length===0)return[{start:0,end:0,score:0},null];if(Tt(r,i,e)<0)return[{start:-1,end:-1,score:0},null];let s=0,c=-1,l=-1,u=r.length,d=i.length;for(let a=0;a<u;a++){let o=r[mt(a,u,n)];e||(o>=ct&&o<=lt?o+=32:o>st&&(o=String.fromCodePoint(o).toLowerCase().codePointAt(0))),t&&(o=tt(o));let f=i[mt(s,d,n)];if(o===f&&(c<0&&(c=a),s++,s===d)){l=a+1;break}}if(c>=0&&l>=0){s--;for(let t=l-1;t>=c;t--){let a=r[mt(t,u,n)];e||(a>=ct&&a<=lt?a+=32:a>st&&(a=String.fromCodePoint(a).toLowerCase().codePointAt(0)));let o=i[mt(s,d,n)];if(a===o&&(s--,s<0)){c=t;break}}if(!n){let e=c;c=u-l,l=u-e}let[o,f]=Dt(e,t,r,i,c,l,a);return[{start:c,end:l,score:o},f]}return[{start:-1,end:-1,score:0},null]},kt=(e,t,n,r,i,a,o)=>{if(i.length===0)return[{start:0,end:0,score:0},null];let s=r.length,c=i.length;if(s<c||Tt(r,i,e)<0)return[{start:-1,end:-1,score:0},null];let l=0,u=-1,d=nt(0),f=nt(-1);for(let a=0;a<s;a++){let o=mt(a,s,n),p=r[o];e||(p>=ct&&p<=lt?p+=32:p>st&&(p=String.fromCodePoint(p).toLowerCase().codePointAt(0))),t&&(p=tt(p));let m=mt(l,c,n);if(i[m]===p){if(m===0&&(d=St(r,o)),l++,l===c){if(d>f&&(u=a,f=d),d===8)break;a-=l-1,l=0,d=0}}else a-=l,l=0,d=0}if(u>=0){let a=0,o=0;n?(a=u-c+1,o=u+1):(a=s-(u+1),o=s-(u-c+1));let[l]=Dt(e,t,r,i,a,o,!1);return[{start:a,end:o,score:l},null]}return[{start:-1,end:-1,score:0},null]};function At(e,t){return{i16:new Int16Array(e),i32:new Int32Array(t)}}const jt=At(102400,2048),Mt=(e,t,n)=>{let r=!1;switch(t){case`smart-case`:e.toLowerCase()!==e&&(r=!0);break;case`case-sensitive`:r=!0;break;case`case-insensitive`:e=e.toLowerCase(),r=!1;break}let i=at(e);return n&&(i=i.map(tt)),{queryRunes:i,caseSensitive:r}};function Nt(e,t){let n=Object.keys(e).map(e=>parseInt(e,10)).sort((e,t)=>t-e),r=[];for(let i of n)if(r=r.concat(e[i]),r.length>=t)break;return r}function Pt(e,t,n){return r=>{let i=this.runesList[r];if(t.length>i.length)return;let[a,o]=this.algoFn(n,this.opts.normalize,this.opts.forward,i,t,!0,jt);if(a.start===-1)return;if(this.opts.fuzzy===!1){o=new Set;for(let e=a.start;e<a.end;++e)o.add(e)}let s=this.opts.sort?a.score:0;e[s]===void 0&&(e[s]=[]),e[s].push({item:this.items[r],...a,positions:o??new Set})}}function Ft(e){let{queryRunes:t,caseSensitive:n}=Mt(e,this.opts.casing,this.opts.normalize),r={},i=Pt.bind(this)(r,t,n);for(let e=0,t=this.runesList.length;e<t;++e)i(e);return Nt(r,this.opts.limit)}const It={limit:1/0,selector:e=>e,casing:`smart-case`,normalize:!0,fuzzy:`v2`,tiebreakers:[],sort:!0,forward:!0};var Lt=class{constructor(e,...t){switch(this.opts={...It,...t[0]},this.items=e,this.runesList=e.map(e=>at(this.opts.selector(e).normalize())),this.algoFn=kt,this.opts.fuzzy){case`v2`:this.algoFn=Et;break;case`v1`:this.algoFn=Ot;break}}};const Rt={...It,match:Ft};var zt=class extends Lt{constructor(e,...t){super(e,...t),this.opts={...Rt,...t[0]}}find(e){return e.length===0||this.items.length===0?this.items.slice(0,this.opts.limit).map(Bt):(e=e.normalize(),Vt(this.opts.match.bind(this)(e),this.opts))}};({...It});const Bt=e=>({item:e,start:-1,end:-1,score:0,positions:new Set});function Vt(e,t){if(t.sort){let{selector:n}=t;e.sort((e,r)=>{if(e.score===r.score)for(let i of t.tiebreakers){let t=i(e,r,n);if(t!==0)return t}return 0})}return Number.isFinite(t.limit)&&e.splice(t.limit),e}function Ht(e,t,n){return n(e.item).length-n(t.item).length}function Ut(e,t){return e.start-t.start}var Wt=class{constructor(e,...t){this.finder=new zt(e,...t),this.find=this.finder.find.bind(this.finder)}},F=v(`lru-cache:metrics`),Gt=y(`lru-cache`),Kt=typeof performance==`object`&&performance&&typeof performance.now==`function`?performance:Date,qt=()=>F.hasSubscribers||Gt.hasSubscribers,Jt=new Set,Yt=typeof process==`object`&&process?process:{},Xt=(e,t,n,r)=>{typeof Yt.emitWarning==`function`?Yt.emitWarning(e,t,n,r):console.error(`[${n}] ${t}: ${e}`)},Zt=e=>!Jt.has(e),I=e=>!!e&&e===Math.floor(e)&&e>0&&isFinite(e),Qt=e=>I(e)?e<=2**8?Uint8Array:e<=2**16?Uint16Array:e<=2**32?Uint32Array:e<=2**53-1?$t:null:null,$t=class extends Array{constructor(e){super(e),this.fill(0)}},en=class e{heap;length;static#e=!1;static create(t){let n=Qt(t);if(!n)return[];e.#e=!0;let r=new e(t,n);return e.#e=!1,r}constructor(t,n){if(!e.#e)throw TypeError(`instantiate Stack using Stack.create(n)`);this.heap=new n(t),this.length=0}push(e){this.heap[this.length++]=e}pop(){return this.heap[--this.length]}},tn=class e{#e;#t;#n;#r;#i;#a;#o;#s;get perf(){return this.#s}ttl;ttlResolution;ttlAutopurge;updateAgeOnGet;updateAgeOnHas;allowStale;noDisposeOnSet;noUpdateTTL;maxEntrySize;sizeCalculation;noDeleteOnFetchRejection;noDeleteOnStaleGet;allowStaleOnFetchAbort;allowStaleOnFetchRejection;ignoreFetchAbort;backgroundFetchSize;#c;#l;#u;#d;#f;#p;#m;#h;#g;#_;#v;#y;#b;#x;#S;#C;#w;#T;#E;static unsafeExposeInternals(e){return{starts:e.#b,ttls:e.#x,autopurgeTimers:e.#S,sizes:e.#y,keyMap:e.#u,keyList:e.#d,valList:e.#f,next:e.#p,prev:e.#m,get head(){return e.#h},get tail(){return e.#g},free:e.#_,isBackgroundFetch:t=>e.#W(t),backgroundFetch:(t,n,r,i)=>e.#U(t,n,r,i),moveToTail:t=>e.#X(t),indexes:t=>e.#I(t),rindexes:t=>e.#L(t),isStale:t=>e.#j(t)}}get max(){return this.#e}get maxSize(){return this.#t}get calculatedSize(){return this.#l}get size(){return this.#c}get fetchMethod(){return this.#a}get memoMethod(){return this.#o}get dispose(){return this.#n}get onInsert(){return this.#r}get disposeAfter(){return this.#i}constructor(t){let{max:n=0,ttl:r,ttlResolution:i=1,ttlAutopurge:a,updateAgeOnGet:o,updateAgeOnHas:s,allowStale:c,dispose:l,onInsert:u,disposeAfter:d,noDisposeOnSet:f,noUpdateTTL:p,maxSize:m=0,maxEntrySize:h=0,sizeCalculation:g,fetchMethod:_,memoMethod:v,noDeleteOnFetchRejection:y,noDeleteOnStaleGet:b,allowStaleOnFetchRejection:x,allowStaleOnFetchAbort:S,ignoreFetchAbort:C,backgroundFetchSize:w=1,perf:T}=t;if(this.backgroundFetchSize=w,T!==void 0&&typeof T?.now!=`function`)throw TypeError(`perf option must have a now() method if specified`);if(this.#s=T??Kt,n!==0&&!I(n))throw TypeError(`max option must be a nonnegative integer`);let E=n?Qt(n):Array;if(!E)throw Error(`invalid max value: `+n);if(this.#e=n,this.#t=m,this.maxEntrySize=h||this.#t,this.sizeCalculation=g,this.sizeCalculation){if(!this.#t&&!this.maxEntrySize)throw TypeError(`cannot set sizeCalculation without setting maxSize or maxEntrySize`);if(typeof this.sizeCalculation!=`function`)throw TypeError(`sizeCalculation set to non-function`)}if(v!==void 0&&typeof v!=`function`)throw TypeError(`memoMethod must be a function if defined`);if(this.#o=v,_!==void 0&&typeof _!=`function`)throw TypeError(`fetchMethod must be a function if specified`);if(this.#a=_,this.#w=!!_,this.#u=new Map,this.#d=Array.from({length:n}).fill(void 0),this.#f=Array.from({length:n}).fill(void 0),this.#p=new E(n),this.#m=new E(n),this.#h=0,this.#g=0,this.#_=en.create(n),this.#c=0,this.#l=0,typeof l==`function`&&(this.#n=l),typeof u==`function`&&(this.#r=u),typeof d==`function`?(this.#i=d,this.#v=[]):(this.#i=void 0,this.#v=void 0),this.#C=!!this.#n,this.#E=!!this.#r,this.#T=!!this.#i,this.noDisposeOnSet=!!f,this.noUpdateTTL=!!p,this.noDeleteOnFetchRejection=!!y,this.allowStaleOnFetchRejection=!!x,this.allowStaleOnFetchAbort=!!S,this.ignoreFetchAbort=!!C,this.maxEntrySize!==0){if(this.#t!==0&&!I(this.#t))throw TypeError(`maxSize must be a positive integer if specified`);if(!I(this.maxEntrySize))throw TypeError(`maxEntrySize must be a positive integer if specified`);this.#M()}if(this.allowStale=!!c,this.noDeleteOnStaleGet=!!b,this.updateAgeOnGet=!!o,this.updateAgeOnHas=!!s,this.ttlResolution=I(i)||i===0?i:1,this.ttlAutopurge=!!a,this.ttl=r||0,this.ttl){if(!I(this.ttl))throw TypeError(`ttl must be a positive integer if specified`);this.#D()}if(this.#e===0&&this.ttl===0&&this.#t===0)throw TypeError(`At least one of max, maxSize, or ttl is required`);if(!this.ttlAutopurge&&!this.#e&&!this.#t){let t=`LRU_CACHE_UNBOUNDED`;Zt(t)&&(Jt.add(t),Xt(`TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.`,`UnboundedCacheWarning`,t,e))}}getRemainingTTL(e){return this.#u.has(e)?1/0:0}#D(){let e=new $t(this.#e),t=new $t(this.#e);this.#x=e,this.#b=t;let n=this.ttlAutopurge?Array.from({length:this.#e}):void 0;this.#S=n,this.#A=(n,i,a=this.#s.now())=>{t[n]=i===0?0:a,e[n]=i,r(n,i)},this.#O=n=>{t[n]=e[n]===0?0:this.#s.now(),r(n,e[n])};let r=this.ttlAutopurge?(e,t)=>{if(n?.[e]&&(clearTimeout(n[e]),n[e]=void 0),t&&t!==0&&n){let i=setTimeout(()=>{this.#j(e)?(this.#Z(this.#d[e],`expire`),n[e]=void 0):r(e,o(e))},t+1);i.unref&&i.unref(),n[e]=i}}:()=>{};this.#k=(n,r)=>{if(e[r]){let o=e[r],s=t[r];if(!o||!s)return;n.ttl=o,n.start=s,n.now=i||a(),n.remainingTTL=o-(n.now-s)}};let i=0,a=()=>{let e=this.#s.now();if(this.ttlResolution>0){i=e;let t=setTimeout(()=>i=0,this.ttlResolution);t.unref&&t.unref()}return e};this.getRemainingTTL=e=>{let t=this.#u.get(e);return t===void 0?0:o(t)};let o=n=>{let r=e[n],o=t[n];return!r||!o?1/0:r-((i||a())-o)};this.#j=n=>{let r=t[n],o=e[n];return!!o&&!!r&&(i||a())-r>o}}#O=()=>{};#k=()=>{};#A=()=>{};#j=()=>!1;#M(){let e=new $t(this.#e);this.#l=0,this.#y=e,this.#N=t=>{this.#l-=e[t],e[t]=0},this.#F=(e,t,n,r)=>{if(!I(n)){if(this.#W(t))return this.backgroundFetchSize;if(r){if(typeof r!=`function`)throw TypeError(`sizeCalculation must be a function`);if(n=r(t,e),!I(n))throw TypeError(`sizeCalculation return invalid (expect positive integer)`)}else throw TypeError(`invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.`)}return n},this.#P=(t,n,r)=>{if(e[t]=n,this.#t){let n=this.#t-e[t];for(;this.#l>n;)this.#B(!0)}this.#l+=e[t],r&&(r.entrySize=n,r.totalCalculatedSize=this.#l)}}#N=e=>{};#P=(e,t,n)=>{};#F=(e,t,n,r)=>{if(n||r)throw TypeError(`cannot set size without setting maxSize or maxEntrySize on cache`);return 0};*#I({allowStale:e=this.allowStale}={}){if(this.#c)for(let t=this.#g;this.#R(t)&&((e||!this.#j(t))&&(yield t),t!==this.#h);)t=this.#m[t]}*#L({allowStale:e=this.allowStale}={}){if(this.#c)for(let t=this.#h;this.#R(t)&&((e||!this.#j(t))&&(yield t),t!==this.#g);)t=this.#p[t]}#R(e){return e!==void 0&&this.#u.get(this.#d[e])===e}*entries(){for(let e of this.#I())this.#f[e]!==void 0&&this.#d[e]!==void 0&&!this.#W(this.#f[e])&&(yield[this.#d[e],this.#f[e]])}*rentries(){for(let e of this.#L())this.#f[e]!==void 0&&this.#d[e]!==void 0&&!this.#W(this.#f[e])&&(yield[this.#d[e],this.#f[e]])}*keys(){for(let e of this.#I()){let t=this.#d[e];t!==void 0&&!this.#W(this.#f[e])&&(yield t)}}*rkeys(){for(let e of this.#L()){let t=this.#d[e];t!==void 0&&!this.#W(this.#f[e])&&(yield t)}}*values(){for(let e of this.#I())this.#f[e]!==void 0&&!this.#W(this.#f[e])&&(yield this.#f[e])}*rvalues(){for(let e of this.#L())this.#f[e]!==void 0&&!this.#W(this.#f[e])&&(yield this.#f[e])}[Symbol.iterator](){return this.entries()}[Symbol.toStringTag]=`LRUCache`;find(e,t={}){for(let n of this.#I()){let r=this.#f[n],i=this.#W(r)?r.__staleWhileFetching:r;if(i!==void 0&&e(i,this.#d[n],this))return this.#J(this.#d[n],t)}}forEach(e,t=this){for(let n of this.#I()){let r=this.#f[n],i=this.#W(r)?r.__staleWhileFetching:r;i!==void 0&&e.call(t,i,this.#d[n],this)}}rforEach(e,t=this){for(let n of this.#L()){let r=this.#f[n],i=this.#W(r)?r.__staleWhileFetching:r;i!==void 0&&e.call(t,i,this.#d[n],this)}}purgeStale(){let e=!1;for(let t of this.#L({allowStale:!0}))this.#j(t)&&(this.#Z(this.#d[t],`expire`),e=!0);return e}info(e){let t=this.#u.get(e);if(t===void 0)return;let n=this.#f[t],r=this.#W(n)?n.__staleWhileFetching:n;if(r===void 0)return;let i={value:r};if(this.#x&&this.#b){let e=this.#x[t],n=this.#b[t];e&&n&&(i.ttl=e-(this.#s.now()-n),i.start=Date.now())}return this.#y&&(i.size=this.#y[t]),i}dump(){let e=[];for(let t of this.#I({allowStale:!0})){let n=this.#d[t],r=this.#f[t],i=this.#W(r)?r.__staleWhileFetching:r;if(i===void 0||n===void 0)continue;let a={value:i};if(this.#x&&this.#b){a.ttl=this.#x[t];let e=this.#s.now()-this.#b[t];a.start=Math.floor(Date.now()-e)}this.#y&&(a.size=this.#y[t]),e.unshift([n,a])}return e}load(e){this.clear();for(let[t,n]of e){if(n.start){let e=Date.now()-n.start;n.start=this.#s.now()-e}this.#z(t,n.value,n)}}set(e,t,n={}){let{status:r=F.hasSubscribers?{}:void 0}=n;n.status=r,r&&(r.op=`set`,r.key=e,t!==void 0&&(r.value=t),r.cache=this);let i=this.#z(e,t,n);return r&&F.hasSubscribers&&F.publish(r),i}#z(e,t,n,r){let{ttl:i=this.ttl,start:a,noDisposeOnSet:o=this.noDisposeOnSet,sizeCalculation:s=this.sizeCalculation,status:c}=n,l=this.#W(t);if(t===void 0)return c&&(c.set=`deleted`),this.delete(e),this;let{noUpdateTTL:u=this.noUpdateTTL}=n;c&&!l&&(c.value=t);let d=this.#F(e,t,n.size||0,s,c);if(this.maxEntrySize&&d>this.maxEntrySize)return this.#Z(e,`set`),c&&(c.set=`miss`,c.maxEntrySizeExceeded=!0),this;let f=this.#c===0?void 0:this.#u.get(e);if(f===void 0)f=this.#c===0?this.#g:this.#_.length===0?this.#c===this.#e?this.#B(!1):this.#c:this.#_.pop(),this.#d[f]=e,this.#f[f]=t,this.#u.set(e,f),this.#p[this.#g]=f,this.#m[f]=this.#g,this.#g=f,this.#c++,this.#P(f,d,c),c&&(c.set=`add`),u=!1,this.#E&&!l&&this.#r?.(t,e,`add`);else{this.#X(f);let n=this.#f[f];if(t!==n){if(!o)if(this.#W(n)){n!==r&&n.__abortController.abort(Error(`replaced`));let{__staleWhileFetching:i}=n;i!==void 0&&i!==t&&(this.#C&&this.#n?.(i,e,`set`),this.#T&&this.#v?.push([i,e,`set`]))}else this.#C&&this.#n?.(n,e,`set`),this.#T&&this.#v?.push([n,e,`set`]);if(this.#N(f),this.#P(f,d,c),this.#f[f]=t,!l){let r=n&&this.#W(n)?n.__staleWhileFetching:n,i=r===void 0?`add`:t===r?`update`:`replace`;c&&(c.set=i,r!==void 0&&(c.oldValue=r)),this.#E&&this.onInsert?.(t,e,i)}}else l||(c&&(c.set=`update`),this.#E&&this.onInsert?.(t,e,`update`))}if(i!==0&&!this.#x&&this.#D(),this.#x&&(u||this.#A(f,i,a),c&&this.#k(c,f)),!o&&this.#T&&this.#v){let e=this.#v,t;for(;t=e?.shift();)this.#i?.(...t)}return this}pop(){try{for(;this.#c;){let e=this.#f[this.#h];if(this.#B(!0),this.#W(e)){if(e.__staleWhileFetching)return e.__staleWhileFetching}else if(e!==void 0)return e}}finally{if(this.#T&&this.#v){let e=this.#v,t;for(;t=e?.shift();)this.#i?.(...t)}}}#B(e){let t=this.#h,n=this.#d[t],r=this.#f[t],i=this.#W(r);i&&r.__abortController.abort(Error(`evicted`));let a=i?r.__staleWhileFetching:r;return(this.#C||this.#T)&&a!==void 0&&(this.#C&&this.#n?.(a,n,`evict`),this.#T&&this.#v?.push([a,n,`evict`])),this.#N(t),this.#S?.[t]&&(clearTimeout(this.#S[t]),this.#S[t]=void 0),e&&(this.#d[t]=void 0,this.#f[t]=void 0,this.#_.push(t)),this.#c===1?(this.#h=this.#g=0,this.#_.length=0):this.#h=this.#p[t],this.#u.delete(n),this.#c--,t}has(e,t={}){let{status:n=F.hasSubscribers?{}:void 0}=t;t.status=n,n&&(n.op=`has`,n.key=e,n.cache=this);let r=this.#V(e,t);return F.hasSubscribers&&F.publish(n),r}#V(e,t={}){let{updateAgeOnHas:n=this.updateAgeOnHas,status:r}=t,i=this.#u.get(e);if(i!==void 0){let e=this.#f[i];if(this.#W(e)&&e.__staleWhileFetching===void 0)return!1;if(this.#j(i))r&&(r.has=`stale`,this.#k(r,i));else return n&&this.#O(i),r&&(r.has=`hit`,this.#k(r,i)),!0}else r&&(r.has=`miss`);return!1}peek(e,t={}){let{status:n=qt()?{}:void 0}=t;n&&(n.op=`peek`,n.key=e,n.cache=this),t.status=n;let r=this.#H(e,t);return F.hasSubscribers&&F.publish(n),r}#H(e,t){let{status:n,allowStale:r=this.allowStale}=t,i=this.#u.get(e);if(i===void 0||!r&&this.#j(i)){n&&(n.peek=i===void 0?`miss`:`stale`);return}let a=this.#f[i],o=this.#W(a)?a.__staleWhileFetching:a;return n&&(o===void 0?n.peek=`miss`:(n.peek=`hit`,n.value=o)),o}#U(e,t,n,r){let i=t===void 0?void 0:this.#f[t];if(this.#W(i))return i;let a=new AbortController,{signal:o}=n;o?.addEventListener(`abort`,()=>a.abort(o.reason),{signal:a.signal});let s={signal:a.signal,options:n,context:r},c=(r,i=!1)=>{let{aborted:o}=a.signal,c=n.ignoreFetchAbort&&r!==void 0,l=n.ignoreFetchAbort||!!(n.allowStaleOnFetchAbort&&r!==void 0);if(n.status&&(o&&!i?(n.status.fetchAborted=!0,n.status.fetchError=a.signal.reason,c&&(n.status.fetchAbortIgnored=!0)):n.status.fetchResolved=!0),o&&!c&&!i)return u(a.signal.reason,l);let d=f,p=this.#f[t];return(p===f||p===void 0&&c&&i)&&(r===void 0?d.__staleWhileFetching===void 0?this.#Z(e,`fetch`):this.#f[t]=d.__staleWhileFetching:(n.status&&(n.status.fetchUpdated=!0),this.#z(e,r,s.options,d))),r},l=e=>(n.status&&(n.status.fetchRejected=!0,n.status.fetchError=e),u(e,!1)),u=(r,i)=>{let{aborted:o}=a.signal,s=o&&n.allowStaleOnFetchAbort,c=s||n.allowStaleOnFetchRejection,l=c||n.noDeleteOnFetchRejection,u=f;if(this.#f[t]===f&&(!l||!i&&u.__staleWhileFetching===void 0?this.#Z(e,`fetch`):s||(this.#f[t]=u.__staleWhileFetching)),c)return n.status&&u.__staleWhileFetching!==void 0&&(n.status.returnedStale=!0),u.__staleWhileFetching;if(u.__returned===u)throw r},d=(t,r)=>{let o=this.#a?.(e,i,s);a.signal.addEventListener(`abort`,()=>{(!n.ignoreFetchAbort||n.allowStaleOnFetchAbort)&&(t(void 0),n.allowStaleOnFetchAbort&&(t=e=>c(e,!0)))}),o&&o instanceof Promise?o.then(e=>t(e===void 0?void 0:e),r):o!==void 0&&t(o)};n.status&&(n.status.fetchDispatched=!0);let f=new Promise(d).then(c,l),p=Object.assign(f,{__abortController:a,__staleWhileFetching:i,__returned:void 0});return t===void 0?(this.#z(e,p,{...s.options,status:void 0}),t=this.#u.get(e)):this.#f[t]=p,p}#W(e){if(!this.#w)return!1;let t=e;return!!t&&t instanceof Promise&&t.hasOwnProperty(`__staleWhileFetching`)&&t.__abortController instanceof AbortController}fetch(e,t={}){let n=Gt.hasSubscribers,{status:r=qt()?{}:void 0}=t;t.status=r,r&&t.context&&(r.context=t.context);let i=this.#G(e,t);return r&&n&&(r.trace=!0,Gt.tracePromise(()=>i,r).catch(()=>{})),i}async#G(e,t={}){let{allowStale:n=this.allowStale,updateAgeOnGet:r=this.updateAgeOnGet,noDeleteOnStaleGet:i=this.noDeleteOnStaleGet,ttl:a=this.ttl,noDisposeOnSet:o=this.noDisposeOnSet,size:s=0,sizeCalculation:c=this.sizeCalculation,noUpdateTTL:l=this.noUpdateTTL,noDeleteOnFetchRejection:u=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:d=this.allowStaleOnFetchRejection,ignoreFetchAbort:f=this.ignoreFetchAbort,allowStaleOnFetchAbort:p=this.allowStaleOnFetchAbort,context:m,forceRefresh:h=!1,status:g,signal:_}=t;if(g&&(g.op=`fetch`,g.key=e,h&&(g.forceRefresh=!0),g.cache=this),!this.#w)return g&&(g.fetch=`get`),this.#J(e,{allowStale:n,updateAgeOnGet:r,noDeleteOnStaleGet:i,status:g});let v={allowStale:n,updateAgeOnGet:r,noDeleteOnStaleGet:i,ttl:a,noDisposeOnSet:o,size:s,sizeCalculation:c,noUpdateTTL:l,noDeleteOnFetchRejection:u,allowStaleOnFetchRejection:d,allowStaleOnFetchAbort:p,ignoreFetchAbort:f,status:g,signal:_},y=this.#u.get(e);if(y===void 0){g&&(g.fetch=`miss`);let t=this.#U(e,y,v,m);return t.__returned=t}else{let t=this.#f[y];if(this.#W(t)){let e=n&&t.__staleWhileFetching!==void 0;return g&&(g.fetch=`inflight`,e&&(g.returnedStale=!0)),e?t.__staleWhileFetching:t.__returned=t}let i=this.#j(y);if(!h&&!i)return g&&(g.fetch=`hit`),this.#X(y),r&&this.#O(y),g&&this.#k(g,y),t;let a=this.#U(e,y,v,m),o=a.__staleWhileFetching!==void 0&&n;return g&&(g.fetch=i?`stale`:`refresh`,o&&i&&(g.returnedStale=!0)),o?a.__staleWhileFetching:a.__returned=a}}forceFetch(e,t={}){let n=Gt.hasSubscribers,{status:r=qt()?{}:void 0}=t;t.status=r,r&&t.context&&(r.context=t.context);let i=this.#K(e,t);return r&&n&&(r.trace=!0,Gt.tracePromise(()=>i,r).catch(()=>{})),i}async#K(e,t={}){let n=await this.#G(e,t);if(n===void 0)throw Error(`fetch() returned undefined`);return n}memo(e,t={}){let{status:n=F.hasSubscribers?{}:void 0}=t;t.status=n,n&&(n.op=`memo`,n.key=e,t.context&&(n.context=t.context),n.cache=this);let r=this.#q(e,t);return n&&(n.value=r),F.hasSubscribers&&F.publish(n),r}#q(e,t={}){let n=this.#o;if(!n)throw Error(`no memoMethod provided to constructor`);let{context:r,status:i,forceRefresh:a,...o}=t;i&&a&&(i.forceRefresh=!0);let s=this.#J(e,o),c=a||s===void 0;if(i&&(i.memo=c?`miss`:`hit`,c||(i.value=s)),!c)return s;let l=n(e,s,{options:o,context:r});return i&&(i.value=l),this.#z(e,l,o),l}get(e,t={}){let{status:n=F.hasSubscribers?{}:void 0}=t;t.status=n,n&&(n.op=`get`,n.key=e,n.cache=this);let r=this.#J(e,t);return n&&(r!==void 0&&(n.value=r),F.hasSubscribers&&F.publish(n)),r}#J(e,t={}){let{allowStale:n=this.allowStale,updateAgeOnGet:r=this.updateAgeOnGet,noDeleteOnStaleGet:i=this.noDeleteOnStaleGet,status:a}=t,o=this.#u.get(e);if(o===void 0){a&&(a.get=`miss`);return}let s=this.#f[o],c=this.#W(s);return a&&this.#k(a,o),this.#j(o)?c?(a&&(a.get=`stale-fetching`),n&&s.__staleWhileFetching!==void 0?(a&&(a.returnedStale=!0),s.__staleWhileFetching):void 0):(i||this.#Z(e,`expire`),a&&(a.get=`stale`),n?(a&&(a.returnedStale=!0),s):void 0):(a&&(a.get=c?`fetching`:`hit`),this.#X(o),r&&this.#O(o),c?s.__staleWhileFetching:s)}#Y(e,t){this.#m[t]=e,this.#p[e]=t}#X(e){e!==this.#g&&(e===this.#h?this.#h=this.#p[e]:this.#Y(this.#m[e],this.#p[e]),this.#Y(this.#g,e),this.#g=e)}delete(e){return this.#Z(e,`delete`)}#Z(e,t){F.hasSubscribers&&F.publish({op:`delete`,delete:t,key:e,cache:this});let n=!1;if(this.#c!==0){let r=this.#u.get(e);if(r!==void 0)if(this.#S?.[r]&&(clearTimeout(this.#S[r]),this.#S[r]=void 0),n=!0,this.#c===1)this.#Q(t);else{this.#N(r);let n=this.#f[r];if(this.#W(n)?n.__abortController.abort(Error(`deleted`)):(this.#C||this.#T)&&(this.#C&&this.#n?.(n,e,t),this.#T&&this.#v?.push([n,e,t])),this.#u.delete(e),this.#d[r]=void 0,this.#f[r]=void 0,r===this.#g)this.#g=this.#m[r];else if(r===this.#h)this.#h=this.#p[r];else{let e=this.#m[r];this.#p[e]=this.#p[r];let t=this.#p[r];this.#m[t]=this.#m[r]}this.#c--,this.#_.push(r)}}if(this.#T&&this.#v?.length){let e=this.#v,t;for(;t=e?.shift();)this.#i?.(...t)}return n}clear(){return this.#Q(`delete`)}#Q(e){for(let t of this.#L({allowStale:!0})){let n=this.#f[t];if(this.#W(n))n.__abortController.abort(Error(`deleted`));else{let r=this.#d[t];this.#C&&this.#n?.(n,r,e),this.#T&&this.#v?.push([n,r,e])}}if(this.#u.clear(),this.#f.fill(void 0),this.#d.fill(void 0),this.#x&&this.#b){this.#x.fill(0),this.#b.fill(0);for(let e of this.#S??[])e!==void 0&&clearTimeout(e);this.#S?.fill(void 0)}if(this.#y&&this.#y.fill(0),this.#h=0,this.#g=0,this.#_.length=0,this.#l=0,this.#c=0,this.#T&&this.#v){let e=this.#v,t;for(;t=e?.shift();)this.#i?.(...t)}}},nn=`@teacss/autocomplete`;const rn=2e6,an=5e4,on=4096,sn=1e3,cn=5e7,ln=1e5,un=new Map(Array.from(`ÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝßàáâãäåçèéêëìíîïñòóôõöøùúûüýÿĀāĂ㥹ĆćĈĉĊċČčĎďđĒēĔĕĖėĘęĚěĜĝĞğĠġĢģĤĥħĨĩĪīĬĭĮįİıĴĵĶķĹĺĻļĽľŀłŃńŅņŇňŌōŎŏŐőŔŕŖŗŘřŚśŜŝŞşŠšŢţŤťŧŨũŪūŬŭŮůŰűŲųŴŵŶŷŸŹźŻżŽžſƀƁƃƆƈƉƊƌƎƐƒƓƗƙƚƜƝƞƟƠơƥƫƭƮƯưƲƴƶǍǎǏǐǑǒǓǔǗǘǝǥǦǧǨǩǪǫǰǴǵǸǹȀȁȂȃȄȅȆȇȈȉȊȋȌȍȎȏȐȑȒȓȔȕȖȗȘșȚțȞȟȠȡȥȦȧȨȩȮȯȲȳȴȵȶȷȺȻȼȽȾȿɀɃɄɅɆɇɈɉɊɋɌɍɎɏɐɑɓɔɕɖɗɘɛɜɝɞɟɠɡɢɥɦɨɪɫɬɭɯɰɱɲɳɴɵɹɺɻɼɽɾɿʀʁʂʇʈʉʋʌʍʎʏʐʑʗʙʚʛʜʝʞʟʠʮͣͤͥͦͧͨͩͪͫͬͭͮͯᴀᴃᴄᴅᴇᴈᴉᴊᴋᴌᴍᴎᴏᴐᴑᴒᴓᴖᴗᴘᴙᴚᴛᴜᴝᴞᴟᴠᴡᴢᵢᵣᵤᵥḀḁḂḃḄḅḆḇḊḋḌḍḎḏḐḑḒḓḘḙḚḛḞḟḠḡḢḣḤḥḦḧḨḩḪḫḬḭḮḯḰḱḲḳḴḵḶḷḺḻḼḽḾḿṀṁṂṃṄṅṆṇṈṉṊṋṔṕṖṗṘṙṚṛṞṟṠṡṢṣṪṫṬṭṮṯṰṱṲṳṴṵṶṷṼṽṾṿẀẁẂẃẄẅẆẇẈẉẊẋẌẍẎẏẐẑẒẓẔẕẖẗẘẙẚẛẠạẢảẤấẦầẨẩẪẫẬậẮắẰằẲẳẴẵẶặẸẹẺẻẼẽẾếỀềỂểỄễỆệỈỉỊịỌọỎỏỐốỒồỔổỖỗỘộỚớỜờỞởỠỡỢợỤụỦủỨứỪừỬửỮữỰựỲỳỴỵỶỷỸỹⁱₕₖₗₘₙₚₛₜↄ`,(e,t)=>[e,`AAAAAACEEEEIIIINOOOOOOUUUUYsaaaaaaceeeeiiiinoooooouuuuyyAaAaAaCcCcCcCcDddEeEeEeEeEeGgGgGgGgHhhIiIiIiIiIiJjKkLlLlLlllNnNnNnOoOoOoRrRrRrSsSsSsSsTtTttUuUuUuUuUuUuWwYyYZzZzZzsbBbOcDDdEEfGIklMNnOOopttTUuVyzAaIiOoUuUuegGgKkOojGgNnAaAaEeEeIiIiOoOoRrRrUuUuSsTtHhNdzAaEeOoYylntjACcLTszBUVEeJjQqRrYyaabocddeeeeejggGhhiIlllmmmnnNorrrrrrrRRsttuvvwyYzzcBeGHjkLqhaeioucdhmrtvxABCDEeiJKLMNOOoooooPRRTUuumVWZiruvAaBbBbBbDdDdDdDdDdEeEeFfGgHhHhHhHhHhIiIiKkKkKkLlLlLlMmMmMmNnNnNnNnPpPpRrRrRrSsSsTtTtTtTtUuUuUuVvVvWwWwWwWwWwXxXxYyZzZzZzhtwyasAaAaAaAaAaAaAaAaAaAaAaAaEeEeEeEeEeEeEeEeIiIiOoOoOoOoOoOoOoOoOoOoOoOoUuUuUuUuUuUuUuYyYyYyYyihklmnpstc`[t]])),L={maxAttempts:an,maxCandidateLength:on,maxCandidates:5e4,maxCharacters:rn,maxScans:ln,maxScannedCharacters:5e7},dn={...L,maxCandidateLength:rn,maxCandidates:sn};function fn(){return{suggestions:[],attempts:0,candidates:0,characters:0,scans:0,truncated:!1}}const pn=new WeakMap,mn=new WeakMap;function hn(e,t,n){let r=pn.get(e);if(!r){let n=e.suggest(t,`prefix`)??[];return{suggestions:n,attempts:n.length,candidates:n.length,characters:n.reduce((e,t)=>e+t.length,0),scans:n.length,truncated:!1}}return r(t,n)}function gn(e,t,n){let r=mn.get(e);return r?r(t,n):hn(e,t,n)}var _n=class extends Error{template;constructor(e,t){super(e),this.template=t,this.name=nn,this.template=t}toString(){return`⚠️ [${this.name}]: ${this.message}. ${this.template?`Template: ${this.template}.`:``}`}};const vn={directions:`(x|y|t|b|l|r|s|e)`,num:`(${[0,1,2,3,4,5,6,8,10,12,24,36].join(`|`)})`,percent:`(${[0,10,20,30,40,50,60,70,80,90,100].join(`|`)})`,percentage:`(${[`10%`,`20%`,`30%`,`40%`,`50%`,`60%`,`70%`,`80%`,`90%`,`100%`].join(`|`)})`},yn=[`DEFAULT`];function bn(e,t,n,r){let i=0;Array.from(e.matchAll(t)).forEach(t=>{let a=t.index;i!==a&&r(e.slice(i,a),i,a),n(t),i=a+t[0].length}),i!==e.length&&r(e.slice(i),i,e.length)}function xn(e,t={},n={}){let r=[],i=[],a={...vn,...n};e=e.replace(/<([\w-]+)>/g,(e,t,n,r)=>Object.hasOwn(a,t)?a[t]:(i.push(new _n(`Unknown template shorthand: <${t}>`,r)),e)),c(e),i.length&&(r.length=0);let o={parts:r,suggest:l,errors:i};return pn.set(o,d),mn.set(o,u),o;function s(e){bn(e,/\$([\w.|-]+)/g,e=>{r.push({type:`theme`,objects:e[1].split(`|`).map(n=>{let r=n.split(`.`).reduce((t,n)=>!n||typeof t!=`object`||!t||!Object.hasOwn(t,n)||!t[n]?(i.push(new _n(`Invalid theme key: ${n}`,e.input)),{}):t[n],t);return typeof r!=`object`||!r||Array.isArray(r)?(i.push(new _n(`Invalid theme path: ${n}`,e.input)),{}):r})})},e=>{r.push({type:`static`,value:e})})}function c(e){bn(e,/\((.*?)\)/g,e=>{if(!e[1].includes(`|`)){r.push({type:`static`,value:e[0]});return}r.push({type:`group`,values:e[1].split(`|`)})},e=>{s(e)})}function l(e,t=`prefix`){if(e.length>1&&t===`fuzzy`){let t=e!==e.toLowerCase(),n=B(e,t),i=d(e,{maxCandidates:sn}).suggestions.filter(e=>On(n,B(e,t),e,0));if(n.length>on)return i;let a=dr(r,{},e).candidates;if(i.length){let e=new Set(i);if(a.every(t=>e.has(t)))return i}if(Dn(e,a.reduce((e,t)=>e+t.length,0))){let t=Tn(a,e),n=t.filter(t=>Nn(t,e));return n.length?or(n,[...i,...t]):or(i,t)}return or(i,new Wt(a,{fuzzy:`v1`,limit:sn}).find(e).map(e=>e.item))}return u(e).suggestions}function u(e,t={}){let n={...dn,...t},i=R(e);if(i.length>n.maxCandidateLength)return fn();let a=Sn(r);if(a){let t=Cn(r,0,a.index);if(!Wn(t,e)&&!Wn(R(t),i))return fn();let o=Cn(r,a.index+1,r.length);return Gn(a.part,t,o,e,a.suppressPartialRoots,n)}let o=wn(r);return o&&!Wn(o,e)&&!Wn(R(o),R(e))?fn():Fn(r,e,n)}function d(e,t={}){let n={...L,...t},i=u(e,n),a=wn(r);if(i.suggestions.length||!a)return i;let o={...n,maxAttempts:n.maxAttempts-i.attempts,maxCandidates:n.maxCandidates-i.candidates,maxCharacters:n.maxCharacters-i.characters,maxScans:n.maxScans-i.scans},s=u(a+e,o);return{suggestions:s.suggestions,attempts:i.attempts+s.attempts,candidates:i.candidates+s.candidates,characters:i.characters+s.characters,scans:i.scans+s.scans,truncated:i.truncated||s.truncated}}}function Sn(e){let t,n=!1;for(let r=0;r<e.length;r++){let i=e[r];if(i.type!==`static`){if(i.type===`group`&&i.values.length>0&&i.values.every(e=>e===``)){n=!0;continue}if(i.type!==`theme`||t)return;t={index:r,part:i}}}return t&&{...t,suppressPartialRoots:n}}function Cn(e,t,n){let r=``;for(let i=t;i<n;i++){let t=e[i];t.type===`static`&&(r+=t.value)}return r}function wn(e){let t=e.findIndex(e=>e.type!==`static`);return Cn(e,0,t<0?e.length:t)}function R(e){return e.replace(/-/g,``)}function Tn(e,t){return z(e,t)}function z(e,t,n={}){let r={...L,maxCandidates:sn,...n};if(!t)return En(e,r);let i=t!==t.toLowerCase(),a=B(t,i);if(a.length>r.maxCandidateLength)return[];let o={characters:0,items:[],retained:new Set},s=new Set,c=e[Symbol.iterator](),l=0,u=0;for(;l<r.maxAttempts&&u<r.maxScannedCharacters;){let e=c.next();if(e.done)break;let t=e.value,n=l++;if(!t||t.length>r.maxCandidateLength||s.has(t)||t.length>r.maxScannedCharacters-u)continue;s.add(t),u+=t.length;let d=On(a,B(t,i),t,n);d&&kn(o,d,r.maxCandidates,r.maxCharacters)}return o.items.sort(Mn).map(({candidate:e})=>e)}function En(e,t){let n=[],r=new Set,i=e[Symbol.iterator](),a=0,o=0,s=0;for(;a<t.maxAttempts&&n.length<t.maxCandidates&&o<t.maxCharacters&&s<t.maxScannedCharacters;){let e=i.next();if(e.done)break;let c=e.value;a++,!(!c||c.length>t.maxCandidateLength||r.has(c)||c.length>t.maxScannedCharacters-s)&&(r.add(c),s+=c.length,!(o+c.length>t.maxCharacters)&&(n.push(c),o+=c.length))}return n}function Dn(e,t){return e.length*t>cn}function On(e,t,n,r){if(t===e)return{candidate:n,category:0,gaps:0,longestRun:e.length,start:0,order:r};if(t.startsWith(e))return{candidate:n,category:1,gaps:0,longestRun:e.length,start:0,order:r};let i=0,a=-1,o=-1,s=0,c=0,l=0;for(let n=0;n<t.length&&i<e.length;n++)t[n]===e[i]&&(a<0&&(a=n),o>=0&&(l+=n-o-1),s=n===o+1?s+1:1,c=Math.max(c,s),o=n,i++);if(i===e.length)return{candidate:n,category:2,gaps:l,longestRun:c,start:a,order:r}}function kn(e,t,n,r){e.retained.has(t.candidate)||(e.items.length<n&&e.characters+t.candidate.length<=r?(e.items.push(t),e.retained.add(t.candidate),e.characters+=t.candidate.length,An(e.items,e.items.length-1)):e.items.length&&Mn(t,e.items[0])<0&&e.characters-e.items[0].candidate.length+t.candidate.length<=r&&(e.retained.delete(e.items[0].candidate),e.characters+=t.candidate.length-e.items[0].candidate.length,e.items[0]=t,e.retained.add(t.candidate),jn(e.items,0)))}function An(e,t){for(;t>0;){let n=t-1>>>1;if(Mn(e[t],e[n])<=0)return;[e[n],e[t]]=[e[t],e[n]],t=n}}function jn(e,t){for(;;){let n=t*2+1;if(n>=e.length)return;let r=n+1,i=n;if(r<e.length&&Mn(e[r],e[n])>0&&(i=r),Mn(e[i],e[t])<=0)return;[e[t],e[i]]=[e[i],e[t]],t=i}}function Mn(e,t){return e.category-t.category||e.gaps-t.gaps||t.longestRun-e.longestRun||e.start-t.start||e.candidate.length-t.candidate.length||e.order-t.order}function Nn(e,t){let n=t!==t.toLowerCase();return B(e,n)===B(t,n)}function B(e,t){let n=e.normalize(),r=Pn(n)?n:Array.from(n,e=>un.get(e)??e).join(``);return t?r:r.toLowerCase()}function Pn(e){for(let t=0;t<e.length;t++)if(e.charCodeAt(t)>127)return!1;return!0}function Fn(e,t,n={}){let r={...L,...n};if(r.maxAttempts<=0||r.maxCandidates<=0||r.maxCharacters<=0)return fn();let i=R(t),a=In(),o=In(),s=r.maxCandidates,c=Jn(r.maxScans),l=[],u=Array.from({length:e.length},()=>``),d=Array.from({length:e.length+1},()=>0),f=Array.from({length:e.length+1},()=>0),p=Array.from({length:e.length+1},()=>0),m=[],h=new Set,g=0,_=0;for(;_>=0&&!c.truncated;){if(_===e.length){let e=u.join(``),n=f[_]>=t.length,c=p[_]>=i.length;if((n||c)&&e.length<=r.maxCharacters){let t=!h.has(e);(!t||g<r.maxAttempts)&&(t&&(h.add(e),g++),n&&Ln(a,e,m,s,r),c&&Ln(o,e,m,s,r))}_--;continue}if(g>=r.maxAttempts)break;let n=l[_];n||(n={choiceIndex:0,iterator:sr(e[_],r.maxCandidateLength-d[_],c)},l[_]=n);let v=n.iterator.next();if(v.done){l.pop(),_--;continue}let y=n.choiceIndex++,b=v.value,x=d[_]+b.length;if(x>r.maxCandidateLength)continue;let S=f[_]<0?-1:Un(t,f[_],b,!1),C=p[_]<0?-1:Un(i,p[_],b,!0);if(S<0&&C<0)continue;for(;m.length&&!(m.at(-1).depth<_);)m.pop();y>0&&m.push({depth:_,index:y}),u[_]=b;let w=_+1;d[w]=x,f[w]=S,p[w]=C,l.length=w,_=w}let v=a.entries.length?a:o;v.entries.sort((e,t)=>Hn(e.path,t.path));let y=v.entries.map(e=>e.candidate);return{suggestions:y,attempts:g,candidates:y.length,characters:v.characters,scans:c.initial-c.remaining,truncated:c.truncated}}function In(){return{characters:0,entries:[],indices:new Map}}function Ln(e,t,n,r,i){let a=e.indices.get(t);if(a!==void 0){let t=e.entries[a];Hn(n,t.path)<0&&(t.path=n.slice(),Bn(e,a));return}if(r<=0||t.length>i.maxCharacters)return;let o={candidate:t,path:n.slice()};if(e.entries.length>=r){if(Hn(o.path,e.entries[0].path)>=0)return;Rn(e)}for(;e.entries.length&&e.characters+t.length>i.maxCharacters;){if(Hn(o.path,e.entries[0].path)>=0)return;Rn(e)}e.characters+t.length>i.maxCharacters||(e.indices.set(t,e.entries.length),e.entries.push(o),e.characters+=t.length,zn(e,e.entries.length-1))}function Rn(e){let t=e.entries[0],n=e.entries.pop();e.indices.delete(t.candidate),e.characters-=t.candidate.length,e.entries.length&&(e.entries[0]=n,e.indices.set(n.candidate,0),Bn(e,0))}function zn(e,t){for(;t>0;){let n=t-1>>>1;if(Hn(e.entries[t].path,e.entries[n].path)<=0)return;Vn(e,n,t),t=n}}function Bn(e,t){for(;;){let n=t*2+1;if(n>=e.entries.length)return;let r=n+1,i=n;if(r<e.entries.length&&Hn(e.entries[r].path,e.entries[n].path)>0&&(i=r),Hn(e.entries[i].path,e.entries[t].path)<=0)return;Vn(e,i,t),t=i}}function Vn(e,t,n){[e.entries[t],e.entries[n]]=[e.entries[n],e.entries[t]],e.indices.set(e.entries[t].candidate,t),e.indices.set(e.entries[n].candidate,n)}function Hn(e,t){let n=e.length-1,r=t.length-1;for(;n>=0||r>=0;){let i=n>=0?e[n].depth:-1,a=r>=0?t[r].depth:-1,o=Math.max(i,a),s=i===o?e[n--].index:0,c=a===o?t[r--].index:0;if(s!==c)return s-c}return 0}function Un(e,t,n,r){let i=t;for(let t=0;t<n.length;t++){let a=n[t];if(!(r&&a===`-`)){if(i<e.length&&e[i]!==a)return-1;i++}}return i}function Wn(e,t){return e.length<=t.length?t.startsWith(e):e.startsWith(t)}function Gn(e,t,n,r,i,a){let o={...L,...a};if(t.length+1>o.maxCandidateLength)return fn();let s=Jn(o.maxScans),c=Zn(e.objects,s),l=Qn(r,!1,o),u=Qn(R(r),!0,o);Kn(c,t,n,o.maxCandidateLength,i,l,u,s);let d=er(l,s);if(d.suggestions.length||!d.exhausted)return d;let f=er(u,s);return{suggestions:f.suggestions,attempts:d.attempts+f.attempts,candidates:d.candidates+f.candidates,characters:d.characters+f.characters,scans:f.scans,truncated:f.truncated}}function Kn(e,t,n,r,i,a,o,s){for(let c of e){let e=t+c.key,l=tr(e,a.input,!1),u=tr(e,o.input,!0);if(l===`none`&&u===`none`)continue;let d=rr(c.objects,e,n,a.input,o.input,r),f=l===`partial`||u===`partial`?ir(d,s):void 0,p=f!==void 0;if(nr(a,l,c.hasLeaf,p,e,n,i),nr(o,u,c.hasLeaf,p,e,n,i),a.blocked)return;for(f??=ir(d,s);f;){if((l===`reached`||i&&l===`partial`)&&$n(a,f.candidate,f.rawMatch),(u===`reached`||i&&u===`partial`)&&$n(o,f.candidate,f.normalizedMatch),a.blocked)return;f=ir(d,s)}if(s.truncated||a.blocked)return}}function qn(e){return!!e&&e[0]!==`_`&&!yn.includes(e)}function Jn(e=ln){let t=Math.max(0,e);return{initial:t,remaining:t,truncated:!1}}function Yn(e){return e.remaining<=0?(e.truncated=!0,!1):(e.remaining--,!0)}function*Xn(e){yield*Object.keys(e)}function Zn(e,t){let n=new Map;outer:for(let r of e)for(let e of Xn(r)){if(!Yn(t))break outer;if(!qn(e))continue;let i=r[e];if(i==null)continue;let a=n.get(e)??{key:e,hasLeaf:!1,objects:[]};if(typeof i!=`object`||Array.isArray(i))a.hasLeaf=!0;else{let e=i;a.objects.push(e),a.hasLeaf||=Object.hasOwn(e,`DEFAULT`)&&e.DEFAULT!==null&&e.DEFAULT!==void 0}n.set(e,a)}return[...n.values()]}function Qn(e,t,n){return{attempts:0,blocked:n.maxAttempts<=0||n.maxCandidates<=0||n.maxCharacters<=0,characters:0,input:e,limits:n,normalize:t,seen:new Set,suggestions:[]}}function $n(e,t,n){!n||e.blocked||e.seen.has(t)||(e.seen.add(t),e.attempts++,t.length<=e.limits.maxCandidateLength&&e.characters+t.length<=e.limits.maxCharacters&&(e.suggestions.push(t),e.characters+=t.length),e.blocked||=e.attempts>=e.limits.maxAttempts||e.suggestions.length>=e.limits.maxCandidates||e.characters>=e.limits.maxCharacters)}function er(e,t){return{suggestions:e.suggestions,attempts:e.attempts,candidates:e.suggestions.length,characters:e.characters,scans:t.initial-t.remaining,truncated:t.truncated,exhausted:!e.blocked&&!t.truncated}}function tr(e,t,n){let r=n?R(e):e;return t.startsWith(r)?`reached`:r.startsWith(t)?`partial`:`none`}function nr(e,t,n,r,i,a,o){if(t===`none`)return;if(t===`partial`&&r){(n||!o)&&$n(e,i,!0);return}if(!n)return;let s=i+a;$n(e,s,(e.normalize?R(s):s).startsWith(e.input))}function rr(e,t,n,r,i,a){return{base:t,fragments:[],frames:[],maxCandidateLength:a,normalizedInput:i,normalizedMatchedLength:Un(i,0,t,!0),objectIndex:0,objects:e,rawInput:r,rawMatchedLength:Un(r,0,t,!1),staticSuffix:n}}function ir(e,t){for(;!t.truncated;){if(!e.frames.length){if(e.objectIndex>=e.objects.length)return;let t=e.objects[e.objectIndex++];e.frames.push({depth:0,iterator:Xn(t),normalizedMatchedLength:e.normalizedMatchedLength,object:t,rawMatchedLength:e.rawMatchedLength,valueLength:0})}let n=e.frames.at(-1),r=n.iterator.next();if(r.done){e.frames.pop(),e.fragments.length=n.depth;continue}if(!Yn(t))return;let i=r.value;if(!qn(i))continue;let a=n.object[i];if(a==null)continue;let o=n.valueLength+ +!!n.depth+i.length;if(e.base.length+o+e.staticSuffix.length+1>e.maxCandidateLength)continue;let s=`-${i}`,c=n.rawMatchedLength<0?-1:Un(e.rawInput,n.rawMatchedLength,s,!1),l=n.normalizedMatchedLength<0?-1:Un(e.normalizedInput,n.normalizedMatchedLength,s,!0);if(c<0&&l<0)continue;e.fragments.length=n.depth,e.fragments.push(i);let u=typeof a==`object`&&!Array.isArray(a)?a:void 0;if(u&&e.frames.push({depth:n.depth+1,iterator:Xn(u),normalizedMatchedLength:l,object:u,rawMatchedLength:c,valueLength:o}),!(!u||Object.hasOwn(u,`DEFAULT`)&&u.DEFAULT!==null&&u.DEFAULT!==void 0))continue;let d=ar(e.rawInput,c,e.staticSuffix,!1),f=ar(e.normalizedInput,l,e.staticSuffix,!0);if(!(!d&&!f))return{candidate:`${e.base}-${e.fragments.join(`-`)}${e.staticSuffix}`,normalizedMatch:f,rawMatch:d}}}function ar(e,t,n,r){return t<0?!1:Un(e,t,n,r)>=e.length}function or(e,t){let n=[],r=new Set,i=0,a=(e,t)=>{for(let a of e){if(n.length===t)return;if(!(!a||r.has(a)||a.length>on)){if(i+a.length>rn)return;r.add(a),n.push(a),i+=a.length}}};return a(e,t.length?750:sn),a(t,sn),a(e,sn),n}function*sr(e,t,n){e.type===`theme`?yield*lr(e.objects,t,n):yield*cr(e,t,n)}function*cr(e,t,n){if(e.type===`static`){e.value.length<=t&&(yield e.value);return}if(e.type===`group`)for(let r of e.values){if(!Yn(n))return;r.length<=t&&(yield r)}}function*lr(e,t,n){let r=[];for(let i of e){r.length=0;let e=[{depth:0,iterator:Xn(i),object:i,valueLength:0}];for(;e.length&&!n.truncated;){let i=e.at(-1),a=i.iterator.next();if(a.done){e.pop(),r.length=i.depth;continue}if(!Yn(n))return;let o=a.value;if(!qn(o))continue;let s=i.object[o];if(s==null)continue;let c=i.valueLength+ +!!i.depth+o.length;if(c>t)continue;r.length=i.depth,r.push(o);let l=typeof s==`object`&&!Array.isArray(s)?s:void 0;l&&e.push({depth:i.depth+1,iterator:Xn(l),object:l,valueLength:c}),(!l||Object.hasOwn(l,`DEFAULT`)&&l.DEFAULT!==null&&l.DEFAULT!==void 0)&&(yield r.join(`-`))}}}function ur(e,t){let n=Jn(t.maxScans),r=e.map(e=>({done:!1,iterator:sr(e,t.maxCandidateLength,n),pending:void 0,seen:new Set,values:[]})),i=e.length+Math.max(0,t.maxCandidates-1),a=r.length,o=0,s=0,c=!1,l=r.length;for(;l&&!n.truncated;){let e=!1;for(let n of r){if(!n.values.length&&n.pending!==void 0&&o+n.pending.length<=t.maxCharacters){n.values.push(n.pending),o+=n.pending.length,n.pending=void 0,s++,l--,e=!0;continue}if(n.done)continue;let r=n.iterator.next();if(e=!0,r.done){n.done=!0,a--;continue}if(n.seen.has(r.value))continue;if(n.seen.add(r.value),!n.values.length){o+r.value.length<=t.maxCharacters?(n.values.push(r.value),o+=r.value.length,s++,l--):(n.pending===void 0||r.value.length<n.pending.length)&&(n.pending=r.value,c=!0);continue}let i=n.values[0];r.value.length<i.length&&(n.values[0]=r.value,o+=r.value.length-i.length,c=!0)}if(!e)break}for(;a&&s<i&&o<t.maxCharacters&&!n.truncated;){let e=!1;for(let n of r){if(n.done)continue;let r=n.iterator.next();if(r.done){n.done=!0,a--;continue}if(e=!0,!n.seen.has(r.value)){if(n.seen.add(r.value),o+r.value.length>t.maxCharacters){c=!0;continue}if(n.values.push(r.value),o+=r.value.length,s++,s===i)break}}if(!e)break}return c||=n.truncated||a>0||l>0,{scans:n.initial-n.remaining,truncated:c,values:r.map(e=>e.values)}}function dr(e,t={},n=``){let r={...L,...t},i=ur(e,r),a=i.values,o=i.scans,s,c=()=>{if(s===void 0){let t=fr(a,n,r);s=t?{combination:t,scans:0}:pr(e,n,r,Math.max(0,r.maxScans-o)),o+=s.scans}return s};if(a.some(e=>!e.length)){let e=i.truncated?c().combination:void 0;if(!e)return{candidates:[],truncated:i.truncated,attempts:0,scans:o};let t=hr(r),n={remaining:r.maxAttempts};return V(t,n,0)&&H(t,e),{candidates:[...t.candidates],truncated:!0,attempts:r.maxAttempts-n.remaining,scans:o}}let l=0;for(let e of a){let t=e[0].length;for(let n=1;n<e.length;n++)t=Math.min(t,e[n].length);if(l+=t,l>Math.min(r.maxCandidateLength,r.maxCharacters)){let e=i.truncated?c().combination:void 0;if(!e)return{candidates:[],truncated:!0,attempts:0,scans:o};let t=hr(r),n={remaining:r.maxAttempts};return V(t,n,0)&&H(t,e),{candidates:[...t.candidates],truncated:!0,attempts:r.maxAttempts-n.remaining,scans:o}}}let u=1,d=0,f=i.truncated;for(let e of a){if(f)continue;let t=0;for(let n of e)if(t+=n.length,t>r.maxCharacters)break;let n=d*e.length,i=u*t;u>r.maxCandidates/e.length||u>r.maxAttempts/e.length||n>r.maxCharacters||i>r.maxCharacters-n?f=!0:(u*=e.length,d=n+i)}let p={remaining:r.maxAttempts};if(!f){let e=hr(r);return br(e,a,u,p),{candidates:[...e.candidates],truncated:!1,attempts:r.maxAttempts-p.remaining,scans:o}}let m=hr(r),h=a.map(e=>e[0]),g=a.flatMap((e,t)=>e.length>1?[t]:[]),_=c().combination;_&&V(m,p,0)&&H(m,_),V(m,p,0)&&H(m,h);let v=Math.min(an,Math.max(0,p.remaining));return e.length&&v>cn/e.length?{candidates:[...m.candidates],truncated:!0,attempts:r.maxAttempts-p.remaining,scans:o}:(gr(m,a,h,g,p),vr(m,a,h,g,p),_r(m,a,h,g,p),yr(m,a,h,g,p),br(m,a,r.maxAttempts,p,!0),{candidates:[...m.candidates],truncated:!0,attempts:r.maxAttempts-p.remaining,scans:o})}function fr(e,t,n){if(!t||e.some(e=>!e.length))return;let r=t!==t.toLowerCase(),i=B(t,r);if(!i||i.length>n.maxCandidateLength)return;let a=Math.min(n.maxCandidateLength,n.maxCharacters),o=Array.from({length:e.length+1},()=>0);for(let t=e.length-1;t>=0;t--){let n=e[t][0].length;for(let r=1;r<e[t].length;r++)n=Math.min(n,e[t][r].length);o[t]=o[t+1]+n}if(o[0]>a)return;let s=[],c=0,l=0;for(let t=0;t<e.length;t++){let n,u=l;for(let s of e[t]){if(c+s.length+o[t+1]>a)continue;let e=mr(i,l,B(s,r)),d=e>l,f=u>l;(n===void 0||d&&!f||d===f&&(s.length<n.length||s.length===n.length&&e>u))&&(n=s,u=e)}if(n===void 0)return;s.push(n),c+=n.length,l=u}if(l<i.length)return;let u=s.join(``);if(On(i,B(u,r),u,0))return s}function pr(e,t,n,r){let i=Jn(r),a=e=>({combination:e,scans:i.initial-i.remaining});if(!t)return a();let o=t!==t.toLowerCase(),s=B(t,o);if(!s||s.length>n.maxCandidateLength)return a();let c=Math.min(n.maxCandidateLength,n.maxCharacters),l=[{characters:0,choice:``,matched:0}],u=0,d=0;for(let t of e){let e=new Map,n=new Set;for(let r of sr(t,c,i)){if(n.has(r))continue;n.add(r);let t={normalized:B(r,o),raw:r};for(let n of l){if(d++,u+=t.normalized.length,d>an||u>cn)return a();let r=n.characters+t.raw.length;if(r>c)continue;let i=mr(s,n.matched,t.normalized),o=e.get(i);o&&o.characters<=r||e.set(i,{characters:r,choice:t.raw,matched:i,previous:n})}}if(!e.size)return a();let r=1/0;l=[...e.values()].sort((e,t)=>t.matched-e.matched||e.characters-t.characters).filter(e=>e.characters>=r?!1:(r=e.characters,!0))}let f=l.find(e=>e.matched===s.length);if(!f)return a();let p=Array.from({length:e.length},()=>``),m=f;for(let t=e.length-1;t>=0;t--)p[t]=m.choice,m=m.previous;let h=p.join(``);return On(s,B(h,o),h,0)?a(p):a()}function mr(e,t,n){for(let r=0;r<n.length&&t<e.length;r++)n[r]===e[t]&&t++;return t}function hr(e){return{candidates:new Set,characters:0,maxCandidateLength:e.maxCandidateLength,maxCandidates:e.maxCandidates,maxCharacters:e.maxCharacters}}function V(e,t,n){return n>=an||t.remaining<=0||e.candidates.size>=e.maxCandidates||e.characters>=e.maxCharacters?!1:(t.remaining--,!0)}function gr(e,t,n,r,i){let a=0;for(let o of r){if(!V(e,i,a))return;a++;let r=n.slice();r[o]=t[o].at(-1),H(e,r)}}function _r(e,t,n,r,i){let a=0;for(let o=0;o<r.length;o++)for(let s=o+1;s<r.length;s++){if(!V(e,i,a))return;a++;let c=r[o],l=r[s],u=n.slice();u[c]=t[c].at(-1),u[l]=t[l].at(-1),H(e,u)}}function vr(e,t,n,r,i){let a=0;for(let o of r)for(let r=1;r<t[o].length-1;r++){if(!V(e,i,a))return;a++;let s=n.slice();s[o]=t[o][r],H(e,s)}}function yr(e,t,n,r,i){let a=0;for(let o=0;o<r.length;o++)for(let s=o+1;s<r.length;s++){let c=r[o],l=r[s];for(let r=1;r<t[c].length;r++)for(let o=1;o<t[l].length;o++){if(r===t[c].length-1&&o===t[l].length-1)continue;if(!V(e,i,a))return;a++;let s=n.slice();s[c]=t[c][r],s[l]=t[l][o],H(e,s)}}}function br(e,t,n,r,i=!1){if(!t.length){V(e,r,0)&&H(e,[``]);return}let a=t.map(()=>0),o=t.flatMap((e,t)=>e.length>1?[t]:[]),s=()=>{let e=o.length-1;for(;e>=0;){let n=o[e];if(a[n]++,a[n]<t[n].length)return!0;a[n]=0,e--}return!1};if(i&&!s())return;let c=Math.min(n,an);for(let n=0;n<c;n++){if(!V(e,r,n))return;if(H(e,t.map((e,t)=>e[a[t]])),!s())break}}function H(e,t){let n=e.maxCharacters-e.characters,r=0;for(let i of t)if(r+=i.length,r>Math.min(e.maxCandidateLength,n))return;let i=t.join(``);e.candidates.has(i)||e.candidates.size===e.maxCandidates||e.characters+i.length>e.maxCharacters||(e.candidates.add(i),e.characters+=i.length)}function xr(e,t,n=!0){let r=t,i=t,a=/[^\s>"'`;]/;for(;r&&a.test(e.charAt(r-1));)--r;for(;i<e.length&&a.test(e.charAt(i));)++i;if(n)return{content:e.slice(r,i),start:r,end:i};let o=Ar(e,t),s=o?.key.toLowerCase();if(o&&(s?.endsWith(`class`)||s?.endsWith(`classname`)))return r=Math.max(r,o.valueStart),{content:e.slice(r,i),start:r,end:i};let c=e.slice(0,r).trimEnd();if(/(?:^|[\s;{])@apply$/.test(c))return{content:e.slice(r,i),start:r,end:i}}const Sr=new Set(`a abbr address area article aside audio b base bdi bdo blockquote body br button canvas caption cite code col colgroup data datalist dd del details dfn dialog div dl dt em embed fieldset figcaption figure footer form h1 h2 h3 h4 h5 h6 head header hgroup hr html i iframe img input ins kbd label legend li link main map mark menu meta meter nav noscript object ol optgroup option output p picture pre progress q rp rt ruby s samp script search section select slot small source span strong style sub summary sup table tbody td template textarea tfoot th thead time title tr track u ul var video wbr svg`.split(` `)),Cr=new Set(`=([{,:;!?&|>~`);function wr(e){return e>=65&&e<=90||e>=97&&e<=122}function Tr(e){return wr(e)||e===95}function Er(e){return Tr(e)||e>=48&&e<=57||e===36||e===45||e===46||e===58}function Dr(e,t,n){let r=t-n.length;return r<0||e.slice(r,t)!==n?!1:r===0||!Er(e.charCodeAt(r-1))}function Or(e,t,n,r){if(Sr.has(n.toLowerCase())||n.includes(`-`)||r&&n.charCodeAt(0)>=65&&n.charCodeAt(0)<=90)return!0;let i=t-1;for(;i>=0&&/\s/.test(e.charAt(i));)i--;return i<0||Cr.has(e.charAt(i))?!0:Dr(e,i+1,`return`)}function kr(e){let t,n=!1,r,i=0,a=0;for(;a<e.length;){if(t){let o=e.charAt(a);r?o===`\\`?a++:o===r&&(r=void 0):o===`"`||o===`'`?r=o:o===`{`?i++:o===`}`?i>0&&i--:o===`>`&&i===0&&(t=void 0,n=!0),a++;continue}if(e.charAt(a)===`;`&&(n=!1),e.charCodeAt(a)!==60){a++;continue}let o=a++;if(!Tr(e.charCodeAt(a)))continue;let s=a;for(;a<e.length&&Er(e.charCodeAt(a));)a++;if(a<e.length&&!/[\s/>]/.test(e.charAt(a)))continue;let c=e.slice(s,a);Or(e,o,c,n)&&(t={name:c,start:o},i=0)}return t}function Ar(e,t){let n=e.substring(0,t),r=kr(n);if(!r)return;let i=r.start+1,a=n.slice(i),o=-1,s=-1,c=-1,l=-1,u=-1,d=-1,f;for(let e=0;e<a.length;e++){let t=a.charAt(e);if(f){t===`\\`?e++:t===f&&(f=void 0);continue}if(t===`"`||t===`'`){f=t,o<0&&(o=e);continue}if(/\s/.test(t)){o>=0&&(s=o,c=e,o=-1);continue}if(t===`=`){let t=o>=0?o:s,n=o>=0?e:c;t>=0&&n>t&&t>=l&&(l=t,u=n,d=e)}o<0&&(o=e)}if(l<0)return;let p=d+1;for(;/\s/.test(a.charAt(p));)p++;let m=a.charAt(p);if(m===`"`||m===`'`){p++;for(let e=p;e<a.length;e++){let t=a.charAt(e);if(t===`\\`)e++;else if(t===m)return}}else if(/[\s>]/.test(a.slice(p)))return;return{key:a.slice(l,u),valueStart:i+p}}function jr(e,t){return Ar(e,t)?.key}const U=1e3,Mr=6e5,Nr=5e7,Pr=6e4,Fr=3e5,Ir=5e4,Lr=2e5,Rr=5e3,W={...L,maxAttempts:15e3,maxCandidates:15e3,maxCharacters:6e5,maxScans:3e5};function zr(){return{active:0,waiters:[]}}function Br(e){return e>=48&&e<=57}function Vr(e){for(let t=0;t<e.length;t++)if(Br(e.charCodeAt(t)))return!0;return!1}function Hr(e,t){let n=0,r=0;for(;n<e.length&&r<t.length;){let i=e.charCodeAt(n),a=t.charCodeAt(r),o=Br(i),s=Br(a);if(o&&s){let i=n+1,a=r+1;for(;i<e.length&&Br(e.charCodeAt(i));)i++;for(;a<t.length&&Br(t.charCodeAt(a));)a++;let o=n,s=r;for(;o<i-1&&e.charCodeAt(o)===48;)o++;for(;s<a-1&&t.charCodeAt(s)===48;)s++;let c=i-o,l=a-s;if(c!==l)return c<l?-1:1;for(;o<i;){let n=e.charCodeAt(o)-t.charCodeAt(s);if(n)return n<0?-1:1;o++,s++}n=i,r=a;continue}if(i!==a)return i<a?-1:1;n++,r++}return n!==e.length||r!==t.length?n===e.length?-1:1:0}function Ur(e,t){let n=Vr(e);return n===Vr(t)?Hr(e,t)||(e===t?0:e<t?-1:1):n?1:-1}function Wr(e,t=Fr,n=Nr){return{attempts:0,heap:[],limit:e,maxAttempts:t,maxScannedCharacters:n,retained:new Set,scannedCharacters:0}}function Gr(e){return e.attempts<e.maxAttempts&&e.scannedCharacters<e.maxScannedCharacters}function Kr(e,t){return Gr(e)?(e.attempts++,!t||e.retained.has(t)||t.length>Pr||t.length>e.maxScannedCharacters-e.scannedCharacters?!0:(e.scannedCharacters+=t.length,qr(e,t),!0)):!1}function qr(e,t){if(!(!t||e.retained.has(t)||t.length>Pr)){if(e.heap.length<e.limit){e.heap.push(t),e.retained.add(t),Jr(e.heap,e.heap.length-1);return}Ur(t,e.heap[0])>=0||(e.retained.delete(e.heap[0]),e.heap[0]=t,e.retained.add(t),Yr(e.heap,0))}}function Jr(e,t){let n=t;for(;n>0;){let t=Math.floor((n-1)/2);if(Ur(e[t],e[n])>=0)return;[e[t],e[n]]=[e[n],e[t]],n=t}}function Yr(e,t){let n=t;for(;;){let t=n*2+1;if(t>=e.length)return;let r=t+1,i=r<e.length&&Ur(e[r],e[t])>0?r:t;if(Ur(e[n],e[i])>=0)return;[e[n],e[i]]=[e[i],e[n]],n=i}}function Xr(e){let t=[],n=0;for(let r of e.heap.sort(Ur))n+r.length>Mr||(t.push(r),n+=r.length);return t}function Zr(e,t,n,r){return Math.floor((t+n)*e/r)-Math.floor(t*e/r)}function*Qr(e){let t=e.filter(e=>e.length).map(e=>({index:0,source:e})),n=0;for(;t.length;){let e=t[n];yield e.source[e.index++],e.index===e.source.length?t.splice(n,1):n++,n===t.length&&(n=0)}}function*$r(e,t,n,r,i,a){for(;n.attempts<r&&n.characters<i;){let r=e.next();if(r.done)return;let o=r.value;n.attempts++,!(!o||t.has(o)||o.length>a||o.length>i-n.characters)&&(t.add(o),n.characters+=o.length,yield o)}}function ei(e){let t=``;for(let n of e.parts){if(n.type!==`static`)break;t+=n.value}return t}function ti(e,t){if(!t)return{priorityCount:0,templates:[...e]};let n=t.replace(/-/g,``),r=[],i=[];for(let a=0;a<e.length;a++){let o=e[a],s=ei(o),c=s.replace(/-/g,``),l=-1;s&&t.startsWith(s)?l=0:c&&n.startsWith(c)?l=1:s.startsWith(t)?l=2:c.startsWith(n)&&(l=3),l<0?i.push(o):r.push({category:l,index:a,parsed:o,prefixLength:l<2?l?c.length:s.length:0})}return r.sort((e,t)=>e.category-t.category||t.prefixLength-e.prefixLength||e.index-t.index),{priorityCount:r.length,templates:[...r.map(({parsed:e})=>e),...i]}}function ni(e,t){return e.length<=t?[...e]:t<=0?[]:t===1?[e[0]]:Array.from({length:t},(n,r)=>e[Math.floor(r*(e.length-1)/(t-1))])}async function ri(e,t,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{r[t]=await n(e[t])}catch(e){throw a=!0,e}}});return await Promise.all(o),r}function ii(e,t=U){let n=Wr(t);for(let t of e)if(!Kr(n,t))break;return Xr(n)}function ai(e,t){let n=[],r=new Set,i=0,a=0;for(let o of e)if(o.startsWith(t)){if(i===Fr||n.length===U||a>=Mr)break;i++,!(!o||r.has(o)||o.length>Pr||a+o.length>Mr)&&(r.add(o),n.push(o),a+=o.length)}return n}function oi(e,t={}){let n=new Map,r=new tn({max:Rr,maxSize:32e6,sizeCalculation:(e,t)=>Math.max(1,t.length*2+e.reduce((e,t)=>e+t.length*2+8,0))}),i=new Map,a=e.config,o=0,s=[],c,l,u=[],d=0,f=new Set,p=new Set,m=[],h=new Map,g=new Set,_=zr(),{matchType:v=`prefix`,throwErrors:y=!0}=t;return le(),{suggest:S,suggestInFile:w,templates:m,cache:r,errorCache:i,reset:le,enumerate:b};async function b(){let e=Array.from(`abcdefghijklmnopqrstuvwxyz`),t=[...e,`-`],n=e.flatMap(e=>[e,...t.map(t=>`${e}${t}`)]);for(;;){ue();let e=a,t=o,r=new Set;if(await x(n,r,e,t,e=>e)&&await x([...r].filter(e=>/^\w+$/.test(e)&&e.length>3),r,e,t,e=>`${e}-`))return r}}async function x(e,t,n,r,i){for(let a=0;a<e.length;a+=128){let o=await de(Promise.all(e.slice(a,a+128).map(e=>S(i(e)))),n,r);if(o.stale)return!1;for(let e of o.value)for(let n of e)t.add(n)}return!0}async function S(e,t=!1){if(ue(),!t&&e.length<1)return[];if(r.has(e))return r.get(e);let n=h.get(e);if(n)return n;let i=C(e,t);h.set(e,i);try{return await i}finally{h.get(e)===i&&h.delete(e)}}async function C(t,n){for(;;){ue();let i=a,s=o;if(!n&&t.length<1)return[];if(r.has(t))return r.get(t);let c=i.presets.find(e=>e.name===`@teacss/preset-attributify`)?.options?.prefix,l=c?t.startsWith(c)?t.slice(c.length):t.replace(`:${c}`,`:`):t,u=await de(e.matchVariants(l),i,s);if(u.stale)continue;let d=await de(Promise.all(u.value.map(async([,e])=>{let n=e?t.indexOf(e):t.length;n===-1&&(n=0);let r=t.slice(0,n),a=t.slice(n+e.length),o=v===`fuzzy`?[E(e,i,s),ne(e,i,s),te(e),ee(e)]:[E(e,i,s),ee(e),te(e),ne(e,i,s)];return fe(await Promise.all(o),r,a)})),i,s);if(d.stale)continue;let f=d.value.flat();if(f=v===`fuzzy`?ie(z(f,t,{maxCandidates:W.maxCandidates,maxCharacters:W.maxCharacters}),t):ii(f),!N(i,s))return r.set(t,f),f}}async function w(e,t){ue();let n=a,r=o,i=jr(e,t)!==void 0,s=await de(T(e,t,n),n,r);if(s.stale)return w(e,t);let c=s.value;if(c){let a=await S(c.extracted,i);if(N(n,r))return w(e,t);let o=c.transformSuggestions?c.transformSuggestions(a):a;return{suggestions:a.map((e,t)=>[e,o[t]]),resolveReplacement:c.resolveReplacement}}let l=xr(e,t,n.presets.some(e=>e.name===`@teacss/preset-attributify`));if(!l)return;let u=await S(l.content,i);return N(n,r)?w(e,t):{suggestions:u.map(e=>[e,e]),resolveReplacement:e=>({start:l.start,end:l.end,replacement:e})}}async function T(e,t,n){if(!n.autocomplete.extractors.length)return null;for(let r of n.autocomplete.extractors){let n=await r.extract({content:e,cursor:t});if(n)return n}return null}async function E(t,n,r){let i=await e.parseToken(t,`-`);return i&&!N(n,r)&&(p.delete(t),p.add(t),p.size>Rr&&p.delete(p.values().next().value)),i?[t]:[]}async function ee(e){if(v===`fuzzy`){let t=ae(),n=ie(u,e,t,d),r=z(j(),e,{maxAttempts:Fr,maxCandidates:750,maxCharacters:6e4});return z([...n,...r],e,{maxCandidates:U,maxCharacters:W.maxCharacters})}return c??=[...s].sort(Ur),ai(c,e)}async function te(t){return ii(n());function*n(){for(let e of p)e.startsWith(t)&&(yield e);for(let[n,r]of e.cache){if(!r)continue;let e=n.replace(/ -$/,``);e.startsWith(t)&&(yield e)}}}async function ne(e,t,n){let r=m.filter(e=>typeof e==`function`);if(v!==`fuzzy`){let i=se(e),a=await D(r,e,t,n);return[...i,...a]}let i=ce(e),a=await O(r,e,t,n);return[...i,...a]}async function D(e,t,n,r){if(!e.length)return[];let i=Wr(U),a=Wr(U);for(let o=0;o<e.length;o+=8){let s=await ri(e.slice(o,o+8),8,e=>k(e,t,n,r));if(N(n,r))return[];let c=Zr(Fr,o,s.length,e.length),l=Zr(Nr,o,s.length,e.length),u=Wr(U,c,l),d=Qr(s.filter(e=>!!e?.length));for(;Gr(u);){let e=d.next();if(e.done)break;Kr(u,e.value)}for(let e of Xr(u))qr(i,e);let f=Wr(U,c,l);for(;Gr(f);){let e=d.next();if(e.done)break;Kr(f,e.value)}for(let e of Xr(f))qr(i,e);for(;Gr(a);){let e=d.next();if(e.done)break;Kr(a,e.value)}}for(let e of Xr(a))qr(i,e);return Xr(i)}async function O(e,t,n,r){if(!e.length)return[];let i=[],a=new Set,o={attempts:0,characters:0};for(let s=0;s<e.length;s+=32){let c=await ri(e.slice(s,s+32),32,e=>k(e,t,n,r));if(N(n,r))return[];let l=Qr(c.filter(e=>!!e?.length)),u=Zr(Fr,s,c.length,e.length),d=Zr(L.maxScannedCharacters,s,c.length,e.length),f=z(l,t,{maxAttempts:u,maxCandidates:U,maxCharacters:W.maxCharacters,maxScannedCharacters:d});i=z([...i,...f],t,{maxAttempts:i.length+f.length,maxCandidates:U,maxCharacters:W.maxCharacters});let p=z($r(l,a,{attempts:0,characters:0},u,d,L.maxCandidateLength),t,{maxAttempts:u,maxCandidates:750,maxCharacters:W.maxCharacters,maxScannedCharacters:d});i=z([...i,...p],t,{maxAttempts:i.length+p.length,maxCandidates:U,maxCharacters:W.maxCharacters});let m=z($r(l,a,{attempts:0,characters:0},u,d,L.maxCandidateLength),t,{maxAttempts:u,maxCandidates:750,maxCharacters:W.maxCharacters,maxScannedCharacters:d});i=z([...i,...m],t,{maxAttempts:i.length+m.length,maxCandidates:U,maxCharacters:W.maxCharacters});let h=z($r(l,a,o,Fr,L.maxScannedCharacters,L.maxCandidateLength),t,{maxAttempts:Fr-o.attempts,maxCandidates:750,maxCharacters:W.maxCharacters,maxScannedCharacters:L.maxScannedCharacters-o.characters});i=z([...i,...h],t,{maxAttempts:i.length+h.length,maxCandidates:U,maxCharacters:W.maxCharacters})}return i}async function k(e,t,n,r){let i=_;await A(i);try{if(N(n,r))return;try{return await e(t)}catch{return}}finally{re(i)}}async function A(e){if(e.active<128){e.active++;return}await new Promise(t=>e.waiters.push(t))}function re(e){let t=e.waiters.shift();t?t():e.active--}function ie(e,t,n,r){return Dn(t,r??e.reduce((e,t)=>e+t.length,0))?z(e,t,{maxCandidates:U,maxCharacters:W.maxCharacters}):(n??new Wt(e,{fuzzy:`v1`,limit:U,tiebreakers:[Ut,Ht]})).find(t).map(e=>e.item)}function ae(){if(l)return l;let e=new Set,t=0,n=0,r=n=>!n||e.has(n)||n.length>W.maxCandidateLength||e.size===W.maxCandidates||t+n.length>W.maxCharacters?!1:(e.add(n),t+=n.length,!0),i=0;for(;i<s.length&&n<W.maxAttempts&&e.size<W.maxCandidates&&t<W.maxCharacters;){let e=s[i++];n++,r(e)&&f.add(e)}return u=[...e],d=t,l=new Wt(u,{fuzzy:`v1`,limit:U,tiebreakers:[Ut,Ht]}),l}function*j(){for(let e of s)f.has(e)||(yield e)}function se(e){let t=Wr(U),r=0,i=0,a=0,o=ti([...n.values()],e).templates.slice(0,Ir);for(let n=0;n<o.length;n++){let s=Fr-r,c=Nr-i,l=Lr-a;if(c<=0||s<=0||l<=0||!Gr(t))break;let u=o.length-n,d=Math.max(1,Math.floor(s/u)),f=gn(o[n],e,{maxAttempts:d,maxCandidateLength:Pr,maxCandidates:d,maxCharacters:Math.max(1,Math.floor(c/u)),maxScans:Math.max(1,Math.floor(l/u))});r+=f.attempts,i+=f.characters,a+=f.scans;for(let e of f.suggestions)if(!Kr(t,e))break}return Xr(t)}function ce(e){let t=[],r=new Set,i=0,a=0,o=0,s=0,c=ti([...n.values()],e).templates.slice(0,Ir),l=e=>{!e||r.has(e)||e.length>L.maxCandidateLength||o>=W.maxCandidates||i+e.length>W.maxCharacters||(r.add(e),t.push(e),o++,i+=e.length)},u=0;for(let t of z(f(),e,{maxAttempts:Ir,maxCandidates:750,maxCharacters:W.maxCharacters}))l(t);let d=ni(c,Math.max(1,Math.floor(Math.min(W.maxAttempts,W.maxCandidates-o)/2)));for(let t=0;t<d.length;t++){let n=W.maxAttempts-a,r=W.maxCandidates-o,c=W.maxCharacters-i,u=W.maxScans-s;if(n<=0||r<=0||c<=0||u<=0)break;let f=d.length-t,p={maxAttempts:Math.max(2,Math.floor(n/f)),maxCandidates:Math.max(2,Math.floor(r/f)),maxCharacters:Math.max(1,Math.floor(c/f)),maxScans:Math.max(1,Math.floor(u/f))},m;if(e.length<=1){let n=gn(d[t],e,p);m=n.suggestions,a+=n.attempts,s+=n.scans}else{let n=dr(d[t].parts,p,e);m=n.candidates,a+=n.attempts,s+=n.scans}for(let e of m)l(e)}return z(t,e,{maxAttempts:W.maxAttempts,maxCandidates:750,maxCharacters:W.maxCharacters});function*f(){for(let t=0;t<c.length;t++){let n=Lr-u;if(n<=0)return;let r=c.length-t,i=(e.length<=1?gn:hn)(c[t],e,{maxAttempts:1,maxCandidates:1,maxCharacters:L.maxCandidateLength,maxScans:Math.max(1,Math.floor(n/r))});u+=i.scans,yield*i.suggestions}}}function le(){let t=e.config,v=[...Object.keys(t.rulesStaticMap),...t.shortcuts.filter(e=>typeof e[0]==`string`).map(e=>e[0])],b=[...t.autocomplete.templates||[],...t.rulesDynamic.flatMap(e=>M(e?.[2]?.autocomplete||[])),...t.shortcuts.flatMap(e=>M(e?.[2]?.autocomplete||[])),...t.variants.flatMap(e=>M(e.autocomplete||[]))],x=new Map,S=new Map;for(let e of b)if(typeof e!=`function`){if(x.has(e)||S.has(e))continue;let n=xn(e,t.theme,t.autocomplete.shorthands);n.errors.length&&S.set(e,n.errors),x.set(e,n)}if(S.size&&y){i.clear();for(let[e,t]of S)i.set(e,t);let e=Array.from(S.values()).flat().map(e=>e.toString()).join(`
9
- `);throw Error(e)}o++;for(let e of[...g])e();a=t,s=v,c=void 0,m.length=0,m.push(...b),n.clear();for(let[e,t]of x)n.set(e,t);r.clear(),h.clear(),_=zr(),i.clear();for(let[e,t]of S)i.set(e,t);l=void 0,u=[],d=0,f.clear(),p.clear()}function ue(){a!==e.config&&le()}function N(t,n){return t!==e.config||n!==o}function de(t,n,r){return new Promise((i,a)=>{let o=!1,s=e=>{o||(o=!0,l(),g.delete(c),i(e))},c=()=>s({stale:!0}),l=e.events.on(`config`,e=>{e!==n&&c()});g.add(c),Promise.resolve(t).then(e=>s({stale:!1,value:e}),e=>{o||(o=!0,l(),g.delete(c),a(e))}),N(n,r)&&c()})}function fe(t,n=``,r=``){let i=oe(t.flat()).filter(t=>!!(t&&!t.endsWith(`-`)&&!e.isBlocked(t)&&!e.isBlocked(n+t+r)));v!==`fuzzy`&&i.sort(Ur);let a=i.map(e=>n+e+r);return v===`fuzzy`?a:ii(a)}}function G(e){try{return g(e)}catch{try{let t=new URL(e);return t.protocol===`file:`?e:decodeURIComponent(t.pathname.replace(/^\/([a-z]:)/i,`$1`))}catch{return e}}}const si=/<style[^>]*>[\s\S]*?(?:<\/style>|<\/>|$)/g,ci=/(?:<\/style>|<\/>)$/,li=/<template\b[^>]*\slang\s*=\s*(?:'pug'|"pug")[^>]*>/i;function ui(e,t,n){let r=t.match(/\.(svelte|vue|astro|marko)$/);if(r&&di(e,t)){let t=e.slice(0,n);if(/\.$/.test(t)||/\.\S+$/.test(t))return!0}if((r?[...e.matchAll(si)].some(t=>{let r=t.index,i=r+t[0].length,a=i===e.length&&!ci.test(t[0]);return n>r&&(n<i||a&&n===i)}):/\.(?:css|scss|sass|less|styl(?:us)?|pcss|postcss)$/i.test(t))||jr(e,n)!==void 0)return!0;let i=e.slice(n).replace(/"[^"]*"|\{[^}]*\}|'[^']*'/g,``);return/^[^<>]*>/.test(i)}function di(e,t){return t.endsWith(`.vue`)&&li.test(e)}function fi(e,t){let n=u.relative(e,t);return n!==``&&n!==`..`&&!n.startsWith(`..${u.sep}`)&&!u.isAbsolute(n)}const pi={log(){},warn(){}},mi=/[\\/](?:node_modules|dist|\.temp|\.cache)[\\/]/;var hi=class{cwd;logger;ready;contextsMap=new Map;configSources=[];fileContextCache=new Map;configExistsCache=new Map;loadingContexts=new Map;contextLoadVersions=new Map;contextReloadDisposers=new Map;failedConfigSources=new Map;discoveredConfigs=new Set;yarnPnpSetupFailures=new Set;lifecycleVersion=0;workspaceRoots;events=me();constructor(e,t=pi,n=[e]){this.cwd=e,this.logger=t,this.workspaceRoots=Array.from(new Set(n.length?n:[e])),this.ready=this.reload()}log(e){this.logger.log(e)}warn(e){this.logger.warn(e)}isTarget(e){return Array.from(this.contextsMap.keys()).some(t=>fi(t,e))}get contexts(){return Array.from(new Set(this.contextsMap.values())).filter(ve)}async setRoots(e){let t=Array.from(new Set(e)),n=Array.from(this.contextsMap.keys()),r=this.workspaceRoots.length===t.length&&t.every(e=>this.workspaceRoots.includes(e)),i=n.length===t.length&&t.every(e=>n.includes(e));if(r&&i)return;let a=++this.lifecycleVersion;this.workspaceRoots=t;for(let e of n)t.includes(e)||this.removeContext(e,`contextUnload`,!0);a===this.lifecycleVersion&&(this.resetCaches(),await this.loadRoots(t.filter(e=>!n.includes(e)),a),a===this.lifecycleVersion&&this.events.emit(`reload`))}async reload(){let e=++this.lifecycleVersion,t=Array.from(this.contextsMap.keys()),n=t.length?t:this.workspaceRoots;for(let e of t)this.removeContext(e,`contextUnload`,!1);e===this.lifecycleVersion&&(this.resetCaches(),await this.loadRoots(n,e),e===this.lifecycleVersion&&this.events.emit(`reload`))}async unloadContext(e){this.removeContext(e,`contextUnload`,!0)}async unload(e){this.removeContext(e,`unload`,!0)}removeContext(e,t,n){n&&(this.contextLoadVersions.set(e,(this.contextLoadVersions.get(e)??0)+1),this.loadingContexts.delete(e));let r=this.contextsMap.get(e);r!==void 0&&(this.contextsMap.delete(e),this.failedConfigSources.delete(e),this.syncConfigSources(),r&&(this.disposeContextReload(r),this.clearFileContextCache(r),this.events.emit(t,r),t===`contextUnload`&&this.events.emit(`reload`)))}syncConfigSources(){let e=this.contexts.flatMap(e=>e.getConfigFileList()),t=Array.from(this.failedConfigSources.values()).flat(),n=Array.from(new Set([...e,...t]));this.configSources.splice(0,this.configSources.length,...n)}clearFileContextCache(e){for(let[t,n]of this.fileContextCache)n===e&&this.fileContextCache.delete(t)}resetCaches(){this.fileContextCache.clear(),this.configExistsCache.clear()}releaseDocument(e){this.fileContextCache.delete(e),this.invalidateConfigSearchPath(e)}invalidateConfigSearchPath(e){let t=u.dirname(e),n=this.getWorkspaceBoundary(t);if(n)for(;t===n||fi(n,t);){if(this.configExistsCache.delete(t),t===n)return;t=u.dirname(t)}}async loadRoots(e,t){let n=e.map(e=>({dir:e,loadVersion:this.contextLoadVersions.get(e)??0}));await Promise.all(n.map(async({dir:e,loadVersion:n})=>{try{await this.loadContextInDirectoryWithVersion(e,t,n)}catch(n){if(t!==this.lifecycleVersion)return;this.warn(`⚠️ Failed to reload context for ${e}: ${String(n.stack??n)}`)}}))}async loadContextInDirectory(e){return this.loadContextInDirectoryWithVersion(e,void 0,this.contextLoadVersions.get(e)??0)}async loadContextInDirectoryWithVersion(e,t,n){if(!this.isLoadCurrent(e,t,n))return;let r=this.contextsMap.get(e);if(r!==void 0)return r;let i=this.loadingContexts.get(e);if(i&&i.lifecycleVersion===t&&i.loadVersion===n)return i.promise;let a=this.loadContext(e,t,n);this.loadingContexts.set(e,{lifecycleVersion:t,loadVersion:n,promise:a});try{return await a}finally{this.loadingContexts.get(e)?.promise===a&&this.loadingContexts.delete(e)}}async loadContext(e,t,n){this.setupYarnPnp(e),this.discoveredConfigs.has(e)||this.log(`🛠 Resolving config for ${e}`);let r=h(e,{},e=>{e.config.details=!0}),i=[];try{i=(await r.updateRoot(e)).sources}catch(i){return this.isLoadCurrent(e,t,n)?(this.warn(`⚠️ Error on loading config. Config directory: ${e}`),this.warn(String(i.stack??i)),this.failedConfigSources.set(e,r.getConfigFileList()),this.finishLoading(e,null,t,n)):void 0}if(!this.isLoadCurrent(e,t,n))return;if(this.failedConfigSources.delete(e),!i.length)return this.log(`ℹ️ No config sources found in ${e}`),this.finishLoading(e,null,t,n);if(await r.ready,!this.isLoadCurrent(e,t,n))return;this.setupContextReload(r),this.logConfigInfo(i,r.generator);let a=this.finishLoading(e,r,t,n);return this.events.emit(`contextLoaded`,r),a}setupYarnPnp(e){for(let t of[`.pnp.js`,`.pnp.cjs`]){let n=u.join(e,t);if(l(n))try{j(n).setup(),this.yarnPnpSetupFailures.delete(n)}catch(e){if(this.yarnPnpSetupFailures.has(n))continue;this.yarnPnpSetupFailures.add(n);let t=e instanceof Error?e.message:String(e);this.warn(`⚠️ Failed to setup Yarn PnP from ${n}: ${t}`)}}}setupContextReload(e){this.disposeContextReload(e);let t=e.onReload(()=>{for(let[t,n]of this.fileContextCache)(n===e||!n)&&this.fileContextCache.delete(t);this.configExistsCache.clear(),this.syncConfigSources(),this.events.emit(`contextReload`,e)});this.contextReloadDisposers.set(e,t);for(let[e,t]of this.fileContextCache)t||this.fileContextCache.delete(e)}disposeContextReload(e){this.contextReloadDisposers.get(e)?.(),this.contextReloadDisposers.delete(e)}isLoadCurrent(e,t,n){return(t===void 0||t===this.lifecycleVersion)&&n===(this.contextLoadVersions.get(e)??0)}logConfigInfo(e,t){let n=e.length===1?e[0]:`\n${e.map(e=>` - ${e}`).join(`
10
- `)}`;this.log(`🛠 New configuration loaded from ${n}`),this.log(`ℹ️ ${t.config.presets.length} presets, ${t.config.rulesSize} rules, ${t.config.shortcuts.length} shortcuts, ${t.config.variants.length} variants, ${t.config.transformers?.length||0} transformers loaded`)}finishLoading(e,t,n,r){if(!this.isLoadCurrent(e,n,r))return;this.contextsMap.has(e)||this.contextsMap.set(e,t),this.syncConfigSources(),this.fileContextCache.clear(),this.events.emit(`reload`);let i=Array.from(this.contextsMap.entries()).filter(([,e])=>e).map(([e])=>e).join(`, `)||`[none]`;return this.log(`🗂️ Enabled context: ${i}`),t}async resolveClosestContext(e,t){if(mi.test(t))return;if(this.fileContextCache.has(t)){let e=this.fileContextCache.get(t);return P(this.fileContextCache,t,e,100),e}let n=await this.discoverAndLoadConfig(t);if(n)return n;let r=Array.from(this.contextsMap.entries()).sort((e,t)=>t[0].length-e[0].length);for(let[n,i]of r)if(!(!i||!fi(n,t))&&(i.filter(e,t)||fe(t)))return P(this.fileContextCache,t,i,100),i;for(let[e,n]of r)if(n&&fi(e,t))return P(this.fileContextCache,t,n,100),n}async discoverAndLoadConfig(e){let t=this.lifecycleVersion,n=await this.findConfigDirectory(u.dirname(e),t);if(t!==this.lifecycleVersion||!n||this.contextsMap.has(n))return;this.discoveredConfigs.has(n)||(this.log(`🔍 Discovered config in ${n}`),this.discoveredConfigs.add(n));let r=this.contextLoadVersions.get(n)??0;if(await this.loadContextInDirectoryWithVersion(n,t,r),!this.isLoadCurrent(n,t,r))return;let i=this.contextsMap.get(n);return i&&P(this.fileContextCache,e,i,100),i}async findConfigDirectory(e,t){let n=this.configExistsCache.get(e);if(n!==void 0)return P(this.configExistsCache,e,n,100),n||void 0;let r=this.getWorkspaceBoundary(e);if(!r)return;let i=u.parse(e).root,a=[],o=e;for(;o!==i&&(fi(r,o)||o===r);){a.push(o);let e=this.configExistsCache.get(o);if(e!==void 0)return P(this.configExistsCache,o,e,100),this.cacheSearchPath(a,e||!1),e||void 0;let n=await this.hasConfigFiles(o);if(t!==this.lifecycleVersion)return;if(n)return this.cacheSearchPath(a,o),o;o=u.dirname(o)}this.cacheSearchPath(a,!1)}getWorkspaceBoundary(e){return[...this.workspaceRoots,...this.contextsMap.keys()].filter(t=>t===e||fi(t,e)).sort((e,t)=>t.length-e.length)[0]}async hasConfigFiles(e){return!!p(e)}cacheSearchPath(e,t){for(let n of e)P(this.configExistsCache,n,t,100)}};const gi={root:void 0,colorPreview:!1,remToPxPreview:!0,remToPxRatio:16,syntaxHighlight:!0,strictAnnotationMatch:!1,autocompleteMatchType:`prefix`,autocompleteStrict:!1,autocompleteMaxItems:1e3},_i=/^#(?:[0-9a-f]{3,8})$/i,vi=/^(?:rgb|rgba|hsl|hsla|hwb|oklch|oklab|lab|lch|device-cmyk|color)\(/i,yi=/^(?:media|supports|container)\b/;function bi(e={}){let t=new Set(Object.keys(e.colors??{})),n=new Set(Object.keys(e.breakpoint??e.breakpoints??{}));return{isColorValue(e){let n=e.trim();if(n.startsWith(`[`)&&n.endsWith(`]`)&&(n=n.slice(1,-1)),!n)return!1;if(n===`current`||n===`transparent`||_i.test(n)||vi.test(n))return!0;let r=n.split(`/`)[0].split(`-`)[0];return t.has(r)},isBreakpoint(e){if(yi.test(e))return!0;let t=e.replace(/^(?:max|min)-/,``).split(/[^a-z0-9]/i)[0];return n.has(t)}}}const xi=/(-?[\d.]+)rem(\s+!important)?;/;let Si;function Ci(e){return e.default??e}function wi(){return Si??=Promise.all([import(`prettier/standalone`),import(`prettier/parser-postcss`)]).then(([e,t])=>({prettier:Ci(e),parserCSS:Ci(t)}))}function Ti(e,t=16){if(!e)return``;if(t<1)return e;let n=0,r=[];for(;n<e.length;){let i=e.slice(n).match(xi);if(i?.index==null)break;let a=` /* ${Number.parseFloat(i[1])*t}px */`,o=n+i.index+i[0].length;r.push(e.slice(n,o)),r.push(a),n=o}return r.push(e.slice(n)),r.join(``)}async function Ei(e,t,n){let[r,{prettier:i,parserCSS:a}]=await Promise.all([e.generate(new Set(M(t)),{preflights:!1,safelist:!1}),wi()]),o=Ti(r.css,n),s=await i.format(o,{parser:`css`,plugins:[a]});return{...r,prettified:s}}async function Di(e,t,n){return`\`\`\`css\n${(await Ei(e,t,n)).prettified.trimEnd()}\n\`\`\``}const Oi=[`property`,`class`,`keyword`,`number`,`enumMember`,`string`,`operator`,`type`],ki=[`important`,`pseudoClass`,`pseudoElement`,`query`,`selector`,`variable`,`combinator`,`bracket`,`group`,`condition`],Ai=/^-?(?:\d+\.?\d*|\.\d+)[a-z%]*$/i,ji=/^[>+~_[&.#*: ]/,Mi=/^[>+~_.#]/;function Ni(e,t){return t?.isColorValue?.(e)?`enumMember`:e.startsWith(`[`)?`string`:Ai.test(e)?`number`:`keyword`}function Pi(e,t){return e.startsWith(`::`)?{type:`type`,modifier:`pseudoElement`,symbolLen:0}:Mi.test(e)?{type:`type`,modifier:`selector`,symbolLen:1}:ji.test(e)?{type:`type`,modifier:`selector`,symbolLen:0}:t?.isBreakpoint?.(e)?{type:`keyword`,modifier:`query`,symbolLen:0}:{type:`keyword`,modifier:`pseudoClass`,symbolLen:0}}function Fi(e,t,n,r){e.push({start:n,length:1,type:`operator`,modifiers:[`condition`]});let i=n+1,a=t;if(a.startsWith(`!`)&&(e.push({start:i,length:1,type:`operator`,modifiers:[`important`]}),i+=1,a=a.slice(1)),a.length){let{type:t,modifier:n,symbolLen:o}=Pi(a,r);o&&(e.push({start:i,length:o,type:`operator`,modifiers:[`combinator`]}),i+=o,a=a.slice(o)),a.length&&e.push({start:i,length:a.length,type:t,modifiers:[n]})}return n+t.length+1}function Ii(e,t,n){let r=-1,i=t=>{r>=0&&(e.push({start:n+r,length:t-r,type:`string`,modifiers:[]}),r=-1)};for(let a=0;a<t.length;a++){let o=t[a];o===`[`||o===`]`||o===`_`?(i(a),e.push({start:n+a,length:1,type:`operator`,modifiers:[`bracket`]})):r<0&&(r=a)}i(t.length)}function Li(e,t,n,r,i){let a=+!!t.startsWith(`$`);a&&e.push({start:n,length:1,type:`operator`,modifiers:[`variable`]});let o=t.slice(a);if(!o.length)return;if(r===`value`&&o.startsWith(`[`)){Ii(e,o,n+a);return}if(r===`value`&&a&&o.includes(`|`)){let t=o.indexOf(`|`),r=o.slice(0,t),s=o.slice(t+1);if(r.length&&e.push({start:n+a,length:r.length,type:Ni(r,i),modifiers:[]}),e.push({start:n+a+t,length:1,type:`operator`,modifiers:[`important`]}),s.length){let r=n+a+t+1;s.startsWith(`[`)?Ii(e,s,r):e.push({start:r,length:s.length,type:Ni(s,i),modifiers:[]})}return}let s=r===`property`?`property`:Ni(o,i);e.push({start:n+a,length:o.length,type:s,modifiers:[]})}function Ri(e,t,n){if(!e)return[];if(e.startsWith(`{`)&&e.includes(`}`))return Bi(e,t,n);let r=le(e),i=[];if(r.keyword)r.body.length&&(r.body.startsWith(`[`)?Ii(i,r.body,t):i.push({start:t,length:r.body.length,type:`class`,modifiers:[]}));else{let e=r.property??``,a=r.value??``;e.length&&Li(i,e,t,`property`,n),i.push({start:t+e.length,length:1,type:`operator`,modifiers:[]}),a.length&&Li(i,a,t+e.length+1,`value`,n)}let a=t+r.body.length;r.important&&(i.push({start:a,length:1,type:`operator`,modifiers:[`important`]}),a+=1);for(let e of r.conditions)a=Fi(i,e,a,n);return i}function zi(e,t,n){let r=0;for(let i=n;i<e.length;i++){let n=e[i];if(n===`\\`)i++;else if(n===`[`||n===`(`)r++;else if(n===`]`||n===`)`)r--;else if(n===t&&r<=0)return i}return-1}function Bi(e,t,n){let r=[],i=zi(e,`}`,0);r.push({start:t,length:1,type:`operator`,modifiers:[`group`]});let a=t+1,o=e.slice(1,i),s=[],c=0;for(;;){let e=zi(o,`;`,c);if(e===-1){s.push(o.slice(c));break}s.push(o.slice(c,e)),c=e+1}s.forEach((e,t)=>{if(t>0&&(r.push({start:a,length:1,type:`operator`,modifiers:[`group`]}),a+=1),e.length){for(let t of Ri(e,a,n))r.push(t);a+=e.length}}),r.push({start:t+i,length:1,type:`operator`,modifiers:[`group`]});let l=t+i+1,u=e.slice(i+1);if(u.startsWith(`!`)&&(r.push({start:l,length:1,type:`operator`,modifiers:[`important`]}),l+=1,u=u.slice(1)),u.startsWith(`@`))for(let e of u.slice(1).split(`@`))l=Fi(r,e,l,n);return r}w([T,E,ee,te,ne,D]);const Vi=/var\((?<cssVarName>--[^,|)]+)(?:,(?<fallback>[^)]+))?\)/g,Hi=String.raw`(?:#|0x)(?:[a-f0-9]{3}|[a-f0-9]{4}|[a-f0-9]{6}|[a-f0-9]{8})\b|(?:rgb|rgba|hsl|hsla|hwb|oklch|oklab|lab|lch|device-cmyk|color)\([^)]*\)`,Ui=new RegExp(Hi,`g`),Wi=/var\((--[^,|)]+)(?:,([^)]+))?\)/,Gi=String.raw`(?:^|[;{]\s*)(?:[\w-]+-color|color|fill|stroke)\s*:\s*(?<value>[^;}{]+)`,Ki=new RegExp(Gi,`gm`),qi=/(?:^|[;{])\s*--[^\s:;{}]+\s*:/m,Ji=new RegExp(Hi,`i`),Yi=new RegExp(Gi,`m`),Xi=new RegExp(String.raw`color-mix\([^,]+,\s*(?<color>${Hi})\s+(?<weight>\d+(?:\.\d+)?%)\s*,\s*transparent\s*\)`,`i`);function Zi(e){return qi.test(e)||Yi.test(e)||Qi(e)}function Qi(e){return Ji.test(e)}function $i(e){let t=/(?:^|[;{])\s*(?<key>--[^\s:;{}]+)\s*:\s*(?<value>[^;{}]+)(?=;|})/gm,n=new Map;for(let r of e.matchAll(t)){let e=r.groups?.key;e&&n.set(e,(r.groups?.value??``).trim().replace(/\s*!important\s*$/,``))}return n}function ea(e,t){let n=e.trim(),r=new Set;for(;n.startsWith(`var(`);){let e=n.match(Wi);if(!e)break;let i=e[1].trim(),a=e[2]?.trim();if(r.has(i))return a;r.add(i);let o=t.get(i)?.trim();if(o){n=o;continue}return a||`1`}return n}function ta(e,t){let n=e;for(let r of e.matchAll(Vi)){let e=r[0],i=r.groups?.cssVarName?.trim(),a=r.groups?.fallback;if(!i)continue;let o=t.get(i);o?n=n.replaceAll(e,ea(o,t)??a??`1`):a&&(n=n.replaceAll(e,a))}return n.replaceAll(/,?\s+var\(--.*?\)/g,``)}function na(e,t){let n=ta(e,t),r=n.match(Xi);if(r?.groups?.color){let e=r.groups.color,t=r.groups.weight;if(e)return/\//.test(e)?e:e.replace(/\)$/,` / ${t})`)}let i=n.match(Ui)?.[0];if(!i){let e=n.trim().replace(/\s*!important$/,``);return C(e).isValid()?e:void 0}return/\/\)/.test(i)&&(i=i.replace(/ \/\)/g,`/ 1)`)),i}function ra(e){let t=$i(e);for(let n of e.matchAll(Ki)){let e=n.groups?.value;if(!e)continue;let r=na(e,t);if(r)return r}return na(e,t)}function ia(e){let t=C(e);if(!t.isValid())return;let n=t.toRgb();return{red:n.r/255,green:n.g/255,blue:n.b/255,alpha:n.alpha}}const aa=new Map,oa=new WeakMap;function sa(e,t){let n=Number.parseFloat(e);return t===`rem`||t===`em`?n*16:n}function ca(e){let t=e.match(/\(min-width:\s*([\d.]+)(px|rem|em)?\s*\)/);if(t)return sa(t[1],t[2]);let n=e.match(/\(max-width:\s*([\d.]+)(px|rem|em)?\s*\)/);if(n)return-sa(n[1],n[2])}function la(e,t){return e<t?-1:+(e>t)}function ua(e,t){return la(e??``,t??``)}function da(e,t,n){let r=(e.get(t)??0)-(e.get(n)??0);if(r)return r;let i=ca(t),a=ca(n);return i!==void 0&&a!==void 0&&i!==a?i-a:la(t,n)}function fa(e,t){return e[0]-t[0]||(e[4]?.sort??0)-(t[4]?.sort??0)||ua(e[5]?.currentSelector,t[5]?.currentSelector)||ua(e[1],t[1])||la(e[2],t[2])}function pa(e){let t=!1,n=0,r,i=``;for(let a=0;a<e.length;a++){let o=e[a];if(t){o===`*`&&e[a+1]===`/`&&(t=!1,a++);continue}if(r){o===`\\`?a++:o===r&&(r=void 0);continue}if(o===`/`&&e[a+1]===`*`){t=!0,a++;continue}if(o===`\\`){a++;continue}if(o===`"`||o===`'`){r=o;continue}if(!/\s/.test(o)||e[a+1]!==`$`||e[a+2]!==`$`||!/\s/.test(e[a+3]??``))continue;let s=a+4;for(;s<e.length&&/\s/.test(e[s]);)s++;i+=`${e.slice(n,a)} `,n=s,a=s-1}return n?i+e.slice(n):e}function ma(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)&&(t.push(e.slice(o,s)),s+=3,o=s+1)}return t.push(e.slice(o)),t}function ha(e){let t=aa.get(e);if(t!==void 0)return t;let n=Zi(e);return P(aa,e,n,2048),n}function ga(e){let t=new Map,n=new Map,r=0;for(let i of e){let[a,o,s]=i;if(s){e[r++]=i;continue}let c=a.length?t:n,l=c.get(o);l?a.length&&l[0].push(...a):(c.set(o,i),e[r++]=i)}e.length=r}function _a(e,t,n){let r=e.sort(fa).map(([,e,t,,n,,r])=>{let i=e&&!n?.noScope?pa(e):e;return[i==null?[]:[[i,n?.sort??0]],t,!!(r??n?.noMerge)]});t&&ga(r);let i=[];for(let e=r.length-1;e>=0;e--){let[t,n]=r[e],a=t.length===1?t[0][0]:``;t.length>1&&(t.sort((e,t)=>e[1]-t[1]||la(e[0],t[0])),a=[...new Set(t.map(([e])=>e).filter(Boolean))].join(`,
11
- `)),i.push(a?`${a}{${n}}`:n)}let a=[...new Set(i)].reverse();return(n?a:a.filter(ha)).join(`
12
- `)}function va(e,t,n){let r=new Map,i=new Set([ue]);for(let e of n){let t=e[4]?.layer||`utilities`;i.add(t);let n=e[3]||``,a=r.get(t);a||(a=new Map,r.set(t,a));let o=a.get(n);o?o.push(e):a.set(n,[e])}let a=t=>Object.hasOwn(e.layers,t)?e.layers[t]??0:0,o=e.sortLayers([...i].sort((e,t)=>a(e)-a(t)||la(e,t))),s=[];for(let n of o){let i=r.get(n);if(i)for(let n of[...i.keys()].sort((e,n)=>da(t,e,n))){let t=_a(i.get(n),e.mergeSelectors,ha(n));if(t)if(!n)s.push(t);else{let e=ma(n);s.push(`${e.join(`{`)}{${t}${`}`.repeat(e.length)}`)}}}return s.join(`
13
- `)}async function ya(e,t){let n=e.config,r=await e.parseToken(t);if(e.config!==n)return ya(e,t);if(r?.length)return ra(va(n,new Map(e.parentOrders),r))}async function ba(e,t){let n=oa.get(e);return(!n||n.config!==e.config)&&(n={config:e.config,values:new Map},oa.set(e,n)),Je(n.values,t,1e3,()=>ya(e,t).then(e=>e?{colorString:e,color:ia(e)}:{}))}const xa=[...ki,`teacss`],Sa={tokenTypes:[...Oi],tokenModifiers:xa},Ca=new Map(Oi.map((e,t)=>[e,t])),wa=new Map(xa.map((e,t)=>[e,1<<t])),Ta=wa.get(`teacss`)??0,Ea=/^-?(?:\d+\.?\d*|\.\d+)[a-z%]*$/i,Da=new WeakMap,Oa={log(){},warn(){}};async function ka(e,t,n){let r=Array(e.length),i=0,a=Array.from({length:Math.min(t,e.length)},async()=>{for(;i<e.length;){let t=i++;r[t]=await n(e[t],t)}});return await Promise.all(a),r}function Aa(e){let t=Da.get(e);if(t?.config===e.config)return t.classifier;let n=bi(e.config?.theme??{});return Da.set(e,{config:e.config,classifier:n}),n}function ja(e){e.sort((e,t)=>e.line-t.line||e.char-t.char);let t=[],n=0,r=0;for(let i of e){let e=i.line-n,a=e===0?i.char-r:i.char;t.push(e,a,i.length,i.type,i.modifiers),n=i.line,r=i.char}return{data:t}}function Ma(e,t,n,r,i=Ta){let a=e.positionAt(t);return{line:a.line,char:a.character,length:n,type:Ca.get(r)??0,modifiers:i}}function Na(e,t,n,r,i=Ta){let a=[],o=0;for(let s=0;s<n.length;s++)(n[s]===`\r`||n[s]===`
14
- `)&&(s>o&&a.push(Ma(e,t+o,s-o,r,i)),n[s]===`\r`&&n[s+1]===`
15
- `&&s++,o=s+1);return o<n.length&&a.push(Ma(e,t+o,n.length-o,r,i)),a}function Pa(e,t){return t.isColorValue?.(e)?`enumMember`:Ea.test(e)?`number`:`string`}function Fa(e,t,n){return e.some(e=>e.open===t&&e.close===n-1)}function Ia(e,t,n){let r=[];for(let i of n){r.push(Ma(e,i.open,1,`operator`,Ta|(wa.get(`group`)??0)));for(let n of i.declarations){let{property:i,start:a,colon:o,value:s,valueStart:c}=n;r.push(Ma(e,a,2,`operator`,Ta|(wa.get(`variable`)??0))),r.push(Ma(e,a+2,i.length-2,`property`)),r.push(Ma(e,o,1,`operator`)),s&&r.push(...Na(e,c,s,Pa(s,t)))}r.push(Ma(e,i.close,1,`operator`,Ta|(wa.get(`group`)??0)))}return r}var La=class{contextManager;getSettings;logger;autoCompletes=new Map;semanticTokensCache=new Map;featureFailures=new Map;constructor(e){this.getSettings=e.getSettings??(()=>gi),this.logger=e.logger??Oa;let t=e.folderPaths?.length?e.folderPaths:[e.rootPath];this.contextManager=new hi(e.rootPath,this.logger,t),this.contextManager.events.on(`contextReload`,e=>this.resetFeatureCaches(e)),this.contextManager.events.on(`contextUnload`,e=>this.resetFeatureCaches(e)),this.contextManager.events.on(`unload`,e=>this.resetFeatureCaches(e))}get events(){return this.contextManager.events}get ready(){return this.contextManager.ready}resetAutoCompleteCache(e){e?this.autoCompletes.delete(e):this.autoCompletes.clear()}resetFeatureCaches(e){this.resetAutoCompleteCache(e),this.semanticTokensCache.clear(),this.featureFailures.clear()}reportFeatureFailure(e,t,n){let r=`${e}\0${t}`,i=n instanceof Error?n.message:String(n);this.featureFailures.get(r)!==i&&(P(this.featureFailures,r,i,100),this.logger.warn(`⚠️ Failed to provide ${e} for ${t}: ${i}`))}clearFeatureFailure(e,t){this.featureFailures.delete(`${e}\0${t}`)}getAutocomplete(e,t){let n=this.autoCompletes.get(e);if(n?.matchType===t)return n.autocomplete;let r=oi(e.generator,{matchType:t,throwErrors:!1});return this.autoCompletes.set(e,{matchType:t,autocomplete:r}),r}async resolveTargetContext(e){let t=G(e.uri);if(!this.contextManager.isTarget(t))return null;let n=e.getText();if(!n)return null;let r=await this.contextManager.resolveClosestContext(n,t);return!r||!(r.filter(n,t)||n.includes(`@teacss-ide-include`)||this.contextManager.configSources.includes(t)||fe(t))?null:{ctx:r,id:t,code:n,doc:e.getText()===n?e:b.create(e.uri,e.languageId,e.version,n)}}async getSemanticTokens(e){let t={data:[]},n=`semantic tokens`;try{let r=this.getSettings();if(!r.syntaxHighlight)return this.clearFeatureFailure(n,e.uri),t;let i=await this.resolveTargetContext(e);if(!i)return this.clearFeatureFailure(n,e.uri),t;let{ctx:a,id:o,code:s,doc:c}=i,l=r.strictAnnotationMatch,u=this.semanticTokensCache.get(o);if(u&&u.code===s&&u.generator===a.generator&&u.strictAnnotationMatch===l)return P(this.semanticTokensCache,o,u,100),this.clearFeatureFailure(n,e.uri),u.result;let d=await Qe(a.generator,s,o,l),f=Aa(a.generator),p=[],h=new Map,g=fe(o)?m(s):[];for(let[e,t]of d){if(Fa(g,e,t))continue;let n=s.slice(e,t),r=h.get(n);r||(r=Ri(n,0,f),h.set(n,r));for(let t of r){let n=e+t.start,r=c.positionAt(n),i=Ta;for(let e of t.modifiers)i|=wa.get(e)??0;p.push({line:r.line,char:r.character,length:t.length,type:Ca.get(t.type)??0,modifiers:i})}}g.length&&p.push(...Ia(c,f,g));let _=ja(p);return P(this.semanticTokensCache,o,{code:s,generator:a.generator,strictAnnotationMatch:l,result:_},100),this.clearFeatureFailure(n,e.uri),_}catch(r){return this.reportFeatureFailure(n,e.uri,r),t}}async getDiagnostics(e){try{if(!fe(G(e.uri)))return this.clearFeatureFailure(`diagnostics`,e.uri),[];let t=await this.resolveTargetContext(e);if(!t)return this.clearFeatureFailure(`diagnostics`,e.uri),[];let{ctx:n,code:r,doc:i}=t,a=n.generator.config?.theme??{},o=d(r,Object.keys(a).filter(e=>e!==`modes`&&e!==`defaultMode`&&a[e]!=null&&typeof a[e]==`object`)).map(e=>({range:{start:i.positionAt(e.start),end:i.positionAt(e.end)},message:e.message,severity:S.Warning,source:`teacss`,code:e.reason}));return this.clearFeatureFailure(`diagnostics`,e.uri),o}catch(t){return this.reportFeatureFailure(`diagnostics`,e.uri,t),[]}}async getHover(e,t){let n=`hover`;try{if(fe(G(e.uri)))return this.clearFeatureFailure(n,e.uri),null;let r=this.getSettings(),i=await this.resolveTargetContext(e);if(!i)return this.clearFeatureFailure(n,e.uri),null;let{ctx:a,id:o,code:s,doc:c}=i,l=c.offsetAt(t),u=(await Qe(a.generator,s,o,r.strictAnnotationMatch)).find(([e,t])=>l>=e&&l<t);if(!u)return this.clearFeatureFailure(n,e.uri),null;let d=r.remToPxPreview?r.remToPxRatio:-1,f={contents:{kind:`markdown`,value:await Di(a.generator,u[2],d)},range:{start:c.positionAt(u[0]),end:c.positionAt(u[1])}};return this.clearFeatureFailure(n,e.uri),f}catch(t){return this.reportFeatureFailure(n,e.uri,t),null}}async getDocumentColors(e){let t=`document colors`;try{let n=this.getSettings();if(!n.colorPreview)return this.clearFeatureFailure(t,e.uri),[];let r=await this.resolveTargetContext(e);if(!r)return this.clearFeatureFailure(t,e.uri),[];let{ctx:i,id:a,code:o,doc:s}=r,c=await Qe(i.generator,o,a,n.strictAnnotationMatch),l=[],u=!1;for(let[n,r,a]of c)try{let{color:e}=await ba(i.generator,a);e&&l.push({range:{start:s.positionAt(n),end:s.positionAt(r)},color:{...e}})}catch(n){u=!0,this.reportFeatureFailure(t,e.uri,n)}return u||this.clearFeatureFailure(t,e.uri),l}catch(n){return this.reportFeatureFailure(t,e.uri,n),[]}}getColorPresentations(e,t,n){let r=Math.round(e.red*255),i=Math.round(e.green*255),a=Math.round(e.blue*255),o=Math.min(1,Math.max(0,e.alpha)),s=e=>e.toString(16).padStart(2,`0`),c=o<1?`#${s(r)}${s(i)}${s(a)}${s(Math.round(o*255))}`:`#${s(r)}${s(i)}${s(a)}`;if(t&&n){let e=Ra(n),r=n.slice(0,e),i=n.slice(e),a=r.indexOf(`:`);if(a>0){let e=r.endsWith(`!`)?`!`:``,n=`${r.slice(0,a)}:[${c}]${e}${i}`;return[{label:n,textEdit:{range:t,newText:n}}]}}return n&&t?[{label:n,textEdit:{range:t,newText:n}}]:[{label:c}]}async getMatchedPositions(e){let t=this.getSettings(),n=await this.resolveTargetContext(e);if(!n)return[];let{ctx:r,id:i,code:a}=n;return(await Qe(r.generator,a,i,t.strictAnnotationMatch)).map(([e,t,n])=>({start:e,end:t,text:n}))}async getReferences(e,t){let n=this.getSettings(),r=G(e.uri),i=e.getText(),a=await this.contextManager.resolveClosestContext(i,r);if(!a?.filter(i,r))return null;let o=e.getText()===i?e:b.create(e.uri,e.languageId,e.version,i),s=await Qe(a.generator,i,r,n.strictAnnotationMatch),c=o.offsetAt(t),l=s.find(e=>e[0]<=c&&c<e[1]);if(!l?.[2])return null;let u=l[2],d=new Set(a.generator.getCachedEquivalentTokens(u));return s.filter(e=>d.has(e[2])).map(t=>({uri:e.uri,range:{start:o.positionAt(t[0]),end:o.positionAt(t[1])}}))}async getCompletions(e,t){let n=`completions`;try{let r=this.getSettings(),i=G(e.uri);if(!this.contextManager.isTarget(i))return this.clearFeatureFailure(n,e.uri),null;let a=e.getText();if(!a)return this.clearFeatureFailure(n,e.uri),null;let o=await this.contextManager.resolveClosestContext(a,i);if(!o)return this.clearFeatureFailure(n,e.uri),null;let s=e.getText()===a?e:b.create(e.uri,e.languageId,e.version,a),c=s.offsetAt(t);if(r.autocompleteStrict&&!ui(a,i,c))return this.clearFeatureFailure(n,e.uri),null;let l=await this.getSuggestionResult({ctx:o,code:a,id:i,offset:c,matchType:r.autocompleteMatchType});if(!l?.suggestions.length)return this.clearFeatureFailure(n,e.uri),null;let u=l.suggestions.slice(0,r.autocompleteMaxItems),d=r.colorPreview?await ka(u,32,async([e])=>{try{return(await ba(o.generator,e)).colorString}catch{return}}):[],f=[];for(let t=0;t<u.length;t++){let[n,r]=u[t],i=d[t],a=l.resolveReplacement(n),o={label:r,kind:i?x.Color:x.EnumMember,sortText:i?/-\d$/.test(r)?`1`:`2`:void 0,data:{value:n,uri:e.uri},textEdit:{range:{start:s.positionAt(a.start),end:s.positionAt(a.end)},newText:a.replacement}};i&&(o.documentation=i),f.push(o)}return this.clearFeatureFailure(n,e.uri),{isIncomplete:!0,items:f}}catch(t){return this.reportFeatureFailure(n,e.uri,t),null}}async resolveCompletion(e,t){if(!e.data?.uri||!e.data?.value||!t)return e;let n=this.getSettings(),r=G(e.data.uri),i=t.getText(),a=await this.contextManager.resolveClosestContext(i,r);if(!a)return e;let o=n.remToPxPreview?n.remToPxRatio:-1;return e.kind===x.Color?e.detail=await(await Ei(a.generator,e.data.value,o)).prettified:e.documentation={kind:`markdown`,value:await Di(a.generator,e.data.value,o)},e}async getSuggestionResult({ctx:e,code:t,id:n,offset:r,matchType:i}){let a=di(t,n);if(!e.filter(t,n)&&!fe(n)&&!a)return null;let o=this.getAutocomplete(e,i),s;if(a){let e=t.substring(0,r).match(/\.[-\w]*$/);if(e){let t=e[0].substring(1),n=await o.suggest(t||``);n.length&&(s={suggestions:n.map(e=>[e,e]),resolveReplacement:e=>({start:r-(t?.length||0),end:r,replacement:e})})}else s=await o.suggestInFile(t,r)}else s=await o.suggestInFile(t,r);return s}};function Ra(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 r}return e.length}function za(e,t){let n=Va(t.workspaceFolderPaths||[]),r=n.length?n:Va([t.workspaceRootPath]),i=M(e).filter(e=>typeof e==`string`&&e.length>0);if(!i.length)return r;let a=Va([t.workspaceFileDir,...n,t.workspaceRootPath]);return Va(i.flatMap(e=>Ba(e,a)))}function Ba(e,t){if(!e)return[];if(Ha(e))return[u.normalize(e)];let n=u.normalize(e),r=t.filter(e=>{let t=u.normalize(e);return t===n||t.endsWith(`${u.sep}${n}`)});if(r.length)return r;let i=t.map(t=>u.resolve(t,e)),a=i.filter(e=>l(e));return a.length?a:i.slice(0,1)}function Va(e){return Array.from(new Set(e.filter(Boolean).map(e=>u.normalize(e))))}function Ha(e){return u.isAbsolute(e)||u.win32.isAbsolute(e)}const Ua=/[\\/](?:node_modules|dist|\.temp|\.cache|\.git)[\\/]/,Wa=new Set([`node_modules`,`dist`,`.temp`,`.cache`,`.git`]),Ga=`**/{${Array.from(new Set(f.map(e=>u.posix.basename(e)))).join(`,`)}}`;function Ka(e,t){let n=u.relative(e,t);return n===``||!n.startsWith(`..${u.sep}`)&&n!==`..`&&!u.isAbsolute(n)}function qa(e){return[...e].map(e=>e===`*`?`[*]`:e===`?`?`[?]`:e===`[`?`[[]`:e===`]`?`[]]`:e===`{`?`[{]`:e===`}`?`[}]`:e).join(``)}function Ja(e){try{let t=JSON.parse(c.readFileSync(u.join(e,`package.json`),`utf8`))?.teacss?.entry;return typeof t==`string`&&t?u.resolve(e,t):void 0}catch{return}}function Ya(e){let t=[],n=[e];for(let e of n){let r;try{r=c.readdirSync(e,{withFileTypes:!0})}catch{continue}if(r.some(e=>e.isFile()&&e.name===`package.json`)){let n=Ja(e);n&&t.push({directory:e,entry:n})}for(let t of r)t.isDirectory()&&!Wa.has(t.name)&&n.push(u.join(e,t.name))}return t.sort((e,t)=>e.directory<t.directory?-1:+(e.directory>t.directory))}function Xa(e,t){return t.map(e=>u.normalize(e)).filter(t=>Ka(t,e)).sort((e,t)=>t.length-e.length)[0]}function Za(e,t){let n=u.dirname(e);for(;Ka(t,n);){if(u.normalize(p(n)??``)===e)return!0;if(n===t)break;n=u.dirname(n)}return!1}function Qa(e){let t=e.map(({globPattern:e,kind:t})=>typeof e==`string`?`${t??``}\0${e}`:`${t??``}\0${e.baseUri}\0${e.pattern}`);return JSON.stringify(t.sort())}function $a(e,t,n){let r=new Map,i=(e,t,i=!0)=>{let a=i?qa(t):t,o={baseUri:_(e).href,pattern:a};r.set(`${o.baseUri}\0${a}`,{globPattern:o,kind:n})};for(let t of e)i(u.dirname(t),u.basename(t));for(let e of t){i(e,Ga,!1);for(let{directory:t,entry:n}of Ya(e)){let e=u.relative(t,n);Ka(t,n)?i(t,e.split(u.sep).join(`/`)):i(u.dirname(n),u.basename(n))}}return Array.from(r.values())}function eo(e,t,n){let r=new Set(t.map(e=>u.normalize(e))),i=new Set(n.map(Ja).filter(e=>!!e).map(e=>u.normalize(e))),a=new Set;for(let t of e){let e;try{e=u.normalize(g(t.uri))}catch{return!0}if(r.has(e)||i.has(e))return!0;if(Ua.test(e))continue;let o=Xa(e,n);if(!o){a.add(e);continue}if(u.basename(e)===`package.json`)return!0;if(u.extname(e).toLowerCase()!==`.css`){a.add(e);continue}try{if(Za(e,o))return!0}catch{return!0}}if(a.size){for(let e of n)for(let{entry:t}of Ya(e))if(a.has(u.normalize(t)))return!0}return!1}function to(e){let t,n,r,i,a=0,o=Promise.resolve();return{update(s){let c=Qa(s);if(i&&r===c)return i;if(!i&&n===c)return Promise.resolve();let l=++a,u=o.then(async()=>{if(l!==a||n===c)return;let r=await e(s);if(l!==a){r.dispose();return}t?.dispose(),t=r,n=c});o=u.catch(()=>{}),r=c,i=u;let d=()=>{i===u&&(i=void 0,r=void 0)};return u.then(d,d),u}}}function no(e){return e instanceof Error?e.message:String(e)}function ro(e){let t=new Map,n=new Map,r=0;return{async publish(i){let a=++r;t.set(i.uri,a);try{let r=await e.getDiagnostics(i);if(t.get(i.uri)!==a)return;await e.sendDiagnostics(i.uri,r),t.get(i.uri)===a&&n.delete(i.uri)}catch(r){if(t.get(i.uri)!==a)return;let o=no(r);if(n.get(i.uri)===o)return;n.set(i.uri,o),e.reportError(i.uri,r)}},invalidate(e){t.delete(e),n.delete(e)}}}function io(e,t){e.on(`uncaughtExceptionMonitor`,(e,n)=>{t(`[teacss] ${n===`unhandledRejection`?`Unhandled rejection`:`Uncaught exception`}: ${e.message}`)})}function ao(e){return typeof e==`object`&&e&&!Array.isArray(e)?e:{}}function oo(e,t){return typeof e==`boolean`?e:t}function so(e,t){if(e!==null)return typeof e==`string`?e:Array.isArray(e)?e.filter(e=>typeof e==`string`):t}function co(e,t){return typeof e==`number`&&Number.isFinite(e)&&e>0?e:t}function lo(e,t){return typeof e!=`number`||!Number.isFinite(e)?t:Math.min(1e4,Math.max(0,Math.floor(e)))}function uo(e){let t=ao(e),n={};return Object.hasOwn(t,`root`)&&(n.root=t.root),(t.semanticTokens===`native`||t.semanticTokens===`overlay`)&&(n.semanticTokens=t.semanticTokens),typeof t.workspaceFileDir==`string`&&(n.workspaceFileDir=t.workspaceFileDir),Array.isArray(t.workspaceFolderPaths)&&(n.workspaceFolderPaths=t.workspaceFolderPaths.filter(e=>typeof e==`string`)),n}function fo(e,t){let n=ao(t),r=ao(n.autocomplete),i=r.matchType;return{root:so(n.root,e.root),colorPreview:oo(n.colorPreview,e.colorPreview),remToPxPreview:oo(n.remToPxPreview,e.remToPxPreview),remToPxRatio:co(n.remToPxRatio,e.remToPxRatio),syntaxHighlight:oo(n.syntaxHighlight,e.syntaxHighlight),strictAnnotationMatch:oo(n.strictAnnotationMatch,e.strictAnnotationMatch),autocompleteMatchType:i===`prefix`||i===`fuzzy`?i:e.autocompleteMatchType,autocompleteStrict:oo(r.strict,e.autocompleteStrict),autocompleteMaxItems:lo(r.maxItems,e.autocompleteMaxItems)}}function po(e){return fo(gi,e)}function mo(e,t){return e.syntaxHighlight!==t.syntaxHighlight||e.strictAnnotationMatch!==t.strictAnnotationMatch}function ho(e,t){let n=new Set(e),r=new Set(t);return n.size!==r.size||[...n].some(e=>!r.has(e))}async function go(e,t,n){if(e)try{return await t()}catch(e){n(e);return}}const K=ae(k.all),q=new re(b);let J=po(),Y,_o=!1,vo=!1,yo=!1,bo=!1,xo=!1,So=!1,Co=0,wo;const To=new Promise(e=>{wo=e}),Eo=ie.Create|ie.Change|ie.Delete,Do=[{globPattern:`**/*.css`,kind:Eo}],X={folderPaths:[]};function Oo(e){J=fo(J,e)}function Z(e){return za(e,{workspaceRootPath:X.rootPath,workspaceFileDir:X.fileDir,workspaceFolderPaths:X.folderPaths})}function ko(e){return typeof e==`string`?e.length>0:Array.isArray(e)&&e.some(Boolean)}async function Ao(){Y&&await jo(()=>Y.contextManager.setRoots(Z(J.root)))}async function jo(e){Co++;try{return await e()}finally{Co--}}function Mo(e,t,n){X.rootPath=e?G(e):void 0,X.fileDir=n?.workspaceFileDir,X.folderPaths=n?.workspaceFolderPaths||t?.map(e=>G(e.uri))||[]}function No(e=X.rootPath){if(!e)return;let t=new La({rootPath:e,folderPaths:Z(J.root),logger:{log:e=>K.console.log(e),warn:e=>K.console.warn(e)},getSettings:Ho});Y=t;let n=()=>{Co||(zo().catch(e=>Q(`Failed to update config watchers`,e)),Bo(),Xo())};return t.events.on(`reload`,()=>{Co||zo().catch(e=>Q(`Failed to update config watchers`,e))}),t.events.on(`contextLoaded`,n),t.events.on(`contextReload`,n),t.events.on(`contextUnload`,n),t.events.on(`unload`,n),t}async function Po(e){Y||!e[0]||await No(e[0])?.ready}function Fo(){return Y?.contextManager.configSources??[]}function Io(){return Array.from(new Set([...Z(J.root),...Y?.contextManager.contextsMap.keys()??[]]))}function Lo(){let e=Fo(),t=$a(e,Io(),Eo);return e.length?t:[...Do,...t]}const Ro=to(async e=>K.client.register(O.type,{watchers:[...e]}));async function zo(){!_o||!So||!Y||await Ro.update(Lo())}function Q(e,t){K.console.error(`[teacss] ${e}: ${t instanceof Error?t.message:String(t)}`)}async function Bo(){So&&(xo?await K.sendNotification(`teacss/semanticTokens/refresh`).catch(e=>Q(`Failed to refresh semantic token decorations`,e)):bo&&await K.languages.semanticTokens.refresh().catch(e=>Q(`Failed to refresh semantic tokens`,e)))}const Vo=ro({async getDiagnostics(e){return await $(),await Y?.getDiagnostics(e)??[]},sendDiagnostics(e,t){return K.sendDiagnostics({uri:e,diagnostics:[...t]})},reportError(e,t){Q(`Failed to publish diagnostics for ${e}`,t)}});io(o,e=>K.console.error(e));function Ho(){return J}function Uo(){return Y}function $(){return To}K.onInitialize(a=>{_o=!!a.capabilities.workspace?.didChangeWatchedFiles?.dynamicRegistration,vo=!!a.capabilities.workspace?.configuration,yo=!!a.capabilities.workspace?.workspaceFolders,bo=!!a.capabilities.workspace?.semanticTokens?.refreshSupport;let o=uo(a.initializationOptions);xo=o?.semanticTokens===`overlay`,`root`in o&&Oo({root:o.root});let s=a.workspaceFolders,c=s?.[0]?.uri||a.rootUri;Mo(c,s,o);let l=c?void 0:Z(J.root)[0];return c?No():l&&No(l),t(K,q,Uo,$),r(K,q,Uo,$),e(K,q,Uo,$),n(K,q,Uo,$),i(K,q,Uo,$),{capabilities:{textDocumentSync:A.Incremental,completionProvider:{resolveProvider:!0,triggerCharacters:[`-`,`:`,` `,`"`,`'`]},hoverProvider:!0,referencesProvider:!0,colorProvider:!0,...xo?{}:{semanticTokensProvider:{legend:Sa,full:!0}},...yo?{workspace:{workspaceFolders:{supported:!0,changeNotifications:!0}}}:{}}}}),K.onInitialized(async()=>{yo&&K.workspace.onDidChangeWorkspaceFolders(e=>{Zo(e).catch(e=>Q(`Failed to update workspace folders`,e))});try{let e=await go(vo,()=>K.workspace.getConfiguration(`teacss`),e=>Q(`Failed to read workspace configuration`,e));e!==void 0&&Oo(e),await Po(Z(J.root)),Y&&(await Y.ready,await Ao())}catch(e){Q(`Failed to complete initial setup`,e)}finally{So=!0,wo?.(),wo=void 0}K.console.log(`✅ TeaCSS Language Server initialized`),await zo().catch(e=>Q(`Failed to update config watchers`,e)),await Bo()});let Wo;K.onDidChangeWatchedFiles(e=>{eo(e.changes,Fo(),Io())&&(clearTimeout(Wo),Wo=setTimeout(()=>{Go().catch(e=>Q(`Failed to reload config sources`,e))},500))});async function Go(){await $(),Y&&(K.console.log(`🔄 Config source changed, reloading TeaCSS...`),Ze(),await jo(()=>Y.contextManager.reload()),K.console.log(`🔵 Reloaded.`),await zo().catch(e=>Q(`Failed to update config watchers`,e)),await Bo(),await Xo())}K.onDidChangeConfiguration(async e=>{await $();let t=e.settings?.teacss;if(t!==void 0){let e=J,n=Z(e.root);Oo(t);let r=Z(J.root),i=ho(n,r);i&&(await Po(r),Y&&await jo(()=>Y.contextManager.setRoots(r)),await zo().catch(e=>Q(`Failed to update config watchers`,e)),await Xo()),(i||mo(e,J))&&await Bo()}});async function Ko(){return await $(),Y?(Ze(),await jo(()=>Y.contextManager.reload()),await zo().catch(e=>Q(`Failed to update config watchers`,e)),await Bo(),await Xo(),{success:!0}):{success:!1}}async function qo(e){if(await $(),!Y)return{count:0};let t=q.get(e.uri);if(!t)return{count:0};let n=G(e.uri),r=t.getText(),i=await Y.contextManager.resolveClosestContext(r,n);return i?{count:(await i.generator.generate(r,{id:n,preflights:!1,safelist:!1,minify:!0})).matched.size}:{count:0}}async function Jo(e){if(await $(),!Y)return{positions:[]};let t=q.get(e.uri);return t?{positions:(await Y.getMatchedPositions(t)).map(e=>({start:t.positionAt(e.start),end:t.positionAt(e.end),className:e.text}))}:{positions:[]}}K.onRequest(`teacss/reloadConfig`,Ko),K.onRequest(`teacss/getMatchedCount`,qo),K.onRequest(`teacss/getMatchedPositions`,Jo);async function Yo(e){!Y||!fe(G(e.uri))||await Vo.publish(e)}async function Xo(){await Promise.all(q.all().map(e=>Yo(e)))}async function Zo(e){await $();let t=new Set(e.removed.map(e=>G(e.uri))),n=X.folderPaths.filter(e=>!t.has(e));for(let t of e.added){let e=G(t.uri);n.includes(e)||n.push(e)}if(X.folderPaths=n,X.rootPath=n[0],!Y&&X.rootPath&&(No(),await Uo()?.ready),!Y)return;Ze();let r=ko(J.root)?Z(J.root):X.folderPaths;await jo(()=>Y.contextManager.setRoots(r)),await zo().catch(e=>Q(`Failed to update config watchers`,e)),await Bo(),await Xo()}q.onDidChangeContent(e=>{Xe(G(e.document.uri)),Yo(e.document)}),q.onDidClose(e=>{let t=G(e.document.uri);Xe(t),Y?.contextManager.releaseDocument(t),Vo.invalidate(e.document.uri),K.sendDiagnostics({uri:e.document.uri,diagnostics:[]})}),q.listen(K),K.listen();export{};
8
+ const nt={216:`O`,223:`s`,248:`o`,273:`d`,295:`h`,305:`i`,320:`l`,322:`l`,359:`t`,383:`s`,384:`b`,385:`B`,387:`b`,390:`O`,392:`c`,393:`D`,394:`D`,396:`d`,398:`E`,400:`E`,402:`f`,403:`G`,407:`I`,409:`k`,410:`l`,412:`M`,413:`N`,414:`n`,415:`O`,421:`p`,427:`t`,429:`t`,430:`T`,434:`V`,436:`y`,438:`z`,477:`e`,485:`g`,544:`N`,545:`d`,549:`z`,564:`l`,565:`n`,566:`t`,567:`j`,570:`A`,571:`C`,572:`c`,573:`L`,574:`T`,575:`s`,576:`z`,579:`B`,580:`U`,581:`V`,582:`E`,583:`e`,584:`J`,585:`j`,586:`Q`,587:`q`,588:`R`,589:`r`,590:`Y`,591:`y`,592:`a`,593:`a`,595:`b`,596:`o`,597:`c`,598:`d`,599:`d`,600:`e`,603:`e`,604:`e`,605:`e`,606:`e`,607:`j`,608:`g`,609:`g`,610:`G`,613:`h`,614:`h`,616:`i`,618:`I`,619:`l`,620:`l`,621:`l`,623:`m`,624:`m`,625:`m`,626:`n`,627:`n`,628:`N`,629:`o`,633:`r`,634:`r`,635:`r`,636:`r`,637:`r`,638:`r`,639:`r`,640:`R`,641:`R`,642:`s`,647:`t`,648:`t`,649:`u`,651:`v`,652:`v`,653:`w`,654:`y`,655:`Y`,656:`z`,657:`z`,663:`c`,665:`B`,666:`e`,667:`G`,668:`H`,669:`j`,670:`k`,671:`L`,672:`q`,686:`h`,867:`a`,868:`e`,869:`i`,870:`o`,871:`u`,872:`c`,873:`d`,874:`h`,875:`m`,876:`r`,877:`t`,878:`v`,879:`x`,7424:`A`,7427:`B`,7428:`C`,7429:`D`,7431:`E`,7432:`e`,7433:`i`,7434:`J`,7435:`K`,7436:`L`,7437:`M`,7438:`N`,7439:`O`,7440:`O`,7441:`o`,7442:`o`,7443:`o`,7446:`o`,7447:`o`,7448:`P`,7449:`R`,7450:`R`,7451:`T`,7452:`U`,7453:`u`,7454:`u`,7455:`m`,7456:`V`,7457:`W`,7458:`Z`,7522:`i`,7523:`r`,7524:`u`,7525:`v`,7834:`a`,7835:`s`,8305:`i`,8341:`h`,8342:`k`,8343:`l`,8344:`m`,8345:`n`,8346:`p`,8347:`s`,8348:`t`,8580:`c`};for(let e=`̀`.codePointAt(0);e<=`ͯ`.codePointAt(0);++e){let t=String.fromCodePoint(e);for(let e of`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz`){let n=(e+t).normalize().codePointAt(0);n>126&&(nt[n]=e)}}const rt={a:[7844,7863],e:[7870,7879],o:[7888,7907],u:[7912,7921]};for(let e of Object.keys(rt)){let t=e.toUpperCase();for(let n=rt[e][0];n<=rt[e][1];++n)nt[n]=n%2==0?t:e}function it(e){if(e<192||e>8580)return e;let t=nt[e];return t===void 0?e:t.codePointAt(0)}function at(e){return e}function ot(e){return e}function P(e,t){return e>t?e:t}const st=e=>e.split(``).map(e=>e.codePointAt(0)),ct=new Set(` \f
9
+ \r \v\xA0 \u2028\u2029   `.split(``).map(e=>e.codePointAt(0)));for(let e=` `.codePointAt(0);e<=` `.codePointAt(0);e++)ct.add(e);const lt=``.codePointAt(0),ut=`A`.codePointAt(0),dt=`Z`.codePointAt(0),ft=`a`.codePointAt(0),pt=`z`.codePointAt(0),mt=`0`.codePointAt(0),ht=`9`.codePointAt(0);function gt(e,t,n){return n?e:t-e-1}function _t(e){return e?new Set:null}function vt(e,t,n){if(t!==null&&t.i16.length>e+n){let r=t.i16.subarray(e,e+n);return[e+n,r]}return[e,new Int16Array(n)]}function yt(e,t,n){if(t!==null&&t.i32.length>e+n){let r=t.i32.subarray(e,e+n);return[e+n,r]}return[e,new Int32Array(n)]}function bt(e){return e>=ft&&e<=pt?1:e>=ut&&e<=dt?2:e>=mt&&e<=ht?4:0}function xt(e){let t=String.fromCodePoint(e);return t===t.toUpperCase()?t===t.toLowerCase()?t.match(/\p{Number}/gu)===null?t.match(/\p{Letter}/gu)===null?0:3:4:2:1}function St(e){return e<=lt?bt(e):xt(e)}function Ct(e,t){return e===0&&t!==0?8:e===1&&t===2||e!==4&&t===4?7:t===0?8:0}function wt(e,t){return t===0?8:Ct(St(e[t-1]),St(e[t]))}function Tt(e,t,n,r){let i=e.slice(r),a=i.indexOf(n);if(a===0)return r;if(!t&&n>=ft&&n<=pt){a>0&&(i=i.slice(0,a));let e=i.indexOf(n-32);e>=0&&(a=e)}return a<0?-1:r+a}function Et(e){for(let t of e)if(t>=128)return!1;return!0}function Dt(e,t,n){if(!Et(e))return 0;if(!Et(t))return-1;let r=0,i=0;for(let a=0;a<t.length;a++){if(i=Tt(e,n,t[a],i),i<0)return-1;a===0&&i>0&&(r=i-1),i++}return r}const Ot=(e,t,n,r,i,a,o)=>{let s=i.length;if(s===0)return[{start:0,end:0,score:0},_t(a)];let c=r.length;if(o!==null&&c*s>o.i16.length)return At(e,t,n,r,i,a);let l=Dt(r,i,e);if(l<0)return[{start:-1,end:-1,score:0},null];let u=0,d=0,f=null,p=null,m=null,h=null;[u,f]=vt(u,o,c),[u,p]=vt(u,o,c),[u,m]=vt(u,o,c),[d,h]=yt(d,o,s);let[,g]=yt(d,o,c);for(let e=0;e<g.length;e++)g[e]=r[e];let _=at(0),v=0,y=0,b=0,x=i[0],S=i[0],ee=at(0),C=0,w=!1,T=g.subarray(l),te=f.subarray(l).subarray(0,T.length),ne=p.subarray(l).subarray(0,T.length),re=m.subarray(l).subarray(0,T.length);for(let[r,a]of T.entries()){let o=null;a<=lt?(o=bt(a),!e&&o===2&&(a+=32)):(o=xt(a),!e&&o===2&&(a=String.fromCodePoint(a).toLowerCase().codePointAt(0)),t&&(a=it(a))),T[r]=a;let c=Ct(C,o);if(re[r]=c,C=o,a===S&&(y<s&&(h[y]=ot(l+r),y++,S=i[Math.min(y,s-1)]),b=l+r),a===x){let e=16+c*2;if(te[r]=e,ne[r]=1,s===1&&(n&&e>_||!n&&e>=_)&&(_=e,v=l+r,n&&c===8))break;w=!1}else w?te[r]=P(ee+-1,0):te[r]=P(ee+-3,0),ne[r]=0,w=!0;ee=te[r]}if(y!==s)return[{start:-1,end:-1,score:0},null];if(s===1){let e={start:v,end:v+1,score:_};if(!a)return[e,null];let t=new Set;return t.add(v),[e,t]}let E=h[0],D=b-E+1,O=null;[u,O]=vt(u,o,D*s);{let e=f.subarray(E,b+1);for(let[t,n]of e.entries())O[t]=n}let[,k]=vt(u,o,D*s);{let e=p.subarray(E,b+1);for(let[t,n]of e.entries())k[t]=n}let ie=h.subarray(1),ae=i.slice(1).slice(0,ie.length);for(let[e,t]of ie.entries()){let r=!1,i=ae[e],a=e+1,o=a*D,c=g.subarray(t,b+1),l=m.subarray(t).subarray(0,c.length),u=k.subarray(o+t-E).subarray(0,c.length),d=k.subarray(o+t-E-1-D).subarray(0,c.length),f=O.subarray(o+t-E).subarray(0,c.length),p=O.subarray(o+t-E-1-D).subarray(0,c.length),h=O.subarray(o+t-E-1).subarray(0,c.length);h[0]=0;for(let[e,o]of c.entries()){let c=e+t,g=0,y=0,b=0;if(y=r?h[e]+-1:h[e]+-3,i===o){g=p[e]+16;let t=l[e];b=d[e]+1,t===8?b=1:b>1&&(t=P(t,P(4,m[c-b+1]))),g+t<y?(g+=l[e],b=0):g+=t}u[e]=b,r=g<y;let x=P(P(g,y),0);a===s-1&&(n&&x>_||!n&&x>=_)&&(_=x,v=c),f[e]=x}}let oe=_t(a),A=E;if(a&&oe!==null){let e=s-1;A=v;let t=!0;for(;;){let n=e*D,r=A-E,i=O[n+r],a=0,o=0;if(e>0&&A>=h[e]&&(a=O[n-D+r-1]),A>h[e]&&(o=O[n+r-1]),i>a&&(i>o||i===o&&t)){if(oe.add(A),e===0)break;e--}t=k[n+r]>1||n+D+r+1<k.length&&k[n+D+r+1]>0,A--}}return[{start:A,end:v+1,score:_},oe]};function kt(e,t,n,r,i,a,o){let s=0,c=0,l=!1,u=0,d=at(0),f=_t(o),p=0;i>0&&(p=St(n[i-1]));for(let m=i;m<a;m++){let i=n[m],a=St(i);if(e||(i>=ut&&i<=dt?i+=32:i>lt&&(i=String.fromCodePoint(i).toLowerCase().codePointAt(0))),t&&(i=it(i)),i===r[s]){o&&f!==null&&f.add(m),c+=16;let e=Ct(p,a);u===0?d=e:(e===8&&(d=e),e=P(P(e,d),4)),s===0?c+=e*2:c+=e,l=!1,u++,s++}else l?c+=-1:c+=-3,l=!0,u=0,d=0;p=a}return[c,f]}const At=(e,t,n,r,i,a,o)=>{if(i.length===0)return[{start:0,end:0,score:0},null];if(Dt(r,i,e)<0)return[{start:-1,end:-1,score:0},null];let s=0,c=-1,l=-1,u=r.length,d=i.length;for(let a=0;a<u;a++){let o=r[gt(a,u,n)];e||(o>=ut&&o<=dt?o+=32:o>lt&&(o=String.fromCodePoint(o).toLowerCase().codePointAt(0))),t&&(o=it(o));let f=i[gt(s,d,n)];if(o===f&&(c<0&&(c=a),s++,s===d)){l=a+1;break}}if(c>=0&&l>=0){s--;for(let t=l-1;t>=c;t--){let a=r[gt(t,u,n)];e||(a>=ut&&a<=dt?a+=32:a>lt&&(a=String.fromCodePoint(a).toLowerCase().codePointAt(0)));let o=i[gt(s,d,n)];if(a===o&&(s--,s<0)){c=t;break}}if(!n){let e=c;c=u-l,l=u-e}let[o,f]=kt(e,t,r,i,c,l,a);return[{start:c,end:l,score:o},f]}return[{start:-1,end:-1,score:0},null]},jt=(e,t,n,r,i,a,o)=>{if(i.length===0)return[{start:0,end:0,score:0},null];let s=r.length,c=i.length;if(s<c||Dt(r,i,e)<0)return[{start:-1,end:-1,score:0},null];let l=0,u=-1,d=at(0),f=at(-1);for(let a=0;a<s;a++){let o=gt(a,s,n),p=r[o];e||(p>=ut&&p<=dt?p+=32:p>lt&&(p=String.fromCodePoint(p).toLowerCase().codePointAt(0))),t&&(p=it(p));let m=gt(l,c,n);if(i[m]===p){if(m===0&&(d=wt(r,o)),l++,l===c){if(d>f&&(u=a,f=d),d===8)break;a-=l-1,l=0,d=0}}else a-=l,l=0,d=0}if(u>=0){let a=0,o=0;n?(a=u-c+1,o=u+1):(a=s-(u+1),o=s-(u-c+1));let[l]=kt(e,t,r,i,a,o,!1);return[{start:a,end:o,score:l},null]}return[{start:-1,end:-1,score:0},null]};function Mt(e,t){return{i16:new Int16Array(e),i32:new Int32Array(t)}}const Nt=Mt(102400,2048),Pt=(e,t,n)=>{let r=!1;switch(t){case`smart-case`:e.toLowerCase()!==e&&(r=!0);break;case`case-sensitive`:r=!0;break;case`case-insensitive`:e=e.toLowerCase(),r=!1;break}let i=st(e);return n&&(i=i.map(it)),{queryRunes:i,caseSensitive:r}};function Ft(e,t){let n=Object.keys(e).map(e=>parseInt(e,10)).sort((e,t)=>t-e),r=[];for(let i of n)if(r=r.concat(e[i]),r.length>=t)break;return r}function It(e,t,n){return r=>{let i=this.runesList[r];if(t.length>i.length)return;let[a,o]=this.algoFn(n,this.opts.normalize,this.opts.forward,i,t,!0,Nt);if(a.start===-1)return;if(this.opts.fuzzy===!1){o=new Set;for(let e=a.start;e<a.end;++e)o.add(e)}let s=this.opts.sort?a.score:0;e[s]===void 0&&(e[s]=[]),e[s].push({item:this.items[r],...a,positions:o??new Set})}}function Lt(e){let{queryRunes:t,caseSensitive:n}=Pt(e,this.opts.casing,this.opts.normalize),r={},i=It.bind(this)(r,t,n);for(let e=0,t=this.runesList.length;e<t;++e)i(e);return Ft(r,this.opts.limit)}const Rt={limit:1/0,selector:e=>e,casing:`smart-case`,normalize:!0,fuzzy:`v2`,tiebreakers:[],sort:!0,forward:!0};var zt=class{constructor(e,...t){switch(this.opts={...Rt,...t[0]},this.items=e,this.runesList=e.map(e=>st(this.opts.selector(e).normalize())),this.algoFn=jt,this.opts.fuzzy){case`v2`:this.algoFn=Ot;break;case`v1`:this.algoFn=At;break}}};const Bt={...Rt,match:Lt};var Vt=class extends zt{constructor(e,...t){super(e,...t),this.opts={...Bt,...t[0]}}find(e){return e.length===0||this.items.length===0?this.items.slice(0,this.opts.limit).map(Ht):(e=e.normalize(),Ut(this.opts.match.bind(this)(e),this.opts))}};({...Rt});const Ht=e=>({item:e,start:-1,end:-1,score:0,positions:new Set});function Ut(e,t){if(t.sort){let{selector:n}=t;e.sort((e,r)=>{if(e.score===r.score)for(let i of t.tiebreakers){let t=i(e,r,n);if(t!==0)return t}return 0})}return Number.isFinite(t.limit)&&e.splice(t.limit),e}function Wt(e,t,n){return n(e.item).length-n(t.item).length}function Gt(e,t){return e.start-t.start}var Kt=class{constructor(e,...t){this.finder=new Vt(e,...t),this.find=this.finder.find.bind(this.finder)}},F=y(`lru-cache:metrics`),qt=b(`lru-cache`),Jt=typeof performance==`object`&&performance&&typeof performance.now==`function`?performance:Date,Yt=()=>F.hasSubscribers||qt.hasSubscribers,Xt=new Set,Zt=typeof process==`object`&&process?process:{},Qt=(e,t,n,r)=>{typeof Zt.emitWarning==`function`?Zt.emitWarning(e,t,n,r):console.error(`[${n}] ${t}: ${e}`)},$t=e=>!Xt.has(e),I=e=>!!e&&e===Math.floor(e)&&e>0&&isFinite(e),en=e=>I(e)?e<=2**8?Uint8Array:e<=2**16?Uint16Array:e<=2**32?Uint32Array:e<=2**53-1?tn:null:null,tn=class extends Array{constructor(e){super(e),this.fill(0)}},nn=class e{heap;length;static#e=!1;static create(t){let n=en(t);if(!n)return[];e.#e=!0;let r=new e(t,n);return e.#e=!1,r}constructor(t,n){if(!e.#e)throw TypeError(`instantiate Stack using Stack.create(n)`);this.heap=new n(t),this.length=0}push(e){this.heap[this.length++]=e}pop(){return this.heap[--this.length]}},rn=class e{#e;#t;#n;#r;#i;#a;#o;#s;get perf(){return this.#s}ttl;ttlResolution;ttlAutopurge;updateAgeOnGet;updateAgeOnHas;allowStale;noDisposeOnSet;noUpdateTTL;maxEntrySize;sizeCalculation;noDeleteOnFetchRejection;noDeleteOnStaleGet;allowStaleOnFetchAbort;allowStaleOnFetchRejection;ignoreFetchAbort;backgroundFetchSize;#c;#l;#u;#d;#f;#p;#m;#h;#g;#_;#v;#y;#b;#x;#S;#C;#w;#T;#E;static unsafeExposeInternals(e){return{starts:e.#b,ttls:e.#x,autopurgeTimers:e.#S,sizes:e.#y,keyMap:e.#u,keyList:e.#d,valList:e.#f,next:e.#p,prev:e.#m,get head(){return e.#h},get tail(){return e.#g},free:e.#_,isBackgroundFetch:t=>e.#W(t),backgroundFetch:(t,n,r,i)=>e.#U(t,n,r,i),moveToTail:t=>e.#X(t),indexes:t=>e.#I(t),rindexes:t=>e.#L(t),isStale:t=>e.#j(t)}}get max(){return this.#e}get maxSize(){return this.#t}get calculatedSize(){return this.#l}get size(){return this.#c}get fetchMethod(){return this.#a}get memoMethod(){return this.#o}get dispose(){return this.#n}get onInsert(){return this.#r}get disposeAfter(){return this.#i}constructor(t){let{max:n=0,ttl:r,ttlResolution:i=1,ttlAutopurge:a,updateAgeOnGet:o,updateAgeOnHas:s,allowStale:c,dispose:l,onInsert:u,disposeAfter:d,noDisposeOnSet:f,noUpdateTTL:p,maxSize:m=0,maxEntrySize:h=0,sizeCalculation:g,fetchMethod:_,memoMethod:v,noDeleteOnFetchRejection:y,noDeleteOnStaleGet:b,allowStaleOnFetchRejection:x,allowStaleOnFetchAbort:S,ignoreFetchAbort:ee,backgroundFetchSize:C=1,perf:w}=t;if(this.backgroundFetchSize=C,w!==void 0&&typeof w?.now!=`function`)throw TypeError(`perf option must have a now() method if specified`);if(this.#s=w??Jt,n!==0&&!I(n))throw TypeError(`max option must be a nonnegative integer`);let T=n?en(n):Array;if(!T)throw Error(`invalid max value: `+n);if(this.#e=n,this.#t=m,this.maxEntrySize=h||this.#t,this.sizeCalculation=g,this.sizeCalculation){if(!this.#t&&!this.maxEntrySize)throw TypeError(`cannot set sizeCalculation without setting maxSize or maxEntrySize`);if(typeof this.sizeCalculation!=`function`)throw TypeError(`sizeCalculation set to non-function`)}if(v!==void 0&&typeof v!=`function`)throw TypeError(`memoMethod must be a function if defined`);if(this.#o=v,_!==void 0&&typeof _!=`function`)throw TypeError(`fetchMethod must be a function if specified`);if(this.#a=_,this.#w=!!_,this.#u=new Map,this.#d=Array.from({length:n}).fill(void 0),this.#f=Array.from({length:n}).fill(void 0),this.#p=new T(n),this.#m=new T(n),this.#h=0,this.#g=0,this.#_=nn.create(n),this.#c=0,this.#l=0,typeof l==`function`&&(this.#n=l),typeof u==`function`&&(this.#r=u),typeof d==`function`?(this.#i=d,this.#v=[]):(this.#i=void 0,this.#v=void 0),this.#C=!!this.#n,this.#E=!!this.#r,this.#T=!!this.#i,this.noDisposeOnSet=!!f,this.noUpdateTTL=!!p,this.noDeleteOnFetchRejection=!!y,this.allowStaleOnFetchRejection=!!x,this.allowStaleOnFetchAbort=!!S,this.ignoreFetchAbort=!!ee,this.maxEntrySize!==0){if(this.#t!==0&&!I(this.#t))throw TypeError(`maxSize must be a positive integer if specified`);if(!I(this.maxEntrySize))throw TypeError(`maxEntrySize must be a positive integer if specified`);this.#M()}if(this.allowStale=!!c,this.noDeleteOnStaleGet=!!b,this.updateAgeOnGet=!!o,this.updateAgeOnHas=!!s,this.ttlResolution=I(i)||i===0?i:1,this.ttlAutopurge=!!a,this.ttl=r||0,this.ttl){if(!I(this.ttl))throw TypeError(`ttl must be a positive integer if specified`);this.#D()}if(this.#e===0&&this.ttl===0&&this.#t===0)throw TypeError(`At least one of max, maxSize, or ttl is required`);if(!this.ttlAutopurge&&!this.#e&&!this.#t){let t=`LRU_CACHE_UNBOUNDED`;$t(t)&&(Xt.add(t),Qt(`TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.`,`UnboundedCacheWarning`,t,e))}}getRemainingTTL(e){return this.#u.has(e)?1/0:0}#D(){let e=new tn(this.#e),t=new tn(this.#e);this.#x=e,this.#b=t;let n=this.ttlAutopurge?Array.from({length:this.#e}):void 0;this.#S=n,this.#A=(n,i,a=this.#s.now())=>{t[n]=i===0?0:a,e[n]=i,r(n,i)},this.#O=n=>{t[n]=e[n]===0?0:this.#s.now(),r(n,e[n])};let r=this.ttlAutopurge?(e,t)=>{if(n?.[e]&&(clearTimeout(n[e]),n[e]=void 0),t&&t!==0&&n){let i=setTimeout(()=>{this.#j(e)?(this.#Z(this.#d[e],`expire`),n[e]=void 0):r(e,o(e))},t+1);i.unref&&i.unref(),n[e]=i}}:()=>{};this.#k=(n,r)=>{if(e[r]){let o=e[r],s=t[r];if(!o||!s)return;n.ttl=o,n.start=s,n.now=i||a(),n.remainingTTL=o-(n.now-s)}};let i=0,a=()=>{let e=this.#s.now();if(this.ttlResolution>0){i=e;let t=setTimeout(()=>i=0,this.ttlResolution);t.unref&&t.unref()}return e};this.getRemainingTTL=e=>{let t=this.#u.get(e);return t===void 0?0:o(t)};let o=n=>{let r=e[n],o=t[n];return!r||!o?1/0:r-((i||a())-o)};this.#j=n=>{let r=t[n],o=e[n];return!!o&&!!r&&(i||a())-r>o}}#O=()=>{};#k=()=>{};#A=()=>{};#j=()=>!1;#M(){let e=new tn(this.#e);this.#l=0,this.#y=e,this.#N=t=>{this.#l-=e[t],e[t]=0},this.#F=(e,t,n,r)=>{if(!I(n)){if(this.#W(t))return this.backgroundFetchSize;if(r){if(typeof r!=`function`)throw TypeError(`sizeCalculation must be a function`);if(n=r(t,e),!I(n))throw TypeError(`sizeCalculation return invalid (expect positive integer)`)}else throw TypeError(`invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.`)}return n},this.#P=(t,n,r)=>{if(e[t]=n,this.#t){let n=this.#t-e[t];for(;this.#l>n;)this.#B(!0)}this.#l+=e[t],r&&(r.entrySize=n,r.totalCalculatedSize=this.#l)}}#N=e=>{};#P=(e,t,n)=>{};#F=(e,t,n,r)=>{if(n||r)throw TypeError(`cannot set size without setting maxSize or maxEntrySize on cache`);return 0};*#I({allowStale:e=this.allowStale}={}){if(this.#c)for(let t=this.#g;this.#R(t)&&((e||!this.#j(t))&&(yield t),t!==this.#h);)t=this.#m[t]}*#L({allowStale:e=this.allowStale}={}){if(this.#c)for(let t=this.#h;this.#R(t)&&((e||!this.#j(t))&&(yield t),t!==this.#g);)t=this.#p[t]}#R(e){return e!==void 0&&this.#u.get(this.#d[e])===e}*entries(){for(let e of this.#I())this.#f[e]!==void 0&&this.#d[e]!==void 0&&!this.#W(this.#f[e])&&(yield[this.#d[e],this.#f[e]])}*rentries(){for(let e of this.#L())this.#f[e]!==void 0&&this.#d[e]!==void 0&&!this.#W(this.#f[e])&&(yield[this.#d[e],this.#f[e]])}*keys(){for(let e of this.#I()){let t=this.#d[e];t!==void 0&&!this.#W(this.#f[e])&&(yield t)}}*rkeys(){for(let e of this.#L()){let t=this.#d[e];t!==void 0&&!this.#W(this.#f[e])&&(yield t)}}*values(){for(let e of this.#I())this.#f[e]!==void 0&&!this.#W(this.#f[e])&&(yield this.#f[e])}*rvalues(){for(let e of this.#L())this.#f[e]!==void 0&&!this.#W(this.#f[e])&&(yield this.#f[e])}[Symbol.iterator](){return this.entries()}[Symbol.toStringTag]=`LRUCache`;find(e,t={}){for(let n of this.#I()){let r=this.#f[n],i=this.#W(r)?r.__staleWhileFetching:r;if(i!==void 0&&e(i,this.#d[n],this))return this.#J(this.#d[n],t)}}forEach(e,t=this){for(let n of this.#I()){let r=this.#f[n],i=this.#W(r)?r.__staleWhileFetching:r;i!==void 0&&e.call(t,i,this.#d[n],this)}}rforEach(e,t=this){for(let n of this.#L()){let r=this.#f[n],i=this.#W(r)?r.__staleWhileFetching:r;i!==void 0&&e.call(t,i,this.#d[n],this)}}purgeStale(){let e=!1;for(let t of this.#L({allowStale:!0}))this.#j(t)&&(this.#Z(this.#d[t],`expire`),e=!0);return e}info(e){let t=this.#u.get(e);if(t===void 0)return;let n=this.#f[t],r=this.#W(n)?n.__staleWhileFetching:n;if(r===void 0)return;let i={value:r};if(this.#x&&this.#b){let e=this.#x[t],n=this.#b[t];e&&n&&(i.ttl=e-(this.#s.now()-n),i.start=Date.now())}return this.#y&&(i.size=this.#y[t]),i}dump(){let e=[];for(let t of this.#I({allowStale:!0})){let n=this.#d[t],r=this.#f[t],i=this.#W(r)?r.__staleWhileFetching:r;if(i===void 0||n===void 0)continue;let a={value:i};if(this.#x&&this.#b){a.ttl=this.#x[t];let e=this.#s.now()-this.#b[t];a.start=Math.floor(Date.now()-e)}this.#y&&(a.size=this.#y[t]),e.unshift([n,a])}return e}load(e){this.clear();for(let[t,n]of e){if(n.start){let e=Date.now()-n.start;n.start=this.#s.now()-e}this.#z(t,n.value,n)}}set(e,t,n={}){let{status:r=F.hasSubscribers?{}:void 0}=n;n.status=r,r&&(r.op=`set`,r.key=e,t!==void 0&&(r.value=t),r.cache=this);let i=this.#z(e,t,n);return r&&F.hasSubscribers&&F.publish(r),i}#z(e,t,n,r){let{ttl:i=this.ttl,start:a,noDisposeOnSet:o=this.noDisposeOnSet,sizeCalculation:s=this.sizeCalculation,status:c}=n,l=this.#W(t);if(t===void 0)return c&&(c.set=`deleted`),this.delete(e),this;let{noUpdateTTL:u=this.noUpdateTTL}=n;c&&!l&&(c.value=t);let d=this.#F(e,t,n.size||0,s,c);if(this.maxEntrySize&&d>this.maxEntrySize)return this.#Z(e,`set`),c&&(c.set=`miss`,c.maxEntrySizeExceeded=!0),this;let f=this.#c===0?void 0:this.#u.get(e);if(f===void 0)f=this.#c===0?this.#g:this.#_.length===0?this.#c===this.#e?this.#B(!1):this.#c:this.#_.pop(),this.#d[f]=e,this.#f[f]=t,this.#u.set(e,f),this.#p[this.#g]=f,this.#m[f]=this.#g,this.#g=f,this.#c++,this.#P(f,d,c),c&&(c.set=`add`),u=!1,this.#E&&!l&&this.#r?.(t,e,`add`);else{this.#X(f);let n=this.#f[f];if(t!==n){if(!o)if(this.#W(n)){n!==r&&n.__abortController.abort(Error(`replaced`));let{__staleWhileFetching:i}=n;i!==void 0&&i!==t&&(this.#C&&this.#n?.(i,e,`set`),this.#T&&this.#v?.push([i,e,`set`]))}else this.#C&&this.#n?.(n,e,`set`),this.#T&&this.#v?.push([n,e,`set`]);if(this.#N(f),this.#P(f,d,c),this.#f[f]=t,!l){let r=n&&this.#W(n)?n.__staleWhileFetching:n,i=r===void 0?`add`:t===r?`update`:`replace`;c&&(c.set=i,r!==void 0&&(c.oldValue=r)),this.#E&&this.onInsert?.(t,e,i)}}else l||(c&&(c.set=`update`),this.#E&&this.onInsert?.(t,e,`update`))}if(i!==0&&!this.#x&&this.#D(),this.#x&&(u||this.#A(f,i,a),c&&this.#k(c,f)),!o&&this.#T&&this.#v){let e=this.#v,t;for(;t=e?.shift();)this.#i?.(...t)}return this}pop(){try{for(;this.#c;){let e=this.#f[this.#h];if(this.#B(!0),this.#W(e)){if(e.__staleWhileFetching)return e.__staleWhileFetching}else if(e!==void 0)return e}}finally{if(this.#T&&this.#v){let e=this.#v,t;for(;t=e?.shift();)this.#i?.(...t)}}}#B(e){let t=this.#h,n=this.#d[t],r=this.#f[t],i=this.#W(r);i&&r.__abortController.abort(Error(`evicted`));let a=i?r.__staleWhileFetching:r;return(this.#C||this.#T)&&a!==void 0&&(this.#C&&this.#n?.(a,n,`evict`),this.#T&&this.#v?.push([a,n,`evict`])),this.#N(t),this.#S?.[t]&&(clearTimeout(this.#S[t]),this.#S[t]=void 0),e&&(this.#d[t]=void 0,this.#f[t]=void 0,this.#_.push(t)),this.#c===1?(this.#h=this.#g=0,this.#_.length=0):this.#h=this.#p[t],this.#u.delete(n),this.#c--,t}has(e,t={}){let{status:n=F.hasSubscribers?{}:void 0}=t;t.status=n,n&&(n.op=`has`,n.key=e,n.cache=this);let r=this.#V(e,t);return F.hasSubscribers&&F.publish(n),r}#V(e,t={}){let{updateAgeOnHas:n=this.updateAgeOnHas,status:r}=t,i=this.#u.get(e);if(i!==void 0){let e=this.#f[i];if(this.#W(e)&&e.__staleWhileFetching===void 0)return!1;if(this.#j(i))r&&(r.has=`stale`,this.#k(r,i));else return n&&this.#O(i),r&&(r.has=`hit`,this.#k(r,i)),!0}else r&&(r.has=`miss`);return!1}peek(e,t={}){let{status:n=Yt()?{}:void 0}=t;n&&(n.op=`peek`,n.key=e,n.cache=this),t.status=n;let r=this.#H(e,t);return F.hasSubscribers&&F.publish(n),r}#H(e,t){let{status:n,allowStale:r=this.allowStale}=t,i=this.#u.get(e);if(i===void 0||!r&&this.#j(i)){n&&(n.peek=i===void 0?`miss`:`stale`);return}let a=this.#f[i],o=this.#W(a)?a.__staleWhileFetching:a;return n&&(o===void 0?n.peek=`miss`:(n.peek=`hit`,n.value=o)),o}#U(e,t,n,r){let i=t===void 0?void 0:this.#f[t];if(this.#W(i))return i;let a=new AbortController,{signal:o}=n;o?.addEventListener(`abort`,()=>a.abort(o.reason),{signal:a.signal});let s={signal:a.signal,options:n,context:r},c=(r,i=!1)=>{let{aborted:o}=a.signal,c=n.ignoreFetchAbort&&r!==void 0,l=n.ignoreFetchAbort||!!(n.allowStaleOnFetchAbort&&r!==void 0);if(n.status&&(o&&!i?(n.status.fetchAborted=!0,n.status.fetchError=a.signal.reason,c&&(n.status.fetchAbortIgnored=!0)):n.status.fetchResolved=!0),o&&!c&&!i)return u(a.signal.reason,l);let d=f,p=this.#f[t];return(p===f||p===void 0&&c&&i)&&(r===void 0?d.__staleWhileFetching===void 0?this.#Z(e,`fetch`):this.#f[t]=d.__staleWhileFetching:(n.status&&(n.status.fetchUpdated=!0),this.#z(e,r,s.options,d))),r},l=e=>(n.status&&(n.status.fetchRejected=!0,n.status.fetchError=e),u(e,!1)),u=(r,i)=>{let{aborted:o}=a.signal,s=o&&n.allowStaleOnFetchAbort,c=s||n.allowStaleOnFetchRejection,l=c||n.noDeleteOnFetchRejection,u=f;if(this.#f[t]===f&&(!l||!i&&u.__staleWhileFetching===void 0?this.#Z(e,`fetch`):s||(this.#f[t]=u.__staleWhileFetching)),c)return n.status&&u.__staleWhileFetching!==void 0&&(n.status.returnedStale=!0),u.__staleWhileFetching;if(u.__returned===u)throw r},d=(t,r)=>{let o=this.#a?.(e,i,s);a.signal.addEventListener(`abort`,()=>{(!n.ignoreFetchAbort||n.allowStaleOnFetchAbort)&&(t(void 0),n.allowStaleOnFetchAbort&&(t=e=>c(e,!0)))}),o&&o instanceof Promise?o.then(e=>t(e===void 0?void 0:e),r):o!==void 0&&t(o)};n.status&&(n.status.fetchDispatched=!0);let f=new Promise(d).then(c,l),p=Object.assign(f,{__abortController:a,__staleWhileFetching:i,__returned:void 0});return t===void 0?(this.#z(e,p,{...s.options,status:void 0}),t=this.#u.get(e)):this.#f[t]=p,p}#W(e){if(!this.#w)return!1;let t=e;return!!t&&t instanceof Promise&&t.hasOwnProperty(`__staleWhileFetching`)&&t.__abortController instanceof AbortController}fetch(e,t={}){let n=qt.hasSubscribers,{status:r=Yt()?{}:void 0}=t;t.status=r,r&&t.context&&(r.context=t.context);let i=this.#G(e,t);return r&&n&&(r.trace=!0,qt.tracePromise(()=>i,r).catch(()=>{})),i}async#G(e,t={}){let{allowStale:n=this.allowStale,updateAgeOnGet:r=this.updateAgeOnGet,noDeleteOnStaleGet:i=this.noDeleteOnStaleGet,ttl:a=this.ttl,noDisposeOnSet:o=this.noDisposeOnSet,size:s=0,sizeCalculation:c=this.sizeCalculation,noUpdateTTL:l=this.noUpdateTTL,noDeleteOnFetchRejection:u=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:d=this.allowStaleOnFetchRejection,ignoreFetchAbort:f=this.ignoreFetchAbort,allowStaleOnFetchAbort:p=this.allowStaleOnFetchAbort,context:m,forceRefresh:h=!1,status:g,signal:_}=t;if(g&&(g.op=`fetch`,g.key=e,h&&(g.forceRefresh=!0),g.cache=this),!this.#w)return g&&(g.fetch=`get`),this.#J(e,{allowStale:n,updateAgeOnGet:r,noDeleteOnStaleGet:i,status:g});let v={allowStale:n,updateAgeOnGet:r,noDeleteOnStaleGet:i,ttl:a,noDisposeOnSet:o,size:s,sizeCalculation:c,noUpdateTTL:l,noDeleteOnFetchRejection:u,allowStaleOnFetchRejection:d,allowStaleOnFetchAbort:p,ignoreFetchAbort:f,status:g,signal:_},y=this.#u.get(e);if(y===void 0){g&&(g.fetch=`miss`);let t=this.#U(e,y,v,m);return t.__returned=t}else{let t=this.#f[y];if(this.#W(t)){let e=n&&t.__staleWhileFetching!==void 0;return g&&(g.fetch=`inflight`,e&&(g.returnedStale=!0)),e?t.__staleWhileFetching:t.__returned=t}let i=this.#j(y);if(!h&&!i)return g&&(g.fetch=`hit`),this.#X(y),r&&this.#O(y),g&&this.#k(g,y),t;let a=this.#U(e,y,v,m),o=a.__staleWhileFetching!==void 0&&n;return g&&(g.fetch=i?`stale`:`refresh`,o&&i&&(g.returnedStale=!0)),o?a.__staleWhileFetching:a.__returned=a}}forceFetch(e,t={}){let n=qt.hasSubscribers,{status:r=Yt()?{}:void 0}=t;t.status=r,r&&t.context&&(r.context=t.context);let i=this.#K(e,t);return r&&n&&(r.trace=!0,qt.tracePromise(()=>i,r).catch(()=>{})),i}async#K(e,t={}){let n=await this.#G(e,t);if(n===void 0)throw Error(`fetch() returned undefined`);return n}memo(e,t={}){let{status:n=F.hasSubscribers?{}:void 0}=t;t.status=n,n&&(n.op=`memo`,n.key=e,t.context&&(n.context=t.context),n.cache=this);let r=this.#q(e,t);return n&&(n.value=r),F.hasSubscribers&&F.publish(n),r}#q(e,t={}){let n=this.#o;if(!n)throw Error(`no memoMethod provided to constructor`);let{context:r,status:i,forceRefresh:a,...o}=t;i&&a&&(i.forceRefresh=!0);let s=this.#J(e,o),c=a||s===void 0;if(i&&(i.memo=c?`miss`:`hit`,c||(i.value=s)),!c)return s;let l=n(e,s,{options:o,context:r});return i&&(i.value=l),this.#z(e,l,o),l}get(e,t={}){let{status:n=F.hasSubscribers?{}:void 0}=t;t.status=n,n&&(n.op=`get`,n.key=e,n.cache=this);let r=this.#J(e,t);return n&&(r!==void 0&&(n.value=r),F.hasSubscribers&&F.publish(n)),r}#J(e,t={}){let{allowStale:n=this.allowStale,updateAgeOnGet:r=this.updateAgeOnGet,noDeleteOnStaleGet:i=this.noDeleteOnStaleGet,status:a}=t,o=this.#u.get(e);if(o===void 0){a&&(a.get=`miss`);return}let s=this.#f[o],c=this.#W(s);return a&&this.#k(a,o),this.#j(o)?c?(a&&(a.get=`stale-fetching`),n&&s.__staleWhileFetching!==void 0?(a&&(a.returnedStale=!0),s.__staleWhileFetching):void 0):(i||this.#Z(e,`expire`),a&&(a.get=`stale`),n?(a&&(a.returnedStale=!0),s):void 0):(a&&(a.get=c?`fetching`:`hit`),this.#X(o),r&&this.#O(o),c?s.__staleWhileFetching:s)}#Y(e,t){this.#m[t]=e,this.#p[e]=t}#X(e){e!==this.#g&&(e===this.#h?this.#h=this.#p[e]:this.#Y(this.#m[e],this.#p[e]),this.#Y(this.#g,e),this.#g=e)}delete(e){return this.#Z(e,`delete`)}#Z(e,t){F.hasSubscribers&&F.publish({op:`delete`,delete:t,key:e,cache:this});let n=!1;if(this.#c!==0){let r=this.#u.get(e);if(r!==void 0)if(this.#S?.[r]&&(clearTimeout(this.#S[r]),this.#S[r]=void 0),n=!0,this.#c===1)this.#Q(t);else{this.#N(r);let n=this.#f[r];if(this.#W(n)?n.__abortController.abort(Error(`deleted`)):(this.#C||this.#T)&&(this.#C&&this.#n?.(n,e,t),this.#T&&this.#v?.push([n,e,t])),this.#u.delete(e),this.#d[r]=void 0,this.#f[r]=void 0,r===this.#g)this.#g=this.#m[r];else if(r===this.#h)this.#h=this.#p[r];else{let e=this.#m[r];this.#p[e]=this.#p[r];let t=this.#p[r];this.#m[t]=this.#m[r]}this.#c--,this.#_.push(r)}}if(this.#T&&this.#v?.length){let e=this.#v,t;for(;t=e?.shift();)this.#i?.(...t)}return n}clear(){return this.#Q(`delete`)}#Q(e){for(let t of this.#L({allowStale:!0})){let n=this.#f[t];if(this.#W(n))n.__abortController.abort(Error(`deleted`));else{let r=this.#d[t];this.#C&&this.#n?.(n,r,e),this.#T&&this.#v?.push([n,r,e])}}if(this.#u.clear(),this.#f.fill(void 0),this.#d.fill(void 0),this.#x&&this.#b){this.#x.fill(0),this.#b.fill(0);for(let e of this.#S??[])e!==void 0&&clearTimeout(e);this.#S?.fill(void 0)}if(this.#y&&this.#y.fill(0),this.#h=0,this.#g=0,this.#_.length=0,this.#l=0,this.#c=0,this.#T&&this.#v){let e=this.#v,t;for(;t=e?.shift();)this.#i?.(...t)}}},an=`@teacss/autocomplete`;const on=5e4,sn=2e6,cn=5e4,ln=4096,un=1e3,dn=5e7,fn=1e5,pn=new Map(Array.from(`ÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝßàáâãäåçèéêëìíîïñòóôõöøùúûüýÿĀāĂ㥹ĆćĈĉĊċČčĎďđĒēĔĕĖėĘęĚěĜĝĞğĠġĢģĤĥħĨĩĪīĬĭĮįİıĴĵĶķĹĺĻļĽľŀłŃńŅņŇňŌōŎŏŐőŔŕŖŗŘřŚśŜŝŞşŠšŢţŤťŧŨũŪūŬŭŮůŰűŲųŴŵŶŷŸŹźŻżŽžſƀƁƃƆƈƉƊƌƎƐƒƓƗƙƚƜƝƞƟƠơƥƫƭƮƯưƲƴƶǍǎǏǐǑǒǓǔǗǘǝǥǦǧǨǩǪǫǰǴǵǸǹȀȁȂȃȄȅȆȇȈȉȊȋȌȍȎȏȐȑȒȓȔȕȖȗȘșȚțȞȟȠȡȥȦȧȨȩȮȯȲȳȴȵȶȷȺȻȼȽȾȿɀɃɄɅɆɇɈɉɊɋɌɍɎɏɐɑɓɔɕɖɗɘɛɜɝɞɟɠɡɢɥɦɨɪɫɬɭɯɰɱɲɳɴɵɹɺɻɼɽɾɿʀʁʂʇʈʉʋʌʍʎʏʐʑʗʙʚʛʜʝʞʟʠʮͣͤͥͦͧͨͩͪͫͬͭͮͯᴀᴃᴄᴅᴇᴈᴉᴊᴋᴌᴍᴎᴏᴐᴑᴒᴓᴖᴗᴘᴙᴚᴛᴜᴝᴞᴟᴠᴡᴢᵢᵣᵤᵥḀḁḂḃḄḅḆḇḊḋḌḍḎḏḐḑḒḓḘḙḚḛḞḟḠḡḢḣḤḥḦḧḨḩḪḫḬḭḮḯḰḱḲḳḴḵḶḷḺḻḼḽḾḿṀṁṂṃṄṅṆṇṈṉṊṋṔṕṖṗṘṙṚṛṞṟṠṡṢṣṪṫṬṭṮṯṰṱṲṳṴṵṶṷṼṽṾṿẀẁẂẃẄẅẆẇẈẉẊẋẌẍẎẏẐẑẒẓẔẕẖẗẘẙẚẛẠạẢảẤấẦầẨẩẪẫẬậẮắẰằẲẳẴẵẶặẸẹẺẻẼẽẾếỀềỂểỄễỆệỈỉỊịỌọỎỏỐốỒồỔổỖỗỘộỚớỜờỞởỠỡỢợỤụỦủỨứỪừỬửỮữỰựỲỳỴỵỶỷỸỹⁱₕₖₗₘₙₚₛₜↄ`,(e,t)=>[e,`AAAAAACEEEEIIIINOOOOOOUUUUYsaaaaaaceeeeiiiinoooooouuuuyyAaAaAaCcCcCcCcDddEeEeEeEeEeGgGgGgGgHhhIiIiIiIiIiJjKkLlLlLlllNnNnNnOoOoOoRrRrRrSsSsSsSsTtTttUuUuUuUuUuUuWwYyYZzZzZzsbBbOcDDdEEfGIklMNnOOopttTUuVyzAaIiOoUuUuegGgKkOojGgNnAaAaEeEeIiIiOoOoRrRrUuUuSsTtHhNdzAaEeOoYylntjACcLTszBUVEeJjQqRrYyaabocddeeeeejggGhhiIlllmmmnnNorrrrrrrRRsttuvvwyYzzcBeGHjkLqhaeioucdhmrtvxABCDEeiJKLMNOOoooooPRRTUuumVWZiruvAaBbBbBbDdDdDdDdDdEeEeFfGgHhHhHhHhHhIiIiKkKkKkLlLlLlMmMmMmNnNnNnNnPpPpRrRrRrSsSsTtTtTtTtUuUuUuVvVvWwWwWwWwWwXxXxYyZzZzZzhtwyasAaAaAaAaAaAaAaAaAaAaAaAaEeEeEeEeEeEeEeEeIiIiOoOoOoOoOoOoOoOoOoOoOoOoUuUuUuUuUuUuUuYyYyYyYyihklmnpstc`[t]])),L={maxAttempts:cn,maxCandidateLength:ln,maxCandidates:on,maxCharacters:sn,maxScans:fn,maxScannedCharacters:5e7},mn={...L,maxCandidateLength:sn,maxCandidates:un};function hn(){return{suggestions:[],attempts:0,candidates:0,characters:0,scans:0,truncated:!1}}const gn=new WeakMap,_n=new WeakMap;function vn(e,t,n){let r=gn.get(e);if(!r){let n=e.suggest(t,`prefix`)??[];return{suggestions:n,attempts:n.length,candidates:n.length,characters:n.reduce((e,t)=>e+t.length,0),scans:n.length,truncated:!1}}return r(t,n)}function yn(e,t,n){let r=_n.get(e);return r?r(t,n):vn(e,t,n)}var bn=class extends Error{template;constructor(e,t){super(e),this.template=t,this.name=an,this.template=t}toString(){return`⚠️ [${this.name}]: ${this.message}. ${this.template?`Template: ${this.template}.`:``}`}};const xn={directions:`(x|y|t|b|l|r|s|e)`,num:`(${[0,1,2,3,4,5,6,8,10,12,24,36].join(`|`)})`,percent:`(${[0,10,20,30,40,50,60,70,80,90,100].join(`|`)})`,percentage:`(${[`10%`,`20%`,`30%`,`40%`,`50%`,`60%`,`70%`,`80%`,`90%`,`100%`].join(`|`)})`},Sn=[`DEFAULT`];function Cn(e,t,n,r){let i=0;Array.from(e.matchAll(t)).forEach(t=>{let a=t.index;i!==a&&r(e.slice(i,a),i,a),n(t),i=a+t[0].length}),i!==e.length&&r(e.slice(i),i,e.length)}const wn=on;function Tn(e,t){let n=0;for(let r=t;r<e.length;r++)if(e[r]===`(`)n++;else if(e[r]===`)`&&--n===0)return r}function En(e){let t=[],n=0,r=0;for(let i=0;i<e.length;i++){let a=e[i];a===`(`?n++:a===`)`?n--:a===`|`&&n===0&&(t.push(e.slice(r,i)),r=i+1)}return t.push(e.slice(r)),t}function Dn(e,t){let n=e.indexOf(`(`),r=n===-1?void 0:Tn(e,n);if(n===-1||r==null)return[e];let i=e.slice(0,n),a=Dn(e.slice(r+1),t);if(a===void 0)return;let o=[];for(let s of En(e.slice(n+1,r))){let e=Dn(s,t);if(e===void 0)return;for(let n of e)for(let e of a){if(--t.remaining<0)return;o.push(`${i}${n}${e}`)}}return o}function On(e){let t={remaining:wn},n=[];for(let r of En(e)){let e=Dn(r,t);if(e===void 0)return;n.push(...e)}return n}function kn(e,t={},n={}){let r=[],i=[],a={...xn,...n};e=e.replace(/<([\w-]+)>/g,(e,t,n,r)=>Object.hasOwn(a,t)?a[t]:(i.push(new bn(`Unknown template shorthand: <${t}>`,r)),e)),c(e),i.length&&(r.length=0);let o={parts:r,suggest:l,errors:i};return gn.set(o,d),_n.set(o,u),o;function s(e){Cn(e,/\$([\w.|-]+)/g,e=>{r.push({type:`theme`,objects:e[1].split(`|`).map(n=>{let r=n.split(`.`).reduce((t,n)=>!n||typeof t!=`object`||!t||!Object.hasOwn(t,n)||!t[n]?(i.push(new bn(`Invalid theme key: ${n}`,e.input)),{}):t[n],t);return typeof r!=`object`||!r||Array.isArray(r)?(i.push(new bn(`Invalid theme path: ${n}`,e.input)),{}):r})})},e=>{r.push({type:`static`,value:e})})}function c(t){let n=0;for(let a=0;a<t.length;a++){if(t[a]!==`(`)continue;let o=Tn(t,a);if(o==null)break;let c=t.slice(a+1,o);if(n!==a&&s(t.slice(n,a)),n=o+1,!c.includes(`|`)){r.push({type:`static`,value:t.slice(a,o+1)}),a=o;continue}let l=On(c);l===void 0?(i.push(new bn(`Template group expands past ${wn} values: (${c})`,e)),r.push({type:`static`,value:t.slice(a,o+1)})):r.push({type:`group`,values:l}),a=o}n!==t.length&&s(t.slice(n))}function l(e,t=`prefix`){if(e.length>1&&t===`fuzzy`){let t=e!==e.toLowerCase(),n=B(e,t),i=d(e,{maxCandidates:un}).suggestions.filter(e=>In(n,B(e,t),e,0));if(n.length>ln)return i;let a=yr(r,{},e).candidates;if(i.length){let e=new Set(i);if(a.every(t=>e.has(t)))return i}if(Fn(e,a.reduce((e,t)=>e+t.length,0))){let t=Nn(a,e),n=t.filter(t=>Vn(t,e));return n.length?mr(n,[...i,...t]):mr(i,t)}return mr(i,new Kt(a,{fuzzy:`v1`,limit:un}).find(e).map(e=>e.item))}return u(e).suggestions}function u(e,t={}){let n={...mn,...t},i=R(e);if(i.length>n.maxCandidateLength)return hn();let a=An(r);if(a){let t=jn(r,0,a.index);if(!Qn(t,e)&&!Qn(R(t),i))return hn();let o=jn(r,a.index+1,r.length);return $n(a.part,t,o,e,a.suppressPartialRoots,n)}let o=Mn(r);return o&&!Qn(o,e)&&!Qn(R(o),R(e))?hn():Un(r,e,n)}function d(e,t={}){let n={...L,...t},i=u(e,n),a=Mn(r);if(i.suggestions.length||!a)return i;let o={...n,maxAttempts:n.maxAttempts-i.attempts,maxCandidates:n.maxCandidates-i.candidates,maxCharacters:n.maxCharacters-i.characters,maxScans:n.maxScans-i.scans},s=u(a+e,o);return{suggestions:s.suggestions,attempts:i.attempts+s.attempts,candidates:i.candidates+s.candidates,characters:i.characters+s.characters,scans:i.scans+s.scans,truncated:i.truncated||s.truncated}}}function An(e){let t,n=!1;for(let r=0;r<e.length;r++){let i=e[r];if(i.type!==`static`){if(i.type===`group`&&i.values.length>0&&i.values.every(e=>e===``)){n=!0;continue}if(i.type!==`theme`||t)return;t={index:r,part:i}}}return t&&{...t,suppressPartialRoots:n}}function jn(e,t,n){let r=``;for(let i=t;i<n;i++){let t=e[i];t.type===`static`&&(r+=t.value)}return r}function Mn(e){let t=e.findIndex(e=>e.type!==`static`);return jn(e,0,t<0?e.length:t)}function R(e){return e.replace(/-/g,``)}function Nn(e,t){return z(e,t)}function z(e,t,n={}){let r={...L,maxCandidates:un,...n};if(!t)return Pn(e,r);let i=t!==t.toLowerCase(),a=B(t,i);if(a.length>r.maxCandidateLength)return[];let o={characters:0,items:[],retained:new Set},s=new Set,c=e[Symbol.iterator](),l=0,u=0;for(;l<r.maxAttempts&&u<r.maxScannedCharacters;){let e=c.next();if(e.done)break;let t=e.value,n=l++;if(!t||t.length>r.maxCandidateLength||s.has(t)||t.length>r.maxScannedCharacters-u)continue;s.add(t),u+=t.length;let d=In(a,B(t,i),t,n);d&&Ln(o,d,r.maxCandidates,r.maxCharacters)}return o.items.sort(Bn).map(({candidate:e})=>e)}function Pn(e,t){let n=[],r=new Set,i=e[Symbol.iterator](),a=0,o=0,s=0;for(;a<t.maxAttempts&&n.length<t.maxCandidates&&o<t.maxCharacters&&s<t.maxScannedCharacters;){let e=i.next();if(e.done)break;let c=e.value;a++,!(!c||c.length>t.maxCandidateLength||r.has(c)||c.length>t.maxScannedCharacters-s)&&(r.add(c),s+=c.length,!(o+c.length>t.maxCharacters)&&(n.push(c),o+=c.length))}return n}function Fn(e,t){return e.length*t>dn}function In(e,t,n,r){if(t===e)return{candidate:n,category:0,gaps:0,longestRun:e.length,start:0,order:r};if(t.startsWith(e))return{candidate:n,category:1,gaps:0,longestRun:e.length,start:0,order:r};let i=0,a=-1,o=-1,s=0,c=0,l=0;for(let n=0;n<t.length&&i<e.length;n++)t[n]===e[i]&&(a<0&&(a=n),o>=0&&(l+=n-o-1),s=n===o+1?s+1:1,c=Math.max(c,s),o=n,i++);if(i===e.length)return{candidate:n,category:2,gaps:l,longestRun:c,start:a,order:r}}function Ln(e,t,n,r){e.retained.has(t.candidate)||(e.items.length<n&&e.characters+t.candidate.length<=r?(e.items.push(t),e.retained.add(t.candidate),e.characters+=t.candidate.length,Rn(e.items,e.items.length-1)):e.items.length&&Bn(t,e.items[0])<0&&e.characters-e.items[0].candidate.length+t.candidate.length<=r&&(e.retained.delete(e.items[0].candidate),e.characters+=t.candidate.length-e.items[0].candidate.length,e.items[0]=t,e.retained.add(t.candidate),zn(e.items,0)))}function Rn(e,t){for(;t>0;){let n=t-1>>>1;if(Bn(e[t],e[n])<=0)return;[e[n],e[t]]=[e[t],e[n]],t=n}}function zn(e,t){for(;;){let n=t*2+1;if(n>=e.length)return;let r=n+1,i=n;if(r<e.length&&Bn(e[r],e[n])>0&&(i=r),Bn(e[i],e[t])<=0)return;[e[t],e[i]]=[e[i],e[t]],t=i}}function Bn(e,t){return e.category-t.category||e.gaps-t.gaps||t.longestRun-e.longestRun||e.start-t.start||e.candidate.length-t.candidate.length||e.order-t.order}function Vn(e,t){let n=t!==t.toLowerCase();return B(e,n)===B(t,n)}function B(e,t){let n=e.normalize(),r=Hn(n)?n:Array.from(n,e=>pn.get(e)??e).join(``);return t?r:r.toLowerCase()}function Hn(e){for(let t=0;t<e.length;t++)if(e.charCodeAt(t)>127)return!1;return!0}function Un(e,t,n={}){let r={...L,...n};if(r.maxAttempts<=0||r.maxCandidates<=0||r.maxCharacters<=0)return hn();let i=R(t),a=Wn(),o=Wn(),s=r.maxCandidates,c=nr(r.maxScans),l=[],u=Array.from({length:e.length},()=>``),d=Array.from({length:e.length+1},()=>0),f=Array.from({length:e.length+1},()=>0),p=Array.from({length:e.length+1},()=>0),m=[],h=new Set,g=0,_=0;for(;_>=0&&!c.truncated;){if(_===e.length){let e=u.join(``),n=f[_]>=t.length,c=p[_]>=i.length;if((n||c)&&e.length<=r.maxCharacters){let t=!h.has(e);(!t||g<r.maxAttempts)&&(t&&(h.add(e),g++),n&&Gn(a,e,m,s,r),c&&Gn(o,e,m,s,r))}_--;continue}if(g>=r.maxAttempts)break;let n=l[_];n||(n={choiceIndex:0,iterator:hr(e[_],r.maxCandidateLength-d[_],c)},l[_]=n);let v=n.iterator.next();if(v.done){l.pop(),_--;continue}let y=n.choiceIndex++,b=v.value,x=d[_]+b.length;if(x>r.maxCandidateLength)continue;let S=f[_]<0?-1:Zn(t,f[_],b,!1),ee=p[_]<0?-1:Zn(i,p[_],b,!0);if(S<0&&ee<0)continue;for(;m.length&&!(m.at(-1).depth<_);)m.pop();y>0&&m.push({depth:_,index:y}),u[_]=b;let C=_+1;d[C]=x,f[C]=S,p[C]=ee,l.length=C,_=C}let v=a.entries.length?a:o;v.entries.sort((e,t)=>Xn(e.path,t.path));let y=v.entries.map(e=>e.candidate);return{suggestions:y,attempts:g,candidates:y.length,characters:v.characters,scans:c.initial-c.remaining,truncated:c.truncated}}function Wn(){return{characters:0,entries:[],indices:new Map}}function Gn(e,t,n,r,i){let a=e.indices.get(t);if(a!==void 0){let t=e.entries[a];Xn(n,t.path)<0&&(t.path=n.slice(),Jn(e,a));return}if(r<=0||t.length>i.maxCharacters)return;let o={candidate:t,path:n.slice()};if(e.entries.length>=r){if(Xn(o.path,e.entries[0].path)>=0)return;Kn(e)}for(;e.entries.length&&e.characters+t.length>i.maxCharacters;){if(Xn(o.path,e.entries[0].path)>=0)return;Kn(e)}e.characters+t.length>i.maxCharacters||(e.indices.set(t,e.entries.length),e.entries.push(o),e.characters+=t.length,qn(e,e.entries.length-1))}function Kn(e){let t=e.entries[0],n=e.entries.pop();e.indices.delete(t.candidate),e.characters-=t.candidate.length,e.entries.length&&(e.entries[0]=n,e.indices.set(n.candidate,0),Jn(e,0))}function qn(e,t){for(;t>0;){let n=t-1>>>1;if(Xn(e.entries[t].path,e.entries[n].path)<=0)return;Yn(e,n,t),t=n}}function Jn(e,t){for(;;){let n=t*2+1;if(n>=e.entries.length)return;let r=n+1,i=n;if(r<e.entries.length&&Xn(e.entries[r].path,e.entries[n].path)>0&&(i=r),Xn(e.entries[i].path,e.entries[t].path)<=0)return;Yn(e,i,t),t=i}}function Yn(e,t,n){[e.entries[t],e.entries[n]]=[e.entries[n],e.entries[t]],e.indices.set(e.entries[t].candidate,t),e.indices.set(e.entries[n].candidate,n)}function Xn(e,t){let n=e.length-1,r=t.length-1;for(;n>=0||r>=0;){let i=n>=0?e[n].depth:-1,a=r>=0?t[r].depth:-1,o=Math.max(i,a),s=i===o?e[n--].index:0,c=a===o?t[r--].index:0;if(s!==c)return s-c}return 0}function Zn(e,t,n,r){let i=t;for(let t=0;t<n.length;t++){let a=n[t];if(!(r&&a===`-`)){if(i<e.length&&e[i]!==a)return-1;i++}}return i}function Qn(e,t){return e.length<=t.length?t.startsWith(e):e.startsWith(t)}function $n(e,t,n,r,i,a){let o={...L,...a};if(t.length+1>o.maxCandidateLength)return hn();let s=nr(o.maxScans),c=ar(e.objects,s),l=or(r,!1,o),u=or(R(r),!0,o);er(c,t,n,o.maxCandidateLength,i,l,u,s);let d=cr(l,s);if(d.suggestions.length||!d.exhausted)return d;let f=cr(u,s);return{suggestions:f.suggestions,attempts:d.attempts+f.attempts,candidates:d.candidates+f.candidates,characters:d.characters+f.characters,scans:f.scans,truncated:f.truncated}}function er(e,t,n,r,i,a,o,s){for(let c of e){let e=t+c.key,l=lr(e,a.input,!1),u=lr(e,o.input,!0);if(l===`none`&&u===`none`)continue;let d=dr(c.objects,e,n,a.input,o.input,r),f=l===`partial`||u===`partial`?fr(d,s):void 0,p=f!==void 0;if(ur(a,l,c.hasLeaf,p,e,n,i),ur(o,u,c.hasLeaf,p,e,n,i),a.blocked)return;for(f??=fr(d,s);f;){if((l===`reached`||i&&l===`partial`)&&sr(a,f.candidate,f.rawMatch),(u===`reached`||i&&u===`partial`)&&sr(o,f.candidate,f.normalizedMatch),a.blocked)return;f=fr(d,s)}if(s.truncated||a.blocked)return}}function tr(e){return!!e&&e[0]!==`_`&&!Sn.includes(e)}function nr(e=fn){let t=Math.max(0,e);return{initial:t,remaining:t,truncated:!1}}function rr(e){return e.remaining<=0?(e.truncated=!0,!1):(e.remaining--,!0)}function*ir(e){yield*Object.keys(e)}function ar(e,t){let n=new Map;outer:for(let r of e)for(let e of ir(r)){if(!rr(t))break outer;if(!tr(e))continue;let i=r[e];if(i==null)continue;let a=n.get(e)??{key:e,hasLeaf:!1,objects:[]};if(typeof i!=`object`||Array.isArray(i))a.hasLeaf=!0;else{let e=i;a.objects.push(e),a.hasLeaf||=Object.hasOwn(e,`DEFAULT`)&&e.DEFAULT!==null&&e.DEFAULT!==void 0}n.set(e,a)}return[...n.values()]}function or(e,t,n){return{attempts:0,blocked:n.maxAttempts<=0||n.maxCandidates<=0||n.maxCharacters<=0,characters:0,input:e,limits:n,normalize:t,seen:new Set,suggestions:[]}}function sr(e,t,n){!n||e.blocked||e.seen.has(t)||(e.seen.add(t),e.attempts++,t.length<=e.limits.maxCandidateLength&&e.characters+t.length<=e.limits.maxCharacters&&(e.suggestions.push(t),e.characters+=t.length),e.blocked||=e.attempts>=e.limits.maxAttempts||e.suggestions.length>=e.limits.maxCandidates||e.characters>=e.limits.maxCharacters)}function cr(e,t){return{suggestions:e.suggestions,attempts:e.attempts,candidates:e.suggestions.length,characters:e.characters,scans:t.initial-t.remaining,truncated:t.truncated,exhausted:!e.blocked&&!t.truncated}}function lr(e,t,n){let r=n?R(e):e;return t.startsWith(r)?`reached`:r.startsWith(t)?`partial`:`none`}function ur(e,t,n,r,i,a,o){if(t===`none`)return;if(t===`partial`&&r){(n||!o)&&sr(e,i,!0);return}if(!n)return;let s=i+a;sr(e,s,(e.normalize?R(s):s).startsWith(e.input))}function dr(e,t,n,r,i,a){return{base:t,fragments:[],frames:[],maxCandidateLength:a,normalizedInput:i,normalizedMatchedLength:Zn(i,0,t,!0),objectIndex:0,objects:e,rawInput:r,rawMatchedLength:Zn(r,0,t,!1),staticSuffix:n}}function fr(e,t){for(;!t.truncated;){if(!e.frames.length){if(e.objectIndex>=e.objects.length)return;let t=e.objects[e.objectIndex++];e.frames.push({depth:0,iterator:ir(t),normalizedMatchedLength:e.normalizedMatchedLength,object:t,rawMatchedLength:e.rawMatchedLength,valueLength:0})}let n=e.frames.at(-1),r=n.iterator.next();if(r.done){e.frames.pop(),e.fragments.length=n.depth;continue}if(!rr(t))return;let i=r.value;if(!tr(i))continue;let a=n.object[i];if(a==null)continue;let o=n.valueLength+ +!!n.depth+i.length;if(e.base.length+o+e.staticSuffix.length+1>e.maxCandidateLength)continue;let s=`-${i}`,c=n.rawMatchedLength<0?-1:Zn(e.rawInput,n.rawMatchedLength,s,!1),l=n.normalizedMatchedLength<0?-1:Zn(e.normalizedInput,n.normalizedMatchedLength,s,!0);if(c<0&&l<0)continue;e.fragments.length=n.depth,e.fragments.push(i);let u=typeof a==`object`&&!Array.isArray(a)?a:void 0;if(u&&e.frames.push({depth:n.depth+1,iterator:ir(u),normalizedMatchedLength:l,object:u,rawMatchedLength:c,valueLength:o}),!(!u||Object.hasOwn(u,`DEFAULT`)&&u.DEFAULT!==null&&u.DEFAULT!==void 0))continue;let d=pr(e.rawInput,c,e.staticSuffix,!1),f=pr(e.normalizedInput,l,e.staticSuffix,!0);if(!(!d&&!f))return{candidate:`${e.base}-${e.fragments.join(`-`)}${e.staticSuffix}`,normalizedMatch:f,rawMatch:d}}}function pr(e,t,n,r){return t<0?!1:Zn(e,t,n,r)>=e.length}function mr(e,t){let n=[],r=new Set,i=0,a=(e,t)=>{for(let a of e){if(n.length===t)return;if(!(!a||r.has(a)||a.length>ln)){if(i+a.length>sn)return;r.add(a),n.push(a),i+=a.length}}};return a(e,t.length?750:un),a(t,un),a(e,un),n}function*hr(e,t,n){e.type===`theme`?yield*_r(e.objects,t,n):yield*gr(e,t,n)}function*gr(e,t,n){if(e.type===`static`){e.value.length<=t&&(yield e.value);return}if(e.type===`group`)for(let r of e.values){if(!rr(n))return;r.length<=t&&(yield r)}}function*_r(e,t,n){let r=[];for(let i of e){r.length=0;let e=[{depth:0,iterator:ir(i),object:i,valueLength:0}];for(;e.length&&!n.truncated;){let i=e.at(-1),a=i.iterator.next();if(a.done){e.pop(),r.length=i.depth;continue}if(!rr(n))return;let o=a.value;if(!tr(o))continue;let s=i.object[o];if(s==null)continue;let c=i.valueLength+ +!!i.depth+o.length;if(c>t)continue;r.length=i.depth,r.push(o);let l=typeof s==`object`&&!Array.isArray(s)?s:void 0;l&&e.push({depth:i.depth+1,iterator:ir(l),object:l,valueLength:c}),(!l||Object.hasOwn(l,`DEFAULT`)&&l.DEFAULT!==null&&l.DEFAULT!==void 0)&&(yield r.join(`-`))}}}function vr(e,t){let n=nr(t.maxScans),r=e.map(e=>({done:!1,iterator:hr(e,t.maxCandidateLength,n),pending:void 0,seen:new Set,values:[]})),i=e.length+Math.max(0,t.maxCandidates-1),a=r.length,o=0,s=0,c=!1,l=r.length;for(;l&&!n.truncated;){let e=!1;for(let n of r){if(!n.values.length&&n.pending!==void 0&&o+n.pending.length<=t.maxCharacters){n.values.push(n.pending),o+=n.pending.length,n.pending=void 0,s++,l--,e=!0;continue}if(n.done)continue;let r=n.iterator.next();if(e=!0,r.done){n.done=!0,a--;continue}if(n.seen.has(r.value))continue;if(n.seen.add(r.value),!n.values.length){o+r.value.length<=t.maxCharacters?(n.values.push(r.value),o+=r.value.length,s++,l--):(n.pending===void 0||r.value.length<n.pending.length)&&(n.pending=r.value,c=!0);continue}let i=n.values[0];r.value.length<i.length&&(n.values[0]=r.value,o+=r.value.length-i.length,c=!0)}if(!e)break}for(;a&&s<i&&o<t.maxCharacters&&!n.truncated;){let e=!1;for(let n of r){if(n.done)continue;let r=n.iterator.next();if(r.done){n.done=!0,a--;continue}if(e=!0,!n.seen.has(r.value)){if(n.seen.add(r.value),o+r.value.length>t.maxCharacters){c=!0;continue}if(n.values.push(r.value),o+=r.value.length,s++,s===i)break}}if(!e)break}return c||=n.truncated||a>0||l>0,{scans:n.initial-n.remaining,truncated:c,values:r.map(e=>e.values)}}function yr(e,t={},n=``){let r={...L,...t},i=vr(e,r),a=i.values,o=i.scans,s,c=()=>{if(s===void 0){let t=br(a,n,r);s=t?{combination:t,scans:0}:xr(e,n,r,Math.max(0,r.maxScans-o)),o+=s.scans}return s};if(a.some(e=>!e.length)){let e=i.truncated?c().combination:void 0;if(!e)return{candidates:[],truncated:i.truncated,attempts:0,scans:o};let t=Cr(r),n={remaining:r.maxAttempts};return V(t,n,0)&&H(t,e),{candidates:[...t.candidates],truncated:!0,attempts:r.maxAttempts-n.remaining,scans:o}}let l=0;for(let e of a){let t=e[0].length;for(let n=1;n<e.length;n++)t=Math.min(t,e[n].length);if(l+=t,l>Math.min(r.maxCandidateLength,r.maxCharacters)){let e=i.truncated?c().combination:void 0;if(!e)return{candidates:[],truncated:!0,attempts:0,scans:o};let t=Cr(r),n={remaining:r.maxAttempts};return V(t,n,0)&&H(t,e),{candidates:[...t.candidates],truncated:!0,attempts:r.maxAttempts-n.remaining,scans:o}}}let u=1,d=0,f=i.truncated;for(let e of a){if(f)continue;let t=0;for(let n of e)if(t+=n.length,t>r.maxCharacters)break;let n=d*e.length,i=u*t;u>r.maxCandidates/e.length||u>r.maxAttempts/e.length||n>r.maxCharacters||i>r.maxCharacters-n?f=!0:(u*=e.length,d=n+i)}let p={remaining:r.maxAttempts};if(!f){let e=Cr(r);return Or(e,a,u,p),{candidates:[...e.candidates],truncated:!1,attempts:r.maxAttempts-p.remaining,scans:o}}let m=Cr(r),h=a.map(e=>e[0]),g=a.flatMap((e,t)=>e.length>1?[t]:[]),_=c().combination;_&&V(m,p,0)&&H(m,_),V(m,p,0)&&H(m,h);let v=Math.min(cn,Math.max(0,p.remaining));return e.length&&v>dn/e.length?{candidates:[...m.candidates],truncated:!0,attempts:r.maxAttempts-p.remaining,scans:o}:(wr(m,a,h,g,p),Er(m,a,h,g,p),Tr(m,a,h,g,p),Dr(m,a,h,g,p),Or(m,a,r.maxAttempts,p,!0),{candidates:[...m.candidates],truncated:!0,attempts:r.maxAttempts-p.remaining,scans:o})}function br(e,t,n){if(!t||e.some(e=>!e.length))return;let r=t!==t.toLowerCase(),i=B(t,r);if(!i||i.length>n.maxCandidateLength)return;let a=Math.min(n.maxCandidateLength,n.maxCharacters),o=Array.from({length:e.length+1},()=>0);for(let t=e.length-1;t>=0;t--){let n=e[t][0].length;for(let r=1;r<e[t].length;r++)n=Math.min(n,e[t][r].length);o[t]=o[t+1]+n}if(o[0]>a)return;let s=[],c=0,l=0;for(let t=0;t<e.length;t++){let n,u=l;for(let s of e[t]){if(c+s.length+o[t+1]>a)continue;let e=Sr(i,l,B(s,r)),d=e>l,f=u>l;(n===void 0||d&&!f||d===f&&(s.length<n.length||s.length===n.length&&e>u))&&(n=s,u=e)}if(n===void 0)return;s.push(n),c+=n.length,l=u}if(l<i.length)return;let u=s.join(``);if(In(i,B(u,r),u,0))return s}function xr(e,t,n,r){let i=nr(r),a=e=>({combination:e,scans:i.initial-i.remaining});if(!t)return a();let o=t!==t.toLowerCase(),s=B(t,o);if(!s||s.length>n.maxCandidateLength)return a();let c=Math.min(n.maxCandidateLength,n.maxCharacters),l=[{characters:0,choice:``,matched:0}],u=0,d=0;for(let t of e){let e=new Map,n=new Set;for(let r of hr(t,c,i)){if(n.has(r))continue;n.add(r);let t={normalized:B(r,o),raw:r};for(let n of l){if(d++,u+=t.normalized.length,d>cn||u>dn)return a();let r=n.characters+t.raw.length;if(r>c)continue;let i=Sr(s,n.matched,t.normalized),o=e.get(i);o&&o.characters<=r||e.set(i,{characters:r,choice:t.raw,matched:i,previous:n})}}if(!e.size)return a();let r=1/0;l=[...e.values()].sort((e,t)=>t.matched-e.matched||e.characters-t.characters).filter(e=>e.characters>=r?!1:(r=e.characters,!0))}let f=l.find(e=>e.matched===s.length);if(!f)return a();let p=Array.from({length:e.length},()=>``),m=f;for(let t=e.length-1;t>=0;t--)p[t]=m.choice,m=m.previous;let h=p.join(``);return In(s,B(h,o),h,0)?a(p):a()}function Sr(e,t,n){for(let r=0;r<n.length&&t<e.length;r++)n[r]===e[t]&&t++;return t}function Cr(e){return{candidates:new Set,characters:0,maxCandidateLength:e.maxCandidateLength,maxCandidates:e.maxCandidates,maxCharacters:e.maxCharacters}}function V(e,t,n){return n>=cn||t.remaining<=0||e.candidates.size>=e.maxCandidates||e.characters>=e.maxCharacters?!1:(t.remaining--,!0)}function wr(e,t,n,r,i){let a=0;for(let o of r){if(!V(e,i,a))return;a++;let r=n.slice();r[o]=t[o].at(-1),H(e,r)}}function Tr(e,t,n,r,i){let a=0;for(let o=0;o<r.length;o++)for(let s=o+1;s<r.length;s++){if(!V(e,i,a))return;a++;let c=r[o],l=r[s],u=n.slice();u[c]=t[c].at(-1),u[l]=t[l].at(-1),H(e,u)}}function Er(e,t,n,r,i){let a=0;for(let o of r)for(let r=1;r<t[o].length-1;r++){if(!V(e,i,a))return;a++;let s=n.slice();s[o]=t[o][r],H(e,s)}}function Dr(e,t,n,r,i){let a=0;for(let o=0;o<r.length;o++)for(let s=o+1;s<r.length;s++){let c=r[o],l=r[s];for(let r=1;r<t[c].length;r++)for(let o=1;o<t[l].length;o++){if(r===t[c].length-1&&o===t[l].length-1)continue;if(!V(e,i,a))return;a++;let s=n.slice();s[c]=t[c][r],s[l]=t[l][o],H(e,s)}}}function Or(e,t,n,r,i=!1){if(!t.length){V(e,r,0)&&H(e,[``]);return}let a=t.map(()=>0),o=t.flatMap((e,t)=>e.length>1?[t]:[]),s=()=>{let e=o.length-1;for(;e>=0;){let n=o[e];if(a[n]++,a[n]<t[n].length)return!0;a[n]=0,e--}return!1};if(i&&!s())return;let c=Math.min(n,cn);for(let n=0;n<c;n++){if(!V(e,r,n))return;if(H(e,t.map((e,t)=>e[a[t]])),!s())break}}function H(e,t){let n=e.maxCharacters-e.characters,r=0;for(let i of t)if(r+=i.length,r>Math.min(e.maxCandidateLength,n))return;let i=t.join(``);e.candidates.has(i)||e.candidates.size===e.maxCandidates||e.characters+i.length>e.maxCharacters||(e.candidates.add(i),e.characters+=i.length)}function kr(e,t,n=!0){let r=t,i=t,a=/[^\s>"'`;]/;for(;r&&a.test(e.charAt(r-1));)--r;for(;i<e.length&&a.test(e.charAt(i));)++i;if(n)return{content:e.slice(r,i),start:r,end:i};let o=Rr(e,t),s=o?.key.toLowerCase();if(o&&(s?.endsWith(`class`)||s?.endsWith(`classname`)))return r=Math.max(r,o.valueStart),{content:e.slice(r,i),start:r,end:i};let c=e.slice(0,r).trimEnd();if(/(?:^|[\s;{])@apply$/.test(c))return{content:e.slice(r,i),start:r,end:i}}const Ar=new Set(`a abbr address area article aside audio b base bdi bdo blockquote body br button canvas caption cite code col colgroup data datalist dd del details dfn dialog div dl dt em embed fieldset figcaption figure footer form h1 h2 h3 h4 h5 h6 head header hgroup hr html i iframe img input ins kbd label legend li link main map mark menu meta meter nav noscript object ol optgroup option output p picture pre progress q rp rt ruby s samp script search section select slot small source span strong style sub summary sup table tbody td template textarea tfoot th thead time title tr track u ul var video wbr svg`.split(` `)),jr=new Set(`=([{,:;!?&|>~`);function Mr(e){return e>=65&&e<=90||e>=97&&e<=122}function Nr(e){return Mr(e)||e===95}function Pr(e){return Nr(e)||e>=48&&e<=57||e===36||e===45||e===46||e===58}function Fr(e,t,n){let r=t-n.length;return r<0||e.slice(r,t)!==n?!1:r===0||!Pr(e.charCodeAt(r-1))}function Ir(e,t,n,r){if(Ar.has(n.toLowerCase())||n.includes(`-`)||r&&n.charCodeAt(0)>=65&&n.charCodeAt(0)<=90)return!0;let i=t-1;for(;i>=0&&/\s/.test(e.charAt(i));)i--;return i<0||jr.has(e.charAt(i))?!0:Fr(e,i+1,`return`)}function Lr(e){let t,n=!1,r,i=0,a=0;for(;a<e.length;){if(t){let o=e.charAt(a);r?o===`\\`?a++:o===r&&(r=void 0):o===`"`||o===`'`?r=o:o===`{`?i++:o===`}`?i>0&&i--:o===`>`&&i===0&&(t=void 0,n=!0),a++;continue}if(e.charAt(a)===`;`&&(n=!1),e.charCodeAt(a)!==60){a++;continue}let o=a++;if(!Nr(e.charCodeAt(a)))continue;let s=a;for(;a<e.length&&Pr(e.charCodeAt(a));)a++;if(a<e.length&&!/[\s/>]/.test(e.charAt(a)))continue;let c=e.slice(s,a);Ir(e,o,c,n)&&(t={name:c,start:o},i=0)}return t}function Rr(e,t){let n=e.substring(0,t),r=Lr(n);if(!r)return;let i=r.start+1,a=n.slice(i),o=-1,s=-1,c=-1,l=-1,u=-1,d=-1,f;for(let e=0;e<a.length;e++){let t=a.charAt(e);if(f){t===`\\`?e++:t===f&&(f=void 0);continue}if(t===`"`||t===`'`){f=t,o<0&&(o=e);continue}if(/\s/.test(t)){o>=0&&(s=o,c=e,o=-1);continue}if(t===`=`){let t=o>=0?o:s,n=o>=0?e:c;t>=0&&n>t&&t>=l&&(l=t,u=n,d=e)}o<0&&(o=e)}if(l<0)return;let p=d+1;for(;/\s/.test(a.charAt(p));)p++;let m=a.charAt(p);if(m===`"`||m===`'`){p++;for(let e=p;e<a.length;e++){let t=a.charAt(e);if(t===`\\`)e++;else if(t===m)return}}else if(/[\s>]/.test(a.slice(p)))return;return{key:a.slice(l,u),valueStart:i+p}}function zr(e,t){return Rr(e,t)?.key}const U=1e3,Br=6e5,Vr=5e7,Hr=6e4,W=3e5,Ur=5e4,Wr=2e5,Gr=5e3,G={...L,maxAttempts:15e3,maxCandidates:15e3,maxCharacters:6e5,maxScans:3e5};function Kr(){return{active:0,waiters:[]}}function qr(e){return e>=48&&e<=57}function Jr(e){for(let t=0;t<e.length;t++)if(qr(e.charCodeAt(t)))return!0;return!1}function Yr(e,t){let n=0,r=0;for(;n<e.length&&r<t.length;){let i=e.charCodeAt(n),a=t.charCodeAt(r),o=qr(i),s=qr(a);if(o&&s){let i=n+1,a=r+1;for(;i<e.length&&qr(e.charCodeAt(i));)i++;for(;a<t.length&&qr(t.charCodeAt(a));)a++;let o=n,s=r;for(;o<i-1&&e.charCodeAt(o)===48;)o++;for(;s<a-1&&t.charCodeAt(s)===48;)s++;let c=i-o,l=a-s;if(c!==l)return c<l?-1:1;for(;o<i;){let n=e.charCodeAt(o)-t.charCodeAt(s);if(n)return n<0?-1:1;o++,s++}n=i,r=a;continue}if(i!==a)return i<a?-1:1;n++,r++}return n!==e.length||r!==t.length?n===e.length?-1:1:0}function Xr(e,t){let n=Jr(e);return n===Jr(t)?Yr(e,t)||(e===t?0:e<t?-1:1):n?1:-1}function Zr(e,t=W,n=Vr){return{attempts:0,heap:[],limit:e,maxAttempts:t,maxScannedCharacters:n,retained:new Set,scannedCharacters:0}}function Qr(e){return e.attempts<e.maxAttempts&&e.scannedCharacters<e.maxScannedCharacters}function $r(e,t){return Qr(e)?(e.attempts++,!t||e.retained.has(t)||t.length>Hr||t.length>e.maxScannedCharacters-e.scannedCharacters?!0:(e.scannedCharacters+=t.length,ei(e,t),!0)):!1}function ei(e,t){if(!(!t||e.retained.has(t)||t.length>Hr)){if(e.heap.length<e.limit){e.heap.push(t),e.retained.add(t),ti(e.heap,e.heap.length-1);return}Xr(t,e.heap[0])>=0||(e.retained.delete(e.heap[0]),e.heap[0]=t,e.retained.add(t),ni(e.heap,0))}}function ti(e,t){let n=t;for(;n>0;){let t=Math.floor((n-1)/2);if(Xr(e[t],e[n])>=0)return;[e[t],e[n]]=[e[n],e[t]],n=t}}function ni(e,t){let n=t;for(;;){let t=n*2+1;if(t>=e.length)return;let r=t+1,i=r<e.length&&Xr(e[r],e[t])>0?r:t;if(Xr(e[n],e[i])>=0)return;[e[n],e[i]]=[e[i],e[n]],n=i}}function ri(e){let t=[],n=0;for(let r of e.heap.sort(Xr))n+r.length>Br||(t.push(r),n+=r.length);return t}function ii(e,t,n,r){return Math.floor((t+n)*e/r)-Math.floor(t*e/r)}function*ai(e){let t=e.filter(e=>e.length).map(e=>({index:0,source:e})),n=0;for(;t.length;){let e=t[n];yield e.source[e.index++],e.index===e.source.length?t.splice(n,1):n++,n===t.length&&(n=0)}}function*oi(e,t,n,r,i,a){for(;n.attempts<r&&n.characters<i;){let r=e.next();if(r.done)return;let o=r.value;n.attempts++,!(!o||t.has(o)||o.length>a||o.length>i-n.characters)&&(t.add(o),n.characters+=o.length,yield o)}}function si(e){let t=``;for(let n of e.parts){if(n.type!==`static`)break;t+=n.value}return t}function ci(e,t){if(!t)return{priorityCount:0,templates:[...e]};let n=t.replace(/-/g,``),r=[],i=[];for(let a=0;a<e.length;a++){let o=e[a],s=si(o),c=s.replace(/-/g,``),l=-1;s&&t.startsWith(s)?l=0:c&&n.startsWith(c)?l=1:s.startsWith(t)?l=2:c.startsWith(n)&&(l=3),l<0?i.push(o):r.push({category:l,index:a,parsed:o,prefixLength:l<2?l?c.length:s.length:0})}return r.sort((e,t)=>e.category-t.category||t.prefixLength-e.prefixLength||e.index-t.index),{priorityCount:r.length,templates:[...r.map(({parsed:e})=>e),...i]}}function li(e,t){return e.length<=t?[...e]:t<=0?[]:t===1?[e[0]]:Array.from({length:t},(n,r)=>e[Math.floor(r*(e.length-1)/(t-1))])}async function ui(e,t,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{r[t]=await n(e[t])}catch(e){throw a=!0,e}}});return await Promise.all(o),r}function di(e,t=U){let n=Zr(t);for(let t of e)if(!$r(n,t))break;return ri(n)}function fi(e,t){let n=[],r=new Set,i=0,a=0;for(let o of e)if(o.startsWith(t)){if(i===W||n.length===U||a>=Br)break;i++,!(!o||r.has(o)||o.length>Hr||a+o.length>Br)&&(r.add(o),n.push(o),a+=o.length)}return n}function pi(e,t={}){let n=new Map,r=new rn({max:Gr,maxSize:32e6,sizeCalculation:(e,t)=>Math.max(1,t.length*2+e.reduce((e,t)=>e+t.length*2+8,0))}),i=new Map,a=e.config,o=0,s=[],c,l,u=[],d=0,f=new Set,p=new Set,m=[],h=new Map,g=new Set,_=Kr(),{matchType:v=`prefix`,throwErrors:y=!0}=t;return ue(),{suggest:S,suggestInFile:C,templates:m,cache:r,errorCache:i,reset:ue,enumerate:b};async function b(){let e=Array.from(`abcdefghijklmnopqrstuvwxyz`),t=[...e,`-`],n=e.flatMap(e=>[e,...t.map(t=>`${e}${t}`)]);for(;;){de();let e=a,t=o,r=new Set;if(await x(n,r,e,t,e=>e)&&await x([...r].filter(e=>/^\w+$/.test(e)&&e.length>3),r,e,t,e=>`${e}-`))return r}}async function x(e,t,n,r,i){for(let a=0;a<e.length;a+=128){let o=await fe(Promise.all(e.slice(a,a+128).map(e=>S(i(e)))),n,r);if(o.stale)return!1;for(let e of o.value)for(let n of e)t.add(n)}return!0}async function S(e,t=!1){if(de(),!t&&e.length<1)return[];if(r.has(e))return r.get(e);let n=h.get(e);if(n)return n;let i=ee(e,t);h.set(e,i);try{return await i}finally{h.get(e)===i&&h.delete(e)}}async function ee(t,n){for(;;){de();let i=a,s=o;if(!n&&t.length<1)return[];if(r.has(t))return r.get(t);let c=i.presets.find(e=>e.name===`@teacss/preset-attributify`)?.options?.prefix,l=c?t.startsWith(c)?t.slice(c.length):t.replace(`:${c}`,`:`):t,u=await fe(e.matchVariants(l),i,s);if(u.stale)continue;let d=await fe(Promise.all(u.value.map(async([,e])=>{if(!e&&l)return[];let n=e?t.indexOf(e):t.length;n===-1&&(n=0);let r=t.slice(0,n),a=t.slice(n+e.length),o=v===`fuzzy`?[T(e,i,s),re(e,i,s),ne(e),te(e)]:[T(e,i,s),te(e),ne(e),re(e,i,s)];return pe(await Promise.all(o),r,a)})),i,s);if(d.stale)continue;let f=d.value.flat();if(f=v===`fuzzy`?ae(z(f,t,{maxCandidates:G.maxCandidates,maxCharacters:G.maxCharacters}),t):di(f),!M(i,s))return r.set(t,f),f}}async function C(e,t){de();let n=a,r=o,i=zr(e,t)!==void 0,s=await fe(w(e,t,n),n,r);if(s.stale)return C(e,t);let c=s.value;if(c){let a=await S(c.extracted,i);if(M(n,r))return C(e,t);let o=c.transformSuggestions?c.transformSuggestions(a):a;return{suggestions:a.map((e,t)=>[e,o[t]]),resolveReplacement:c.resolveReplacement}}let l=kr(e,t,n.presets.some(e=>e.name===`@teacss/preset-attributify`));if(!l)return;let u=await S(l.content,i);return M(n,r)?C(e,t):{suggestions:u.map(e=>[e,e]),resolveReplacement:e=>({start:l.start,end:l.end,replacement:e})}}async function w(e,t,n){if(!n.autocomplete.extractors.length)return null;for(let r of n.autocomplete.extractors){let n=await r.extract({content:e,cursor:t});if(n)return n}return null}async function T(t,n,r){let i=await e.parseToken(t,`-`);return i&&!M(n,r)&&(p.delete(t),p.add(t),p.size>Gr&&p.delete(p.values().next().value)),i?[t]:[]}async function te(e){if(v===`fuzzy`){let t=oe(),n=ae(u,e,t,d),r=z(A(),e,{maxAttempts:W,maxCandidates:750,maxCharacters:6e4});return z([...n,...r],e,{maxCandidates:U,maxCharacters:G.maxCharacters})}return c??=[...s].sort(Xr),fi(c,e)}async function ne(t){return di(n());function*n(){for(let e of p)e.startsWith(t)&&(yield e);for(let[n,r]of e.cache){if(!r)continue;let e=n.replace(/ -$/,``);e.startsWith(t)&&(yield e)}}}async function re(e,t,n){let r=m.filter(e=>typeof e==`function`);if(v!==`fuzzy`){let i=se(e),a=await E(r,e,t,n);return[...i,...a]}let i=le(e),a=await D(r,e,t,n);return[...i,...a]}async function E(e,t,n,r){if(!e.length)return[];let i=Zr(U),a=Zr(U);for(let o=0;o<e.length;o+=8){let s=await ui(e.slice(o,o+8),8,e=>O(e,t,n,r));if(M(n,r))return[];let c=ii(W,o,s.length,e.length),l=ii(Vr,o,s.length,e.length),u=Zr(U,c,l),d=ai(s.filter(e=>!!e?.length));for(;Qr(u);){let e=d.next();if(e.done)break;$r(u,e.value)}for(let e of ri(u))ei(i,e);let f=Zr(U,c,l);for(;Qr(f);){let e=d.next();if(e.done)break;$r(f,e.value)}for(let e of ri(f))ei(i,e);for(;Qr(a);){let e=d.next();if(e.done)break;$r(a,e.value)}}for(let e of ri(a))ei(i,e);return ri(i)}async function D(e,t,n,r){if(!e.length)return[];let i=[],a=new Set,o={attempts:0,characters:0};for(let s=0;s<e.length;s+=32){let c=await ui(e.slice(s,s+32),32,e=>O(e,t,n,r));if(M(n,r))return[];let l=ai(c.filter(e=>!!e?.length)),u=ii(W,s,c.length,e.length),d=ii(L.maxScannedCharacters,s,c.length,e.length),f=z(l,t,{maxAttempts:u,maxCandidates:U,maxCharacters:G.maxCharacters,maxScannedCharacters:d});i=z([...i,...f],t,{maxAttempts:i.length+f.length,maxCandidates:U,maxCharacters:G.maxCharacters});let p=z(oi(l,a,{attempts:0,characters:0},u,d,L.maxCandidateLength),t,{maxAttempts:u,maxCandidates:750,maxCharacters:G.maxCharacters,maxScannedCharacters:d});i=z([...i,...p],t,{maxAttempts:i.length+p.length,maxCandidates:U,maxCharacters:G.maxCharacters});let m=z(oi(l,a,{attempts:0,characters:0},u,d,L.maxCandidateLength),t,{maxAttempts:u,maxCandidates:750,maxCharacters:G.maxCharacters,maxScannedCharacters:d});i=z([...i,...m],t,{maxAttempts:i.length+m.length,maxCandidates:U,maxCharacters:G.maxCharacters});let h=z(oi(l,a,o,W,L.maxScannedCharacters,L.maxCandidateLength),t,{maxAttempts:W-o.attempts,maxCandidates:750,maxCharacters:G.maxCharacters,maxScannedCharacters:L.maxScannedCharacters-o.characters});i=z([...i,...h],t,{maxAttempts:i.length+h.length,maxCandidates:U,maxCharacters:G.maxCharacters})}return i}async function O(e,t,n,r){let i=_;await k(i);try{if(M(n,r))return;try{return await e(t)}catch{return}}finally{ie(i)}}async function k(e){if(e.active<128){e.active++;return}await new Promise(t=>e.waiters.push(t))}function ie(e){let t=e.waiters.shift();t?t():e.active--}function ae(e,t,n,r){return Fn(t,r??e.reduce((e,t)=>e+t.length,0))?z(e,t,{maxCandidates:U,maxCharacters:G.maxCharacters}):(n??new Kt(e,{fuzzy:`v1`,limit:U,tiebreakers:[Gt,Wt]})).find(t).map(e=>e.item)}function oe(){if(l)return l;let e=new Set,t=0,n=0,r=n=>!n||e.has(n)||n.length>G.maxCandidateLength||e.size===G.maxCandidates||t+n.length>G.maxCharacters?!1:(e.add(n),t+=n.length,!0),i=0;for(;i<s.length&&n<G.maxAttempts&&e.size<G.maxCandidates&&t<G.maxCharacters;){let e=s[i++];n++,r(e)&&f.add(e)}return u=[...e],d=t,l=new Kt(u,{fuzzy:`v1`,limit:U,tiebreakers:[Gt,Wt]}),l}function*A(){for(let e of s)f.has(e)||(yield e)}function se(e){let t=Zr(U),r=0,i=0,a=0,o=ci([...n.values()],e).templates.slice(0,Ur);for(let n=0;n<o.length;n++){let s=W-r,c=Vr-i,l=Wr-a;if(c<=0||s<=0||l<=0||!Qr(t))break;let u=o.length-n,d=Math.max(1,Math.floor(s/u)),f=yn(o[n],e,{maxAttempts:d,maxCandidateLength:Hr,maxCandidates:d,maxCharacters:Math.max(1,Math.floor(c/u)),maxScans:Math.max(1,Math.floor(l/u))});r+=f.attempts,i+=f.characters,a+=f.scans;for(let e of f.suggestions)if(!$r(t,e))break}return ri(t)}function le(e){let t=[],r=new Set,i=0,a=0,o=0,s=0,c=ci([...n.values()],e).templates.slice(0,Ur),l=e=>{!e||r.has(e)||e.length>L.maxCandidateLength||o>=G.maxCandidates||i+e.length>G.maxCharacters||(r.add(e),t.push(e),o++,i+=e.length)},u=0;for(let t of z(f(),e,{maxAttempts:Ur,maxCandidates:750,maxCharacters:G.maxCharacters}))l(t);let d=li(c,Math.max(1,Math.floor(Math.min(G.maxAttempts,G.maxCandidates-o)/2)));for(let t=0;t<d.length;t++){let n=G.maxAttempts-a,r=G.maxCandidates-o,c=G.maxCharacters-i,u=G.maxScans-s;if(n<=0||r<=0||c<=0||u<=0)break;let f=d.length-t,p={maxAttempts:Math.max(2,Math.floor(n/f)),maxCandidates:Math.max(2,Math.floor(r/f)),maxCharacters:Math.max(1,Math.floor(c/f)),maxScans:Math.max(1,Math.floor(u/f))},m;if(e.length<=1){let n=yn(d[t],e,p);m=n.suggestions,a+=n.attempts,s+=n.scans}else{let n=yr(d[t].parts,p,e);m=n.candidates,a+=n.attempts,s+=n.scans}for(let e of m)l(e)}return z(t,e,{maxAttempts:G.maxAttempts,maxCandidates:750,maxCharacters:G.maxCharacters});function*f(){for(let t=0;t<c.length;t++){let n=Wr-u;if(n<=0)return;let r=c.length-t,i=(e.length<=1?yn:vn)(c[t],e,{maxAttempts:1,maxCandidates:1,maxCharacters:L.maxCandidateLength,maxScans:Math.max(1,Math.floor(n/r))});u+=i.scans,yield*i.suggestions}}}function ue(){let t=e.config,v=[...Object.keys(t.rulesStaticMap),...t.shortcuts.filter(e=>typeof e[0]==`string`).map(e=>e[0])],b=[...t.autocomplete.templates||[],...t.rulesDynamic.flatMap(e=>j(e?.[2]?.autocomplete||[])),...t.shortcuts.flatMap(e=>j(e?.[2]?.autocomplete||[])),...t.variants.flatMap(e=>j(e.autocomplete||[]))],x=new Map,S=new Map;for(let e of b)if(typeof e!=`function`){if(x.has(e)||S.has(e))continue;let n=kn(e,t.theme,t.autocomplete.shorthands);n.errors.length&&S.set(e,n.errors),x.set(e,n)}if(S.size&&y){i.clear();for(let[e,t]of S)i.set(e,t);let e=Array.from(S.values()).flat().map(e=>e.toString()).join(`
10
+ `);throw Error(e)}o++;for(let e of[...g])e();a=t,s=v,c=void 0,m.length=0,m.push(...b),n.clear();for(let[e,t]of x)n.set(e,t);r.clear(),h.clear(),_=Kr(),i.clear();for(let[e,t]of S)i.set(e,t);l=void 0,u=[],d=0,f.clear(),p.clear()}function de(){a!==e.config&&ue()}function M(t,n){return t!==e.config||n!==o}function fe(t,n,r){return new Promise((i,a)=>{let o=!1,s=e=>{o||(o=!0,l(),g.delete(c),i(e))},c=()=>s({stale:!0}),l=e.events.on(`config`,e=>{e!==n&&c()});g.add(c),Promise.resolve(t).then(e=>s({stale:!1,value:e}),e=>{o||(o=!0,l(),g.delete(c),a(e))}),M(n,r)&&c()})}function pe(t,n=``,r=``){let i=ce(t.flat()).filter(t=>!!(t&&!t.endsWith(`-`)&&!e.isBlocked(t)&&!e.isBlocked(n+t+r)));v!==`fuzzy`&&i.sort(Xr);let a=i.map(e=>n+e+r);return v===`fuzzy`?a:di(a)}}function K(e){try{return _(e)}catch{try{let t=new URL(e);return t.protocol===`file:`?e:decodeURIComponent(t.pathname.replace(/^\/([a-z]:)/i,`$1`))}catch{return e}}}const mi=/<style[^>]*>[\s\S]*?(?:<\/style>|<\/>|$)/g,hi=/(?:<\/style>|<\/>)$/,gi=/<template\b[^>]*\slang\s*=\s*(?:'pug'|"pug")[^>]*>/i;function _i(e,t,n){let r=t.match(/\.(svelte|vue|astro|marko)$/);if(r&&vi(e,t)){let t=e.slice(0,n);if(/\.$/.test(t)||/\.\S+$/.test(t))return!0}if((r?[...e.matchAll(mi)].some(t=>{let r=t.index,i=r+t[0].length,a=i===e.length&&!hi.test(t[0]);return n>r&&(n<i||a&&n===i)}):/\.(?:css|scss|sass|less|styl(?:us)?|pcss|postcss)$/i.test(t))||zr(e,n)!==void 0)return!0;let i=e.slice(n).replace(/"[^"]*"|\{[^}]*\}|'[^']*'/g,``);return/^[^<>]*>/.test(i)}function vi(e,t){return t.endsWith(`.vue`)&&gi.test(e)}function yi(e,t){let n=u.relative(e,t);return n!==``&&n!==`..`&&!n.startsWith(`..${u.sep}`)&&!u.isAbsolute(n)}const bi={log(){},warn(){}},xi=/[\\/](?:node_modules|dist|\.temp|\.cache)[\\/]/;var Si=class{cwd;logger;ready;contextsMap=new Map;configSources=[];fileContextCache=new Map;configExistsCache=new Map;loadingContexts=new Map;contextLoadVersions=new Map;contextReloadDisposers=new Map;failedConfigSources=new Map;discoveredConfigs=new Set;yarnPnpSetupFailures=new Set;lifecycleVersion=0;workspaceRoots;events=ge();constructor(e,t=bi,n=[e]){this.cwd=e,this.logger=t,this.workspaceRoots=Array.from(new Set(n.length?n:[e])),this.ready=this.reload()}log(e){this.logger.log(e)}warn(e){this.logger.warn(e)}isTarget(e){return Array.from(this.contextsMap.keys()).some(t=>yi(t,e))}get contexts(){return Array.from(new Set(this.contextsMap.values())).filter(be)}async setRoots(e){let t=Array.from(new Set(e)),n=Array.from(this.contextsMap.keys()),r=this.workspaceRoots.length===t.length&&t.every(e=>this.workspaceRoots.includes(e)),i=n.length===t.length&&t.every(e=>n.includes(e));if(r&&i)return;let a=++this.lifecycleVersion;this.workspaceRoots=t;for(let e of n)t.includes(e)||this.removeContext(e,`contextUnload`,!0);a===this.lifecycleVersion&&(this.resetCaches(),await this.loadRoots(t.filter(e=>!n.includes(e)),a),a===this.lifecycleVersion&&this.events.emit(`reload`))}async reload(){let e=++this.lifecycleVersion,t=Array.from(this.contextsMap.keys()),n=t.length?t:this.workspaceRoots;for(let e of t)this.removeContext(e,`contextUnload`,!1);e===this.lifecycleVersion&&(this.resetCaches(),await this.loadRoots(n,e),e===this.lifecycleVersion&&this.events.emit(`reload`))}async unloadContext(e){this.removeContext(e,`contextUnload`,!0)}async unload(e){this.removeContext(e,`unload`,!0)}removeContext(e,t,n){n&&(this.contextLoadVersions.set(e,(this.contextLoadVersions.get(e)??0)+1),this.loadingContexts.delete(e));let r=this.contextsMap.get(e);r!==void 0&&(this.contextsMap.delete(e),this.failedConfigSources.delete(e),this.syncConfigSources(),r&&(this.disposeContextReload(r),this.clearFileContextCache(r),this.events.emit(t,r),t===`contextUnload`&&this.events.emit(`reload`)))}syncConfigSources(){let e=this.contexts.flatMap(e=>e.getConfigFileList()),t=Array.from(this.failedConfigSources.values()).flat(),n=Array.from(new Set([...e,...t]));this.configSources.splice(0,this.configSources.length,...n)}clearFileContextCache(e){for(let[t,n]of this.fileContextCache)n===e&&this.fileContextCache.delete(t)}resetCaches(){this.fileContextCache.clear(),this.configExistsCache.clear()}releaseDocument(e){this.fileContextCache.delete(e),this.invalidateConfigSearchPath(e)}invalidateConfigSearchPath(e){let t=u.dirname(e),n=this.getWorkspaceBoundary(t);if(n)for(;t===n||yi(n,t);){if(this.configExistsCache.delete(t),t===n)return;t=u.dirname(t)}}async loadRoots(e,t){let n=e.map(e=>({dir:e,loadVersion:this.contextLoadVersions.get(e)??0}));await Promise.all(n.map(async({dir:e,loadVersion:n})=>{try{await this.loadContextInDirectoryWithVersion(e,t,n)}catch(n){if(t!==this.lifecycleVersion)return;this.warn(`⚠️ Failed to reload context for ${e}: ${String(n.stack??n)}`)}}))}async loadContextInDirectory(e){return this.loadContextInDirectoryWithVersion(e,void 0,this.contextLoadVersions.get(e)??0)}async loadContextInDirectoryWithVersion(e,t,n){if(!this.isLoadCurrent(e,t,n))return;let r=this.contextsMap.get(e);if(r!==void 0)return r;let i=this.loadingContexts.get(e);if(i&&i.lifecycleVersion===t&&i.loadVersion===n)return i.promise;let a=this.loadContext(e,t,n);this.loadingContexts.set(e,{lifecycleVersion:t,loadVersion:n,promise:a});try{return await a}finally{this.loadingContexts.get(e)?.promise===a&&this.loadingContexts.delete(e)}}async loadContext(e,t,n){this.setupYarnPnp(e),this.discoveredConfigs.has(e)||this.log(`🛠 Resolving config for ${e}`);let r=g(e,{},e=>{e.config.details=!0}),i=[];try{i=(await r.updateRoot(e)).sources}catch(i){return this.isLoadCurrent(e,t,n)?(this.warn(`⚠️ Error on loading config. Config directory: ${e}`),this.warn(String(i.stack??i)),this.failedConfigSources.set(e,r.getConfigFileList()),this.finishLoading(e,null,t,n)):void 0}if(!this.isLoadCurrent(e,t,n))return;if(this.failedConfigSources.delete(e),!i.length)return this.log(`ℹ️ No config sources found in ${e}`),this.finishLoading(e,null,t,n);if(await r.ready,!this.isLoadCurrent(e,t,n))return;this.setupContextReload(r),this.logConfigInfo(i,r.generator);let a=this.finishLoading(e,r,t,n);return this.events.emit(`contextLoaded`,r),a}setupYarnPnp(e){for(let t of[`.pnp.js`,`.pnp.cjs`]){let n=u.join(e,t);if(l(n))try{se(n).setup(),this.yarnPnpSetupFailures.delete(n)}catch(e){if(this.yarnPnpSetupFailures.has(n))continue;this.yarnPnpSetupFailures.add(n);let t=e instanceof Error?e.message:String(e);this.warn(`⚠️ Failed to setup Yarn PnP from ${n}: ${t}`)}}}setupContextReload(e){this.disposeContextReload(e);let t=e.onReload(()=>{for(let[t,n]of this.fileContextCache)(n===e||!n)&&this.fileContextCache.delete(t);this.configExistsCache.clear(),this.syncConfigSources(),this.events.emit(`contextReload`,e)});this.contextReloadDisposers.set(e,t);for(let[e,t]of this.fileContextCache)t||this.fileContextCache.delete(e)}disposeContextReload(e){this.contextReloadDisposers.get(e)?.(),this.contextReloadDisposers.delete(e)}isLoadCurrent(e,t,n){return(t===void 0||t===this.lifecycleVersion)&&n===(this.contextLoadVersions.get(e)??0)}logConfigInfo(e,t){let n=e.length===1?e[0]:`\n${e.map(e=>` - ${e}`).join(`
11
+ `)}`;this.log(`🛠 New configuration loaded from ${n}`),this.log(`ℹ️ ${t.config.presets.length} presets, ${t.config.rulesSize} rules, ${t.config.shortcuts.length} shortcuts, ${t.config.variants.length} variants, ${t.config.transformers?.length||0} transformers loaded`)}finishLoading(e,t,n,r){if(!this.isLoadCurrent(e,n,r))return;this.contextsMap.has(e)||this.contextsMap.set(e,t),this.syncConfigSources(),this.fileContextCache.clear(),this.events.emit(`reload`);let i=Array.from(this.contextsMap.entries()).filter(([,e])=>e).map(([e])=>e).join(`, `)||`[none]`;return this.log(`🗂️ Enabled context: ${i}`),t}async resolveClosestContext(e,t){if(xi.test(t))return;if(this.fileContextCache.has(t)){let e=this.fileContextCache.get(t);return N(this.fileContextCache,t,e,100),e}let n=await this.discoverAndLoadConfig(t);if(n)return n;let r=Array.from(this.contextsMap.entries()).sort((e,t)=>t[0].length-e[0].length);for(let[n,i]of r)if(!(!i||!yi(n,t))&&(i.filter(e,t)||me(t)))return N(this.fileContextCache,t,i,100),i;for(let[e,n]of r)if(n&&yi(e,t))return N(this.fileContextCache,t,n,100),n}async discoverAndLoadConfig(e){let t=this.lifecycleVersion,n=await this.findConfigDirectory(u.dirname(e),t);if(t!==this.lifecycleVersion||!n||this.contextsMap.has(n))return;this.discoveredConfigs.has(n)||(this.log(`🔍 Discovered config in ${n}`),this.discoveredConfigs.add(n));let r=this.contextLoadVersions.get(n)??0;if(await this.loadContextInDirectoryWithVersion(n,t,r),!this.isLoadCurrent(n,t,r))return;let i=this.contextsMap.get(n);return i&&N(this.fileContextCache,e,i,100),i}async findConfigDirectory(e,t){let n=this.configExistsCache.get(e);if(n!==void 0)return N(this.configExistsCache,e,n,100),n||void 0;let r=this.getWorkspaceBoundary(e);if(!r)return;let i=u.parse(e).root,a=[],o=e;for(;o!==i&&(yi(r,o)||o===r);){a.push(o);let e=this.configExistsCache.get(o);if(e!==void 0)return N(this.configExistsCache,o,e,100),this.cacheSearchPath(a,e||!1),e||void 0;let n=await this.hasConfigFiles(o);if(t!==this.lifecycleVersion)return;if(n)return this.cacheSearchPath(a,o),o;o=u.dirname(o)}this.cacheSearchPath(a,!1)}getWorkspaceBoundary(e){return[...this.workspaceRoots,...this.contextsMap.keys()].filter(t=>t===e||yi(t,e)).sort((e,t)=>t.length-e.length)[0]}async hasConfigFiles(e){return!!p(e)}cacheSearchPath(e,t){for(let n of e)N(this.configExistsCache,n,t,100)}};const Ci={root:void 0,colorPreview:!1,remToPxPreview:!0,remToPxRatio:16,syntaxHighlight:!0,strictAnnotationMatch:!1,autocompleteMatchType:`prefix`,autocompleteStrict:!1,autocompleteMaxItems:1e3},wi=/^#(?:[0-9a-f]{3,8})$/i,Ti=/^(?:rgb|rgba|hsl|hsla|hwb|oklch|oklab|lab|lch|device-cmyk|color)\(/i,Ei=/^(?:media|supports|container)\b/;function Di(e={}){let t=new Set(Object.keys(e.colors??{})),n=new Set(Object.keys(e.breakpoint??e.breakpoints??{}));return{isColorValue(e){let n=e.trim();if(n.startsWith(`[`)&&n.endsWith(`]`)&&(n=n.slice(1,-1)),!n)return!1;if(n===`current`||n===`transparent`||wi.test(n)||Ti.test(n))return!0;let r=n.split(`/`)[0].split(`-`)[0];return t.has(r)},isBreakpoint(e){if(Ei.test(e))return!0;let t=e.replace(/^(?:max|min)-/,``).split(/[^a-z0-9]/i)[0];return n.has(t)}}}w([T,te,ne,re,E,D]);const Oi=/var\((?<cssVarName>--[^,|)]+)(?:,(?<fallback>[^)]+))?\)/g,ki=String.raw`(?:#|0x)(?:[a-f0-9]{3}|[a-f0-9]{4}|[a-f0-9]{6}|[a-f0-9]{8})\b|(?:rgb|rgba|hsl|hsla|hwb|oklch|oklab|lab|lch|device-cmyk|color)\([^)]*\)`,Ai=new RegExp(ki,`g`),ji=/var\((--[^,|)]+)(?:,([^)]+))?\)/,Mi=String.raw`(?:^|[;{]\s*)(?:[\w-]+-color|color|fill|stroke)\s*:\s*(?<value>[^;}{]+)`,Ni=new RegExp(Mi,`gm`),Pi=/(?:^|[;{])\s*--[^\s:;{}]+\s*:/m,Fi=new RegExp(ki,`i`),Ii=new RegExp(Mi,`m`),Li=new RegExp(String.raw`color-mix\([^,]+,\s*(?<color>${ki})\s+(?<weight>\d+(?:\.\d+)?%)\s*,\s*transparent\s*\)`,`i`);function Ri(e){return Pi.test(e)||Ii.test(e)||zi(e)}function zi(e){return Fi.test(e)}function Bi(e){let t=/(?:^|[;{])\s*(?<key>--[^\s:;{}]+)\s*:\s*(?<value>[^;{}]+)(?=;|})/gm,n=new Map;for(let r of e.matchAll(t)){let e=r.groups?.key;e&&n.set(e,(r.groups?.value??``).trim().replace(/\s*!important\s*$/,``))}return n}function Vi(e,t){let n=e.trim(),r=new Set;for(;n.startsWith(`var(`);){let e=n.match(ji);if(!e)break;let i=e[1].trim(),a=e[2]?.trim();if(r.has(i))return a;r.add(i);let o=t.get(i)?.trim();if(o){n=o;continue}return a||`1`}return n}function Hi(e,t){let n=e;for(let r of e.matchAll(Oi)){let e=r[0],i=r.groups?.cssVarName?.trim(),a=r.groups?.fallback;if(!i)continue;let o=t.get(i);o?n=n.replaceAll(e,Vi(o,t)??a??`1`):a&&(n=n.replaceAll(e,a))}return n.replaceAll(/,?\s+var\(--.*?\)/g,``)}function Ui(e,t){let n=Hi(e,t),r=n.match(Li);if(r?.groups?.color){let e=r.groups.color,t=r.groups.weight;if(e)return/\//.test(e)?e:e.replace(/\)$/,` / ${t})`)}let i=n.match(Ai)?.[0];if(!i){let e=n.trim().replace(/\s*!important$/,``);return C(e).isValid()?e:void 0}return/\/\)/.test(i)&&(i=i.replace(/ \/\)/g,`/ 1)`)),i}function Wi(e){let t=Bi(e);for(let n of e.matchAll(Ni)){let e=n.groups?.value;if(!e)continue;let r=Ui(e,t);if(r)return r}return Ui(e,t)}function Gi(e){let t=C(e);if(!t.isValid())return;let n=t.toRgb();return{red:n.r/255,green:n.g/255,blue:n.b/255,alpha:n.alpha}}const Ki=/(-?[\d.]+)rem(\s+!important)?;/;let qi;function Ji(e){return e.default??e}function Yi(){return qi??=Promise.all([import(`prettier/standalone`),import(`prettier/parser-postcss`)]).then(([e,t])=>({prettier:Ji(e),parserCSS:Ji(t)}))}function Xi(e,t=16){if(!e)return``;if(t<1)return e;let n=0,r=[];for(;n<e.length;){let i=e.slice(n).match(Ki);if(i?.index==null)break;let a=` /* ${Number.parseFloat(i[1])*t}px */`,o=n+i.index+i[0].length;r.push(e.slice(n,o)),r.push(a),n=o}return r.push(e.slice(n)),r.join(``)}async function Zi(e,t,n){let[r,{prettier:i,parserCSS:a}]=await Promise.all([e.generate(new Set(j(t)),{preflights:!1,safelist:!1}),Yi()]),o=Xi(r.css,n),s=await i.format(o,{parser:`css`,plugins:[a]});return{...r,prettified:s}}async function Qi(e,t,n){return`\`\`\`css\n${(await Zi(e,t,n)).prettified.trimEnd()}\n\`\`\``}const $i=[`property`,`class`,`keyword`,`number`,`enumMember`,`string`,`operator`,`type`],ea=[`important`,`pseudoClass`,`pseudoElement`,`query`,`selector`,`variable`,`combinator`,`bracket`,`group`,`condition`],ta=/^-?(?:\d+\.?\d*|\.\d+)[a-z%]*$/i,na=/^[>+~_[&.#*: ]/,ra=/^[>+~_.#]/;function ia(e,t){return t?.isColorValue?.(e)?`enumMember`:e.startsWith(`[`)?`string`:ta.test(e)?`number`:`keyword`}function aa(e,t){return e.startsWith(`::`)?{type:`type`,modifier:`pseudoElement`,symbolLen:0}:ra.test(e)?{type:`type`,modifier:`selector`,symbolLen:1}:na.test(e)?{type:`type`,modifier:`selector`,symbolLen:0}:t?.isBreakpoint?.(e)?{type:`keyword`,modifier:`query`,symbolLen:0}:{type:`keyword`,modifier:`pseudoClass`,symbolLen:0}}function oa(e,t,n,r){e.push({start:n,length:1,type:`operator`,modifiers:[`condition`]});let i=n+1,a=t;if(a.startsWith(`!`)&&(e.push({start:i,length:1,type:`operator`,modifiers:[`important`]}),i+=1,a=a.slice(1)),a.length){let{type:t,modifier:n,symbolLen:o}=aa(a,r);o&&(e.push({start:i,length:o,type:`operator`,modifiers:[`combinator`]}),i+=o,a=a.slice(o)),a.length&&e.push({start:i,length:a.length,type:t,modifiers:[n]})}return n+t.length+1}function sa(e,t,n){let r=-1,i=t=>{r>=0&&(e.push({start:n+r,length:t-r,type:`string`,modifiers:[]}),r=-1)};for(let a=0;a<t.length;a++){let o=t[a];o===`[`||o===`]`||o===`_`?(i(a),e.push({start:n+a,length:1,type:`operator`,modifiers:[`bracket`]})):r<0&&(r=a)}i(t.length)}function ca(e,t,n,r,i){let a=+!!t.startsWith(`$`);a&&e.push({start:n,length:1,type:`operator`,modifiers:[`variable`]});let o=t.slice(a);if(!o.length)return;if(r===`value`&&o.startsWith(`[`)){sa(e,o,n+a);return}if(r===`value`&&a&&o.includes(`|`)){let t=o.indexOf(`|`),r=o.slice(0,t),s=o.slice(t+1);if(r.length&&e.push({start:n+a,length:r.length,type:ia(r,i),modifiers:[]}),e.push({start:n+a+t,length:1,type:`operator`,modifiers:[`important`]}),s.length){let r=n+a+t+1;s.startsWith(`[`)?sa(e,s,r):e.push({start:r,length:s.length,type:ia(s,i),modifiers:[]})}return}let s=r===`property`?`property`:ia(o,i);e.push({start:n+a,length:o.length,type:s,modifiers:[]})}function la(e,t,n){if(!e)return[];if(e.startsWith(`{`)&&e.includes(`}`))return da(e,t,n);let r=de(e),i=[];if(r.keyword)r.body.length&&(r.body.startsWith(`[`)?sa(i,r.body,t):i.push({start:t,length:r.body.length,type:`class`,modifiers:[]}));else{let e=r.property??``,a=r.value??``;e.length&&ca(i,e,t,`property`,n),i.push({start:t+e.length,length:1,type:`operator`,modifiers:[]}),a.length&&ca(i,a,t+e.length+1,`value`,n)}let a=t+r.body.length;r.important&&(i.push({start:a,length:1,type:`operator`,modifiers:[`important`]}),a+=1);for(let e of r.conditions)a=oa(i,e,a,n);return i}function ua(e,t,n){let r=0;for(let i=n;i<e.length;i++){let n=e[i];if(n===`\\`)i++;else if(n===`[`||n===`(`)r++;else if(n===`]`||n===`)`)r--;else if(n===t&&r<=0)return i}return-1}function da(e,t,n){let r=[],i=ua(e,`}`,0);r.push({start:t,length:1,type:`operator`,modifiers:[`group`]});let a=t+1,o=e.slice(1,i),s=[],c=0;for(;;){let e=ua(o,`;`,c);if(e===-1){s.push(o.slice(c));break}s.push(o.slice(c,e)),c=e+1}s.forEach((e,t)=>{if(t>0&&(r.push({start:a,length:1,type:`operator`,modifiers:[`group`]}),a+=1),e.length){for(let t of la(e,a,n))r.push(t);a+=e.length}}),r.push({start:t+i,length:1,type:`operator`,modifiers:[`group`]});let l=t+i+1,u=e.slice(i+1);if(u.startsWith(`!`)&&(r.push({start:l,length:1,type:`operator`,modifiers:[`important`]}),l+=1,u=u.slice(1)),u.startsWith(`@`))for(let e of u.slice(1).split(`@`))l=oa(r,e,l,n);return r}const fa=new Map,pa=new WeakMap;function ma(e,t){let n=Number.parseFloat(e);return t===`rem`||t===`em`?n*16:n}function ha(e){let t=e.match(/\(min-width:\s*([\d.]+)(px|rem|em)?\s*\)/);if(t)return ma(t[1],t[2]);let n=e.match(/\(max-width:\s*([\d.]+)(px|rem|em)?\s*\)/);if(n)return-ma(n[1],n[2])}function ga(e,t){return e<t?-1:+(e>t)}function _a(e,t){return ga(e??``,t??``)}function va(e,t,n){let r=(e.get(t)??0)-(e.get(n)??0);if(r)return r;let i=ha(t),a=ha(n);return i!==void 0&&a!==void 0&&i!==a?i-a:ga(t,n)}function ya(e,t){return e[0]-t[0]||(e[4]?.sort??0)-(t[4]?.sort??0)||_a(e[5]?.currentSelector,t[5]?.currentSelector)||_a(e[1],t[1])||ga(e[2],t[2])}function ba(e){let t=!1,n=0,r,i=``;for(let a=0;a<e.length;a++){let o=e[a];if(t){o===`*`&&e[a+1]===`/`&&(t=!1,a++);continue}if(r){o===`\\`?a++:o===r&&(r=void 0);continue}if(o===`/`&&e[a+1]===`*`){t=!0,a++;continue}if(o===`\\`){a++;continue}if(o===`"`||o===`'`){r=o;continue}if(!/\s/.test(o)||e[a+1]!==`$`||e[a+2]!==`$`||!/\s/.test(e[a+3]??``))continue;let s=a+4;for(;s<e.length&&/\s/.test(e[s]);)s++;i+=`${e.slice(n,a)} `,n=s,a=s-1}return n?i+e.slice(n):e}function xa(e){let t=[],n=0,r=!1,i=0,a,o=0;for(let s=0;s<e.length;s++){let c=e[s];r?c===`*`&&e[s+1]===`/`&&(r=!1,s++):a?c===`\\`?s++:c===a&&(a=void 0):c===`/`&&e[s+1]===`*`?(r=!0,s++):c===`"`||c===`'`?a=c:c===`(`?i++:c===`)`?i>0&&i--:c===`[`?n++:c===`]`?n>0&&n--:n===0&&i===0&&e.startsWith(` $$ `,s)&&(t.push(e.slice(o,s)),s+=3,o=s+1)}return t.push(e.slice(o)),t}function Sa(e){let t=fa.get(e);if(t!==void 0)return t;let n=Ri(e);return N(fa,e,n,2048),n}function Ca(e){let t=new Map,n=new Map,r=0;for(let i of e){let[a,o,s]=i;if(s){e[r++]=i;continue}let c=a.length?t:n,l=c.get(o);l?a.length&&l[0].push(...a):(c.set(o,i),e[r++]=i)}e.length=r}function wa(e,t,n){let r=e.sort(ya).map(([,e,t,,n,,r])=>{let i=e&&!n?.noScope?ba(e):e;return[i==null?[]:[[i,n?.sort??0]],t,!!(r??n?.noMerge)]});t&&Ca(r);let i=[];for(let e=r.length-1;e>=0;e--){let[t,n]=r[e],a=t.length===1?t[0][0]:``;t.length>1&&(t.sort((e,t)=>e[1]-t[1]||ga(e[0],t[0])),a=[...new Set(t.map(([e])=>e).filter(Boolean))].join(`,
12
+ `)),i.push(a?`${a}{${n}}`:n)}let a=[...new Set(i)].reverse();return(n?a:a.filter(Sa)).join(`
13
+ `)}function Ta(e,t,n){let r=new Map,i=new Set([M]);for(let e of n){let t=e[4]?.layer||`utilities`;i.add(t);let n=e[3]||``,a=r.get(t);a||(a=new Map,r.set(t,a));let o=a.get(n);o?o.push(e):a.set(n,[e])}let a=t=>Object.hasOwn(e.layers,t)?e.layers[t]??0:0,o=e.sortLayers([...i].sort((e,t)=>a(e)-a(t)||ga(e,t))),s=[];for(let n of o){let i=r.get(n);if(i)for(let n of[...i.keys()].sort((e,n)=>va(t,e,n))){let t=wa(i.get(n),e.mergeSelectors,Sa(n));if(t)if(!n)s.push(t);else{let e=xa(n);s.push(`${e.join(`{`)}{${t}${`}`.repeat(e.length)}`)}}}return s.join(`
14
+ `)}async function Ea(e,t){let n=e.config,r=await e.parseToken(t);if(e.config!==n)return Ea(e,t);if(r?.length)return Wi(Ta(n,new Map(e.parentOrders),r))}async function Da(e,t){let n=pa.get(e);return(!n||n.config!==e.config)&&(n={config:e.config,values:new Map},pa.set(e,n)),Ze(n.values,t,1e3,()=>Ea(e,t).then(e=>e?{colorString:e,color:Gi(e)}:{}))}const Oa=[...ea,`teacss`],ka={tokenTypes:[...$i],tokenModifiers:Oa},Aa=new Map($i.map((e,t)=>[e,t])),ja=new Map(Oa.map((e,t)=>[e,1<<t])),Ma=ja.get(`teacss`)??0,Na=/^-?(?:\d+\.?\d*|\.\d+)[a-z%]*$/i,Pa=new WeakMap,Fa={log(){},warn(){}};async function Ia(e,t,n){let r=Array(e.length),i=0,a=Array.from({length:Math.min(t,e.length)},async()=>{for(;i<e.length;){let t=i++;r[t]=await n(e[t],t)}});return await Promise.all(a),r}function La(e){return!e.startsWith(`[`)||!e.endsWith(`]`)||Gi(e.slice(1,-1).replace(/\\?_/g,e=>e===`_`?` `:`_`).trim())!==void 0}function Ra(e){let t=Pa.get(e);if(t?.config===e.config)return t.classifier;let n=Di(e.config?.theme??{});return Pa.set(e,{config:e.config,classifier:n}),n}function za(e){e.sort((e,t)=>e.line-t.line||e.char-t.char);let t=[],n=0,r=0;for(let i of e){let e=i.line-n,a=e===0?i.char-r:i.char;t.push(e,a,i.length,i.type,i.modifiers),n=i.line,r=i.char}return{data:t}}function Ba(e,t,n,r,i=Ma){let a=e.positionAt(t);return{line:a.line,char:a.character,length:n,type:Aa.get(r)??0,modifiers:i}}function Va(e,t,n,r,i=Ma){let a=[],o=0;for(let s=0;s<n.length;s++)(n[s]===`\r`||n[s]===`
15
+ `)&&(s>o&&a.push(Ba(e,t+o,s-o,r,i)),n[s]===`\r`&&n[s+1]===`
16
+ `&&s++,o=s+1);return o<n.length&&a.push(Ba(e,t+o,n.length-o,r,i)),a}function Ha(e,t){return t.isColorValue?.(e)?`enumMember`:Na.test(e)?`number`:`string`}function Ua(e,t,n){return e.some(e=>e.open===t&&e.close===n-1)}function Wa(e,t,n){let r=[];for(let i of n){r.push(Ba(e,i.open,1,`operator`,Ma|(ja.get(`group`)??0)));for(let n of i.declarations){let{property:i,start:a,colon:o,value:s,valueStart:c}=n;r.push(Ba(e,a,2,`operator`,Ma|(ja.get(`variable`)??0))),r.push(Ba(e,a+2,i.length-2,`property`)),r.push(Ba(e,o,1,`operator`)),s&&r.push(...Va(e,c,s,Ha(s,t)))}r.push(Ba(e,i.close,1,`operator`,Ma|(ja.get(`group`)??0)))}return r}var Ga=class{contextManager;getSettings;logger;autoCompletes=new Map;semanticTokensCache=new Map;featureFailures=new Map;constructor(e){this.getSettings=e.getSettings??(()=>Ci),this.logger=e.logger??Fa;let t=e.folderPaths?.length?e.folderPaths:[e.rootPath];this.contextManager=new Si(e.rootPath,this.logger,t),this.contextManager.events.on(`contextReload`,e=>this.resetFeatureCaches(e)),this.contextManager.events.on(`contextUnload`,e=>this.resetFeatureCaches(e)),this.contextManager.events.on(`unload`,e=>this.resetFeatureCaches(e))}get events(){return this.contextManager.events}get ready(){return this.contextManager.ready}resetAutoCompleteCache(e){e?this.autoCompletes.delete(e):this.autoCompletes.clear()}resetFeatureCaches(e){this.resetAutoCompleteCache(e),this.semanticTokensCache.clear(),this.featureFailures.clear()}reportFeatureFailure(e,t,n){let r=`${e}\0${t}`,i=n instanceof Error?n.message:String(n);this.featureFailures.get(r)!==i&&(N(this.featureFailures,r,i,100),this.logger.warn(`⚠️ Failed to provide ${e} for ${t}: ${i}`))}clearFeatureFailure(e,t){this.featureFailures.delete(`${e}\0${t}`)}getAutocomplete(e,t){let n=this.autoCompletes.get(e);if(n?.matchType===t)return n.autocomplete;let r=pi(e.generator,{matchType:t,throwErrors:!1});return this.autoCompletes.set(e,{matchType:t,autocomplete:r}),r}async resolveTargetContext(e){let t=K(e.uri);if(!this.contextManager.isTarget(t))return null;let n=e.getText();if(!n)return null;let r=await this.contextManager.resolveClosestContext(n,t);return!r||!(r.filter(n,t)||n.includes(`@teacss-ide-include`)||this.contextManager.configSources.includes(t)||me(t))?null:{ctx:r,id:t,code:n,doc:e.getText()===n?e:x.create(e.uri,e.languageId,e.version,n)}}async getSemanticTokens(e){let t={data:[]},n=`semantic tokens`;try{let r=this.getSettings();if(!r.syntaxHighlight)return this.clearFeatureFailure(n,e.uri),t;let i=await this.resolveTargetContext(e);if(!i)return this.clearFeatureFailure(n,e.uri),t;let{ctx:a,id:o,code:s,doc:c}=i,l=r.strictAnnotationMatch,u=this.semanticTokensCache.get(o);if(u&&u.code===s&&u.generator===a.generator&&u.strictAnnotationMatch===l)return N(this.semanticTokensCache,o,u,100),this.clearFeatureFailure(n,e.uri),u.result;let d=await tt(a.generator,s,o,l),f=Ra(a.generator),p=[],m=new Map,g=me(o)?h(s):[];for(let[e,t]of d){if(Ua(g,e,t))continue;let n=s.slice(e,t),r=m.get(n);r||(r=la(n,0,f),m.set(n,r));for(let t of r){let n=e+t.start,r=c.positionAt(n),i=Ma;for(let e of t.modifiers)i|=ja.get(e)??0;p.push({line:r.line,char:r.character,length:t.length,type:Aa.get(t.type)??0,modifiers:i})}}g.length&&p.push(...Wa(c,f,g));let _=za(p);return N(this.semanticTokensCache,o,{code:s,generator:a.generator,strictAnnotationMatch:l,result:_},100),this.clearFeatureFailure(n,e.uri),_}catch(r){return this.reportFeatureFailure(n,e.uri,r),t}}async getDiagnostics(e){try{if(!me(K(e.uri)))return this.clearFeatureFailure(`diagnostics`,e.uri),[];let t=await this.resolveTargetContext(e);if(!t)return this.clearFeatureFailure(`diagnostics`,e.uri),[];let{ctx:n,code:r,doc:i}=t,a=d(r,m(n.generator.config?.theme??{})).map(e=>({range:{start:i.positionAt(e.start),end:i.positionAt(e.end)},message:e.message,severity:ee.Warning,source:`teacss`,code:e.reason}));return this.clearFeatureFailure(`diagnostics`,e.uri),a}catch(t){return this.reportFeatureFailure(`diagnostics`,e.uri,t),[]}}async getHover(e,t){let n=`hover`;try{if(me(K(e.uri)))return this.clearFeatureFailure(n,e.uri),null;let r=this.getSettings(),i=await this.resolveTargetContext(e);if(!i)return this.clearFeatureFailure(n,e.uri),null;let{ctx:a,id:o,code:s,doc:c}=i,l=c.offsetAt(t),u=(await tt(a.generator,s,o,r.strictAnnotationMatch)).find(([e,t])=>l>=e&&l<t);if(!u)return this.clearFeatureFailure(n,e.uri),null;let d=r.remToPxPreview?r.remToPxRatio:-1,f={contents:{kind:`markdown`,value:await Qi(a.generator,u[2],d)},range:{start:c.positionAt(u[0]),end:c.positionAt(u[1])}};return this.clearFeatureFailure(n,e.uri),f}catch(t){return this.reportFeatureFailure(n,e.uri,t),null}}async getDocumentColors(e){let t=`document colors`;try{let n=this.getSettings();if(!n.colorPreview)return this.clearFeatureFailure(t,e.uri),[];let r=await this.resolveTargetContext(e);if(!r)return this.clearFeatureFailure(t,e.uri),[];let{ctx:i,id:a,code:o,doc:s}=r,c=await tt(i.generator,o,a,n.strictAnnotationMatch),l=[],u=!1;for(let[n,r,a]of c)try{let{color:e}=await Da(i.generator,a);e&&l.push({range:{start:s.positionAt(n),end:s.positionAt(r)},color:{...e}})}catch(n){u=!0,this.reportFeatureFailure(t,e.uri,n)}return u||this.clearFeatureFailure(t,e.uri),l}catch(n){return this.reportFeatureFailure(t,e.uri,n),[]}}getColorPresentations(e,t,n){let r=Math.round(e.red*255),i=Math.round(e.green*255),a=Math.round(e.blue*255),o=Math.min(1,Math.max(0,e.alpha)),s=e=>e.toString(16).padStart(2,`0`),c=o<1?`#${s(r)}${s(i)}${s(a)}${s(Math.round(o*255))}`:`#${s(r)}${s(i)}${s(a)}`;if(t&&n){let e=Ka(n),r=n.slice(0,e),i=n.slice(e),a=r.indexOf(`:`);if(a>0){let e=r.endsWith(`!`)?`!`:``;if(La(r.slice(a+1,r.length-e.length))){let n=`${r.slice(0,a)}:[${c}]${e}${i}`;return[{label:n,textEdit:{range:t,newText:n}}]}}}return n&&t?[{label:n,textEdit:{range:t,newText:n}}]:[{label:c}]}async getMatchedPositions(e){let t=this.getSettings(),n=await this.resolveTargetContext(e);if(!n)return[];let{ctx:r,id:i,code:a}=n;return(await tt(r.generator,a,i,t.strictAnnotationMatch)).map(([e,t,n])=>({start:e,end:t,text:n}))}async getReferences(e,t){let n=this.getSettings(),r=K(e.uri),i=e.getText(),a=await this.contextManager.resolveClosestContext(i,r);if(!a?.filter(i,r))return null;let o=e.getText()===i?e:x.create(e.uri,e.languageId,e.version,i),s=await tt(a.generator,i,r,n.strictAnnotationMatch),c=o.offsetAt(t),l=s.find(e=>e[0]<=c&&c<e[1]);if(!l?.[2])return null;let u=l[2],d=new Set(a.generator.getCachedEquivalentTokens(u));return s.filter(e=>d.has(e[2])).map(t=>({uri:e.uri,range:{start:o.positionAt(t[0]),end:o.positionAt(t[1])}}))}async getCompletions(e,t){let n=`completions`;try{let r=this.getSettings(),i=K(e.uri);if(!this.contextManager.isTarget(i))return this.clearFeatureFailure(n,e.uri),null;let a=e.getText();if(!a)return this.clearFeatureFailure(n,e.uri),null;let o=await this.contextManager.resolveClosestContext(a,i);if(!o)return this.clearFeatureFailure(n,e.uri),null;let s=e.getText()===a?e:x.create(e.uri,e.languageId,e.version,a),c=s.offsetAt(t);if(r.autocompleteStrict&&!_i(a,i,c))return this.clearFeatureFailure(n,e.uri),null;let l=await this.getSuggestionResult({ctx:o,code:a,id:i,offset:c,matchType:r.autocompleteMatchType});if(!l?.suggestions.length)return this.clearFeatureFailure(n,e.uri),null;let u=l.suggestions.slice(0,r.autocompleteMaxItems),d=r.colorPreview?await Ia(u,32,async([e])=>{try{return(await Da(o.generator,e)).colorString}catch{return}}):[],f=[];for(let t=0;t<u.length;t++){let[n,r]=u[t],i=d[t],a=l.resolveReplacement(n),o={label:r,kind:i?S.Color:S.EnumMember,sortText:i?/-\d$/.test(r)?`1`:`2`:void 0,data:{value:n,uri:e.uri},textEdit:{range:{start:s.positionAt(a.start),end:s.positionAt(a.end)},newText:a.replacement}};i&&(o.documentation=i),f.push(o)}return this.clearFeatureFailure(n,e.uri),{isIncomplete:!0,items:f}}catch(t){return this.reportFeatureFailure(n,e.uri,t),null}}async resolveCompletion(e,t){if(!e.data?.uri||!e.data?.value||!t)return e;let n=this.getSettings(),r=K(e.data.uri),i=t.getText(),a=await this.contextManager.resolveClosestContext(i,r);if(!a)return e;let o=n.remToPxPreview?n.remToPxRatio:-1;return e.kind===S.Color?e.detail=await(await Zi(a.generator,e.data.value,o)).prettified:e.documentation={kind:`markdown`,value:await Qi(a.generator,e.data.value,o)},e}async getSuggestionResult({ctx:e,code:t,id:n,offset:r,matchType:i}){let a=vi(t,n);if(!e.filter(t,n)&&!me(n)&&!a)return null;let o=this.getAutocomplete(e,i),s;if(a){let e=t.substring(0,r).match(/\.[-\w]*$/);if(e){let t=e[0].substring(1),n=await o.suggest(t||``);n.length&&(s={suggestions:n.map(e=>[e,e]),resolveReplacement:e=>({start:r-(t?.length||0),end:r,replacement:e})})}else s=await o.suggestInFile(t,r)}else s=await o.suggestInFile(t,r);return s}};function Ka(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 r}return e.length}function qa(e,t){let n=Ya(t.workspaceFolderPaths||[]),r=n.length?n:Ya([t.workspaceRootPath]),i=j(e).filter(e=>typeof e==`string`&&e.length>0);if(!i.length)return r;let a=Ya([t.workspaceFileDir,...n,t.workspaceRootPath]);return Ya(i.flatMap(e=>Ja(e,a)))}function Ja(e,t){if(!e)return[];if(Xa(e))return[u.normalize(e)];let n=u.normalize(e),r=t.filter(e=>{let t=u.normalize(e);return t===n||t.endsWith(`${u.sep}${n}`)});if(r.length)return r;let i=t.map(t=>u.resolve(t,e)),a=i.filter(e=>l(e));return a.length?a:i.slice(0,1)}function Ya(e){return Array.from(new Set(e.filter(Boolean).map(e=>u.normalize(e))))}function Xa(e){return u.isAbsolute(e)||u.win32.isAbsolute(e)}const Za=/[\\/](?:node_modules|dist|\.temp|\.cache|\.git)[\\/]/,Qa=new Set([`node_modules`,`dist`,`.temp`,`.cache`,`.git`]),$a=`**/{${Array.from(new Set(f.map(e=>u.posix.basename(e)))).join(`,`)}}`;function eo(e,t){let n=u.relative(e,t);return n===``||!n.startsWith(`..${u.sep}`)&&n!==`..`&&!u.isAbsolute(n)}function to(e){return[...e].map(e=>e===`*`?`[*]`:e===`?`?`[?]`:e===`[`?`[[]`:e===`]`?`[]]`:e===`{`?`[{]`:e===`}`?`[}]`:e).join(``)}function no(e){try{let t=JSON.parse(c.readFileSync(u.join(e,`package.json`),`utf8`))?.teacss?.entry;return typeof t==`string`&&t?u.resolve(e,t):void 0}catch{return}}function ro(e){let t=[],n=[e];for(let e of n){let r;try{r=c.readdirSync(e,{withFileTypes:!0})}catch{continue}if(r.some(e=>e.isFile()&&e.name===`package.json`)){let n=no(e);n&&t.push({directory:e,entry:n})}for(let t of r)t.isDirectory()&&!Qa.has(t.name)&&n.push(u.join(e,t.name))}return t.sort((e,t)=>e.directory<t.directory?-1:+(e.directory>t.directory))}function io(e,t){return t.map(e=>u.normalize(e)).filter(t=>eo(t,e)).sort((e,t)=>t.length-e.length)[0]}function ao(e,t){let n=u.dirname(e);for(;eo(t,n);){if(u.normalize(p(n)??``)===e)return!0;if(n===t)break;n=u.dirname(n)}return!1}function oo(e){let t=e.map(({globPattern:e,kind:t})=>typeof e==`string`?`${t??``}\0${e}`:`${t??``}\0${e.baseUri}\0${e.pattern}`);return JSON.stringify(t.sort())}function so(e,t,n){let r=new Map,i=(e,t,i=!0)=>{let a=i?to(t):t,o={baseUri:v(e).href,pattern:a};r.set(`${o.baseUri}\0${a}`,{globPattern:o,kind:n})};for(let t of e)i(u.dirname(t),u.basename(t));for(let e of t){i(e,$a,!1);for(let{directory:t,entry:n}of ro(e)){let e=u.relative(t,n);eo(t,n)?i(t,e.split(u.sep).join(`/`)):i(u.dirname(n),u.basename(n))}}return Array.from(r.values())}function co(e,t,n){let r=new Set(t.map(e=>u.normalize(e))),i=new Set(n.map(no).filter(e=>!!e).map(e=>u.normalize(e))),a=new Set;for(let t of e){let e;try{e=u.normalize(_(t.uri))}catch{return!0}if(r.has(e)||i.has(e))return!0;if(Za.test(e))continue;let o=io(e,n);if(!o){a.add(e);continue}if(u.basename(e)===`package.json`)return!0;if(u.extname(e).toLowerCase()!==`.css`){a.add(e);continue}try{if(ao(e,o))return!0}catch{return!0}}if(a.size){for(let e of n)for(let{entry:t}of ro(e))if(a.has(u.normalize(t)))return!0}return!1}function lo(e){let t,n,r,i,a=0,o=Promise.resolve();return{update(s){let c=oo(s);if(i&&r===c)return i;if(!i&&n===c)return Promise.resolve();let l=++a,u=o.then(async()=>{if(l!==a||n===c)return;let r=await e(s);if(l!==a){r.dispose();return}t?.dispose(),t=r,n=c});o=u.catch(()=>{}),r=c,i=u;let d=()=>{i===u&&(i=void 0,r=void 0)};return u.then(d,d),u}}}function uo(e){return e instanceof Error?e.message:String(e)}function fo(e){let t=new Map,n=new Map,r=0;return{async publish(i){let a=++r;t.set(i.uri,a);try{let r=await e.getDiagnostics(i);if(t.get(i.uri)!==a)return;await e.sendDiagnostics(i.uri,r),t.get(i.uri)===a&&n.delete(i.uri)}catch(r){if(t.get(i.uri)!==a)return;let o=uo(r);if(n.get(i.uri)===o)return;n.set(i.uri,o),e.reportError(i.uri,r)}},invalidate(e){t.delete(e),n.delete(e)}}}function po(e,t){e.on(`uncaughtExceptionMonitor`,(e,n)=>{t(`[teacss] ${n===`unhandledRejection`?`Unhandled rejection`:`Uncaught exception`}: ${e.message}`)})}function mo(e){return typeof e==`object`&&e&&!Array.isArray(e)?e:{}}function ho(e,t){return typeof e==`boolean`?e:t}function go(e,t){if(e!==null)return typeof e==`string`?e:Array.isArray(e)?e.filter(e=>typeof e==`string`):t}function _o(e,t){return typeof e==`number`&&Number.isFinite(e)&&e>0?e:t}function vo(e,t){return typeof e!=`number`||!Number.isFinite(e)?t:Math.min(1e4,Math.max(0,Math.floor(e)))}function yo(e){let t=mo(e),n={};return Object.hasOwn(t,`root`)&&(n.root=t.root),(t.semanticTokens===`native`||t.semanticTokens===`overlay`)&&(n.semanticTokens=t.semanticTokens),typeof t.workspaceFileDir==`string`&&(n.workspaceFileDir=t.workspaceFileDir),Array.isArray(t.workspaceFolderPaths)&&(n.workspaceFolderPaths=t.workspaceFolderPaths.filter(e=>typeof e==`string`)),n}function bo(e,t){let n=mo(t),r=mo(n.autocomplete),i=r.matchType;return{root:go(n.root,e.root),colorPreview:ho(n.colorPreview,e.colorPreview),remToPxPreview:ho(n.remToPxPreview,e.remToPxPreview),remToPxRatio:_o(n.remToPxRatio,e.remToPxRatio),syntaxHighlight:ho(n.syntaxHighlight,e.syntaxHighlight),strictAnnotationMatch:ho(n.strictAnnotationMatch,e.strictAnnotationMatch),autocompleteMatchType:i===`prefix`||i===`fuzzy`?i:e.autocompleteMatchType,autocompleteStrict:ho(r.strict,e.autocompleteStrict),autocompleteMaxItems:vo(r.maxItems,e.autocompleteMaxItems)}}function xo(e){return bo(Ci,e)}function So(e,t){return e.syntaxHighlight!==t.syntaxHighlight||e.strictAnnotationMatch!==t.strictAnnotationMatch}function Co(e,t){let n=new Set(e),r=new Set(t);return n.size!==r.size||[...n].some(e=>!r.has(e))}async function wo(e,t,n){if(e)try{return await t()}catch(e){n(e);return}}const q=A(k.all),J=new ae(x);let Y=xo(),X,To=!1,Eo=!1,Do=!1,Oo=!1,ko=!1,Ao=!1,jo=0,Mo;const No=new Promise(e=>{Mo=e}),Po=oe.Create|oe.Change|oe.Delete,Fo=[{globPattern:`**/*.css`,kind:Po}],Z={folderPaths:[]};function Io(e){Y=bo(Y,e)}function Lo(e){return qa(e,{workspaceRootPath:Z.rootPath,workspaceFileDir:Z.fileDir,workspaceFolderPaths:Z.folderPaths})}function Ro(e){return typeof e==`string`?e.length>0:Array.isArray(e)&&e.some(Boolean)}async function zo(){X&&await Bo(()=>X.contextManager.setRoots(Lo(Y.root)))}async function Bo(e){jo++;try{return await e()}finally{jo--}}function Vo(e,t,n){Z.rootPath=e?K(e):void 0,Z.fileDir=n?.workspaceFileDir,Z.folderPaths=n?.workspaceFolderPaths||t?.map(e=>K(e.uri))||[]}function Ho(e=Z.rootPath){if(!e)return;let t=new Ga({rootPath:e,folderPaths:Lo(Y.root),logger:{log:e=>q.console.log(e),warn:e=>q.console.warn(e)},getSettings:Zo});X=t;let n=()=>{jo||(Jo().catch(e=>Q(`Failed to update config watchers`,e)),Yo(),as())};return t.events.on(`reload`,()=>{jo||Jo().catch(e=>Q(`Failed to update config watchers`,e))}),t.events.on(`contextLoaded`,n),t.events.on(`contextReload`,n),t.events.on(`contextUnload`,n),t.events.on(`unload`,n),t}async function Uo(e){X||!e[0]||await Ho(e[0])?.ready}function Wo(){return X?.contextManager.configSources??[]}function Go(){return Array.from(new Set([...Lo(Y.root),...X?.contextManager.contextsMap.keys()??[]]))}function Ko(){let e=Wo(),t=so(e,Go(),Po);return e.length?t:[...Fo,...t]}const qo=lo(async e=>q.client.register(O.type,{watchers:[...e]}));async function Jo(){!To||!Ao||!X||await qo.update(Ko())}function Q(e,t){q.console.error(`[teacss] ${e}: ${t instanceof Error?t.message:String(t)}`)}async function Yo(){Ao&&(ko?await q.sendNotification(`teacss/semanticTokens/refresh`).catch(e=>Q(`Failed to refresh semantic token decorations`,e)):Oo&&await q.languages.semanticTokens.refresh().catch(e=>Q(`Failed to refresh semantic tokens`,e)))}const Xo=fo({async getDiagnostics(e){return await $(),await X?.getDiagnostics(e)??[]},sendDiagnostics(e,t){return q.sendDiagnostics({uri:e,diagnostics:[...t]})},reportError(e,t){Q(`Failed to publish diagnostics for ${e}`,t)}});po(o,e=>q.console.error(e));function Zo(){return Y}function Qo(){return X}function $(){return No}q.onInitialize(a=>{To=!!a.capabilities.workspace?.didChangeWatchedFiles?.dynamicRegistration,Eo=!!a.capabilities.workspace?.configuration,Do=!!a.capabilities.workspace?.workspaceFolders,Oo=!!a.capabilities.workspace?.semanticTokens?.refreshSupport;let o=yo(a.initializationOptions);ko=o?.semanticTokens===`overlay`,`root`in o&&Io({root:o.root});let s=a.workspaceFolders,c=s?.[0]?.uri||a.rootUri;Vo(c,s,o);let l=c?void 0:Lo(Y.root)[0];return c?Ho():l&&Ho(l),t(q,J,Qo,$),r(q,J,Qo,$),e(q,J,Qo,$),n(q,J,Qo,$),i(q,J,Qo,$),{capabilities:{textDocumentSync:ie.Incremental,completionProvider:{resolveProvider:!0,triggerCharacters:[`-`,`:`,` `,`"`,`'`]},hoverProvider:!0,referencesProvider:!0,colorProvider:!0,...ko?{}:{semanticTokensProvider:{legend:ka,full:!0}},...Do?{workspace:{workspaceFolders:{supported:!0,changeNotifications:!0}}}:{}}}}),q.onInitialized(async()=>{Do&&q.workspace.onDidChangeWorkspaceFolders(e=>{os(e).catch(e=>Q(`Failed to update workspace folders`,e))});try{let e=await wo(Eo,()=>q.workspace.getConfiguration(`teacss`),e=>Q(`Failed to read workspace configuration`,e));e!==void 0&&Io(e),await Uo(Lo(Y.root)),X&&(await X.ready,await zo())}catch(e){Q(`Failed to complete initial setup`,e)}finally{Ao=!0,Mo?.(),Mo=void 0}q.console.log(`✅ TeaCSS Language Server initialized`),await Jo().catch(e=>Q(`Failed to update config watchers`,e)),await Yo()});let $o;q.onDidChangeWatchedFiles(e=>{co(e.changes,Wo(),Go())&&(clearTimeout($o),$o=setTimeout(()=>{es().catch(e=>Q(`Failed to reload config sources`,e))},500))});async function es(){await $(),X&&(q.console.log(`🔄 Config source changed, reloading TeaCSS...`),et(),await Bo(()=>X.contextManager.reload()),q.console.log(`🔵 Reloaded.`),await Jo().catch(e=>Q(`Failed to update config watchers`,e)),await Yo(),await as())}q.onDidChangeConfiguration(async e=>{await $();let t=e.settings?.teacss;if(t!==void 0){let e=Y,n=Lo(e.root);Io(t);let r=Lo(Y.root),i=Co(n,r);i&&(await Uo(r),X&&await Bo(()=>X.contextManager.setRoots(r)),await Jo().catch(e=>Q(`Failed to update config watchers`,e)),await as()),(i||So(e,Y))&&await Yo()}});async function ts(){return await $(),X?(et(),await Bo(()=>X.contextManager.reload()),await Jo().catch(e=>Q(`Failed to update config watchers`,e)),await Yo(),await as(),{success:!0}):{success:!1}}async function ns(e){if(await $(),!X)return{count:0};let t=J.get(e.uri);if(!t)return{count:0};let n=K(e.uri),r=t.getText(),i=await X.contextManager.resolveClosestContext(r,n);return i?{count:(await i.generator.generate(r,{id:n,preflights:!1,safelist:!1,minify:!0})).matched.size}:{count:0}}async function rs(e){if(await $(),!X)return{positions:[]};let t=J.get(e.uri);return t?{positions:(await X.getMatchedPositions(t)).map(e=>({start:t.positionAt(e.start),end:t.positionAt(e.end),className:e.text}))}:{positions:[]}}q.onRequest(`teacss/reloadConfig`,ts),q.onRequest(`teacss/getMatchedCount`,ns),q.onRequest(`teacss/getMatchedPositions`,rs);async function is(e){!X||!me(K(e.uri))||await Xo.publish(e)}async function as(){await Promise.all(J.all().map(e=>is(e)))}async function os(e){await $();let t=new Set(e.removed.map(e=>K(e.uri))),n=Z.folderPaths.filter(e=>!t.has(e));for(let t of e.added){let e=K(t.uri);n.includes(e)||n.push(e)}if(Z.folderPaths=n,Z.rootPath=n[0],!X&&Z.rootPath&&(Ho(),await Qo()?.ready),!X)return;et();let r=Ro(Y.root)?Lo(Y.root):Z.folderPaths;await Bo(()=>X.contextManager.setRoots(r)),await Jo().catch(e=>Q(`Failed to update config watchers`,e)),await Yo(),await as()}J.onDidChangeContent(e=>{$e(K(e.document.uri)),is(e.document)}),J.onDidClose(e=>{let t=K(e.document.uri);$e(t),X?.contextManager.releaseDocument(t),Xo.invalidate(e.document.uri),q.sendDiagnostics({uri:e.document.uri,diagnostics:[]})}),J.listen(q),q.listen();export{};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@teacss/language-server",
3
- "version": "0.3.8",
3
+ "version": "0.4.1",
4
4
  "description": "Standalone LSP server for TeaCSS — completion, hover, color, and token highlighting over stdio.",
5
5
  "homepage": "https://css.teasim.com",
6
6
  "funding": "https://github.com/sponsors/billgo",
@@ -30,9 +30,9 @@
30
30
  },
31
31
  "dependencies": {
32
32
  "@colordx/core": "^5.5.0",
33
- "@teacss/config": "0.3.8",
34
- "@teacss/language-service": "0.3.8",
35
- "@teacss/runtime": "0.3.8",
33
+ "@teacss/config": "0.4.1",
34
+ "@teacss/language-service": "0.4.1",
35
+ "@teacss/runtime": "0.4.1",
36
36
  "magic-string": "^1.1.0",
37
37
  "prettier": "^3.9.6",
38
38
  "vscode-languageserver": "^10.1.0",
@@ -40,9 +40,9 @@
40
40
  "vscode-languageserver-types": "^3.18.0"
41
41
  },
42
42
  "devDependencies": {
43
- "@teacss/autocomplete": "0.3.8",
44
- "@teacss/core": "0.3.8",
45
- "@teacss/preset-standard": "0.3.8"
43
+ "@teacss/autocomplete": "0.4.1",
44
+ "@teacss/core": "0.4.1",
45
+ "@teacss/preset-standard": "0.4.1"
46
46
  },
47
47
  "engines": {
48
48
  "node": ">=22.12.0"