forgecss 0.10.0 → 0.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- (()=>{function f(n){let t=n.lastIndexOf(":");if(t===-1)return[null,n];let e=n.slice(0,t),i=n.slice(t+1);return[e,i]}function c(n){let t=[],e="",i=0,l=null;for(let r=0;r<n.length;r++){let o=n[r];if(i>0){if(l){e+=o,o===l&&n[r-1]!=="\\"&&(l=null);continue}else if(o==="'"||o==='"'){l=o,e+=o;continue}}if(o==="["){i++,e+=o;continue}if(o==="]"&&i>0){i--,e+=o;continue}if(i===0&&/\s/.test(o)){for(e&&t.push(e),e="";r+1<n.length&&/\s/.test(n[r+1]);)r++;continue}e+=o}return e&&t.push(e),t}function s(n){return c(n).map(t=>{let[e,i]=f(t);return!e||e==="[true]"?i:e==="[false]"?!1:(e=a(e),i.split(",").map(l=>`${e}_${l}`).join(" "))}).filter(Boolean).join(" ")}function a(n){let t=n.trim();return t=t.replace(/[&]/g,"I"),t=t.replace(/[:| =]/g,"-"),t=t.replace(/[^a-zA-Z0-9_-]/g,""),t}function u(n){for(var t=n||document,e=t.querySelectorAll("[class]"),i=0;i<e.length;i++){var l=e[i],r=l.getAttribute("class");if(r){var o=s(r);typeof o=="string"&&o!==r&&l.setAttribute("class",o)}}}window.fx=s;window.forgecss=u;document.readyState!=="loading"?u():document.addEventListener("DOMContentLoaded",function(){u()});window.addEventListener("load",function(){u()});})();
1
+ (()=>{function c(t){let n=t.lastIndexOf(":");if(n===-1)return[null,t];let e=t.slice(0,n),o=t.slice(n+1);return[e,o]}function s(t){let n=[],e="",o=0,l=null;for(let r=0;r<t.length;r++){let i=t[r];if(o>0){if(l){e+=i,i===l&&t[r-1]!=="\\"&&(l=null);continue}else if(i==="'"||i==='"'){l=i,e+=i;continue}}if(i==="["){o++,e+=i;continue}if(i==="]"&&o>0){o--,e+=i;continue}if(o===0&&/\s/.test(i)){for(e&&n.push(e),e="";r+1<t.length&&/\s/.test(t[r+1]);)r++;continue}e+=i}return e&&n.push(e),n}function u(t){return s(t).map(n=>{let[e,o]=c(n);return!e||e==="[true]"?o:e==="[false]"?!1:(e=a(e),o.split(",").map(l=>`${e}_${l}`).join(" "))}).filter(Boolean).join(" ")}function a(t){let n=t.trim();return n=n.replace(/[&]/g,"I"),n=n.replace(/[:| =]/g,"-"),n=n.replace(/[^a-zA-Z0-9_-]/g,""),n}function f(t){for(var n=t||document,e=n.querySelectorAll("[class]"),o=0;o<e.length;o++){var l=e[o],r=l.getAttribute("class");if(r){var i=u(r);typeof i=="string"&&i!==r&&l.setAttribute("class",i)}}}window.fx=function(t){return t?u(t):f()};document.readyState!=="loading"?f():document.addEventListener("DOMContentLoaded",function(){f()});window.addEventListener("load",function(){f()});})();
@@ -0,0 +1,32 @@
1
+ (()=>{var Yr=Object.create;var lt=Object.defineProperty;var Qr=Object.getOwnPropertyDescriptor;var Jr=Object.getOwnPropertyNames;var Kr=Object.getPrototypeOf,Zr=Object.prototype.hasOwnProperty;var y=(i,e)=>()=>(e||i((e={exports:{}}).exports,e),e.exports);var Xr=(i,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of Jr(e))!Zr.call(i,s)&&s!==t&&lt(i,s,{get:()=>e[s],enumerable:!(r=Qr(e,s))||r.enumerable});return i};var at=(i,e,t)=>(t=i!=null?Yr(Kr(i)):{},Xr(e||!i||!i.__esModule?lt(t,"default",{value:i,enumerable:!0}):t,i));var ft=y((ki,ve)=>{var g=String,ut=function(){return{isColorSupported:!1,reset:g,bold:g,dim:g,italic:g,underline:g,inverse:g,hidden:g,strikethrough:g,black:g,red:g,green:g,yellow:g,blue:g,magenta:g,cyan:g,white:g,gray:g,bgBlack:g,bgRed:g,bgGreen:g,bgYellow:g,bgBlue:g,bgMagenta:g,bgCyan:g,bgWhite:g,blackBright:g,redBright:g,greenBright:g,yellowBright:g,blueBright:g,magentaBright:g,cyanBright:g,whiteBright:g,bgBlackBright:g,bgRedBright:g,bgGreenBright:g,bgYellowBright:g,bgBlueBright:g,bgMagentaBright:g,bgCyanBright:g,bgWhiteBright:g}};ve.exports=ut();ve.exports.createColors=ut});var Re=y(()=>{});var oe=y((qi,pt)=>{"use strict";var ct=ft(),ht=Re(),j=class i extends Error{constructor(e,t,r,s,n,l){super(e),this.name="CssSyntaxError",this.reason=e,n&&(this.file=n),s&&(this.source=s),l&&(this.plugin=l),typeof t<"u"&&typeof r<"u"&&(typeof t=="number"?(this.line=t,this.column=r):(this.line=t.line,this.column=t.column,this.endLine=r.line,this.endColumn=r.column)),this.setMessage(),Error.captureStackTrace&&Error.captureStackTrace(this,i)}setMessage(){this.message=this.plugin?this.plugin+": ":"",this.message+=this.file?this.file:"<css input>",typeof this.line<"u"&&(this.message+=":"+this.line+":"+this.column),this.message+=": "+this.reason}showSourceCode(e){if(!this.source)return"";let t=this.source;e==null&&(e=ct.isColorSupported);let r=f=>f,s=f=>f,n=f=>f;if(e){let{bold:f,gray:m,red:p}=ct.createColors(!0);s=c=>f(p(c)),r=c=>m(c),ht&&(n=c=>ht(c))}let l=t.split(/\r?\n/),a=Math.max(this.line-3,0),o=Math.min(this.line+2,l.length),u=String(o).length;return l.slice(a,o).map((f,m)=>{let p=a+1+m,c=" "+(" "+p).slice(-u)+" | ";if(p===this.line){if(f.length>160){let w=20,h=Math.max(0,this.column-w),O=Math.max(this.column+w,this.endColumn+w),I=f.slice(h,O),ne=r(c.replace(/\d/g," "))+f.slice(0,Math.min(this.column-1,w-1)).replace(/[^\t]/g," ");return s(">")+r(c)+n(I)+`
2
+ `+ne+s("^")}let d=r(c.replace(/\d/g," "))+f.slice(0,this.column-1).replace(/[^\t]/g," ");return s(">")+r(c)+n(f)+`
3
+ `+d+s("^")}return" "+r(c)+n(f)}).join(`
4
+ `)}toString(){let e=this.showSourceCode();return e&&(e=`
5
+
6
+ `+e+`
7
+ `),this.name+": "+this.message+e}};pt.exports=j;j.default=j});var Pe=y((Ni,dt)=>{"use strict";var mt={after:`
8
+ `,beforeClose:`
9
+ `,beforeComment:`
10
+ `,beforeDecl:`
11
+ `,beforeOpen:" ",beforeRule:`
12
+ `,colon:": ",commentLeft:" ",commentRight:" ",emptyBody:"",indent:" ",semicolon:!1};function es(i){return i[0].toUpperCase()+i.slice(1)}var $=class{constructor(e){this.builder=e}atrule(e,t){let r="@"+e.name,s=e.params?this.rawValue(e,"params"):"";if(typeof e.raws.afterName<"u"?r+=e.raws.afterName:s&&(r+=" "),e.nodes)this.block(e,r+s);else{let n=(e.raws.between||"")+(t?";":"");this.builder(r+s+n,e)}}beforeAfter(e,t){let r;e.type==="decl"?r=this.raw(e,null,"beforeDecl"):e.type==="comment"?r=this.raw(e,null,"beforeComment"):t==="before"?r=this.raw(e,null,"beforeRule"):r=this.raw(e,null,"beforeClose");let s=e.parent,n=0;for(;s&&s.type!=="root";)n+=1,s=s.parent;if(r.includes(`
13
+ `)){let l=this.raw(e,null,"indent");if(l.length)for(let a=0;a<n;a++)r+=l}return r}block(e,t){let r=this.raw(e,"between","beforeOpen");this.builder(t+r+"{",e,"start");let s;e.nodes&&e.nodes.length?(this.body(e),s=this.raw(e,"after")):s=this.raw(e,"after","emptyBody"),s&&this.builder(s),this.builder("}",e,"end")}body(e){let t=e.nodes.length-1;for(;t>0&&e.nodes[t].type==="comment";)t-=1;let r=this.raw(e,"semicolon");for(let s=0;s<e.nodes.length;s++){let n=e.nodes[s],l=this.raw(n,"before");l&&this.builder(l),this.stringify(n,t!==s||r)}}comment(e){let t=this.raw(e,"left","commentLeft"),r=this.raw(e,"right","commentRight");this.builder("/*"+t+e.text+r+"*/",e)}decl(e,t){let r=this.raw(e,"between","colon"),s=e.prop+r+this.rawValue(e,"value");e.important&&(s+=e.raws.important||" !important"),t&&(s+=";"),this.builder(s,e)}document(e){this.body(e)}raw(e,t,r){let s;if(r||(r=t),t&&(s=e.raws[t],typeof s<"u"))return s;let n=e.parent;if(r==="before"&&(!n||n.type==="root"&&n.first===e||n&&n.type==="document"))return"";if(!n)return mt[r];let l=e.root();if(l.rawCache||(l.rawCache={}),typeof l.rawCache[r]<"u")return l.rawCache[r];if(r==="before"||r==="after")return this.beforeAfter(e,r);{let a="raw"+es(r);this[a]?s=this[a](l,e):l.walk(o=>{if(s=o.raws[t],typeof s<"u")return!1})}return typeof s>"u"&&(s=mt[r]),l.rawCache[r]=s,s}rawBeforeClose(e){let t;return e.walk(r=>{if(r.nodes&&r.nodes.length>0&&typeof r.raws.after<"u")return t=r.raws.after,t.includes(`
14
+ `)&&(t=t.replace(/[^\n]+$/,"")),!1}),t&&(t=t.replace(/\S/g,"")),t}rawBeforeComment(e,t){let r;return e.walkComments(s=>{if(typeof s.raws.before<"u")return r=s.raws.before,r.includes(`
15
+ `)&&(r=r.replace(/[^\n]+$/,"")),!1}),typeof r>"u"?r=this.raw(t,null,"beforeDecl"):r&&(r=r.replace(/\S/g,"")),r}rawBeforeDecl(e,t){let r;return e.walkDecls(s=>{if(typeof s.raws.before<"u")return r=s.raws.before,r.includes(`
16
+ `)&&(r=r.replace(/[^\n]+$/,"")),!1}),typeof r>"u"?r=this.raw(t,null,"beforeRule"):r&&(r=r.replace(/\S/g,"")),r}rawBeforeOpen(e){let t;return e.walk(r=>{if(r.type!=="decl"&&(t=r.raws.between,typeof t<"u"))return!1}),t}rawBeforeRule(e){let t;return e.walk(r=>{if(r.nodes&&(r.parent!==e||e.first!==r)&&typeof r.raws.before<"u")return t=r.raws.before,t.includes(`
17
+ `)&&(t=t.replace(/[^\n]+$/,"")),!1}),t&&(t=t.replace(/\S/g,"")),t}rawColon(e){let t;return e.walkDecls(r=>{if(typeof r.raws.between<"u")return t=r.raws.between.replace(/[^\s:]/g,""),!1}),t}rawEmptyBody(e){let t;return e.walk(r=>{if(r.nodes&&r.nodes.length===0&&(t=r.raws.after,typeof t<"u"))return!1}),t}rawIndent(e){if(e.raws.indent)return e.raws.indent;let t;return e.walk(r=>{let s=r.parent;if(s&&s!==e&&s.parent&&s.parent===e&&typeof r.raws.before<"u"){let n=r.raws.before.split(`
18
+ `);return t=n[n.length-1],t=t.replace(/\S/g,""),!1}}),t}rawSemicolon(e){let t;return e.walk(r=>{if(r.nodes&&r.nodes.length&&r.last.type==="decl"&&(t=r.raws.semicolon,typeof t<"u"))return!1}),t}rawValue(e,t){let r=e[t],s=e.raws[t];return s&&s.value===r?s.raw:r}root(e){this.body(e),e.raws.after&&this.builder(e.raws.after)}rule(e){this.block(e,this.rawValue(e,"selector")),e.raws.ownSemicolon&&this.builder(e.raws.ownSemicolon,e,"end")}stringify(e,t){if(!this[e.type])throw new Error("Unknown AST node type "+e.type+". Maybe you need to change PostCSS stringifier.");this[e.type](e,t)}};dt.exports=$;$.default=$});var W=y((Ui,gt)=>{"use strict";var ts=Pe();function ke(i,e){new ts(e).stringify(i)}gt.exports=ke;ke.default=ke});var le=y((Bi,Le)=>{"use strict";Le.exports.isClean=Symbol("isClean");Le.exports.my=Symbol("my")});var G=y((Ti,wt)=>{"use strict";var rs=oe(),ss=Pe(),is=W(),{isClean:V,my:ns}=le();function Ie(i,e){let t=new i.constructor;for(let r in i){if(!Object.prototype.hasOwnProperty.call(i,r)||r==="proxyCache")continue;let s=i[r],n=typeof s;r==="parent"&&n==="object"?e&&(t[r]=e):r==="source"?t[r]=s:Array.isArray(s)?t[r]=s.map(l=>Ie(l,t)):(n==="object"&&s!==null&&(s=Ie(s)),t[r]=s)}return t}function A(i,e){if(e&&typeof e.offset<"u")return e.offset;let t=1,r=1,s=0;for(let n=0;n<i.length;n++){if(r===e.line&&t===e.column){s=n;break}i[n]===`
19
+ `?(t=1,r+=1):t+=1}return s}var H=class{get proxyOf(){return this}constructor(e={}){this.raws={},this[V]=!1,this[ns]=!0;for(let t in e)if(t==="nodes"){this.nodes=[];for(let r of e[t])typeof r.clone=="function"?this.append(r.clone()):this.append(r)}else this[t]=e[t]}addToError(e){if(e.postcssNode=this,e.stack&&this.source&&/\n\s{4}at /.test(e.stack)){let t=this.source;e.stack=e.stack.replace(/\n\s{4}at /,`$&${t.input.from}:${t.start.line}:${t.start.column}$&`)}return e}after(e){return this.parent.insertAfter(this,e),this}assign(e={}){for(let t in e)this[t]=e[t];return this}before(e){return this.parent.insertBefore(this,e),this}cleanRaws(e){delete this.raws.before,delete this.raws.after,e||delete this.raws.between}clone(e={}){let t=Ie(this);for(let r in e)t[r]=e[r];return t}cloneAfter(e={}){let t=this.clone(e);return this.parent.insertAfter(this,t),t}cloneBefore(e={}){let t=this.clone(e);return this.parent.insertBefore(this,t),t}error(e,t={}){if(this.source){let{end:r,start:s}=this.rangeBy(t);return this.source.input.error(e,{column:s.column,line:s.line},{column:r.column,line:r.line},t)}return new rs(e)}getProxyProcessor(){return{get(e,t){return t==="proxyOf"?e:t==="root"?()=>e.root().toProxy():e[t]},set(e,t,r){return e[t]===r||(e[t]=r,(t==="prop"||t==="value"||t==="name"||t==="params"||t==="important"||t==="text")&&e.markDirty()),!0}}}markClean(){this[V]=!0}markDirty(){if(this[V]){this[V]=!1;let e=this;for(;e=e.parent;)e[V]=!1}}next(){if(!this.parent)return;let e=this.parent.index(this);return this.parent.nodes[e+1]}positionBy(e={}){let t=this.source.start;if(e.index)t=this.positionInside(e.index);else if(e.word){let r="document"in this.source.input?this.source.input.document:this.source.input.css,n=r.slice(A(r,this.source.start),A(r,this.source.end)).indexOf(e.word);n!==-1&&(t=this.positionInside(n))}return t}positionInside(e){let t=this.source.start.column,r=this.source.start.line,s="document"in this.source.input?this.source.input.document:this.source.input.css,n=A(s,this.source.start),l=n+e;for(let a=n;a<l;a++)s[a]===`
20
+ `?(t=1,r+=1):t+=1;return{column:t,line:r,offset:l}}prev(){if(!this.parent)return;let e=this.parent.index(this);return this.parent.nodes[e-1]}rangeBy(e={}){let t="document"in this.source.input?this.source.input.document:this.source.input.css,r={column:this.source.start.column,line:this.source.start.line,offset:A(t,this.source.start)},s=this.source.end?{column:this.source.end.column+1,line:this.source.end.line,offset:typeof this.source.end.offset=="number"?this.source.end.offset:A(t,this.source.end)+1}:{column:r.column+1,line:r.line,offset:r.offset+1};if(e.word){let l=t.slice(A(t,this.source.start),A(t,this.source.end)).indexOf(e.word);l!==-1&&(r=this.positionInside(l),s=this.positionInside(l+e.word.length))}else e.start?r={column:e.start.column,line:e.start.line,offset:A(t,e.start)}:e.index&&(r=this.positionInside(e.index)),e.end?s={column:e.end.column,line:e.end.line,offset:A(t,e.end)}:typeof e.endIndex=="number"?s=this.positionInside(e.endIndex):e.index&&(s=this.positionInside(e.index+1));return(s.line<r.line||s.line===r.line&&s.column<=r.column)&&(s={column:r.column+1,line:r.line,offset:r.offset+1}),{end:s,start:r}}raw(e,t){return new ss().raw(this,e,t)}remove(){return this.parent&&this.parent.removeChild(this),this.parent=void 0,this}replaceWith(...e){if(this.parent){let t=this,r=!1;for(let s of e)s===this?r=!0:r?(this.parent.insertAfter(t,s),t=s):this.parent.insertBefore(t,s);r||this.remove()}return this}root(){let e=this;for(;e.parent&&e.parent.type!=="document";)e=e.parent;return e}toJSON(e,t){let r={},s=t==null;t=t||new Map;let n=0;for(let l in this){if(!Object.prototype.hasOwnProperty.call(this,l)||l==="parent"||l==="proxyCache")continue;let a=this[l];if(Array.isArray(a))r[l]=a.map(o=>typeof o=="object"&&o.toJSON?o.toJSON(null,t):o);else if(typeof a=="object"&&a.toJSON)r[l]=a.toJSON(null,t);else if(l==="source"){if(a==null)continue;let o=t.get(a.input);o==null&&(o=n,t.set(a.input,n),n++),r[l]={end:a.end,inputId:o,start:a.start}}else r[l]=a}return s&&(r.inputs=[...t.keys()].map(l=>l.toJSON())),r}toProxy(){return this.proxyCache||(this.proxyCache=new Proxy(this,this.getProxyProcessor())),this.proxyCache}toString(e=is){e.stringify&&(e=e.stringify);let t="";return e(this,r=>{t+=r}),t}warn(e,t,r={}){let s={node:this};for(let n in r)s[n]=r[n];return e.warn(t,s)}};wt.exports=H;H.default=H});var B=y((Mi,yt)=>{"use strict";var os=G(),Y=class extends os{constructor(e){super(e),this.type="comment"}};yt.exports=Y;Y.default=Y});var J=y((_i,xt)=>{"use strict";var ls=G(),Q=class extends ls{get variable(){return this.prop.startsWith("--")||this.prop[0]==="$"}constructor(e){e&&typeof e.value<"u"&&typeof e.value!="string"&&(e={...e,value:String(e.value)}),super(e),this.type="decl"}};xt.exports=Q;Q.default=Q});var v=y((Di,Pt)=>{"use strict";var St=B(),bt=J(),as=G(),{isClean:Ct,my:Et}=le(),qe,Ot,At,Ne;function vt(i){return i.map(e=>(e.nodes&&(e.nodes=vt(e.nodes)),delete e.source,e))}function Rt(i){if(i[Ct]=!1,i.proxyOf.nodes)for(let e of i.proxyOf.nodes)Rt(e)}var b=class i extends as{get first(){if(this.proxyOf.nodes)return this.proxyOf.nodes[0]}get last(){if(this.proxyOf.nodes)return this.proxyOf.nodes[this.proxyOf.nodes.length-1]}append(...e){for(let t of e){let r=this.normalize(t,this.last);for(let s of r)this.proxyOf.nodes.push(s)}return this.markDirty(),this}cleanRaws(e){if(super.cleanRaws(e),this.nodes)for(let t of this.nodes)t.cleanRaws(e)}each(e){if(!this.proxyOf.nodes)return;let t=this.getIterator(),r,s;for(;this.indexes[t]<this.proxyOf.nodes.length&&(r=this.indexes[t],s=e(this.proxyOf.nodes[r],r),s!==!1);)this.indexes[t]+=1;return delete this.indexes[t],s}every(e){return this.nodes.every(e)}getIterator(){this.lastEach||(this.lastEach=0),this.indexes||(this.indexes={}),this.lastEach+=1;let e=this.lastEach;return this.indexes[e]=0,e}getProxyProcessor(){return{get(e,t){return t==="proxyOf"?e:e[t]?t==="each"||typeof t=="string"&&t.startsWith("walk")?(...r)=>e[t](...r.map(s=>typeof s=="function"?(n,l)=>s(n.toProxy(),l):s)):t==="every"||t==="some"?r=>e[t]((s,...n)=>r(s.toProxy(),...n)):t==="root"?()=>e.root().toProxy():t==="nodes"?e.nodes.map(r=>r.toProxy()):t==="first"||t==="last"?e[t].toProxy():e[t]:e[t]},set(e,t,r){return e[t]===r||(e[t]=r,(t==="name"||t==="params"||t==="selector")&&e.markDirty()),!0}}}index(e){return typeof e=="number"?e:(e.proxyOf&&(e=e.proxyOf),this.proxyOf.nodes.indexOf(e))}insertAfter(e,t){let r=this.index(e),s=this.normalize(t,this.proxyOf.nodes[r]).reverse();r=this.index(e);for(let l of s)this.proxyOf.nodes.splice(r+1,0,l);let n;for(let l in this.indexes)n=this.indexes[l],r<n&&(this.indexes[l]=n+s.length);return this.markDirty(),this}insertBefore(e,t){let r=this.index(e),s=r===0?"prepend":!1,n=this.normalize(t,this.proxyOf.nodes[r],s).reverse();r=this.index(e);for(let a of n)this.proxyOf.nodes.splice(r,0,a);let l;for(let a in this.indexes)l=this.indexes[a],r<=l&&(this.indexes[a]=l+n.length);return this.markDirty(),this}normalize(e,t){if(typeof e=="string")e=vt(Ot(e).nodes);else if(typeof e>"u")e=[];else if(Array.isArray(e)){e=e.slice(0);for(let s of e)s.parent&&s.parent.removeChild(s,"ignore")}else if(e.type==="root"&&this.type!=="document"){e=e.nodes.slice(0);for(let s of e)s.parent&&s.parent.removeChild(s,"ignore")}else if(e.type)e=[e];else if(e.prop){if(typeof e.value>"u")throw new Error("Value field is missed in node creation");typeof e.value!="string"&&(e.value=String(e.value)),e=[new bt(e)]}else if(e.selector||e.selectors)e=[new Ne(e)];else if(e.name)e=[new qe(e)];else if(e.text)e=[new St(e)];else throw new Error("Unknown node type in node creation");return e.map(s=>(s[Et]||i.rebuild(s),s=s.proxyOf,s.parent&&s.parent.removeChild(s),s[Ct]&&Rt(s),s.raws||(s.raws={}),typeof s.raws.before>"u"&&t&&typeof t.raws.before<"u"&&(s.raws.before=t.raws.before.replace(/\S/g,"")),s.parent=this.proxyOf,s))}prepend(...e){e=e.reverse();for(let t of e){let r=this.normalize(t,this.first,"prepend").reverse();for(let s of r)this.proxyOf.nodes.unshift(s);for(let s in this.indexes)this.indexes[s]=this.indexes[s]+r.length}return this.markDirty(),this}push(e){return e.parent=this,this.proxyOf.nodes.push(e),this}removeAll(){for(let e of this.proxyOf.nodes)e.parent=void 0;return this.proxyOf.nodes=[],this.markDirty(),this}removeChild(e){e=this.index(e),this.proxyOf.nodes[e].parent=void 0,this.proxyOf.nodes.splice(e,1);let t;for(let r in this.indexes)t=this.indexes[r],t>=e&&(this.indexes[r]=t-1);return this.markDirty(),this}replaceValues(e,t,r){return r||(r=t,t={}),this.walkDecls(s=>{t.props&&!t.props.includes(s.prop)||t.fast&&!s.value.includes(t.fast)||(s.value=s.value.replace(e,r))}),this.markDirty(),this}some(e){return this.nodes.some(e)}walk(e){return this.each((t,r)=>{let s;try{s=e(t,r)}catch(n){throw t.addToError(n)}return s!==!1&&t.walk&&(s=t.walk(e)),s})}walkAtRules(e,t){return t?e instanceof RegExp?this.walk((r,s)=>{if(r.type==="atrule"&&e.test(r.name))return t(r,s)}):this.walk((r,s)=>{if(r.type==="atrule"&&r.name===e)return t(r,s)}):(t=e,this.walk((r,s)=>{if(r.type==="atrule")return t(r,s)}))}walkComments(e){return this.walk((t,r)=>{if(t.type==="comment")return e(t,r)})}walkDecls(e,t){return t?e instanceof RegExp?this.walk((r,s)=>{if(r.type==="decl"&&e.test(r.prop))return t(r,s)}):this.walk((r,s)=>{if(r.type==="decl"&&r.prop===e)return t(r,s)}):(t=e,this.walk((r,s)=>{if(r.type==="decl")return t(r,s)}))}walkRules(e,t){return t?e instanceof RegExp?this.walk((r,s)=>{if(r.type==="rule"&&e.test(r.selector))return t(r,s)}):this.walk((r,s)=>{if(r.type==="rule"&&r.selector===e)return t(r,s)}):(t=e,this.walk((r,s)=>{if(r.type==="rule")return t(r,s)}))}};b.registerParse=i=>{Ot=i};b.registerRule=i=>{Ne=i};b.registerAtRule=i=>{qe=i};b.registerRoot=i=>{At=i};Pt.exports=b;b.default=b;b.rebuild=i=>{i.type==="atrule"?Object.setPrototypeOf(i,qe.prototype):i.type==="rule"?Object.setPrototypeOf(i,Ne.prototype):i.type==="decl"?Object.setPrototypeOf(i,bt.prototype):i.type==="comment"?Object.setPrototypeOf(i,St.prototype):i.type==="root"&&Object.setPrototypeOf(i,At.prototype),i[Et]=!0,i.nodes&&i.nodes.forEach(e=>{b.rebuild(e)})}});var ae=y((Fi,Lt)=>{"use strict";var kt=v(),T=class extends kt{constructor(e){super(e),this.type="atrule"}append(...e){return this.proxyOf.nodes||(this.nodes=[]),super.append(...e)}prepend(...e){return this.proxyOf.nodes||(this.nodes=[]),super.prepend(...e)}};Lt.exports=T;T.default=T;kt.registerAtRule(T)});var ue=y((zi,Nt)=>{"use strict";var us=v(),It,qt,q=class extends us{constructor(e){super({type:"document",...e}),this.nodes||(this.nodes=[])}toResult(e={}){return new It(new qt,this,e).stringify()}};q.registerLazyResult=i=>{It=i};q.registerProcessor=i=>{qt=i};Nt.exports=q;q.default=q});var Bt=y((ji,Ut)=>{var fs="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict",cs=(i,e=21)=>(t=e)=>{let r="",s=t|0;for(;s--;)r+=i[Math.random()*i.length|0];return r},hs=(i=21)=>{let e="",t=i|0;for(;t--;)e+=fs[Math.random()*64|0];return e};Ut.exports={nanoid:hs,customAlphabet:cs}});var fe=y(()=>{});var ce=y(()=>{});var Ue=y(()=>{});var Tt=y(()=>{});var Te=y((Ki,Dt)=>{"use strict";var{existsSync:ps,readFileSync:ms}=Tt(),{dirname:Be,join:ds}=fe(),{SourceMapConsumer:Mt,SourceMapGenerator:_t}=ce();function gs(i){return Buffer?Buffer.from(i,"base64").toString():window.atob(i)}var K=class{constructor(e,t){if(t.map===!1)return;this.loadAnnotation(e),this.inline=this.startWith(this.annotation,"data:");let r=t.map?t.map.prev:void 0,s=this.loadMap(t.from,r);!this.mapFile&&t.from&&(this.mapFile=t.from),this.mapFile&&(this.root=Be(this.mapFile)),s&&(this.text=s)}consumer(){return this.consumerCache||(this.consumerCache=new Mt(this.text)),this.consumerCache}decodeInline(e){let t=/^data:application\/json;charset=utf-?8;base64,/,r=/^data:application\/json;base64,/,s=/^data:application\/json;charset=utf-?8,/,n=/^data:application\/json,/,l=e.match(s)||e.match(n);if(l)return decodeURIComponent(e.substr(l[0].length));let a=e.match(t)||e.match(r);if(a)return gs(e.substr(a[0].length));let o=e.match(/data:application\/json;([^,]+),/)[1];throw new Error("Unsupported source map encoding "+o)}getAnnotationURL(e){return e.replace(/^\/\*\s*# sourceMappingURL=/,"").trim()}isMap(e){return typeof e!="object"?!1:typeof e.mappings=="string"||typeof e._mappings=="string"||Array.isArray(e.sections)}loadAnnotation(e){let t=e.match(/\/\*\s*# sourceMappingURL=/g);if(!t)return;let r=e.lastIndexOf(t.pop()),s=e.indexOf("*/",r);r>-1&&s>-1&&(this.annotation=this.getAnnotationURL(e.substring(r,s)))}loadFile(e){if(this.root=Be(e),ps(e))return this.mapFile=e,ms(e,"utf-8").toString().trim()}loadMap(e,t){if(t===!1)return!1;if(t){if(typeof t=="string")return t;if(typeof t=="function"){let r=t(e);if(r){let s=this.loadFile(r);if(!s)throw new Error("Unable to load previous source map: "+r.toString());return s}}else{if(t instanceof Mt)return _t.fromSourceMap(t).toString();if(t instanceof _t)return t.toString();if(this.isMap(t))return JSON.stringify(t);throw new Error("Unsupported previous source map format: "+t.toString())}}else{if(this.inline)return this.decodeInline(this.annotation);if(this.annotation){let r=this.annotation;return e&&(r=ds(Be(e),r)),this.loadFile(r)}}}startWith(e,t){return e?e.substr(0,t.length)===t:!1}withContent(){return!!(this.consumer().sourcesContent&&this.consumer().sourcesContent.length>0)}};Dt.exports=K;K.default=K});var Z=y((Zi,Wt)=>{"use strict";var{nanoid:ws}=Bt(),{isAbsolute:De,resolve:Fe}=fe(),{SourceMapConsumer:ys,SourceMapGenerator:xs}=ce(),{fileURLToPath:Ft,pathToFileURL:he}=Ue(),zt=oe(),Ss=Te(),Me=Re(),_e=Symbol("lineToIndexCache"),bs=!!(ys&&xs),jt=!!(Fe&&De);function $t(i){if(i[_e])return i[_e];let e=i.css.split(`
21
+ `),t=new Array(e.length),r=0;for(let s=0,n=e.length;s<n;s++)t[s]=r,r+=e[s].length+1;return i[_e]=t,t}var M=class{get from(){return this.file||this.id}constructor(e,t={}){if(e===null||typeof e>"u"||typeof e=="object"&&!e.toString)throw new Error(`PostCSS received ${e} instead of CSS string`);if(this.css=e.toString(),this.css[0]==="\uFEFF"||this.css[0]==="\uFFFE"?(this.hasBOM=!0,this.css=this.css.slice(1)):this.hasBOM=!1,this.document=this.css,t.document&&(this.document=t.document.toString()),t.from&&(!jt||/^\w+:\/\//.test(t.from)||De(t.from)?this.file=t.from:this.file=Fe(t.from)),jt&&bs){let r=new Ss(this.css,t);if(r.text){this.map=r;let s=r.consumer().file;!this.file&&s&&(this.file=this.mapResolve(s))}}this.file||(this.id="<input css "+ws(6)+">"),this.map&&(this.map.file=this.from)}error(e,t,r,s={}){let n,l,a,o,u;if(t&&typeof t=="object"){let m=t,p=r;if(typeof m.offset=="number"){o=m.offset;let c=this.fromOffset(o);t=c.line,r=c.col}else t=m.line,r=m.column,o=this.fromLineAndColumn(t,r);if(typeof p.offset=="number"){a=p.offset;let c=this.fromOffset(a);l=c.line,n=c.col}else l=p.line,n=p.column,a=this.fromLineAndColumn(p.line,p.column)}else if(r)o=this.fromLineAndColumn(t,r);else{o=t;let m=this.fromOffset(o);t=m.line,r=m.col}let f=this.origin(t,r,l,n);return f?u=new zt(e,f.endLine===void 0?f.line:{column:f.column,line:f.line},f.endLine===void 0?f.column:{column:f.endColumn,line:f.endLine},f.source,f.file,s.plugin):u=new zt(e,l===void 0?t:{column:r,line:t},l===void 0?r:{column:n,line:l},this.css,this.file,s.plugin),u.input={column:r,endColumn:n,endLine:l,endOffset:a,line:t,offset:o,source:this.css},this.file&&(he&&(u.input.url=he(this.file).toString()),u.input.file=this.file),u}fromLineAndColumn(e,t){return $t(this)[e-1]+t-1}fromOffset(e){let t=$t(this),r=t[t.length-1],s=0;if(e>=r)s=t.length-1;else{let n=t.length-2,l;for(;s<n;)if(l=s+(n-s>>1),e<t[l])n=l-1;else if(e>=t[l+1])s=l+1;else{s=l;break}}return{col:e-t[s]+1,line:s+1}}mapResolve(e){return/^\w+:\/\//.test(e)?e:Fe(this.map.consumer().sourceRoot||this.map.root||".",e)}origin(e,t,r,s){if(!this.map)return!1;let n=this.map.consumer(),l=n.originalPositionFor({column:t,line:e});if(!l.source)return!1;let a;typeof r=="number"&&(a=n.originalPositionFor({column:s,line:r}));let o;De(l.source)?o=he(l.source):o=new URL(l.source,this.map.consumer().sourceRoot||he(this.map.mapFile));let u={column:l.column,endColumn:a&&a.column,endLine:a&&a.line,line:l.line,url:o.toString()};if(o.protocol==="file:")if(Ft)u.file=Ft(o);else throw new Error("file: protocol is not available in this PostCSS build");let f=n.sourceContentFor(l.source);return f&&(u.source=f),u}toJSON(){let e={};for(let t of["hasBOM","css","file","id"])this[t]!=null&&(e[t]=this[t]);return this.map&&(e.map={...this.map},e.map.consumerCache&&(e.map.consumerCache=void 0)),e}};Wt.exports=M;M.default=M;Me&&Me.registerInput&&Me.registerInput(M)});var _=y((Xi,Yt)=>{"use strict";var Vt=v(),Ht,Gt,R=class extends Vt{constructor(e){super(e),this.type="root",this.nodes||(this.nodes=[])}normalize(e,t,r){let s=super.normalize(e);if(t){if(r==="prepend")this.nodes.length>1?t.raws.before=this.nodes[1].raws.before:delete t.raws.before;else if(this.first!==t)for(let n of s)n.raws.before=t.raws.before}return s}removeChild(e,t){let r=this.index(e);return!t&&r===0&&this.nodes.length>1&&(this.nodes[1].raws.before=this.nodes[r].raws.before),super.removeChild(e)}toResult(e={}){return new Ht(new Gt,this,e).stringify()}};R.registerLazyResult=i=>{Ht=i};R.registerProcessor=i=>{Gt=i};Yt.exports=R;R.default=R;Vt.registerRoot(R)});var ze=y((en,Qt)=>{"use strict";var X={comma(i){return X.split(i,[","],!0)},space(i){let e=[" ",`
22
+ `," "];return X.split(i,e)},split(i,e,t){let r=[],s="",n=!1,l=0,a=!1,o="",u=!1;for(let f of i)u?u=!1:f==="\\"?u=!0:a?f===o&&(a=!1):f==='"'||f==="'"?(a=!0,o=f):f==="("?l+=1:f===")"?l>0&&(l-=1):l===0&&e.includes(f)&&(n=!0),n?(s!==""&&r.push(s.trim()),s="",n=!1):s+=f;return(t||s!=="")&&r.push(s.trim()),r}};Qt.exports=X;X.default=X});var pe=y((tn,Kt)=>{"use strict";var Jt=v(),Cs=ze(),D=class extends Jt{get selectors(){return Cs.comma(this.selector)}set selectors(e){let t=this.selector?this.selector.match(/,\s*/):null,r=t?t[0]:","+this.raw("between","beforeOpen");this.selector=e.join(r)}constructor(e){super(e),this.type="rule",this.nodes||(this.nodes=[])}};Kt.exports=D;D.default=D;Jt.registerRule(D)});var Xt=y((rn,Zt)=>{"use strict";var Es=ae(),Os=B(),As=J(),vs=Z(),Rs=Te(),Ps=_(),ks=pe();function ee(i,e){if(Array.isArray(i))return i.map(s=>ee(s));let{inputs:t,...r}=i;if(t){e=[];for(let s of t){let n={...s,__proto__:vs.prototype};n.map&&(n.map={...n.map,__proto__:Rs.prototype}),e.push(n)}}if(r.nodes&&(r.nodes=i.nodes.map(s=>ee(s,e))),r.source){let{inputId:s,...n}=r.source;r.source=n,s!=null&&(r.source.input=e[s])}if(r.type==="root")return new Ps(r);if(r.type==="decl")return new As(r);if(r.type==="rule")return new ks(r);if(r.type==="comment")return new Os(r);if(r.type==="atrule")return new Es(r);throw new Error("Unknown node type: "+i.type)}Zt.exports=ee;ee.default=ee});var $e=y((sn,nr)=>{"use strict";var{dirname:me,relative:tr,resolve:rr,sep:sr}=fe(),{SourceMapConsumer:ir,SourceMapGenerator:de}=ce(),{pathToFileURL:er}=Ue(),Ls=Z(),Is=!!(ir&&de),qs=!!(me&&rr&&tr&&sr),je=class{constructor(e,t,r,s){this.stringify=e,this.mapOpts=r.map||{},this.root=t,this.opts=r,this.css=s,this.originalCSS=s,this.usesFileUrls=!this.mapOpts.from&&this.mapOpts.absolute,this.memoizedFileURLs=new Map,this.memoizedPaths=new Map,this.memoizedURLs=new Map}addAnnotation(){let e;this.isInline()?e="data:application/json;base64,"+this.toBase64(this.map.toString()):typeof this.mapOpts.annotation=="string"?e=this.mapOpts.annotation:typeof this.mapOpts.annotation=="function"?e=this.mapOpts.annotation(this.opts.to,this.root):e=this.outputFile()+".map";let t=`
23
+ `;this.css.includes(`\r
24
+ `)&&(t=`\r
25
+ `),this.css+=t+"/*# sourceMappingURL="+e+" */"}applyPrevMaps(){for(let e of this.previous()){let t=this.toUrl(this.path(e.file)),r=e.root||me(e.file),s;this.mapOpts.sourcesContent===!1?(s=new ir(e.text),s.sourcesContent&&(s.sourcesContent=null)):s=e.consumer(),this.map.applySourceMap(s,t,this.toUrl(this.path(r)))}}clearAnnotation(){if(this.mapOpts.annotation!==!1)if(this.root){let e;for(let t=this.root.nodes.length-1;t>=0;t--)e=this.root.nodes[t],e.type==="comment"&&e.text.startsWith("# sourceMappingURL=")&&this.root.removeChild(t)}else this.css&&(this.css=this.css.replace(/\n*\/\*#[\S\s]*?\*\/$/gm,""))}generate(){if(this.clearAnnotation(),qs&&Is&&this.isMap())return this.generateMap();{let e="";return this.stringify(this.root,t=>{e+=t}),[e]}}generateMap(){if(this.root)this.generateString();else if(this.previous().length===1){let e=this.previous()[0].consumer();e.file=this.outputFile(),this.map=de.fromSourceMap(e,{ignoreInvalidMapping:!0})}else this.map=new de({file:this.outputFile(),ignoreInvalidMapping:!0}),this.map.addMapping({generated:{column:0,line:1},original:{column:0,line:1},source:this.opts.from?this.toUrl(this.path(this.opts.from)):"<no source>"});return this.isSourcesContent()&&this.setSourcesContent(),this.root&&this.previous().length>0&&this.applyPrevMaps(),this.isAnnotation()&&this.addAnnotation(),this.isInline()?[this.css]:[this.css,this.map]}generateString(){this.css="",this.map=new de({file:this.outputFile(),ignoreInvalidMapping:!0});let e=1,t=1,r="<no source>",s={generated:{column:0,line:0},original:{column:0,line:0},source:""},n,l;this.stringify(this.root,(a,o,u)=>{if(this.css+=a,o&&u!=="end"&&(s.generated.line=e,s.generated.column=t-1,o.source&&o.source.start?(s.source=this.sourcePath(o),s.original.line=o.source.start.line,s.original.column=o.source.start.column-1,this.map.addMapping(s)):(s.source=r,s.original.line=1,s.original.column=0,this.map.addMapping(s))),l=a.match(/\n/g),l?(e+=l.length,n=a.lastIndexOf(`
26
+ `),t=a.length-n):t+=a.length,o&&u!=="start"){let f=o.parent||{raws:{}};(!(o.type==="decl"||o.type==="atrule"&&!o.nodes)||o!==f.last||f.raws.semicolon)&&(o.source&&o.source.end?(s.source=this.sourcePath(o),s.original.line=o.source.end.line,s.original.column=o.source.end.column-1,s.generated.line=e,s.generated.column=t-2,this.map.addMapping(s)):(s.source=r,s.original.line=1,s.original.column=0,s.generated.line=e,s.generated.column=t-1,this.map.addMapping(s)))}})}isAnnotation(){return this.isInline()?!0:typeof this.mapOpts.annotation<"u"?this.mapOpts.annotation:this.previous().length?this.previous().some(e=>e.annotation):!0}isInline(){if(typeof this.mapOpts.inline<"u")return this.mapOpts.inline;let e=this.mapOpts.annotation;return typeof e<"u"&&e!==!0?!1:this.previous().length?this.previous().some(t=>t.inline):!0}isMap(){return typeof this.opts.map<"u"?!!this.opts.map:this.previous().length>0}isSourcesContent(){return typeof this.mapOpts.sourcesContent<"u"?this.mapOpts.sourcesContent:this.previous().length?this.previous().some(e=>e.withContent()):!0}outputFile(){return this.opts.to?this.path(this.opts.to):this.opts.from?this.path(this.opts.from):"to.css"}path(e){if(this.mapOpts.absolute||e.charCodeAt(0)===60||/^\w+:\/\//.test(e))return e;let t=this.memoizedPaths.get(e);if(t)return t;let r=this.opts.to?me(this.opts.to):".";typeof this.mapOpts.annotation=="string"&&(r=me(rr(r,this.mapOpts.annotation)));let s=tr(r,e);return this.memoizedPaths.set(e,s),s}previous(){if(!this.previousMaps)if(this.previousMaps=[],this.root)this.root.walk(e=>{if(e.source&&e.source.input.map){let t=e.source.input.map;this.previousMaps.includes(t)||this.previousMaps.push(t)}});else{let e=new Ls(this.originalCSS,this.opts);e.map&&this.previousMaps.push(e.map)}return this.previousMaps}setSourcesContent(){let e={};if(this.root)this.root.walk(t=>{if(t.source){let r=t.source.input.from;if(r&&!e[r]){e[r]=!0;let s=this.usesFileUrls?this.toFileUrl(r):this.toUrl(this.path(r));this.map.setSourceContent(s,t.source.input.css)}}});else if(this.css){let t=this.opts.from?this.toUrl(this.path(this.opts.from)):"<no source>";this.map.setSourceContent(t,this.css)}}sourcePath(e){return this.mapOpts.from?this.toUrl(this.mapOpts.from):this.usesFileUrls?this.toFileUrl(e.source.input.from):this.toUrl(this.path(e.source.input.from))}toBase64(e){return Buffer?Buffer.from(e).toString("base64"):window.btoa(unescape(encodeURIComponent(e)))}toFileUrl(e){let t=this.memoizedFileURLs.get(e);if(t)return t;if(er){let r=er(e).toString();return this.memoizedFileURLs.set(e,r),r}else throw new Error("`map.absolute` option is not available in this PostCSS build")}toUrl(e){let t=this.memoizedURLs.get(e);if(t)return t;sr==="\\"&&(e=e.replace(/\\/g,"/"));let r=encodeURI(e).replace(/[#?]/g,encodeURIComponent);return this.memoizedURLs.set(e,r),r}};nr.exports=je});var We=y((nn,lr)=>{"use strict";var ge=/[\t\n\f\r "#'()/;[\\\]{}]/g,we=/[\t\n\f\r !"#'():;@[\\\]{}]|\/(?=\*)/g,Ns=/.[\r\n"'(/\\]/,or=/[\da-f]/i;lr.exports=function(e,t={}){let r=e.css.valueOf(),s=t.ignoreErrors,n,l,a,o,u,f,m,p,c,d,w=r.length,h=0,O=[],I=[];function ne(){return h}function Oe(U){throw e.error("Unclosed "+U,h)}function Vr(){return I.length===0&&h>=w}function Hr(U){if(I.length)return I.pop();if(h>=w)return;let Ae=U?U.ignoreUnclosed:!1;switch(n=r.charCodeAt(h),n){case 10:case 32:case 9:case 13:case 12:{o=h;do o+=1,n=r.charCodeAt(o);while(n===32||n===10||n===9||n===13||n===12);f=["space",r.slice(h,o)],h=o-1;break}case 91:case 93:case 123:case 125:case 58:case 59:case 41:{let ot=String.fromCharCode(n);f=[ot,ot,h];break}case 40:{if(d=O.length?O.pop()[1]:"",c=r.charCodeAt(h+1),d==="url"&&c!==39&&c!==34&&c!==32&&c!==10&&c!==9&&c!==12&&c!==13){o=h;do{if(m=!1,o=r.indexOf(")",o+1),o===-1)if(s||Ae){o=h;break}else Oe("bracket");for(p=o;r.charCodeAt(p-1)===92;)p-=1,m=!m}while(m);f=["brackets",r.slice(h,o+1),h,o],h=o}else o=r.indexOf(")",h+1),l=r.slice(h,o+1),o===-1||Ns.test(l)?f=["(","(",h]:(f=["brackets",l,h,o],h=o);break}case 39:case 34:{u=n===39?"'":'"',o=h;do{if(m=!1,o=r.indexOf(u,o+1),o===-1)if(s||Ae){o=h+1;break}else Oe("string");for(p=o;r.charCodeAt(p-1)===92;)p-=1,m=!m}while(m);f=["string",r.slice(h,o+1),h,o],h=o;break}case 64:{ge.lastIndex=h+1,ge.test(r),ge.lastIndex===0?o=r.length-1:o=ge.lastIndex-2,f=["at-word",r.slice(h,o+1),h,o],h=o;break}case 92:{for(o=h,a=!0;r.charCodeAt(o+1)===92;)o+=1,a=!a;if(n=r.charCodeAt(o+1),a&&n!==47&&n!==32&&n!==10&&n!==9&&n!==13&&n!==12&&(o+=1,or.test(r.charAt(o)))){for(;or.test(r.charAt(o+1));)o+=1;r.charCodeAt(o+1)===32&&(o+=1)}f=["word",r.slice(h,o+1),h,o],h=o;break}default:{n===47&&r.charCodeAt(h+1)===42?(o=r.indexOf("*/",h+2)+1,o===0&&(s||Ae?o=r.length:Oe("comment")),f=["comment",r.slice(h,o+1),h,o],h=o):(we.lastIndex=h+1,we.test(r),we.lastIndex===0?o=r.length-1:o=we.lastIndex-2,f=["word",r.slice(h,o+1),h,o],O.push(f),h=o);break}}return h++,f}function Gr(U){I.push(U)}return{back:Gr,endOfFile:Vr,nextToken:Hr,position:ne}}});var He=y((on,fr)=>{"use strict";var Us=ae(),Bs=B(),Ts=J(),Ms=_(),ar=pe(),_s=We(),ur={empty:!0,space:!0};function Ds(i){for(let e=i.length-1;e>=0;e--){let t=i[e],r=t[3]||t[2];if(r)return r}}var Ve=class{constructor(e){this.input=e,this.root=new Ms,this.current=this.root,this.spaces="",this.semicolon=!1,this.createTokenizer(),this.root.source={input:e,start:{column:1,line:1,offset:0}}}atrule(e){let t=new Us;t.name=e[1].slice(1),t.name===""&&this.unnamedAtrule(t,e),this.init(t,e[2]);let r,s,n,l=!1,a=!1,o=[],u=[];for(;!this.tokenizer.endOfFile();){if(e=this.tokenizer.nextToken(),r=e[0],r==="("||r==="["?u.push(r==="("?")":"]"):r==="{"&&u.length>0?u.push("}"):r===u[u.length-1]&&u.pop(),u.length===0)if(r===";"){t.source.end=this.getPosition(e[2]),t.source.end.offset++,this.semicolon=!0;break}else if(r==="{"){a=!0;break}else if(r==="}"){if(o.length>0){for(n=o.length-1,s=o[n];s&&s[0]==="space";)s=o[--n];s&&(t.source.end=this.getPosition(s[3]||s[2]),t.source.end.offset++)}this.end(e);break}else o.push(e);else o.push(e);if(this.tokenizer.endOfFile()){l=!0;break}}t.raws.between=this.spacesAndCommentsFromEnd(o),o.length?(t.raws.afterName=this.spacesAndCommentsFromStart(o),this.raw(t,"params",o),l&&(e=o[o.length-1],t.source.end=this.getPosition(e[3]||e[2]),t.source.end.offset++,this.spaces=t.raws.between,t.raws.between="")):(t.raws.afterName="",t.params=""),a&&(t.nodes=[],this.current=t)}checkMissedSemicolon(e){let t=this.colon(e);if(t===!1)return;let r=0,s;for(let n=t-1;n>=0&&(s=e[n],!(s[0]!=="space"&&(r+=1,r===2)));n--);throw this.input.error("Missed semicolon",s[0]==="word"?s[3]+1:s[2])}colon(e){let t=0,r,s,n;for(let[l,a]of e.entries()){if(s=a,n=s[0],n==="("&&(t+=1),n===")"&&(t-=1),t===0&&n===":")if(!r)this.doubleColon(s);else{if(r[0]==="word"&&r[1]==="progid")continue;return l}r=s}return!1}comment(e){let t=new Bs;this.init(t,e[2]),t.source.end=this.getPosition(e[3]||e[2]),t.source.end.offset++;let r=e[1].slice(2,-2);if(/^\s*$/.test(r))t.text="",t.raws.left=r,t.raws.right="";else{let s=r.match(/^(\s*)([^]*\S)(\s*)$/);t.text=s[2],t.raws.left=s[1],t.raws.right=s[3]}}createTokenizer(){this.tokenizer=_s(this.input)}decl(e,t){let r=new Ts;this.init(r,e[0][2]);let s=e[e.length-1];for(s[0]===";"&&(this.semicolon=!0,e.pop()),r.source.end=this.getPosition(s[3]||s[2]||Ds(e)),r.source.end.offset++;e[0][0]!=="word";)e.length===1&&this.unknownWord(e),r.raws.before+=e.shift()[1];for(r.source.start=this.getPosition(e[0][2]),r.prop="";e.length;){let u=e[0][0];if(u===":"||u==="space"||u==="comment")break;r.prop+=e.shift()[1]}r.raws.between="";let n;for(;e.length;)if(n=e.shift(),n[0]===":"){r.raws.between+=n[1];break}else n[0]==="word"&&/\w/.test(n[1])&&this.unknownWord([n]),r.raws.between+=n[1];(r.prop[0]==="_"||r.prop[0]==="*")&&(r.raws.before+=r.prop[0],r.prop=r.prop.slice(1));let l=[],a;for(;e.length&&(a=e[0][0],!(a!=="space"&&a!=="comment"));)l.push(e.shift());this.precheckMissedSemicolon(e);for(let u=e.length-1;u>=0;u--){if(n=e[u],n[1].toLowerCase()==="!important"){r.important=!0;let f=this.stringFrom(e,u);f=this.spacesFromEnd(e)+f,f!==" !important"&&(r.raws.important=f);break}else if(n[1].toLowerCase()==="important"){let f=e.slice(0),m="";for(let p=u;p>0;p--){let c=f[p][0];if(m.trim().startsWith("!")&&c!=="space")break;m=f.pop()[1]+m}m.trim().startsWith("!")&&(r.important=!0,r.raws.important=m,e=f)}if(n[0]!=="space"&&n[0]!=="comment")break}e.some(u=>u[0]!=="space"&&u[0]!=="comment")&&(r.raws.between+=l.map(u=>u[1]).join(""),l=[]),this.raw(r,"value",l.concat(e),t),r.value.includes(":")&&!t&&this.checkMissedSemicolon(e)}doubleColon(e){throw this.input.error("Double colon",{offset:e[2]},{offset:e[2]+e[1].length})}emptyRule(e){let t=new ar;this.init(t,e[2]),t.selector="",t.raws.between="",this.current=t}end(e){this.current.nodes&&this.current.nodes.length&&(this.current.raws.semicolon=this.semicolon),this.semicolon=!1,this.current.raws.after=(this.current.raws.after||"")+this.spaces,this.spaces="",this.current.parent?(this.current.source.end=this.getPosition(e[2]),this.current.source.end.offset++,this.current=this.current.parent):this.unexpectedClose(e)}endFile(){this.current.parent&&this.unclosedBlock(),this.current.nodes&&this.current.nodes.length&&(this.current.raws.semicolon=this.semicolon),this.current.raws.after=(this.current.raws.after||"")+this.spaces,this.root.source.end=this.getPosition(this.tokenizer.position())}freeSemicolon(e){if(this.spaces+=e[1],this.current.nodes){let t=this.current.nodes[this.current.nodes.length-1];t&&t.type==="rule"&&!t.raws.ownSemicolon&&(t.raws.ownSemicolon=this.spaces,this.spaces="",t.source.end=this.getPosition(e[2]),t.source.end.offset+=t.raws.ownSemicolon.length)}}getPosition(e){let t=this.input.fromOffset(e);return{column:t.col,line:t.line,offset:e}}init(e,t){this.current.push(e),e.source={input:this.input,start:this.getPosition(t)},e.raws.before=this.spaces,this.spaces="",e.type!=="comment"&&(this.semicolon=!1)}other(e){let t=!1,r=null,s=!1,n=null,l=[],a=e[1].startsWith("--"),o=[],u=e;for(;u;){if(r=u[0],o.push(u),r==="("||r==="[")n||(n=u),l.push(r==="("?")":"]");else if(a&&s&&r==="{")n||(n=u),l.push("}");else if(l.length===0)if(r===";")if(s){this.decl(o,a);return}else break;else if(r==="{"){this.rule(o);return}else if(r==="}"){this.tokenizer.back(o.pop()),t=!0;break}else r===":"&&(s=!0);else r===l[l.length-1]&&(l.pop(),l.length===0&&(n=null));u=this.tokenizer.nextToken()}if(this.tokenizer.endOfFile()&&(t=!0),l.length>0&&this.unclosedBracket(n),t&&s){if(!a)for(;o.length&&(u=o[o.length-1][0],!(u!=="space"&&u!=="comment"));)this.tokenizer.back(o.pop());this.decl(o,a)}else this.unknownWord(o)}parse(){let e;for(;!this.tokenizer.endOfFile();)switch(e=this.tokenizer.nextToken(),e[0]){case"space":this.spaces+=e[1];break;case";":this.freeSemicolon(e);break;case"}":this.end(e);break;case"comment":this.comment(e);break;case"at-word":this.atrule(e);break;case"{":this.emptyRule(e);break;default:this.other(e);break}this.endFile()}precheckMissedSemicolon(){}raw(e,t,r,s){let n,l,a=r.length,o="",u=!0,f,m;for(let p=0;p<a;p+=1)n=r[p],l=n[0],l==="space"&&p===a-1&&!s?u=!1:l==="comment"?(m=r[p-1]?r[p-1][0]:"empty",f=r[p+1]?r[p+1][0]:"empty",!ur[m]&&!ur[f]?o.slice(-1)===","?u=!1:o+=n[1]:u=!1):o+=n[1];if(!u){let p=r.reduce((c,d)=>c+d[1],"");e.raws[t]={raw:p,value:o}}e[t]=o}rule(e){e.pop();let t=new ar;this.init(t,e[0][2]),t.raws.between=this.spacesAndCommentsFromEnd(e),this.raw(t,"selector",e),this.current=t}spacesAndCommentsFromEnd(e){let t,r="";for(;e.length&&(t=e[e.length-1][0],!(t!=="space"&&t!=="comment"));)r=e.pop()[1]+r;return r}spacesAndCommentsFromStart(e){let t,r="";for(;e.length&&(t=e[0][0],!(t!=="space"&&t!=="comment"));)r+=e.shift()[1];return r}spacesFromEnd(e){let t,r="";for(;e.length&&(t=e[e.length-1][0],t==="space");)r=e.pop()[1]+r;return r}stringFrom(e,t){let r="";for(let s=t;s<e.length;s++)r+=e[s][1];return e.splice(t,e.length-t),r}unclosedBlock(){let e=this.current.source.start;throw this.input.error("Unclosed block",e.line,e.column)}unclosedBracket(e){throw this.input.error("Unclosed bracket",{offset:e[2]},{offset:e[2]+1})}unexpectedClose(e){throw this.input.error("Unexpected }",{offset:e[2]},{offset:e[2]+1})}unknownWord(e){throw this.input.error("Unknown word "+e[0][1],{offset:e[0][2]},{offset:e[0][2]+e[0][1].length})}unnamedAtrule(e,t){throw this.input.error("At-rule without name",{offset:t[2]},{offset:t[2]+t[1].length})}};fr.exports=Ve});var xe=y((ln,cr)=>{"use strict";var Fs=v(),zs=Z(),js=He();function ye(i,e){let t=new zs(i,e),r=new js(t);try{r.parse()}catch(s){throw s}return r.root}cr.exports=ye;ye.default=ye;Fs.registerParse(ye)});var Ge=y((an,hr)=>{"use strict";var te=class{constructor(e,t={}){if(this.type="warning",this.text=e,t.node&&t.node.source){let r=t.node.rangeBy(t);this.line=r.start.line,this.column=r.start.column,this.endLine=r.end.line,this.endColumn=r.end.column}for(let r in t)this[r]=t[r]}toString(){return this.node?this.node.error(this.text,{index:this.index,plugin:this.plugin,word:this.word}).message:this.plugin?this.plugin+": "+this.text:this.text}};hr.exports=te;te.default=te});var Se=y((un,pr)=>{"use strict";var $s=Ge(),re=class{get content(){return this.css}constructor(e,t,r){this.processor=e,this.messages=[],this.root=t,this.opts=r,this.css="",this.map=void 0}toString(){return this.css}warn(e,t={}){t.plugin||this.lastPlugin&&this.lastPlugin.postcssPlugin&&(t.plugin=this.lastPlugin.postcssPlugin);let r=new $s(e,t);return this.messages.push(r),r}warnings(){return this.messages.filter(e=>e.type==="warning")}};pr.exports=re;re.default=re});var Ye=y((fn,dr)=>{"use strict";var mr={};dr.exports=function(e){mr[e]||(mr[e]=!0,typeof console<"u"&&console.warn&&console.warn(e))}});var Ke=y((hn,xr)=>{"use strict";var Ws=v(),Vs=ue(),Hs=$e(),Gs=xe(),gr=Se(),Ys=_(),Qs=W(),{isClean:E,my:Js}=le(),cn=Ye(),Ks={atrule:"AtRule",comment:"Comment",decl:"Declaration",document:"Document",root:"Root",rule:"Rule"},Zs={AtRule:!0,AtRuleExit:!0,Comment:!0,CommentExit:!0,Declaration:!0,DeclarationExit:!0,Document:!0,DocumentExit:!0,Once:!0,OnceExit:!0,postcssPlugin:!0,prepare:!0,Root:!0,RootExit:!0,Rule:!0,RuleExit:!0},Xs={Once:!0,postcssPlugin:!0,prepare:!0},F=0;function se(i){return typeof i=="object"&&typeof i.then=="function"}function yr(i){let e=!1,t=Ks[i.type];return i.type==="decl"?e=i.prop.toLowerCase():i.type==="atrule"&&(e=i.name.toLowerCase()),e&&i.append?[t,t+"-"+e,F,t+"Exit",t+"Exit-"+e]:e?[t,t+"-"+e,t+"Exit",t+"Exit-"+e]:i.append?[t,F,t+"Exit"]:[t,t+"Exit"]}function wr(i){let e;return i.type==="document"?e=["Document",F,"DocumentExit"]:i.type==="root"?e=["Root",F,"RootExit"]:e=yr(i),{eventIndex:0,events:e,iterator:0,node:i,visitorIndex:0,visitors:[]}}function Qe(i){return i[E]=!1,i.nodes&&i.nodes.forEach(e=>Qe(e)),i}var Je={},P=class i{get content(){return this.stringify().content}get css(){return this.stringify().css}get map(){return this.stringify().map}get messages(){return this.sync().messages}get opts(){return this.result.opts}get processor(){return this.result.processor}get root(){return this.sync().root}get[Symbol.toStringTag](){return"LazyResult"}constructor(e,t,r){this.stringified=!1,this.processed=!1;let s;if(typeof t=="object"&&t!==null&&(t.type==="root"||t.type==="document"))s=Qe(t);else if(t instanceof i||t instanceof gr)s=Qe(t.root),t.map&&(typeof r.map>"u"&&(r.map={}),r.map.inline||(r.map.inline=!1),r.map.prev=t.map);else{let n=Gs;r.syntax&&(n=r.syntax.parse),r.parser&&(n=r.parser),n.parse&&(n=n.parse);try{s=n(t,r)}catch(l){this.processed=!0,this.error=l}s&&!s[Js]&&Ws.rebuild(s)}this.result=new gr(e,s,r),this.helpers={...Je,postcss:Je,result:this.result},this.plugins=this.processor.plugins.map(n=>typeof n=="object"&&n.prepare?{...n,...n.prepare(this.result)}:n)}async(){return this.error?Promise.reject(this.error):this.processed?Promise.resolve(this.result):(this.processing||(this.processing=this.runAsync()),this.processing)}catch(e){return this.async().catch(e)}finally(e){return this.async().then(e,e)}getAsyncError(){throw new Error("Use process(css).then(cb) to work with async plugins")}handleError(e,t){let r=this.result.lastPlugin;try{t&&t.addToError(e),this.error=e,e.name==="CssSyntaxError"&&!e.plugin?(e.plugin=r.postcssPlugin,e.setMessage()):r.postcssVersion}catch(s){console&&console.error&&console.error(s)}return e}prepareVisitors(){this.listeners={};let e=(t,r,s)=>{this.listeners[r]||(this.listeners[r]=[]),this.listeners[r].push([t,s])};for(let t of this.plugins)if(typeof t=="object")for(let r in t){if(!Zs[r]&&/^[A-Z]/.test(r))throw new Error(`Unknown event ${r} in ${t.postcssPlugin}. Try to update PostCSS (${this.processor.version} now).`);if(!Xs[r])if(typeof t[r]=="object")for(let s in t[r])s==="*"?e(t,r,t[r][s]):e(t,r+"-"+s.toLowerCase(),t[r][s]);else typeof t[r]=="function"&&e(t,r,t[r])}this.hasListener=Object.keys(this.listeners).length>0}async runAsync(){this.plugin=0;for(let e=0;e<this.plugins.length;e++){let t=this.plugins[e],r=this.runOnRoot(t);if(se(r))try{await r}catch(s){throw this.handleError(s)}}if(this.prepareVisitors(),this.hasListener){let e=this.result.root;for(;!e[E];){e[E]=!0;let t=[wr(e)];for(;t.length>0;){let r=this.visitTick(t);if(se(r))try{await r}catch(s){let n=t[t.length-1].node;throw this.handleError(s,n)}}}if(this.listeners.OnceExit)for(let[t,r]of this.listeners.OnceExit){this.result.lastPlugin=t;try{if(e.type==="document"){let s=e.nodes.map(n=>r(n,this.helpers));await Promise.all(s)}else await r(e,this.helpers)}catch(s){throw this.handleError(s)}}}return this.processed=!0,this.stringify()}runOnRoot(e){this.result.lastPlugin=e;try{if(typeof e=="object"&&e.Once){if(this.result.root.type==="document"){let t=this.result.root.nodes.map(r=>e.Once(r,this.helpers));return se(t[0])?Promise.all(t):t}return e.Once(this.result.root,this.helpers)}else if(typeof e=="function")return e(this.result.root,this.result)}catch(t){throw this.handleError(t)}}stringify(){if(this.error)throw this.error;if(this.stringified)return this.result;this.stringified=!0,this.sync();let e=this.result.opts,t=Qs;e.syntax&&(t=e.syntax.stringify),e.stringifier&&(t=e.stringifier),t.stringify&&(t=t.stringify);let s=new Hs(t,this.result.root,this.result.opts).generate();return this.result.css=s[0],this.result.map=s[1],this.result}sync(){if(this.error)throw this.error;if(this.processed)return this.result;if(this.processed=!0,this.processing)throw this.getAsyncError();for(let e of this.plugins){let t=this.runOnRoot(e);if(se(t))throw this.getAsyncError()}if(this.prepareVisitors(),this.hasListener){let e=this.result.root;for(;!e[E];)e[E]=!0,this.walkSync(e);if(this.listeners.OnceExit)if(e.type==="document")for(let t of e.nodes)this.visitSync(this.listeners.OnceExit,t);else this.visitSync(this.listeners.OnceExit,e)}return this.result}then(e,t){return this.async().then(e,t)}toString(){return this.css}visitSync(e,t){for(let[r,s]of e){this.result.lastPlugin=r;let n;try{n=s(t,this.helpers)}catch(l){throw this.handleError(l,t.proxyOf)}if(t.type!=="root"&&t.type!=="document"&&!t.parent)return!0;if(se(n))throw this.getAsyncError()}}visitTick(e){let t=e[e.length-1],{node:r,visitors:s}=t;if(r.type!=="root"&&r.type!=="document"&&!r.parent){e.pop();return}if(s.length>0&&t.visitorIndex<s.length){let[l,a]=s[t.visitorIndex];t.visitorIndex+=1,t.visitorIndex===s.length&&(t.visitors=[],t.visitorIndex=0),this.result.lastPlugin=l;try{return a(r.toProxy(),this.helpers)}catch(o){throw this.handleError(o,r)}}if(t.iterator!==0){let l=t.iterator,a;for(;a=r.nodes[r.indexes[l]];)if(r.indexes[l]+=1,!a[E]){a[E]=!0,e.push(wr(a));return}t.iterator=0,delete r.indexes[l]}let n=t.events;for(;t.eventIndex<n.length;){let l=n[t.eventIndex];if(t.eventIndex+=1,l===F){r.nodes&&r.nodes.length&&(r[E]=!0,t.iterator=r.getIterator());return}else if(this.listeners[l]){t.visitors=this.listeners[l];return}}e.pop()}walkSync(e){e[E]=!0;let t=yr(e);for(let r of t)if(r===F)e.nodes&&e.each(s=>{s[E]||this.walkSync(s)});else{let s=this.listeners[r];if(s&&this.visitSync(s,e.toProxy()))return}}warnings(){return this.sync().warnings()}};P.registerPostcss=i=>{Je=i};xr.exports=P;P.default=P;Ys.registerLazyResult(P);Vs.registerLazyResult(P)});var br=y((mn,Sr)=>{"use strict";var ei=$e(),ti=xe(),ri=Se(),si=W(),pn=Ye(),ie=class{get content(){return this.result.css}get css(){return this.result.css}get map(){return this.result.map}get messages(){return[]}get opts(){return this.result.opts}get processor(){return this.result.processor}get root(){if(this._root)return this._root;let e,t=ti;try{e=t(this._css,this._opts)}catch(r){this.error=r}if(this.error)throw this.error;return this._root=e,e}get[Symbol.toStringTag](){return"NoWorkResult"}constructor(e,t,r){t=t.toString(),this.stringified=!1,this._processor=e,this._css=t,this._opts=r,this._map=void 0;let s,n=si;this.result=new ri(this._processor,s,this._opts),this.result.css=t;let l=this;Object.defineProperty(this.result,"root",{get(){return l.root}});let a=new ei(n,s,this._opts,t);if(a.isMap()){let[o,u]=a.generate();o&&(this.result.css=o),u&&(this.result.map=u)}else a.clearAnnotation(),this.result.css=a.css}async(){return this.error?Promise.reject(this.error):Promise.resolve(this.result)}catch(e){return this.async().catch(e)}finally(e){return this.async().then(e,e)}sync(){if(this.error)throw this.error;return this.result}then(e,t){return this.async().then(e,t)}toString(){return this._css}warnings(){return[]}};Sr.exports=ie;ie.default=ie});var Er=y((dn,Cr)=>{"use strict";var ii=ue(),ni=Ke(),oi=br(),li=_(),N=class{constructor(e=[]){this.version="8.5.6",this.plugins=this.normalize(e)}normalize(e){let t=[];for(let r of e)if(r.postcss===!0?r=r():r.postcss&&(r=r.postcss),typeof r=="object"&&Array.isArray(r.plugins))t=t.concat(r.plugins);else if(typeof r=="object"&&r.postcssPlugin)t.push(r);else if(typeof r=="function")t.push(r);else if(!(typeof r=="object"&&(r.parse||r.stringify)))throw new Error(r+" is not a PostCSS plugin");return t}process(e,t={}){return!this.plugins.length&&!t.parser&&!t.stringifier&&!t.syntax?new oi(this,e,t):new ni(this,e,t)}use(e){return this.plugins=this.plugins.concat(this.normalize([e])),this}};Cr.exports=N;N.default=N;li.registerProcessor(N);ii.registerProcessor(N)});var Xe=y((gn,Lr)=>{"use strict";var Or=ae(),Ar=B(),ai=v(),ui=oe(),vr=J(),Rr=ue(),fi=Xt(),ci=Z(),hi=Ke(),pi=ze(),mi=G(),di=xe(),Ze=Er(),gi=Se(),Pr=_(),kr=pe(),wi=W(),yi=Ge();function x(...i){return i.length===1&&Array.isArray(i[0])&&(i=i[0]),new Ze(i)}x.plugin=function(e,t){let r=!1;function s(...l){console&&console.warn&&!r&&(r=!0,console.warn(e+`: postcss.plugin was deprecated. Migration guide:
27
+ https://evilmartians.com/chronicles/postcss-8-plugin-migration`),process.env.LANG&&process.env.LANG.startsWith("cn")&&console.warn(e+`: \u91CC\u9762 postcss.plugin \u88AB\u5F03\u7528. \u8FC1\u79FB\u6307\u5357:
28
+ https://www.w3ctech.com/topic/2226`));let a=t(...l);return a.postcssPlugin=e,a.postcssVersion=new Ze().version,a}let n;return Object.defineProperty(s,"postcss",{get(){return n||(n=s()),n}}),s.process=function(l,a,o){return x([s(o)]).process(l,a)},s};x.stringify=wi;x.parse=di;x.fromJSON=fi;x.list=pi;x.comment=i=>new Ar(i);x.atRule=i=>new Or(i);x.decl=i=>new vr(i);x.rule=i=>new kr(i);x.root=i=>new Pr(i);x.document=i=>new Rr(i);x.CssSyntaxError=ui;x.Declaration=vr;x.Container=ai;x.Processor=Ze;x.Document=Rr;x.Comment=Ar;x.Warning=yi;x.AtRule=Or;x.Result=gi;x.Input=ci;x.Rule=kr;x.Root=Pr;x.Node=mi;hi.registerPostcss(x);Lr.exports=x;x.default=x});var qr=y((jn,Ir)=>{var xi=B(),Si=He(),bi=We(),et=class extends Si{checkMissedSemicolon(){}comment(e){let t=new xi;this.init(t,e[2]);let r=this.input.fromOffset(e[3])||this.input.fromOffset(this.input.css.length-1);t.source.end={column:r.col,line:r.line,offset:e[3]+1};let s=e[1].slice(2);if(s.slice(-2)==="*/"&&(s=s.slice(0,-2)),/^\s*$/.test(s))t.text="",t.raws.left=s,t.raws.right="";else{let n=s.match(/^(\s*)([^]*\S)(\s*)$/);t.text=n[2],t.raws.left=n[1],t.raws.right=n[3]}}createTokenizer(){this.tokenizer=bi(this.input,{ignoreErrors:!0})}decl(e){e.length>1&&e.some(t=>t[0]==="word")&&super.decl(e)}doubleColon(){}endFile(){for(this.current.nodes&&this.current.nodes.length&&(this.current.raws.semicolon=this.semicolon),this.current.raws.after=(this.current.raws.after||"")+this.spaces;this.current.parent;)this.current=this.current.parent,this.current.raws.after="";this.root.source.end=this.getPosition(this.tokenizer.position())}precheckMissedSemicolon(e){let t=this.colon(e);if(t===!1)return;let r,s;for(r=t-1;r>=0&&e[r][0]!=="word";r--);if(r===0||r<0)return;for(s=r-1;s>=0;s--)if(e[s][0]!=="space"){s+=1;break}let n=e.slice(r),l=e.slice(s,r);e.splice(s,e.length-s),this.spaces=l.map(a=>a[1]).join(""),this.decl(n)}unclosedBracket(){}unexpectedClose(){this.current.raws.after+="}"}unknownWord(e){this.spaces+=e.map(t=>t[1]).join("")}unnamedAtrule(e){e.name=""}};Ir.exports=et});var Ur=y(($n,Nr)=>{var{Input:Ci}=Xe(),Ei=qr();Nr.exports=function(e,t){let r=new Ci(e,t),s=new Ei(r);return s.parse(),s.root}});var S=at(Xe(),1),k=S.default,wn=S.default.stringify,yn=S.default.fromJSON,xn=S.default.plugin,Sn=S.default.parse,bn=S.default.list,Cn=S.default.document,En=S.default.comment,On=S.default.atRule,An=S.default.rule,vn=S.default.decl,Rn=S.default.root,Pn=S.default.CssSyntaxError,kn=S.default.Declaration,Ln=S.default.Container,In=S.default.Processor,qn=S.default.Document,Nn=S.default.Comment,Un=S.default.Warning,Bn=S.default.AtRule,Tn=S.default.Result,Mn=S.default.Input,_n=S.default.Rule,Dn=S.default.Root,Fn=S.default.Node;var Br=at(Ur(),1),C={};function Tr(i,e){C[i]=k.parse(e,{parser:Br.default})}function be(i){let e=[];return Object.keys(C).forEach(t=>{C[t].walkRules(r=>{r.selectors&&r.selectors.includes(`.${i}`)&&r.walkDecls(s=>{e.push({prop:s.prop,value:s.value,important:s.important})})})}),e.length===0&&console.warn(`forgecss: no styles found for class "${i}".`),e}function Mr(i){if(!i){C={};return}C[i]&&delete C[i]}function _r(){let i;return Object.keys(C).forEach(e=>{C[e].walkRules(t=>{t.walkDecls(r=>{if(r.prop==="--apply"){let s=r.value.split(" ").map(l=>l.trim()).filter(Boolean),n=k.rule({selector:t.selector});s.forEach(l=>{be(l).forEach(o=>{n.append({prop:o.prop,value:o.value,important:o.important})})}),i||(i=k.root()),i.append(n)}})})}),i}function Dr(){return C}function Fr(){let i="";return Object.keys(C).forEach(e=>{i+=C[e].toString()+`
29
+ `}),i}var L={};async function tt(i,e,t){try{if(L[i])return;L[i]=[];let r=i.split(".").pop().toLowerCase();if(r==="html"){Oi(e).forEach(s=>{L[i].push(s)});return}if(t&&(r==="jsx"||r==="tsx")){await t(e,L,i);return}}catch(r){console.error(`forgecss: error processing file ${i.replace(process.cwd(),"")}`,r)}}function zr(i){if(!i){L={};return}L[i]&&delete L[i]}function rt(){return L}function Oi(i){let e=[],t=/\bclass\s*=\s*(["'])(.*?)\1/gis,r;for(;r=t.exec(i);)e.push(r[2].trim());return e}function Ai(i){let e=i.lastIndexOf(":");if(e===-1)return[null,i];let t=i.slice(0,e),r=i.slice(e+1);return[t,r]}function vi(i){let e=[],t="",r=0,s=null;for(let n=0;n<i.length;n++){let l=i[n];if(r>0){if(s){t+=l,l===s&&i[n-1]!=="\\"&&(s=null);continue}else if(l==="'"||l==='"'){s=l,t+=l;continue}}if(l==="["){r++,t+=l;continue}if(l==="]"&&r>0){r--,t+=l;continue}if(r===0&&/\s/.test(l)){for(t&&e.push(t),t="";n+1<i.length&&/\s/.test(i[n+1]);)n++;continue}t+=l}return t&&e.push(t),e}function Ce(i){return vi(i).map(e=>{let[t,r]=Ai(e);return!t||t==="[true]"?r:t==="[false]"?!1:(t=st(t),r.split(",").map(s=>`${t}_${s}`).join(" "))}).filter(Boolean).join(" ")}function st(i){let e=i.trim();return e=e.replace(/[&]/g,"I"),e=e.replace(/[:| =]/g,"-"),e=e.replace(/[^a-zA-Z0-9_-]/g,""),e}var Ee={VARIANT:"variant",CALL:"call",TOKEN:"token"},jr=["hover","active","focus","focus-visible","focus-within","disabled","enabled","read-only","read-write","checked","indeterminate","valid","invalid","required","optional","in-range","out-of-range","placeholder-shown","autofill","user-invalid"];function $r(i){return i.replace(/\/\*[\s\S]*?\*\//g,"").replace(/\s*([{}:;,])\s*/g,"$1").replace(/;}/g,"}").replace(/\s+/g," ").replace(/\s*{\s*/g,"{").replace(/\s*}\s*/g,"}").trim()}function it(i,e){let t=[],{getStylesByClassName:r,cache:s={},config:n}=e;for(let o of i)switch(o.type){case Ee.TOKEN:break;case Ee.VARIANT:let u=o.selector,f=(o?.payload?.value??"").split(",").map(p=>p.trim()).filter(Boolean),m;if(!o.payload.value&&typeof o.payload=="object"&&(m=it([o.payload],e)),jr.includes(u))f.forEach(p=>{let c=`.${u}_${p}`,d=l(`${c}:${u}`,p,s);d&&t.push(d)});else if(n.breakpoints[u]){let p;s[n.breakpoints[u]]?p=s[n.breakpoints[u]]:(p=s[n.breakpoints[u]]=k.atRule({name:"media",params:n.breakpoints[u]}),t.push(p)),m?m.forEach(c=>{p.append(c)}):f.forEach(c=>{let d=`.${u}_${c}`,w=l(d,c,s);w&&p.append(w)})}else o.payload?.type===Ee.TOKEN&&o.simple===!0?console.warn(`forgecss: there is no breakpoint defined for label "${u}".`):f.forEach(p=>{if(Array.isArray(u)&&(u=u.map(({type:h,value:O,selector:I,payload:ne})=>{if(h==="token")return O}).filter(Boolean).join(" ")),["","true"].includes(u))return;let c=st(u)+"_"+p,d=a(u,c),w=l(d,p,s);w&&t.push(w)});break}function l(o,u,f={}){if(f[o])return;let m=f[o]=k.rule({selector:o}),p=r(u);if(p.length!==0)return p.forEach(c=>{m.append(k.decl({prop:c.prop,value:c.value,important:c.important}))}),m}function a(o,u){return o=o.replace(/[&]/g,`.${u}`),o}return t}function Wr(i,{minify:e}={minify:!0}){return e?$r(i.map(t=>t.toString()).join("")):i.map(t=>t.toString()).join(`
30
+ `)}function nt(i,e={}){if(e[i])return e[i];if(Array.isArray(i)){let c=[];i.forEach(d=>{d.trim().split(" ").forEach(w=>{c.includes(w)||c.push(w)})}),i=c.join(" ")}let t=String(i??"").trim(),r=0,s=c=>c===" "||c===`
31
+ `||c===" "||c==="\r";function n(){for(;r<t.length&&s(t[r]);)r++}function l(c){let d=[];for(;r<t.length&&(n(),!(c&&t[r]===c||r>=t.length));)d.push(f());return d}function a(){let c="";for(;r<t.length;){let d=t[r];if(s(d)||d==="("||d===")"||d===":"||d==="[")break;c+=d,r++}return c.trim()}function o(c){return/^[A-Za-z_][A-Za-z0-9_-]*$/.test(c)}function u(c){return/^[A-Za-z_][A-Za-z0-9_-]*$/.test(c)}function f(){if(n(),t[r]==="["){let w=m(),h=nt(w,e);if(t[r]===":"){r++;let O=f();return{type:"variant",selector:h,payload:O}}return{type:"token",value:`[${w}]`}}let d=a();for(;t[r]==="[";){let w=m();d+=`[${w}]`}if(t[r]===":"&&o(d)){r++;let w=f();return{type:"variant",selector:d,payload:w,simple:!0}}if(t[r]==="("&&u(d)){r++;let w=[];for(;r<t.length;){if(n(),t[r]===")"){r++;break}w.push(f()),n(),t[r]===","&&r++}return{type:"call",name:d,args:w}}if(t[r]===":")for(d+=":",r++;r<t.length;){let w=t[r];if(s(w)||w===")"||w===",")break;if(w==="["){let h=m();d+=`[${h}]`;continue}if(w==="("){d+="(",r++;let h=1;for(;r<t.length&&h>0;)t[r]==="("&&h++,t[r]===")"&&h--,d+=t[r++];continue}d+=w,r++}return{type:"token",value:d}}function m(){r++;let c="",d=1,w=null;for(;r<t.length;){let h=t[r];if(w){c+=h,h==="\\"&&r+1<t.length?(r++,c+=t[r]):h===w&&(w=null),r++;continue}if(h==="'"||h==='"'){w=h,c+=h,r++;continue}if(h==="["){d++,c+=h,r++;continue}if(h==="]"){if(d--,d===0){r++;break}c+=h,r++;continue}c+=h,r++}return c}let p=l(null);return e[i]=p,p}var z={inventoryFiles:["css","less","scss"],usageFiles:["html","jsx","tsx"],usageAttributes:["class","className"],breakpoints:{},verbose:!0,minify:!0,bundleAll:!1};function Ri(i){let e={...z};e.breakpoints=Object.assign({},z.breakpoints,i?.breakpoints??{}),e.usageAttributes=i?.usageAttributes??z.usageAttributes,e.verbose=i?.verbose??z.verbose,e.minify=i?.minify??z.minify;async function t(){try{let r={},s=rt(),n=nt(Object.values(s).reduce((o,u)=>o.concat(u),[])),l=it(n,{getStylesByClassName:be,cache:r,config:e});l.push(_r());let a=Wr(l.filter(Boolean),e);return e.verbose&&console.log("forgecss: output CSS generated successfully."),e.bundleAll?Fr()+`
32
+ `+a:a}catch(r){console.error(`forgecss: error generating output CSS: ${r}`)}return null}return{async parse({css:r,html:s,jsx:n}){if(!r)throw new Error('forgecss: parse requires "css".');if(!s&&!n)throw new Error('forgecss: parse requires "html" or "jsx".');Mr(),zr();try{Tr("styles.css",r)}catch(l){console.error("forgecss: error extracting styles.",l)}try{s?await tt("usage.html",s):n&&await tt("usage.jsx",n)}catch(l){console.error("forgecss: error extracting usages.",l)}return t()},fxAll:function(r){let n=(r||document).querySelectorAll("[class]");for(let l=0;l<n.length;l++){let a=n[l],o=a.getAttribute("class");if(!o)continue;let u=Ce(o);typeof u=="string"&&u!==o&&a.setAttribute("class",u)}},fx:Ce,getUsages:rt,getStylesByClassName:be,getInventory:Dr}}window.ForgeCSS=Ri;})();
@@ -3,19 +3,14 @@ import {
3
3
  getStylesByClassName,
4
4
  invalidateInventory,
5
5
  resolveApplys,
6
- getInventory
6
+ getInventory,
7
+ getAllCSS
7
8
  } from "./lib/inventory.js";
8
9
  import { invalidateUsageCache, findUsages, getUsages } from "./lib/usages.js";
9
- import { astToRules, rulesToCSS } from "../lib/forge-lang/Compiler.js";
10
- import { toAST } from "../lib/forge-lang/Parser.js";
11
- import fx from '../lib/fx.js'
12
-
13
- const DEFAULT_OPTIONS = {
14
- usageAttributes: ["class", "className"],
15
- breakpoints: {},
16
- verbose: true,
17
- minify: true
18
- };
10
+ import fx from './lib/fx.js'
11
+ import { astToRules, rulesToCSS } from "./lib/forge-lang/Compiler.js";
12
+ import { toAST } from "./lib/forge-lang/Parser.js";
13
+ import { DEFAULT_OPTIONS } from "./lib/constants.js";
19
14
 
20
15
  function ForgeCSS(options) {
21
16
  const config = { ...DEFAULT_OPTIONS };
@@ -42,7 +37,11 @@ function ForgeCSS(options) {
42
37
  rules.push(resolveApplys());
43
38
  const css = rulesToCSS(rules.filter(Boolean), config);
44
39
  if (config.verbose) {
45
- console.log("forgecss: Output CSS generated successfully.");
40
+ console.log("forgecss: output CSS generated successfully.");
41
+ }
42
+ if (config.bundleAll) {
43
+ const inventoryCSS = getAllCSS();
44
+ return inventoryCSS + "\n" + css;
46
45
  }
47
46
  return css;
48
47
  } catch (err) {
@@ -63,7 +62,7 @@ function ForgeCSS(options) {
63
62
  invalidateUsageCache();
64
63
  // filling the inventory
65
64
  try {
66
- await extractStyles(css);
65
+ extractStyles("styles.css", css);
67
66
  } catch (err) {
68
67
  console.error(`forgecss: error extracting styles.`, err);
69
68
  }
@@ -79,10 +78,26 @@ function ForgeCSS(options) {
79
78
  }
80
79
  return result();
81
80
  },
81
+ fxAll: function (root) {
82
+ const rootNode = root || document;
83
+ const nodes = rootNode.querySelectorAll("[class]");
84
+
85
+ for (let i = 0; i < nodes.length; i++) {
86
+ let el = nodes[i];
87
+ let original = el.getAttribute("class");
88
+ if (!original) continue;
89
+
90
+ let transformed = fx(original);
91
+
92
+ if (typeof transformed === "string" && transformed !== original) {
93
+ el.setAttribute("class", transformed);
94
+ }
95
+ }
96
+ },
97
+ fx,
82
98
  getUsages,
83
99
  getStylesByClassName,
84
- getInventory,
85
- fx
100
+ getInventory
86
101
  };
87
102
  }
88
103
 
@@ -8,7 +8,13 @@ import chokidar from "chokidar";
8
8
 
9
9
  import ForgeCSS from './index.js';
10
10
 
11
- program.option("-c, --config <string>,", "Path to forgecss config file", process.cwd() + "/forgecss.config.json");
11
+ const POSSIBLE_CONFIG_FILES = [
12
+ process.cwd() + "/forgecss.config.json",
13
+ process.cwd() + "/forgecss.config.js",
14
+ process.cwd() + "/forgecss.config.mjs"
15
+ ];
16
+
17
+ program.option("-c, --config <string>,", "Path to forgecss config file", POSSIBLE_CONFIG_FILES[0]);
12
18
  program.option("-w, --watch", "Enable watch mode", false);
13
19
  program.option("-v, --verbose", "Enable watch mode", false);
14
20
  program.parse();
@@ -17,16 +23,37 @@ const options = program.opts();
17
23
  let config = null, instance = null;
18
24
 
19
25
  if (!fs.existsSync(options.config)) {
20
- throw new Error(`forgecss: Config file not found at ${options.config}. Check the --config option.`);
26
+ let found = false;
27
+ for (let possibleConfigFile of POSSIBLE_CONFIG_FILES) {
28
+ if (fs.existsSync(possibleConfigFile)) {
29
+ options.config = possibleConfigFile;
30
+ found = true;
31
+ break;
32
+ }
33
+ }
34
+ if (!found) {
35
+ throw new Error(`forgecss: config file not found at ${options.config} or any of the default locations.`);
36
+ }
21
37
  }
22
38
 
23
39
  async function loadConfig(configPath) {
24
40
  const abs = path.resolve(configPath);
25
- const jsonStr = fs.readFileSync(abs, "utf-8");
26
- try {
27
- return JSON.parse(jsonStr);
28
- } catch(err) {
29
- throw new Error(`forgecss: error parsing config file at ${configPath}: ${err}`);
41
+ if (abs.toLowerCase().endsWith('.json')) {
42
+ const jsonStr = fs.readFileSync(abs, "utf-8");
43
+ if (options.verbose) {
44
+ console.log(`forgecss: Loaded config file from ${abs.replace(process.cwd(), '')}`);
45
+ }
46
+ try {
47
+ return JSON.parse(jsonStr);
48
+ } catch(err) {
49
+ throw new Error(`forgecss: error parsing config file at ${configPath}: ${err}`);
50
+ }
51
+ } else {
52
+ const module = await import(pathToFileURL(abs).href);
53
+ if (options.verbose) {
54
+ console.log(`forgecss: Loaded config file from ${abs.replace(process.cwd(), '')}`);
55
+ }
56
+ return module.default || module;
30
57
  }
31
58
  }
32
59
  async function runForgeCSS(lookAtPath = null) {
@@ -62,9 +89,6 @@ async function runForgeCSS(lookAtPath = null) {
62
89
  } else {
63
90
  instance.parseDirectory({ dir: config.dir, output: config.output });
64
91
  }
65
- if (options.verbose) {
66
- console.log(`forgecss: ${config.output} generated successfully.`);
67
- }
68
92
  }
69
93
 
70
94
  runForgeCSS();
package/index.d.ts CHANGED
@@ -7,6 +7,7 @@ export type ForgeCSSOptions = {
7
7
  };
8
8
  verbose?: boolean;
9
9
  minify?: boolean;
10
+ bundleAll?: boolean;
10
11
  };
11
12
 
12
13
  export type ForgeInstance = {
@@ -1,9 +1,7 @@
1
- import fxFn from "../lib/fx.js";
1
+ import fxFn from "./lib/fx.js";
2
2
 
3
- function forgecss(root) {
3
+ function fxAll(root) {
4
4
  var rootNode = root || document;
5
-
6
- // Query only nodes that actually have "class" attributes
7
5
  var nodes = rootNode.querySelectorAll('[class]');
8
6
 
9
7
  for (var i = 0; i < nodes.length; i++) {
@@ -19,16 +17,20 @@ function forgecss(root) {
19
17
  }
20
18
  }
21
19
 
22
- window.fx = fxFn;
23
- window.forgecss = forgecss;
20
+ window.fx = function(str) {
21
+ if (str) {
22
+ return fxFn(str);
23
+ }
24
+ return fxAll();
25
+ };
24
26
 
25
27
  if (document.readyState !== 'loading') {
26
- forgecss();
28
+ fxAll();
27
29
  } else {
28
30
  document.addEventListener('DOMContentLoaded', function () {
29
- forgecss();
31
+ fxAll();
30
32
  });
31
33
  }
32
34
  window.addEventListener('load', function () {
33
- forgecss();
35
+ fxAll();
34
36
  });
package/index.js CHANGED
@@ -2,20 +2,12 @@ import path from 'path';
2
2
  import { writeFile } from "fs/promises";
3
3
  import chokidar from "chokidar";
4
4
 
5
- import { extractStyles, getStylesByClassName, invalidateInventory, resolveApplys } from "./lib/inventory.js";
5
+ import { extractStyles, getStylesByClassName, invalidateInventory, resolveApplys, getAllCSS } from "./lib/inventory.js";
6
6
  import { invalidateUsageCache, findUsages, getUsages } from "./lib/usages.js";
7
7
  import { astToRules, rulesToCSS } from './lib/forge-lang/Compiler.js';
8
8
  import { toAST } from './lib/forge-lang/Parser.js';
9
- import { getAllFiles } from './lib/helpers.js';
10
-
11
- const DEFAULT_OPTIONS = {
12
- inventoryFiles: ["css", "less", "scss"],
13
- usageFiles: ["html", "jsx", "tsx"],
14
- usageAttributes: ["class", "className"],
15
- breakpoints: {},
16
- verbose: true,
17
- minify: true
18
- };
9
+ import { getAllFiles, JSXParser, readFileContent } from './lib/helpers.js';
10
+ import { DEFAULT_OPTIONS } from './lib/constants.js';
19
11
 
20
12
  export default function ForgeCSS(options) {
21
13
  const config = { ...DEFAULT_OPTIONS };
@@ -26,6 +18,7 @@ export default function ForgeCSS(options) {
26
18
  config.usageAttributes = options?.usageAttributes ?? DEFAULT_OPTIONS.usageAttributes;
27
19
  config.verbose = options?.verbose ?? DEFAULT_OPTIONS.verbose;
28
20
  config.minify = options?.minify ?? DEFAULT_OPTIONS.minify;
21
+ config.bundleAll = options?.bundleAll ?? DEFAULT_OPTIONS.bundleAll;
29
22
 
30
23
  async function result(output) {
31
24
  try {
@@ -47,7 +40,11 @@ export default function ForgeCSS(options) {
47
40
  await writeFile(output, `/* ForgeCSS auto-generated file */\n${css}`, "utf-8");
48
41
  }
49
42
  if (config.verbose) {
50
- console.log("forgecss: Output CSS generated successfully.");
43
+ console.log("forgecss: output CSS generated successfully.");
44
+ }
45
+ if (config.bundleAll) {
46
+ const inventoryCSS = getAllCSS();
47
+ return inventoryCSS + "\n" + css;
51
48
  }
52
49
  return css;
53
50
  } catch (err) {
@@ -83,7 +80,7 @@ export default function ForgeCSS(options) {
83
80
  // filling the inventory
84
81
  let files = await getAllFiles(dir, config.inventoryFiles);
85
82
  for (let file of files) {
86
- await extractStyles(file);
83
+ extractStyles(file, await readFileContent(file));
87
84
  }
88
85
  } catch (err) {
89
86
  console.error(`forgecss: error extracting styles.`, err);
@@ -92,7 +89,7 @@ export default function ForgeCSS(options) {
92
89
  try {
93
90
  let files = await getAllFiles(dir, config.usageFiles);
94
91
  for (let file of files) {
95
- await findUsages(file);
92
+ await findUsages(file, await readFileContent(file), JSXParser);
96
93
  }
97
94
  } catch (err) {
98
95
  console.error(`forgecss: error extracting usages`, err);
@@ -111,7 +108,7 @@ export default function ForgeCSS(options) {
111
108
  // filling the inventory
112
109
  try {
113
110
  if (config.inventoryFiles.includes(ext)) {
114
- await extractStyles(file);
111
+ extractStyles(file, await readFileContent(file));
115
112
  }
116
113
  } catch (err) {
117
114
  console.error(`forgecss: error extracting styles.`, err);
@@ -120,7 +117,7 @@ export default function ForgeCSS(options) {
120
117
  try {
121
118
  if (config.usageFiles.includes(ext)) {
122
119
  invalidateUsageCache(file);
123
- await findUsages(file);
120
+ await findUsages(file, await readFileContent(file), JSXParser);
124
121
  }
125
122
  } catch (err) {
126
123
  console.error(`forgecss: error extracting usages.`, err);
@@ -142,7 +139,7 @@ export default function ForgeCSS(options) {
142
139
  invalidateUsageCache();
143
140
  // filling the inventory
144
141
  try {
145
- await extractStyles("styles.css", css);
142
+ extractStyles("styles.css", css);
146
143
  } catch (err) {
147
144
  console.error(`forgecss: error extracting styles.`, err);
148
145
  }
@@ -151,7 +148,7 @@ export default function ForgeCSS(options) {
151
148
  if (html) {
152
149
  await findUsages("usage.html", html);
153
150
  } else if (jsx) {
154
- await findUsages("usage.jsx", jsx);
151
+ await findUsages("usage.jsx", jsx, JSXParser);
155
152
  }
156
153
  } catch (err) {
157
154
  console.error(`forgecss: error extracting usages.`, err);
@@ -0,0 +1,9 @@
1
+ export const DEFAULT_OPTIONS = {
2
+ inventoryFiles: ["css", "less", "scss"],
3
+ usageFiles: ["html", "jsx", "tsx"],
4
+ usageAttributes: ["class", "className"],
5
+ breakpoints: {},
6
+ verbose: true,
7
+ minify: true,
8
+ bundleAll: false
9
+ };
package/lib/helpers.js CHANGED
@@ -1,6 +1,10 @@
1
+ import swc from "@swc/core";
1
2
  import fs from "fs/promises";
2
3
  import path from "path";
3
4
 
5
+ const FUNC_NAME = "fx";
6
+ const { parse } = swc;
7
+
4
8
  export async function getAllFiles(dir, matchFiles) {
5
9
  const result = [];
6
10
  const stack = [dir];
@@ -28,3 +32,65 @@ export async function getAllFiles(dir, matchFiles) {
28
32
 
29
33
  return result;
30
34
  }
35
+ export function readFileContent(filePath) {
36
+ return fs.readFile(filePath, "utf-8");
37
+ }
38
+ export async function JSXParser(content, USAGES, filePath) {
39
+ const ast = await parse(content, {
40
+ syntax: "typescript",
41
+ tsx: true,
42
+ decorators: false
43
+ });
44
+ function traverseASTNode(node, visitors, stack = []) {
45
+ if (!node || typeof node.type !== "string") {
46
+ return;
47
+ }
48
+
49
+ const visitor = visitors[node.type];
50
+ if (visitor) {
51
+ visitor(node, stack);
52
+ }
53
+
54
+ for (const key in node) {
55
+ if (!node.hasOwnProperty(key)) continue;
56
+
57
+ const child = node[key];
58
+
59
+ if (Array.isArray(child)) {
60
+ child.forEach((c) => {
61
+ if (c) {
62
+ if (typeof c.type === "string") {
63
+ traverseASTNode(c, visitors, [node].concat(stack));
64
+ } else if (c?.expression && typeof c.expression.type === "string") {
65
+ traverseASTNode(c.expression, visitors, [node].concat(stack));
66
+ } else if (c?.callee && typeof c.callee.type === "string") {
67
+ traverseASTNode(c.callee, visitors, [node].concat(stack));
68
+ } else if (c?.left && typeof c.left.type === "string") {
69
+ traverseASTNode(c.left, visitors, [node].concat(stack));
70
+ } else if (c?.right && typeof c.right.type === "string") {
71
+ traverseASTNode(c.right, visitors, [node].concat(stack));
72
+ }
73
+ }
74
+ });
75
+ } else if (child && typeof child.type === "string") {
76
+ traverseASTNode(child, visitors, [node].concat(stack));
77
+ }
78
+ }
79
+ }
80
+
81
+ traverseASTNode(ast, {
82
+ JSXExpressionContainer(node) {
83
+ if (node?.expression?.callee?.value === FUNC_NAME && node?.expression?.arguments) {
84
+ if (node?.expression?.arguments[0]) {
85
+ const arg = node.expression.arguments[0];
86
+ let value = arg?.expression.value;
87
+ if (arg.expression.type === "TemplateLiteral") {
88
+ let quasis = arg.expression.quasis.map((elem) => elem?.cooked || "");
89
+ value = quasis.join("");
90
+ }
91
+ USAGES[filePath].push(value);
92
+ }
93
+ }
94
+ }
95
+ });
96
+ }
package/lib/inventory.js CHANGED
@@ -1,11 +1,9 @@
1
- import { readFile } from "fs/promises";
2
1
  import postcss from "postcss";
3
2
  import safeParser from "postcss-safe-parser";
4
3
 
5
4
  let INVENTORY = {};
6
5
 
7
- export async function extractStyles(filePath, css = null) {
8
- const content = css !== null ? css : await readFile(filePath, "utf-8");
6
+ export function extractStyles(filePath, content) {
9
7
  INVENTORY[filePath] = postcss.parse(content, { parser: safeParser });
10
8
  }
11
9
  export function getStylesByClassName(selector) {
@@ -64,3 +62,13 @@ export function resolveApplys() {
64
62
  });
65
63
  return resolvedApplies;
66
64
  }
65
+ export function getInventory() {
66
+ return INVENTORY;
67
+ }
68
+ export function getAllCSS() {
69
+ let combined = "";
70
+ Object.keys(INVENTORY).forEach((filePath) => {
71
+ combined += INVENTORY[filePath].toString() + "\n";
72
+ });
73
+ return combined;
74
+ }