@tailwindcss/upgrade 4.0.0-alpha.29 → 4.0.0-alpha.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.mjs +33 -33
- package/package.json +5 -5
package/dist/index.mjs
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{globby as
|
|
3
|
-
`)}function
|
|
4
|
-
`)}function
|
|
2
|
+
import{globby as Mr}from"globby";import Ur from"node:fs/promises";import Qn from"node:path";import Zn from"postcss";import{parse as zr}from"postcss";import{format as Br}from"prettier";function b(e,t){let r;return e.each?.(i=>{let n=t(i)??0;if(n===2)return r=!1,r;if(n!==1)return r=b(i,t),r}),r}function De(e,t){e?.each?.(r=>{De(r,t),t(r)})}function ot(){async function e(t){let r=[];b(t,i=>{if(i.raws.tailwind_pretty)return r.push(i),1}),await Promise.all(r.map(async i=>{i.replaceWith(zr(await Br(i.toString(),{parser:"css",semi:!0,singleQuote:!0})))}))}return{postcssPlugin:"@tailwindcss/upgrade/format-nodes",OnceExit:e}}import O from"picocolors";import Hr from"node:fs";import mo from"node:path";import{stripVTControlCharacters as Qr}from"node:util";import S from"picocolors";import lt from"enhanced-resolve";import qr from"node:fs";import{createRequire as Jr}from"node:module";var Gr=Jr(import.meta.url).resolve;function st(e){if(typeof globalThis.__tw_resolve=="function"){let t=globalThis.__tw_resolve(e);if(t)return t}return Gr(e)}var Yr=lt.ResolverFactory.createResolver({fileSystem:new lt.CachedInputFileSystem(qr,4e3),useSyncFileSystemCalls:!0,extensions:[".css"],mainFields:["style"],conditionNames:["style"]});function Ie(e,t){if(typeof globalThis.__tw_resolve=="function"){let r=globalThis.__tw_resolve(e,t);if(r)return r}return Yr.resolveSync({},t,e)}var se={indent:2};function ae(){return`${S.italic(S.bold(S.blue("\u2248")))} tailwindcss ${S.blue(`v${Zr()}`)}`}function ue(e){return`${S.dim(S.blue("`"))}${S.blue(e)}${S.dim(S.blue("`"))}`}function j(e,t){let r=e.split(" "),i=[],n="",l=0;for(let s of r){let o=Qr(s).length;l+o+1>t&&(i.push(n),n="",l=0),n+=(l?" ":"")+s,l+=o+(l?1:0)}return l&&i.push(n),i}function Q(e,t=0){return`${" ".repeat(t+se.indent)}${e}`}function I(e,t=F){j(e,process.stderr.columns-3).map(r=>t(`${S.green("\u2502")} ${r}`)),t()}function T(e,t=F){j(e,process.stderr.columns-3).map(r=>t(`${S.blue("\u2502")} ${r}`)),t()}function E(e,t=F){j(e,process.stderr.columns-3).map(r=>t(`${S.red("\u2502")} ${r}`)),t()}function fe(e,t=F){j(e,process.stderr.columns-3).map(r=>t(`${S.yellow("\u2502")} ${r}`)),t()}function F(e=""){process.stderr.write(`${e}
|
|
3
|
+
`)}function $(e=""){process.stdout.write(`${e}
|
|
4
|
+
`)}function Zr(){if(typeof globalThis.__tw_version=="string")return globalThis.__tw_version;let{version:e}=JSON.parse(Hr.readFileSync(st("tailwindcss/package.json"),"utf-8"));return e}function at({invalid:e,usage:t,options:r}){let i=process.stdout.columns;if($(ae()),e&&($(),$(`${O.dim("Invalid command:")} ${e}`)),t&&t.length>0){$(),$(O.dim("Usage:"));for(let[n,l]of t.entries()){let s=l.slice(0,l.indexOf("[")),o=l.slice(l.indexOf("["));o=o.replace(/\[.*?\]/g,f=>O.dim(f));let u=j(o,i-se.indent-s.length-1);u.length>1&&n!==0&&$(),$(Q(`${s}${u.shift()}`));for(let f of u)$(Q(f,s.length))}}if(r){let n=0;for(let{alias:a}of Object.values(r))a&&(n=Math.max(n,a.length));let l=[],s=0;for(let[a,{alias:u}]of Object.entries(r)){let f=[u&&`${u.padStart(n)}`,u?a:" ".repeat(n+2)+a].filter(Boolean).join(", ");l.push(f),s=Math.max(s,f.length)}$(),$(O.dim("Options:"));let o=8;for(let{description:a,default:u=null}of Object.values(r)){let f=l.shift(),p=o+(s-f.length),c=2,m=i-f.length-p-c-se.indent,d=j(u!==null?`${a} ${O.dim(`[default:\u202F${ue(`${u}`)}]`)}`:a,m);$(Q(`${O.blue(f)} ${O.dim(O.gray("\xB7")).repeat(p)} ${d.shift()}`));for(let g of d)$(Q(`${" ".repeat(f.length+p+c)}${g}`))}}}import tn from"node:path";import Ze from"postcss";var _=class extends Map{constructor(r){super();this.factory=r}get(r){let i=super.get(r);return i===void 0&&(i=this.factory(r,this),this.set(r,i)),i}};var ce=new Uint8Array(256);function v(e,t){let r=0,i=[],n=0,l=e.length,s=t.charCodeAt(0);for(let o=0;o<l;o++){let a=e.charCodeAt(o);if(r===0&&a===s){i.push(e.slice(n,o)),n=o+1;continue}switch(a){case 92:o+=1;break;case 39:case 34:for(;++o<l;){let u=e.charCodeAt(o);if(u===92){o+=1;continue}if(u===a)break}break;case 40:ce[r]=41,r++;break;case 91:ce[r]=93,r++;break;case 123:ce[r]=125,r++;break;case 93:case 125:case 41:r>0&&a===ce[r-1]&&r--;break}}return i.push(e.slice(n)),i}import Ut from"node:fs/promises";import Ri,{extname as Ei}from"node:path";import{Scanner as li}from"@tailwindcss/oxide";function Fe(e){return{kind:"word",value:e}}function Xr(e,t){return{kind:"function",value:e,nodes:t}}function ei(e){return{kind:"separator",value:e}}function N(e,t,r=null){for(let i=0;i<e.length;i++){let n=e[i],l=t(n,{parent:r,replaceWith(s){e.splice(i,1,...Array.isArray(s)?s:[s]),i--}})??0;if(l===2)return;l!==1&&n.kind==="function"&&N(n.nodes,t,n)}}function w(e){let t="";for(let r of e)switch(r.kind){case"word":case"separator":{t+=r.value;break}case"function":t+=r.value+"("+w(r.nodes)+")"}return t}var ti=92,ri=41,ut=58,ft=44,ii=34,ni=40,oi=39,ct=32,pt=60,dt=62,mt=61,gt=47;function A(e){e=e.replaceAll(`\r
|
|
5
5
|
`,`
|
|
6
|
-
`);let t=[],r=[],i=null,n="",l;for(let s=0;s<e.length;s++){let o=e.charCodeAt(s);switch(o){case ot:case lt:case st:case ct:case at:case ut:case ft:{if(n.length>0){let p=Oe(n);i?i.nodes.push(p):t.push(p),n=""}let a=s,u=s+1;for(;u<e.length&&(l=e.charCodeAt(u),!(l!==ot&&l!==lt&&l!==st&&l!==ct&&l!==at&&l!==ut&&l!==ft));u++);s=u-1;let f=Jr(e.slice(a,u));i?i.nodes.push(f):t.push(f);break}case Zr:case Hr:{let a=s;for(let u=s+1;u<e.length;u++)if(l=e.charCodeAt(u),l===Gr)u+=1;else if(l===o){s=u;break}n+=e.slice(a,s+1);break}case Qr:{let a=qr(n,[]);n="",i?i.nodes.push(a):t.push(a),r.push(a),i=a;break}case Yr:{let a=r.pop();if(n.length>0){let u=Oe(n);a.nodes.push(u),n=""}r.length>0?i=r[r.length-1]:i=null;break}default:n+=String.fromCharCode(o)}}return n.length>0&&t.push(Oe(n)),t}async function pt(e,t="html"){let i=new Xr({}).getCandidatesWithPositions({content:e,extension:t}),n=[];for(let{candidate:l,position:s}of i)n.push({rawCandidate:l,start:s,end:s+l.length});return n}function b(e,t){let r=[];for(let n of t.variants)r.unshift(dt(n));e.theme.prefix&&r.unshift(e.theme.prefix);let i="";return(t.kind==="static"||t.kind==="functional")&&t.negative&&(i+="-"),t.kind==="static"&&(i+=t.root),t.kind==="functional"&&(i+=t.root,t.value&&(t.value.kind==="arbitrary"?t.value===null?i+="":t.value.dataType?i+=`-[${t.value.dataType}:${M(t.value.value)}]`:i+=`-[${M(t.value.value)}]`:t.value.kind==="named"&&(i+=`-${t.value.value}`))),t.kind==="arbitrary"&&(i+=`[${t.property}:${M(t.value)}]`),(t.kind==="arbitrary"||t.kind==="functional")&&t.modifier&&(t.modifier.kind==="arbitrary"?i+=`/[${M(t.modifier.value)}]`:t.modifier.kind==="named"&&(i+=`/${t.modifier.value}`)),t.important&&(i+="!"),r.push(i),r.join(":")}function dt(e){if(e.kind==="static")return e.root;if(e.kind==="arbitrary")return`[${M(ei(e.selector))}]`;let t="";return e.kind==="functional"&&(t+=e.root,e.value&&(e.value.kind==="arbitrary"?t+=`-[${M(e.value.value)}]`:e.value.kind==="named"&&(t+=`-${e.value.value}`))),e.kind==="compound"&&(t+=e.root,t+="-",t+=dt(e.variant)),(e.kind==="functional"||e.kind==="compound")&&e.modifier&&(e.modifier.kind==="arbitrary"?t+=`/[${M(e.modifier.value)}]`:e.modifier.kind==="named"&&(t+=`/${e.modifier.value}`)),t}function M(e){let t=V(e),r=new Set;return _(t,(i,{parent:n})=>{let l=n===null?t:n.nodes??[];if(i.kind==="word"&&(i.value==="+"||i.value==="-"||i.value==="*"||i.value==="/")){let s=l.indexOf(i)??-1;if(s===-1)return;let o=l[s-1];if(o?.kind!=="separator"||o.value!==" ")return;let a=l[s+1];if(a?.kind!=="separator"||a.value!==" ")return;r.add(o),r.add(a)}else i.kind==="separator"&&i.value.trim()==="/"?i.value="/":i.kind==="separator"&&i.value.length>0&&i.value.trim()===""&&(l[0]===i||l[l.length-1]===i)&&r.add(i)}),r.size>0&&_(t,(i,{replaceWith:n})=>{r.has(i)&&(r.delete(i),n([]))}),S(t).replaceAll("_",String.raw`\_`).replaceAll(" ","_")}function ei(e){let t=V(e);return t.length===3&&t[0].kind==="word"&&t[0].value==="&"&&t[1].kind==="separator"&&t[1].value===":"&&t[2].kind==="function"&&t[2].value==="is"?S(t[2].nodes):e}var mt=["calc","min","max","clamp","mod","rem","sin","cos","tan","asin","acos","atan","atan2","pow","sqrt","hypot","log","exp","round"],ce=["anchor-size"],gt=new RegExp(`(${ce.join("|")})\\(`,"g");function ht(e){if(e.indexOf("(")===-1||!mt.some(n=>e.includes(n)))return e;let t=!1;ce.some(n=>e.includes(n))&&(gt.lastIndex=0,e=e.replace(gt,(n,l)=>(t=!0,`$${ce.indexOf(l)}$(`)));let r="",i=[];for(let n=0;n<e.length;n++){let l=e[n];if(l==="("){r+=l;let s=n;for(let a=n-1;a>=0;a--){let u=e.charCodeAt(a);if(u>=48&&u<=57)s=a;else if(u>=97&&u<=122)s=a;else break}let o=e.slice(s,n);if(mt.includes(o)){i.unshift(!0);continue}else if(i[0]&&o===""){i.unshift(!0);continue}i.unshift(!1);continue}else if(l===")")r+=l,i.shift();else if(l===","&&i[0]){r+=", ";continue}else{if(l===" "&&i[0]&&r[r.length-1]===" ")continue;if((l==="+"||l==="*"||l==="/"||l==="-")&&i[0]){let s=r.trimEnd(),o=s[s.length-1];if(o==="+"||o==="*"||o==="/"||o==="-"){r+=l;continue}else if(o==="("||o===","){r+=l;continue}else e[n-1]===" "?r+=`${l} `:r+=` ${l} `}else if(i[0]&&e.startsWith("to-zero",n)){let s=n;n+=7,r+=e.slice(s,n+1)}else r+=l}}return t?r.replace(/\$(\d+)\$/g,(n,l)=>ce[l]??n):r}function pe(e){return e.startsWith("url(")||(e=ti(e),e=ht(e)),e}function ti(e){let t="";for(let r=0;r<e.length;r++){let i=e[r];i==="\\"&&e[r+1]==="_"?(t+="_",r+=1):i==="_"?t+=" ":t+=i}return t}var ri=58,yt=45,vt=97,wt=122;function*P(e,t){let r=v(e,":");if(t.theme.prefix){if(r.length===1||r[0]!==t.theme.prefix)return null;r.shift()}let i=r.pop(),n=[];for(let p=r.length-1;p>=0;--p){let c=t.parseVariant(r[p]);if(c===null)return;n.push(c)}let l=!1,s=!1;i[i.length-1]==="!"?(l=!0,i=i.slice(0,-1)):i[0]==="!"&&(l=!0,i=i.slice(1)),i[0]==="-"&&(s=!0,i=i.slice(1)),t.utilities.has(i,"static")&&!i.includes("[")&&(yield{kind:"static",root:i,variants:n,negative:s,important:l,raw:e});let[o,a=null,u]=v(i,"/");if(u)return;if(o[0]==="["){if(o[o.length-1]!=="]")return;let p=o.charCodeAt(1);if(p!==yt&&!(p>=vt&&p<=wt))return;o=o.slice(1,-1);let c=o.indexOf(":");if(c===-1||c===0||c===o.length-1)return;let m=o.slice(0,c),d=pe(o.slice(c+1));yield{kind:"arbitrary",property:m,value:d,modifier:a===null?null:bt(a),variants:n,important:l,raw:e};return}let f;if(o[o.length-1]==="]"){let p=o.indexOf("-[");if(p===-1)return;let c=o.slice(0,p);if(!t.utilities.has(c,"functional"))return;let m=o.slice(p+1);f=[[c,m]]}else f=ii(o,p=>t.utilities.has(p,"functional"));for(let[p,c]of f){let m={kind:"functional",root:p,modifier:a===null?null:bt(a),value:null,variants:n,negative:s,important:l,raw:e};if(c===null){yield m;continue}{let d=c.indexOf("[");if(d!==-1){let h=c.slice(d+1,-1),y="";for(let k=0;k<h.length;k++){let D=h.charCodeAt(k);if(D===ri){y=h.slice(0,k),h=h.slice(k+1);break}if(!(D===yt||D>=vt&&D<=wt))break}m.value={kind:"arbitrary",dataType:y||null,value:pe(h)}}else{let h=a===null||m.modifier?.kind==="arbitrary"?null:`${c}/${a}`;m.value={kind:"named",value:c,fraction:h}}}yield m}}function bt(e){if(e[0]==="["&&e[e.length-1]==="]"){let t=e.slice(1,-1);return{kind:"arbitrary",value:pe(t)}}return{kind:"named",value:e}}function*ii(e,t){t(e)&&(yield[e,null]);let r=e.lastIndexOf("-");if(r===-1){e[0]==="@"&&t("@")&&(yield["@",e.slice(1)]);return}do{let i=e.slice(0,r);if(t(i)){let n=[i,e.slice(r+1)];if(n[1]==="")break;yield n}r=e.lastIndexOf("-",r-1)}while(r>0)}var L=/[+-]?\d*\.?\d+(?:[eE][+-]?\d+)?/,$o=new RegExp(`^${L.source}$`);var To=new RegExp(`^${L.source}%$`);var ni=["cm","mm","Q","in","pc","pt","px","em","ex","ch","rem","lh","rlh","vw","vh","vmin","vmax","vb","vi","svw","svh","lvw","lvh","dvw","dvh","cqw","cqh","cqi","cqb","cqmin","cqmax"],_o=new RegExp(`^${L.source}(${ni.join("|")})$`);var oi=["deg","rad","grad","turn"],Vo=new RegExp(`^${L.source}(${oi.join("|")})$`);var No=new RegExp(`^${L.source} +${L.source} +${L.source}$`);function Q(e){let t=Number(e);return Number.isInteger(t)&&t>=0&&String(t)===String(e)}function kt(e,t,r){for(let i of P(r,e)){let n=structuredClone(i),l=!1;if(n.kind==="functional"&&n.value?.kind==="arbitrary"&&n.value.dataType===null&&(n.root==="from"||n.root==="via"||n.root==="to"||n.root==="font-stretch")){if(n.value.value.endsWith("%")&&Q(n.value.value.slice(0,-1))){let s=parseInt(n.value.value);(n.root==="from"||n.root==="via"||n.root==="to"||n.root==="font-stretch"&&s>=50&&s<=200)&&(l=!0,n.value={kind:"named",value:n.value.value,fraction:null})}}else if(n.kind==="functional"&&n.value?.kind==="arbitrary"&&n.value.dataType===null){let s=v(n.value.value,"/");if(s.every(o=>Q(o))){l=!0;let o=n.value,a=n.modifier;s.length===1?n.value={kind:"named",value:n.value.value,fraction:null}:(n.value={kind:"named",value:s[0],fraction:n.value.value},n.modifier={kind:"named",value:s[1]}),e.compileAstNodes(n).length===0&&(n.value=o,n.modifier=a,l=!1)}}for(let s of li(n))if(s.kind==="functional"&&s.root==="data"&&s.value?.kind==="arbitrary"&&!s.value.value.includes("="))l=!0,s.value={kind:"named",value:s.value.value};else if(s.kind==="functional"&&s.root==="aria"&&s.value?.kind==="arbitrary"&&(s.value.value.endsWith("=true")||s.value.value.endsWith('="true"')||s.value.value.endsWith("='true'"))){let[o,a]=v(s.value.value,"=");if(o[o.length-1]==="~"||o[o.length-1]==="|"||o[o.length-1]==="^"||o[o.length-1]==="$"||o[o.length-1]==="*")continue;l=!0,s.value={kind:"named",value:s.value.value.slice(0,s.value.value.indexOf("="))}}else s.kind==="functional"&&s.root==="supports"&&s.value?.kind==="arbitrary"&&/^[a-z-][a-z0-9-]*$/i.test(s.value.value)&&(l=!0,s.value={kind:"named",value:s.value.value});return l?b(e,n):r}return r}function*li(e){function*t(r){yield r,r.kind==="compound"&&(yield*t(r.variant))}for(let r of e.variants)yield*t(r)}function x(e,t){return{kind:"rule",selector:e,nodes:t}}function R(e,t){return{kind:"declaration",property:e,value:t,important:!1}}function N(e,t,r=null,i={}){for(let n=0;n<e.length;n++){let l=e[n];if(l.kind==="context"){N(l.nodes,t,r,{...i,...l.context});continue}let s=t(l,{parent:r,replaceWith(o){e.splice(n,1,...Array.isArray(o)?o:[o]),n--},context:i})??0;if(s===2)return;s!==1&&l.kind==="rule"&&N(l.nodes,t,l,i)}}function De(e){let t="",r=new Set,i=[],n=[];function l(u,f=0){let p="",c=" ".repeat(f);if(u.kind==="rule"){if(u.selector==="@tailwind utilities"){for(let m of u.nodes)p+=l(m,f);return p}if(u.selector[0]==="@"&&u.nodes.length===0)return`${c}${u.selector};
|
|
7
|
-
`;if(u.selector[0]==="@"&&u.selector.startsWith("@property ")&&f===0){if(r.has(u.selector))return"";let m=u.selector.replace(/@property\s*/g,""),d=null,g=!1;for(let h of u.nodes)h.kind==="declaration"&&(h.property==="initial-value"?d=h.value:h.property==="inherits"&&(g=h.value==="true"));g?i.push(
|
|
6
|
+
`);let t=[],r=[],i=null,n="",l;for(let s=0;s<e.length;s++){let o=e.charCodeAt(s);switch(o){case ut:case ft:case ct:case gt:case pt:case dt:case mt:{if(n.length>0){let p=Fe(n);i?i.nodes.push(p):t.push(p),n=""}let a=s,u=s+1;for(;u<e.length&&(l=e.charCodeAt(u),!(l!==ut&&l!==ft&&l!==ct&&l!==gt&&l!==pt&&l!==dt&&l!==mt));u++);s=u-1;let f=ei(e.slice(a,u));i?i.nodes.push(f):t.push(f);break}case oi:case ii:{let a=s;for(let u=s+1;u<e.length;u++)if(l=e.charCodeAt(u),l===ti)u+=1;else if(l===o){s=u;break}n+=e.slice(a,s+1);break}case ni:{let a=Xr(n,[]);n="",i?i.nodes.push(a):t.push(a),r.push(a),i=a;break}case ri:{let a=r.pop();if(n.length>0){let u=Fe(n);a.nodes.push(u),n=""}r.length>0?i=r[r.length-1]:i=null;break}default:n+=String.fromCharCode(o)}}return n.length>0&&t.push(Fe(n)),t}async function ht(e,t="html"){let i=new li({}).getCandidatesWithPositions({content:e,extension:t}),n=[];for(let{candidate:l,position:s}of i)n.push({rawCandidate:l,start:s,end:s+l.length});return n}function k(e,t){let r=[];for(let n of t.variants)r.unshift(yt(n));e.theme.prefix&&r.unshift(e.theme.prefix);let i="";return(t.kind==="static"||t.kind==="functional")&&t.negative&&(i+="-"),t.kind==="static"&&(i+=t.root),t.kind==="functional"&&(i+=t.root,t.value&&(t.value.kind==="arbitrary"?t.value===null?i+="":t.value.dataType?i+=`-[${t.value.dataType}:${M(t.value.value)}]`:i+=`-[${M(t.value.value)}]`:t.value.kind==="named"&&(i+=`-${t.value.value}`))),t.kind==="arbitrary"&&(i+=`[${t.property}:${M(t.value)}]`),(t.kind==="arbitrary"||t.kind==="functional")&&t.modifier&&(t.modifier.kind==="arbitrary"?i+=`/[${M(t.modifier.value)}]`:t.modifier.kind==="named"&&(i+=`/${t.modifier.value}`)),t.important&&(i+="!"),r.push(i),r.join(":")}function yt(e){if(e.kind==="static")return e.root;if(e.kind==="arbitrary")return`[${M(si(e.selector))}]`;let t="";return e.kind==="functional"&&(t+=e.root,e.value&&(e.value.kind==="arbitrary"?t+=`-[${M(e.value.value)}]`:e.value.kind==="named"&&(t+=`-${e.value.value}`))),e.kind==="compound"&&(t+=e.root,t+="-",t+=yt(e.variant)),(e.kind==="functional"||e.kind==="compound")&&e.modifier&&(e.modifier.kind==="arbitrary"?t+=`/[${M(e.modifier.value)}]`:e.modifier.kind==="named"&&(t+=`/${e.modifier.value}`)),t}function M(e){let t=A(e),r=new Set;return N(t,(i,{parent:n})=>{let l=n===null?t:n.nodes??[];if(i.kind==="word"&&(i.value==="+"||i.value==="-"||i.value==="*"||i.value==="/")){let s=l.indexOf(i)??-1;if(s===-1)return;let o=l[s-1];if(o?.kind!=="separator"||o.value!==" ")return;let a=l[s+1];if(a?.kind!=="separator"||a.value!==" ")return;r.add(o),r.add(a)}else i.kind==="separator"&&i.value.trim()==="/"?i.value="/":i.kind==="separator"&&i.value.length>0&&i.value.trim()===""&&(l[0]===i||l[l.length-1]===i)&&r.add(i)}),r.size>0&&N(t,(i,{replaceWith:n})=>{r.has(i)&&(r.delete(i),n([]))}),Le(t),w(t)}function si(e){let t=A(e);return t.length===3&&t[0].kind==="word"&&t[0].value==="&"&&t[1].kind==="separator"&&t[1].value===":"&&t[2].kind==="function"&&t[2].value==="is"?w(t[2].nodes):e}function Le(e){for(let t of e)switch(t.kind){case"function":{if(t.value==="url"||t.value.endsWith("_url")){t.value=pe(t.value);break}if(t.value==="var"||t.value.endsWith("_var")||t.value==="theme"||t.value.endsWith("_theme")){t.value=pe(t.value);for(let r=0;r<t.nodes.length;r++)r==0&&t.nodes[r].kind==="word"||Le([t.nodes[r]]);break}t.value=pe(t.value),Le(t.nodes);break}case"separator":case"word":{t.value=pe(t.value);break}default:ai(t)}}function ai(e){throw new Error(`Unexpected value: ${e}`)}function pe(e){return e.replaceAll("_",String.raw`\_`).replaceAll(" ","_")}var vt=["calc","min","max","clamp","mod","rem","sin","cos","tan","asin","acos","atan","atan2","pow","sqrt","hypot","log","exp","round"],de=["anchor-size"],wt=new RegExp(`(${de.join("|")})\\(`,"g");function bt(e){if(!vt.some(n=>e.includes(n)))return e;let t=!1;de.some(n=>e.includes(n))&&(wt.lastIndex=0,e=e.replace(wt,(n,l)=>(t=!0,`$${de.indexOf(l)}$(`)));let r="",i=[];for(let n=0;n<e.length;n++){let l=e[n];if(l==="("){r+=l;let s=n;for(let a=n-1;a>=0;a--){let u=e.charCodeAt(a);if(u>=48&&u<=57)s=a;else if(u>=97&&u<=122)s=a;else break}let o=e.slice(s,n);if(vt.includes(o)){i.unshift(!0);continue}else if(i[0]&&o===""){i.unshift(!0);continue}i.unshift(!1);continue}else if(l===")")r+=l,i.shift();else if(l===","&&i[0]){r+=", ";continue}else{if(l===" "&&i[0]&&r[r.length-1]===" ")continue;if((l==="+"||l==="*"||l==="/"||l==="-")&&i[0]){let s=r.trimEnd(),o=s[s.length-1];if(o==="+"||o==="*"||o==="/"||o==="-"){r+=l;continue}else if(o==="("||o===","){r+=l;continue}else e[n-1]===" "?r+=`${l} `:r+=` ${l} `}else if(i[0]&&e.startsWith("to-zero",n)){let s=n;n+=7,r+=e.slice(s,n+1)}else r+=l}}return t?r.replace(/\$(\d+)\$/g,(n,l)=>de[l]??n):r}function me(e){if(e.indexOf("(")===-1)return Z(e);let t=A(e);return Me(t),e=w(t),e=bt(e),e}function Z(e){let t="";for(let r=0;r<e.length;r++){let i=e[r];i==="\\"&&e[r+1]==="_"?(t+="_",r+=1):i==="_"?t+=" ":t+=i}return t}function Me(e){for(let t of e)switch(t.kind){case"function":{if(t.value==="url"||t.value.endsWith("_url")){t.value=Z(t.value);break}if(t.value==="var"||t.value.endsWith("_var")||t.value==="theme"||t.value.endsWith("_theme")){t.value=Z(t.value);for(let r=0;r<t.nodes.length;r++)r==0&&t.nodes[r].kind==="word"||Me([t.nodes[r]]);break}t.value=Z(t.value),Me(t.nodes);break}case"separator":case"word":{t.value=Z(t.value);break}default:ui(t)}}function ui(e){throw new Error(`Unexpected value: ${e}`)}var fi=58,kt=45,xt=97,Ct=122;function*P(e,t){let r=v(e,":");if(t.theme.prefix){if(r.length===1||r[0]!==t.theme.prefix)return null;r.shift()}let i=r.pop(),n=[];for(let p=r.length-1;p>=0;--p){let c=t.parseVariant(r[p]);if(c===null)return;n.push(c)}let l=!1,s=!1;i[i.length-1]==="!"?(l=!0,i=i.slice(0,-1)):i[0]==="!"&&(l=!0,i=i.slice(1)),i[0]==="-"&&(s=!0,i=i.slice(1)),t.utilities.has(i,"static")&&!i.includes("[")&&(yield{kind:"static",root:i,variants:n,negative:s,important:l,raw:e});let[o,a=null,u]=v(i,"/");if(u)return;if(o[0]==="["){if(o[o.length-1]!=="]")return;let p=o.charCodeAt(1);if(p!==kt&&!(p>=xt&&p<=Ct))return;o=o.slice(1,-1);let c=o.indexOf(":");if(c===-1||c===0||c===o.length-1)return;let m=o.slice(0,c),d=me(o.slice(c+1));yield{kind:"arbitrary",property:m,value:d,modifier:a===null?null:At(a),variants:n,important:l,raw:e};return}let f;if(o[o.length-1]==="]"){let p=o.indexOf("-[");if(p===-1)return;let c=o.slice(0,p);if(!t.utilities.has(c,"functional"))return;let m=o.slice(p+1);f=[[c,m]]}else f=ci(o,p=>t.utilities.has(p,"functional"));for(let[p,c]of f){let m={kind:"functional",root:p,modifier:a===null?null:At(a),value:null,variants:n,negative:s,important:l,raw:e};if(c===null){yield m;continue}{let d=c.indexOf("[");if(d!==-1){let h=c.slice(d+1,-1),y="";for(let C=0;C<h.length;C++){let D=h.charCodeAt(C);if(D===fi){y=h.slice(0,C),h=h.slice(C+1);break}if(!(D===kt||D>=xt&&D<=Ct))break}m.value={kind:"arbitrary",dataType:y||null,value:me(h)}}else{let h=a===null||m.modifier?.kind==="arbitrary"?null:`${c}/${a}`;m.value={kind:"named",value:c,fraction:h}}}yield m}}function At(e){if(e[0]==="["&&e[e.length-1]==="]"){let t=e.slice(1,-1);return{kind:"arbitrary",value:me(t)}}return{kind:"named",value:e}}function*ci(e,t){t(e)&&(yield[e,null]);let r=e.lastIndexOf("-");if(r===-1){e[0]==="@"&&t("@")&&(yield["@",e.slice(1)]);return}do{let i=e.slice(0,r);if(t(i)){let n=[i,e.slice(r+1)];if(n[1]==="")break;yield n}r=e.lastIndexOf("-",r-1)}while(r>0)}var U=/[+-]?\d*\.?\d+(?:[eE][+-]?\d+)?/,Fo=new RegExp(`^${U.source}$`);var Lo=new RegExp(`^${U.source}%$`);var pi=["cm","mm","Q","in","pc","pt","px","em","ex","ch","rem","lh","rlh","vw","vh","vmin","vmax","vb","vi","svw","svh","lvw","lvh","dvw","dvh","cqw","cqh","cqi","cqb","cqmin","cqmax"],Mo=new RegExp(`^${U.source}(${pi.join("|")})$`);var di=["deg","rad","grad","turn"],Uo=new RegExp(`^${U.source}(${di.join("|")})$`);var Wo=new RegExp(`^${U.source} +${U.source} +${U.source}$`);function X(e){let t=Number(e);return Number.isInteger(t)&&t>=0&&String(t)===String(e)}function St(e,t,r){for(let i of P(r,e)){let n=structuredClone(i),l=!1;if(n.kind==="functional"&&n.value?.kind==="arbitrary"&&n.value.dataType===null&&(n.root==="from"||n.root==="via"||n.root==="to"||n.root==="font-stretch")){if(n.value.value.endsWith("%")&&X(n.value.value.slice(0,-1))){let s=parseInt(n.value.value);(n.root==="from"||n.root==="via"||n.root==="to"||n.root==="font-stretch"&&s>=50&&s<=200)&&(l=!0,n.value={kind:"named",value:n.value.value,fraction:null})}}else if(n.kind==="functional"&&n.value?.kind==="arbitrary"&&n.value.dataType===null){let s=v(n.value.value,"/");if(s.every(o=>X(o))){l=!0;let o=n.value,a=n.modifier;s.length===1?n.value={kind:"named",value:n.value.value,fraction:null}:(n.value={kind:"named",value:s[0],fraction:n.value.value},n.modifier={kind:"named",value:s[1]}),e.compileAstNodes(n).length===0&&(n.value=o,n.modifier=a,l=!1)}}for(let s of mi(n))if(s.kind==="functional"&&s.root==="data"&&s.value?.kind==="arbitrary"&&!s.value.value.includes("="))l=!0,s.value={kind:"named",value:s.value.value};else if(s.kind==="functional"&&s.root==="aria"&&s.value?.kind==="arbitrary"&&(s.value.value.endsWith("=true")||s.value.value.endsWith('="true"')||s.value.value.endsWith("='true'"))){let[o,a]=v(s.value.value,"=");if(o[o.length-1]==="~"||o[o.length-1]==="|"||o[o.length-1]==="^"||o[o.length-1]==="$"||o[o.length-1]==="*")continue;l=!0,s.value={kind:"named",value:s.value.value.slice(0,s.value.value.indexOf("="))}}else s.kind==="functional"&&s.root==="supports"&&s.value?.kind==="arbitrary"&&/^[a-z-][a-z0-9-]*$/i.test(s.value.value)&&(l=!0,s.value={kind:"named",value:s.value.value});return l?k(e,n):r}return r}function*mi(e){function*t(r){yield r,r.kind==="compound"&&(yield*t(r.variant))}for(let r of e.variants)yield*t(r)}function x(e,t){return{kind:"rule",selector:e,nodes:t}}function K(e,t){return{kind:"declaration",property:e,value:t,important:!1}}function V(e,t,r=[],i={}){for(let n=0;n<e.length;n++){let l=e[n],s=[...r,l],o=r.at(-1)??null;if(l.kind==="context"){V(l.nodes,t,r,{...i,...l.context});continue}let a=t(l,{parent:o,context:i,path:s,replaceWith(u){e.splice(n,1,...Array.isArray(u)?u:[u]),n--}})??0;if(a===2)return;a!==1&&l.kind==="rule"&&V(l.nodes,t,s,i)}}function Ue(e){let t="",r=new Set,i=[],n=[];function l(u,f=0){let p="",c=" ".repeat(f);if(u.kind==="rule"){if(u.selector==="@tailwind utilities"){for(let m of u.nodes)p+=l(m,f);return p}if(u.selector[0]==="@"&&u.nodes.length===0)return`${c}${u.selector};
|
|
7
|
+
`;if(u.selector[0]==="@"&&u.selector.startsWith("@property ")&&f===0){if(r.has(u.selector))return"";let m=u.selector.replace(/@property\s*/g,""),d=null,g=!1;for(let h of u.nodes)h.kind==="declaration"&&(h.property==="initial-value"?d=h.value:h.property==="inherits"&&(g=h.value==="true"));g?i.push(K(m,d??"initial")):n.push(K(m,d??"initial")),r.add(u.selector)}p+=`${c}${u.selector} {
|
|
8
8
|
`;for(let m of u.nodes)p+=l(m,f+1);p+=`${c}}
|
|
9
9
|
`}else if(u.kind==="comment")p+=`${c}/*${u.value}*/
|
|
10
10
|
`;else if(u.kind==="context")for(let m of u.nodes)p+=l(m,f);else if(u.kind==="at-root"){for(let m of u.nodes)t+=l(m,0);return p}else u.property!=="--tw-sort"&&u.value!==void 0&&u.value!==null&&(p+=`${c}${u.property}: ${u.value}${u.important?" !important":""};
|
|
11
|
-
`);return p}let s="";for(let u of e){let f=l(u);f!==""&&(s+=f)}let o=[];i.length&&o.push(x(":root",i)),n.length&&o.push(x("*, ::before, ::after, ::backdrop",n));let a="";return o.length&&(a=l(x("@supports (-moz-orient: inline)",[x("@layer base",o)]))),`${s}${a}${t}`}function
|
|
12
|
-
`)break;
|
|
13
|
-
`)break;if(St(a)){s=!0;break}}if(!l||!s)continue}return b(e,n)}return r}function St(e){switch(e){case'"':case"'":case"`":return!0;default:return!1}}function Tt(e,t,r){for(let i of e.parseCandidate(r))if(i.kind==="functional"&&i.root==="max-w"&&i.value?.value.startsWith("screen-"))return b(e,{...i,value:{...i.value,value:`[theme(screens.${i.value.value.slice(7)})]`}});return r}function _t(e,t,r){if(!e.theme.prefix)return r;let i=fi(e,t,r);if(!i)return r;let n=e.theme.prefix,l=null;try{e.theme.prefix=null;let s=r.slice(0,i.start)+i.base+r.slice(i.end),o=[...P(s,e)];o.length>0&&(l=o[0])}finally{e.theme.prefix=n}return l?b(e,l):r}function fi(e,t,r){if(!e.theme.prefix)return null;if(!t.prefix)throw new Error("Could not find the Tailwind CSS v3 `prefix` configuration inside the JavaScript config.");let n=v(r,":").pop(),l=r.length-n.length,s=l+n.length,o=!1,a=!1;return n[n.length-1]==="!"?(o=!0,n=n.slice(0,-1)):n[0]==="!"&&(o=!0,n=n.slice(1)),n[0]==="-"&&(a=!0,n=n.slice(1)),!n.startsWith(t.prefix)&&n[0]!=="["?null:(n[0]!=="["&&(n=n.slice(t.prefix.length)),a&&(n="-"+n),o&&(n+="!"),{base:n,start:l,end:s})}var ci=/([a-z]+)/;function Vt(e){let t=ci.exec(e.toLocaleLowerCase());return t?t[0]:(console.warn(`The prefix "${e} can not be used with Tailwind CSS v4 and cannot be converted to a valid one automatically. We've updated it to "tw" for you.`),"tw")}var Ie={"overflow-clip":"text-clip","overflow-ellipsis":"text-ellipsis","flex-grow":"grow","flex-grow-0":"grow-0","flex-shrink":"shrink","flex-shrink-0":"shrink-0","decoration-clone":"box-decoration-clone","decoration-slice":"box-decoration-slice"},Nt=new WeakSet;function Pt(e,t,r){if(!Nt.has(e)){for(let i in Ie)e.utilities.static(i,()=>[]);Nt.add(e)}for(let i of e.parseCandidate(r))if(i.kind==="static"&&Object.hasOwn(Ie,i.root))return b(e,{...i,root:Ie[i.root]});return r}function U(e){if(arguments.length==0)throw new TypeError("`CSS.escape` requires an argument.");var t=String(e),r=t.length,i=-1,n,l="",s=t.charCodeAt(0);if(r==1&&s==45)return"\\"+t;for(;++i<r;){if(n=t.charCodeAt(i),n==0){l+="\uFFFD";continue}if(n>=1&&n<=31||n==127||i==0&&n>=48&&n<=57||i==1&&n>=48&&n<=57&&s==45){l+="\\"+n.toString(16)+" ";continue}if(n>=128||n==45||n==95||n>=48&&n<=57||n>=65&&n<=90||n>=97&&n<=122){l+=t.charAt(i);continue}l+="\\"+t.charAt(i)}return l}function Rt(e){return e.replace(/\\([\dA-Fa-f]{1,6}[\t\n\f\r ]?|[\S\s])/g,t=>t.length>2?String.fromCodePoint(Number.parseInt(t.slice(1).trim(),16)):t[1])}function Et(e){let t=[];return Kt(e,[],(r,i)=>{if(mi(r))return t.push([i,r]),1;if(gi(r)){t.push([i,r[0]]);for(let n of Reflect.ownKeys(r[1]))t.push([[...i,`-${n}`],r[1][n]]);return 1}if(Array.isArray(r)&&r.every(n=>typeof n=="string"))return t.push([i,r.join(", ")]),1}),t}var di=/^[a-zA-Z0-9-_%/\.]+$/;function z(e){e[0]==="colors"&&(e[0]="color"),e[0]==="screens"&&(e[0]="breakpoint"),e[0]==="borderRadius"&&(e[0]="radius"),e[0]==="boxShadow"&&(e[0]="shadow"),e[0]==="animation"&&(e[0]="animate");for(let t of e)if(!di.test(t))return null;return e.map((t,r,i)=>t==="1"&&r!==i.length-1?"":t).map(t=>t.replaceAll(".","_").replace(/([a-z])([A-Z])/g,(r,i,n)=>`${i}-${n.toLowerCase()}`)).filter((t,r)=>t!=="DEFAULT"||r!==e.length-1).join("-")}function mi(e){return typeof e=="number"||typeof e=="string"}function gi(e){if(!Array.isArray(e)||e.length!==2||typeof e[0]!="string"&&typeof e[0]!="number"||e[1]===void 0||e[1]===null||typeof e[1]!="object")return!1;for(let t of Reflect.ownKeys(e[1]))if(typeof t!="string"||typeof e[1][t]!="string"&&typeof e[1][t]!="number")return!1;return!0}function Kt(e,t=[],r){for(let i of Reflect.ownKeys(e)){let n=e[i];if(n==null)continue;let l=[...t,i],s=r(n,l)??0;if(s!==1){if(s===2)break;!Array.isArray(n)&&typeof n!="object"||Kt(n,l,r)}}}function B(e){let t=[];for(let r of v(e,".")){if(!r.includes("[")){t.push(r);continue}let i=0;for(;;){let n=r.indexOf("[",i),l=r.indexOf("]",n);if(n===-1||l===-1)break;n>i&&t.push(r.slice(i,n)),t.push(r.slice(n+1,l)),i=l+1}i<=r.length-1&&t.push(r.slice(i))}return t}function Ot(e,t,r){let i=Fe(e);for(let n of P(r,e)){let l=structuredClone(n),s=!1;if(l.kind==="arbitrary"){let[o,a]=i(l.value,l.modifier===null?1:0);o!==l.value&&(s=!0,l.value=o,a!==null&&(l.modifier=a))}else if(l.kind==="functional"&&l.value?.kind==="arbitrary"){let[o,a]=i(l.value.value,l.modifier===null?1:0);o!==l.value.value&&(s=!0,l.value.value=o,a!==null&&(l.modifier=a))}for(let o of yi(l))if(o.kind==="arbitrary"){let[a]=i(o.selector,2);a!==o.selector&&(s=!0,o.selector=a)}else if(o.kind==="functional"&&o.value?.kind==="arbitrary"){let[a]=i(o.value.value,2);a!==o.value.value&&(s=!0,o.value.value=a)}return s?b(e,l):r}return r}function Fe(e,{prettyPrint:t=!1}={}){function r(s,o=0){let a=V(s);if(o&2)return[ge(a,l),null];let u=0,f=0;if(_(a,m=>{m.kind==="function"&&m.value==="theme"&&(u+=1,_(m.nodes,d=>d.kind==="separator"&&d.value.includes(",")?2:d.kind==="separator"&&d.value.trim()==="/"?(f+=1,2):1))}),u===0)return[s,null];if(f===0)return[ge(a,n),null];if(f>1)return[ge(a,l),null];let p=null;return[ge(a,(m,d)=>{let g=v(m,"/").map(h=>h.trim());if(g.length>2)return null;if(g.length===2&&o&1){let[h,y]=g;if(/^\d+%$/.test(y))p={kind:"named",value:y.slice(0,-1)};else if(/^0?\.\d+$/.test(y)){let k=Number(y)*100;p={kind:Number.isInteger(k)?"named":"arbitrary",value:k.toString()}}else p={kind:"arbitrary",value:y};m=h}return n(m,d)||l(m,d)}),p]}function i(s){let o=`--${z(B(s))}`;return e.theme.get([o])?o:null}function n(s,o){let a=i(s);return a?o?`var(${a}, ${o})`:`var(${a})`:null}function l(s,o){let a=v(s,"/").map(p=>p.trim());s=a.shift();let u=i(s);if(!u)return null;let f=a.length>0?t?` / ${a.join(" / ")}`:`/${a.join("/")}`:"";return o?`theme(${u}${f}, ${o})`:`theme(${u}${f})`}return r}function ge(e,t){return _(e,(r,{replaceWith:i})=>{if(r.kind==="function"&&r.value==="theme"){if(r.nodes.length<1)return;let n=r.nodes[0];if(n.kind!=="word")return;let l=n.value,s=1;for(let u=s;u<r.nodes.length&&!r.nodes[u].value.includes(",");u++)l+=S([r.nodes[u]]),s=u+1;l=hi(l);let o=r.nodes.slice(s+1),a=o.length>0?t(l,S(o)):t(l);if(a===null)return;i(V(a))}}),S(e)}function hi(e){if(e[0]!=="'"&&e[0]!=='"')return e;let t="",r=e[0];for(let i=1;i<e.length-1;i++){let n=e[i],l=e[i+1];n==="\\"&&(l===r||l==="\\")?(t+=l,i++):t+=n}return t}function*yi(e){function*t(r){yield r,r.kind==="compound"&&(yield*t(r.variant))}for(let r of e.variants)yield*t(r)}function Dt(e,t,r){for(let i of e.parseCandidate(r)){if(i.variants.length<=1)continue;let n=[],l=[],s=[],o=i.variants;for(let f of i.variants)vi(e,f)?n.push(f):bi(e,f)?s.push(f):l.push(f);let a=l.some(f=>wi(e,f)),u=[...s,...a?l.reverse():l,...n];if(!ki(o,u))return b(e,{...i,variants:u})}return r}function vi(e,t){return t.kind==="static"&&t.root==="dark"?!0:Me(e,t).every(i=>i.kind==="rule"&&i.selector[0]==="@")}function wi(e,t){return Me(e,t).some(i=>i.kind==="rule"&&i.selector[0]!=="@"&&(i.selector.includes(" ")||i.selector.includes(">")||i.selector.includes("+")||i.selector.includes("~")))}function bi(e,t){return Me(e,t).some(i=>i.kind==="rule"&&(i.selector.includes("::after")||i.selector.includes("::backdrop")||i.selector.includes("::before")||i.selector.includes("::first-letter")||i.selector.includes("::first-line")||i.selector.includes("::marker")||i.selector.includes("::placeholder")||i.selector.includes("::selection")))}function Me(e,t){let r=[],i=e.compileAstNodes({kind:"arbitrary",property:"color",value:"red",modifier:null,variants:[t],important:!1,raw:"candidate"}).map(n=>n.node);return N(i,n=>{n.kind==="rule"&&n.selector===".candidate"||n.kind==="declaration"&&n.property==="color"&&n.value==="red"||r.push(n)}),r}function ki(e,t){return e.length!==t.length?!1:e.every((r,i)=>t[i]===r)}function jt(e,t){if(!t[0])return e;t.sort((n,l)=>n.end-l.end||n.start-l.start);let r="",i=t[0];r+=e.slice(0,i.start),r+=i.replacement;for(let n=1;n<t.length;++n){let l=t[n];r+=e.slice(i.end,l.start),r+=l.replacement,i=l}return r+=e.slice(i.end),r}var Ai=[_t,$t,xt,At,Pt,kt,Tt,Ot,Dt];function Le(e,t,r,i){for(let n of Ai)r=n(e,t,r,i);return r}async function Ft(e,t,r,i){let n=await pt(r,i),l=[];for(let{rawCandidate:s,start:o,end:a}of n){let u=Le(e,t,s,{contents:r,start:o,end:a});u!==s&&l.push({start:o,end:a,replacement:u})}return jt(r,l)}async function Mt(e,t,r){let i=xi.resolve(process.cwd(),r),n=await It.readFile(i,"utf-8");await It.writeFile(i,await Ft(e,t,n,Ci(r)))}function Lt({designSystem:e,userConfig:t}){function r(i){let n=i.params.split(/(\s+)/),l=n[n.length-1]==="!important"||n[n.length-1]==="#{!important}";l&&n.pop();let s=n.map(o=>{if(o.trim()==="")return o;let a=v(o,":"),u=a.pop();return l&&u[0]!=="!"&&u[u.length-1]!=="!"&&(u+="!"),[...a,u].join(":")});s=s.map(o=>Le(e,t,o)),i.params=s.join("").trim()}return{postcssPlugin:"@tailwindcss/upgrade/migrate-at-apply",OnceExit(i){i.walkAtRules("apply",r)}}}import"postcss";import ye from"postcss-selector-parser";import*as Ut from"node:fs/promises";import*as he from"node:path";import*as zt from"node:util";import*as Ue from"postcss";var W=class e{id;root;file=null;parents=new Set;children=new Set;canMigrate=!0;extension=null;static async load(t){t=he.resolve(process.cwd(),t);let r=await Ut.readFile(t,"utf-8"),i=Ue.parse(r,{from:t});return new e(i,t)}static async fromString(t){let r=Ue.parse(t);return new e(r)}static async fromRoot(t,r){return new e(t,r)}constructor(t,r){this.id=Math.random().toString(36).slice(2),this.root=t,this.file=r??null,r&&(this.extension=he.extname(r))}get importRules(){let t=new Set;return this.root.walkAtRules("import",r=>{t.add(r)}),t}get isEmpty(){return this.root.toString().trim()===""}*ancestors(){for(let{item:t}of Z(this,r=>r.parents))yield t}*descendants(){for(let{item:t}of Z(this,r=>r.children))yield t}layers(){let t=new Set;for(let{item:r,path:i}of Z(this,n=>n.parents))if(!(r.parents.size>0))for(let{meta:n}of i)for(let l of n.layers)t.add(l);return t}*pathsToRoot(){for(let{item:t,path:r}of Z(this,i=>i.parents))t.parents.size>0||(yield r)}analyzeImportPaths(){let t=[],r=[];for(let i of this.pathsToRoot()){let n=!1;for(let{meta:l}of i)for(let s of l.layers)n||=s==="utilities"||s==="components";n?t.push(i):r.push(i)}return{convertiblePaths:t,nonConvertiblePaths:r}}[zt.inspect.custom](){return{...this,root:this.root.toString(),layers:Array.from(this.layers()),parents:Array.from(this.parents,t=>t.item.id),children:Array.from(this.children,t=>t.item.id),parentsMeta:Array.from(this.parents,t=>t.meta),childrenMeta:Array.from(this.children,t=>t.meta)}}};function*Z(e,t,r=[]){for(let i of t(e)){let n=[...r,i];yield*Z(i.item,t,n),yield{item:i.item,path:n}}}function Bt(e){function t(r){if(r.params!=="utilities"&&r.params!=="components")return;let i=r.clone();w(r,s=>{if(s.type!=="rule")return;let o=v(s.selector,",");if(o.length>1){let a=[];for(let u of o){let f=s.clone({selector:u});a.push(f)}s.replaceWith(a)}return 1});let n=new Set;w(r,s=>{if(s.type==="rule")return ye(o=>{o.each(a=>{w(a,u=>{if(u.type==="pseudo"&&u.value===":not")return 1;u.type==="class"&&n.add(u.value)})})}).processSync(s.selector,{updateSelector:!1}),1}),w(i,s=>{s.type==="rule"&&ye(o=>{o.each(a=>{w(a,u=>{if(u.type==="pseudo"&&u.value===":not")return 1;if(u.type==="class"&&n.has(u.value))return s.remove(),2})})}).processSync(s,{updateSelector:!0})});let l=[i];for(let s of n){let o=r.clone();l.push(o),w(o,a=>{if(a.type==="atrule"&&(!a.nodes||a.nodes?.length===0)&&a.remove(),a.type!=="rule")return;let u=!1;if(ye(f=>{f.each(p=>{w(p,c=>{if(c.type==="pseudo"&&c.value===":not")return 1;if(c.type==="class"&&c.value===s){u=!0;let m=p.atPosition(c.source.start.line,c.source.start.column),d=m.parent,g=(m.parent?.index(m)??0)-1;for(;g>=0&&d.at(g)?.type!=="combinator";){let h=d.at(g+1),y=d.at(g);d.at(g+1).replaceWith(y),d.at(g).replaceWith(h),g--}m.replaceWith(ye.nesting())}})})}).processSync(a,{updateSelector:!0}),!u){let f=[a],p=a.parent?.index(a)??null;if(p!==null)for(let c=p-1;c>=0&&a.parent?.nodes.at(c)?.type!=="rule";c--)a.parent?.nodes.at(c)?.type==="comment"&&f.push(a.parent?.nodes.at(c));for(let c of f)c.remove()}return 1}),o.name="utility",o.params=s,o.raws.tailwind_pretty=!0,o.raws.before=`${o.raws.before??""}
|
|
11
|
+
`);return p}let s="";for(let u of e){let f=l(u);f!==""&&(s+=f)}let o=[];i.length&&o.push(x(":root",i)),n.length&&o.push(x("*, ::before, ::after, ::backdrop",n));let a="";return o.length&&(a=l(x("@supports (-moz-orient: inline)",[x("@layer base",o)]))),`${s}${a}${t}`}function $t(e,t,r){for(let i of e.parseCandidate(r)){let n=structuredClone(i),l=!1;if("modifier"in n&&n.modifier?.kind==="arbitrary"&&!he(e,n,n.modifier.value)){let{value:s,didChange:o}=ge(n.modifier.value);n.modifier.value=s,l||=o}for(let s of n.variants)Tt(e,s)&&(l=!0);if(n.kind==="arbitrary"&&!he(e,n,n.value)){let{value:s,didChange:o}=ge(n.value);n.value=s,l||=o}if(n.kind==="functional"&&n.value&&n.value.kind==="arbitrary"&&!he(e,n,n.value.value)){let{value:s,didChange:o}=ge(n.value.value);n.value.value=s,l||=o}if(l)return k(e,n)}return r}function ge(e){let t=!1;return e.startsWith("--")?(e=`var(${e})`,t=!0):e.startsWith(" --")&&(e=e.slice(1),t=!0),{value:e,didChange:t}}function Tt(e,t){let r=!1;if(t.kind==="functional"&&t.value&&t.value.kind==="arbitrary"&&!he(e,gi(t),t.value.value)){let{value:i,didChange:n}=ge(t.value.value);t.value.value=i,r||=n}return t.kind==="compound"&&Tt(e,t.variant)&&(r=!0),r}function gi(e){return{kind:"arbitrary",property:"color",value:"red",modifier:null,variants:[e],important:!1,raw:"candidate"}}var hi=new Set(["scroll-timeline-name","timeline-scope","view-timeline-name","font-palette","anchor-name","anchor-scope","position-anchor","position-try-options","scroll-timeline","animation-timeline","view-timeline","position-try"]);function he(e,t,r){let i=e.compileAstNodes(t).map(l=>l.node),n=!1;return V(i,l=>{if(l.kind==="declaration"&&hi.has(l.property)&&l.value==r)return n=!0,2}),n}var yi=["t","tr","r","br","b","bl","l","tl"];function _t(e,t,r){for(let i of e.parseCandidate(r))if(i.kind==="static"&&i.root.startsWith("bg-gradient-to-")){let n=i.root.slice(15);if(!yi.includes(n))continue;return k(e,{...i,root:`bg-linear-to-${n}`})}return r}var Nt=['"',"'","`"],vi=["&&","||","===","==","!=","!==",">",">=","<","<="],wi=[/v-else-if=['"]$/,/v-if=['"]$/,/v-show=['"]$/,/x-if=['"]$/,/x-show=['"]$/];function Vt(e,t,r,i){e:for(let n of P(r,e))if(n.important&&n.raw[n.raw.length-1]!=="!"){if(i){let l="";for(let u=i.start-1;u>=0;u--){let f=i.contents.at(u);if(f===`
|
|
12
|
+
`)break;l=f+l}let s="";for(let u=i.end;u<i.contents.length;u++){let f=i.contents.at(u);if(f===`
|
|
13
|
+
`)break;s+=f}let o=Nt.some(u=>l.includes(u)),a=Nt.some(u=>s.includes(u));if(!o||!a||s[0]===".")continue e;for(let u of vi)if(s.trim().startsWith(u)||l.trim().endsWith(u))continue e;for(let u of wi)if(u.test(l))continue e}return k(e,n)}return r}function Pt(e,t,r){for(let i of e.parseCandidate(r))if(i.kind==="functional"&&i.root==="max-w"&&i.value?.value.startsWith("screen-"))return k(e,{...i,value:{...i.value,value:`[theme(screens.${i.value.value.slice(7)})]`}});return r}function Rt(e,t,r){if(!e.theme.prefix)return r;let i=bi(e,t,r);if(!i)return r;let n=e.theme.prefix,l=null;try{e.theme.prefix=null;let s=r.slice(0,i.start)+i.base+r.slice(i.end),o=[...P(s,e)];o.length>0&&(l=o[0])}finally{e.theme.prefix=n}return l?k(e,l):r}function bi(e,t,r){if(!e.theme.prefix)return null;if(!t.prefix)throw new Error("Could not find the Tailwind CSS v3 `prefix` configuration inside the JavaScript config.");let n=v(r,":").pop(),l=r.length-n.length,s=l+n.length,o=!1,a=!1;return n[n.length-1]==="!"?(o=!0,n=n.slice(0,-1)):n[0]==="!"&&(o=!0,n=n.slice(1)),n[0]==="-"&&(a=!0,n=n.slice(1)),!n.startsWith(t.prefix)&&n[0]!=="["?null:(n[0]!=="["&&(n=n.slice(t.prefix.length)),a&&(n="-"+n),o&&(n+="!"),{base:n,start:l,end:s})}var ki=/([a-z]+)/;function Et(e){let t=ki.exec(e.toLocaleLowerCase());return t?t[0]:(console.warn(`The prefix "${e} can not be used with Tailwind CSS v4 and cannot be converted to a valid one automatically. We've updated it to "tw" for you.`),"tw")}var We={"overflow-clip":"text-clip","overflow-ellipsis":"text-ellipsis","flex-grow":"grow","flex-grow-0":"grow-0","flex-shrink":"shrink","flex-shrink-0":"shrink-0","decoration-clone":"box-decoration-clone","decoration-slice":"box-decoration-slice"},Ot=new WeakSet;function Kt(e,t,r){if(!Ot.has(e)){for(let i in We)e.utilities.static(i,()=>[]);Ot.add(e)}for(let i of e.parseCandidate(r))if(i.kind==="static"&&Object.hasOwn(We,i.root))return k(e,{...i,root:We[i.root]});return r}function W(e){if(arguments.length==0)throw new TypeError("`CSS.escape` requires an argument.");var t=String(e),r=t.length,i=-1,n,l="",s=t.charCodeAt(0);if(r==1&&s==45)return"\\"+t;for(;++i<r;){if(n=t.charCodeAt(i),n==0){l+="\uFFFD";continue}if(n>=1&&n<=31||n==127||i==0&&n>=48&&n<=57||i==1&&n>=48&&n<=57&&s==45){l+="\\"+n.toString(16)+" ";continue}if(n>=128||n==45||n==95||n>=48&&n<=57||n>=65&&n<=90||n>=97&&n<=122){l+=t.charAt(i);continue}l+="\\"+t.charAt(i)}return l}function Dt(e){return e.replace(/\\([\dA-Fa-f]{1,6}[\t\n\f\r ]?|[\S\s])/g,t=>t.length>2?String.fromCodePoint(Number.parseInt(t.slice(1).trim(),16)):t[1])}function jt(e){let t=[];return It(e,[],(r,i)=>{if(Ai(r))return t.push([i,r]),1;if(Si(r)){t.push([i,r[0]]);for(let n of Reflect.ownKeys(r[1]))t.push([[...i,`-${n}`],r[1][n]]);return 1}if(Array.isArray(r)&&r.every(n=>typeof n=="string"))return t.push([i,r.join(", ")]),1}),t}var Ci=/^[a-zA-Z0-9-_%/\.]+$/;function z(e){e[0]==="colors"&&(e[0]="color"),e[0]==="screens"&&(e[0]="breakpoint"),e[0]==="borderRadius"&&(e[0]="radius"),e[0]==="boxShadow"&&(e[0]="shadow"),e[0]==="animation"&&(e[0]="animate");for(let t of e)if(!Ci.test(t))return null;return e.map((t,r,i)=>t==="1"&&r!==i.length-1?"":t).map(t=>t.replaceAll(".","_").replace(/([a-z])([A-Z])/g,(r,i,n)=>`${i}-${n.toLowerCase()}`)).filter((t,r)=>t!=="DEFAULT"||r!==e.length-1).join("-")}function Ai(e){return typeof e=="number"||typeof e=="string"}function Si(e){if(!Array.isArray(e)||e.length!==2||typeof e[0]!="string"&&typeof e[0]!="number"||e[1]===void 0||e[1]===null||typeof e[1]!="object")return!1;for(let t of Reflect.ownKeys(e[1]))if(typeof t!="string"||typeof e[1][t]!="string"&&typeof e[1][t]!="number")return!1;return!0}function It(e,t=[],r){for(let i of Reflect.ownKeys(e)){let n=e[i];if(n==null)continue;let l=[...t,i],s=r(n,l)??0;if(s!==1){if(s===2)break;!Array.isArray(n)&&typeof n!="object"||It(n,l,r)}}}function B(e){let t=[];for(let r of v(e,".")){if(!r.includes("[")){t.push(r);continue}let i=0;for(;;){let n=r.indexOf("[",i),l=r.indexOf("]",n);if(n===-1||l===-1)break;n>i&&t.push(r.slice(i,n)),t.push(r.slice(n+1,l)),i=l+1}i<=r.length-1&&t.push(r.slice(i))}return t}function Ft(e,t,r){let i=ze(e);for(let n of P(r,e)){let l=structuredClone(n),s=!1;if(l.kind==="arbitrary"){let[o,a]=i(l.value,l.modifier===null?1:0);o!==l.value&&(s=!0,l.value=o,a!==null&&(l.modifier=a))}else if(l.kind==="functional"&&l.value?.kind==="arbitrary"){let[o,a]=i(l.value.value,l.modifier===null?1:0);o!==l.value.value&&(s=!0,l.value.value=o,a!==null&&(l.modifier=a))}for(let o of Ti(l))if(o.kind==="arbitrary"){let[a]=i(o.selector,2);a!==o.selector&&(s=!0,o.selector=a)}else if(o.kind==="functional"&&o.value?.kind==="arbitrary"){let[a]=i(o.value.value,2);a!==o.value.value&&(s=!0,o.value.value=a)}return s?k(e,l):r}return r}function ze(e,{prettyPrint:t=!1}={}){function r(s,o=0){let a=A(s);if(o&2)return[ve(a,l),null];let u=0,f=0;if(N(a,m=>{m.kind==="function"&&m.value==="theme"&&(u+=1,N(m.nodes,d=>d.kind==="separator"&&d.value.includes(",")?2:d.kind==="separator"&&d.value.trim()==="/"?(f+=1,2):1))}),u===0)return[s,null];if(f===0)return[ve(a,n),null];if(f>1)return[ve(a,l),null];let p=null;return[ve(a,(m,d)=>{let g=v(m,"/").map(h=>h.trim());if(g.length>2)return null;if(g.length===2&&o&1){let[h,y]=g;if(/^\d+%$/.test(y))p={kind:"named",value:y.slice(0,-1)};else if(/^0?\.\d+$/.test(y)){let C=Number(y)*100;p={kind:Number.isInteger(C)?"named":"arbitrary",value:C.toString()}}else p={kind:"arbitrary",value:y};m=h}return n(m,d)||l(m,d)}),p]}function i(s){let o=`--${z(B(s))}`;return e.theme.get([o])?o:null}function n(s,o){let a=i(s);return a?o?`var(${a}, ${o})`:`var(${a})`:null}function l(s,o){let a=v(s,"/").map(p=>p.trim());s=a.shift();let u=i(s);if(!u)return null;let f=a.length>0?t?` / ${a.join(" / ")}`:`/${a.join("/")}`:"";return o?`theme(${u}${f}, ${o})`:`theme(${u}${f})`}return r}function ve(e,t){return N(e,(r,{replaceWith:i})=>{if(r.kind==="function"&&r.value==="theme"){if(r.nodes.length<1)return;let n=r.nodes[0];if(n.kind!=="word")return;let l=n.value,s=1;for(let u=s;u<r.nodes.length&&!r.nodes[u].value.includes(",");u++)l+=w([r.nodes[u]]),s=u+1;l=$i(l);let o=r.nodes.slice(s+1),a=o.length>0?t(l,w(o)):t(l);if(a===null)return;i(A(a))}}),w(e)}function $i(e){if(e[0]!=="'"&&e[0]!=='"')return e;let t="",r=e[0];for(let i=1;i<e.length-1;i++){let n=e[i],l=e[i+1];n==="\\"&&(l===r||l==="\\")?(t+=l,i++):t+=n}return t}function*Ti(e){function*t(r){yield r,r.kind==="compound"&&(yield*t(r.variant))}for(let r of e.variants)yield*t(r)}function Lt(e,t,r){for(let i of e.parseCandidate(r)){if(i.variants.length<=1)continue;let n=[],l=[],s=[],o=i.variants;for(let f of i.variants)_i(e,f)?n.push(f):Vi(e,f)?s.push(f):l.push(f);let a=l.some(f=>Ni(e,f)),u=[...s,...a?l.reverse():l,...n];if(!Pi(o,u))return k(e,{...i,variants:u})}return r}function _i(e,t){return t.kind==="static"&&t.root==="dark"?!0:Be(e,t).every(i=>i.kind==="rule"&&i.selector[0]==="@")}function Ni(e,t){return Be(e,t).some(i=>i.kind==="rule"&&i.selector[0]!=="@"&&(i.selector.includes(" ")||i.selector.includes(">")||i.selector.includes("+")||i.selector.includes("~")))}function Vi(e,t){return Be(e,t).some(i=>i.kind==="rule"&&(i.selector.includes("::after")||i.selector.includes("::backdrop")||i.selector.includes("::before")||i.selector.includes("::first-letter")||i.selector.includes("::first-line")||i.selector.includes("::marker")||i.selector.includes("::placeholder")||i.selector.includes("::selection")))}function Be(e,t){let r=[],i=e.compileAstNodes({kind:"arbitrary",property:"color",value:"red",modifier:null,variants:[t],important:!1,raw:"candidate"}).map(n=>n.node);return V(i,n=>{n.kind==="rule"&&n.selector===".candidate"||n.kind==="declaration"&&n.property==="color"&&n.value==="red"||r.push(n)}),r}function Pi(e,t){return e.length!==t.length?!1:e.every((r,i)=>t[i]===r)}function Mt(e,t){if(!t[0])return e;t.sort((n,l)=>n.end-l.end||n.start-l.start);let r="",i=t[0];r+=e.slice(0,i.start),r+=i.replacement;for(let n=1;n<t.length;++n){let l=t[n];r+=e.slice(i.end,l.start),r+=l.replacement,i=l}return r+=e.slice(i.end),r}var Oi=[Rt,Vt,$t,_t,Kt,St,Pt,Ft,Lt];function qe(e,t,r,i){for(let n of Oi)r=n(e,t,r,i);return r}async function Wt(e,t,r,i){let n=await ht(r,i),l=[];for(let{rawCandidate:s,start:o,end:a}of n){let u=qe(e,t,s,{contents:r,start:o,end:a});u!==s&&l.push({start:o,end:a,replacement:u})}return Mt(r,l)}async function zt(e,t,r){let i=Ri.resolve(process.cwd(),r),n=await Ut.readFile(i,"utf-8");await Ut.writeFile(i,await Wt(e,t,n,Ei(r)))}function Bt({designSystem:e,userConfig:t}){function r(i){let n=i.params.split(/(\s+)/),l=n[n.length-1]==="!important"||n[n.length-1]==="#{!important}";l&&n.pop();let s=n.map(o=>{if(o.trim()==="")return o;let a=v(o,":"),u=a.pop();return l&&u[0]!=="!"&&u[u.length-1]!=="!"&&(u+="!"),[...a,u].join(":")});s=s.map(o=>qe(e,t,o)),i.params=s.join("").trim()}return{postcssPlugin:"@tailwindcss/upgrade/migrate-at-apply",OnceExit(i){i.walkAtRules("apply",r)}}}import"postcss";import be from"postcss-selector-parser";import*as qt from"node:fs/promises";import*as we from"node:path";import*as Jt from"node:util";import*as Je from"postcss";var q=class e{id;root;file=null;parents=new Set;children=new Set;canMigrate=!0;extension=null;static async load(t){t=we.resolve(process.cwd(),t);let r=await qt.readFile(t,"utf-8"),i=Je.parse(r,{from:t});return new e(i,t)}static async fromString(t){let r=Je.parse(t);return new e(r)}static async fromRoot(t,r){return new e(t,r)}constructor(t,r){this.id=Math.random().toString(36).slice(2),this.root=t,this.file=r??null,r&&(this.extension=we.extname(r))}get importRules(){let t=new Set;return this.root.walkAtRules("import",r=>{t.add(r)}),t}get isEmpty(){return this.root.toString().trim()===""}*ancestors(){for(let{item:t}of ee(this,r=>r.parents))yield t}*descendants(){for(let{item:t}of ee(this,r=>r.children))yield t}layers(){let t=new Set;for(let{item:r,path:i}of ee(this,n=>n.parents))if(!(r.parents.size>0))for(let{meta:n}of i)for(let l of n.layers)t.add(l);return t}*pathsToRoot(){for(let{item:t,path:r}of ee(this,i=>i.parents))t.parents.size>0||(yield r)}analyzeImportPaths(){let t=[],r=[];for(let i of this.pathsToRoot()){let n=!1;for(let{meta:l}of i)for(let s of l.layers)n||=s==="utilities"||s==="components";n?t.push(i):r.push(i)}return{convertiblePaths:t,nonConvertiblePaths:r}}containsRule(t){let r=!1;if(this.root.walk(i=>{if(t(i))return r=!0,!1}),r)return!0;for(let i of this.children)if(i.item.containsRule(t))return!0;return!1}[Jt.inspect.custom](){return{...this,root:this.root.toString(),layers:Array.from(this.layers()),parents:Array.from(this.parents,t=>t.item.id),children:Array.from(this.children,t=>t.item.id),parentsMeta:Array.from(this.parents,t=>t.meta),childrenMeta:Array.from(this.children,t=>t.meta)}}};function*ee(e,t,r=[]){for(let i of t(e)){let n=[...r,i];yield*ee(i.item,t,n),yield{item:i.item,path:n}}}function Gt(e){function t(r){if(r.params!=="utilities"&&r.params!=="components")return;let i=r.clone();b(r,s=>{if(s.type!=="rule")return;let o=v(s.selector,",");if(o.length>1){let a=[];for(let u of o){let f=s.clone({selector:u});a.push(f)}s.replaceWith(a)}return 1});let n=new Set;b(r,s=>{if(s.type==="rule")return be(o=>{o.each(a=>{b(a,u=>{if(u.type==="pseudo"&&u.value===":not")return 1;u.type==="class"&&n.add(u.value)})})}).processSync(s.selector,{updateSelector:!1}),1}),b(i,s=>{s.type==="rule"&&be(o=>{o.each(a=>{b(a,u=>{if(u.type==="pseudo"&&u.value===":not")return 1;if(u.type==="class"&&n.has(u.value))return s.remove(),2})})}).processSync(s,{updateSelector:!0})});let l=[i];for(let s of n){let o=r.clone();l.push(o),b(o,a=>{if(a.type==="atrule"&&(!a.nodes||a.nodes?.length===0)&&a.remove(),a.type!=="rule")return;let u=!1;if(be(f=>{f.each(p=>{b(p,c=>{if(c.type==="pseudo"&&c.value===":not")return 1;if(c.type==="class"&&c.value===s){u=!0;let m=p.atPosition(c.source.start.line,c.source.start.column),d=m.parent,g=(m.parent?.index(m)??0)-1;for(;g>=0&&d.at(g)?.type!=="combinator";){let h=d.at(g+1),y=d.at(g);d.at(g+1).replaceWith(y),d.at(g).replaceWith(h),g--}m.replaceWith(be.nesting())}})})}).processSync(a,{updateSelector:!0}),!u){let f=[a],p=a.parent?.index(a)??null;if(p!==null)for(let c=p-1;c>=0&&a.parent?.nodes.at(c)?.type!=="rule";c--)a.parent?.nodes.at(c)?.type==="comment"&&f.push(a.parent?.nodes.at(c));for(let c of f)c.remove()}return 1}),o.name="utility",o.params=s,o.raws.tailwind_pretty=!0,o.raws.before=`${o.raws.before??""}
|
|
14
14
|
|
|
15
|
-
`}for(let s=l.length-1;s>=0;s--){let o=l[s];
|
|
15
|
+
`}for(let s=l.length-1;s>=0;s--){let o=l[s];De(o,a=>{if(o===i&&a.type==="comment"){let u=!1;for(let f of l)if(f!==i&&(b(f,p=>{if(p.type==="comment"&&p.source?.start?.offset===a.source?.start?.offset)return a.remove(),u=!0,2}),u))return 1}if((a.type==="rule"||a.type==="atrule")&&a.nodes?.length===0)a.remove();else if(a.type==="rule"&&a.selector==="&"){let u=a.parent,f=!1;for(;u;){if(u.type==="rule"){f=!0;break}u=u.parent}f||a.replaceWith(a.nodes)}}),o.nodes?.length===0&&l.splice(s,1)}r.replaceWith(l)}return{postcssPlugin:"@tailwindcss/upgrade/migrate-at-layer-utilities",OnceExit:(r,{atRule:i})=>{let n=e.layers(),l=n.has("utilities")||n.has("components");if(l){let s=i({name:"layer",params:"utilities"});s.append(r.nodes),r.append(s)}r.walkAtRules("layer",t);{let s=new Map;b(r,o=>{if(o.type==="atrule"&&o.name==="utility"){let a=s.get(o.params);a?(a.append(o.nodes),o.remove()):s.set(o.params,o)}})}l&&r.each(s=>{s.type==="atrule"&&s.name==="layer"&&s.params==="utilities"&&s.replaceWith(s.nodes??[])})}}}import Ki from"dedent";import Di from"postcss";var ji="currentColor",Yt=Ki,Ii=Yt`
|
|
16
16
|
/*
|
|
17
17
|
The default border color has changed to \`currentColor\` in Tailwind CSS v4,
|
|
18
18
|
so we've added these compatibility styles to make sure everything still
|
|
@@ -30,7 +30,7 @@ import{globby as Kr}from"globby";import Or from"node:fs/promises";import In from
|
|
|
30
30
|
border-color: theme(borderColor.DEFAULT);
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
|
-
`,
|
|
33
|
+
`,Fi=Yt`
|
|
34
34
|
/*
|
|
35
35
|
Form elements have a 1px border by default in Tailwind CSS v4, so we've
|
|
36
36
|
added these compatibility styles to make sure everything still looks the
|
|
@@ -46,25 +46,25 @@ import{globby as Kr}from"globby";import Or from"node:fs/promises";import In from
|
|
|
46
46
|
border-width: 0;
|
|
47
47
|
}
|
|
48
48
|
}
|
|
49
|
-
`;function
|
|
49
|
+
`;function Ht({designSystem:e,userConfig:t}){let r=t?.theme?.borderColor?.DEFAULT;function i(l){let s=`--${z(B(l))}`;return!!e.theme.get([s])}function n(l){let s=!1;if(l.walkAtRules("import",f=>{if(/['"]tailwindcss['"]/.test(f.params)||/['"]tailwindcss\/preflight['"]/.test(f.params))return s=!0,!1}),!s)return;let o=null;if(l.walkAtRules(f=>{if(f.name==="import")o=f;else if(f.name==="layer"&&f.params==="base")return o=f,!1}),!o)return;let a="";r!==ji&&(a+=Ii,a+=`
|
|
50
50
|
|
|
51
|
-
`),
|
|
51
|
+
`),a+=Fi;let u=Di.parse(a);if(u.walkDecls(f=>{f.value.includes("theme(")&&(f.value=Li(A(f.value),p=>i(p)?r:p==="borderColor.DEFAULT"?"var(--color-gray-200, currentColor)":null))}),l.walkAtRules("theme",f=>{f.walkDecls("--border-color",p=>{p.remove()}),f.nodes?.length===0&&f.remove()}),o.name==="import"){o.after(u);let f=o.next();f&&(f.raws.before=`
|
|
52
52
|
|
|
53
|
-
`)}else{let u
|
|
53
|
+
`)}else{let f=u.last?.raws.before;o.before(u);let p=o.prev();p&&(p.raws.before=f)}}return{postcssPlugin:"@tailwindcss/upgrade/migrate-border-compatibility",OnceExit:n}}function Li(e,t){return N(e,(r,{replaceWith:i})=>{if(r.kind==="function"&&r.value==="theme"){if(r.nodes.length<1)return;let n=r.nodes[0];if(n.kind!=="word")return;let l=n.value,s=1;for(let u=s;u<r.nodes.length&&!r.nodes[u].value.includes(",");u++)l+=w([r.nodes[u]]),s=u+1;l=Mi(l);let o=r.nodes.slice(s+1),a=o.length>0?t(l,w(o)):t(l);if(a===null)return;i(A(a))}}),w(e)}function Mi(e){if(e[0]!=="'"&&e[0]!=='"')return e;let t="",r=e[0];for(let i=1;i<e.length-1;i++){let n=e[i],l=e[i+1];n==="\\"&&(l===r||l==="\\")?(t+=l,i++):t+=n}return t}import ke from"node:path";import Wi,{AtRule as Zt}from"postcss";function Ui(e,t){if(typeof e!="string")throw new TypeError("expected path to be a string");if(e==="\\"||e==="/")return"/";var r=e.length;if(r<=1)return e;var i="";if(r>4&&e[3]==="\\"){var n=e[2];(n==="?"||n===".")&&e.slice(0,2)==="\\\\"&&(e=e.slice(2),i="//")}var l=e.split(/[/\\]+/);return t!==!1&&l[l.length-1]===""&&l.pop(),i+l.join("/")}function Qt(e){let t=Ui(e);return e.startsWith("\\\\")&&t.startsWith("/")&&!t.startsWith("//")?`/${t}`:t}var Xt=new WeakMap;function tr(e,{configFilePath:t,jsConfigMigration:r}){function i(l){let s=Xt.get(l);if(s&&s.includes(t))return;s?s.push(t):Xt.set(l,[t]);let o=l.root;if(!l.file)return;let a=new Zt;if(r===null){{let f=!1;if(o.walkAtRules("config",()=>(f=!0,!1)),f)return}a.append(new Zt({name:"config",params:`'${Ge(l,t)}'`}))}else{let f=`
|
|
54
54
|
|
|
55
|
-
`;for(let p of r.sources){let c=
|
|
55
|
+
`;for(let p of r.sources){let c=ke.resolve(p.base,p.pattern);f+=`@source '${Ge(l,c)}';
|
|
56
56
|
`}r.sources.length>0&&(f=f+`
|
|
57
|
-
`);for(let p of r.plugins){let c=p.path[0]==="."?
|
|
57
|
+
`);for(let p of r.plugins){let c=p.path[0]==="."?Ge(l,ke.resolve(p.base,p.path)):p.path;if(p.options===null)f+=`@plugin '${c}';
|
|
58
58
|
`;else{f+=`@plugin '${c}' {
|
|
59
|
-
`;for(let[m,d]of Object.entries(p.options)){let g="";typeof d=="string"?g=
|
|
59
|
+
`;for(let[m,d]of Object.entries(p.options)){let g="";typeof d=="string"?g=er(d):Array.isArray(d)?g=d.map(h=>typeof h=="string"?er(h):""+h).join(", "):g=""+d,f+=` ${m}: ${g};
|
|
60
60
|
`}f+=`}
|
|
61
61
|
`}}r.plugins.length>0&&(f=f+`
|
|
62
|
-
`),a.append(Ei.parse(f+r.css))}let u=null;w(o,f=>(f.type==="atrule"&&f.name==="import"&&(u=f),1));for(let f of a?.nodes??[])f.raws.tailwind_pretty=!0;u?u.name==="import"&&u.after(a.nodes):o.prepend(a.nodes)}function n(l){let s=!1,o=!1;if(l.walkAtRules("import",a=>{if(a.params.match(/['"]tailwindcss['"]/))return s=!0,o=!0,!1;a.params.match(/['"]tailwindcss\/.*?['"]/)&&(s=!0)}),!!s){if(o||e.parents.size<=0){i(e);return}if(e.parents.size>0)for(let a of e.ancestors())a.parents.size===0&&i(a)}}return{postcssPlugin:"@tailwindcss/upgrade/migrate-config",OnceExit:n}}function ze(e,t){if(!e.file)throw new Error("Can not find a path for the stylesheet");let r=e.file,i=ve.relative(ve.dirname(r),t);return i[0]!=="."&&(i=`./${i}`),Jt(i)}function Ht(e){return`'${e.replace(/\\/g,"\\\\").replace(/'/g,"\\'")}'`}import"postcss";var Zt={inherit:"inherit",current:"currentColor",transparent:"transparent",black:"#000",white:"#fff",slate:{50:"oklch(0.984 0.003 247.858)",100:"oklch(0.968 0.007 247.896)",200:"oklch(0.929 0.013 255.508)",300:"oklch(0.869 0.022 252.894)",400:"oklch(0.704 0.04 256.788)",500:"oklch(0.554 0.046 257.417)",600:"oklch(0.446 0.043 257.281)",700:"oklch(0.372 0.044 257.287)",800:"oklch(0.279 0.041 260.031)",900:"oklch(0.208 0.042 265.755)",950:"oklch(0.129 0.042 264.695)"},gray:{50:"oklch(0.985 0.002 247.839)",100:"oklch(0.967 0.003 264.542)",200:"oklch(0.928 0.006 264.531)",300:"oklch(0.872 0.01 258.338)",400:"oklch(0.707 0.022 261.325)",500:"oklch(0.551 0.027 264.364)",600:"oklch(0.446 0.03 256.802)",700:"oklch(0.373 0.034 259.733)",800:"oklch(0.278 0.033 256.848)",900:"oklch(0.21 0.034 264.665)",950:"oklch(0.13 0.028 261.692)"},zinc:{50:"oklch(0.985 0 0)",100:"oklch(0.967 0.001 286.375)",200:"oklch(0.92 0.004 286.32)",300:"oklch(0.871 0.006 286.286)",400:"oklch(0.705 0.015 286.067)",500:"oklch(0.552 0.016 285.938)",600:"oklch(0.442 0.017 285.786)",700:"oklch(0.37 0.013 285.805)",800:"oklch(0.274 0.006 286.033)",900:"oklch(0.21 0.006 285.885)",950:"oklch(0.141 0.005 285.823)"},neutral:{50:"oklch(0.985 0 0)",100:"oklch(0.97 0 0)",200:"oklch(0.922 0 0)",300:"oklch(0.87 0 0)",400:"oklch(0.708 0 0)",500:"oklch(0.556 0 0)",600:"oklch(0.439 0 0)",700:"oklch(0.371 0 0)",800:"oklch(0.269 0 0)",900:"oklch(0.205 0 0)",950:"oklch(0.145 0 0)"},stone:{50:"oklch(0.985 0.001 106.423)",100:"oklch(0.97 0.001 106.424)",200:"oklch(0.923 0.003 48.717)",300:"oklch(0.869 0.005 56.366)",400:"oklch(0.709 0.01 56.259)",500:"oklch(0.553 0.013 58.071)",600:"oklch(0.444 0.011 73.639)",700:"oklch(0.374 0.01 67.558)",800:"oklch(0.268 0.007 34.298)",900:"oklch(0.216 0.006 56.043)",950:"oklch(0.147 0.004 49.25)"},red:{50:"oklch(0.971 0.013 17.38)",100:"oklch(0.936 0.032 17.717)",200:"oklch(0.885 0.062 18.334)",300:"oklch(0.808 0.114 19.571)",400:"oklch(0.704 0.191 22.216)",500:"oklch(0.637 0.237 25.331)",600:"oklch(0.577 0.245 27.325)",700:"oklch(0.505 0.213 27.518)",800:"oklch(0.444 0.177 26.899)",900:"oklch(0.396 0.141 25.723)",950:"oklch(0.258 0.092 26.042)"},orange:{50:"oklch(0.98 0.016 73.684)",100:"oklch(0.954 0.038 75.164)",200:"oklch(0.901 0.076 70.697)",300:"oklch(0.837 0.128 66.29)",400:"oklch(0.75 0.183 55.934)",500:"oklch(0.705 0.213 47.604)",600:"oklch(0.646 0.222 41.116)",700:"oklch(0.553 0.195 38.402)",800:"oklch(0.47 0.157 37.304)",900:"oklch(0.408 0.123 38.172)",950:"oklch(0.266 0.079 36.259)"},amber:{50:"oklch(0.987 0.022 95.277)",100:"oklch(0.962 0.059 95.617)",200:"oklch(0.924 0.12 95.746)",300:"oklch(0.879 0.169 91.605)",400:"oklch(0.828 0.189 84.429)",500:"oklch(0.769 0.188 70.08)",600:"oklch(0.666 0.179 58.318)",700:"oklch(0.555 0.163 48.998)",800:"oklch(0.473 0.137 46.201)",900:"oklch(0.414 0.112 45.904)",950:"oklch(0.279 0.077 45.635)"},yellow:{50:"oklch(0.987 0.026 102.212)",100:"oklch(0.973 0.071 103.193)",200:"oklch(0.945 0.129 101.54)",300:"oklch(0.905 0.182 98.111)",400:"oklch(0.852 0.199 91.936)",500:"oklch(0.795 0.184 86.047)",600:"oklch(0.681 0.162 75.834)",700:"oklch(0.554 0.135 66.442)",800:"oklch(0.476 0.114 61.907)",900:"oklch(0.421 0.095 57.708)",950:"oklch(0.286 0.066 53.813)"},lime:{50:"oklch(0.986 0.031 120.757)",100:"oklch(0.967 0.067 122.328)",200:"oklch(0.938 0.127 124.321)",300:"oklch(0.897 0.196 126.665)",400:"oklch(0.841 0.238 128.85)",500:"oklch(0.768 0.233 130.85)",600:"oklch(0.648 0.2 131.684)",700:"oklch(0.532 0.157 131.589)",800:"oklch(0.453 0.124 130.933)",900:"oklch(0.405 0.101 131.063)",950:"oklch(0.274 0.072 132.109)"},green:{50:"oklch(0.982 0.018 155.826)",100:"oklch(0.962 0.044 156.743)",200:"oklch(0.925 0.084 155.995)",300:"oklch(0.871 0.15 154.449)",400:"oklch(0.792 0.209 151.711)",500:"oklch(0.723 0.219 149.579)",600:"oklch(0.627 0.194 149.214)",700:"oklch(0.527 0.154 150.069)",800:"oklch(0.448 0.119 151.328)",900:"oklch(0.393 0.095 152.535)",950:"oklch(0.266 0.065 152.934)"},emerald:{50:"oklch(0.979 0.021 166.113)",100:"oklch(0.95 0.052 163.051)",200:"oklch(0.905 0.093 164.15)",300:"oklch(0.845 0.143 164.978)",400:"oklch(0.765 0.177 163.223)",500:"oklch(0.696 0.17 162.48)",600:"oklch(0.596 0.145 163.225)",700:"oklch(0.508 0.118 165.612)",800:"oklch(0.432 0.095 166.913)",900:"oklch(0.378 0.077 168.94)",950:"oklch(0.262 0.051 172.552)"},teal:{50:"oklch(0.984 0.014 180.72)",100:"oklch(0.953 0.051 180.801)",200:"oklch(0.91 0.096 180.426)",300:"oklch(0.855 0.138 181.071)",400:"oklch(0.777 0.152 181.912)",500:"oklch(0.704 0.14 182.503)",600:"oklch(0.6 0.118 184.704)",700:"oklch(0.511 0.096 186.391)",800:"oklch(0.437 0.078 188.216)",900:"oklch(0.386 0.063 188.416)",950:"oklch(0.277 0.046 192.524)"},cyan:{50:"oklch(0.984 0.019 200.873)",100:"oklch(0.956 0.045 203.388)",200:"oklch(0.917 0.08 205.041)",300:"oklch(0.865 0.127 207.078)",400:"oklch(0.789 0.154 211.53)",500:"oklch(0.715 0.143 215.221)",600:"oklch(0.609 0.126 221.723)",700:"oklch(0.52 0.105 223.128)",800:"oklch(0.45 0.085 224.283)",900:"oklch(0.398 0.07 227.392)",950:"oklch(0.302 0.056 229.695)"},sky:{50:"oklch(0.977 0.013 236.62)",100:"oklch(0.951 0.026 236.824)",200:"oklch(0.901 0.058 230.902)",300:"oklch(0.828 0.111 230.318)",400:"oklch(0.746 0.16 232.661)",500:"oklch(0.685 0.169 237.323)",600:"oklch(0.588 0.158 241.966)",700:"oklch(0.5 0.134 242.749)",800:"oklch(0.443 0.11 240.79)",900:"oklch(0.391 0.09 240.876)",950:"oklch(0.293 0.066 243.157)"},blue:{50:"oklch(0.97 0.014 254.604)",100:"oklch(0.932 0.032 255.585)",200:"oklch(0.882 0.059 254.128)",300:"oklch(0.809 0.105 251.813)",400:"oklch(0.707 0.165 254.624)",500:"oklch(0.623 0.214 259.815)",600:"oklch(0.546 0.245 262.881)",700:"oklch(0.488 0.243 264.376)",800:"oklch(0.424 0.199 265.638)",900:"oklch(0.379 0.146 265.522)",950:"oklch(0.282 0.091 267.935)"},indigo:{50:"oklch(0.962 0.018 272.314)",100:"oklch(0.93 0.034 272.788)",200:"oklch(0.87 0.065 274.039)",300:"oklch(0.785 0.115 274.713)",400:"oklch(0.673 0.182 276.935)",500:"oklch(0.585 0.233 277.117)",600:"oklch(0.511 0.262 276.966)",700:"oklch(0.457 0.24 277.023)",800:"oklch(0.398 0.195 277.366)",900:"oklch(0.359 0.144 278.697)",950:"oklch(0.257 0.09 281.288)"},violet:{50:"oklch(0.969 0.016 293.756)",100:"oklch(0.943 0.029 294.588)",200:"oklch(0.894 0.057 293.283)",300:"oklch(0.811 0.111 293.571)",400:"oklch(0.702 0.183 293.541)",500:"oklch(0.606 0.25 292.717)",600:"oklch(0.541 0.281 293.009)",700:"oklch(0.491 0.27 292.581)",800:"oklch(0.432 0.232 292.759)",900:"oklch(0.38 0.189 293.745)",950:"oklch(0.283 0.141 291.089)"},purple:{50:"oklch(0.977 0.014 308.299)",100:"oklch(0.946 0.033 307.174)",200:"oklch(0.902 0.063 306.703)",300:"oklch(0.827 0.119 306.383)",400:"oklch(0.714 0.203 305.504)",500:"oklch(0.627 0.265 303.9)",600:"oklch(0.558 0.288 302.321)",700:"oklch(0.496 0.265 301.924)",800:"oklch(0.438 0.218 303.724)",900:"oklch(0.381 0.176 304.987)",950:"oklch(0.291 0.149 302.717)"},fuchsia:{50:"oklch(0.977 0.017 320.058)",100:"oklch(0.952 0.037 318.852)",200:"oklch(0.903 0.076 319.62)",300:"oklch(0.833 0.145 321.434)",400:"oklch(0.74 0.238 322.16)",500:"oklch(0.667 0.295 322.15)",600:"oklch(0.591 0.293 322.896)",700:"oklch(0.518 0.253 323.949)",800:"oklch(0.452 0.211 324.591)",900:"oklch(0.401 0.17 325.612)",950:"oklch(0.293 0.136 325.661)"},pink:{50:"oklch(0.971 0.014 343.198)",100:"oklch(0.948 0.028 342.258)",200:"oklch(0.899 0.061 343.231)",300:"oklch(0.823 0.12 346.018)",400:"oklch(0.718 0.202 349.761)",500:"oklch(0.656 0.241 354.308)",600:"oklch(0.592 0.249 0.584)",700:"oklch(0.525 0.223 3.958)",800:"oklch(0.459 0.187 3.815)",900:"oklch(0.408 0.153 2.432)",950:"oklch(0.284 0.109 3.907)"},rose:{50:"oklch(0.969 0.015 12.422)",100:"oklch(0.941 0.03 12.58)",200:"oklch(0.892 0.058 10.001)",300:"oklch(0.81 0.117 11.638)",400:"oklch(0.712 0.194 13.428)",500:"oklch(0.645 0.246 16.439)",600:"oklch(0.586 0.253 17.585)",700:"oklch(0.514 0.222 16.935)",800:"oklch(0.455 0.188 13.697)",900:"oklch(0.41 0.159 10.272)",950:"oklch(0.271 0.105 12.094)"}};function we(e,t){if(t===null)return e;let r=Number(t);return Number.isNaN(r)?t[t.length-1]!=="%"&&(t=`calc(${t} * 100%)`):t=`${r*100}%`,`color-mix(in oklch, ${e} ${t}, transparent)`}function q(e){if(Object.prototype.toString.call(e)!=="[object Object]")return!1;let t=Object.getPrototypeOf(e);return t===null||Object.getPrototypeOf(t)===null}function X(e,t,r,i=[]){for(let n of t)if(n!=null)for(let l of Reflect.ownKeys(n)){let s=[...i,l],o=r(e[l],n[l],s);o!==void 0?e[l]=o:!q(e[l])||!q(n[l])?e[l]=n[l]:e[l]=X({},[e[l],n[l]],r,s)}return e}function Be(e,t,r){return function(n,l){let s=n.lastIndexOf("/"),o=null;s!==-1&&(o=n.slice(s+1).trim(),n=n.slice(0,s).trim());let a=(()=>{let u=B(n),[f,p]=Di(e.theme,u),c=r(Xt(t()??{},u)??null);if(typeof f!="object")return typeof p!="object"&&p&4?c??f:f;if(c!==null&&typeof c=="object"&&!Array.isArray(c)){let m=X({},[c],(d,g)=>g);if(f===null&&Object.hasOwn(c,"__CSS_VALUES__")){let d={};for(let g in c.__CSS_VALUES__)d[g]=c[g],delete m[g];f=d}for(let d in f)d!=="__CSS_VALUES__"&&(c?.__CSS_VALUES__?.[d]&4&&Xt(m,d.split("-"))!==void 0||(m[Rt(d)]=f[d]));return m}if(Array.isArray(f)&&Array.isArray(p)&&Array.isArray(c)){let m=f[0],d=f[1];p[0]&4&&(m=c[0]??m);for(let g of Object.keys(d))p[1][g]&4&&(d[g]=c[1][g]??d[g]);return[m,d]}return f??c})();return o&&typeof a=="string"&&(a=we(a,o)),a??l}}function Di(e,t){if(t.length===1&&t[0].startsWith("--"))return[e.get([t[0]]),e.getOptions(t[0])];let r=t.map(f=>f==="1"?"":f).map(f=>f.replaceAll(".","_").replace(/([a-z])([A-Z])/g,(p,c,m)=>`${c}-${m.toLowerCase()}`)).filter((f,p)=>f!=="DEFAULT"||p!==t.length-1).join("-"),i=new Map,n=new T(()=>new Map),l=e.namespace(`--${r}`);if(l.size===0)return[null,0];let s=new Map;for(let[f,p]of l){if(!f||!f.includes("--")){i.set(f,p),s.set(f,e.getOptions(f?`--${r}-${f}`:`--${r}`));continue}let c=f.indexOf("--"),m=f.slice(0,c),d=f.slice(c+2);d=d.replace(/-([a-z])/g,(g,h)=>h.toUpperCase()),n.get(m===""?null:m).set(d,[p,e.getOptions(`--${r}${f}`)])}let o=e.getOptions(`--${r}`);for(let[f,p]of n){let c=i.get(f);if(typeof c!="string")continue;let m={},d={};for(let[g,[h,y]]of p)m[g]=h,d[g]=y;i.set(f,[c,m]),s.set(f,[o,d])}let a={},u={};for(let[f,p]of i)er(a,[f??"DEFAULT"],p);for(let[f,p]of s)er(u,[f??"DEFAULT"],p);return t[t.length-1]==="DEFAULT"?[a?.DEFAULT??null,u.DEFAULT??0]:"DEFAULT"in a&&Object.keys(a).length===1?[a.DEFAULT,u.DEFAULT??0]:(a.__CSS_VALUES__=u,[a,u])}function Xt(e,t){for(let r=0;r<t.length;++r){let i=t[r];if(e[i]===void 0){if(t[r+1]===void 0)return;t[r+1]=`${i}-${t[r+1]}`;continue}e=e[i]}return e}function er(e,t,r){for(let i of t.slice(0,-1))e[i]===void 0&&(e[i]={}),e=e[i];e[t[t.length-1]]=r}var ji={blocklist:[],prefix:"",important:!1,darkMode:null,theme:{},plugins:[],content:{files:[]}};function J(e,t){let r={design:e,configs:[],plugins:[],content:{files:[]},theme:{},extend:{},result:structuredClone(ji)};for(let n of t)We(r,n);for(let n of r.configs)"darkMode"in n&&n.darkMode!==void 0&&(r.result.darkMode=n.darkMode??null),"prefix"in n&&n.prefix!==void 0&&(r.result.prefix=n.prefix??""),"blocklist"in n&&n.blocklist!==void 0&&(r.result.blocklist=n.blocklist??[]),"important"in n&&n.important!==void 0&&(r.result.important=n.important??!1);let i=Fi(r);return{resolvedConfig:{...r.result,content:r.content,theme:r.theme,plugins:r.plugins},replacedThemeKeys:i}}function Ii(e,t){if(Array.isArray(e)&&q(e[0]))return e.concat(t);if(Array.isArray(t)&&q(t[0])&&q(e))return[e,...t];if(Array.isArray(t))return t}function We(e,{config:t,base:r,path:i}){let n=[];for(let o of t.plugins??[])"__isOptionsFunction"in o?n.push(o()):"handler"in o?n.push(o):n.push({handler:o});if(Array.isArray(t.presets)&&t.presets.length===0)throw new Error("Error in the config file/plugin/preset. An empty preset (`preset: []`) is not currently supported.");for(let o of t.presets??[])We(e,{path:i,base:r,config:o});for(let o of n)e.plugins.push(o),o.config&&We(e,{path:i,base:r,config:o.config});let l=t.content??[],s=Array.isArray(l)?l:l.files;for(let o of s)e.content.files.push(typeof o=="object"?o:{base:r,pattern:o});e.configs.push(t)}function Fi(e){let t=new Set,r=Be(e.design,()=>e.theme,n),i=Object.assign(r,{theme:r,colors:Zt});function n(l){return typeof l=="function"?l(i)??null:l??null}for(let l of e.configs){let s=l.theme??{},o=s.extend??{};for(let a in s)a!=="extend"&&t.add(a);Object.assign(e.theme,s);for(let a in o)e.extend[a]??=[],e.extend[a].push(o[a])}delete e.theme.extend;for(let l in e.extend){let s=[e.theme[l],...e.extend[l]];e.theme[l]=()=>{let o=s.map(n);return X({},o,Ii)}}for(let l in e.theme)e.theme[l]=n(e.theme[l]);if(e.theme.screens&&typeof e.theme.screens=="object")for(let l of Object.keys(e.theme.screens)){let s=e.theme.screens[l];s&&typeof s=="object"&&("raw"in s||"max"in s||"min"in s&&(e.theme.screens[l]=s.min))}return t}function tr(e){return(Array.isArray(e)?e:[e]).map(r=>typeof r=="string"?{min:r}:r&&typeof r=="object"?r:null).map(r=>{if(r===null)return null;if("raw"in r)return r.raw;let i="";return r.max!==void 0&&(i+=`${r.max} >= `),i+="width",r.min!==void 0&&(i+=` >= ${r.min}`),`(${i})`}).filter(Boolean).join(", ")}function rr({designSystem:e,userConfig:t}={}){function r(i){if(!e||!t)return;let{resolvedConfig:n}=J(e,[{base:"",config:t}]),l=n?.theme?.screens||{},s=new T(o=>{let a=e?.resolveThemeValue(`--breakpoint-${o}`)??l?.[o];return typeof a=="string"?`(width >= theme(--breakpoint-${o}))`:a?tr(a):null});i.walkAtRules("screen",o=>{o.name="media",o.params=`screen(${o.params})`}),i.walkAtRules(o=>{if(o.name!=="media")return;let a=o.params.match(/screen\(([^)]+)\)/);if(!a)return;let u=s.get(a[1]);u&&(o.params=u)})}return{postcssPlugin:"@tailwindcss/upgrade/migrate-media-screen",OnceExit:r}}import{AtRule as Mi}from"postcss";function ir(){function e(t){let r="",i=[],n=[],l=null;t.each(s=>{if(s.type==="atrule"){if(s.name==="config"||s.name==="source"||s.name==="theme"||s.name==="utility"||s.name==="variant"){i.length>0&&n.push([r,i.splice(0)]);return}if(s.name==="tailwind"&&s.params==="base"||s.name==="import"&&s.params.match(/^["']tailwindcss\/base["']/)){i.length>0&&n.push([r,i.splice(0)]),l??="base",r="base";return}if(s.name==="tailwind"&&s.params==="components"||s.name==="import"&&s.params.match(/^["']tailwindcss\/components["']/)){i.length>0&&n.push([r,i.splice(0)]),l??="components",r="components";return}if(s.name==="tailwind"&&s.params==="utilities"||s.name==="import"&&s.params.match(/^["']tailwindcss\/utilities["']/)){i.length>0&&n.push([r,i.splice(0)]),l??="utilities",r="utilities";return}if(s.name==="layer"){i.length>0&&n.push([r,i.splice(0)]);return}if(s.name==="import"){r!==""&&!s.params.includes("layer(")&&(s.params+=` layer(${r})`,s.raws.tailwind_injected_layer=!0),i.length>0&&n.push([r,i.splice(0)]);return}}r===""&&(s.type==="comment"||s.type==="atrule"&&!s.nodes||s.type==="atrule"&&s.name==="charset")||i.push(s)});for(let[s,o]of n){let a=s||l||"";if(a===""||o.every(p=>p.type==="comment"))continue;let u=o[0],f=new Mi({name:"layer",params:a,nodes:o.map(p=>p===u?p:p.remove()),raws:{tailwind_pretty:!0}});u.replaceWith(f)}}return{postcssPlugin:"@tailwindcss/upgrade/migrate-missing-layers",OnceExit:e}}import{AtRule as be}from"postcss";var qe=["theme","base","components","utilities"];function nr(e){let t=e.newPrefix?` prefix(${e.newPrefix})`:"";function r(i){let n=null,l=null,s=[],o=null,a=null,u=null,f=null,p=[];i.walkAtRules(c=>{if(c.name==="import"&&c.params.match(/^["']tailwindcss\/tailwind\.css["']$/)&&(c.params=c.params.replace("tailwindcss/tailwind.css","tailwindcss")),c.name==="import"&&c.params.match(/^["']tailwindcss["']/))c.params+=t;else if(c.name==="tailwind"&&c.params==="base"||c.name==="import"&&c.params.match(/^["']tailwindcss\/base["']$/))p.push("base"),s.push(c),n=c;else if(c.name==="tailwind"&&c.params==="utilities"||c.name==="import"&&c.params.match(/^["']tailwindcss\/utilities["']$/))p.push("utilities"),s.push(c),l=c;else if(c.name==="tailwind"&&c.params==="components"||c.name==="tailwind"&&c.params==="screens"||c.name==="tailwind"&&c.params==="variants"||c.name==="import"&&c.params.match(/^["']tailwindcss\/components["']$/))c.remove();else if(c.name==="responsive")if(c.nodes){for(let m of c.nodes)m.raws.tailwind_pretty=!0;c.replaceWith(c.nodes)}else c.remove()}),n!==null&&l!==null?(o||ke(s).before(new be({name:"import",params:`'tailwindcss'${t}`})),n?.remove(),l?.remove()):l!==null?(a||ke(s).before(new be({name:"import",params:"'tailwindcss/utilities' layer(utilities)"})),l?.remove()):n!==null&&(f||ke(s).before(new be({name:"import",params:`'tailwindcss/theme' layer(theme)${t}`})),u||ke(s).before(new be({name:"import",params:"'tailwindcss/preflight' layer(base)"})),n?.remove());{let c=p.toSorted((m,d)=>qe.indexOf(m)-qe.indexOf(d));if(p.some((m,d)=>m!==c[d])){let m=qe.toSorted((d,g)=>p.indexOf(d)-p.indexOf(g));i.prepend({name:"layer",params:m.join(", ")})}}}return{postcssPlugin:"@tailwindcss/upgrade/migrate-tailwind-directives",OnceExit:r}}function ke(e){let t=e.at(0),r=t.prev();for(;r;){if(r.type==="rule"&&(t=r),r.type==="atrule")if(r.name==="charset"||r.name==="import"){r=r.prev();continue}else if(r.name==="layer"&&!r.nodes){r=r.prev();continue}else t=r;r=r.prev()}return t}import"postcss";function or({designSystem:e}={}){return{postcssPlugin:"@tailwindcss/upgrade/migrate-theme-to-var",OnceExit(t){if(!e)return;let r=Fe(e,{prettyPrint:!0});t.walkDecls(i=>{let[n]=r(i.value);i.value=n}),t.walkAtRules(i=>{if(i.name==="media"||i.name==="custom-media"||i.name==="container"||i.name==="supports"){let[n]=r(i.params,2);i.params=n}})}}}import"postcss";function lr(){function e(t){t.walkAtRules("variants",r=>{r.name==="variants"&&(r.name="layer",r.params="utilities")})}return{postcssPlugin:"@tailwindcss/upgrade/migrate-variants-directive",OnceExit:e}}async function Ui(e,t,r){return typeof e=="string"&&(e=await W.fromString(e),e.file=r??null),Je().use(Lt(t)).use(rr(t)).use(lr()).use(Bt(e)).use(ir()).use(nr(t)).use(Qt(e,t)).use(qt(t)).use(or(t)).process(e.root,{from:e.file??void 0})}async function sr(e,t){if(!e.file)throw new Error("Cannot migrate a stylesheet without a file path");e.canMigrate&&await Ui(e,t)}async function ar(e){let t=new Map;for(let o of e)o.file&&t.set(o.file,o);let r=Je([{postcssPlugin:"mark-import-nodes",AtRule:{import(o){let a=o.params.match(/['"](.*)['"]/)?.[1];if(!a)return;let u=o.source?.input.file?Li.dirname(o.source.input.file):process.cwd(),f;try{f=it(a,u)}catch(d){console.warn(`Failed to resolve import: ${a}. Skipping.`),console.error(d);return}if(!f)return;let p=t.get(f);if(!p)return;o.raws.tailwind_destination_sheet_id=p.id;let c=o.source?.input.file?t.get(o.source.input.file):void 0,m=[];for(let d of v(o.params," "))d.startsWith("layer(")&&d.endsWith(")")&&m.push(d.slice(6,-1).trim());if(c){let d={layers:m};p.parents.add({item:c,meta:d}),c.children.add({item:p,meta:d})}}}}]);for(let o of e)o.file&&await r.process(o.root,{from:o.file});let i=process.cwd();function n(o){let a=[];for(let u of o){if(!u.item.file)continue;let f=u.item.file.replace(i,""),p=u.meta.layers.join(", ");p.length>0?a.push(`${f} (layers: ${p})`):a.push(f)}return a.join(" <- ")}let l=[];for(let o of e){if(!o.file)continue;let{convertiblePaths:a,nonConvertiblePaths:u}=o.analyzeImportPaths();if(!(a.length>0&&u.length>0))continue;o.canMigrate=!1;let p=o.file.replace(i,"");for(let c of a)l.push(`- ${p} <- ${n(c)}`);for(let c of u)l.push(`- ${p} <- ${n(c)}`)}if(l.length===0)return;let s=`You have one or more stylesheets that are imported into a utility layer and non-utility layer.
|
|
62
|
+
`),a.append(Wi.parse(f+r.css))}let u=null;b(o,f=>(f.type==="atrule"&&f.name==="import"&&(u=f),1));for(let f of a?.nodes??[])f.raws.tailwind_pretty=!0;u?u.name==="import"&&u.after(a.nodes):o.prepend(a.nodes)}function n(l){let s=!1,o=!1;if(l.walkAtRules("import",a=>{if(a.params.match(/['"]tailwindcss['"]/))return s=!0,o=!0,!1;a.params.match(/['"]tailwindcss\/.*?['"]/)&&(s=!0)}),!!s){if(o||e.parents.size<=0){i(e);return}if(e.parents.size>0)for(let a of e.ancestors())a.parents.size===0&&i(a)}}return{postcssPlugin:"@tailwindcss/upgrade/migrate-config",OnceExit:n}}function Ge(e,t){if(!e.file)throw new Error("Can not find a path for the stylesheet");let r=e.file,i=ke.relative(ke.dirname(r),t);return i[0]!=="."&&(i=`./${i}`),Qt(i)}function er(e){return`'${e.replace(/\\/g,"\\\\").replace(/'/g,"\\'")}'`}import Bi from"node:fs/promises";import{dirname as qi,resolve as Ji}from"node:path";import"postcss";function ir(e){let t,r=null,i=null,n=null;for(let l=0;l<e.length;l++){let s=e[l];if(s.kind!=="separator"){if(s.kind==="word"&&!t){if(!s.value)throw new Error("Unable to find uri");if(s.value[0]!=='"'&&s.value[0]!=="'")throw new Error("Unable to find uri");t=s.value.slice(1,-1);continue}if(s.kind==="function"&&s.value.toLowerCase()==="url")throw new Error("url functions are not supported");if(!t)throw new Error("Unable to find uri");if((s.kind==="word"||s.kind==="function")&&s.value.toLowerCase()==="layer"){if(r)throw new Error("Multiple layers");if(n)throw new Error("layers must be defined before support conditions");"nodes"in s?r=w(s.nodes):r="";continue}if(s.kind==="function"&&s.value.toLowerCase()==="supports"){if(n)throw new Error("Multiple support conditions");n=w(s.nodes);continue}i=w(e.slice(l));break}}if(!t)throw new Error("Unable to find uri");return{uri:t,layer:r,media:i,supports:n}}function nr(){async function e(t){let r=t.source?.input.file;if(!r)return;let i=[];t.walkAtRules("import",n=>{let[l,...s]=v(n.params," "),o=ir(A(l)),a=o.uri[0]===".",u=o.uri.endsWith(".css");if(a&&u)return;let f=Ji(qi(r),o.uri);u||(f+=".css"),i.push(Bi.stat(f).then(()=>{let p=u?"":".css",c=a?o.uri:`./${o.uri}`;n.params=[`'${c}${p}'`,...s].join(" ")}))}),await Promise.allSettled(i)}return{postcssPlugin:"@tailwindcss/upgrade/migrate-import",OnceExit:e}}import"postcss";var or={inherit:"inherit",current:"currentColor",transparent:"transparent",black:"#000",white:"#fff",slate:{50:"oklch(0.984 0.003 247.858)",100:"oklch(0.968 0.007 247.896)",200:"oklch(0.929 0.013 255.508)",300:"oklch(0.869 0.022 252.894)",400:"oklch(0.704 0.04 256.788)",500:"oklch(0.554 0.046 257.417)",600:"oklch(0.446 0.043 257.281)",700:"oklch(0.372 0.044 257.287)",800:"oklch(0.279 0.041 260.031)",900:"oklch(0.208 0.042 265.755)",950:"oklch(0.129 0.042 264.695)"},gray:{50:"oklch(0.985 0.002 247.839)",100:"oklch(0.967 0.003 264.542)",200:"oklch(0.928 0.006 264.531)",300:"oklch(0.872 0.01 258.338)",400:"oklch(0.707 0.022 261.325)",500:"oklch(0.551 0.027 264.364)",600:"oklch(0.446 0.03 256.802)",700:"oklch(0.373 0.034 259.733)",800:"oklch(0.278 0.033 256.848)",900:"oklch(0.21 0.034 264.665)",950:"oklch(0.13 0.028 261.692)"},zinc:{50:"oklch(0.985 0 0)",100:"oklch(0.967 0.001 286.375)",200:"oklch(0.92 0.004 286.32)",300:"oklch(0.871 0.006 286.286)",400:"oklch(0.705 0.015 286.067)",500:"oklch(0.552 0.016 285.938)",600:"oklch(0.442 0.017 285.786)",700:"oklch(0.37 0.013 285.805)",800:"oklch(0.274 0.006 286.033)",900:"oklch(0.21 0.006 285.885)",950:"oklch(0.141 0.005 285.823)"},neutral:{50:"oklch(0.985 0 0)",100:"oklch(0.97 0 0)",200:"oklch(0.922 0 0)",300:"oklch(0.87 0 0)",400:"oklch(0.708 0 0)",500:"oklch(0.556 0 0)",600:"oklch(0.439 0 0)",700:"oklch(0.371 0 0)",800:"oklch(0.269 0 0)",900:"oklch(0.205 0 0)",950:"oklch(0.145 0 0)"},stone:{50:"oklch(0.985 0.001 106.423)",100:"oklch(0.97 0.001 106.424)",200:"oklch(0.923 0.003 48.717)",300:"oklch(0.869 0.005 56.366)",400:"oklch(0.709 0.01 56.259)",500:"oklch(0.553 0.013 58.071)",600:"oklch(0.444 0.011 73.639)",700:"oklch(0.374 0.01 67.558)",800:"oklch(0.268 0.007 34.298)",900:"oklch(0.216 0.006 56.043)",950:"oklch(0.147 0.004 49.25)"},red:{50:"oklch(0.971 0.013 17.38)",100:"oklch(0.936 0.032 17.717)",200:"oklch(0.885 0.062 18.334)",300:"oklch(0.808 0.114 19.571)",400:"oklch(0.704 0.191 22.216)",500:"oklch(0.637 0.237 25.331)",600:"oklch(0.577 0.245 27.325)",700:"oklch(0.505 0.213 27.518)",800:"oklch(0.444 0.177 26.899)",900:"oklch(0.396 0.141 25.723)",950:"oklch(0.258 0.092 26.042)"},orange:{50:"oklch(0.98 0.016 73.684)",100:"oklch(0.954 0.038 75.164)",200:"oklch(0.901 0.076 70.697)",300:"oklch(0.837 0.128 66.29)",400:"oklch(0.75 0.183 55.934)",500:"oklch(0.705 0.213 47.604)",600:"oklch(0.646 0.222 41.116)",700:"oklch(0.553 0.195 38.402)",800:"oklch(0.47 0.157 37.304)",900:"oklch(0.408 0.123 38.172)",950:"oklch(0.266 0.079 36.259)"},amber:{50:"oklch(0.987 0.022 95.277)",100:"oklch(0.962 0.059 95.617)",200:"oklch(0.924 0.12 95.746)",300:"oklch(0.879 0.169 91.605)",400:"oklch(0.828 0.189 84.429)",500:"oklch(0.769 0.188 70.08)",600:"oklch(0.666 0.179 58.318)",700:"oklch(0.555 0.163 48.998)",800:"oklch(0.473 0.137 46.201)",900:"oklch(0.414 0.112 45.904)",950:"oklch(0.279 0.077 45.635)"},yellow:{50:"oklch(0.987 0.026 102.212)",100:"oklch(0.973 0.071 103.193)",200:"oklch(0.945 0.129 101.54)",300:"oklch(0.905 0.182 98.111)",400:"oklch(0.852 0.199 91.936)",500:"oklch(0.795 0.184 86.047)",600:"oklch(0.681 0.162 75.834)",700:"oklch(0.554 0.135 66.442)",800:"oklch(0.476 0.114 61.907)",900:"oklch(0.421 0.095 57.708)",950:"oklch(0.286 0.066 53.813)"},lime:{50:"oklch(0.986 0.031 120.757)",100:"oklch(0.967 0.067 122.328)",200:"oklch(0.938 0.127 124.321)",300:"oklch(0.897 0.196 126.665)",400:"oklch(0.841 0.238 128.85)",500:"oklch(0.768 0.233 130.85)",600:"oklch(0.648 0.2 131.684)",700:"oklch(0.532 0.157 131.589)",800:"oklch(0.453 0.124 130.933)",900:"oklch(0.405 0.101 131.063)",950:"oklch(0.274 0.072 132.109)"},green:{50:"oklch(0.982 0.018 155.826)",100:"oklch(0.962 0.044 156.743)",200:"oklch(0.925 0.084 155.995)",300:"oklch(0.871 0.15 154.449)",400:"oklch(0.792 0.209 151.711)",500:"oklch(0.723 0.219 149.579)",600:"oklch(0.627 0.194 149.214)",700:"oklch(0.527 0.154 150.069)",800:"oklch(0.448 0.119 151.328)",900:"oklch(0.393 0.095 152.535)",950:"oklch(0.266 0.065 152.934)"},emerald:{50:"oklch(0.979 0.021 166.113)",100:"oklch(0.95 0.052 163.051)",200:"oklch(0.905 0.093 164.15)",300:"oklch(0.845 0.143 164.978)",400:"oklch(0.765 0.177 163.223)",500:"oklch(0.696 0.17 162.48)",600:"oklch(0.596 0.145 163.225)",700:"oklch(0.508 0.118 165.612)",800:"oklch(0.432 0.095 166.913)",900:"oklch(0.378 0.077 168.94)",950:"oklch(0.262 0.051 172.552)"},teal:{50:"oklch(0.984 0.014 180.72)",100:"oklch(0.953 0.051 180.801)",200:"oklch(0.91 0.096 180.426)",300:"oklch(0.855 0.138 181.071)",400:"oklch(0.777 0.152 181.912)",500:"oklch(0.704 0.14 182.503)",600:"oklch(0.6 0.118 184.704)",700:"oklch(0.511 0.096 186.391)",800:"oklch(0.437 0.078 188.216)",900:"oklch(0.386 0.063 188.416)",950:"oklch(0.277 0.046 192.524)"},cyan:{50:"oklch(0.984 0.019 200.873)",100:"oklch(0.956 0.045 203.388)",200:"oklch(0.917 0.08 205.041)",300:"oklch(0.865 0.127 207.078)",400:"oklch(0.789 0.154 211.53)",500:"oklch(0.715 0.143 215.221)",600:"oklch(0.609 0.126 221.723)",700:"oklch(0.52 0.105 223.128)",800:"oklch(0.45 0.085 224.283)",900:"oklch(0.398 0.07 227.392)",950:"oklch(0.302 0.056 229.695)"},sky:{50:"oklch(0.977 0.013 236.62)",100:"oklch(0.951 0.026 236.824)",200:"oklch(0.901 0.058 230.902)",300:"oklch(0.828 0.111 230.318)",400:"oklch(0.746 0.16 232.661)",500:"oklch(0.685 0.169 237.323)",600:"oklch(0.588 0.158 241.966)",700:"oklch(0.5 0.134 242.749)",800:"oklch(0.443 0.11 240.79)",900:"oklch(0.391 0.09 240.876)",950:"oklch(0.293 0.066 243.157)"},blue:{50:"oklch(0.97 0.014 254.604)",100:"oklch(0.932 0.032 255.585)",200:"oklch(0.882 0.059 254.128)",300:"oklch(0.809 0.105 251.813)",400:"oklch(0.707 0.165 254.624)",500:"oklch(0.623 0.214 259.815)",600:"oklch(0.546 0.245 262.881)",700:"oklch(0.488 0.243 264.376)",800:"oklch(0.424 0.199 265.638)",900:"oklch(0.379 0.146 265.522)",950:"oklch(0.282 0.091 267.935)"},indigo:{50:"oklch(0.962 0.018 272.314)",100:"oklch(0.93 0.034 272.788)",200:"oklch(0.87 0.065 274.039)",300:"oklch(0.785 0.115 274.713)",400:"oklch(0.673 0.182 276.935)",500:"oklch(0.585 0.233 277.117)",600:"oklch(0.511 0.262 276.966)",700:"oklch(0.457 0.24 277.023)",800:"oklch(0.398 0.195 277.366)",900:"oklch(0.359 0.144 278.697)",950:"oklch(0.257 0.09 281.288)"},violet:{50:"oklch(0.969 0.016 293.756)",100:"oklch(0.943 0.029 294.588)",200:"oklch(0.894 0.057 293.283)",300:"oklch(0.811 0.111 293.571)",400:"oklch(0.702 0.183 293.541)",500:"oklch(0.606 0.25 292.717)",600:"oklch(0.541 0.281 293.009)",700:"oklch(0.491 0.27 292.581)",800:"oklch(0.432 0.232 292.759)",900:"oklch(0.38 0.189 293.745)",950:"oklch(0.283 0.141 291.089)"},purple:{50:"oklch(0.977 0.014 308.299)",100:"oklch(0.946 0.033 307.174)",200:"oklch(0.902 0.063 306.703)",300:"oklch(0.827 0.119 306.383)",400:"oklch(0.714 0.203 305.504)",500:"oklch(0.627 0.265 303.9)",600:"oklch(0.558 0.288 302.321)",700:"oklch(0.496 0.265 301.924)",800:"oklch(0.438 0.218 303.724)",900:"oklch(0.381 0.176 304.987)",950:"oklch(0.291 0.149 302.717)"},fuchsia:{50:"oklch(0.977 0.017 320.058)",100:"oklch(0.952 0.037 318.852)",200:"oklch(0.903 0.076 319.62)",300:"oklch(0.833 0.145 321.434)",400:"oklch(0.74 0.238 322.16)",500:"oklch(0.667 0.295 322.15)",600:"oklch(0.591 0.293 322.896)",700:"oklch(0.518 0.253 323.949)",800:"oklch(0.452 0.211 324.591)",900:"oklch(0.401 0.17 325.612)",950:"oklch(0.293 0.136 325.661)"},pink:{50:"oklch(0.971 0.014 343.198)",100:"oklch(0.948 0.028 342.258)",200:"oklch(0.899 0.061 343.231)",300:"oklch(0.823 0.12 346.018)",400:"oklch(0.718 0.202 349.761)",500:"oklch(0.656 0.241 354.308)",600:"oklch(0.592 0.249 0.584)",700:"oklch(0.525 0.223 3.958)",800:"oklch(0.459 0.187 3.815)",900:"oklch(0.408 0.153 2.432)",950:"oklch(0.284 0.109 3.907)"},rose:{50:"oklch(0.969 0.015 12.422)",100:"oklch(0.941 0.03 12.58)",200:"oklch(0.892 0.058 10.001)",300:"oklch(0.81 0.117 11.638)",400:"oklch(0.712 0.194 13.428)",500:"oklch(0.645 0.246 16.439)",600:"oklch(0.586 0.253 17.585)",700:"oklch(0.514 0.222 16.935)",800:"oklch(0.455 0.188 13.697)",900:"oklch(0.41 0.159 10.272)",950:"oklch(0.271 0.105 12.094)"}};function xe(e,t){if(t===null)return e;let r=Number(t);return Number.isNaN(r)?t[t.length-1]!=="%"&&(t=`calc(${t} * 100%)`):t=`${r*100}%`,`color-mix(in oklch, ${e} ${t}, transparent)`}function J(e){if(Object.prototype.toString.call(e)!=="[object Object]")return!1;let t=Object.getPrototypeOf(e);return t===null||Object.getPrototypeOf(t)===null}function te(e,t,r,i=[]){for(let n of t)if(n!=null)for(let l of Reflect.ownKeys(n)){let s=[...i,l],o=r(e[l],n[l],s);o!==void 0?e[l]=o:!J(e[l])||!J(n[l])?e[l]=n[l]:e[l]=te({},[e[l],n[l]],r,s)}return e}function Ye(e,t,r){return function(n,l){let s=n.lastIndexOf("/"),o=null;s!==-1&&(o=n.slice(s+1).trim(),n=n.slice(0,s).trim());let a=(()=>{let u=B(n),[f,p]=Hi(e.theme,u),c=r(lr(t()??{},u)??null);if(typeof f!="object")return typeof p!="object"&&p&4?c??f:f;if(c!==null&&typeof c=="object"&&!Array.isArray(c)){let m=te({},[c],(d,g)=>g);if(f===null&&Object.hasOwn(c,"__CSS_VALUES__")){let d={};for(let g in c.__CSS_VALUES__)d[g]=c[g],delete m[g];f=d}for(let d in f)d!=="__CSS_VALUES__"&&(c?.__CSS_VALUES__?.[d]&4&&lr(m,d.split("-"))!==void 0||(m[Dt(d)]=f[d]));return m}if(Array.isArray(f)&&Array.isArray(p)&&Array.isArray(c)){let m=f[0],d=f[1];p[0]&4&&(m=c[0]??m);for(let g of Object.keys(d))p[1][g]&4&&(d[g]=c[1][g]??d[g]);return[m,d]}return f??c})();return o&&typeof a=="string"&&(a=xe(a,o)),a??l}}function Hi(e,t){if(t.length===1&&t[0].startsWith("--"))return[e.get([t[0]]),e.getOptions(t[0])];let r=t.map(f=>f==="1"?"":f).map(f=>f.replaceAll(".","_").replace(/([a-z])([A-Z])/g,(p,c,m)=>`${c}-${m.toLowerCase()}`)).filter((f,p)=>f!=="DEFAULT"||p!==t.length-1).join("-"),i=new Map,n=new _(()=>new Map),l=e.namespace(`--${r}`);if(l.size===0)return[null,0];let s=new Map;for(let[f,p]of l){if(!f||!f.includes("--")){i.set(f,p),s.set(f,e.getOptions(f?`--${r}-${f}`:`--${r}`));continue}let c=f.indexOf("--"),m=f.slice(0,c),d=f.slice(c+2);d=d.replace(/-([a-z])/g,(g,h)=>h.toUpperCase()),n.get(m===""?null:m).set(d,[p,e.getOptions(`--${r}${f}`)])}let o=e.getOptions(`--${r}`);for(let[f,p]of n){let c=i.get(f);if(typeof c!="string")continue;let m={},d={};for(let[g,[h,y]]of p)m[g]=h,d[g]=y;i.set(f,[c,m]),s.set(f,[o,d])}let a={},u={};for(let[f,p]of i)sr(a,[f??"DEFAULT"],p);for(let[f,p]of s)sr(u,[f??"DEFAULT"],p);return t[t.length-1]==="DEFAULT"?[a?.DEFAULT??null,u.DEFAULT??0]:"DEFAULT"in a&&Object.keys(a).length===1?[a.DEFAULT,u.DEFAULT??0]:(a.__CSS_VALUES__=u,[a,u])}function lr(e,t){for(let r=0;r<t.length;++r){let i=t[r];if(e[i]===void 0){if(t[r+1]===void 0)return;t[r+1]=`${i}-${t[r+1]}`;continue}e=e[i]}return e}function sr(e,t,r){for(let i of t.slice(0,-1))e[i]===void 0&&(e[i]={}),e=e[i];e[t[t.length-1]]=r}var Qi={blocklist:[],prefix:"",important:!1,darkMode:null,theme:{},plugins:[],content:{files:[]}};function G(e,t){let r={design:e,configs:[],plugins:[],content:{files:[]},theme:{},extend:{},result:structuredClone(Qi)};for(let n of t)He(r,n);for(let n of r.configs)"darkMode"in n&&n.darkMode!==void 0&&(r.result.darkMode=n.darkMode??null),"prefix"in n&&n.prefix!==void 0&&(r.result.prefix=n.prefix??""),"blocklist"in n&&n.blocklist!==void 0&&(r.result.blocklist=n.blocklist??[]),"important"in n&&n.important!==void 0&&(r.result.important=n.important??!1);let i=Xi(r);return{resolvedConfig:{...r.result,content:r.content,theme:r.theme,plugins:r.plugins},replacedThemeKeys:i}}function Zi(e,t){if(Array.isArray(e)&&J(e[0]))return e.concat(t);if(Array.isArray(t)&&J(t[0])&&J(e))return[e,...t];if(Array.isArray(t))return t}function He(e,{config:t,base:r,path:i}){let n=[];for(let o of t.plugins??[])"__isOptionsFunction"in o?n.push(o()):"handler"in o?n.push(o):n.push({handler:o});if(Array.isArray(t.presets)&&t.presets.length===0)throw new Error("Error in the config file/plugin/preset. An empty preset (`preset: []`) is not currently supported.");for(let o of t.presets??[])He(e,{path:i,base:r,config:o});for(let o of n)e.plugins.push(o),o.config&&He(e,{path:i,base:r,config:o.config});let l=t.content??[],s=Array.isArray(l)?l:l.files;for(let o of s)e.content.files.push(typeof o=="object"?o:{base:r,pattern:o});e.configs.push(t)}function Xi(e){let t=new Set,r=Ye(e.design,()=>e.theme,n),i=Object.assign(r,{theme:r,colors:or});function n(l){return typeof l=="function"?l(i)??null:l??null}for(let l of e.configs){let s=l.theme??{},o=s.extend??{};for(let a in s)a!=="extend"&&t.add(a);Object.assign(e.theme,s);for(let a in o)e.extend[a]??=[],e.extend[a].push(o[a])}delete e.theme.extend;for(let l in e.extend){let s=[e.theme[l],...e.extend[l]];e.theme[l]=()=>{let o=s.map(n);return te({},o,Zi)}}for(let l in e.theme)e.theme[l]=n(e.theme[l]);if(e.theme.screens&&typeof e.theme.screens=="object")for(let l of Object.keys(e.theme.screens)){let s=e.theme.screens[l];s&&typeof s=="object"&&("raw"in s||"max"in s||"min"in s&&(e.theme.screens[l]=s.min))}return t}function ar(e){return(Array.isArray(e)?e:[e]).map(r=>typeof r=="string"?{min:r}:r&&typeof r=="object"?r:null).map(r=>{if(r===null)return null;if("raw"in r)return r.raw;let i="";return r.max!==void 0&&(i+=`${r.max} >= `),i+="width",r.min!==void 0&&(i+=` >= ${r.min}`),`(${i})`}).filter(Boolean).join(", ")}function ur({designSystem:e,userConfig:t}={}){function r(i){if(!e||!t)return;let{resolvedConfig:n}=G(e,[{base:"",config:t}]),l=n?.theme?.screens||{},s=new _(o=>{let a=e?.resolveThemeValue(`--breakpoint-${o}`)??l?.[o];return typeof a=="string"?`(width >= theme(--breakpoint-${o}))`:a?ar(a):null});i.walkAtRules("screen",o=>{o.name="media",o.params=`screen(${o.params})`}),i.walkAtRules(o=>{if(o.name!=="media")return;let a=o.params.match(/screen\(([^)]+)\)/);if(!a)return;let u=s.get(a[1]);u&&(o.params=u)})}return{postcssPlugin:"@tailwindcss/upgrade/migrate-media-screen",OnceExit:r}}import{AtRule as en}from"postcss";function fr(){function e(t){let r="",i=[],n=[],l=null;t.each(s=>{if(s.type==="atrule"){if(s.name==="config"||s.name==="source"||s.name==="theme"||s.name==="utility"||s.name==="variant"){i.length>0&&n.push([r,i.splice(0)]);return}if(s.name==="tailwind"&&s.params==="base"||s.name==="import"&&s.params.match(/^["']tailwindcss\/base["']/)){i.length>0&&n.push([r,i.splice(0)]),l??="base",r="base";return}if(s.name==="tailwind"&&s.params==="components"||s.name==="import"&&s.params.match(/^["']tailwindcss\/components["']/)){i.length>0&&n.push([r,i.splice(0)]),l??="components",r="components";return}if(s.name==="tailwind"&&s.params==="utilities"||s.name==="import"&&s.params.match(/^["']tailwindcss\/utilities["']/)){i.length>0&&n.push([r,i.splice(0)]),l??="utilities",r="utilities";return}if(s.name==="layer"){i.length>0&&n.push([r,i.splice(0)]);return}if(s.name==="import"){r!==""&&!s.params.includes("layer(")&&(s.params+=` layer(${r})`,s.raws.tailwind_injected_layer=!0),i.length>0&&n.push([r,i.splice(0)]);return}}r===""&&(s.type==="comment"||s.type==="atrule"&&!s.nodes||s.type==="atrule"&&s.name==="charset")||i.push(s)});for(let[s,o]of n){let a=s||l||"";if(a===""||o.every(p=>p.type==="comment"))continue;let u=o[0],f=new en({name:"layer",params:a,nodes:o.map(p=>p===u?p:p.remove()),raws:{tailwind_pretty:!0}});u.replaceWith(f)}}return{postcssPlugin:"@tailwindcss/upgrade/migrate-missing-layers",OnceExit:e}}import{AtRule as Ce}from"postcss";var Qe=["theme","base","components","utilities"];function cr(e){let t=e.newPrefix?` prefix(${e.newPrefix})`:"";function r(i){let n=null,l=null,s=[],o=null,a=null,u=null,f=null,p=[];i.walkAtRules(c=>{if(c.name==="import"&&c.params.match(/^["']tailwindcss\/tailwind\.css["']$/)&&(c.params=c.params.replace("tailwindcss/tailwind.css","tailwindcss")),c.name==="import"&&c.params.match(/^["']tailwindcss["']/))c.params+=t;else if(c.name==="tailwind"&&c.params==="base"||c.name==="import"&&c.params.match(/^["']tailwindcss\/base["']$/))p.push("base"),s.push(c),n=c;else if(c.name==="tailwind"&&c.params==="utilities"||c.name==="import"&&c.params.match(/^["']tailwindcss\/utilities["']$/))p.push("utilities"),s.push(c),l=c;else if(c.name==="tailwind"&&c.params==="components"||c.name==="tailwind"&&c.params==="screens"||c.name==="tailwind"&&c.params==="variants"||c.name==="import"&&c.params.match(/^["']tailwindcss\/components["']$/))c.remove();else if(c.name==="responsive")if(c.nodes){for(let m of c.nodes)m.raws.tailwind_pretty=!0;c.replaceWith(c.nodes)}else c.remove()}),n!==null&&l!==null?(o||Ae(s).before(new Ce({name:"import",params:`'tailwindcss'${t}`})),n?.remove(),l?.remove()):l!==null?(a||Ae(s).before(new Ce({name:"import",params:"'tailwindcss/utilities' layer(utilities)"})),l?.remove()):n!==null&&(f||Ae(s).before(new Ce({name:"import",params:`'tailwindcss/theme' layer(theme)${t}`})),u||Ae(s).before(new Ce({name:"import",params:"'tailwindcss/preflight' layer(base)"})),n?.remove());{let c=p.toSorted((m,d)=>Qe.indexOf(m)-Qe.indexOf(d));if(p.some((m,d)=>m!==c[d])){let m=Qe.toSorted((d,g)=>p.indexOf(d)-p.indexOf(g));i.prepend({name:"layer",params:m.join(", ")})}}}return{postcssPlugin:"@tailwindcss/upgrade/migrate-tailwind-directives",OnceExit:r}}function Ae(e){let t=e.at(0),r=t.prev();for(;r;){if(r.type==="rule"&&(t=r),r.type==="atrule")if(r.name==="charset"||r.name==="import"){r=r.prev();continue}else if(r.name==="layer"&&!r.nodes){r=r.prev();continue}else t=r;r=r.prev()}return t}import"postcss";function pr({designSystem:e}={}){return{postcssPlugin:"@tailwindcss/upgrade/migrate-theme-to-var",OnceExit(t){if(!e)return;let r=ze(e,{prettyPrint:!0});t.walkDecls(i=>{let[n]=r(i.value);i.value=n}),t.walkAtRules(i=>{if(i.name==="media"||i.name==="custom-media"||i.name==="container"||i.name==="supports"){let[n]=r(i.params,2);i.params=n}})}}}import"postcss";function dr(){function e(t){t.walkAtRules("variants",r=>{r.name==="variants"&&(r.name="layer",r.params="utilities")})}return{postcssPlugin:"@tailwindcss/upgrade/migrate-variants-directive",OnceExit:e}}async function rn(e,t,r){return typeof e=="string"&&(e=await q.fromString(e),e.file=r??null),Ze().use(nr()).use(Bt(t)).use(ur(t)).use(dr()).use(Gt(e)).use(fr()).use(cr(t)).use(tr(e,t)).use(Ht(t)).use(pr(t)).process(e.root,{from:e.file??void 0})}async function mr(e,t){if(!e.file)throw new Error("Cannot migrate a stylesheet without a file path");e.canMigrate&&await rn(e,t)}async function gr(e){let t=new Map;for(let o of e)o.file&&t.set(o.file,o);let r=Ze([{postcssPlugin:"mark-import-nodes",AtRule:{import(o){let a=o.params.match(/['"](.*)['"]/)?.[1];if(!a)return;let u=o.source?.input.file?tn.dirname(o.source.input.file):process.cwd(),f=!1;try{if(a[0]!==".")try{f=Ie(`./${a}`,u)}catch{}f||(f=Ie(a,u))}catch(d){console.warn(`Failed to resolve import: ${a}. Skipping.`),console.error(d);return}if(!f)return;let p=t.get(f);if(!p)return;o.raws.tailwind_destination_sheet_id=p.id;let c=o.source?.input.file?t.get(o.source.input.file):void 0,m=[];for(let d of v(o.params," "))d.startsWith("layer(")&&d.endsWith(")")&&m.push(d.slice(6,-1).trim());if(c){let d={layers:m};p.parents.add({item:c,meta:d}),c.children.add({item:p,meta:d})}}}}]);for(let o of e)o.file&&await r.process(o.root,{from:o.file});let i=process.cwd();function n(o){let a=[];for(let u of o){if(!u.item.file)continue;let f=u.item.file.replace(i,""),p=u.meta.layers.join(", ");p.length>0?a.push(`${f} (layers: ${p})`):a.push(f)}return a.join(" <- ")}let l=[];for(let o of e){if(!o.file)continue;let{convertiblePaths:a,nonConvertiblePaths:u}=o.analyzeImportPaths();if(!(a.length>0&&u.length>0))continue;o.canMigrate=!1;let p=o.file.replace(i,"");for(let c of a)l.push(`- ${p} <- ${n(c)}`);for(let c of u)l.push(`- ${p} <- ${n(c)}`)}if(l.length===0)return;let s=`You have one or more stylesheets that are imported into a utility layer and non-utility layer.
|
|
63
63
|
`;throw s+=`We cannot convert stylesheets under these conditions. Please look at the following stylesheets:
|
|
64
64
|
`,new Error(s+l.join(`
|
|
65
|
-
`))}async function
|
|
65
|
+
`))}async function hr(e){let t=new Map,r=new Map;for(let o of e)t.set(o.id,o),o.file&&r.set(o.file,o);let i=new Set;for(let o of e){let a=o.layers();(a.has("utilities")||a.has("components"))&&b(o.root,f=>{if(f.type==="atrule"&&f.name==="utility")return i.add(o),2})}let n=new Map;for(let o of e){if(!o.file||o.parents.size===0||!i.has(o)&&!Array.from(o.descendants()).some(c=>i.has(c)))continue;let a=Ze.root({raws:{tailwind_pretty:!0}});b(o.root,c=>{if(c.type==="atrule"&&c.name==="utility")return a.append(c),1});let u=o.file.replace(/\.css$/,".utilities.css"),f=0;for(;r.has(u);)f+=1,u=o.file.replace(/\.css$/,`.utilities.${f}.css`);let p=await q.fromRoot(a,u);p.extension=f>0?`.utilities.${f}.css`:".utilities.css",n.set(o,p),t.set(p.id,p)}for(let[o,a]of n){for(let u of o.parents){let f=n.get(u.item);f&&a.parents.add({item:f,meta:u.meta})}for(let u of o.children){let f=n.get(u.item);f&&a.children.add({item:f,meta:u.meta})}}for(let o of e){let a=n.get(o),u=new Set;for(let f of o.importRules){let p=f.raws.tailwind_destination_sheet_id;if(!p)continue;let c=t.get(p);if(!c)continue;let m=n.get(c);if(!m)continue;let d=f.params.match(/(['"])(.*)\1/);if(!d)return;let g=d[1],h=d[2],y=h.replace(/\.css$/,m.extension),C=f.clone({params:`${g}${y}${g}`,raws:{after:`
|
|
66
66
|
|
|
67
|
-
`,tailwind_injected_layer:f.raws.tailwind_injected_layer,tailwind_original_params:`${g}${h}${g}`,tailwind_destination_sheet_id:m.id}});a?u.add(
|
|
67
|
+
`,tailwind_injected_layer:f.raws.tailwind_injected_layer,tailwind_original_params:`${g}${h}${g}`,tailwind_destination_sheet_id:m.id}});a?u.add(C):f.after(C)}a&&u.size>0&&a.root.prepend(Array.from(u))}let l=new _(()=>new Set);for(let o of t.values())for(let a of o.importRules){let u=a.raws.tailwind_destination_sheet_id;if(!u)continue;let f=t.get(u);f&&l.get(f).add(a)}let s=[];for(let o of e.slice()){for(let a of o.descendants())s.push(a);s.push(o)}for(let o of s){let a=n.get(o);if(a&&o.isEmpty){o.root=a.root;for(let u of l.get(a))u.params=u.raws.tailwind_original_params;for(let u of l.get(o))u.remove();n.delete(o)}}e.push(...n.values())}import{Scanner as Vr}from"@tailwindcss/oxide";import yn from"node:fs/promises";import{dirname as vn}from"path";import"tailwindcss";import wn from"tailwindcss/defaultTheme";import{fileURLToPath as bn}from"url";import Se from"enhanced-resolve";import{createJiti as un}from"jiti";import Ar from"node:fs";import Fa from"node:fs/promises";import Ma,{dirname as wr}from"node:path";import{pathToFileURL as br}from"node:url";import{__unstable__loadDesignSystem as za,compile as Ba}from"tailwindcss";import Xe from"node:fs/promises";import re from"node:path";var nn=[/import[\s\S]*?['"](.{3,}?)['"]/gi,/import[\s\S]*from[\s\S]*?['"](.{3,}?)['"]/gi,/export[\s\S]*from[\s\S]*?['"](.{3,}?)['"]/gi,/require\(['"`](.+)['"`]\)/gi],on=[".js",".cjs",".mjs"],ln=["",".js",".cjs",".mjs",".ts",".cts",".mts",".jsx",".tsx"],sn=["",".ts",".cts",".mts",".tsx",".js",".cjs",".mjs",".jsx"];async function an(e,t){for(let r of t){let i=`${e}${r}`;if((await Xe.stat(i).catch(()=>null))?.isFile())return i}for(let r of t){let i=`${e}/index${r}`;if(await Xe.access(i).then(()=>!0,()=>!1))return i}return null}async function yr(e,t,r,i){let n=on.includes(i)?ln:sn,l=await an(re.resolve(r,t),n);if(l===null||e.has(l))return;e.add(l),r=re.dirname(l),i=re.extname(l);let s=await Xe.readFile(l,"utf-8"),o=[];for(let a of nn)for(let u of s.matchAll(a))u[1].startsWith(".")&&o.push(yr(e,u[1],r,i));await Promise.all(o)}async function vr(e){let t=new Set;return await yr(t,e,re.dirname(e),re.extname(e)),Array.from(t)}async function $e(e,t,r){if(e[0]!=="."){let s=await Cr(e,t);if(!s)throw new Error(`Could not resolve '${e}' from '${t}'`);let o=await xr(br(s).href);return{base:wr(s),module:o.default??o}}let i=await Cr(e,t);if(!i)throw new Error(`Could not resolve '${e}' from '${t}'`);let[n,l]=await Promise.all([xr(br(i).href+"?id="+Date.now()),vr(i)]);for(let s of l)r(s);return{base:wr(i),module:n.default??n}}var kr=null;async function xr(e){try{return await import(e)}catch{return kr??=un(import.meta.url,{moduleCache:!1,fsCache:!1}),await kr.import(e)}}var Ja=Se.ResolverFactory.createResolver({fileSystem:new Se.CachedInputFileSystem(Ar,4e3),useSyncFileSystemCalls:!0,extensions:[".css"],mainFields:["style"],conditionNames:["style"]});var fn=Se.ResolverFactory.createResolver({fileSystem:new Se.CachedInputFileSystem(Ar,4e3),useSyncFileSystemCalls:!0,extensions:[".js",".json",".node",".ts"],conditionNames:import.meta.url?["node","import"]:["node","require"]});function Cr(e,t){return cn(fn,e,t)}function cn(e,t,r){return new Promise((i,n)=>e.resolve({},r,t,{},(l,s)=>{if(l)return n(l);i(s)}))}function Te(e){let t=[];e=Array.isArray(e)?e:[e];let r=e.flatMap(i=>Object.entries(i));for(let[i,n]of r)if(typeof n!="object")!i.startsWith("--")&&n==="@slot"?t.push(x(i,[x("@slot",[])])):(i=i.replace(/([A-Z])/g,"-$1").toLowerCase(),t.push(K(i,String(n))));else if(Array.isArray(n))for(let l of n)typeof l=="string"?t.push(K(i,l)):t.push(x(i,Te(l)));else n!==null&&t.push(x(i,Te(n)));return t}function $r(e){let t=[];if("keyframes"in e.theme)for(let[r,i]of Object.entries(e.theme.keyframes))t.push(x(`@keyframes ${r}`,Te(i)));return t}function Tr({addVariant:e,config:t}){let r=t("darkMode",null),[i,n=".dark"]=Array.isArray(r)?r:[r];if(i==="variant"){let l;if(Array.isArray(n)||typeof n=="function"?l=n:typeof n=="string"&&(l=[n]),Array.isArray(l))for(let s of l)s===".dark"?(i=!1,console.warn('When using `variant` for `darkMode`, you must provide a selector.\nExample: `darkMode: ["variant", ".your-selector &"]`')):s.includes("&")||(i=!1,console.warn('When using `variant` for `darkMode`, your selector must contain `&`.\nExample `darkMode: ["variant", ".your-selector &"]`'));n=l}i===null||(i==="selector"?e("dark",`&:where(${n}, ${n} *)`):i==="media"?e("dark","@media (prefers-color-scheme: dark)"):i==="variant"?e("dark",n):i==="class"&&e("dark",`&:is(${n} *)`))}import _e from"tree-sitter";import Ne from"tree-sitter-typescript";var et=new _e;et.setLanguage(Ne.typescript);var tt=String.raw,dn=new _e.Query(Ne.typescript,tt`
|
|
68
68
|
; export default {}
|
|
69
69
|
(export_statement
|
|
70
70
|
value: [
|
|
@@ -115,7 +115,7 @@ import{globby as Kr}from"globby";import Or from"node:fs/promises";import In from
|
|
|
115
115
|
]
|
|
116
116
|
)
|
|
117
117
|
)
|
|
118
|
-
`),
|
|
118
|
+
`),mn=new _e.Query(Ne.typescript,tt`
|
|
119
119
|
(call_expression
|
|
120
120
|
function: [
|
|
121
121
|
(call_expression
|
|
@@ -168,7 +168,7 @@ import{globby as Kr}from"globby";import Or from"node:fs/promises";import In from
|
|
|
168
168
|
(string (string_fragment) @module_string)
|
|
169
169
|
)
|
|
170
170
|
)
|
|
171
|
-
`);function
|
|
171
|
+
`);function rt(e){try{let r=et.parse(e).rootNode,i=hn(e),n=dn.matches(r),l=[];for(let s of n)for(let o of s.captures)if(o.name==="imports"){for(let a of o.node.children)if(!(a.type==="["||a.type==="]"||a.type===","))switch(a.type){case"identifier":let u=i[a.text];if(!u||u.export!==null)return null;l.push([u.module,null]);break;case"string":l.push([a.children[1].text,null]);break;case"call_expression":let f=mn.matches(a);if(f.length===0)return null;let p=null,c=null,m=null,d=null,g=f.flatMap(h=>h.captures);for(let h=0;h<g.length;h++){let y=g[h];switch(y.name){case"module_identifier":{c=y.node.text;break}case"module_string":{p=y.node.text;break}case"property":{if(d!==null)return null;d=y.node.text;break}case"str_value":case"num_value":case"null_value":case"true_value":case"false_value":{if(d===null)return null;m??={},m[d]=_r(y),d=null;break}case"array_value":{if(d===null)return null;m??={};let C=[],D=h;e:for(let le=h+1;le<g.length;le++){let Ke=g[le];switch(Ke.name){case"property":{if(Ke.node.text!==d)break e;break}case"str_value":case"num_value":case"null_value":case"true_value":case"false_value":C.push(_r(Ke)),D=le}}h=D,m[d]=C,d=null;break}case"_name":case"_empty_args":break;default:return null}}if(d!==null)return null;if(c!==null){let h=i[c];if(!h||h.export!==null&&h.export!=="*")return null;p=h.module}if(p===null)return null;l.push([p,m]);break;default:return null}}return l}catch(t){return console.error(t),null}}var gn=new _e.Query(Ne.typescript,tt`
|
|
172
172
|
; ESM import
|
|
173
173
|
(import_statement
|
|
174
174
|
(import_clause
|
|
@@ -207,19 +207,19 @@ import{globby as Kr}from"globby";import Or from"node:fs/promises";import In from
|
|
|
207
207
|
)
|
|
208
208
|
)
|
|
209
209
|
)
|
|
210
|
-
`);function
|
|
211
|
-
`)}}async function
|
|
212
|
-
`,o=c),s.has(f[0])&&s.get(f[0])===!1){s.set(f[0],!0);let d=z([f[0]]);d!==null&&(a+=` ${
|
|
213
|
-
`)}let m=z(f);m!==null&&(a+=` ${
|
|
210
|
+
`);function hn(e){let r=et.parse(e).rootNode,i=gn.matches(r),n={};for(let l of i){let s=[],o="";for(let a=0;a<l.captures.length;a++){let u=l.captures[a];switch(u.name){case"default":s.push({name:u.node.text,export:null});break;case"imported-name":s.push({name:u.node.text,export:u.node.text});break;case"imported-from":o=u.node.text;break;case"imported-namespace":s.push({name:u.node.text,export:"*"});break;case"imported-alias":if(s.length<1)throw new Error("Unexpected alias: "+JSON.stringify(i,null,2));let f=s[s.length-1],p=f.name;f.export=p,f.name=u.node.text;break}}for(let{name:a,export:u}of s)n[a]={module:o,export:u}}return n}function _r(e){return e.name==="num_value"?parseFloat(e.node.text):e.name==="null_value"?null:e.name==="true_value"?!0:e.name==="false_value"?!1:e.node.text}var kn=bn(import.meta.url),xn=vn(kn);async function Pr(e,t,r){let[i,n]=await Promise.all([$e(t,xn,()=>{}).then(u=>u.module),yn.readFile(t,"utf-8")]);if(!Tn(i,n))return T("Your configuration file could not be automatically migrated to the new CSS configuration format, so your CSS has been updated to load your existing configuration file."),null;let l=[],s=[],o=[];if("darkMode"in i&&o.push(An(i)),"content"in i&&(l=await $n(i,r)),"theme"in i){let u=await Cn(e,i,r);u&&o.push(u)}"corePlugins"in i&&T("The `corePlugins` option is no longer supported as of Tailwind CSS v4.0, so it's been removed from your configuration.");let a=rt(n);if(a!==null)for(let[u,f]of a)s.push({base:r,path:u,options:f});return{sources:l,plugins:s,css:o.join(`
|
|
211
|
+
`)}}async function Cn(e,t,r){let i={base:r,config:{...t,plugins:[],presets:void 0}},{resolvedConfig:n,replacedThemeKeys:l}=G(e,[i]),s=new Map(Array.from(l.entries()).map(([f])=>[f,!1])),o="",a="@theme {",u=!1;for(let[f,p]of jt(n.theme)){if(typeof p!="string"&&typeof p!="number"||f[0]==="keyframes")continue;u=!0;let c=Sn(f);if(c!==o&&(a+=`
|
|
212
|
+
`,o=c),s.has(f[0])&&s.get(f[0])===!1){s.set(f[0],!0);let d=z([f[0]]);d!==null&&(a+=` ${W(`--${d}`)}-*: initial;
|
|
213
|
+
`)}let m=z(f);m!==null&&(a+=` ${W(`--${m}`)}: ${p};
|
|
214
214
|
`)}return"keyframes"in n.theme&&(u=!0,a+=`
|
|
215
|
-
`+
|
|
216
|
-
`:null}function
|
|
217
|
-
`}function
|
|
218
|
-
`}function
|
|
219
|
-
`),m=[];for(let d=0;d<c.length;d++){let g=c[d];if(r(g))o=!0,m.push(g.replace("tailwindcss:","'@tailwindcss/postcss':"));else if(n(g))a=!0;else if(i(g)){let h=!1;for(let y=d+1;y<c.length;y++){let
|
|
220
|
-
`)),{didAddPostcssClient:o,didRemoveAutoprefixer:a,didRemovePostCSSImport:u}}async function
|
|
215
|
+
`+Vn(n.theme.keyframes)),u?a+`}
|
|
216
|
+
`:null}function An(e){let t="";return Tr({config:()=>e.darkMode,addVariant:(n,l)=>t=l}),t===""?"":`@variant dark (${t});
|
|
217
|
+
`}function Sn(e){let t=[];for(let r=0;r<e.length-1;r++){let i=e[r];if(e[r+1][0]==="-")break;t.push(i)}return t.join("-")}async function $n(e,t){let r=Pn(t),i=[];for(let n of e.content){if(typeof n!="string")throw new Error("Unsupported content value: "+n);let l=Rn({base:t,pattern:n}),s=!0;for(let o of l)if(!r.includes(o)){s=!1;break}s||i.push({base:t,pattern:n})}return i}function Tn(e,t){function r(o){return typeof o=="function"?!1:Array.isArray(o)?o.every(r):typeof o=="object"&&o!==null?Object.values(o).every(r):["string","number","boolean","undefined"].includes(typeof o)}let{plugins:i,theme:n,...l}=e;if(!r(l))return!1;let s=["darkMode","content","theme","plugins","presets","prefix","corePlugins"];if(Object.keys(e).some(o=>!s.includes(o))||rt(t)===null||e.presets&&e.presets.length>0)return!1;if(n&&typeof n=="object"){if(n.extend&&!Nr(n.extend))return!1;let{extend:o,...a}=n;if(!Nr(a))return!1}return!0}var _n=[...Object.keys(wn),"containers"],Nn=["supports","data","aria"];function Nr(e){for(let t of Object.keys(e))if(!_n.includes(t)||Nn.includes(t))return!1;if("screens"in e&&typeof e.screens=="object"&&e.screens!==null){for(let t of Object.values(e.screens))if(typeof t=="object"&&t!==null&&("max"in t||"raw"in t))return!1}return!0}function Vn(e){let t=$r({theme:{keyframes:e}});return Ue(t).trim()+`
|
|
218
|
+
`}function Pn(e){let t=new Vr({detectSources:{base:e}});return t.scan(),t.files}function Rn(e){let t=new Vr({sources:[e]});return t.scan(),t.files}import R from"node:fs/promises";import ne from"node:path";import{execSync as En}from"node:child_process";import Y from"node:fs/promises";import{dirname as On,resolve as H}from"node:path";var Rr=!1;async function ie(e,t){let r=await Kn(t);if(!r){Rr||(Rr=!0,fe("Could not detect a package manager. Please manually update `tailwindcss` to v4."));return}return En(`${r} ${e}`,{cwd:t})}async function Kn(e){do{let t=H(e,"package.json");try{let r=await Y.readFile(t,"utf-8"),i=JSON.parse(r);if(i.packageManager){if(i.packageManager.includes("bun"))return"bun";if(i.packageManager.includes("yarn"))return"yarn";if(i.packageManager.includes("pnpm"))return"pnpm";if(i.packageManager.includes("npm"))return"npm"}}catch{}try{return await Y.access(H(e,"bun.lockb")),"bun"}catch{}try{return await Y.access(H(e,"bun.lock")),"bun"}catch{}try{return await Y.access(H(e,"pnpm-lock.yaml")),"pnpm"}catch{}try{return await Y.access(H(e,"yarn.lock")),"yarn"}catch{}try{return await Y.access(H(e,"package-lock.json")),"npm"}catch{}e=On(e)}while(!0)}async function Or(e){let t=!1,r=!1,i=!1,n=!1,l=await In(e);if(l){let f=await Dn(e,l);f&&(t=!0,r=f.didAddPostcssClient,i=f.didRemoveAutoprefixer,n=f.didRemovePostCSSImport)}let s=ne.resolve(e,"package.json"),o;try{o=JSON.parse(await R.readFile(s,"utf-8"))}catch{}if(!t&&o&&"postcss"in o){let f=await Er(e,o.postcss);f&&(await R.writeFile(s,JSON.stringify({...o,postcss:f?.json},null,2)),t=!0,r=f.didAddPostcssClient,i=f.didRemoveAutoprefixer,n=f.didRemovePostCSSImport)}let a=await Ln(e),u=null;if(!t&&a){try{u=JSON.parse(await R.readFile(a,"utf-8"))}catch{}if(u){let f=await Er(e,u);f&&(await R.writeFile(a,JSON.stringify(f.json,null,2)),t=!0,r=f.didAddPostcssClient,i=f.didRemoveAutoprefixer,n=f.didRemovePostCSSImport)}}if(!t){T("No PostCSS config found, skipping migration.");return}if(r)try{await ie("add -D @tailwindcss/postcss@next",e)}catch{}if(i||n)try{let f=[i?"autoprefixer":null,n?"postcss-import":null].filter(Boolean).join(" ");await ie(`remove ${f}`,e)}catch{}I("PostCSS config has been upgraded.")}async function Dn(e,t){function r(d){return/['"]?tailwindcss['"]?\: ?\{\}/.test(d)}function i(d){return/['"]?postcss-import['"]?\: ?\{\}/.test(d)}function n(d){return/['"]?autoprefixer['"]?\: ?\{\}/.test(d)}function l(d){return/['"]tailwindcss\/nesting['"]\: ?(\{\}|['"]postcss-nesting['"])/.test(d)}if(T(`Attempt to upgrade the PostCSS config in file: ${t}`),!await Mn(e,t))return fe("The PostCSS config contains dynamic JavaScript and can not be automatically migrated."),null;let o=!1,a=!1,u=!1,f=ne.resolve(e,t),c=(await R.readFile(f,"utf-8")).split(`
|
|
219
|
+
`),m=[];for(let d=0;d<c.length;d++){let g=c[d];if(r(g))o=!0,m.push(g.replace("tailwindcss:","'@tailwindcss/postcss':"));else if(n(g))a=!0;else if(i(g)){let h=!1;for(let y=d+1;y<c.length;y++){let C=c[y];if(r(C))break;if(!l(C)){h=!0;break}}h?m.push(g):u=!0}else if(l(g)){let h=c[d+1];r(h)||m.push(g)}else m.push(g)}return await R.writeFile(f,m.join(`
|
|
220
|
+
`)),{didAddPostcssClient:o,didRemoveAutoprefixer:a,didRemovePostCSSImport:u}}async function Er(e,t){function r(p,c){return p==="tailwindcss"&&Ve(c)}function i(p,c){return p==="postcss-import"&&Ve(c)}function n(p,c){return p==="autoprefixer"&&Ve(c)}function l(p,c){return p==="tailwindcss/nesting"&&(c==="postcss-nesting"||Ve(c))}let s=!1,o=!1,a=!1,u=Object.entries(t.plugins||{}),f=[];for(let p=0;p<u.length;p++){let[c,m]=u[p];if(r(c,m))s=!0,f.push(["@tailwindcss/postcss",m]);else if(n(c,m))o=!0;else if(i(c,m)){let d=!1;for(let g=p+1;g<u.length;g++){let[h,y]=u[g];if(r(h,y))break;if(!l(h,y)){d=!0;break}}d?f.push([c,m]):a=!0}else if(l(c,m)){let[d,g]=u[p+1];r(d,g)||f.push([c,m])}else f.push([c,m])}return{json:{...t,plugins:Object.fromEntries(f)},didAddPostcssClient:s,didRemoveAutoprefixer:o,didRemovePostCSSImport:a}}var jn=[".postcssrc.js",".postcssrc.mjs",".postcssrc.cjs",".postcssrc.ts",".postcssrc.mts",".postcssrc.cts","postcss.config.js","postcss.config.mjs","postcss.config.cjs","postcss.config.ts","postcss.config.mts","postcss.config.cts"];async function In(e){for(let t of jn){let r=ne.resolve(e,t);try{return await R.access(r),t}catch{}}return null}var Fn=[".postcssrc",".postcssrc.json"];async function Ln(e){for(let t of Fn){let r=ne.resolve(e,t);try{return await R.access(r),t}catch{}}return null}async function Mn(e,t){let r=ne.resolve(e,t),i=await R.readFile(r,"utf-8");return i.includes("tailwindcss:")&&!(i.includes("require")||i.includes("import "))}function Ve(e){return typeof e=="object"&&e!==null&&Object.keys(e).length===0}import{__unstable__loadDesignSystem as Kr,compile as Un}from"@tailwindcss/node";import Wn from"node:fs/promises";import it from"node:path";import{dirname as Dr}from"path";import{fileURLToPath as zn}from"url";var Bn=zn(import.meta.url),oe=Dr(Bn),jr=String.raw;async function Ir(e,t){try{e===null&&(e=await Gn(t.base));let r=it.resolve(t.base,e),i=it.relative(oe,r);i.startsWith(".")||(i="./"+i);let n=await qn(r),l=n.prefix?Et(n.prefix):null,s=jr`
|
|
221
221
|
@import 'tailwindcss' ${l?`prefix(${l})`:""};
|
|
222
222
|
@config './${i}';
|
|
223
|
-
`,[o,a]=await Promise.all([
|
|
223
|
+
`,[o,a]=await Promise.all([Un(s,{base:oe,onDependency:()=>{}}),Kr(s,{base:oe})]);return{designSystem:a,globs:o.globs,userConfig:n,newPrefix:l,configFilePath:r}}catch(r){E("Could not load the configuration file: "+r.message),process.exit(1)}}async function qn(e){let[t,r]=await Promise.all([Kr(jr`
|
|
224
224
|
@import 'tailwindcss';
|
|
225
|
-
`,{base:
|
|
225
|
+
`,{base:oe}),$e(e,oe,()=>{}).then(i=>i.module)]);return G(t,[{base:Dr(e),config:r}]).resolvedConfig}var Jn=["./tailwind.config.js","./tailwind.config.cjs","./tailwind.config.mjs","./tailwind.config.ts","./tailwind.config.cts","./tailwind.config.mts"];async function Gn(e){for(let t of Jn){let r=it.resolve(e,t);try{return await Wn.access(r),t}catch{}}throw new Error("No configuration file found. Please provide a path to the Tailwind CSS v3 config file via the `--config` option.")}import Yn from"mri";function Lr(e,t=process.argv.slice(2)){let r=Yn(t),i={_:r._};for(let[n,{type:l,alias:s,default:o=l==="boolean"?!1:null}]of Object.entries(e)){if(i[n]=o,s){let a=s.slice(1);r[a]!==void 0&&(i[n]=Fr(r[a],l))}{let a=n.slice(2);r[a]!==void 0&&(i[n]=Fr(r[a],l))}}return i}function Fr(e,t){switch(t){case"string":return Ee(e);case"boolean":return Pe(e);case"number":return Re(e);case"boolean | string":return Pe(e)??Ee(e);case"number | string":return Re(e)??Ee(e);case"boolean | number":return Pe(e)??Re(e);case"boolean | number | string":return Pe(e)??Re(e)??Ee(e);default:throw new Error(`Unhandled type: ${t}`)}}function Pe(e){if(e===!0||e===!1)return e;if(e==="true")return!0;if(e==="false")return!1}function Re(e){if(typeof e=="number")return e;{let t=Number(e);if(!Number.isNaN(t))return t}}function Ee(e){return`${e}`}import{execSync as Hn}from"node:child_process";function nt(){try{return Hn("git status --porcelain",{encoding:"utf-8"}).trim()!==""}catch(e){return!e?.toString?.().includes("not a git repository")}}var Wr={"--config":{type:"string",description:"Path to the configuration file",alias:"-c"},"--help":{type:"boolean",description:"Display usage information",alias:"-h"},"--force":{type:"boolean",description:"Force the migration",alias:"-f"},"--version":{type:"boolean",description:"Display the version number",alias:"-v"}},Oe=Lr(Wr);Oe["--help"]&&(at({usage:["npx @tailwindcss/upgrade"],options:Wr}),process.exit(0));async function Xn(){let e=process.cwd();F(ae()),F(),Oe["--force"]||nt()&&(E("Git directory is not clean. Please stash or commit your changes before migrating."),T(`You may use the ${ue("--force")} flag to silence this warning and perform the migration.`),process.exit(1));let t=await Ir(Oe["--config"],{base:e});{T("Migrating templates using the provided configuration file.");let i=new Set;for(let{pattern:l,base:s}of t.globs){let o=await Mr([l],{absolute:!0,gitignore:!0,cwd:s});for(let a of o)i.add(a)}let n=Array.from(i);n.sort(),await Promise.allSettled(n.map(l=>zt(t.designSystem,t.userConfig,l))),I("Template migration complete.")}T("Migrating JavaScript configuration files using the provided configuration file.");let r=await Pr(t.designSystem,t.configFilePath,e);{let i=Oe._.map(o=>Qn.resolve(e,o));i.length===0&&(T("No input stylesheets provided. Searching for CSS files in the current directory and its subdirectories\u2026"),i=await Mr(["**/*.css"],{absolute:!0,gitignore:!0})),i=i.filter(o=>o.endsWith(".css"));let n=await Promise.allSettled(i.map(o=>q.load(o)));for(let o of n)o.status==="rejected"&&E(`${o.reason}`);let l=n.filter(o=>o.status==="fulfilled").map(o=>o.value);try{await gr(l)}catch(o){E(`${o}`)}let s=await Promise.allSettled(l.map(o=>mr(o,{...t,jsConfigMigration:r})));for(let o of s)o.status==="rejected"&&E(`${o.reason}`);try{await hr(l)}catch(o){E(`${o}`)}for(let o of l)for(let a of o.importRules){if(!a.raws.tailwind_injected_layer)continue;let u=l.find(f=>f.id===a.raws.tailwind_destination_sheet_id);u&&u.containsRule(f=>f.type==="atrule"&&f.name==="utility")&&(a.params=a.params.replace(/ layer\([^)]+\)/,"").trim())}for(let o of l)await Zn([ot()]).process(o.root,{from:o.file});for(let o of l)o.file&&await Ur.writeFile(o.file,o.root.toString());I("Stylesheet migration complete.")}await Or(e);try{await ie("add tailwindcss@next",e)}catch{}r!==null&&await Ur.rm(t.configFilePath),nt()?I("Verify the changes and commit them to your repository."):I("No changes were made to your repository.")}Xn().then(()=>process.exit(0)).catch(e=>{console.error(e),process.exit(1)});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tailwindcss/upgrade",
|
|
3
|
-
"version": "4.0.0-alpha.
|
|
3
|
+
"version": "4.0.0-alpha.30",
|
|
4
4
|
"description": "A utility-first CSS framework for rapidly building custom user interfaces.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -27,16 +27,16 @@
|
|
|
27
27
|
"globby": "^14.0.2",
|
|
28
28
|
"jiti": "^2.0.0-beta.3",
|
|
29
29
|
"mri": "^1.2.0",
|
|
30
|
-
"picocolors": "^1.
|
|
30
|
+
"picocolors": "^1.1.1",
|
|
31
31
|
"postcss": "^8.4.41",
|
|
32
32
|
"postcss-import": "^16.1.0",
|
|
33
33
|
"postcss-selector-parser": "^6.1.2",
|
|
34
34
|
"prettier": "^3.3.3",
|
|
35
35
|
"tree-sitter": "^0.21.1",
|
|
36
36
|
"tree-sitter-typescript": "^0.23.0",
|
|
37
|
-
"@tailwindcss/
|
|
38
|
-
"@tailwindcss/
|
|
39
|
-
"tailwindcss": "4.0.0-alpha.
|
|
37
|
+
"@tailwindcss/node": "4.0.0-alpha.30",
|
|
38
|
+
"@tailwindcss/oxide": "4.0.0-alpha.30",
|
|
39
|
+
"tailwindcss": "4.0.0-alpha.30"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
42
|
"@types/node": "^20.14.8",
|