@tailwindcss/language-server 0.0.23 → 0.0.24

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.
@@ -1281,7 +1281,7 @@ If omitted, Tailwind will append these classes to the very end of your styleshee
1281
1281
  `)+_.toString().replace(/\n\s*\n/g,`
1282
1282
  `).replace(/(@apply [^;\n]+)$/gm,"$1;").replace(/([^\s^]){$/gm,"$1 {").replace(/^\s+/gm,v=>(typeof b>"u"&&(b=v),v.replace(new RegExp(b,"g"),D.indent))).replace(/^(\s+)(.*?[^{}]\n)([^\s}])/gm,"$1$2$1$3")}),!1})})})]).process(i,{from:void 0})}catch{return[]}return a.length?[{title:"Extract to new rule",kind:"quickfix",diagnostics:[r],edit:{changes:{[t.uri]:a}}}]:[]}function mY(e){return{start:{line:e.start.line-1,character:e.start.column-1},end:{line:e.end.line-1,character:e.end.column}}}function WOe(e,t,r,n=!1){let s=t[t.length-1],i=Ou(e,[s]);if(i===null||i.isApplyable===!1)return null;let o=tp(e,t);if(Array.isArray(o))return null;let a=o.context,u=o.pseudo,c=e.classNames.context,H=[];for(let f=0;f<t.length-1;f++){let h=t[f],m=c[h];if(!m)return null;e.screens.includes(h)&&(H.push(`@screen ${h}`),a=a.filter(A=>!m.includes(A)))}H.push(...a);let l={};for(let f=1;f<=H.length;f++)Ba(l,H.slice(0,f),{});if(r=XOe(r,u),r===null)return null;let d={[r]:{[`@apply ${s}${n?" !important":""}`]:""}};return H.length?Ba(l,H,d):l=d,hY(l,e.modules.postcss)}function XOe(e,t){if(t.length===0)return e;let r=!0,n=(0,fk.default)(s=>{ll(s.split(i=>!0)).forEach(i=>{for(let o=i.nodes.length-1;o>=0&&i.nodes[o].type==="pseudo";o--)if(t.includes(i.nodes[o].value)){r=!1;break}r&&t.forEach(o=>{i.append(fk.default.pseudo({value:o}))})})}).processSync(e);return r?n:null}function gY(e,t,r){return r.suggestions.map(n=>({title:`Replace with '${n}'`,kind:"quickfix",diagnostics:[r],edit:{changes:{[t.textDocument.uri]:[{range:r.range,newText:n}]}}}))}async function VOe(e,t,r,n){if(!r)return[];let s=await cI(e,r,n);return t.context.diagnostics.map(i=>s.find(o=>o.code===i.code&&o.message===i.message&&Hy(o.range,i.range))).filter(Boolean)}async function LY(e,t,r){if(!e.enabled)return[];let n=await VOe(e,t,r,t.context.diagnostics.map(s=>s.code).filter(Boolean));return Promise.all(n.map(s=>xJ(s)?yY(e,r,s):DJ(s)?lY(e,t,s):kJ(s)||MJ(s)||CJ(s)||wJ(s)||NJ(s)?gY(e,t,s):[])).then(ll).then(s=>r4(s,i=>JSON.stringify(i.edit)))}var IY=Kt(Us());async function AY(e,t){let r=[];return!e.enabled||(await e.editor.getConfiguration(t.uri)).tailwindCSS.colorDecorators===!1?r:((await rf(e,t)).forEach(o=>{Nu(o,e.blocklist).forEach(u=>{let c=Ao(e,u.className);c===null||typeof c=="string"||(c.alpha??1)===0||r.push({range:u.range,color:Yw(c)})})}),rI(e,t).forEach(o=>{let a=HI(o.path),u=o.helper==="theme"?["theme"]:[],c=(0,IY.default)(e.config,[...u,...a]),H=Qd(c);H&&typeof H!="string"&&(H.alpha??1)!==0&&r.push({range:o.ranges.path,color:Yw(H)})}),xp(r))}function bY(e,t,r){return qOe(e,t,r)}function qOe(e,t,r){if(!Dr(e.version,"3.2.0"))return[];let n=[],s=[];if(va(e,t))s.push(void 0);else{let i=as(e,t);if(!i)return[];s.push(...i.filter(o=>o.type==="css").map(({range:o})=>o))}for(let i of s){let o=Ji(t,"css",i),a=bo(/@config\s*(?<path>'[^']+'|"[^"]+")/g,o);for(let u of a)n.push({target:r(u.groups.path.slice(1,-1)),range:lH({start:li(o,u.index+u[0].length-u.groups.path.length),end:li(o,u.index+u[0].length)},i)})}return n}var _ue=Kt(vY());var nE=Kt(require("fs")),Hf=Kt(require("path"));var KOe=[".js",".cjs",".mjs"],GOe=["",".js",".cjs",".mjs",".ts",".cts",".mts",".jsx",".tsx"],ZOe=["",".ts",".cts",".mts",".tsx",".js",".cjs",".mjs",".jsx"];function zOe(e,t){for(let r of t){let n=`${e}${r}`;if(nE.default.existsSync(n)&&nE.default.statSync(n).isFile())return n}for(let r of t){let n=`${e}/index${r}`;if(nE.default.existsSync(n))return n}return null}function*TY(e,t,r,n=Hf.default.extname(e)){let s=zOe(Hf.default.resolve(t,e),KOe.includes(n)?GOe:ZOe);if(s===null||r.has(s))return;r.add(s),yield s,t=Hf.default.dirname(s),n=Hf.default.extname(s);let i=nE.default.readFileSync(s,"utf-8");for(let o of[...i.matchAll(/import[\s\S]*?['"](.{3,}?)['"]/gi),...i.matchAll(/import[\s\S]*from[\s\S]*?['"](.{3,}?)['"]/gi),...i.matchAll(/require\(['"`](.+)['"`]\)/gi)])o[1].startsWith(".")&&(yield*TY(o[1],t,r,n))}function fI(e){return Array.from(TY(e,Hf.default.dirname(e),new Set)).filter(t=>t!==e).map(t=>Bs(Zi(t)))}var A1=Kt(require("assert"));var Eue=Kt(dw());function iE(e){let t=[],r=e.startsWith("0.0.0-insiders");return!r&&Dr(e,"4.0.0-alpha.1")?["css-at-theme","layer:base","content-list"]:!r&&e.startsWith("0.0.0-oxide")?["css-at-theme","layer:base","content-list"]:(Dr(e,"0.99.0")?(t.push("layer:base"),t.push("separator:root")):(t.push("layer:preflight"),t.push("separator:options")),Dr(e,"1.4.0")&&Bc(e,"1.99.0")&&t.push("browserslist-in-plugins"),Dr(e,"3.0.0")||(Dr(e,"1.99.0")?t.push("apply-complex-classes"):Dr(e,"1.7.0")&&t.push("apply-complex-classes:flagged")),Dr(e,"3.0.0")?t.push("content-list"):t.push("purge-list"),Dr(e,"3.0.0")?t.push("jit"):Dr(e,"2.1.0"),Dr(e,"3.2.0")&&(t.push("css-at-config"),t.push("relative-content-paths")),Dr(e,"3.3.0")&&t.push("transpiled-configs"),t)}var jQ=Kt(BQ());var cE=Kt(require("node:path"));var Pk="'",$k='"';function UQ(){let e=new WeakSet;function t(r){if(e.has(r))return;let n=r.root().source?.input.file;if(!n)return;let s=r.source?.input.file;if(!s)return;let i=r.params[0],o=i[0]===$k&&i[i.length-1]===$k?$k:i[0]===Pk&&i[i.length-1]===Pk?Pk:null;if(!o)return;let a=r.params.slice(1,-1),u="";if(a.startsWith("!")&&(a=a.slice(1),u="!"),!a.startsWith("./")&&!a.startsWith("../"))return;let c=cE.default.posix.join(Zi(cE.default.dirname(s)),a),H=cE.default.posix.dirname(Zi(n)),l=cE.default.posix.relative(H,c);l.startsWith(".")||(l="./"+l),r.params=o+u+l+o,e.add(r)}return{postcssPlugin:"tailwindcss-postcss-fix-relative-paths",AtRule:{source:t,plugin:t}}}var l3e=Ly({extensions:[".css"],mainFields:["style"],conditionNames:["style"]}),u3e=Va([(0,jQ.default)({resolve(e,t){let r=l3e.resolveSync({},t,e);return r||e}}),UQ()]);function gI(){return u3e}function WQ(e){return{postcssPlugin:"extract-at-rules",AtRule:{source:({params:t})=>{t[0]!=='"'&&t[0]!=="'"||e.push(t.slice(1,-1))}}}}var c3e=/@import\s*(?:'tailwindcss'|"tailwindcss")/,p3e=/@theme\s*\{/;async function d3e(e){return p3e.test(e)||c3e.test(e)}async function Dk(e,t,r){if(!e.__unstable__loadDesignSystem||!d3e(r))return null;let n=await gI().process(r,{from:t}),s=await e.__unstable__loadDesignSystem(n.css,{loadPlugin(){return()=>{}}});return Object.assign(s,{compile(i){let o=s.candidatesToCss(i),a=[],u=o.map(c=>{if(c===null)return Va.root();try{return Va.parse(c.trimEnd())}catch(H){return a.push(H),Va.root()}});return a.length>0&&console.error(JSON.stringify(a)),u},toCss(i){return Array.isArray(i)?Va.root({nodes:i}).toString().trim():i.toString().trim()}}),s}var XQ=require("node:fs/promises");async function sp(e){try{let t=await(0,XQ.readFile)(e,"utf8");return Ji(t,"css")}catch{return null}}var uue=Object.keys(Eue.default);function cue(e,t){return JSON.stringify([e,...t].map(r=>[r,Lp.statSync(r).mtimeMs]))}function yue(e){if(typeof e.mode<"u")return e.mode;if(Array.isArray(e.presets))for(let t=e.presets.length-1;t>=0;t--){let r=yue(e.presets[t]);if(typeof r<"u")return r}}function gue(e){if(delete e.mode,Array.isArray(e.presets))for(let t of e.presets)gue(t)}function $b(e,t){let r,n=jn.dirname(e),s=[e,n];if(n===t)return s;for(;n=jn.dirname(r=n),r!==n;)if(s.push(n),n===t)break;return s}async function Lue(e,t,r,n,s,i,o,a,u,c,H,l){let d=!1,f=t.folder,h=[],m=t.documentSelector,A=n.capabilities.textDocument?.completion?.completionList?.itemDefaults??[];n.clientInfo?.name?.includes("Visual Studio Code")&&!A.includes("data")&&A.push("data");let g={enabled:!1,completionItemData:{_projectKey:e},editor:{connection:r,folder:f,userLanguages:l,capabilities:{configuration:!0,diagnosticRelatedInformation:!0,itemDefaults:A},getConfiguration:H,getDocumentSymbols:P=>r.sendRequest("@/tailwindCSS/getDocumentSymbols",{uri:P}),async readDirectory(P,S){try{S=jn.resolve(jn.dirname(pI(P.uri)),S);let T=await Lp.promises.readdir(S,{withFileTypes:!0});return(await Promise.all(T.map(async N=>{let R=N.isDirectory();return await Fu(g,P,jn.join(S,N.name,R?"/":""))?null:[N.name,{isDirectory:R}]}))).filter(N=>N!==null)}catch{return[]}}}};if(t.configPath&&t.config.source==="js"){let P=[];try{P=fI(t.configPath)}catch{}u([...$b(t.configPath,t.folder),...P.flatMap(S=>$b(S,t.folder))])}function _(...P){console.log(`[${jn.relative(t.folder,t.configPath)}] ${P.join(" ")}`)}function L(P){let S=!1,T=!1,k=(0,fue.default)(`**/${nd}`,{dot:!0});for(let N of P){let R=Bs(Zi(N.file)),O=sd(R,[t.configPath]),F=sd(R,g.dependencies??[]),B=k(R);if(!(!O&&!F&&!B)){if(!d){!t.isUserConfigured&&t.configPath&&(O||F)&&(m=[...m.filter(({priority:C})=>C!==1),...due(t.configPath,c,t.folder)],o());continue}if(N.type===Db.FileChangeType.Created){_("File created:",N.file),S=!0;break}else if(N.type===Db.FileChangeType.Changed)if(_("File changed:",N.file),!g.enabled||B){S=!0;break}else T=!0;else if(N.type===Db.FileChangeType.Deleted)if(_("File deleted:",N.file),!g.enabled||O||B){S=!0;break}else T=!0}}S?D():T&&v()}function b(){Object.keys(g).forEach(P=>{P!=="editor"&&P!=="dependencies"&&delete g[P]}),g.enabled=!1,a(),i(),r.sendNotification("@/tailwindCSS/projectReset")}async function D(){if(d)try{await x(),r.sendNotification("@/tailwindCSS/projectInitialized")}catch(P){b(),kP(r,P)}}async function v(){if(d)try{await I()}catch(P){b(),kP(r,P)}}async function x(){_("Initializing..."),zh();let P=t.configPath;if(!P)throw new $g("No config file found.");u($b(P,t.folder));let S=oc.default.sync(G=>{let se=jn.join(G,".pnp.js");if(oc.default.sync.exists(se)||(se=jn.join(G,".pnp.cjs"),oc.default.sync.exists(se)))return se;if(G===jn.normalize(f))return oc.default.stop},{cwd:f});if(S){let G=require(S);G.setup(),iU(G)}let T=t.config.source==="js"?fI(P):[],k=cue(P,T),N=jn.dirname(P),R,O,F,B,C,K,Z,ie,te,ne,W,j={future:[],experimental:[]},q;try{let G=Jr(N,"tailwindcss"),se=Jr(N,"tailwindcss/package.json"),de=jn.dirname(se);C=require(se).version;let me=iE(C);if(_(`supported features: ${JSON.stringify(me)}`),G=Sg(G).href,R=await import(G),R=R.default??R,_(`Loaded tailwindcss v${C}: ${de}`),me.includes("css-at-theme"))return g.configPath=P,g.version=C,g.isCssConfig=!0,g.v4=!0,g.jit=!0,g.modules={tailwindcss:{version:C,module:R},postcss:{version:null,module:null},resolveConfig:{module:null},loadConfig:{module:null}},v();if(t.config.source==="css"){_("CSS-based configuration is not supported before Tailwind CSS v4"),g.enabled=!1,d=!1;return}let Ae=Jr(de,"postcss"),Fe=Jr(de,"postcss/package.json"),Xe=jn.dirname(Fe),Pe=Jr(de,"postcss-selector-parser");if(K=require(Fe).version,Z=Object.keys(nL).map(ye=>{try{return require(Jr(N,`${ye}/package.json`)).version}catch{return""}}).join(","),g.enabled&&K===g.modules.postcss.version&&C===g.modules.tailwindcss.version&&Z===g.pluginVersions&&P===g.configPath&&k===g.configId)return;_(`Loaded Tailwind CSS config file: ${P}`),O=require(Ae),F=require(Pe),_(`Loaded postcss v${K}: ${Xe}`);try{te=require(Jr(de,"./resolveConfig.js"))}catch{try{let le=require(Jr(de,"./lib/util/resolveConfig.js")),ae=require(Jr(de,"./stubs/defaultConfig.stub.js"));te=X=>le([X,ae])}catch{try{let ae=require(Jr(de,"./lib/util/mergeConfigWithDefaults.js")),X=require(Jr(de,"./defaultConfig.js"));te=ce=>ae.default(ce,X())}catch{throw Error("Failed to load resolveConfig function.")}}}try{let ye=require(Jr(de,"./lib/util/transformThemeValue.js"));ne=ye.default??ye}catch{}try{W=require(Jr(de,"./loadConfig.js"))}catch{}if(Dr(C,"1.4.0")&&Bc(C,"1.99.0")){let ye=Jr(de,"browserslist");ie=require(ye)(void 0,{path:f})}Dr(C,"1.99.0")?q=CP(()=>require(Jr(de,"./lib/lib/substituteClassApplyAtRules"))):Dr(C,"1.7.0")&&(q=require(Jr(de,"./lib/flagged/applyComplexClasses")));try{j=require(Jr(de,"./lib/featureFlags.js")).default}catch{}let Ee=new Set,we=O.root(),Be={opts:{},messages:[]},Ye=()=>{};try{let ye=bg(()=>{let le=require(Jr(N,"tailwindcss/lib/lib/setupContextUtils")).createContext;return A1.default.strictEqual(typeof le,"function"),ae=>le(ae.config)},()=>{let le=require(Jr(N,"tailwindcss/lib/jit/lib/setupContextUtils")).createContext;return A1.default.strictEqual(typeof le,"function"),ae=>le(ae.config)},()=>{let le=require(Jr(N,"tailwindcss/lib/jit/lib/setupTrackingContext")).default;return A1.default.strictEqual(typeof le,"function"),ae=>le(ae.configPath,Ee,Ye)(Be,we)},()=>{let le=require(Jr(N,"tailwindcss/lib/jit/lib/setupContext")).default;return A1.default.strictEqual(typeof le,"function"),ae=>le(ae.configPath,Ee)(Be,we)});B={generateRules:{module:bg(()=>require(Jr(N,"tailwindcss/lib/lib/generateRules")).generateRules,()=>require(Jr(N,"tailwindcss/lib/jit/lib/generateRules")).generateRules)},createContext:{module:ye},expandApplyAtRules:{module:bg(()=>require(Jr(N,"tailwindcss/lib/lib/expandApplyAtRules")).default,()=>require(Jr(N,"tailwindcss/lib/jit/lib/expandApplyAtRules")).default)},evaluateTailwindFunctions:{module:CP(()=>require(Jr(N,"tailwindcss/lib/lib/evaluateTailwindFunctions")).default)}}}catch{try{let le=require(Jr(N,"tailwindcss/jit/lib/setupContext"));B={generateRules:{module:require(Jr(N,"tailwindcss/jit/lib/generateRules")).generateRules},createContext:{module:ae=>le(ae.configPath,Ee)(Be,we)},expandApplyAtRules:{module:require(Jr(N,"tailwindcss/jit/lib/expandApplyAtRules"))}}}catch{}}}catch(G){let se=await import("node:util");console.error(se.format(G)),R=sue(),te=jD(),ne=df().default,W=Hue(),O=Sa(),C=NE().version,K=lue().version,F=SL(),B={generateRules:{module:RE().generateRules},createContext:{module:de=>mf().createContext(de.config)},expandApplyAtRules:{module:l9().default}},_("Failed to load workspace modules."),_(`Using bundled version of \`tailwindcss\`: v${C}`),_(`Using bundled version of \`postcss\`: v${K}`)}g.configPath=P,g.modules={tailwindcss:{version:C,module:R},postcss:{version:K,module:O},postcssSelectorParser:{module:F},resolveConfig:{module:te},loadConfig:{module:W},transformThemeValue:{module:ne},jit:B},g.browserslist=ie,g.featureFlags=j,g.version=C,g.pluginVersions=Z;try{g.corePlugins=Object.keys(require(Jr(jn.dirname(g.configPath),"tailwindcss/lib/plugins/index.js")))}catch{}if(q&&!q.default.__patched){let G=q.default;q.default=(se,...de)=>{if(g.jit)return g.modules.jit.expandApplyAtRules.module(g.jitContext);let me=Lu(se);me.separator=typeof g.separator>"u"?":":g.separator;let Ae=G(me,...de);return async Fe=>(Fe.walkRules(Xe=>{let Pe=Xe.selector.replace(/__TWSEP__(.*?)__TWSEP__/g,"$1");Pe!==Xe.selector&&(Xe.before(O.comment({text:"__ORIGINAL_SELECTOR__:"+Xe.selector})),Xe.selector=Pe)}),await Ae(Fe),Fe.walkComments(Xe=>{Xe.text.startsWith("__ORIGINAL_SELECTOR__:")&&(Xe.next().selector=Xe.text.replace(/^__ORIGINAL_SELECTOR__:/,""),Xe.remove())}),Fe)},q.default.__patched=!0}await v()}async function I(){_("Building..."),zh();let{tailwindcss:P,postcss:S,resolveConfig:T,loadConfig:k}=g.modules,N=Dr(P.version,"0.99.0")?["separator"]:["options","separator"],R=[],O,F=Dr(P.version,"2.99.0"),B;if(g.isCssConfig)try{let Z=await sp(g.configPath),ie=await Dk(g.modules.tailwindcss.module,g.configPath,Z);g.designSystem=ie,O={theme:{}}}catch{d=!1,g.enabled=!1;return}else if(k.module){B=new yd(Lp.realpathSync(g.configPath));try{O=await k.module(g.configPath),O=O.default??O,g.jit=!0}finally{B.unhook()}}else{B=new yd(Lp.realpathSync(g.configPath),Z=>{O=Lu(Z);let ie=(0,yH.default)(Z,N);typeof ie!="string"&&(ie=":"),Ba(Z,N,`__TWSEP__${ie}__TWSEP__`),Z[F?"content":"purge"]=[];let te=yue(Z);if(gue(Z),F||g.modules.jit&&te==="jit"){if(g.jit=!0,Z.variants=[],Array.isArray(Z.presets))for(let W of Z.presets)R.push(W.variants),W.variants=[]}else g.jit=!1;if(g.corePlugins){let W={};for(let j of g.corePlugins)W[j]=!0;Z.corePlugins=W}return Array.isArray(Z.plugins)&&(Z.plugins=Z.plugins.map(W=>{if(W.__isOptionsFunction&&(W=W()),typeof W=="function"){let j=(...q)=>(q[0].matchUtilities||(q[0].matchUtilities=()=>{}),W(...q));return j.__intellisense_cache_bust=Math.random(),j}return W.handler?{...W,handler:(...j)=>(j[0].matchUtilities||(j[0].matchUtilities=()=>{}),W.handler(...j)),__intellisense_cache_bust:Math.random()}:W})),Z});try{t.config.source==="js"&&require(g.configPath)}catch(Z){throw B.unhook(),Z}}if(!O)throw new $g(`Failed to load config file: ${g.configPath}`);t.isUserConfigured||(m=[...m.filter(({priority:Z})=>Z!==1),...due(g.configPath,P.version,t.folder,O)]);try{if(g.config=g.isCssConfig?O:T.module(O),g.separator=(0,yH.default)(g.config,N),typeof g.separator!="string"&&(g.separator=":"),g.blocklist=Array.isArray(g.config.blocklist)?g.config.blocklist:[],delete g.config.blocklist,g.v4){let Z=g.designSystem.getClassList();g.classList=Z.map(ie=>[ie[0],{...ie[1],color:Ao(g,ie[0])}])}else if(g.jit){if(g.jitContext=g.modules.jit.createContext.module(g),g.jitContext.tailwindConfig.separator=g.config.separator,g.jitContext.getClassList){let Z=g.jitContext.getClassList({includeMetadata:!0}).filter(ie=>ie!=="*");g.classListContainsMetadata=Z.some(ie=>Array.isArray(ie)),g.classList=Z.map(ie=>Array.isArray(ie)?[ie[0],{color:Ao(g,ie[0]),...ie[1]??{}}]:[ie,{color:Ao(g,ie)}])}}else delete g.jitContext,delete g.classList}catch(Z){throw B?.unhook(),Z}let C;if(g.classList)B?.unhook();else try{C=await S.module([P.module(g.configPath)]).process([Dr(P.version,"0.99.0")?"base":"preflight","components","utilities"].map(Z=>`/*__tw_intellisense_layer_${Z}__*/
1283
1283
  @tailwind ${Z};`).join(`
1284
- `),{from:void 0})}catch(Z){throw Z}finally{B?.unhook()}g.dependencies=fI(g.configPath),u((g.dependencies??[]).flatMap(Z=>$b(Z,t.folder))),g.configId=cue(g.configPath,g.dependencies),g.plugins=await VQe(O),C&&(g.classNames=await Gq(C.root)),g.variants=XQe(g);let K=(0,yH.default)(g.config,"theme.screens",(0,yH.default)(g.config,"screens",{}));g.screens=CH(K)?Object.keys(K):[],g.enabled=!0,a(),i()}return{projectConfig:t,enabled(){return d},enable(){d=!0},async reload(){if(!g.v4)return;console.log("---- RELOADING DESIGN SYSTEM ----");let P=await sp(g.configPath),S=await Dk(g.modules.tailwindcss.module,g.configPath,P),T=Object.create(g,{designSystem:{value:S}}),k=S.getClassList().map(N=>[N[0],{...N[1],color:Ao(T,N[0])}]);g.designSystem=S,g.classList=k,console.log("---- RELOADED ----")},state:g,documentSelector(){return m},tryInit:D,async dispose(){g={enabled:!1};for(let P of h)(await P).dispose()},async onUpdateSettings(P){g.enabled&&a(),P.editor?.colorDecorators?i():r.sendNotification("@/tailwindCSS/clearColors")},onFileEvents:L,async onHover(P){return id(async()=>{if(!g.enabled)return null;let S=s.getDocument(P.textDocument.uri);return!S||!(await g.editor.getConfiguration(S.uri)).tailwindCSS.hovers||await Fu(g,S)?null:UJ(g,S,P.position)},null)},async onCompletion(P){return id(async()=>{if(!g.enabled)return null;let S=s.getDocument(P.textDocument.uri);return!S||!(await g.editor.getConfiguration(S.uri)).tailwindCSS.suggestions||await Fu(g,S)?null:KJ(g,S,P.position,P.context)},null)},onCompletionResolve(P){return id(()=>g.enabled?GJ(g,P):null,null)},async onCodeAction(P){return id(async()=>{if(!g.enabled)return null;let S=s.getDocument(P.textDocument.uri);return!S||!(await g.editor.getConfiguration(S.uri)).tailwindCSS.codeActions?null:LY(g,P,S)},null)},onDocumentLinks(P){if(!g.enabled)return null;let S=s.getDocument(P.textDocument.uri);return S?bY(g,S,T=>w9.URI.file(jn.resolve(jn.dirname(w9.URI.parse(S.uri).fsPath),T)).toString()):null},provideDiagnostics:(0,_ue.debounce)(P=>{g.enabled&&pk(g,P)},n.initializationOptions?.testMode?0:500),provideDiagnosticsForce:P=>{g.enabled&&pk(g,P)},async onDocumentColor(P){return id(async()=>{if(!g.enabled)return[];let S=s.getDocument(P.textDocument.uri);return S?await Fu(g,S)?null:AY(g,S):[]},null)},async onColorPresentation(P){let S=s.getDocument(P.textDocument.uri);if(!S)return[];let T=S.getText(P.range),k=T.match(new RegExp(`-\\[(${uue.join("|")}|(?:(?:#|rgba?\\(|hsla?\\())[^\\]]+)\\]$`,"i"));if(k===null)return[];let N=k[1],R=uue.includes(N),O={mode:"rgb",r:P.color.red,g:P.color.green,b:P.color.blue,alpha:P.color.alpha},F=D_(O);if(!R&&(N.length===4||N.length===5)){let[,...C]=F.match(/^#([a-f\d])\1([a-f\d])\2([a-f\d])\3(?:([a-f\d])\4)?$/i)??[];C.length&&(F=`#${C.filter(Boolean).join("")}`)}F.length===5?F=F.replace(/f$/,""):F.length===9&&(F=F.replace(/ff$/,""));let B=T.substr(0,k.index);return[F,Bd(O).replace(/ /g,""),Hw(O).replace(/ /g,"").replace(/\d+\.\d+(%?)/g,(C,K)=>`${Math.round(parseFloat(C))}${K}`)].map(C=>({label:`${B}-[${C}]`}))},sortClassLists(P){return g.jit?P.map(S=>{let T="",k=S.split(/(\s+)/),N=k.filter((F,B)=>B%2===0),R=k.filter((F,B)=>B%2!==0);N[N.length-1]===""&&N.pop();let O;g.v4?O=g.designSystem.getClassOrder(N):g.jitContext.getClassOrder?O=g.jitContext.getClassOrder(N):O=UQe(g,N),N=O.sort(([,F],[,B])=>F===B?0:F===null?-1:B===null?1:Ud(F-B)).map(([F])=>F);for(let F=0;F<N.length;F++)T+=`${N[F]}${R[F]??""}`;return T}):P}}}function pue(e,t){let r=e.config.prefix;return typeof r=="function"?r(t):r+t}function UQe(e,t){let r=new Set([pue(e,"group"),pue(e,"peer")]),n=[];for(let s of t){let i=e.modules.jit.generateRules.module(new Set([s]),e.jitContext).sort(([o],[a])=>Ud(a-o))[0]?.[0]??null;i===null&&r.has(s)&&(i=e.jitContext.layerOrder.components),n.push([s,i])}return n}function jQe(e,t,r={}){let n=t.config,s=t.modules.postcss.module,i=t.browserslist,o=i&&i.includes("ie 11")?"ie11":"relaxed",a=typeof e=="function"?e:e.handler;try{a({addUtilities:()=>{},addComponents:()=>{},addBase:()=>{},matchUtilities:()=>{},addVariant:()=>{},e:u=>u,prefix:u=>u,theme:(u,c)=>(0,yH.default)(n,`theme.${u}`,c),variants:()=>[],config:(u,c)=>(0,yH.default)(n,u,c),corePlugins:u=>Array.isArray(n.corePlugins)?n.corePlugins.includes(u):(0,yH.default)(n,`corePlugins.${u}`,!0),target:u=>{if(typeof n.target=="string")return n.target==="browserslist"?o:n.target;let[c,H]=(0,yH.default)(n,"target"),l=(0,yH.default)(H,u,c);return l==="browserslist"?o:l},postcss:s,...r})}catch{}}function WQe(e){return e.type==="atrule"}function XQe(e){if(e.v4)return e.designSystem.getVariants();if(e.jitContext?.getVariants)return e.jitContext.getVariants();if(e.jit){let i=[];return Array.from(e.jitContext.variantMap).forEach(([o,a])=>{i.push({name:o,values:[],isArbitrary:!1,hasDash:!0,selectors:()=>{function u(A){let g=e.modules.postcssSelectorParser.module.className();return g.value=A,(0,yH.default)(g,"raws.value",g.value)}let c=(Array.isArray(a[0])?a:[a]).map(([A,g])=>g),H="__variant_placeholder__",l=e.modules.postcss.module.root({nodes:[e.modules.postcss.module.rule({selector:`.${u(H)}`,nodes:[]})]}),d=e.modules.postcssSelectorParser.module(A=>A.first.filter(({type:g})=>g==="class").pop().value);function f(A){return d.transformSync(A)}function h(A){return l.each(g=>{g.type==="rule"&&(g.selectors=g.selectors.map(_=>A({get className(){return f(_)},selector:_})))}),l}let m=[];for(let A of c){let g,_=l.clone(),L=_j(()=>A({container:_,separator:e.separator,modifySelectors:h,format:b=>{g=b.replace(/:merge\(([^)]+)\)/g,"$1")},wrap:b=>{WQe(b)&&(g=`@${b.name} ${b.params}`)}}));if(g||(g=L),g){m.push(g);continue}_.walkDecls(b=>{b.remove()}),g=_.toString().replace(`.${u(`${o}:${H}`)}`,"&").replace(/(?<!\\)[{}]/g,"").replace(/\s*\n\s*/g," ").trim(),g.includes(H)||m.push(g)}return m}})}),i}let t=e.config,r=e.modules.tailwindcss.version,n=["responsive","hover"];return Dr(r,"0.3.0")&&n.push("focus","group-hover"),Dr(r,"0.5.0")&&n.push("active"),Dr(r,"0.7.0")&&n.push("focus-within"),Dr(r,"1.0.0-beta.1")&&n.push("default"),Dr(r,"1.1.0")&&n.push("first","last","odd","even","disabled","visited"),Dr(r,"1.3.0")&&n.push("group-focus"),Dr(r,"1.5.0")&&n.push("focus-visible","checked"),Dr(r,"1.6.0")&&n.push("motion-safe","motion-reduce"),Dr(r,"2.0.0-alpha.1")&&n.push("dark"),(Array.isArray(t.plugins)?t.plugins:[]).forEach(i=>{jQe(i,e,{addVariant:o=>{n.push(o)}})}),n.map(i=>({name:i,values:[],isArbitrary:!1,hasDash:!0,selectors:()=>[]}))}async function VQe(e){let t=e.plugins;return Array.isArray(t)?Promise.all(t.map(async r=>{let n=r.config;CH(n)||(n={});let s={theme:CH(n.theme)?Object.keys(n.theme):[],variants:CH(n.variants)?Object.keys(n.variants):[]},i=r.handler||r,o=typeof i.name=="string"&&i.name!=="handler"&&i.name!==""?i.name:null;try{i()}catch(a){let u=mue.default.parse(a);if(u.length===0)return{name:o};let c=u[0].fileName,H=jn.dirname(c);if(!hue.default.sync({cwd:H}))return{name:o};let d;try{d=require(d)}catch{return{name:o}}if(d.name&&jn.resolve(H,d.main||"index.js")===c)return{name:d.name,homepage:d.homepage,contributes:s}}return{name:o}})):[]}function qQe(e,t){try{let r=oc.default.sync(n=>{let s=jn.join(n,"package.json");if(oc.default.sync.exists(s))return s;if(n===jn.normalize(t))return oc.default.stop},{cwd:e});return r?jn.dirname(r):t}catch{return t}}function due(e,t,r,n){let s=n??require(e),i=s.content?.files??s.content,o=Array.isArray(i)?i:[],a=Dr(t,"3.2.0")?s.future?.relativeContentPathsByDefault||s.content?.relative:!1,u;return a?u=jn.dirname(e):u=qQe(jn.dirname(e),r),o.filter(c=>typeof c=="string").map(c=>c.startsWith("!")?`!${jn.resolve(u,c.slice(1))}`:jn.resolve(u,c)).map(c=>({pattern:Bs(Zi(c)),priority:1}))}var vue=Kt(Sue());function aet(){return{editor:{tabSize:2},tailwindCSS:{emmetCompletions:!1,classAttributes:["class","className","ngClass","class:list"],codeActions:!0,hovers:!0,suggestions:!0,validate:!0,colorDecorators:!0,rootFontSize:16,lint:{cssConflict:"warning",invalidApply:"error",invalidScreen:"error",invalidVariant:"error",invalidConfigPath:"error",invalidTailwindDirective:"error",recommendedVariantOrder:"warning"},showPixelEquivalents:!0,includeLanguages:{},files:{exclude:["**/.git/**","**/node_modules/**","**/.hg/**","**/.svn/**"]},experimental:{classRegex:[],configFile:null}}}}function Tue(e){let t=new Map;async function r(s){let i=t.get(s);return i||(i=await n(s),t.set(s,i)),i}async function n(s){let[i,o]=await Promise.all([e.workspace.getConfiguration({section:"editor",scopeUri:s}),e.workspace.getConfiguration({section:"tailwindCSS",scopeUri:s})]);return i=CH(i)?i:{},o=CH(o)?o:{},(0,vue.default)(aet(),{editor:i,tailwindCSS:o},{arrayMerge:(a,u,c)=>u})}return{get:r,clear(){t.clear()}}}var pce=Kt(require("node:os")),ls=Kt(require("node:path")),S1=Kt(require("node:fs/promises")),dce=Kt(uce()),fce=Kt(Zh());var Ob=class{constructor(){this.parents=new Map;this.children=new Map;this.nodes=new Map}add(t,r){return this.nodes.has(t)?this.nodes.get(t):(this.nodes.set(t,r),this.parents.set(t,new Set),this.children.set(t,new Set),r)}connect(t,r){let n=this.children.get(t);if(!n)throw new Error(`Node ${t} does not exist`);let s=this.parents.get(r);if(!s)throw new Error(`Node ${r} does not exist`);s.add(t),n.add(r)}*descendants(t){let r=[],n=new Set;for(let s of this.children.get(t))r.push(s);for(;r.length>0;){let s=r.shift();if(!n.has(s)){yield this.nodes.get(s),n.add(s);for(let i of this.children.get(s))r.push(i)}}}*roots(){for(let[t,r]of this.parents)r.size===0&&(yield this.nodes.get(t))}*leaves(){for(let[t,r]of this.children)r.size===0&&(yield this.nodes.get(t))}};var Rb=class extends Map{remember(t,r){let n=super.get(t);return n||(n=r(t),this.set(t,n)),n}};var Fb=Kt(BP()),th=Kt(require("node:path"));async function hF(e,t){async function r(n){let s=th.join(n,"package.json");if(await Fb.default.exists(s))return s;if(n===th.normalize(t))return Fb.default.stop}try{let n=await(0,Fb.default)(r,{cwd:e});return n?th.dirname(n):t}catch{return t}}async function Ttt(e){let t=await import(e);return t.scanDir?t:null}async function cce(e){let t=await Ttt(e.oxidePath);if(!t)return null;if(Bc(e.oxideVersion,"4.0.0-alpha.18")){let n=t.scanDir?.({base:e.basePath,globs:!0});return{files:n.files,globs:n.globs.map(s=>({base:s.base,pattern:s.glob}))}}if(Bc(e.oxideVersion,"4.0.0-alpha.19")){let n=t.scanDir({base:e.basePath,sources:e.sources});return{files:n.files,globs:n.globs}}let r=new t.Scanner({detectSources:{base:e.basePath},sources:e.sources});return{files:r.files,globs:r.globs}}var Bb=class{constructor(t,r){this.base=t;this.settings=r}async search(){let t=await this.findConfigs(),r=await Promise.allSettled(t.map(s=>this.createProject(s))),n=[];for(let s of r)s.status==="rejected"?console.error(`[GLOBAL] Error creating project: ${s.reason}`):s.status==="fulfilled"&&s.value&&n.push(s.value);n.length===1&&n[0].documentSelector.push({pattern:Zi(ls.join(this.base,"**")),priority:5});for(let s of n){s.folder=Bs(s.folder),s.configPath=Bs(s.configPath),s.config.path=Bs(s.config.path);for(let i of s.config.entries)i.path=Bs(i.path);for(let i of s.documentSelector)i.pattern=Bs(i.pattern)}return n}async loadAllFromWorkspace(t){return Promise.all(t.map(r=>this.loadFromWorkspace(r[0],r[1])))}async loadFromWorkspace(t,r){let n={type:"js",path:t,source:"js",entries:[],content:[],packageRoot:""},s=await this.detectTailwindVersion(n);return n.packageRoot=await hF(ls.dirname(n.path),this.base),{config:n,folder:this.base,isUserConfigured:!0,configPath:n.path,documentSelector:r.map(i=>({priority:0,pattern:i})),tailwind:s}}async createProject(t){let r=await this.detectTailwindVersion(t);if(console.log(JSON.stringify({tailwind:r})),t.type==="js"&&t.source==="css"&&(r.isDefaultVersion||!r.features.includes("css-at-config"))||t.type==="css"&&!r.features.includes("css-at-theme")||t.type==="js"&&r.features.includes("css-at-theme")||t.type==="js"&&(t.path.endsWith(".ts")||t.path.endsWith(".mjs"))&&!r.features.includes("transpiled-configs"))return null;t.packageRoot=await hF(ls.dirname(t.path),this.base);let n=[];for(let s of t.entries)s.type==="css"&&n.push({pattern:s.path,priority:0});n.push({pattern:t.path,priority:0});for await(let s of $tt(t,r.features))n.push(s);for(let s of t.entries)s.type==="css"&&n.push({pattern:Zi(ls.join(ls.dirname(s.path),"**")),priority:2});return n.push({pattern:Zi(ls.join(ls.dirname(t.path),"**")),priority:3}),n.push({pattern:Zi(ls.join(t.packageRoot,"**")),priority:4}),n.sort((s,i)=>s.priority-i.priority),n=n.filter(({pattern:s},i,o)=>o.findIndex(({pattern:a})=>a===s)===i),{config:t,folder:this.base,isUserConfigured:!1,configPath:t.path,documentSelector:n,tailwind:r}}async findConfigs(){let t=await(0,dce.default)([`**/${rd}`,`**/${du}`],{cwd:this.base,ignore:this.settings.tailwindCSS.files.exclude,onlyFiles:!0,absolute:!0,suppressErrors:!0,dot:!0,concurrency:Math.max(pce.cpus().length,1)}),r=await Promise.all(t.map(d=>S1.realpath(d)));t=t.filter((d,f)=>{let h=r[f];return d===h?!0:!t.includes(h)}),t=t.map(d=>Zi(d)),t=Array.from(new Set(t)).sort();let n=new Rb,s=(0,fce.default)(`**/${du}`,{dot:!0}),i=t.map(d=>s(d)?new Ub("css",d):new Ub("js",d,[n.remember(d,()=>({source:"js",type:"js",path:d,entries:[],packageRoot:null,content:[]}))])),o=i.filter(d=>d.type==="css");await Promise.all(o.map(d=>d.read()));let a=[];for(let d of o){if(!d.content)continue;let f=d.configPathInCss();if(f){d.content=null,d.configs.push(n.remember(f,()=>({source:"css",type:"js",path:f,entries:[],packageRoot:null,content:[]})));continue}if(d.isMaybeTailwindRelated()){a.push(d);continue}}await Promise.all(a.map(d=>d.resolveImports())),await Promise.all(a.map(d=>d.resolveRealpaths())),await Promise.all(a.map(d=>d.resolveSourceDirectives()));let u=new Ob,c=null,H=null,l=null;for(let d of a){u.add(d.realpath,d);for(let f of d.deps)u.add(f.realpath,f),u.connect(d.realpath,f.realpath);d.realpath.includes("node_modules/tailwindcss/index.css")?c=d.realpath:d.realpath.includes("node_modules/tailwindcss/theme.css")?H=d.realpath:d.realpath.includes("node_modules/tailwindcss/utilities.css")&&(l=d.realpath)}c&&H&&u.connect(c,H),c&&l&&u.connect(c,l);for(let d of u.roots()){let f=n.remember(d.path,()=>({source:"css",type:"css",path:d.path,entries:[],packageRoot:null,content:[{kind:"auto"}]}));d.configs.push(f);for(let h of u.descendants(d.realpath))h.configs.push(f)}for(let d of i)for(let f of d.configs)f.entries.push(d);return Array.from(n.values())}async detectTailwindVersion(t){try{let s=Jr(ls.dirname(t.path),"tailwindcss/package.json"),{version:i}=require(s),o=iE(i);if(typeof i=="string")return{version:i,features:o,isDefaultVersion:!1}}catch{}let{version:r}=NE(),n=iE(r);return{version:r,features:n,isDefaultVersion:!0}}};function $tt(e,t,r){if(e.type==="css")return xtt(e);if(e.type==="js")return Dtt(e,t,r)}async function*Dtt(e,t,r){let n;try{n=r??require(e.path)}catch{return}let s=n.content?.files??n.content,i=Array.isArray(s)?s:[],a=(t.includes("relative-content-paths")?n.future?.relativeContentPathsByDefault||n.content?.relative:!1)?ls.dirname(e.path):e.packageRoot;for(let u of i){if(typeof u!="string")continue;let c=u.startsWith("!")?`!${ls.resolve(a,u.slice(1))}`:ls.resolve(a,u);yield{pattern:Zi(c),priority:1}}}async function*xtt(e){let t=!1;for(let r of e.content)if(r.kind==="file")yield{pattern:Zi(r.file),priority:1};else if(r.kind==="auto"&&!t){t=!0;let n=e.entries.flatMap(s=>s.sources);for await(let s of Ctt(e.packageRoot,e.path,n))yield{pattern:s,priority:1}}}async function*Ctt(e,t,r){try{let n=Jr(ls.dirname(e),"@tailwindcss/oxide");n=Sg(n).href;let s=Jr(ls.dirname(e),"@tailwindcss/oxide/package.json"),i=JSON.parse(await S1.readFile(s,"utf8")),o=await cce({oxidePath:n,oxideVersion:i.version,basePath:e,sources:r.map(a=>({base:ls.dirname(t),pattern:a}))});if(!o)return;for(let a of o.files)yield Zi(a);for(let{base:a,pattern:u}of o.globs)yield Zi(a)+"/"+u}catch{}}var Ub=class e{constructor(t,r,n=[]){this.type=t;this.path=r;this.configs=n;this.deps=[];this.sources=[]}async read(){try{this.content=await sp(this.path)}catch{this.content=null}}async resolveImports(){try{let t=await gI().process(this.content,{from:this.path}),r=t.messages.filter(n=>n.type==="dependency");this.deps=r.map(n=>new e("css",Zi(n.file))),this.content=t.css}catch{}}async resolveRealpaths(){this.realpath=Zi(await S1.realpath(this.path)),await Promise.all(this.deps.map(t=>t.resolveRealpaths()))}async resolveSourceDirectives(){this.sources.length>0||await Va([WQ(this.sources)]).process(this.content,{from:this.realpath})}configPathInCss(){if(!this.content)return null;let t=this.content.match(/@config\s*(?<config>'[^']+'|"[^"]+")/);return t?Zi(ls.resolve(ls.dirname(this.path),t.groups.config.slice(1,-1))):null}isMaybeTailwindRelated(){if(!this.content)return!1;let t=/@import\s*(?<config>'[^']+'|"[^"]+");/,r=/@tailwind\s*[^;]+;/,n=/@theme\s*\{/;return t.test(this.content)||r.test(this.content)||n.test(this.content)}};var upe=['"',"'","`"," ",".","(","[","]","!","/","-"];async function cpe(e){let t=await sp(e);if(!t)return null;let r=t.match(/@config\s*(?<config>'[^']+'|"[^"]+")/);return r?Bs((0,sh.default)(Oo.resolve(Oo.dirname(e),r.groups.config.slice(1,-1)))):null}var tS=class{constructor(t){this.connection=t;this.lspHandlersAdded=!1;this.disposables=[];this.watchPatterns=()=>{};this.watched=[];this.documentService=new Pg(this.connection),this.projects=new Map,this.projectCounter=0,this.settingsCache=Tue(t)}async init(){this.initPromise||(this.initPromise=this._init()),await this.initPromise}getWorkspaceFolders(){return this.initializeParams.workspaceFolders?.length?this.initializeParams.workspaceFolders.map(t=>({uri:Gl.URI.parse(t.uri).fsPath,name:t.name})):this.initializeParams.rootUri?[{uri:Gl.URI.parse(this.initializeParams.rootUri).fsPath,name:"Root"}]:this.initializeParams.rootPath?[{uri:Gl.URI.file(this.initializeParams.rootPath).fsPath,name:"Root"}]:[]}async _init(){zh();let t=this.getWorkspaceFolders().map(n=>(0,sh.default)(n.uri));if(t.length===0){console.error("No workspace folders found, not initializing.");return}let r=await Promise.allSettled(t.map(n=>this._initFolder(Gl.URI.file(n))));for(let[n,s]of r.entries())s.status==="rejected"&&console.error("Failed to initialize workspace folder",t[n],s.reason);await this.listenForEvents()}async _initFolder(t){let r=this.initializeParams.initializationOptions?.userLanguages??{};Object.keys(r).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 n=t.fsPath,s=[],i=await this.settingsCache.get(),o=i.tailwindCSS.files.exclude,a=await this.settingsCache.get(t.toString()),u={...r,...a.tailwindCSS.includeLanguages??{}},c=new Map,H=new Map,l=this.initializeParams.initializationOptions?.workspaceFile?Oo.dirname(this.initializeParams.initializationOptions.workspaceFile):n;function d(b){function D(I){return Bs((0,sh.default)(Oo.resolve(l,I)))}let v=b.experimental.configFile,x={};if(typeof v=="string"){let I=D(v),P=[D(Oo.resolve(n,"**"))];x[I]=P}else if(CH(v))for(let[I,P]of Object.entries(v)){if(typeof I!="string")return null;I=D(I);let S;if(typeof P=="string")S=[D(P)];else if(Array.isArray(P))S=P.map(D);else return null;x[I]=S}else if(v)return null;return Object.entries(x)}let f=d(i.tailwindCSS);if(f===null){console.error("Invalid `experimental.configFile` configuration, not initializing.");return}let h=new Bb(n,i);f.length>0?(console.log("Loading Tailwind CSS projects from the workspace settings."),s=await h.loadAllFromWorkspace(f)):(console.log("Searching for Tailwind CSS projects in the workspace's folders."),s=await h.search());for(let b of s)if(H.set(b.config.path,b.tailwind.version),b.config.source==="css")for(let D of b.config.entries)D.type==="css"&&c.set(D.path,b.config.path);let m=s.map(b=>({folder:b.folder,config:b.config.path,selectors:b.documentSelector,user:b.isUserConfigured,tailwind:b.tailwind}));console.log(`[Global] Creating projects: ${JSON.stringify(m)}`);let A=async b=>{let D=!1,v=!1,x=(0,Zl.default)(`**/${nd}`,{dot:!0}),I=(0,Zl.default)(`**/${du}`,{dot:!0}),P=(0,Zl.default)(`**/${rd}`,{dot:!0});e:for(let S of b){let T=(0,sh.default)(S.file);T=Bs(T);for(let O of o)if((0,Zl.default)(O,{dot:!0})(T))continue e;if(x(T))for(let[,O]of this.projects){let F=NE().version;try{let B=require(Jr(Oo.dirname(O.projectConfig.configPath),"tailwindcss/package.json")).version;typeof B=="string"&&(F=B)}catch{}if(H.get(O.projectConfig.configPath)!==F){D=!0;break e}}for(let[,O]of this.projects){if(!O.state.v4)continue;let F=[O.projectConfig.configPath,...O.projectConfig.config.entries.map(B=>B.path)];if(sd(T,F)){v=!0;break e}}if(I(`**/${du}`)&&S.type!==Kn.FileChangeType.Deleted){let O=await cpe(T)||await cpe(S.file);if(c.has(T)&&c.get(T)!==O){D=!0;break}else if(!c.has(T)&&O){D=!0;break}}if(P(T)&&S.type===Kn.FileChangeType.Created){D=!0;break}for(let[,O]of this.projects)if(S.type===Kn.FileChangeType.Deleted&&sd(T,[O.projectConfig.configPath])){D=!0;break e}}if(D){this.restart();return}if(v){try{await this.softRestart()}catch{this.restart()}return}for(let[,S]of this.projects)S.onFileEvents(b)};if(this.initializeParams.capabilities.workspace?.didChangeWatchedFiles?.dynamicRegistration){this.disposables.push(this.connection.onDidChangeWatchedFiles(async({changes:D})=>{let v=D.map(({uri:x,type:I})=>({file:Gl.URI.parse(x).fsPath,type:I})).filter((x,I,P)=>P.findIndex(S=>S.file===x.file&&S.type===x.type)===I);await A(v)}));let b=await this.connection.client.register(Kn.DidChangeWatchedFilesNotification.type,{watchers:[{globPattern:`**/${rd}`},{globPattern:`**/${nd}`},{globPattern:`**/${du}`}]});this.disposables.push(b),this.watchPatterns=D=>{let v=this.filterNewWatchPatterns(D);v.length&&(console.log(`[Global] Adding watch patterns: ${v.join(", ")}`),this.connection.client.register(Kn.DidChangeWatchedFilesNotification.type,{watchers:v.map(x=>({globPattern:x}))}).then(x=>{this.disposables.push(x)}))}}else if(rS.getBinding()){let b={create:Kn.FileChangeType.Created,update:Kn.FileChangeType.Changed,delete:Kn.FileChangeType.Deleted},D=await rS.subscribe(n,(v,x)=>{A(x.map(I=>({file:I.path,type:b[I.type]})))},{ignore:o.map(v=>Oo.resolve(n,v.replace(/^[*/]+/,"").replace(/[*/]+$/,"")))});this.disposables.push({dispose(){D.unsubscribe()}})}else{let b=lpe().watch,D=b([`**/${rd}`,`**/${nd}`,`**/${du}`],{cwd:n,ignorePermissionErrors:!0,ignoreInitial:!0,ignored:o,awaitWriteFinish:{stabilityThreshold:100,pollInterval:20}});await new Promise(v=>{D.on("ready",()=>v())}),D.on("add",v=>A([{file:Oo.resolve(n,v),type:Kn.FileChangeType.Created}])).on("change",v=>A([{file:Oo.resolve(n,v),type:Kn.FileChangeType.Changed}])).on("unlink",v=>A([{file:Oo.resolve(n,v),type:Kn.FileChangeType.Deleted}])),this.disposables.push({dispose(){D.close()}}),this.watchPatterns=v=>{let x=this.filterNewWatchPatterns(v);x.length&&(console.log(`[Global] Adding watch patterns: ${x.join(", ")}`),D.add(x))}}console.log("[Global] Preparing projects..."),await Promise.all(s.map(b=>this.addProject(b,this.initializeParams,this.watchPatterns,H.get(b.configPath),u))),console.log("[Global] Initializing projects...");let g=[],_=0;for(let b of this.documentService.getAllDocuments()){let D=this.getProject(b);D&&!D.enabled()&&(D.enable(),await D.tryInit(),_++),g.push(b.uri)}console.log(`[Global] Initialized ${_} projects`),this.setupLSPHandlers(),this.disposables.push(this.connection.onDidChangeConfiguration(async({settings:b})=>{let D=i.tailwindCSS.files.exclude;if(this.settingsCache.clear(),i=await this.settingsCache.get(),!so(D,i.tailwindCSS.files.exclude)){this.restart();return}for(let[,v]of this.projects)v.onUpdateSettings(b)})),(this.initializeParams.initializationOptions?.testMode??!1)&&(console.log("[Global][Test] Sending document notifications..."),await Promise.all(g.map(b=>this.connection.sendNotification("@/tailwindCSS/documentReady",{uri:b}))))}async listenForEvents(){let t=this.initializeParams.initializationOptions?.testMode??!1;this.disposables.push(this.connection.onShutdown(()=>{this.dispose()})),this.disposables.push(this.documentService.onDidChangeContent(r=>{this.getProject(r.document)?.provideDiagnostics(r.document)})),this.disposables.push(this.documentService.onDidOpen(async r=>{let n=this.getProject(r.document);n&&(n.enabled()||(n.enable(),await n.tryInit()),t&&await this.connection.sendNotification("@/tailwindCSS/documentReady",{uri:r.document.uri}))})),this.initializeParams.capabilities.workspace.workspaceFolders&&this.disposables.push(this.connection.workspace.onDidChangeWorkspaceFolders(async r=>{let n=r.added.map(s=>({uri:Gl.URI.parse(s.uri).fsPath,name:s.name})).map(s=>(0,sh.default)(s.uri));await Promise.allSettled(n.map(s=>this._initFolder(Gl.URI.file(s))))}))}filterNewWatchPatterns(t){return t=Array.from(new Set(t)),t=t.filter(r=>!this.watched.includes(r)),this.watched.push(...t),t}async addProject(t,r,n,s,i){let o=String(this.projectCounter++),a=await Lue(o,t,this.connection,r,this.documentService,()=>this.updateCapabilities(),()=>{for(let u of this.documentService.getAllDocuments()){let c=this.getProject(u);if(c&&!c.enabled()){c.enable(),c.tryInit();break}}},()=>this.refreshDiagnostics(),u=>n(u),s,this.settingsCache.get,i);this.projects.set(o,a),this.supportsTailwindProjectDetails&&this.connection.sendNotification("@/tailwindCSS/projectDetails",{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 r=this.getProject(t);r?r.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.onDocumentLinks(this.onDocumentLinks.bind(this)),this.connection.onRequest(this.onRequest.bind(this)))}onRequest(t,r){if(t==="@/tailwindCSS/sortSelection"){let n=this.getProject({uri:r.uri});if(!n)return{error:"no-project"};try{return{classLists:n.sortClassLists(r.classLists)}}catch{return{error:"unknown"}}}if(t==="@/tailwindCSS/getProject"){let n=this.getProject({uri:r.uri});return!n||!n.enabled()||!n.state?.enabled?null:{version:n.state.version}}}updateCapabilities(){if(!ppe(this.initializeParams))return;this.registrations&&this.registrations.then(n=>n.dispose());let t=Array.from(this.projects.values()),r=Kn.BulkRegistration.create();r.add(Kn.HoverRequest.type,{documentSelector:null}),r.add(Kn.DocumentColorRequest.type,{documentSelector:null}),r.add(Kn.CodeActionRequest.type,{documentSelector:null}),r.add(Kn.DocumentLinkRequest.type,{documentSelector:null}),r.add(Kn.CompletionRequest.type,{documentSelector:null,resolveProvider:!0,triggerCharacters:[...upe,...t.map(n=>n.state.separator).filter(n=>typeof n=="string").map(n=>n.slice(-1))].filter(Boolean)}),this.registrations=this.connection.client.register(r)}getProject(t){let r,n,s=1/0,i=Gl.URI.parse(t.uri),o=i.fsPath,a=i.path;o=Bs(o);for(let c of this.projects.values()){if(!c.projectConfig.configPath){r=r??c;continue}let H=c.documentSelector().concat().sort((l,d)=>l.pattern.startsWith("!")&&!d.pattern.startsWith("!")?-1:!l.pattern.startsWith("!")&&d.pattern.startsWith("!")?1:0);for(let l of H){let d=l.pattern.replace(/[\[\]{}()]/g,f=>`\\${f}`);if(d.startsWith("!")&&((0,Zl.default)(d.slice(1),{dot:!0})(o)||(0,Zl.default)(d.slice(1),{dot:!0})(a)))break;if((0,Zl.default)(d,{dot:!0})(o)&&l.priority<s){n=c,s=l.priority;continue}if((0,Zl.default)(d,{dot:!0})(a)&&l.priority<s){n=c,s=l.priority;continue}}}let u=n??r;return u||console.debug("[GLOBAL] No matching project for document",{fsPath:o,normalPath:a}),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 onDocumentLinks(t){return await this.init(),this.getProject(t.textDocument)?.onDocumentLinks(t)??null}setup(){this.connection.onInitialize(async t=>(this.initializeParams=t,ppe(t)?{capabilities:{textDocumentSync:Kn.TextDocumentSyncKind.Full}}:(this.setupLSPHandlers(),{capabilities:{textDocumentSync:Kn.TextDocumentSyncKind.Full,hoverProvider:!0,colorProvider:!0,codeActionProvider:!0,documentLinkProvider:{},completionProvider:{resolveProvider:!0,triggerCharacters:[...upe,":"]}}}))),this.connection.onInitialized(()=>this.init())}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.registrations&&(this.registrations.then(t=>t.dispose()),this.registrations=void 0),this.disposables.forEach(t=>t.dispose()),this.disposables.length=0,this.watched.length=0}restart(){console.log(`----------
1284
+ `),{from:void 0})}catch(Z){throw Z}finally{B?.unhook()}g.dependencies=fI(g.configPath),u((g.dependencies??[]).flatMap(Z=>$b(Z,t.folder))),g.configId=cue(g.configPath,g.dependencies),g.plugins=await VQe(O),C&&(g.classNames=await Gq(C.root)),g.variants=XQe(g);let K=(0,yH.default)(g.config,"theme.screens",(0,yH.default)(g.config,"screens",{}));g.screens=CH(K)?Object.keys(K):[],g.enabled=!0,a(),i()}return{projectConfig:t,enabled(){return d},enable(){d=!0},async reload(){if(!g.v4)return;console.log("---- RELOADING DESIGN SYSTEM ----");let P=await sp(g.configPath),S=await Dk(g.modules.tailwindcss.module,g.configPath,P),T=Object.create(g,{designSystem:{value:S}}),k=S.getClassList().map(N=>[N[0],{...N[1],color:Ao(T,N[0])}]);g.designSystem=S,g.classList=k,console.log("---- RELOADED ----")},state:g,documentSelector(){return m},tryInit:D,async dispose(){g={enabled:!1};for(let P of h)(await P).dispose()},async onUpdateSettings(P){g.enabled&&a(),P.editor?.colorDecorators?i():r.sendNotification("@/tailwindCSS/clearColors")},onFileEvents:L,async onHover(P){return id(async()=>{if(!g.enabled)return null;let S=s.getDocument(P.textDocument.uri);return!S||!(await g.editor.getConfiguration(S.uri)).tailwindCSS.hovers||await Fu(g,S)?null:UJ(g,S,P.position)},null)},async onCompletion(P){return id(async()=>{if(!g.enabled)return null;let S=s.getDocument(P.textDocument.uri);return!S||!(await g.editor.getConfiguration(S.uri)).tailwindCSS.suggestions||await Fu(g,S)?null:KJ(g,S,P.position,P.context)},null)},onCompletionResolve(P){return id(()=>g.enabled?GJ(g,P):null,null)},async onCodeAction(P){return id(async()=>{if(!g.enabled)return null;let S=s.getDocument(P.textDocument.uri);return!S||!(await g.editor.getConfiguration(S.uri)).tailwindCSS.codeActions?null:LY(g,P,S)},null)},onDocumentLinks(P){if(!g.enabled)return null;let S=s.getDocument(P.textDocument.uri);return S?bY(g,S,T=>w9.URI.file(jn.resolve(jn.dirname(w9.URI.parse(S.uri).fsPath),T)).toString()):null},provideDiagnostics:(0,_ue.debounce)(P=>{g.enabled&&pk(g,P)},n.initializationOptions?.testMode?0:500),provideDiagnosticsForce:P=>{g.enabled&&pk(g,P)},async onDocumentColor(P){return id(async()=>{if(!g.enabled)return[];let S=s.getDocument(P.textDocument.uri);return S?await Fu(g,S)?null:AY(g,S):[]},null)},async onColorPresentation(P){let S=s.getDocument(P.textDocument.uri);if(!S)return[];let T=S.getText(P.range),k=T.match(new RegExp(`-\\[(${uue.join("|")}|(?:(?:#|rgba?\\(|hsla?\\())[^\\]]+)\\]$`,"i"));if(k===null)return[];let N=k[1],R=uue.includes(N),O={mode:"rgb",r:P.color.red,g:P.color.green,b:P.color.blue,alpha:P.color.alpha},F=D_(O);if(!R&&(N.length===4||N.length===5)){let[,...C]=F.match(/^#([a-f\d])\1([a-f\d])\2([a-f\d])\3(?:([a-f\d])\4)?$/i)??[];C.length&&(F=`#${C.filter(Boolean).join("")}`)}F.length===5?F=F.replace(/f$/,""):F.length===9&&(F=F.replace(/ff$/,""));let B=T.substr(0,k.index);return[F,Bd(O).replace(/ /g,""),Hw(O).replace(/ /g,"").replace(/\d+\.\d+(%?)/g,(C,K)=>`${Math.round(parseFloat(C))}${K}`)].map(C=>({label:`${B}-[${C}]`}))},sortClassLists(P){return g.jit?P.map(S=>{let T="",k=S.split(/(\s+)/),N=k.filter((F,B)=>B%2===0),R=k.filter((F,B)=>B%2!==0);N[N.length-1]===""&&N.pop();let O;g.v4?O=g.designSystem.getClassOrder(N):g.jitContext.getClassOrder?O=g.jitContext.getClassOrder(N):O=UQe(g,N),N=O.sort(([,F],[,B])=>F===B?0:F===null?-1:B===null?1:Ud(F-B)).map(([F])=>F);for(let F=0;F<N.length;F++)T+=`${N[F]}${R[F]??""}`;return T}):P}}}function pue(e,t){let r=e.config.prefix;return typeof r=="function"?r(t):r+t}function UQe(e,t){let r=new Set([pue(e,"group"),pue(e,"peer")]),n=[];for(let s of t){let i=e.modules.jit.generateRules.module(new Set([s]),e.jitContext).sort(([o],[a])=>Ud(a-o))[0]?.[0]??null;i===null&&r.has(s)&&(i=e.jitContext.layerOrder.components),n.push([s,i])}return n}function jQe(e,t,r={}){let n=t.config,s=t.modules.postcss.module,i=t.browserslist,o=i&&i.includes("ie 11")?"ie11":"relaxed",a=typeof e=="function"?e:e.handler;try{a({addUtilities:()=>{},addComponents:()=>{},addBase:()=>{},matchUtilities:()=>{},addVariant:()=>{},e:u=>u,prefix:u=>u,theme:(u,c)=>(0,yH.default)(n,`theme.${u}`,c),variants:()=>[],config:(u,c)=>(0,yH.default)(n,u,c),corePlugins:u=>Array.isArray(n.corePlugins)?n.corePlugins.includes(u):(0,yH.default)(n,`corePlugins.${u}`,!0),target:u=>{if(typeof n.target=="string")return n.target==="browserslist"?o:n.target;let[c,H]=(0,yH.default)(n,"target"),l=(0,yH.default)(H,u,c);return l==="browserslist"?o:l},postcss:s,...r})}catch{}}function WQe(e){return e.type==="atrule"}function XQe(e){if(e.v4)return e.designSystem.getVariants();if(e.jitContext?.getVariants)return e.jitContext.getVariants();if(e.jit){let i=[];return Array.from(e.jitContext.variantMap).forEach(([o,a])=>{i.push({name:o,values:[],isArbitrary:!1,hasDash:!0,selectors:()=>{function u(A){let g=e.modules.postcssSelectorParser.module.className();return g.value=A,(0,yH.default)(g,"raws.value",g.value)}let c=(Array.isArray(a[0])?a:[a]).map(([A,g])=>g),H="__variant_placeholder__",l=e.modules.postcss.module.root({nodes:[e.modules.postcss.module.rule({selector:`.${u(H)}`,nodes:[]})]}),d=e.modules.postcssSelectorParser.module(A=>A.first.filter(({type:g})=>g==="class").pop().value);function f(A){return d.transformSync(A)}function h(A){return l.each(g=>{g.type==="rule"&&(g.selectors=g.selectors.map(_=>A({get className(){return f(_)},selector:_})))}),l}let m=[];for(let A of c){let g,_=l.clone(),L=_j(()=>A({container:_,separator:e.separator,modifySelectors:h,format:b=>{g=b.replace(/:merge\(([^)]+)\)/g,"$1")},wrap:b=>{WQe(b)&&(g=`@${b.name} ${b.params}`)}}));if(g||(g=L),g){m.push(g);continue}_.walkDecls(b=>{b.remove()}),g=_.toString().replace(`.${u(`${o}:${H}`)}`,"&").replace(/(?<!\\)[{}]/g,"").replace(/\s*\n\s*/g," ").trim(),g.includes(H)||m.push(g)}return m}})}),i}let t=e.config,r=e.modules.tailwindcss.version,n=["responsive","hover"];return Dr(r,"0.3.0")&&n.push("focus","group-hover"),Dr(r,"0.5.0")&&n.push("active"),Dr(r,"0.7.0")&&n.push("focus-within"),Dr(r,"1.0.0-beta.1")&&n.push("default"),Dr(r,"1.1.0")&&n.push("first","last","odd","even","disabled","visited"),Dr(r,"1.3.0")&&n.push("group-focus"),Dr(r,"1.5.0")&&n.push("focus-visible","checked"),Dr(r,"1.6.0")&&n.push("motion-safe","motion-reduce"),Dr(r,"2.0.0-alpha.1")&&n.push("dark"),(Array.isArray(t.plugins)?t.plugins:[]).forEach(i=>{jQe(i,e,{addVariant:o=>{n.push(o)}})}),n.map(i=>({name:i,values:[],isArbitrary:!1,hasDash:!0,selectors:()=>[]}))}async function VQe(e){let t=e.plugins;return Array.isArray(t)?Promise.all(t.map(async r=>{let n=r.config;CH(n)||(n={});let s={theme:CH(n.theme)?Object.keys(n.theme):[],variants:CH(n.variants)?Object.keys(n.variants):[]},i=r.handler||r,o=typeof i.name=="string"&&i.name!=="handler"&&i.name!==""?i.name:null;try{i()}catch(a){let u=mue.default.parse(a);if(u.length===0)return{name:o};let c=u[0].fileName,H=jn.dirname(c);if(!hue.default.sync({cwd:H}))return{name:o};let d;try{d=require(d)}catch{return{name:o}}if(d.name&&jn.resolve(H,d.main||"index.js")===c)return{name:d.name,homepage:d.homepage,contributes:s}}return{name:o}})):[]}function qQe(e,t){try{let r=oc.default.sync(n=>{let s=jn.join(n,"package.json");if(oc.default.sync.exists(s))return s;if(n===jn.normalize(t))return oc.default.stop},{cwd:e});return r?jn.dirname(r):t}catch{return t}}function due(e,t,r,n){let s=n??require(e),i=s.content?.files??s.content,o=Array.isArray(i)?i:[],a=Dr(t,"3.2.0")?s.future?.relativeContentPathsByDefault||s.content?.relative:!1,u;return a?u=jn.dirname(e):u=qQe(jn.dirname(e),r),o.filter(c=>typeof c=="string").map(c=>c.startsWith("!")?`!${jn.resolve(u,c.slice(1))}`:jn.resolve(u,c)).map(c=>({pattern:Bs(Zi(c)),priority:1}))}var vue=Kt(Sue());function aet(){return{editor:{tabSize:2},tailwindCSS:{emmetCompletions:!1,classAttributes:["class","className","ngClass","class:list"],codeActions:!0,hovers:!0,suggestions:!0,validate:!0,colorDecorators:!0,rootFontSize:16,lint:{cssConflict:"warning",invalidApply:"error",invalidScreen:"error",invalidVariant:"error",invalidConfigPath:"error",invalidTailwindDirective:"error",recommendedVariantOrder:"warning"},showPixelEquivalents:!0,includeLanguages:{},files:{exclude:["**/.git/**","**/node_modules/**","**/.hg/**","**/.svn/**"]},experimental:{classRegex:[],configFile:null}}}}function Tue(e){let t=new Map;async function r(s){let i=t.get(s);return i||(i=await n(s),t.set(s,i)),i}async function n(s){let[i,o]=await Promise.all([e.workspace.getConfiguration({section:"editor",scopeUri:s}),e.workspace.getConfiguration({section:"tailwindCSS",scopeUri:s})]);return i=CH(i)?i:{},o=CH(o)?o:{},(0,vue.default)(aet(),{editor:i,tailwindCSS:o},{arrayMerge:(a,u,c)=>u})}return{get:r,clear(){t.clear()}}}var pce=Kt(require("node:os")),ls=Kt(require("node:path")),S1=Kt(require("node:fs/promises")),dce=Kt(uce()),fce=Kt(Zh());var Ob=class{constructor(){this.parents=new Map;this.children=new Map;this.nodes=new Map}add(t,r){return this.nodes.has(t)?this.nodes.get(t):(this.nodes.set(t,r),this.parents.set(t,new Set),this.children.set(t,new Set),r)}connect(t,r){let n=this.children.get(t);if(!n)throw new Error(`Node ${t} does not exist`);let s=this.parents.get(r);if(!s)throw new Error(`Node ${r} does not exist`);s.add(t),n.add(r)}*descendants(t){let r=[],n=new Set;for(let s of this.children.get(t))r.push(s);for(;r.length>0;){let s=r.shift();if(!n.has(s)){yield this.nodes.get(s),n.add(s);for(let i of this.children.get(s))r.push(i)}}}*roots(){for(let[t,r]of this.parents)r.size===0&&(yield this.nodes.get(t))}*leaves(){for(let[t,r]of this.children)r.size===0&&(yield this.nodes.get(t))}};var Rb=class extends Map{remember(t,r){let n=super.get(t);return n||(n=r(t),this.set(t,n)),n}};var Fb=Kt(BP()),th=Kt(require("node:path"));async function hF(e,t){async function r(n){let s=th.join(n,"package.json");if(await Fb.default.exists(s))return s;if(n===th.normalize(t))return Fb.default.stop}try{let n=await(0,Fb.default)(r,{cwd:e});return n?th.dirname(n):t}catch{return t}}async function Ttt(e){let t=await import(e);return t.scanDir?t:null}async function cce(e){let t=await Ttt(e.oxidePath);if(!t)return null;if(Bc(e.oxideVersion,"4.0.0-alpha.18")){let n=t.scanDir?.({base:e.basePath,globs:!0});return{files:n.files,globs:n.globs.map(s=>({base:s.base,pattern:s.glob}))}}if(Bc(e.oxideVersion,"4.0.0-alpha.19")){let n=t.scanDir({base:e.basePath,sources:e.sources});return{files:n.files,globs:n.globs}}let r=new t.Scanner({detectSources:{base:e.basePath},sources:e.sources});return{files:r.files,globs:r.globs}}var Bb=class{constructor(t,r){this.base=t;this.settings=r}async search(){let t=await this.findConfigs(),r=await Promise.allSettled(t.map(s=>this.createProject(s))),n=[];for(let s of r)s.status==="rejected"?console.error(`[GLOBAL] Error creating project: ${s.reason}`):s.status==="fulfilled"&&s.value&&n.push(s.value);n.length===1&&n[0].documentSelector.push({pattern:Zi(ls.join(this.base,"**")),priority:5});for(let s of n){s.folder=Bs(s.folder),s.configPath=Bs(s.configPath),s.config.path=Bs(s.config.path);for(let i of s.config.entries)i.path=Bs(i.path);for(let i of s.documentSelector)i.pattern=Bs(i.pattern)}return n}async loadAllFromWorkspace(t){return Promise.all(t.map(r=>this.loadFromWorkspace(r[0],r[1])))}async loadFromWorkspace(t,r){let n={type:"js",path:t,source:"js",entries:[],content:[],packageRoot:""},s=await this.detectTailwindVersion(n);return n.packageRoot=await hF(ls.dirname(n.path),this.base),{config:n,folder:this.base,isUserConfigured:!0,configPath:n.path,documentSelector:r.map(i=>({priority:0,pattern:i})),tailwind:s}}async createProject(t){let r=await this.detectTailwindVersion(t);if(console.log(JSON.stringify({tailwind:r})),t.type==="js"&&t.source==="css"&&(r.isDefaultVersion||!r.features.includes("css-at-config"))||t.type==="css"&&!r.features.includes("css-at-theme")||t.type==="js"&&r.features.includes("css-at-theme")||t.type==="js"&&(t.path.endsWith(".ts")||t.path.endsWith(".mjs"))&&!r.features.includes("transpiled-configs"))return null;t.packageRoot=await hF(ls.dirname(t.path),this.base);let n=[];for(let s of t.entries)s.type==="css"&&n.push({pattern:s.path,priority:0});n.push({pattern:t.path,priority:0});for await(let s of $tt(t,r.features))n.push(s);for(let s of t.entries)s.type==="css"&&n.push({pattern:Zi(ls.join(ls.dirname(s.path),"**")),priority:2});return n.push({pattern:Zi(ls.join(ls.dirname(t.path),"**")),priority:3}),n.push({pattern:Zi(ls.join(t.packageRoot,"**")),priority:4}),n.sort((s,i)=>s.priority-i.priority),n=n.filter(({pattern:s},i,o)=>o.findIndex(({pattern:a})=>a===s)===i),{config:t,folder:this.base,isUserConfigured:!1,configPath:t.path,documentSelector:n,tailwind:r}}async findConfigs(){let t=await(0,dce.default)([`**/${rd}`,`**/${du}`],{cwd:this.base,ignore:this.settings.tailwindCSS.files.exclude,onlyFiles:!0,absolute:!0,suppressErrors:!0,dot:!0,concurrency:Math.max(pce.cpus().length,1)}),r=await Promise.all(t.map(d=>S1.realpath(d)));t=t.filter((d,f)=>{let h=r[f];return d===h?!0:!t.includes(h)}),t=t.map(d=>Zi(d)),t=Array.from(new Set(t)).sort();let n=new Rb,s=(0,fce.default)(`**/${du}`,{dot:!0}),i=t.map(d=>s(d)?new Ub("css",d):new Ub("js",d,[n.remember(d,()=>({source:"js",type:"js",path:d,entries:[],packageRoot:null,content:[]}))])),o=i.filter(d=>d.type==="css");await Promise.all(o.map(d=>d.read()));let a=[];for(let d of o){if(!d.content)continue;let f=d.configPathInCss();if(f){d.content=null,d.configs.push(n.remember(f,()=>({source:"css",type:"js",path:f,entries:[],packageRoot:null,content:[]})));continue}if(d.isMaybeTailwindRelated()){a.push(d);continue}}await Promise.all(a.map(d=>d.resolveImports())),await Promise.all(a.map(d=>d.resolveRealpaths())),await Promise.all(a.map(d=>d.resolveSourceDirectives()));let u=new Ob,c=null,H=null,l=null;for(let d of a){u.add(d.realpath,d);for(let f of d.deps)u.add(f.realpath,f),u.connect(d.realpath,f.realpath);d.realpath.includes("node_modules/tailwindcss/index.css")?c=d.realpath:d.realpath.includes("node_modules/tailwindcss/theme.css")?H=d.realpath:d.realpath.includes("node_modules/tailwindcss/utilities.css")&&(l=d.realpath)}c&&H&&u.connect(c,H),c&&l&&u.connect(c,l);for(let d of u.roots()){let f=n.remember(d.path,()=>({source:"css",type:"css",path:d.path,entries:[],packageRoot:null,content:[{kind:"auto"}]}));d.configs.push(f);for(let h of u.descendants(d.realpath))h.configs.push(f)}for(let d of i)for(let f of d.configs)f.entries.push(d);return Array.from(n.values())}async detectTailwindVersion(t){try{let s=Jr(ls.dirname(t.path),"tailwindcss/package.json"),{version:i}=require(s),o=iE(i);if(typeof i=="string")return{version:i,features:o,isDefaultVersion:!1}}catch{}let{version:r}=NE(),n=iE(r);return{version:r,features:n,isDefaultVersion:!0}}};function $tt(e,t,r){if(e.type==="css")return xtt(e);if(e.type==="js")return Dtt(e,t,r)}async function*Dtt(e,t,r){let n;try{n=r??require(e.path)}catch{return}let s=n.content?.files??n.content,i=Array.isArray(s)?s:[],a=(t.includes("relative-content-paths")?n.future?.relativeContentPathsByDefault||n.content?.relative:!1)?ls.dirname(e.path):e.packageRoot;for(let u of i){if(typeof u!="string")continue;let c=u.startsWith("!")?`!${ls.resolve(a,u.slice(1))}`:ls.resolve(a,u);yield{pattern:Zi(c),priority:1}}}async function*xtt(e){let t=!1;for(let r of e.content)if(r.kind==="file")yield{pattern:Zi(r.file),priority:1};else if(r.kind==="auto"&&!t){t=!0;let n=e.entries.flatMap(s=>s.sources);for await(let s of Ctt(e.packageRoot,e.path,n))yield{pattern:s,priority:1}}}async function*Ctt(e,t,r){try{let n=Jr(ls.dirname(e),"@tailwindcss/oxide");n=Sg(n).href;let s=Jr(ls.dirname(e),"@tailwindcss/oxide/package.json"),i=JSON.parse(await S1.readFile(s,"utf8")),o=await cce({oxidePath:n,oxideVersion:i.version,basePath:e,sources:r.map(a=>({base:ls.dirname(t),pattern:a}))});if(!o)return;for(let a of o.files)yield Zi(a);for(let{base:a,pattern:u}of o.globs)yield Zi(a)+"/"+u}catch{}}var Ub=class e{constructor(t,r,n=[]){this.type=t;this.path=r;this.configs=n;this.deps=[];this.sources=[]}async read(){try{this.content=await sp(this.path)}catch{this.content=null}}async resolveImports(){try{let t=await gI().process(this.content,{from:this.path}),r=t.messages.filter(n=>n.type==="dependency");this.deps=r.map(n=>new e("css",Zi(n.file))),this.content=t.css}catch{}}async resolveRealpaths(){this.realpath=Zi(await S1.realpath(this.path)),await Promise.all(this.deps.map(t=>t.resolveRealpaths()))}async resolveSourceDirectives(){try{if(this.sources.length>0)return;await Va([WQ(this.sources)]).process(this.content,{from:this.realpath})}catch{}}configPathInCss(){if(!this.content)return null;let t=this.content.match(/@config\s*(?<config>'[^']+'|"[^"]+")/);return t?Zi(ls.resolve(ls.dirname(this.path),t.groups.config.slice(1,-1))):null}isMaybeTailwindRelated(){if(!this.content)return!1;let t=/@import\s*(?<config>'[^']+'|"[^"]+");/,r=/@tailwind\s*[^;]+;/,n=/@theme\s*\{/;return t.test(this.content)||r.test(this.content)||n.test(this.content)}};var upe=['"',"'","`"," ",".","(","[","]","!","/","-"];async function cpe(e){let t=await sp(e);if(!t)return null;let r=t.match(/@config\s*(?<config>'[^']+'|"[^"]+")/);return r?Bs((0,sh.default)(Oo.resolve(Oo.dirname(e),r.groups.config.slice(1,-1)))):null}var tS=class{constructor(t){this.connection=t;this.lspHandlersAdded=!1;this.disposables=[];this.watchPatterns=()=>{};this.watched=[];this.documentService=new Pg(this.connection),this.projects=new Map,this.projectCounter=0,this.settingsCache=Tue(t)}async init(){this.initPromise||(this.initPromise=this._init()),await this.initPromise}getWorkspaceFolders(){return this.initializeParams.workspaceFolders?.length?this.initializeParams.workspaceFolders.map(t=>({uri:Gl.URI.parse(t.uri).fsPath,name:t.name})):this.initializeParams.rootUri?[{uri:Gl.URI.parse(this.initializeParams.rootUri).fsPath,name:"Root"}]:this.initializeParams.rootPath?[{uri:Gl.URI.file(this.initializeParams.rootPath).fsPath,name:"Root"}]:[]}async _init(){zh();let t=this.getWorkspaceFolders().map(n=>(0,sh.default)(n.uri));if(t.length===0){console.error("No workspace folders found, not initializing.");return}let r=await Promise.allSettled(t.map(n=>this._initFolder(Gl.URI.file(n))));for(let[n,s]of r.entries())s.status==="rejected"&&console.error("Failed to initialize workspace folder",t[n],s.reason);await this.listenForEvents()}async _initFolder(t){let r=this.initializeParams.initializationOptions?.userLanguages??{};Object.keys(r).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 n=t.fsPath,s=[],i=await this.settingsCache.get(),o=i.tailwindCSS.files.exclude,a=await this.settingsCache.get(t.toString()),u={...r,...a.tailwindCSS.includeLanguages??{}},c=new Map,H=new Map,l=this.initializeParams.initializationOptions?.workspaceFile?Oo.dirname(this.initializeParams.initializationOptions.workspaceFile):n;function d(b){function D(I){return Bs((0,sh.default)(Oo.resolve(l,I)))}let v=b.experimental.configFile,x={};if(typeof v=="string"){let I=D(v),P=[D(Oo.resolve(n,"**"))];x[I]=P}else if(CH(v))for(let[I,P]of Object.entries(v)){if(typeof I!="string")return null;I=D(I);let S;if(typeof P=="string")S=[D(P)];else if(Array.isArray(P))S=P.map(D);else return null;x[I]=S}else if(v)return null;return Object.entries(x)}let f=d(i.tailwindCSS);if(f===null){console.error("Invalid `experimental.configFile` configuration, not initializing.");return}let h=new Bb(n,i);f.length>0?(console.log("Loading Tailwind CSS projects from the workspace settings."),s=await h.loadAllFromWorkspace(f)):(console.log("Searching for Tailwind CSS projects in the workspace's folders."),s=await h.search());for(let b of s)if(H.set(b.config.path,b.tailwind.version),b.config.source==="css")for(let D of b.config.entries)D.type==="css"&&c.set(D.path,b.config.path);let m=s.map(b=>({folder:b.folder,config:b.config.path,selectors:b.documentSelector,user:b.isUserConfigured,tailwind:b.tailwind}));console.log(`[Global] Creating projects: ${JSON.stringify(m)}`);let A=async b=>{let D=!1,v=!1,x=(0,Zl.default)(`**/${nd}`,{dot:!0}),I=(0,Zl.default)(`**/${du}`,{dot:!0}),P=(0,Zl.default)(`**/${rd}`,{dot:!0});e:for(let S of b){let T=(0,sh.default)(S.file);T=Bs(T);for(let O of o)if((0,Zl.default)(O,{dot:!0})(T))continue e;if(x(T))for(let[,O]of this.projects){let F=NE().version;try{let B=require(Jr(Oo.dirname(O.projectConfig.configPath),"tailwindcss/package.json")).version;typeof B=="string"&&(F=B)}catch{}if(H.get(O.projectConfig.configPath)!==F){D=!0;break e}}for(let[,O]of this.projects){if(!O.state.v4)continue;let F=[O.projectConfig.configPath,...O.projectConfig.config.entries.map(B=>B.path)];if(sd(T,F)){v=!0;break e}}if(I(`**/${du}`)&&S.type!==Kn.FileChangeType.Deleted){let O=await cpe(T)||await cpe(S.file);if(c.has(T)&&c.get(T)!==O){D=!0;break}else if(!c.has(T)&&O){D=!0;break}}if(P(T)&&S.type===Kn.FileChangeType.Created){D=!0;break}for(let[,O]of this.projects)if(S.type===Kn.FileChangeType.Deleted&&sd(T,[O.projectConfig.configPath])){D=!0;break e}}if(D){this.restart();return}if(v){try{await this.softRestart()}catch{this.restart()}return}for(let[,S]of this.projects)S.onFileEvents(b)};if(this.initializeParams.capabilities.workspace?.didChangeWatchedFiles?.dynamicRegistration){this.disposables.push(this.connection.onDidChangeWatchedFiles(async({changes:D})=>{let v=D.map(({uri:x,type:I})=>({file:Gl.URI.parse(x).fsPath,type:I})).filter((x,I,P)=>P.findIndex(S=>S.file===x.file&&S.type===x.type)===I);await A(v)}));let b=await this.connection.client.register(Kn.DidChangeWatchedFilesNotification.type,{watchers:[{globPattern:`**/${rd}`},{globPattern:`**/${nd}`},{globPattern:`**/${du}`}]});this.disposables.push(b),this.watchPatterns=D=>{let v=this.filterNewWatchPatterns(D);v.length&&(console.log(`[Global] Adding watch patterns: ${v.join(", ")}`),this.connection.client.register(Kn.DidChangeWatchedFilesNotification.type,{watchers:v.map(x=>({globPattern:x}))}).then(x=>{this.disposables.push(x)}))}}else if(rS.getBinding()){let b={create:Kn.FileChangeType.Created,update:Kn.FileChangeType.Changed,delete:Kn.FileChangeType.Deleted},D=await rS.subscribe(n,(v,x)=>{A(x.map(I=>({file:I.path,type:b[I.type]})))},{ignore:o.map(v=>Oo.resolve(n,v.replace(/^[*/]+/,"").replace(/[*/]+$/,"")))});this.disposables.push({dispose(){D.unsubscribe()}})}else{let b=lpe().watch,D=b([`**/${rd}`,`**/${nd}`,`**/${du}`],{cwd:n,ignorePermissionErrors:!0,ignoreInitial:!0,ignored:o,awaitWriteFinish:{stabilityThreshold:100,pollInterval:20}});await new Promise(v=>{D.on("ready",()=>v())}),D.on("add",v=>A([{file:Oo.resolve(n,v),type:Kn.FileChangeType.Created}])).on("change",v=>A([{file:Oo.resolve(n,v),type:Kn.FileChangeType.Changed}])).on("unlink",v=>A([{file:Oo.resolve(n,v),type:Kn.FileChangeType.Deleted}])),this.disposables.push({dispose(){D.close()}}),this.watchPatterns=v=>{let x=this.filterNewWatchPatterns(v);x.length&&(console.log(`[Global] Adding watch patterns: ${x.join(", ")}`),D.add(x))}}console.log("[Global] Preparing projects..."),await Promise.all(s.map(b=>this.addProject(b,this.initializeParams,this.watchPatterns,H.get(b.configPath),u))),console.log("[Global] Initializing projects...");let g=[],_=0;for(let b of this.documentService.getAllDocuments()){let D=this.getProject(b);D&&!D.enabled()&&(D.enable(),await D.tryInit(),_++),g.push(b.uri)}console.log(`[Global] Initialized ${_} projects`),this.setupLSPHandlers(),this.disposables.push(this.connection.onDidChangeConfiguration(async({settings:b})=>{let D=i.tailwindCSS.files.exclude;if(this.settingsCache.clear(),i=await this.settingsCache.get(),!so(D,i.tailwindCSS.files.exclude)){this.restart();return}for(let[,v]of this.projects)v.onUpdateSettings(b)})),(this.initializeParams.initializationOptions?.testMode??!1)&&(console.log("[Global][Test] Sending document notifications..."),await Promise.all(g.map(b=>this.connection.sendNotification("@/tailwindCSS/documentReady",{uri:b}))))}async listenForEvents(){let t=this.initializeParams.initializationOptions?.testMode??!1;this.disposables.push(this.connection.onShutdown(()=>{this.dispose()})),this.disposables.push(this.documentService.onDidChangeContent(r=>{this.getProject(r.document)?.provideDiagnostics(r.document)})),this.disposables.push(this.documentService.onDidOpen(async r=>{let n=this.getProject(r.document);n&&(n.enabled()||(n.enable(),await n.tryInit()),t&&await this.connection.sendNotification("@/tailwindCSS/documentReady",{uri:r.document.uri}))})),this.initializeParams.capabilities.workspace.workspaceFolders&&this.disposables.push(this.connection.workspace.onDidChangeWorkspaceFolders(async r=>{let n=r.added.map(s=>({uri:Gl.URI.parse(s.uri).fsPath,name:s.name})).map(s=>(0,sh.default)(s.uri));await Promise.allSettled(n.map(s=>this._initFolder(Gl.URI.file(s))))}))}filterNewWatchPatterns(t){return t=Array.from(new Set(t)),t=t.filter(r=>!this.watched.includes(r)),this.watched.push(...t),t}async addProject(t,r,n,s,i){let o=String(this.projectCounter++),a=await Lue(o,t,this.connection,r,this.documentService,()=>this.updateCapabilities(),()=>{for(let u of this.documentService.getAllDocuments()){let c=this.getProject(u);if(c&&!c.enabled()){c.enable(),c.tryInit();break}}},()=>this.refreshDiagnostics(),u=>n(u),s,this.settingsCache.get,i);this.projects.set(o,a),this.supportsTailwindProjectDetails&&this.connection.sendNotification("@/tailwindCSS/projectDetails",{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 r=this.getProject(t);r?r.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.onDocumentLinks(this.onDocumentLinks.bind(this)),this.connection.onRequest(this.onRequest.bind(this)))}onRequest(t,r){if(t==="@/tailwindCSS/sortSelection"){let n=this.getProject({uri:r.uri});if(!n)return{error:"no-project"};try{return{classLists:n.sortClassLists(r.classLists)}}catch{return{error:"unknown"}}}if(t==="@/tailwindCSS/getProject"){let n=this.getProject({uri:r.uri});return!n||!n.enabled()||!n.state?.enabled?null:{version:n.state.version}}}updateCapabilities(){if(!ppe(this.initializeParams))return;this.registrations&&this.registrations.then(n=>n.dispose());let t=Array.from(this.projects.values()),r=Kn.BulkRegistration.create();r.add(Kn.HoverRequest.type,{documentSelector:null}),r.add(Kn.DocumentColorRequest.type,{documentSelector:null}),r.add(Kn.CodeActionRequest.type,{documentSelector:null}),r.add(Kn.DocumentLinkRequest.type,{documentSelector:null}),r.add(Kn.CompletionRequest.type,{documentSelector:null,resolveProvider:!0,triggerCharacters:[...upe,...t.map(n=>n.state.separator).filter(n=>typeof n=="string").map(n=>n.slice(-1))].filter(Boolean)}),this.registrations=this.connection.client.register(r)}getProject(t){let r,n,s=1/0,i=Gl.URI.parse(t.uri),o=i.fsPath,a=i.path;o=Bs(o);for(let c of this.projects.values()){if(!c.projectConfig.configPath){r=r??c;continue}let H=c.documentSelector().concat().sort((l,d)=>l.pattern.startsWith("!")&&!d.pattern.startsWith("!")?-1:!l.pattern.startsWith("!")&&d.pattern.startsWith("!")?1:0);for(let l of H){let d=l.pattern.replace(/[\[\]{}()]/g,f=>`\\${f}`);if(d.startsWith("!")&&((0,Zl.default)(d.slice(1),{dot:!0})(o)||(0,Zl.default)(d.slice(1),{dot:!0})(a)))break;if((0,Zl.default)(d,{dot:!0})(o)&&l.priority<s){n=c,s=l.priority;continue}if((0,Zl.default)(d,{dot:!0})(a)&&l.priority<s){n=c,s=l.priority;continue}}}let u=n??r;return u||console.debug("[GLOBAL] No matching project for document",{fsPath:o,normalPath:a}),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 onDocumentLinks(t){return await this.init(),this.getProject(t.textDocument)?.onDocumentLinks(t)??null}setup(){this.connection.onInitialize(async t=>(this.initializeParams=t,ppe(t)?{capabilities:{textDocumentSync:Kn.TextDocumentSyncKind.Full}}:(this.setupLSPHandlers(),{capabilities:{textDocumentSync:Kn.TextDocumentSyncKind.Full,hoverProvider:!0,colorProvider:!0,codeActionProvider:!0,documentLinkProvider:{},completionProvider:{resolveProvider:!0,triggerCharacters:[...upe,":"]}}}))),this.connection.onInitialized(()=>this.init())}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.registrations&&(this.registrations.then(t=>t.dispose()),this.registrations=void 0),this.disposables.forEach(t=>t.dispose()),this.disposables.length=0,this.watched.length=0}restart(){console.log(`----------
1285
1285
  RESTARTING
1286
1286
  ----------`),this.dispose(),this.initPromise=void 0,this.init()}async softRestart(){for(let[,t]of this.projects)if(t.state.v4)try{await t.reload()}catch{}}};function ppe(e){return e.capabilities.textDocument.hover?.dynamicRegistration&&e.capabilities.textDocument.colorProvider?.dynamicRegistration&&e.capabilities.textDocument.codeAction?.dynamicRegistration&&e.capabilities.textDocument.completion?.dynamicRegistration&&e.capabilities.textDocument.documentLink?.dynamicRegistration}var dpe=require("node:util");function M1(e){return e.map(t=>(0,dpe.format)(t)).join(" ")}function fpe(e,t){e.debug=(...r)=>t.console.info(M1(r)),e.error=(...r)=>t.console.error(M1(r)),e.warn=(...r)=>t.console.warn(M1(r)),e.info=(...r)=>t.console.info(M1(r)),e.log=(...r)=>t.console.log(M1(r))}global.__preflight=f7;new Function("require","__dirname",`
1287
1287
  let oldReadFileSync = require('fs').readFileSync
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@tailwindcss/language-server",
3
3
  "description": "Tailwind CSS Language Server",
4
4
  "license": "MIT",
5
- "version": "0.0.23",
5
+ "version": "0.0.24",
6
6
  "repository": {
7
7
  "type": "git",
8
8
  "url": "git+https://github.com/tailwindlabs/tailwindcss-intellisense.git",