@tailwindcss/language-server 0.14.19 → 0.14.20
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.
@@ -1833,7 +1833,7 @@ If omitted, Tailwind will append these classes to the very end of your styleshee
|
|
1833
1833
|
|
1834
1834
|
[Tailwind CSS Documentation](${xa(e.version,"functions-and-directives/variant")})`}}),Kse("custom-variant",t,n)&&l.push({label:"@slot",documentation:{kind:"markdown",value:`Use the \`@slot\` directive to define where rules go in a custom variant.
|
1835
1835
|
|
1836
|
-
[Tailwind CSS Documentation](${xa(e.version,"functions-and-directives/#slot")})`},sortText:"-0000000"})),ao({isIncomplete:!1,items:l.map(s=>({...s,kind:14}))},{data:{...e.completionItemData??{},_type:"directive"},range:{start:{line:n.line,character:n.character-o.groups.partial.length-1},end:n}},e.editor.capabilities.itemDefaults)}function Kse(e,t,n){let i=t.getText({start:{line:0,character:0},end:n}),o=i.lastIndexOf(`@${e}`);return o===-1?!1:gT(i.slice(o))>0}function sWe(e,t){let n=e.getText({start:{line:0,character:0},end:t});return gT(n)>0}var aWe=/@(?<directive>theme)\s+(?:(?<parts>[^{]+)\s$|$)/,oWe=/@(?<directive>import)\s*[^;]+?theme\((?:(?<parts>[^)]+)\s$|$)/;async function lWe(e,t,n){if(!e.v4)return null;let i=t.getText({start:{line:n.line,character:0},end:n}),o=i.match(aWe)??i.match(oWe);if(!o)return null;let r=o.groups.directive,l=new Set((o.groups.parts??"").trim().split(/\s+/).map(u=>u.trim()).filter(u=>u!=="")),s=[{label:"reference",documentation:{kind:"markdown",value:r==="import"?"Don't emit CSS variables for imported theme values.":"Don't emit CSS variables for these theme values."},sortText:"-000000"},{label:"inline",documentation:{kind:"markdown",value:r==="import"?"Inline imported theme values into generated utilities instead of using `var(\u2026)`.":"Inline these theme values into generated utilities instead of using `var(\u2026)`."},sortText:"-000001"},{label:"static",documentation:{kind:"markdown",value:r==="import"?"Always emit imported theme values into the CSS file instead of only when used.":"Always emit these theme values into the CSS file instead of only when used."},sortText:"-000001"},{label:"default",documentation:{kind:"markdown",value:r==="import"?"Allow imported theme values to be overriden by JS configs and plugins.":"Allow these theme values to be overriden by JS configs and plugins."},sortText:"-000003"}];return s=s.filter(u=>!l.has(u.label)),s.length===0?null:ao({isIncomplete:!1,items:s},{data:{...e.completionItemData??{},_type:"filesystem"},range:{start:{line:n.line,character:n.character},end:n}},e.editor.capabilities.itemDefaults)}async function cWe(e,t,n){if(!_o(e,t,n)||!vn(e.version,"3.2.0"))return null;let i=t.getText({start:{line:n.line,character:0},end:n}),o=await qse(e,i);if(!o)return null;let{partial:r,suggest:l}=o;function s(p){return l==="script"?jse.test(p):l==="source"?Use.test(p):!1}let u=r.substring(0,r.lastIndexOf("/")),H=r.substring(r.lastIndexOf("/")+1),a=await e.editor.readDirectory(t,u||".");a=a.filter(([p,d])=>d.isDirectory||s(p));let c=a.map(([p,d])=>({label:d.isDirectory?p+"/":p,kind:d.isDirectory?19:17,command:d.isDirectory?{command:"editor.action.triggerSuggest",title:""}:void 0}));return ao({isIncomplete:!1,items:c},{data:{...e.completionItemData??{},_type:"filesystem"},range:{start:{line:n.line,character:n.character-H.length},end:n}},e.editor.capabilities.itemDefaults)}async function uWe(e,t,n){let i=await e.editor.getConfiguration(t.uri);if(i.tailwindCSS.emmetCompletions!==!0)return null;let o=!_d(e,t)&&W0(e,t,n),r=_d(e,t)||uM(e,t,n),l=o?"html":r?"jsx":null;if(l===null)return null;let s=Lm.extractAbbreviation(t,n,!0);if(!s||!Lm.isAbbreviationValid(l,s.abbreviation)||!Fse(t,s.abbreviationRange))return null;if(r){let a=s.abbreviation;if(a.startsWith("this."))return null;let c=await e.editor.getDocumentSymbols(t.uri);if(c&&c.find(p=>a===p.name||a.startsWith(p.name+".")&&!/>|\*|\+/.test(a)))return null}let u=Lm.doComplete(t,n,l,{});if(!u||!u.items||u.items.length!==1||u.items[0].label==="widows: ;")return null;let H=u.items[0].label.split(".");return H.length<2?null:bT(e,H[H.length-1],{start:{line:n.line,character:n.character-H[H.length-1].length},end:n},i.tailwindCSS.rootFontSize)}async function Gse(e,t,n,i){if(e===null)return{items:[],isIncomplete:!1};let o=await Zqe(e,t,n,i)||await lWe(e,t,n)||await Qqe(e,t,n)||Jqe(e,t,n)||zqe(e,t,n)||iWe(e,t,n)||nWe(e,t,n)||tWe(e,t,n)||eWe(e,t,n)||Yqe(e,t,n)||rWe(e,t,n)||await cWe(e,t,n)||await Vqe(e,t,n,i)||Kqe(e,t,n,i);return o||uWe(e,t,n)}async function Xse(e,t){if(["helper","directive","variant","layer","@tailwind","filesystem"].includes(t.data?._type))return t;if(t.data?._type==="screen"){let r=(0,Jl.default)(e.config,["theme","screens"],(0,Jl.default)(e.config,["screens"],{}));return Ja(r)||(r={}),t.detail=$se(r[t.label]),t}let n=t.data?.className??t.label;t.data?.important&&(n=`!${n}`);let i=t.data?.variants??[];if(e.v4){if(t.kind===9||t.detail&&t.documentation)return t;let r=e.designSystem.compile([n])[0],s=e.designSystem.compile([[...i,n].join(e.separator)])[0].nodes.filter(u=>u.type==="rule");if(s.length===0)return t;if(!t.detail)if(s.length===1){let u=[];r=r.clone(),r.walkAtRules(H=>{H.name==="property"&&H.remove(),H.name==="supports"&&H.params==="(-moz-orient: inline)"&&H.remove()}),r.walkDecls(H=>{u.push(H)}),t.detail=await _$(e,lie({nodes:u}))}else t.detail=`${s.length} rules`;return t.documentation||(t.documentation={kind:"markdown",value:["```css",await lm(e,cie({nodes:s})),"```"].join(`
|
1836
|
+
[Tailwind CSS Documentation](${xa(e.version,"functions-and-directives/#slot")})`},sortText:"-0000000"})),ao({isIncomplete:!1,items:l.map(s=>({...s,kind:14}))},{data:{...e.completionItemData??{},_type:"directive"},range:{start:{line:n.line,character:n.character-o.groups.partial.length-1},end:n}},e.editor.capabilities.itemDefaults)}function Kse(e,t,n){let i=t.getText({start:{line:0,character:0},end:n}),o=i.lastIndexOf(`@${e}`);return o===-1?!1:gT(i.slice(o))>0}function sWe(e,t){let n=e.getText({start:{line:0,character:0},end:t});return gT(n)>0}var aWe=/@(?<directive>theme)\s+(?:(?<parts>[^{]+)\s$|$)/,oWe=/@(?<directive>import)\s*[^;]+?theme\((?:(?<parts>[^)]+)\s$|$)/;async function lWe(e,t,n){if(!e.v4)return null;let i=t.getText({start:{line:n.line,character:0},end:n}),o=i.match(aWe)??i.match(oWe);if(!o)return null;let r=o.groups.directive,l=new Set((o.groups.parts??"").trim().split(/\s+/).map(u=>u.trim()).filter(u=>u!=="")),s=[{label:"reference",documentation:{kind:"markdown",value:r==="import"?"Don't emit CSS variables for imported theme values.":"Don't emit CSS variables for these theme values."},sortText:"-000000"},{label:"inline",documentation:{kind:"markdown",value:r==="import"?"Inline imported theme values into generated utilities instead of using `var(\u2026)`.":"Inline these theme values into generated utilities instead of using `var(\u2026)`."},sortText:"-000001"},{label:"static",documentation:{kind:"markdown",value:r==="import"?"Always emit imported theme values into the CSS file instead of only when used.":"Always emit these theme values into the CSS file instead of only when used."},sortText:"-000001"},{label:"default",documentation:{kind:"markdown",value:r==="import"?"Allow imported theme values to be overriden by JS configs and plugins.":"Allow these theme values to be overriden by JS configs and plugins."},sortText:"-000003"}];return s=s.filter(u=>!l.has(u.label)),s.length===0?null:ao({isIncomplete:!1,items:s},{data:{...e.completionItemData??{},_type:"filesystem"},range:{start:{line:n.line,character:n.character},end:n}},e.editor.capabilities.itemDefaults)}async function cWe(e,t,n){if(!_o(e,t,n)||!vn(e.version,"3.2.0"))return null;let i=t.getText({start:{line:n.line,character:0},end:n}),o=await qse(e,i);if(!o)return null;let{partial:r,suggest:l}=o;function s(p){return l==="script"?jse.test(p):l==="source"?Use.test(p):!1}let u=r.substring(0,r.lastIndexOf("/")),H=r.substring(r.lastIndexOf("/")+1),a=await e.editor.readDirectory(t,u||".");a=a.filter(([p,d])=>d.isDirectory||s(p));let c=a.map(([p,d])=>({label:d.isDirectory?p+"/":p,kind:d.isDirectory?19:17,command:d.isDirectory?{command:"editor.action.triggerSuggest",title:""}:void 0}));return ao({isIncomplete:!1,items:c},{data:{...e.completionItemData??{},_type:"filesystem"},range:{start:{line:n.line,character:n.character-H.length},end:n}},e.editor.capabilities.itemDefaults)}async function uWe(e,t,n){let i=await e.editor.getConfiguration(t.uri);if(i.tailwindCSS.emmetCompletions!==!0)return null;let o=!_d(e,t)&&W0(e,t,n),r=_d(e,t)||uM(e,t,n),l=o?"html":r?"jsx":null;if(l===null)return null;let s=Lm.extractAbbreviation(t,n,!0);if(!s||!Lm.isAbbreviationValid(l,s.abbreviation)||!Fse(t,s.abbreviationRange))return null;if(r){let a=s.abbreviation;if(a.startsWith("this."))return null;let c=await e.editor.getDocumentSymbols(t.uri);if(c&&c.find(p=>a===p.name||a.startsWith(p.name+".")&&!/>|\*|\+/.test(a)))return null}let u=Lm.doComplete(t,n,l,{});if(!u||!u.items||u.items.length!==1||u.items[0].label==="widows: ;")return null;let H=u.items[0].label.split(".");return H.length<2?null:bT(e,H[H.length-1],{start:{line:n.line,character:n.character-H[H.length-1].length},end:n},i.tailwindCSS.rootFontSize)}async function Gse(e,t,n,i){if(e===null)return{items:[],isIncomplete:!1};let o=await Zqe(e,t,n,i)||await lWe(e,t,n)||await Qqe(e,t,n)||Jqe(e,t,n)||zqe(e,t,n)||iWe(e,t,n)||nWe(e,t,n)||tWe(e,t,n)||eWe(e,t,n)||Yqe(e,t,n)||rWe(e,t,n)||await cWe(e,t,n)||await Vqe(e,t,n,i)||Kqe(e,t,n,i);return o||uWe(e,t,n)}async function Xse(e,t){if(["helper","directive","variant","layer","@tailwind","filesystem"].includes(t.data?._type))return t;if(t.data?._type==="screen"){let r=(0,Jl.default)(e.config,["theme","screens"],(0,Jl.default)(e.config,["screens"],{}));return Ja(r)||(r={}),t.detail=$se(r[t.label]),t}let n=t.data?.className??t.label;t.data?.important&&(n=`!${n}`);let i=t.data?.variants??[];if(e.v4){if(t.kind===9||t.detail&&t.documentation)return t;let r=e.designSystem.compile([n])[0],s=e.designSystem.compile([[...i,n].join(e.separator)])[0].nodes.filter(u=>u.type==="rule");if(s.length===0)return t;if(!t.detail)if(s.length===1){let u=[];r=r.clone(),r.walkAtRules(H=>{H.name==="property"&&H.remove(),H.name==="supports"&&H.params==="(-moz-orient: inline)"&&H.remove()}),r.walkDecls(H=>{H.value!=="var(--tw-border-style)"&&H.value!=="var(--tw-outline-style)"&&u.push(H)}),t.detail=await _$(e,lie({nodes:u}))}else t.detail=`${s.length} rules`;return t.documentation||(t.documentation={kind:"markdown",value:["```css",await lm(e,cie({nodes:s})),"```"].join(`
|
1837
1837
|
`)}),t}if(e.jit){if(t.kind===9||t.detail&&t.documentation)return t;let{root:r,rules:l}=Tl(e,[[...i,n].join(e.separator)]);return l.length===0||(t.detail||(l.length===1?t.detail=await _$(e,l[0]):t.detail=`${l.length} rules`),t.documentation||(t.documentation={kind:"markdown",value:["```css",await lm(e,r),"```"].join(`
|
1838
1838
|
`)})),t}let o=(0,Jl.default)(e.classNames.classNames,[...i,n,"__info"]);if(t.kind===9)t.detail=e.classNames.context[n].join(", ");else if(t.detail=await dWe(e,o),!t.documentation){let r=await e.editor.getConfiguration(),l=U0([...i,n].join(":"),o,r);l&&(t.documentation={kind:"markdown",value:["```css",l,"```"].join(`
|
1839
1839
|
`)})}return t}function HWe(e,t){let n=(0,Jl.default)(e.classNames.classNames,t);return!Ja(n)||!e.classNames.context[t[t.length-1]]?!1:Object.keys(n).filter(i=>i!=="__info").length>0?!0:Ja(n.__info)&&!n.__info.__rule}function pWe(e,t){let n=Object.keys(e),i=n.filter(o=>!o.startsWith("--"));return n.length!==i.length&&i.length!==0&&(n=i),n.map(o=>wp(e[o]).map(r=>(t.tailwindCSS.showPixelEquivalents&&(r=zH(r,t.tailwindCSS.rootFontSize)),`${o}: ${r};`)).join(" ")).join(" ")}async function dWe(e,t){if(Array.isArray(t))return`${t.length} rules`;if(t.__rule===!0){let n=await e.editor.getConfiguration();return pWe(yc(t),n)}return null}async function fWe(e,t){if(!e.designSystem)return[];let n=[],i=Kie(e.designSystem);for(let o of i)n.push({name:`${o}-*`,description:`Support theme values from \`${o}-*\``});return n.push({name:"integer",description:"Support integer values, e.g. `{utility}-6`"}),n.push({name:"number",description:"Support numeric values in increments of 0.25, e.g. `{utility}-6` and `{utility}-7.25`"}),n.push({name:"percentage",description:"Support integer percentage values, e.g. `{utility}-50%` and `{utility}-21%`"}),t==="--value"&&n.push({name:"ratio",description:"Support fractions, e.g. `{utility}-1/5` and `{utility}-16/9`"}),n.push({name:"[integer]",description:"Support arbitrary integer values, e.g. `{utility}-[123]`"}),n.push({name:"[number]",description:"Support arbitrary numeric values, e.g. `{utility}-[10]` and `{utility}-[10.234]`"}),n.push({name:"[percentage]",description:"Support arbitrary percentage values, e.g. `{utility}-[10%]` and `{utility}-[10.234%]`"}),n.push({name:"[ratio]",description:"Support arbitrary fractions, e.g. `{utility}-[1/5]` and `{utility}-[16/9]`"}),n.push({name:"[color]",description:"Support arbitrary color values, e.g. `{utility}-[#639]` and `{utility}-[oklch(44.03% 0.1603 303.37)]`"}),n.push({name:"[angle]",description:"Support arbitrary angle, e.g. `{utility}-[12deg]` and `{utility}-[0.21rad]`"}),n.push({name:"[url]",description:"Support arbitrary URL functions, e.g. `{utility}-['url(\u2026)']`"}),n}function hWe(e){if(!e.v4||!e.designSystem)return null;let t=dT(e.designSystem);return t.map((n,i)=>{let o=e.designSystem.resolveThemeValue(n,!0),r,l=Vf(o);return l!==null?(typeof l!="string"&&(l.alpha??1)!==0&&(r=du(l)),{label:n,kind:Da.CompletionItemKind.Color,sortText:mo(i,t.length),detail:o,documentation:r}):{label:n,kind:Da.CompletionItemKind.Variable,sortText:mo(i,t.length),detail:o}})}function Tm(e){return e.reduce((t,n,i)=>i===0?n:e.length>1&&i===e.length-1?`${t} and ${n}`:`${t}, ${n}`,"")}var Zse=mr(Ko());function SM(e,t){let n=Yu(e,t);if(!n)return null;let i=(0,Zse.default)(e.classNames.classNames,[...n,"__info"]);return Array.isArray(i)?i.map(yc):yc(i)}function _We(e){return e.type==="atrule"}function zse(e){let t=e.parent;return t?!!(_We(t)&&t.name==="keyframes"):!1}function Jse(e){let t=[];return e.walkDecls(({prop:n})=>{t.push(n)}),t}async function Qse(e,t,n){let i=n.tailwindCSS.lint.cssConflict;if(i==="ignore")return[];let o=[];return(await md(e,t)).forEach(l=>{let s=nH(l,e.blocklist);if(e.v4){let u=mWe(e,s);for(let[H,a]of EWe(s,u))o.push({code:"cssConflict",className:H,otherClassNames:a,range:H.range,severity:i==="error"?1:2,message:`'${H.className}' applies the same CSS properties as ${Tm(a.map(c=>`'${c.className}'`))}.`,relatedInformation:a.map(c=>({message:c.className,location:{uri:t.uri,range:c.range}}))});return}s.forEach((u,H)=>{if(e.jit){let{rules:m}=Tl(e,[u.className],E=>!zse(E));if(m.length===0)return;let g=m.map(E=>{let A=Jse(E);return{context:m$(e,E,u.className),properties:A}}),_=s.filter((E,A)=>A!==H).filter(E=>{let{rules:A}=Tl(e,[E.className],T=>!zse(T));if(A.length!==m.length)return!1;let S=!1;for(let T=0;T<A.length;T++){let I=A[T],L=Jse(I);if(g[T].properties.length>0&&L.length>0&&(S=!0),!Bl(g[T].properties,L))return!1;let x=m$(e,I,E.className);if(!Bl(g[T].context,x))return!1}return!!S});if(_.length===0)return;o.push({code:"cssConflict",className:u,otherClassNames:_,range:u.range,severity:i==="error"?1:2,message:`'${u.className}' applies the same CSS properties as ${Tm(_.map(E=>`'${E.className}'`))}.`,relatedInformation:_.map(E=>({message:E.className,location:{uri:t.uri,range:E.range}}))});return}let a=SM(e,u.className);if(!a)return;let c=Object.keys(a),p=Kf(e,u.className),h=s.filter((m,g)=>g!==H).filter(m=>{let g=SM(e,m.className);if(!g)return!1;let y=Kf(e,m.className);return Bl(c,Object.keys(g))&&!Array.isArray(p)&&!Array.isArray(y)&&Bl(p.context,y.context)&&Bl(p.pseudo,y.pseudo)&&p.scope===y.scope});h.length!==0&&o.push({code:"cssConflict",className:u,otherClassNames:h,range:u.range,severity:i==="error"?1:2,message:`'${u.className}' applies the same CSS ${c.length===1?"property":"properties"} as ${Tm(h.map(m=>`'${m.className}'`))}.`,relatedInformation:h.map(m=>({message:m.className,location:{uri:t.uri,range:m.range}}))})})}),o}function Yse(e,t,n=[]){for(let i of e)n=[...n,i],t(i,n),"nodes"in i&&i.nodes&&i.nodes.length>0&&Yse(i.nodes,t,n)}function mWe(e,t){let n={},i=e.designSystem.compile(t.map(o=>o.className));for(let[o,r]of i.entries()){let{className:l}=t[o];Yse([r],(s,u)=>{if(s.type!=="rule"&&s.type!=="atrule")return;let H=[];for(let a of s.nodes??[])a.type==="decl"&&H.push(a.prop);H.length!==0&&(n[l]??=[],n[l].push({properties:H,context:u.map(a=>a.type==="rule"?a.selector:a.type==="atrule"?`@${a.name} ${a.params}`:"").filter(Boolean).slice(1)}))})}return n}function*EWe(e,t){for(let n of e){let i=t[n.className]??[],o=[];for(let r of e){if(n===r)continue;let l=t[r.className]??[];if(i.length!==l.length)continue;let s=!1;for(let u=0;u<i.length;u++){let H=i[u],a=l[u];if(H.properties.length!==a.properties.length){s=!1;break}if(H.context.length!==a.context.length){s=!1;break}if(!Bl(H.properties,a.properties)){s=!1;break}if(!Bl(H.context,a.context)){s=!1;break}H.properties.length===0&&a.properties.length===0||(s=!0)}s&&o.push(r)}o.length!==0&&(yield[n,o])}}async function eae(e,t,n){let i=n.tailwindCSS.lint.invalidApply;return i==="ignore"?[]:(await gm(e,t,void 0,"css",!1)).map(l=>{let s=Ed(e,l.className);return s===null||s.isApplyable===!0?null:{code:"invalidApply",severity:i==="error"?1:2,range:l.range,message:s.reason,className:l}}).filter(Boolean)}function tae(e,t,n){let i=n.tailwindCSS.lint.invalidScreen;if(i==="ignore")return[];let o=[],r=[];if(vl(e,t))r.push(void 0);else{let l=fa(e,t);if(!l)return[];r.push(...l.filter(s=>s.type==="css").map(({range:s})=>s))}return r.forEach(l=>{let s=Ps(t,"css",l);va(/(?:\s|^)@screen\s+(?<screen>[^\s{]+)/g,s).forEach(H=>{if(e.screens.includes(H.groups.screen))return null;let a=`The screen '${H.groups.screen}' does not exist in your theme config.`,c=[],p=iH(H.groups.screen,e.screens);p&&(c.push(p),a+=` Did you mean '${p}'?`),o.push({code:"invalidScreen",range:ta({start:Xn(s,H.index+H[0].length-H.groups.screen.length),end:Xn(s,H.index+H[0].length)},l),severity:i==="error"?1:2,message:a,suggestions:c})})}),o}function rae(e,t,n){let i=n.tailwindCSS.lint.invalidVariant;if(i==="ignore")return[];if(vn(e.version,"2.99.0"))return[];let o=[],r=[];if(vl(e,t))r.push(void 0);else{let s=fa(e,t);if(!s)return[];r.push(...s.filter(u=>u.type==="css").map(({range:u})=>u))}let l=e.variants.flatMap(s=>s.values.length?s.values.map(u=>u==="DEFAULT"?s.name:`${s.name}${s.hasDash?"-":""}${u}`):[s.name]);return e.jit&&(l.unshift("responsive"),l=l.filter(s=>!e.screens.includes(s))),r.forEach(s=>{let u=Ps(t,"css",s);va(/(?:\s|^)@variants\s+(?<variants>[^{]+)/g,u).forEach(a=>{let c=a.groups.variants.split(/(\s*,\s*)/),p=a.index+a[0].length-a.groups.variants.length;for(let d=0;d<c.length;d+=2){let h=c[d].trim();if(l.includes(h))continue;let m=`The variant '${h}' does not exist.`,g=[],y=iH(h,l);y&&(g.push(y),m+=` Did you mean '${y}'?`);let _=p+c.slice(0,d).join("").length;o.push({code:"invalidVariant",range:ta({start:Xn(u,_),end:Xn(u,_+h.length)},s),severity:i==="error"?1:2,message:m,suggestions:g})}})}),o}function nae(e,t,n){let i=n.tailwindCSS.lint.invalidTailwindDirective;if(i==="ignore")return[];let o=[],r=[];if(vl(e,t))r.push(void 0);else{let s=fa(e,t);if(!s)return[];r.push(...s.filter(u=>u.type==="css").map(({range:u})=>u))}let l;return ZL(t.languageId,e.editor?.userLanguages)?l=/(?:\s|^)@tailwind\s+(?<value>[^\r\n]+)/g:l=/(?:\s|^)@tailwind\s+(?<value>[^;]+)/g,r.forEach(s=>{let u=Ps(t,"css",s);va(l,u).forEach(a=>{let c=a.groups.value,p=yWe(e,c);if(!p)return;let{message:d,suggestions:h}=p;o.push({code:"invalidTailwindDirective",range:ta({start:Xn(u,a.index+a[0].length-c.length),end:Xn(u,a.index+a[0].length)},s),severity:i==="error"?1:2,message:d,suggestions:h})})}),o}function yWe(e,t){if(e.v4){if(t==="utilities")return null;if(t==="base"||t==="preflight")return{message:`'@tailwind ${t}' is no longer available in v4. Use '@import "tailwindcss/preflight"' instead.`,suggestions:[]};if(t==="components"||t==="screens"||t==="variants")return{message:`'@tailwind ${t}' is no longer available in v4. Use '@tailwind utilities' instead.`,suggestions:["utilities"]};let s=t.split(/\s+/);return s[0]==="utilities"&&s[1]?.startsWith("source(")?null:{message:`'${t}' is not a valid value.`,suggestions:[]}}let n=["utilities","components","screens"];vn(e.version,"1.0.0-beta.1")?n.push("base"):n.push("preflight");let i=e.jit&&vn(e.version,"2.1.99");if(i&&n.push("variants"),n.includes(t))return null;let o=n;i&&(o=o.filter(s=>s!=="screens"));let r=`'${t}' is not a valid value.`,l=[];if(t==="preflight")l.push("base"),r+=" Did you mean 'base'?";else{let s=iH(t,o);s&&(l.push(s),r+=` Did you mean '${s}'?`)}return{message:r,suggestions:l}}async function iae(e,t,n){if(e.v4)return[];if(!e.jit)return[];if(vn(e.version,"2.99.0"))return[];let i=n.tailwindCSS.lint.recommendedVariantOrder;if(i==="ignore")return[];let o=[];return(await md(e,t)).forEach(l=>{nH(l,e.blocklist).forEach(u=>{let{rules:H}=Tl(e,[u.className]);if(H.length===0)return;let a=e.jitContext.variantOrder??e.jitContext.offsets.variantOffsets,{variants:c,offset:p}=X0(e,u.className),d=[...c].sort((h,m)=>om(a.get(m)-a.get(h)));$U(c,d)||o.push({code:"recommendedVariantOrder",suggestions:[[...d,u.className.substr(p)].join(e.separator)],range:u.range,severity:i==="error"?1:2,message:"Variants are not in the recommended order, which may cause unexpected CSS output."})})}),o}function*AT(e,t){if(vl(e,t))yield{document:t,range:void 0,lang:t.languageId,get text(){return Ps(t,"css")}};else{let n=fa(e,t);if(!n)return[];for(let i of n)i.type==="css"&&(yield{document:t,range:i.range,lang:i.lang??t.languageId,get text(){return Ps(t,"css",i.range)}})}}var gWe=/(?:\s|^)@(?<directive>(?:import|reference))\s*(?<path>'[^']*'|"[^"]*")\s*(layer\([^)]+\)\s*)?source\((?<source>'[^']*'?|"[^"]*"?|[a-z]*|\)|;)/dg,bWe=/(?:\s|^)@(?<directive>tailwind)\s+(?<layer>\S+)\s+source\((?<source>'[^']*'?|"[^"]*"?|[a-z]*|\)|;)/dg,AWe=/(?:\s|^)@(?<directive>source)\s*(?<not>not)?\s*(?<source>'[^']*'?|"[^"]*"?|[a-z]*(?:\([^)]+\))?|\)|;)/dg,IWe=/^[A-Z]:/;function sae(e,t,n){let i=n.tailwindCSS.lint.invalidSourceDirective;if(i==="ignore")return[];let o=[];function r(l){o.push({code:"invalidSourceDirective",severity:i==="error"?1:2,...l})}for(let l of AT(e,t)){let s=l.text,u=[...va(gWe,s),...va(bWe,s),...va(AWe,s)];for(let H of u){let a=H.groups.directive,c=H.groups.source?.trim()??"",p=c,d=H.indices.groups.source,h=!1;if((c.startsWith("'")||c.startsWith('"'))&&(c=c.slice(1),h=!0),(c.endsWith("'")||c.endsWith('"'))&&(c=c.slice(0,-1),h=!0),c=c.trim(),c===""||c===")"||c===";"){let m={start:Xn(s,d[0]),end:Xn(s,d[1])};r({message:"The source directive requires a path to a directory.",range:ta(m,l.range)})}else if(a!=="source"&&c!=="none"&&!h){let m={start:Xn(s,d[0]),end:Xn(s,d[1])};r({message:`\`source(${c})\` is invalid. Did you mean \`source(none)\`?`,range:ta(m,l.range)})}else if(c.includes("\\")||IWe.test(c)){c=c.replaceAll("\\\\","\\");let m={start:Xn(s,d[0]),end:Xn(s,d[1])};r({message:`POSIX-style paths are required with \`source(\u2026)\` but \`${c}\` is a Windows-style path.`,range:ta(m,l.range)})}else if(a==="source"&&c==="none"){let m={start:Xn(s,d[0]),end:Xn(s,d[1])};r({message:"`@source none;` is not valid. Did you mean to use `source(none)` on an `@import`?",range:ta(m,l.range)})}else if(!(a==="source"&&c.startsWith("inline("))){if(a==="source"&&c!=="none"&&!h){let m={start:Xn(s,d[0]),end:Xn(s,d[1])};r({message:`\`@source ${p};\` is invalid.`,range:ta(m,l.range)})}}}}return o}async function aae(e,t,n){if(!e.v4)return[];if(!e.blocklist?.length)return[];let i=n.tailwindCSS.lint.usedBlocklistedClass;if(i==="ignore")return[];let o=new Set(e.blocklist??[]),r=[],l=await md(e,t);for(let s of l){let u=nH(s,[]);for(let H of u)o.has(H.className)&&r.push({code:"usedBlocklistedClass",range:H.range,severity:i==="error"?1:2,message:`The class "${H.className}" will not be generated as it has been blocklisted`})}return r}async function IT(e,t,n=["cssConflict","invalidApply","invalidScreen","invalidVariant","invalidConfigPath","invalidTailwindDirective","invalidSourceDirective","recommendedVariantOrder","usedBlocklistedClass"]){let i=await e.editor.getConfiguration(t.uri);return i.tailwindCSS.validate?[...n.includes("cssConflict")?await Qse(e,t,i):[],...n.includes("invalidApply")?await eae(e,t,i):[],...n.includes("invalidScreen")?tae(e,t,i):[],...n.includes("invalidVariant")?rae(e,t,i):[],...n.includes("invalidConfigPath")?Gie(e,t,i):[],...n.includes("invalidTailwindDirective")?nae(e,t,i):[],...n.includes("invalidSourceDirective")?sae(e,t,i):[],...n.includes("recommendedVariantOrder")?await iae(e,t,i):[],...n.includes("usedBlocklistedClass")?await aae(e,t,i):[]]:[]}var lae=mr(kH()),cae=mr(require("node:path"));var oae=mr(wy());function ST(e){return oae.URI.parse(e).fsPath}async function np(e,t,n=ST(t.uri)){let i=await e.editor.getConfiguration(t.uri);n=Ss(n),n=ss(n);for(let o of i.tailwindCSS.files.exclude)if(o=cae.join(e.editor.folder,o),o=Ss(o),o=ss(o),(0,lae.default)(o)(n))return!0;return!1}async function LM(e,t){await np(e,t)?SWe(e,t):e.editor?.connection.sendDiagnostics({uri:t.uri,diagnostics:await IT(e,t)})}function SWe(e,t){e.editor?.connection.sendDiagnostics({uri:t.uri,diagnostics:[]})}var uae=mr(cM());function LT(e,t){let n=wp(t),i=(0,uae.default)(e+`
|
@@ -3580,7 +3580,7 @@ input:where([type='button'], [type='reset'], [type='submit']),
|
|
3580
3580
|
@tailwind ${K};`).join(`
|
3581
3581
|
`),{from:void 0})}catch(K){throw K}finally{Z?.unhook()}E.dependencies=TT(E.configPath),u((E.dependencies??[]).flatMap(K=>Qx(K,t.folder))),E.configId=j0e(E.configPath,E.dependencies),E.plugins=await $Et(P),ee&&(E.classNames=await UY(ee.root)),E.variants=q0e(E);let J=(0,vu.default)(E.config,"theme.screens",(0,vu.default)(E.config,"screens",{}));E.screens=Uu(J)?Object.keys(J):[],E.enabled=!0,s(),r(),(i.initializationOptions?.testMode??!1)&&n.sendNotification("@/tailwindCSS/projectReloaded")}for(let O of t.config.entries){d.add(O.path);for(let j of O.deps)d.add(j.path)}return{projectConfig:t,enabled(){return h},enable(){h=!0},dependencies:()=>d,async reload(){if(!E.v4)return;console.log("---- RELOADING DESIGN SYSTEM ----"),console.log(`---- ${E.configPath} ----`);let O=await Ld(E.configPath),j,k=process.hrtime.bigint();try{j=await pj(A,E.modules.tailwindcss.module,E.configPath,O,E.v4Fallback??!1)}catch(Z){throw console.error(Z),Z}let $=Object.create(E,{designSystem:{value:j}}),U=j.getClassList().map(Z=>[Z[0],{...Z[1],color:vc($,Z[0])}]);E.designSystem=j,E.classList=U,E.variants=q0e(E),E.blocklist=Array.from(j.invalidCandidates??[]);let F=j.dependencies();for(let Z of F)d.add(Z);u(Array.from(F));let P=process.hrtime.bigint()-k;console.log(`---- RELOADED IN ${(Number(P)/1e6).toFixed(2)}ms ----`),(i.initializationOptions?.testMode??!1)&&n.sendNotification("@/tailwindCSS/projectReloaded")},state:E,documentSelector(){return y},tryInit:L,async dispose(){E={enabled:!1,features:[]};for(let O of g)(await O).dispose()},async onUpdateSettings(O){E.enabled&&s(),r(),n.sendNotification("@/tailwindCSS/clearColors")},onFileEvents:T,async onHover(O){return Af(async()=>{if(!E.enabled)return null;let j=o.getDocument(O.textDocument.uri);return!j||!(await E.editor.getConfiguration(j.uri)).tailwindCSS.hovers||await np(E,j)?null:Pse(E,j,O.position)},null)},async onCodeLens(O){return Af(async()=>{if(!E.enabled)return null;let j=o.getDocument(O.textDocument.uri);return!j||!(await E.editor.getConfiguration(j.uri)).tailwindCSS.codeLens||await np(E,j)?null:Rse(E,j)},null)},async onCompletion(O){return Af(async()=>{if(!E.enabled)return null;let j=o.getDocument(O.textDocument.uri);return!j||!(await E.editor.getConfiguration(j.uri)).tailwindCSS.suggestions||await np(E,j)?null:Gse(E,j,O.position,O.context)},null)},onCompletionResolve(O){return Af(()=>E.enabled?Xse(E,O):null,null)},async onCodeAction(O){return Af(async()=>{if(!E.enabled)return null;let j=o.getDocument(O.textDocument.uri);return!j||!(await E.editor.getConfiguration(j.uri)).tailwindCSS.codeActions?null:Iae(E,O,j)},null)},onDocumentLinks(O){if(!E.enabled)return null;let j=o.getDocument(O.textDocument.uri);if(!j)return null;let k=hj.URI.parse(j.uri).fsPath,$=Ra.dirname(k);async function U(F){return F=await A.substituteId(F,$)??F,hj.URI.file(Ra.resolve($,F)).toString()}return Tae(E,j,U)},provideDiagnostics:(0,G0e.debounce)(O=>{E.enabled&&LM(E,O)},i.initializationOptions?.testMode?0:500),provideDiagnosticsForce:O=>{E.enabled&&LM(E,O)},async onDocumentColor(O){return Af(async()=>{if(!E.enabled)return[];let j=o.getDocument(O.textDocument.uri);return j?await np(E,j)?null:Lae(E,j):[]},null)},async onColorPresentation(O){let j=o.getDocument(O.textDocument.uri);if(!j)return[];let k=j.getText(O.range),$=k.match(new RegExp(`-\\[(${F0e.join("|")}|(?:(?:#|rgba?\\(|hsla?\\())[^\\]]+)\\]$`,"i"));if($===null)return[];let U=$[1],F=F0e.includes(U),P={mode:"rgb",r:O.color.red,g:O.color.green,b:O.color.blue,alpha:O.color.alpha},W=m0(P);if(!F&&(U.length===4||U.length===5)){let[,...ee]=W.match(/^#([a-f\d])\1([a-f\d])\2([a-f\d])\3(?:([a-f\d])\4)?$/i)??[];ee.length&&(W=`#${ee.filter(Boolean).join("")}`)}W.length===5?W=W.replace(/f$/,""):W.length===9&&(W=W.replace(/ff$/,""));let Z=k.substr(0,$.index);return[W,nm(P).replace(/ /g,""),u$(P).replace(/ /g,"").replace(/\d+\.\d+(%?)/g,(ee,J)=>`${Math.round(parseFloat(ee))}${J}`)].map(ee=>({label:`${Z}-[${ee}]`}))},sortClassLists(O){return E.jit?O.map(j=>{let k="",$=j.split(/(\s+)/),U=$.filter((W,Z)=>Z%2===0),F=$.filter((W,Z)=>Z%2!==0);U[U.length-1]===""&&U.pop();let P;E.v4?P=E.designSystem.getClassOrder(U):E.jitContext.getClassOrder?P=E.jitContext.getClassOrder(U):P=kEt(E,U),U=P.sort(([,W],[,Z])=>W===Z?0:W===null?-1:Z===null?1:om(W-Z)).map(([W])=>W);for(let W=0;W<U.length;W++)k+=`${U[W]}${F[W]??""}`;return k}):O}}}function U0e(e,t){let n=e.config.prefix;return typeof n=="function"?n(t):n+t}function kEt(e,t){let n=new Set([U0e(e,"group"),U0e(e,"peer")]),i=[];for(let o of t){let r=e.modules.jit.generateRules.module(new Set([o]),e.jitContext).sort(([l],[s])=>om(s-l))[0]?.[0]??null;r===null&&n.has(o)&&(r=e.jitContext.layerOrder.components),i.push([o,r])}return i}function NEt(e,t,n={}){let i=t.config,o=t.modules.postcss.module,r=t.browserslist,l=r&&r.includes("ie 11")?"ie11":"relaxed",s=typeof e=="function"?e:e.handler;try{s({addUtilities:()=>{},addComponents:()=>{},addBase:()=>{},matchUtilities:()=>{},addVariant:()=>{},e:u=>u,prefix:u=>u,theme:(u,H)=>(0,vu.default)(i,`theme.${u}`,H),variants:()=>[],config:(u,H)=>(0,vu.default)(i,u,H),corePlugins:u=>Array.isArray(i.corePlugins)?i.corePlugins.includes(u):(0,vu.default)(i,`corePlugins.${u}`,!0),target:u=>{if(typeof i.target=="string")return i.target==="browserslist"?l:i.target;let[H,a]=(0,vu.default)(i,"target"),c=(0,vu.default)(a,u,H);return c==="browserslist"?l:c},postcss:o,...n})}catch{}}function REt(e){return e.type==="atrule"}function q0e(e){if(e.v4){let r=Array.from(e.designSystem.getVariants()),l=e.designSystem.theme.prefix??"";return l.length>0&&r.unshift({name:l,values:[],isArbitrary:!1,hasDash:!0,selectors:()=>["&"]}),r}if(e.jitContext?.getVariants)return e.jitContext.getVariants();if(e.jit){let r=[];return Array.from(e.jitContext.variantMap).forEach(([l,s])=>{r.push({name:l,values:[],isArbitrary:!1,hasDash:!0,selectors:()=>{function u(g){let y=e.modules.postcssSelectorParser.module.className();return y.value=g,(0,vu.default)(y,"raws.value",y.value)}let H=(Array.isArray(s[0])?s:[s]).map(([g,y])=>y),a="__variant_placeholder__",c=e.modules.postcss.module.root({nodes:[e.modules.postcss.module.rule({selector:`.${u(a)}`,nodes:[]})]}),p=e.modules.postcssSelectorParser.module(g=>g.first.filter(({type:y})=>y==="class").pop().value);function d(g){return p.transformSync(g)}function h(g){return c.each(y=>{y.type==="rule"&&(y.selectors=y.selectors.map(_=>g({get className(){return d(_)},selector:_})))}),c}let m=[];for(let g of H){let y,_=c.clone(),E=uX(()=>g({container:_,separator:e.separator,modifySelectors:h,format:A=>{y=A.replace(/:merge\(([^)]+)\)/g,"$1")},wrap:A=>{REt(A)&&(y=`@${A.name} ${A.params}`)}}));if(y||(y=E),y){m.push(y);continue}_.walkDecls(A=>{A.remove()}),y=_.toString().replace(`.${u(`${l}:${a}`)}`,"&").replace(/(?<!\\)[{}]/g,"").replace(/\s*\n\s*/g," ").trim(),y.includes(a)||m.push(y)}return m}})}),r}let t=e.config,n=e.modules.tailwindcss.version,i=["responsive","hover"];return vn(n,"0.3.0")&&i.push("focus","group-hover"),vn(n,"0.5.0")&&i.push("active"),vn(n,"0.7.0")&&i.push("focus-within"),vn(n,"1.0.0-beta.1")&&i.push("default"),vn(n,"1.1.0")&&i.push("first","last","odd","even","disabled","visited"),vn(n,"1.3.0")&&i.push("group-focus"),vn(n,"1.5.0")&&i.push("focus-visible","checked"),vn(n,"1.6.0")&&i.push("motion-safe","motion-reduce"),vn(n,"2.0.0-alpha.1")&&i.push("dark"),(Array.isArray(t.plugins)?t.plugins:[]).forEach(r=>{NEt(r,e,{addVariant:l=>{i.push(l)}})}),i.map(r=>({name:r,values:[],isArbitrary:!1,hasDash:!0,selectors:()=>[]}))}async function $Et(e){let t=e.plugins;return Array.isArray(t)?Promise.all(t.map(async n=>{let i=n.config;Uu(i)||(i={});let o={theme:Uu(i.theme)?Object.keys(i.theme):[],variants:Uu(i.variants)?Object.keys(i.variants):[]},r=n.handler||n,l=typeof r.name=="string"&&r.name!=="handler"&&r.name!==""?r.name:null;try{r()}catch(s){let u=K0e.default.parse(s);if(u.length===0)return{name:l};let H=u[0].fileName,a=Ra.dirname(H);if(!V0e.default.sync({cwd:a}))return{name:l};let p;try{p=require(p)}catch{return{name:l}}if(p.name&&Ra.resolve(a,p.main||"index.js")===H)return{name:p.name,homepage:p.homepage,contributes:o}}return{name:l}})):[]}var nge=mr(tge());function rge(){return{editor:{tabSize:2},tailwindCSS:{inspectPort:null,emmetCompletions:!1,classAttributes:["class","className","ngClass","class:list"],classFunctions:[],codeActions:!0,codeLens:!0,hovers:!0,suggestions:!0,validate:!0,colorDecorators:!0,rootFontSize:16,lint:{cssConflict:"warning",invalidApply:"error",invalidScreen:"error",invalidVariant:"error",invalidConfigPath:"error",invalidTailwindDirective:"error",invalidSourceDirective:"error",recommendedVariantOrder:"warning",usedBlocklistedClass:"warning"},showPixelEquivalents:!0,includeLanguages:{},files:{exclude:["**/.git/**","**/.hg/**","**/.svn/**","**/node_modules/**","**/.yarn/**","**/.venv/**","**/venv/**","**/.next/**","**/.parcel-cache/**","**/.svelte-kit/**","**/.turbo/**","**/__pycache__/**"]},experimental:{classRegex:[],configFile:null}}}}function ige(e){let t=new Map;async function n(o){let r=t.get(o);return r||(r=await i(o),t.set(o,r)),r}async function i(o){let[r,l]=await Promise.all([e.workspace.getConfiguration({section:"editor",scopeUri:o}),e.workspace.getConfiguration({section:"tailwindCSS",scopeUri:o})]);return r=Uu(r)?r:{},l=Uu(l)?l:{},(0,nge.default)(rge(),{editor:r,tailwindCSS:l},{arrayMerge:(s,u,H)=>u})}return{get:n,clear(){t.clear()}}}var o1t=mr(require("node:fs")),lbe=mr(require("node:path")),RE=mr(EP());var sge=mr(CI()),eD=mr(require("node:path"));var _j=new Map;async function age(e){let t=_j.get(e);if(t!==void 0)return t;let n=await zEt(eD.normalize(e));if(!n)return _j.set(e,null),null;let r=(await import(NH(n).href)).default;return r.setup(),_j.set(e,r),r}async function zEt(e){let t=[".pnp.js",".pnp.cjs"];for(let n of t){let i=eD.join(e,n);if(await sge.default.exists(i))return i}return null}var Ph=mr(require("node:path")),abe=mr(jge());var Dh=mr(require("node:path"),1),Vge=mr(require("node:fs"),1);var tl=mr(require("node:path"),1),Wge=require("node:fs"),Fyt=new RegExp("\\"+tl.default.posix.sep,"g"),jyt=new RegExp("\\"+tl.default.sep,"g"),Nj=new Map,PE="**/*",cD=[".ts",".tsx",".mts",".cts"],Uyt=[".js",".jsx",".mjs",".cjs"],$j=cD.concat(Uyt),qyt=`\\.(?:${cD.map(e=>e.substring(1)).join("|")})`,Wyt=`\\.(?:${$j.map(e=>e.substring(1)).join("|")})`,uD=tl.default.posix.sep===tl.default.sep;function Vb(){let e,t;return{promise:new Promise((i,o)=>{e=i,t=o}),resolve:e,reject:t}}async function Mj(e,t){if(tl.default.extname(e)!==".json")return;let n=tl.default.resolve(e);return t&&(t.hasParseResult(n)||t.hasParseResult(e))?n:Wge.promises.stat(n).then(i=>{if(i.isFile()||i.isFIFO())return n;throw new Error(`${e} exists but is not a regular file.`)})}var Bj=uD?e=>e.includes("/node_modules/"):e=>e.match(/[/\\]node_modules[/\\]/),Rj=uD?e=>e:e=>e.replace(Fyt,tl.default.sep),xh=uD?e=>e:e=>e.replace(jyt,tl.default.posix.sep),wE=uD?(e,t)=>e?tl.default.resolve(e,t):tl.default.resolve(t):(e,t)=>xh(e?tl.default.resolve(Rj(e),Rj(t)):tl.default.resolve(Rj(t)));function Oj(e,t){let n=tl.default.dirname(e.tsconfigFile);return e.tsconfig.references.map(i=>{let o=i.path.endsWith(".json")?i.path:tl.default.join(i.path,t?.configName??"tsconfig.json");return wE(n,o)})}function Fj(e,t){let i=t.tsconfig.compilerOptions?.allowJs?$j:cD;if(t.referenced&&i.some(o=>e.endsWith(o))&&!Uge(e,t)){let o=t.referenced.find(r=>Uge(e,r));if(o)return o}return t}function Uge(e,t){let n=xh(tl.default.dirname(t.tsconfigFile)),i=(t.tsconfig.files||[]).map(s=>wE(n,s)),o=wE(null,e);if(i.includes(e))return!0;let r=t.tsconfig.compilerOptions?.allowJs;return qge(o,n,t.tsconfig.include||(t.tsconfig.files?[]:[PE]),r)?!qge(o,n,t.tsconfig.exclude||[],r):!1}function qge(e,t,n,i){let o=i?$j:cD;return n.some(r=>{let l=r.length,s=!1,u=!1,H=!1,a=-1;for(let h=r.length-1;h>-1;h--){let m=r[h];if(s||(m==="*"||m==="?")&&(l=h,s=!0),H||(m==="."?u=!0:m==="/"&&(a=h,H=!0)),s&&H)break}if(!u&&(!s||l<a)&&(r+=`${r.endsWith("/")?"":"/"}${PE}`,l=r.length-1,s=!0),l<r.length-1&&!e.endsWith(r.slice(l+1))||r.endsWith("*")&&!o.some(h=>e.endsWith(h)))return!1;if(r===PE)return e.startsWith(`${t}/`);let c=wE(t,r),p=-1;for(let h=0;h<c.length;h++)if(c[h]==="*"||c[h]==="?"){p=h,s=!0;break}if(p>1&&!e.startsWith(c.slice(0,p-1)))return!1;if(s){if(p+PE.length===c.length-(r.length-1-l)&&c.slice(p,p+PE.length)===PE)return!0}else return e===c;if(Nj.has(c))return Nj.get(c).test(e);let d=Vyt(c,i);return Nj.set(c,d),d.test(e)})}function Vyt(e,t){let n="^";for(let i=0;i<e.length;i++){let o=e[i];if(o==="?"){n+="[^\\/]";continue}if(o==="*"){if(e[i+1]==="*"&&e[i+2]==="/"){i+=2,n+="(?:[^\\/]*\\/)*";continue}n+="[^\\/]*";continue}"/.+^${}()|[]\\".includes(o)&&(n+="\\"),n+=o}return e.endsWith("*")&&(n+=t?Wyt:qyt),n+="$",new RegExp(n)}function jj(e,t){return JSON.parse(JSON.stringify(e).replaceAll(/"\${configDir}/g,`"${xh(t)}`))}async function Uj(e,t){let n=Dh.default.dirname(Dh.default.resolve(e));if(t?.ignoreNodeModules&&Bj(n))return null;let i=t?.cache,o=t?.configName??"tsconfig.json";if(i?.hasConfigPath(n,o))return i.getConfigPath(n,o);let{promise:r,resolve:l,reject:s}=Vb();return t?.root&&!Dh.default.isAbsolute(t.root)&&(t.root=Dh.default.resolve(t.root)),Kge(n,{promise:r,resolve:l,reject:s},t),r}function Kge(e,{resolve:t,reject:n,promise:i},o){let{cache:r,root:l,configName:s}=o??{};if(r)if(r.hasConfigPath(e,s)){let H;try{H=r.getConfigPath(e,s)}catch(a){n(a);return}H?.then?H.then(t).catch(n):t(H)}else r.setConfigPath(e,i,s);let u=Dh.default.join(e,o?.configName??"tsconfig.json");Vge.default.stat(u,(H,a)=>{if(a&&(a.isFile()||a.isFIFO()))t(u);else if(H?.code!=="ENOENT")n(H);else{let c;l===e||(c=Dh.default.dirname(e))===e?t(null):Kge(c,{promise:i,resolve:t,reject:n},o)}})}var qj=mr(require("node:path"),1),Xge=require("node:fs"),Gge=qj.default.sep;async function Wj(e,t){let n={files:[],calls:0,skip:t?.skip,err:!1,configNames:t?.configNames??["tsconfig.json"]};return new Promise((i,o)=>{Zge(qj.default.resolve(e),n,(r,l)=>r?o(r):i(l))})}function Zge(e,t,n){t.err||(t.calls++,(0,Xge.readdir)(e,{withFileTypes:!0},(i,o=[])=>{if(!t.err)if(i&&!(i.code==="ENOENT"||i.code==="EACCES"||i.code==="EPERM"))t.err=!0,n(i);else{for(let r of o)r.isDirectory()&&!t.skip?.(r.name)?Zge(`${e}${Gge}${r.name}`,t,n):r.isFile()&&t.configNames.includes(r.name)&&t.files.push(`${e}${Gge}${r.name}`);--t.calls===0&&(t.err||n(null,t.files))}}))}function Kj(e){let t=Kyt(Gyt(Xyt(e)));return t.trim()===""?"{}":t}function Kyt(e){let t=!1,n=0,i="",o=null;for(let r=0;r<e.length;r++){let l=e[r];if(l==='"'&&(Jge(e,r)||(t=!t)),t){o=null;continue}if(l===","){o=r;continue}o&&(l==="}"||l==="]"?(i+=e.slice(n,o)+" ",n=o+1,o=null):l.match(/\s/)||(o=null))}return i+e.substring(n)}function Jge(e,t){let n=t-1,i=0;for(;e[n]==="\\";)n-=1,i+=1;return!!(i%2)}function HD(e,t,n){return e.slice(t,n).replace(/\S/g," ")}var Vj=Symbol("singleComment"),zge=Symbol("multiComment");function Gyt(e){let t=!1,n=!1,i=0,o="";for(let r=0;r<e.length;r++){let l=e[r],s=e[r+1];!n&&l==='"'&&(Jge(e,r)||(t=!t)),!t&&(!n&&l+s==="//"?(o+=e.slice(i,r),i=r,n=Vj,r++):n===Vj&&l+s===`\r
|
3582
3582
|
`?(r++,n=!1,o+=HD(e,i,r),i=r):n===Vj&&l===`
|
3583
|
-
`?(n=!1,o+=HD(e,i,r),i=r):!n&&l+s==="/*"?(o+=e.slice(i,r),i=r,n=zge,r++):n===zge&&l+s==="*/"&&(r++,n=!1,o+=HD(e,i,r+1),i=r+1))}return o+(n?HD(e.slice(i)):e.slice(i))}function Xyt(e){return e.charCodeAt(0)===65279?e.slice(1):e}var Wc=mr(require("node:path"),1),tbe=require("node:fs"),rbe=require("module");var Zyt={tsconfigFile:null,tsconfig:{}};async function Xj(e,t){let n=t?.cache;if(n?.hasParseResult(e))return Qge(e,n,t);let{resolve:i,reject:o,promise:r}=Vb();n?.setParseResult(e,r,!0);try{let l=await Mj(e,n)||await Uj(e,t);if(!l)return i(Zyt),r;let s;e!==l&&n?.hasParseResult(l)?s=await Qge(l,n,t):(s=await Zj(l,n,e===l),await Promise.all([zj(s,n),nbe(s,t)])),s.tsconfig=jj(s.tsconfig,Wc.default.dirname(l)),i(Fj(e,s))}catch(l){o(l)}return r}async function Qge(e,t,n){let i=await t.getParseResult(e);if(i.tsconfig.extends&&!i.extended||i.tsconfig.references&&!i.referenced){let o=Promise.all([zj(i,t),nbe(i,n)]).then(()=>i);return t.setParseResult(e,o,!0),o}return i}async function Zj(e,t,n){if(!n&&t?.hasParseResult(e)&&!t.getParseResult(e)._isRootFile_)return t.getParseResult(e);let i=tbe.promises.readFile(e,"utf-8").then(Kj).then(o=>{let r=JSON.parse(o);return e1t(r,e),{tsconfigFile:e,tsconfig:zyt(r,Wc.default.dirname(e))}}).catch(o=>{throw new kE(`parsing ${e} failed: ${o}`,"PARSE_FILE",e,o)});return!n&&(!t?.hasParseResult(e)||!t.getParseResult(e)._isRootFile_)&&t?.setParseResult(e,i),i}function zyt(e,t){let n=e.compilerOptions?.baseUrl;return n&&!n.startsWith("${")&&!Wc.default.isAbsolute(n)&&(e.compilerOptions.baseUrl=wE(t,n)),e}async function nbe(e,t){if(!e.tsconfig.references)return;let n=Oj(e,t),i=await Promise.all(n.map(o=>Zj(o,t?.cache)));await Promise.all(i.map(o=>zj(o,t?.cache))),i.forEach(o=>{o.solution=e}),e.referenced=i}async function zj(e,t){if(!e.tsconfig.extends)return;let n=[{tsconfigFile:e.tsconfigFile,tsconfig:JSON.parse(JSON.stringify(e.tsconfig))}],i=0,o=[],r=0;for(;i<n.length;){let l=n[i];if(o.push(l.tsconfigFile),l.tsconfig.extends){r+=1;let s;Array.isArray(l.tsconfig.extends)?s=l.tsconfig.extends.reverse().map(H=>Yge(H,l.tsconfigFile)):s=[Yge(l.tsconfig.extends,l.tsconfigFile)];let u=s.find(H=>o.includes(H));if(u){let H=o.concat([u]).join(" -> ");throw new kE(`Circular dependency in "extends": ${H}`,"EXTENDS_CIRCULAR",e.tsconfigFile)}n.splice(i+1,0,...await Promise.all(s.map(H=>Zj(H,t))))}else o.splice(-r),r=0;i=i+1}e.extended=n;for(let l of e.extended.slice(1))Qyt(e,l)}function Yge(e,t){e===".."&&(e="../tsconfig.json");let n=(0,rbe.createRequire)(t),i;try{return n.resolve(e)}catch(o){i=o}if(e[0]!=="."&&!Wc.default.isAbsolute(e))try{return n.resolve(`${e}/tsconfig.json`)}catch(o){i=o}throw new kE(`failed to resolve "extends":"${e}" in ${t}`,"EXTENDS_RESOLVE",t,i)}var Jyt=["compilerOptions","files","include","exclude","watchOptions","compileOnSave","typeAcquisition","buildOptions"];function Qyt(e,t){let n=e.tsconfig,i=t.tsconfig,o=xh(Wc.default.relative(Wc.default.dirname(e.tsconfigFile),Wc.default.dirname(t.tsconfigFile)));for(let r of Object.keys(i).filter(l=>Jyt.includes(l)))if(r==="compilerOptions"){n.compilerOptions||(n.compilerOptions={});for(let l of Object.keys(i.compilerOptions))Object.prototype.hasOwnProperty.call(n.compilerOptions,l)||(n.compilerOptions[l]=Gj(l,i.compilerOptions[l],o))}else if(n[r]===void 0)if(r==="watchOptions"){n.watchOptions={};for(let l of Object.keys(i.watchOptions))n.watchOptions[l]=Gj(l,i.watchOptions[l],o)}else n[r]=Gj(r,i[r],o)}var Yyt=["files","include","exclude","baseUrl","rootDir","rootDirs","typeRoots","outDir","outFile","declarationDir","excludeDirectories","excludeFiles"];function Gj(e,t,n){return Yyt.includes(e)?Array.isArray(t)?t.map(i=>ebe(i,n)):ebe(t,n):t}function ebe(e,t){return Wc.default.isAbsolute(e)||e.startsWith("${configDir}")?e:Wc.default.posix.normalize(Wc.default.posix.join(t,e))}var kE=class e extends Error{code;cause;tsconfigFile;constructor(t,n,i,o){super(t),Object.setPrototypeOf(this,e.prototype),this.name=e.name,this.code=n,this.cause=o,this.tsconfigFile=i}};function e1t(e,t){r1t(t)&&(e.compilerOptions={...t1t,...e.compilerOptions})}var t1t={allowJs:!0,maxNodeModuleJsDepth:2,allowSyntheticDefaultImports:!0,skipLibCheck:!0,noEmit:!0};function r1t(e){return Wc.default.basename(e)==="jsconfig.json"}var Kb=class{clear(){this.#t.clear(),this.#e.clear()}hasConfigPath(t,n="tsconfig.json"){return this.#t.has(`${t}/${n}`)}getConfigPath(t,n="tsconfig.json"){let i=`${t}/${n}`,o=this.#t.get(i);if(o==null||o.length||o.then)return o;throw o}hasParseResult(t){return this.#e.has(t)}getParseResult(t){let n=this.#e.get(t);if(n.then||n.tsconfig)return n;throw n}setParseResult(t,n,i=!1){Object.defineProperty(n,"_isRootFile_",{value:i,writable:!1,enumerable:!1,configurable:!1}),this.#e.set(t,n),n.then(o=>{this.#e.get(t)===n&&this.#e.set(t,o)}).catch(o=>{this.#e.get(t)===n&&this.#e.set(t,o)})}setConfigPath(t,n,i="tsconfig.json"){let o=`${t}/${i}`;this.#t.set(o,n),n.then(r=>{this.#t.get(o)===n&&this.#t.set(o,r)}).catch(r=>{this.#t.get(o)===n&&this.#t.set(o,r)})}#t=new Map;#e=new Map};var NE=class extends Map{constructor(n){super();this.factory=n}get(n){let i=super.get(n);return i===void 0&&(i=this.factory(n,this),this.set(n,i)),i}};async function obe(e){let{configs:t,errors:n}=await ibe(e),i=await sbe(t);async function o(u,H){for(let a of Jj(H))for(let{match:c}of i.get(a))try{return await c(u)}catch{return null}return null}async function r(u,H){for(let a of Jj(H))for(let{match:c}of i.get(a))try{return await c(u,{mustExist:!1})}catch{return null}return null}async function l(u){for(let H of Jj(u))for(let{paths:a}of i.get(H))if(Object.keys(a).length)return a;return{}}async function s(){let{configs:u,errors:H}=await ibe(e);if(i=await sbe(u),H.length)throw new AggregateError(H)}return{resolveId:o,substituteId:r,paths:l,refresh:s,errors:n}}async function ibe(e){let t=await Wj(e,{configNames:["tsconfig.json","jsconfig.json"],skip(r){return r==="node_modules"||r===".git"}}),n={root:e,cache:new Kb},i=new Set,o=[];for(let r of t)try{let l=await Xj(r,n);i.add(l)}catch(l){o.push(l)}for(let r of i)if(r.referenced){for(let l of r.referenced)i.add(l);i.delete(r),i.add(r),r.referenced=void 0}for(let r of o)console.error(r);return{configs:i,errors:o}}async function sbe(e){let t=new NE(()=>[]),n=(i,o)=>o(void 0,!0);for(let i of e){let H=function(a,{mustExist:c=!0}={}){u??=abe.createMatchPathAsync(s,r.paths??{},void 0,l!==void 0);let p=c===!1?a.endsWith("/"):!1;return p&&(a+="__placeholder__"),new Promise((d,h)=>{u(a,void 0,c===!1?n:void 0,void 0,(m,g)=>m?h(m):(p&&(g=g.replace(/__placeholder__$/,"")),d(g)))})},o=ss(Ss(Ph.dirname(i.tsconfigFile))),r=i.tsconfig.compilerOptions??{},l=a1t(i),s=Ph.resolve(o,l||""),u;t.get(o).push({match:H,paths:r.paths??{}})}return t}function*Jj(e){let t=ss(Ss(e)),n;for(;t!==n;)yield t,n=t,t=Ph.dirname(t);return null}function a1t(e){let t=e.tsconfig.compilerOptions?.baseUrl;if(t)return t;for(let n of e.extended??[])if((n.tsconfig.compilerOptions??{})?.paths)return Ph.dirname(n.tsconfigFile);return Ph.dirname(e.tsconfigFile)}async function Qj(e){let t=null;typeof e.pnp=="object"?t=e.pnp:e.pnp&&(t=await age(e.root));let n=e.fileSystem?e.fileSystem:new RE.CachedInputFileSystem(o1t,4e3),i=null;if(typeof e.tsconfig=="object")i=e.tsconfig;else if(e.tsconfig)try{i=await obe(e.root)}catch(m){console.error("Failed to load tsconfig",m)}let o=RE.ResolverFactory.createResolver({fileSystem:n,extensions:[".mjs",".js",".node",".mts",".ts"],mainFields:["module"],conditionNames:["node","import"],pnpApi:t}),r=RE.ResolverFactory.createResolver({fileSystem:n,extensions:[".cjs",".js",".json",".node",".cts",".ts"],mainFields:["main"],conditionNames:["node","require"],pnpApi:t}),l=RE.ResolverFactory.createResolver({fileSystem:n,extensions:[".css"],mainFields:["style"],conditionNames:["style"],pnpApi:t,preferRelative:!0});async function s(m,g,y){if(lbe.sep==="\\"){if(g.startsWith("\\\\")||g.startsWith("//"))return g;y.startsWith("//")&&(y=`\\\\${y.slice(2)}`)}if(i){let E=await i.resolveId(g,y);E&&(g=E)}g=wk(g),y=wk(y);let _=await new Promise((E,A)=>{m.resolve({},y,g,{},(S,T)=>{S?A(S):E(T)})});return _?(_=_.replace(/\0(.)/g,"$1"),_):!1}async function u(m,g){try{return await s(o,m,g)||m}catch{return await s(r,m,g)||m}}async function H(m,g){return await s(r,m,g)||m}async function a(m,g){return await s(l,m,g)||m}async function c(m,g){return await i?.substituteId(m,g)??m}async function p(m){return i?await i.paths(m):{}}async function d(){await i?.refresh()}async function h(){return!!t}return{resolveJsId:u,resolveCjsId:H,resolveCssId:a,substituteId:c,refresh:d,hasPnP:h,aliases:p,child(m){return Qj({...e,...m,pnp:m.pnp??t,tsconfig:m.tsconfig??i,fileSystem:m.fileSystem??n})}}}var cbe=mr(kH());function ube(){let e=new NE(t=>(t=t.replace(/[\[\]{}()]/g,n=>`\\${n}`),(0,cbe.default)(t,{dot:!0})));return{anyMatches:(t,n)=>{let i=e.get(t);return n.some(o=>i(o))},clear:()=>e.clear()}}var aAe=['"',"'","`"," ",".","(","[","]","!","/","-"];async function oAe(e){let t=await Ld(e);if(!t)return null;let n=t.match(/@config\s*(?<config>'[^']+'|"[^"]+")/);return n?ss((0,FE.default)(Vc.resolve(Vc.dirname(e),n.groups.config.slice(1,-1)))):null}var LD=class{constructor(t){this.connection=t;this.lspHandlersAdded=!1;this.disposables=[];this.watchPatterns=()=>{};this.watched=[];this.documentService=new II(this.connection),this.projects=new Map,this.projectCounter=0,this.settingsCache=ige(t),this.pathMatcher=ube()}async init(){this.initPromise||(this.initPromise=this._init()),await this.initPromise}getWorkspaceFolders(){return this.initializeParams.workspaceFolders?.length?this.initializeParams.workspaceFolders.map(t=>({uri:Cp.URI.parse(t.uri).fsPath,name:t.name})):this.initializeParams.rootUri?[{uri:Cp.URI.parse(this.initializeParams.rootUri).fsPath,name:"Root"}]:this.initializeParams.rootPath?[{uri:Cp.URI.file(this.initializeParams.rootPath).fsPath,name:"Root"}]:[]}async _init(){$y(),this.pathMatcher.clear();let t=this.getWorkspaceFolders().map(i=>(0,FE.default)(i.uri));if(t.length===0){console.error("No workspace folders found, not initializing.");return}let n=await Promise.allSettled(t.map(i=>this._initFolder(Cp.URI.file(i))));for(let[i,o]of n.entries())o.status==="rejected"&&console.error("Failed to initialize workspace folder",t[i],o.reason);n.some(i=>i.status==="fulfilled")&&await this.updateCommonCapabilities(),await this.listenForEvents()}async _initFolder(t){let n=t.fsPath;try{await lAe.access(n,PU.constants.F_OK|PU.constants.R_OK)}catch(S){console.error(`Unable to access the workspace folder [${n}]. This may happen if the directory does not exist or the current user does not have the necessary permissions to access it.`),console.error(S);return}let i=this.initializeParams.initializationOptions?.userLanguages??{};Object.keys(i).length>0&&console.warn("Language mappings are currently set via initialization options (`userLanguages`). This is deprecated and will be removed in a future release. Please use the `tailwindCSS.includeLanguages` setting instead.");let o=[],r=await this.settingsCache.get(),l=r.tailwindCSS.files.exclude,s=await this.settingsCache.get(t.toString()),u={...i,...s.tailwindCSS.includeLanguages??{}},H=new Map,a=new Map,c=this.initializeParams.initializationOptions?.workspaceFile?Vc.dirname(this.initializeParams.initializationOptions.workspaceFile):n;function p(S){function T(x){return ss((0,FE.default)(Vc.resolve(c,x)))}let I=S.experimental.configFile,L={};if(typeof I=="string"){let x=T(I),C=[T(Vc.resolve(n,"**"))];L[x]=C}else if(Uu(I))for(let[x,C]of Object.entries(I)){if(typeof x!="string")return null;x=T(x);let D;if(typeof C=="string")D=[T(C)];else if(Array.isArray(C))D=C.map(T);else return null;L[x]=D}else if(I)return null;return Object.entries(L)}let d=p(r.tailwindCSS);if(d===null){console.error("Invalid `experimental.configFile` configuration, not initializing.");return}let h=await Qj({root:n,pnp:!0,tsconfig:!0}),m=new Kx(n,r,h);d.length>0?(console.log("Loading Tailwind CSS projects from the workspace settings."),o=await m.loadAllFromWorkspace(d)):(console.log("Searching for Tailwind CSS projects in the workspace's folders."),o=await m.search());for(let S of o)if(a.set(S.config.path,S.tailwind.version),S.config.source==="css")for(let T of S.config.entries)T.type==="css"&&H.set(T.path,S.config.path);let g=o.map(S=>({folder:S.folder,config:S.config.path,selectors:S.documentSelector,user:S.isUserConfigured,tailwind:S.tailwind}));console.log(`[Global] Creating projects: ${JSON.stringify(g)}`);let y=async S=>{let T=!1,I=!1,L=(0,OE.default)(`**/${__}`,{dot:!0}),x=(0,OE.default)(`**/${qp}`,{dot:!0}),C=(0,OE.default)(`**/${h_}`,{dot:!0}),D=(0,OE.default)(`**/${EI}`,{dot:!0});e:for(let O of S){let j=(0,FE.default)(O.file);j=ss(j);for(let P of l)if((0,OE.default)(P,{dot:!0})(j))continue e;if(L(j))for(let[,P]of this.projects){let W=og().version;try{let Z=require(await h.resolveCjsId("tailwindcss/package.json",Vc.dirname(P.projectConfig.configPath))).version;typeof Z=="string"&&(W=Z)}catch{}if(a.get(P.projectConfig.configPath)!==W){T=!0;break e}}if(D(j)){T=!0;break e}for(let[,P]of this.projects)if(P.state.v4&&!(O.type===Gi.FileChangeType.Deleted&&If(j,[P.projectConfig.configPath]))&&If(j,P.dependencies())){I=!0;break e}if(x(`**/${qp}`)&&O.type!==Gi.FileChangeType.Deleted){let P=await oAe(j)||await oAe(O.file);if(H.has(j)&&H.get(j)!==P){T=!0;break}else if(!H.has(j)&&P){T=!0;break}else{if(this.projects.size>0)continue;let W=await Ld(O.file);if(!W)continue;let Z=zT(W);if(!Z.root||!Z.versions.includes("4"))continue;T=!0;break}}if(C(j)&&O.type===Gi.FileChangeType.Created){T=!0;break}for(let[,P]of this.projects)if(O.type===Gi.FileChangeType.Deleted&&If(j,[P.projectConfig.configPath])){T=!0;break e}}if(T){this.restart();return}if(I){try{await this.softRestart()}catch{this.restart()}return}for(let[,O]of this.projects)O.onFileEvents(S)};if(this.initializeParams.capabilities.workspace?.didChangeWatchedFiles?.dynamicRegistration){this.disposables.push(this.connection.onDidChangeWatchedFiles(async({changes:T})=>{let I=T.map(({uri:L,type:x})=>({file:Cp.URI.parse(L).fsPath,type:x})).filter((L,x,C)=>C.findIndex(D=>D.file===L.file&&D.type===L.type)===x);await y(I)}));let S=await this.connection.client.register(Gi.DidChangeWatchedFilesNotification.type,{watchers:[{globPattern:`**/${h_}`},{globPattern:`**/${__}`},{globPattern:`**/${qp}`},{globPattern:`**/${EI}`}]});this.disposables.push(S),this.watchPatterns=T=>{let I=this.filterNewWatchPatterns(T);I.length&&(console.log(`[Global] Adding watch patterns: ${I.join(", ")}`),this.connection.client.register(Gi.DidChangeWatchedFilesNotification.type,{watchers:I.map(L=>({globPattern:L}))}).then(L=>{this.disposables.push(L)}))}}else if(TD.getBinding()){console.log("[Global] Your LSP client does not support watching files on behalf of the server"),console.log("[Global] Using bundled file watcher: @parcel/watcher");let S={create:Gi.FileChangeType.Created,update:Gi.FileChangeType.Changed,delete:Gi.FileChangeType.Deleted},T=await TD.subscribe(n,(I,L)=>{y(L.map(x=>({file:x.path,type:S[x.type]})))},{ignore:l.map(I=>Vc.resolve(n,I.replace(/^[*/]+/,"").replace(/[*/]+$/,"")))});this.disposables.push({dispose(){T.unsubscribe()}})}else{console.log("[Global] Your LSP client does not support watching files on behalf of the server"),console.log("[Global] Using bundled file watcher: chokidar");let S=sAe().watch,T=S([`**/${h_}`,`**/${__}`,`**/${qp}`,`**/${EI}`],{cwd:n,ignorePermissionErrors:!0,ignoreInitial:!0,ignored:l,awaitWriteFinish:{stabilityThreshold:100,pollInterval:20}});await new Promise(I=>{T.on("ready",()=>I())}),T.on("add",I=>y([{file:Vc.resolve(n,I),type:Gi.FileChangeType.Created}])).on("change",I=>y([{file:Vc.resolve(n,I),type:Gi.FileChangeType.Changed}])).on("unlink",I=>y([{file:Vc.resolve(n,I),type:Gi.FileChangeType.Deleted}])),this.disposables.push({dispose(){T.close()}}),this.watchPatterns=I=>{let L=this.filterNewWatchPatterns(I);L.length&&(console.log(`[Global] Adding watch patterns: ${L.join(", ")}`),T.add(L))}}console.log("[Global] Preparing projects..."),await Promise.all(o.map(S=>this.addProject(S,this.initializeParams,this.watchPatterns,a.get(S.configPath),u,h,t))),console.log("[Global] Initializing projects...");let _=[],E=0;for(let S of this.documentService.getAllDocuments()){let T=this.getProject(S);T&&!T.enabled()&&(T.enable(),await T.tryInit(),E++),_.push(S.uri)}console.log(`[Global] Initialized ${E} projects`),this.disposables.push(this.connection.onDidChangeConfiguration(async({settings:S})=>{let T=r.tailwindCSS.files.exclude;if(this.settingsCache.clear(),r=await this.settingsCache.get(),!Bl(T,r.tailwindCSS.files.exclude)){this.restart();return}for(let[,I]of this.projects)I.onUpdateSettings(S)})),(this.initializeParams.initializationOptions?.testMode??!1)&&(console.log("[Global][Test] Sending document notifications..."),await Promise.all(_.map(S=>this.connection.sendNotification("@/tailwindCSS/documentReady",{uri:S}))))}async listenForEvents(){let t=this.initializeParams.initializationOptions?.testMode??!1;this.disposables.push(this.connection.onShutdown(()=>{this.dispose()})),this.disposables.push(this.documentService.onDidChangeContent(n=>{this.getProject(n.document)?.provideDiagnostics(n.document)})),this.disposables.push(this.documentService.onDidOpen(async n=>{let i=this.getProject(n.document);i&&(i.enabled()||(i.enable(),await i.tryInit()),t&&await this.connection.sendNotification("@/tailwindCSS/documentReady",{uri:n.document.uri}))})),this.initializeParams.capabilities.workspace.workspaceFolders&&this.disposables.push(this.connection.workspace.onDidChangeWorkspaceFolders(async n=>{let i=n.added.map(o=>({uri:Cp.URI.parse(o.uri).fsPath,name:o.name})).map(o=>(0,FE.default)(o.uri));await Promise.allSettled(i.map(o=>this._initFolder(Cp.URI.file(o))))})),t&&await this.connection.sendNotification("@/tailwindCSS/serverReady")}filterNewWatchPatterns(t){return t=Array.from(new Set(t)),t=t.filter(n=>!this.watched.includes(n)),this.watched.push(...t),t}async addProject(t,n,i,o,r,l,s){let u=String(this.projectCounter++),H=await J0e(u,t,this.connection,n,this.documentService,()=>this.updateProjectCapabilities(),()=>{for(let a of this.documentService.getAllDocuments()){let c=this.getProject(a);if(c&&!c.enabled()){c.enable(),c.tryInit();break}}},()=>this.refreshDiagnostics(),a=>i(a),o,this.settingsCache.get,r,l);this.projects.set(u,H),this.supportsTailwindProjectDetails&&this.connection.sendNotification("@/tailwindCSS/projectDetails",{uri:s.toString(),config:t.configPath,tailwind:t.tailwind})}get supportsTailwindProjectDetails(){return this.initializeParams.capabilities.experimental?.tailwind?.projectDetails??!1}refreshDiagnostics(){for(let t of this.documentService.getAllDocuments()){let n=this.getProject(t);n?n.provideDiagnosticsForce(t):this.connection.sendDiagnostics({uri:t.uri,diagnostics:[]})}}setupLSPHandlers(){this.lspHandlersAdded||(this.lspHandlersAdded=!0,this.connection.onHover(this.onHover.bind(this)),this.connection.onCompletion(this.onCompletion.bind(this)),this.connection.onCompletionResolve(this.onCompletionResolve.bind(this)),this.connection.onDocumentColor(this.onDocumentColor.bind(this)),this.connection.onColorPresentation(this.onColorPresentation.bind(this)),this.connection.onCodeAction(this.onCodeAction.bind(this)),this.connection.onCodeLens(this.onCodeLens.bind(this)),this.connection.onDocumentLinks(this.onDocumentLinks.bind(this)),this.connection.onRequest(this.onRequest.bind(this)))}onRequest(t,n){if(t==="@/tailwindCSS/sortSelection"){let i=this.getProject({uri:n.uri});if(!i)return{error:"no-project"};try{return{classLists:i.sortClassLists(n.classLists)}}catch{return{error:"unknown"}}}if(t==="@/tailwindCSS/getProject"){let i=this.getProject({uri:n.uri});return!i||!i.enabled()||!i.state?.enabled?null:{version:i.state.version}}}async updateCommonCapabilities(){let t=Gi.BulkRegistration.create(),n=this.initializeParams.capabilities;n.textDocument?.hover?.dynamicRegistration&&t.add(Gi.HoverRequest.type,{documentSelector:null}),n.textDocument?.colorProvider?.dynamicRegistration&&t.add(Gi.DocumentColorRequest.type,{documentSelector:null}),n.textDocument?.codeAction?.dynamicRegistration&&t.add(Gi.CodeActionRequest.type,{documentSelector:null}),n.textDocument?.codeLens?.dynamicRegistration&&t.add(Gi.CodeLensRequest.type,{documentSelector:null}),n.textDocument?.documentLink?.dynamicRegistration&&t.add(Gi.DocumentLinkRequest.type,{documentSelector:null}),n.workspace?.didChangeConfiguration?.dynamicRegistration&&t.add(Gi.DidChangeConfigurationNotification.type,void 0),this.commonRegistrations?.dispose(),this.commonRegistrations=await this.connection.client.register(t)}updateProjectCapabilities(){this.updateTriggerCharacters()}async updateTriggerCharacters(){if(!this.initializeParams.capabilities.textDocument?.completion?.dynamicRegistration)return;let n=new Set(aAe);for(let o of this.projects.values()){let r=o.state.separator;typeof r=="string"&&(r=r.slice(-1),r&&n.add(r))}if(this.completionRegistration&&Bl(Array.from(n),Array.from(this.lastTriggerCharacters??[])))return;this.lastTriggerCharacters=n;let i=this.completionRegistration;this.completionRegistration=this.connection.client.register(Gi.CompletionRequest.type,{documentSelector:null,resolveProvider:!0,triggerCharacters:Array.from(n)}),await i?.then(o=>o.dispose()),await this.completionRegistration}getProject(t){let n,i,o=1/0,r=Cp.URI.parse(t.uri),l=r.fsPath,s=r.path;l=ss(l);for(let H of this.projects.values()){if(!H.projectConfig.configPath){n=n??H;continue}for(let a of H.documentSelector()){if(a.pattern.startsWith("!")&&this.pathMatcher.anyMatches(a.pattern.slice(1),[l,s]))break;if(a.priority<o&&this.pathMatcher.anyMatches(a.pattern,[l,s])){i=H,o=a.priority;continue}}}let u=i??n;return u||console.debug("[GLOBAL] No matching project for document",{fsPath:l,normalPath:s}),u}async onDocumentColor(t){return await this.init(),this.getProject(t.textDocument)?.onDocumentColor(t)??[]}async onColorPresentation(t){return await this.init(),this.getProject(t.textDocument)?.onColorPresentation(t)??[]}async onHover(t){return await this.init(),this.getProject(t.textDocument)?.onHover(t)??null}async onCompletion(t){return await this.init(),this.getProject(t.textDocument)?.onCompletion(t)??null}async onCompletionResolve(t){return await this.init(),this.projects.get(t.data?._projectKey)?.onCompletionResolve(t)??null}async onCodeAction(t){return await this.init(),this.getProject(t.textDocument)?.onCodeAction(t)??null}async onCodeLens(t){return await this.init(),this.getProject(t.textDocument)?.onCodeLens(t)??null}async onDocumentLinks(t){return await this.init(),this.getProject(t.textDocument)?.onDocumentLinks(t)??null}setup(){this.connection.onInitialize(async t=>(this.initializeParams=t,this.setupLSPHandlers(),{capabilities:this.computeServerCapabilities(t.capabilities)})),this.connection.onInitialized(()=>this.init())}computeServerCapabilities(t){let n={textDocumentSync:Gi.TextDocumentSyncKind.Full,workspace:{workspaceFolders:{changeNotifications:!0}}};return t.textDocument?.hover?.dynamicRegistration||(n.hoverProvider=!0),t.textDocument?.colorProvider?.dynamicRegistration||(n.colorProvider=!0),t.textDocument?.codeAction?.dynamicRegistration||(n.codeActionProvider=!0),t.textDocument?.codeLens?.dynamicRegistration||(n.codeLensProvider={resolveProvider:!1}),t.textDocument?.completion?.dynamicRegistration||(n.completionProvider={resolveProvider:!0,triggerCharacters:[...aAe,":"]}),t.textDocument?.documentLink?.dynamicRegistration||(n.documentLinkProvider={}),n}listen(){this.connection.listen()}dispose(){this.connection.sendNotification("@/tailwindCSS/projectsDestroyed");for(let[,t]of this.projects)t.dispose();this.projects=new Map,this.refreshDiagnostics(),this.commonRegistrations?.dispose(),this.commonRegistrations=void 0,this.lastTriggerCharacters.clear(),this.completionRegistration?.then(t=>t.dispose()),this.completionRegistration=void 0,this.disposables.forEach(t=>t.dispose()),this.disposables.length=0,this.watched.length=0}async restart(){let t=this.initializeParams.initializationOptions?.testMode??!1;console.log(`----------
|
3583
|
+
`?(n=!1,o+=HD(e,i,r),i=r):!n&&l+s==="/*"?(o+=e.slice(i,r),i=r,n=zge,r++):n===zge&&l+s==="*/"&&(r++,n=!1,o+=HD(e,i,r+1),i=r+1))}return o+(n?HD(e.slice(i)):e.slice(i))}function Xyt(e){return e.charCodeAt(0)===65279?e.slice(1):e}var Wc=mr(require("node:path"),1),tbe=require("node:fs"),rbe=require("module");var Zyt={tsconfigFile:null,tsconfig:{}};async function Xj(e,t){let n=t?.cache;if(n?.hasParseResult(e))return Qge(e,n,t);let{resolve:i,reject:o,promise:r}=Vb();n?.setParseResult(e,r,!0);try{let l=await Mj(e,n)||await Uj(e,t);if(!l)return i(Zyt),r;let s;e!==l&&n?.hasParseResult(l)?s=await Qge(l,n,t):(s=await Zj(l,n,e===l),await Promise.all([zj(s,n),nbe(s,t)])),s.tsconfig=jj(s.tsconfig,Wc.default.dirname(l)),i(Fj(e,s))}catch(l){o(l)}return r}async function Qge(e,t,n){let i=await t.getParseResult(e);if(i.tsconfig.extends&&!i.extended||i.tsconfig.references&&!i.referenced){let o=Promise.all([zj(i,t),nbe(i,n)]).then(()=>i);return t.setParseResult(e,o,!0),o}return i}async function Zj(e,t,n){if(!n&&t?.hasParseResult(e)&&!t.getParseResult(e)._isRootFile_)return t.getParseResult(e);let i=tbe.promises.readFile(e,"utf-8").then(Kj).then(o=>{let r=JSON.parse(o);return e1t(r,e),{tsconfigFile:e,tsconfig:zyt(r,Wc.default.dirname(e))}}).catch(o=>{throw new kE(`parsing ${e} failed: ${o}`,"PARSE_FILE",e,o)});return!n&&(!t?.hasParseResult(e)||!t.getParseResult(e)._isRootFile_)&&t?.setParseResult(e,i),i}function zyt(e,t){let n=e.compilerOptions?.baseUrl;return n&&!n.startsWith("${")&&!Wc.default.isAbsolute(n)&&(e.compilerOptions.baseUrl=wE(t,n)),e}async function nbe(e,t){if(!e.tsconfig.references)return;let n=Oj(e,t),i=await Promise.all(n.map(o=>Zj(o,t?.cache)));await Promise.all(i.map(o=>zj(o,t?.cache))),i.forEach(o=>{o.solution=e}),e.referenced=i}async function zj(e,t){if(!e.tsconfig.extends)return;let n=[{tsconfigFile:e.tsconfigFile,tsconfig:JSON.parse(JSON.stringify(e.tsconfig))}],i=0,o=[],r=0;for(;i<n.length;){let l=n[i];if(o.push(l.tsconfigFile),l.tsconfig.extends){r+=1;let s;Array.isArray(l.tsconfig.extends)?s=l.tsconfig.extends.reverse().map(H=>Yge(H,l.tsconfigFile)):s=[Yge(l.tsconfig.extends,l.tsconfigFile)];let u=s.find(H=>o.includes(H));if(u){let H=o.concat([u]).join(" -> ");throw new kE(`Circular dependency in "extends": ${H}`,"EXTENDS_CIRCULAR",e.tsconfigFile)}n.splice(i+1,0,...await Promise.all(s.map(H=>Zj(H,t))))}else o.splice(-r),r=0;i=i+1}e.extended=n;for(let l of e.extended.slice(1))Qyt(e,l)}function Yge(e,t){e===".."&&(e="../tsconfig.json");let n=(0,rbe.createRequire)(t),i;try{return n.resolve(e)}catch(o){i=o}if(e[0]!=="."&&!Wc.default.isAbsolute(e))try{return n.resolve(`${e}/tsconfig.json`)}catch(o){i=o}throw new kE(`failed to resolve "extends":"${e}" in ${t}`,"EXTENDS_RESOLVE",t,i)}var Jyt=["compilerOptions","files","include","exclude","watchOptions","compileOnSave","typeAcquisition","buildOptions"];function Qyt(e,t){let n=e.tsconfig,i=t.tsconfig,o=xh(Wc.default.relative(Wc.default.dirname(e.tsconfigFile),Wc.default.dirname(t.tsconfigFile)));for(let r of Object.keys(i).filter(l=>Jyt.includes(l)))if(r==="compilerOptions"){n.compilerOptions||(n.compilerOptions={});for(let l of Object.keys(i.compilerOptions))Object.prototype.hasOwnProperty.call(n.compilerOptions,l)||(n.compilerOptions[l]=Gj(l,i.compilerOptions[l],o))}else if(n[r]===void 0)if(r==="watchOptions"){n.watchOptions={};for(let l of Object.keys(i.watchOptions))n.watchOptions[l]=Gj(l,i.watchOptions[l],o)}else n[r]=Gj(r,i[r],o)}var Yyt=["files","include","exclude","baseUrl","rootDir","rootDirs","typeRoots","outDir","outFile","declarationDir","excludeDirectories","excludeFiles"];function Gj(e,t,n){return Yyt.includes(e)?Array.isArray(t)?t.map(i=>ebe(i,n)):ebe(t,n):t}function ebe(e,t){return Wc.default.isAbsolute(e)||e.startsWith("${configDir}")?e:Wc.default.posix.normalize(Wc.default.posix.join(t,e))}var kE=class e extends Error{code;cause;tsconfigFile;constructor(t,n,i,o){super(t),Object.setPrototypeOf(this,e.prototype),this.name=e.name,this.code=n,this.cause=o,this.tsconfigFile=i}};function e1t(e,t){r1t(t)&&(e.compilerOptions={...t1t,...e.compilerOptions})}var t1t={allowJs:!0,maxNodeModuleJsDepth:2,allowSyntheticDefaultImports:!0,skipLibCheck:!0,noEmit:!0};function r1t(e){return Wc.default.basename(e)==="jsconfig.json"}var Kb=class{clear(){this.#t.clear(),this.#e.clear()}hasConfigPath(t,n="tsconfig.json"){return this.#t.has(`${t}/${n}`)}getConfigPath(t,n="tsconfig.json"){let i=`${t}/${n}`,o=this.#t.get(i);if(o==null||o.length||o.then)return o;throw o}hasParseResult(t){return this.#e.has(t)}getParseResult(t){let n=this.#e.get(t);if(n.then||n.tsconfig)return n;throw n}setParseResult(t,n,i=!1){Object.defineProperty(n,"_isRootFile_",{value:i,writable:!1,enumerable:!1,configurable:!1}),this.#e.set(t,n),n.then(o=>{this.#e.get(t)===n&&this.#e.set(t,o)}).catch(o=>{this.#e.get(t)===n&&this.#e.set(t,o)})}setConfigPath(t,n,i="tsconfig.json"){let o=`${t}/${i}`;this.#t.set(o,n),n.then(r=>{this.#t.get(o)===n&&this.#t.set(o,r)}).catch(r=>{this.#t.get(o)===n&&this.#t.set(o,r)})}#t=new Map;#e=new Map};var NE=class extends Map{constructor(n){super();this.factory=n}get(n){let i=super.get(n);return i===void 0&&(i=this.factory(n,this),this.set(n,i)),i}};async function obe(e){let{configs:t,errors:n}=await ibe(e),i=await sbe(t);async function o(u,H){for(let a of Jj(H))for(let{match:c}of i.get(a))try{return await c(u)}catch{return null}return null}async function r(u,H){for(let a of Jj(H))for(let{match:c}of i.get(a))try{return await c(u,{mustExist:!1})}catch{return null}return null}async function l(u){for(let H of Jj(u))for(let{paths:a}of i.get(H))if(Object.keys(a).length)return a;return{}}async function s(){let{configs:u,errors:H}=await ibe(e);if(i=await sbe(u),H.length)throw new AggregateError(H)}return{resolveId:o,substituteId:r,paths:l,refresh:s,errors:n}}async function ibe(e){let t=await Wj(e,{configNames:["tsconfig.json","jsconfig.json"],skip(r){return r==="node_modules"||r===".git"}}),n={root:e,cache:new Kb},i=new Set,o=[];for(let r of t)try{let l=await Xj(r,n);i.add(l)}catch(l){o.push(l)}for(let r of i)if(r.referenced){for(let l of r.referenced)i.add(l);i.delete(r),i.add(r),r.referenced=void 0}for(let r of o)console.error(r);return{configs:i,errors:o}}async function sbe(e){let t=new NE(()=>[]),n=(i,o)=>o(void 0,!0);for(let i of e){let H=function(a,{mustExist:c=!0}={}){u??=abe.createMatchPathAsync(s,r.paths??{},void 0,l!==void 0);let p=c===!1?a.endsWith("/"):!1;return p&&(a+="__placeholder__"),new Promise((d,h)=>{u(a,void 0,c===!1?n:void 0,void 0,(m,g)=>m?h(m):(p&&(g=g.replace(/__placeholder__$/,"")),d(g)))})},o=ss(Ss(Ph.dirname(i.tsconfigFile))),r=i.tsconfig.compilerOptions??{},l=a1t(i),s=Ph.resolve(o,l||""),u;t.get(o).push({match:H,paths:r.paths??{}})}return t}function*Jj(e){let t=ss(Ss(e)),n;for(;t!==n;)yield t,n=t,t=Ph.dirname(t);return null}function a1t(e){let t=e.tsconfig.compilerOptions?.baseUrl;if(t)return t;for(let n of e.extended??[])if((n.tsconfig.compilerOptions??{})?.paths)return Ph.dirname(n.tsconfigFile);return Ph.dirname(e.tsconfigFile)}async function Qj(e){let t=null;typeof e.pnp=="object"?t=e.pnp:e.pnp&&(t=await age(e.root));let n=e.fileSystem?e.fileSystem:new RE.CachedInputFileSystem(o1t,4e3),i=null;if(typeof e.tsconfig=="object")i=e.tsconfig;else if(e.tsconfig)try{i=await obe(e.root)}catch(m){console.error("Failed to load tsconfig",m)}let o=RE.ResolverFactory.createResolver({fileSystem:n,extensions:[".mjs",".js",".node",".mts",".ts"],mainFields:["module"],conditionNames:["node","import"],pnpApi:t}),r=RE.ResolverFactory.createResolver({fileSystem:n,extensions:[".cjs",".js",".json",".node",".cts",".ts"],mainFields:["main"],conditionNames:["node","require"],pnpApi:t}),l=RE.ResolverFactory.createResolver({fileSystem:n,extensions:[".css"],mainFields:["style"],conditionNames:["style"],pnpApi:t,preferRelative:!0});async function s(m,g,y){if(lbe.sep==="\\"){if(g.startsWith("\\\\")||g.startsWith("//"))return g;y.startsWith("//")&&(y=`\\\\${y.slice(2)}`)}if(i){let E=await i.resolveId(g,y);E&&(g=E)}g=wk(g),y=wk(y);let _=await new Promise((E,A)=>{m.resolve({},y,g,{},(S,T)=>{S?A(S):E(T)})});return _?(_=_.replace(/\0(.)/g,"$1"),_):!1}async function u(m,g){try{return await s(o,m,g)||m}catch{return await s(r,m,g)||m}}async function H(m,g){return await s(r,m,g)||m}async function a(m,g){return await s(l,m,g)||m}async function c(m,g){return await i?.substituteId(m,g)??m}async function p(m){return i?await i.paths(m):{}}async function d(){await i?.refresh()}async function h(){return!!t}return{resolveJsId:u,resolveCjsId:H,resolveCssId:a,substituteId:c,refresh:d,hasPnP:h,aliases:p,child(m){return Qj({...e,...m,pnp:m.pnp??t,tsconfig:m.tsconfig??i,fileSystem:m.fileSystem??n})}}}var cbe=mr(kH());function ube(){let e=new NE(t=>(t=t.replace(/[\[\]{}()]/g,n=>`\\${n}`),(0,cbe.default)(t,{dot:!0})));return{anyMatches:(t,n)=>{let i=e.get(t);return n.some(o=>i(o))},clear:()=>e.clear()}}var aAe=['"',"'","`"," ",".","(","[","]","!","/","-"];async function oAe(e){let t=await Ld(e);if(!t)return null;let n=t.match(/@config\s*(?<config>'[^']+'|"[^"]+")/);return n?ss((0,FE.default)(Vc.resolve(Vc.dirname(e),n.groups.config.slice(1,-1)))):null}var LD=class{constructor(t){this.connection=t;this.lspHandlersAdded=!1;this.disposables=[];this.watchPatterns=()=>{};this.watched=[];this.documentService=new II(this.connection),this.projects=new Map,this.projectCounter=0,this.settingsCache=ige(t),this.pathMatcher=ube()}async init(){this.initPromise||(this.initPromise=this._init()),await this.initPromise}getWorkspaceFolders(){return this.initializeParams.workspaceFolders?.length?this.initializeParams.workspaceFolders.map(t=>({uri:Cp.URI.parse(t.uri).fsPath,name:t.name})):this.initializeParams.rootUri?[{uri:Cp.URI.parse(this.initializeParams.rootUri).fsPath,name:"Root"}]:this.initializeParams.rootPath?[{uri:Cp.URI.file(this.initializeParams.rootPath).fsPath,name:"Root"}]:[]}async _init(){$y(),this.pathMatcher.clear();let t=this.getWorkspaceFolders().map(i=>(0,FE.default)(i.uri));if(t.length===0){console.error("No workspace folders found, not initializing.");return}let n=await Promise.allSettled(t.map(i=>this._initFolder(Cp.URI.file(i))));for(let[i,o]of n.entries())o.status==="rejected"&&console.error("Failed to initialize workspace folder",t[i],o.reason);n.some(i=>i.status==="fulfilled")&&await this.updateCommonCapabilities(),await this.listenForEvents()}async _initFolder(t){let n=t.fsPath;try{await lAe.access(n,PU.constants.F_OK|PU.constants.R_OK)}catch(S){console.error(`Unable to access the workspace folder [${n}]. This may happen if the directory does not exist or the current user does not have the necessary permissions to access it.`),console.error(S);return}let i=this.initializeParams.initializationOptions?.userLanguages??{};Object.keys(i).length>0&&console.warn("Language mappings are currently set via initialization options (`userLanguages`). This is deprecated and will be removed in a future release. Please use the `tailwindCSS.includeLanguages` setting instead.");let o=[],r=await this.settingsCache.get(),l=r.tailwindCSS.files.exclude,s=await this.settingsCache.get(t.toString()),u={...i,...s.tailwindCSS.includeLanguages??{}},H=new Map,a=new Map,c=this.initializeParams.initializationOptions?.workspaceFile?Vc.dirname(this.initializeParams.initializationOptions.workspaceFile):n;function p(S){function T(x){return ss((0,FE.default)(Vc.resolve(c,x)))}let I=S.experimental.configFile,L={};if(typeof I=="string"){let x=T(I),C=[T(Vc.resolve(n,"**"))];L[x]=C}else if(Uu(I))for(let[x,C]of Object.entries(I)){if(typeof x!="string")return null;x=T(x);let D;if(typeof C=="string")D=[T(C)];else if(Array.isArray(C))D=C.map(T);else return null;L[x]=D}else if(I)return null;return Object.entries(L)}let d=p(r.tailwindCSS);if(d===null){console.error("Invalid `experimental.configFile` configuration, not initializing.");return}let h=await Qj({root:n,pnp:!0,tsconfig:!0}),m=new Kx(n,r,h);d.length>0?(console.log("Loading Tailwind CSS projects from the workspace settings."),o=await m.loadAllFromWorkspace(d)):(console.log("Searching for Tailwind CSS projects in the workspace's folders."),o=await m.search());for(let S of o)if(a.set(S.config.path,S.tailwind.version),S.config.source==="css")for(let T of S.config.entries)T.type==="css"&&H.set(T.path,S.config.path);let g=o.map(S=>({folder:S.folder,config:S.config.path,selectors:S.documentSelector,user:S.isUserConfigured,tailwind:S.tailwind}));console.log(`[Global] Creating projects: ${JSON.stringify(g)}`);let y=async S=>{let T=!1,I=!1,L=(0,OE.default)(`**/${__}`,{dot:!0}),x=(0,OE.default)(`**/${qp}`,{dot:!0}),C=(0,OE.default)(`**/${h_}`,{dot:!0}),D=(0,OE.default)(`**/${EI}`,{dot:!0});e:for(let O of S){let j=(0,FE.default)(O.file);j=ss(j);for(let P of l)if((0,OE.default)(P,{dot:!0})(j))continue e;if(L(j))for(let[,P]of this.projects){let W=og().version;try{let Z=require(await h.resolveCjsId("tailwindcss/package.json",Vc.dirname(P.projectConfig.configPath))).version;typeof Z=="string"&&(W=Z)}catch{}if(a.get(P.projectConfig.configPath)!==W){T=!0;break e}}if(D(j)){T=!0;break e}for(let[,P]of this.projects)if(P.state.v4&&!(O.type===Gi.FileChangeType.Deleted&&If(j,[P.projectConfig.configPath]))&&If(j,P.dependencies())){I=!0;break e}if(x(`**/${qp}`)&&O.type!==Gi.FileChangeType.Deleted){let P=await oAe(j)||await oAe(O.file);if(H.has(j)&&H.get(j)!==P){T=!0;break}else if(!H.has(j)&&P){T=!0;break}else{if(this.projects.size>0)continue;let W=await Ld(O.file);if(!W)continue;let Z=zT(W);if(!Z.root||!Z.versions.includes("4"))continue;T=!0;break}}if(C(j)&&O.type===Gi.FileChangeType.Created){T=!0;break}for(let[,P]of this.projects)if(O.type===Gi.FileChangeType.Deleted&&If(j,[P.projectConfig.configPath])){T=!0;break e}}if(T){this.restart();return}if(I){try{await this.softRestart()}catch{this.restart()}return}for(let[,O]of this.projects)O.onFileEvents(S)};if(this.initializeParams.capabilities.workspace?.didChangeWatchedFiles?.dynamicRegistration){this.disposables.push(this.connection.onDidChangeWatchedFiles(async({changes:T})=>{let I=T.map(({uri:L,type:x})=>({file:Cp.URI.parse(L).fsPath,type:x})).filter((L,x,C)=>C.findIndex(D=>D.file===L.file&&D.type===L.type)===x);await y(I)}));let S=await this.connection.client.register(Gi.DidChangeWatchedFilesNotification.type,{watchers:[{globPattern:`**/${h_}`},{globPattern:`**/${__}`},{globPattern:`**/${qp}`},{globPattern:`**/${EI}`}]});this.disposables.push(S),this.watchPatterns=T=>{let I=this.filterNewWatchPatterns(T);I.length&&(console.log(`[Global] Adding watch patterns: ${I.join(", ")}`),this.connection.client.register(Gi.DidChangeWatchedFilesNotification.type,{watchers:I.map(L=>({globPattern:L}))}).then(L=>{this.disposables.push(L)}))}}else if(TD.getBinding()){console.log("[Global] Your LSP client does not support watching files on behalf of the server"),console.log("[Global] Using bundled file watcher: @parcel/watcher");let S={create:Gi.FileChangeType.Created,update:Gi.FileChangeType.Changed,delete:Gi.FileChangeType.Deleted},T=await TD.subscribe(n,(I,L)=>{y(L.map(x=>({file:x.path,type:S[x.type]})))},{ignore:l.map(I=>Vc.resolve(n,I.replace(/^[*/]+/,"").replace(/[*/]+$/,"")))});this.disposables.push({dispose(){T.unsubscribe()}})}else{console.log("[Global] Your LSP client does not support watching files on behalf of the server"),console.log("[Global] Using bundled file watcher: chokidar");let S=sAe().watch,T=S([`**/${h_}`,`**/${__}`,`**/${qp}`,`**/${EI}`],{cwd:n,ignorePermissionErrors:!0,ignoreInitial:!0,ignored:l,awaitWriteFinish:{stabilityThreshold:100,pollInterval:20}});await new Promise(I=>{T.on("ready",()=>I())}),T.on("add",I=>y([{file:Vc.resolve(n,I),type:Gi.FileChangeType.Created}])).on("change",I=>y([{file:Vc.resolve(n,I),type:Gi.FileChangeType.Changed}])).on("unlink",I=>y([{file:Vc.resolve(n,I),type:Gi.FileChangeType.Deleted}])),this.disposables.push({dispose(){T.close()}}),this.watchPatterns=I=>{let L=this.filterNewWatchPatterns(I);L.length&&(console.log(`[Global] Adding watch patterns: ${L.join(", ")}`),T.add(L))}}console.log("[Global] Preparing projects..."),await Promise.all(o.map(S=>this.addProject(S,this.initializeParams,this.watchPatterns,a.get(S.configPath),u,h,t))),console.log("[Global] Initializing projects...");let _=[],E=0;for(let S of this.documentService.getAllDocuments()){let T=this.getProject(S);T&&!T.enabled()&&(T.enable(),await T.tryInit(),E++),_.push(S.uri)}console.log(`[Global] Initialized ${E} projects`),this.disposables.push(this.connection.onDidChangeConfiguration(async({settings:S})=>{let T=r.tailwindCSS.files.exclude;if(this.settingsCache.clear(),r=await this.settingsCache.get(),!Bl(T,r.tailwindCSS.files.exclude)){this.restart();return}for(let[,I]of this.projects)I.onUpdateSettings(S)})),(this.initializeParams.initializationOptions?.testMode??!1)&&(console.log("[Global][Test] Sending document notifications..."),await Promise.all(_.map(S=>this.connection.sendNotification("@/tailwindCSS/documentReady",{uri:S}))))}async listenForEvents(){let t=this.initializeParams.initializationOptions?.testMode??!1;this.disposables.push(this.connection.onShutdown(()=>{this.dispose()})),this.disposables.push(this.documentService.onDidChangeContent(n=>{this.getProject(n.document)?.provideDiagnostics(n.document)})),this.disposables.push(this.documentService.onDidOpen(async n=>{let i=this.getProject(n.document);i&&(i.enabled()||(i.enable(),await i.tryInit()),t&&await this.connection.sendNotification("@/tailwindCSS/documentReady",{uri:n.document.uri}))})),this.initializeParams.capabilities.workspace.workspaceFolders&&this.disposables.push(this.connection.workspace.onDidChangeWorkspaceFolders(async n=>{let i=n.added.map(o=>({uri:Cp.URI.parse(o.uri).fsPath,name:o.name})).map(o=>(0,FE.default)(o.uri));await Promise.allSettled(i.map(o=>this._initFolder(Cp.URI.file(o))))})),t&&await this.connection.sendNotification("@/tailwindCSS/serverReady")}filterNewWatchPatterns(t){return t=Array.from(new Set(t)),t=t.filter(n=>!this.watched.includes(n)),this.watched.push(...t),t}async addProject(t,n,i,o,r,l,s){let u=String(this.projectCounter++),H=await J0e(u,t,this.connection,n,this.documentService,()=>this.updateProjectCapabilities(),()=>{for(let a of this.documentService.getAllDocuments()){let c=this.getProject(a);if(c&&!c.enabled()){c.enable(),c.tryInit();break}}},()=>this.refreshDiagnostics(),a=>i(a),o,this.settingsCache.get,r,l);this.projects.set(u,H),this.supportsTailwindProjectDetails&&this.connection.sendNotification("@/tailwindCSS/projectDetails",{uri:s.toString(),config:t.configPath,tailwind:t.tailwind})}get supportsTailwindProjectDetails(){return this.initializeParams.capabilities.experimental?.tailwind?.projectDetails??!1}refreshDiagnostics(){for(let t of this.documentService.getAllDocuments()){let n=this.getProject(t);n?n.provideDiagnosticsForce(t):this.connection.sendDiagnostics({uri:t.uri,diagnostics:[]})}}setupLSPHandlers(){this.lspHandlersAdded||(this.lspHandlersAdded=!0,this.connection.onHover(this.onHover.bind(this)),this.connection.onCompletion(this.onCompletion.bind(this)),this.connection.onCompletionResolve(this.onCompletionResolve.bind(this)),this.connection.onDocumentColor(this.onDocumentColor.bind(this)),this.connection.onColorPresentation(this.onColorPresentation.bind(this)),this.connection.onCodeAction(this.onCodeAction.bind(this)),this.connection.onCodeLens(this.onCodeLens.bind(this)),this.connection.onDocumentLinks(this.onDocumentLinks.bind(this)),this.connection.onRequest(this.onRequest.bind(this)))}onRequest(t,n){if(t==="@/tailwindCSS/sortSelection"){let i=this.getProject({uri:n.uri});if(!i)return{error:"no-project"};try{return{classLists:i.sortClassLists(n.classLists)}}catch{return{error:"unknown"}}}if(t==="@/tailwindCSS/getProject"){let i=this.getProject({uri:n.uri});return!i||!i.enabled()||!i.state?.enabled?null:{version:i.state.version}}}async updateCommonCapabilities(){let t=Gi.BulkRegistration.create(),n=this.initializeParams.capabilities;n.textDocument?.hover?.dynamicRegistration&&t.add(Gi.HoverRequest.type,{documentSelector:null}),n.textDocument?.colorProvider?.dynamicRegistration&&t.add(Gi.DocumentColorRequest.type,{documentSelector:null}),n.textDocument?.codeAction?.dynamicRegistration&&t.add(Gi.CodeActionRequest.type,{documentSelector:null}),n.textDocument?.codeLens?.dynamicRegistration&&t.add(Gi.CodeLensRequest.type,{documentSelector:null}),n.textDocument?.documentLink?.dynamicRegistration&&t.add(Gi.DocumentLinkRequest.type,{documentSelector:null}),n.workspace?.didChangeConfiguration?.dynamicRegistration&&t.add(Gi.DidChangeConfigurationNotification.type,void 0),this.commonRegistrations?.dispose(),this.commonRegistrations=await this.connection.client.register(t)}updateProjectCapabilities(){this.updateTriggerCharacters()}async updateTriggerCharacters(){if(!this.initializeParams.capabilities.textDocument?.completion?.dynamicRegistration)return;let n=new Set(aAe);for(let o of this.projects.values()){let r=o.state.separator;typeof r=="string"&&(r=r.slice(-1),r&&n.add(r))}if(this.completionRegistration&&Bl(Array.from(n),Array.from(this.lastTriggerCharacters??[])))return;this.lastTriggerCharacters=n;let i=this.completionRegistration;this.completionRegistration=this.connection.client.register(Gi.CompletionRequest.type,{documentSelector:null,resolveProvider:!0,triggerCharacters:Array.from(n)}),await i?.then(o=>o.dispose()),await this.completionRegistration}getProject(t){let n,i,o=1/0,r=Cp.URI.parse(t.uri),l=r.fsPath,s=r.path;l=ss(l);for(let H of this.projects.values()){if(!H.projectConfig.configPath){n=n??H;continue}for(let a of H.documentSelector()){if(a.pattern.startsWith("!")&&this.pathMatcher.anyMatches(a.pattern.slice(1),[l,s]))break;if(a.priority<o&&this.pathMatcher.anyMatches(a.pattern,[l,s])){i=H,o=a.priority;continue}}}let u=i??n;return u||console.debug("[GLOBAL] No matching project for document",{fsPath:l,normalPath:s}),u}async onDocumentColor(t){return await this.init(),this.getProject(t.textDocument)?.onDocumentColor(t)??[]}async onColorPresentation(t){return await this.init(),this.getProject(t.textDocument)?.onColorPresentation(t)??[]}async onHover(t){return await this.init(),this.getProject(t.textDocument)?.onHover(t)??null}async onCompletion(t){return await this.init(),this.getProject(t.textDocument)?.onCompletion(t)??null}async onCompletionResolve(t){return await this.init(),this.projects.get(t.data?._projectKey)?.onCompletionResolve(t)??null}async onCodeAction(t){return await this.init(),this.getProject(t.textDocument)?.onCodeAction(t)??null}async onCodeLens(t){return await this.init(),this.getProject(t.textDocument)?.onCodeLens(t)??null}async onDocumentLinks(t){return await this.init(),this.getProject(t.textDocument)?.onDocumentLinks(t)??null}setup(){this.connection.onInitialize(async t=>(this.initializeParams=t,this.setupLSPHandlers(),{capabilities:this.computeServerCapabilities(t.capabilities)})),this.connection.onInitialized(()=>this.init())}computeServerCapabilities(t){let n={textDocumentSync:Gi.TextDocumentSyncKind.Full,workspace:{workspaceFolders:{changeNotifications:!0}}};return t.textDocument?.hover?.dynamicRegistration||(n.hoverProvider=!0),t.textDocument?.colorProvider?.dynamicRegistration||(n.colorProvider=!0),t.textDocument?.codeAction?.dynamicRegistration||(n.codeActionProvider=!0),t.textDocument?.codeLens?.dynamicRegistration||(n.codeLensProvider={resolveProvider:!1}),t.textDocument?.completion?.dynamicRegistration||(n.completionProvider={resolveProvider:!0,triggerCharacters:[...aAe,":"]}),t.textDocument?.documentLink?.dynamicRegistration||(n.documentLinkProvider={}),n}listen(){this.connection.listen()}dispose(){this.connection.sendNotification("@/tailwindCSS/projectsDestroyed");for(let[,t]of this.projects)t.dispose();this.projects=new Map,this.refreshDiagnostics(),this.commonRegistrations?.dispose(),this.commonRegistrations=void 0,this.lastTriggerCharacters?.clear(),this.completionRegistration?.then(t=>t.dispose()),this.completionRegistration=void 0,this.disposables.forEach(t=>t.dispose()),this.disposables.length=0,this.watched.length=0}async restart(){let t=this.initializeParams.initializationOptions?.testMode??!1;console.log(`----------
|
3584
3584
|
RESTARTING
|
3585
3585
|
----------`),this.dispose(),this.initPromise=void 0,await this.init(),t&&this.connection.sendNotification("@/tailwindCSS/serverRestarted")}async softRestart(){for(let[,t]of this.projects)if(t.state.v4)try{await t.reload()}catch{}}};var cAe=require("node:util");function rA(e){return e.map(t=>(0,cAe.format)(t)).join(" ")}function uAe(e,t){e.debug=(...n)=>t.console.info(rA(n)),e.error=(...n)=>t.console.error(rA(n)),e.warn=(...n)=>t.console.warn(rA(n)),e.info=(...n)=>t.console.info(rA(n)),e.log=(...n)=>t.console.log(rA(n))}global.__preflight=KK;new Function("require","__dirname",`
|
3586
3586
|
let oldReadFileSync = require('fs').readFileSync
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@tailwindcss/language-server",
|
3
|
-
"version": "0.14.
|
3
|
+
"version": "0.14.20",
|
4
4
|
"description": "Tailwind CSS Language Server",
|
5
5
|
"license": "MIT",
|
6
6
|
"repository": {
|
@@ -93,7 +93,7 @@
|
|
93
93
|
"vscode-languageserver-protocol": "^3.17.5",
|
94
94
|
"vscode-languageserver-textdocument": "1.0.12",
|
95
95
|
"vscode-uri": "3.0.2",
|
96
|
-
"@tailwindcss/language-service": "0.14.
|
96
|
+
"@tailwindcss/language-service": "0.14.20"
|
97
97
|
},
|
98
98
|
"engines": {
|
99
99
|
"node": ">=18.0.0"
|