@projectwallace/css-analyzer 5.5.0 → 5.7.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.
package/dist/analyzer.cjs CHANGED
@@ -1,2 +1,2 @@
1
- var e=require("css-tree/parser"),t=require("css-tree/walker");function r(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var n=/*#__PURE__*/r(e),i=/*#__PURE__*/r(t);function a(e,t){return t>=65&&t<=90&&(t|=32),e===t}function o(e,t){var r=t.length-e.length;if(r<0)return!1;for(var n=t.length-1;n>=r;n--)if(!1===a(e.charCodeAt(n-r),t.charCodeAt(n)))return!1;return!0}function s(e,t){if(t.length<e.length)return!1;for(var r=0;r<e.length;r++)if(!1===a(e.charCodeAt(r),t.charCodeAt(r)))return!1;return!0}function u(e,t){return e[0]===t[0]?e[1]===t[1]?t[2]-e[2]:t[1]-e[1]:t[0]-e[0]}var l=function(e){var t=0,r=0,n=0,a=0,o=!1;return i.default(e,function(e){switch(e.type){case"IdSelector":t++,a++;break;case"ClassSelector":r++,a++;break;case"AttributeSelector":r++,a++,Boolean(e.value)&&a++,o="role"===e.name.name||s("aria-",e.name.name);break;case"PseudoElementSelector":case"TypeSelector":if(a++,42===e.name.charCodeAt(0)&&1===e.name.length)break;n++;break;case"PseudoClassSelector":switch(e.name){case"before":case"after":case"first-letter":case"first-line":return n++,a++,this.skip;case"where":case"is":case"has":case"matches":case"-webkit-any":case"-moz-any":case"not":case"nth-child":case"nth-last-child":"nth-child"!==e.name&&"nth-last-child"!==e.name||r++;var c=(m=[],i.default(e,{visit:"Selector",enter:function(e){m.push(l(e))}}),m.sort(function(e,t){return u(e.specificity,t.specificity)}));if(0===c.length)return;if("where"!==e.name){var f=c[0].specificity;t+=f[0],r+=f[1],n+=f[2]}for(var d=0;d<c.length;d++){var h=c[d];h.isA11y&&(o=!0),a+=h.complexity}return a++,this.skip;default:return a++,r++,this.skip}case"Combinator":a++}var m}),{specificity:[t,r,n],complexity:a,isId:t>0,isA11y:o}},c={aliceblue:1,antiquewhite:1,aqua:1,aquamarine:1,azure:1,beige:1,bisque:1,black:1,blanchedalmond:1,blue:1,blueviolet:1,brown:1,burlywood:1,cadetblue:1,chartreuse:1,chocolate:1,coral:1,cornflowerblue:1,cornsilk:1,crimson:1,cyan:1,darkblue:1,darkcyan:1,darkgoldenrod:1,darkgray:1,darkgreen:1,darkgrey:1,darkkhaki:1,darkmagenta:1,darkolivegreen:1,darkorange:1,darkorchid:1,darkred:1,darksalmon:1,darkseagreen:1,darkslateblue:1,darkslategray:1,darkslategrey:1,darkturquoise:1,darkviolet:1,deeppink:1,deepskyblue:1,dimgray:1,dimgrey:1,dodgerblue:1,firebrick:1,floralwhite:1,forestgreen:1,fuchsia:1,gainsboro:1,ghostwhite:1,gold:1,goldenrod:1,gray:1,green:1,greenyellow:1,grey:1,honeydew:1,hotpink:1,indianred:1,indigo:1,ivory:1,khaki:1,lavender:1,lavenderblush:1,lawngreen:1,lemonchiffon:1,lightblue:1,lightcoral:1,lightcyan:1,lightgoldenrodyellow:1,lightgray:1,lightgreen:1,lightgrey:1,lightpink:1,lightsalmon:1,lightseagreen:1,lightskyblue:1,lightslategray:1,lightslategrey:1,lightsteelblue:1,lightyellow:1,lime:1,limegreen:1,linen:1,magenta:1,maroon:1,mediumaquamarine:1,mediumblue:1,mediumorchid:1,mediumpurple:1,mediumseagreen:1,mediumslateblue:1,mediumspringgreen:1,mediumturquoise:1,mediumvioletred:1,midnightblue:1,mintcream:1,mistyrose:1,moccasin:1,navajowhite:1,navy:1,oldlace:1,olive:1,olivedrab:1,orange:1,orangered:1,orchid:1,palegoldenrod:1,palegreen:1,paleturquoise:1,palevioletred:1,papayawhip:1,peachpuff:1,peru:1,pink:1,plum:1,powderblue:1,purple:1,rebeccapurple:1,red:1,rosybrown:1,royalblue:1,saddlebrown:1,salmon:1,sandybrown:1,seagreen:1,seashell:1,sienna:1,silver:1,skyblue:1,slateblue:1,slategray:1,slategrey:1,snow:1,springgreen:1,steelblue:1,tan:1,teal:1,thistle:1,tomato:1,turquoise:1,violet:1,wheat:1,white:1,whitesmoke:1,yellow:1,yellowgreen:1,canvas:1,canvastext:1,linktext:1,visitedtext:1,activetext:1,buttonface:1,buttontext:1,buttonborder:1,field:1,fieldtext:1,highlight:1,highlighttext:1,selecteditem:1,selecteditemtext:1,mark:1,marktext:1,graytext:1},f={rgb:1,rgba:1,hsl:1,hsla:1,hwb:1,lab:1,lch:1,oklab:1,oklch:1,color:1},d={inherit:1,initial:1,unset:1,revert:1,caption:1,icon:1,menu:1,"message-box":1,"small-caption":1,"status-bar":1},h={normal:1,"xx-small":1,"x-small":1,small:1,medium:1,large:1,"x-large":1,"xx-large":1,larger:1,smaller:1,bold:1,bolder:1,lighter:1,"ultra-condensed":1,"extra-condensed":1,condensed:1,"semi-condensed":1,"semi-expanded":1,expanded:1,"extra-expanded":1,"ultra-expanded":1,italic:1,oblique:1};function m(e){var t=e.children.first;return"Identifier"===t.type&&d[t.name]}var b={"xx-small":1,"x-small":1,small:1,medium:1,large:1,"x-large":1,"xx-large":1,larger:1,smaller:1},v={inherit:1,initial:1,unset:1,revert:1,caption:1,icon:1,menu:1,"message-box":1,"small-caption":1,"status-bar":1};function g(e){var t=e.children.first;return"Identifier"===t.type&&v[t.name]}var w={auto:1,inherit:1,initial:1,unset:1,revert:1,none:1};function k(e){if(!e.children)return!1;var t=e.children.first;return!!t&&!(e.children.size>1)&&"Identifier"===t.type&&w[t.name]}var p={linear:1,ease:1,"ease-in":1,"ease-out":1,"ease-in-out":1,"step-start":1,"step-end":1};function y(e){return 45===e.charCodeAt(0)&&45!==e.charCodeAt(1)&&-1!==e.indexOf("-",2)}function x(e){if(!e.children)return!1;for(var t=e.children.toArray(),r=0;r<t.length;r++){var n=t[r],i=n.type,a=n.name;if("Identifier"===i&&y(a))return!0;if("Function"===i){if(y(a))return!0;if(x(n))return!0}}return!1}var q=/*#__PURE__*/function(){function e(e){if(this.t={},this.i=0,this.o=0,e)for(var t=0;t<e.length;t++)this.push(e[t])}var t=e.prototype;return t.push=function(e){this.i++,this.t[e]?this.t[e]++:(this.t[e]=1,this.o++)},t.size=function(){return this.i},t.count=function(){return{total:this.i,totalUnique:this.o,unique:this.t,uniquenessRatio:0===this.i?0:this.o/this.i}},e}(),z=/*#__PURE__*/function(){function e(){this.u=new q,this.l={}}var t=e.prototype;return t.push=function(e,t){this.u.push(e),this.l[t]||(this.l[t]=new q),this.l[t].push(e)},t.count=function(){var e={};for(var t in this.l)e[t]=this.l[t].count();return Object.assign(this.u.count(),{itemsPerContext:e})},e}(),S=/*#__PURE__*/function(){function e(){this.t=[]}var t=e.prototype;return t.add=function(e){this.t.push(e)},t.size=function(){return this.t.length},t.aggregate=function(){if(0===this.t.length)return{min:0,max:0,mean:0,mode:0,median:0,range:0,sum:0};var e,t,r,n=this.t.slice().sort(function(e,t){return e-t}),i=n[0],a=n[n.length-1],o=this.t.reduce(function(e,t){return e+t}),s=function(e){for(var t=Object.create(null),r=-1,n=0,i=0,a=0;a<e.length;a++){var o=e[a],s=(t[o]||0)+1;t[o]=s,s>r&&(r=s,n=0,i=0),s>=r&&(n++,i+=o)}return i/n}(this.t),u=(t=(e=n).length/2)!==(r=Math.floor(t))?e[r]:(e[r]+e[r-1])/2;return{min:i,max:a,mean:o/this.t.length,mode:s,median:u,range:a-i,sum:o}},t.toArray=function(){return this.t},e}();function O(e){return!(e.length<3)&&45===e.charCodeAt(0)&&45===e.charCodeAt(1)}function I(e,t){return!O(t)&&o(e,t)}var C=/*#__PURE__*/function(){function e(){this.t=Object.create(null)}var t=e.prototype;return t.push=function(e){return this.t[e]?this.t[e]++:this.t[e]=1},t.count=function(){return Object.keys(this.t).length},e}();exports.analyze=function(e){var t=new Date,r=e.split(/\r?\n/);function d(e){var t=e.loc.start,n=e.loc.end;if(0==n.line-t.line)return r[t.line-1].substring(t.column-1,n.column-1);for(var i="",a=t.line;a<=n.line;a++){var o=r[a-1];i+=a!==t.line?a!==n.line?o+"\n":o.substring(0,n.column-1):o.substring(t.column-1)+"\n"}return i}var v,w,D=0,j=0,R=new q,U=new Date,F=n.default(e,{parseAtrulePrelude:!1,parseCustomProperty:!0,positions:!0,onComment:function(e){D++,j+=e.length}}),P=new Date,A=0,_=[],T=new q,B=new q,E=new q,H=new q,K=new q,L=new q,M=new q,N=new q,V=0,G=0,J=new S,Q=new S,W=new S,X=new q,Y=new C,Z=new S,$=new S,ee=new S,te=new q,re=new S,ne=[],ie=new q,ae=new q,oe=new C,se=0,ue=0,le=0,ce=new q,fe=new q,de=new q,he=new q,me=new q,be=new q,ve=new q,ge=new q,we=new q,ke=new q,pe=new q,ye=new q,xe=new z,qe=new z;i.default(F,function(e){switch(e.type){case"Atrule":A++;var t=e.name;if("font-face"===t){var r={};e.block.children.forEach(function(e){return r[e.property]=d(e.value)}),_.push(r);break}if("media"===t){E.push(e.prelude.value);break}if("supports"===t){K.push(e.prelude.value);break}if(o("keyframes",t)){var n="@"+t+" "+e.prelude.value;y(t)&&M.push(n),L.push(n);break}if("import"===t){B.push(e.prelude.value);break}if("charset"===t){H.push(e.prelude.value);break}if("container"===t){N.push(e.prelude.value);break}"layer"===t&&N.push(e.prelude.value.trim().split(",").map(function(e){return e.trim()}).forEach(function(e){return T.push(e)}));break;case"Rule":var q=e.prelude.children?e.prelude.children.size:0,z=e.block.children?e.block.children.size:0;J.add(q+z),Q.add(q),W.add(z),V++,0===z&&G++;break;case"Selector":var S=d(e);if(this.atrule&&o("keyframes",this.atrule.name))return X.push(S),this.skip;var C=l(e),D=C.specificity,j=C.complexity,U=C.isA11y;return C.isId&&ie.push(S),U&&ae.push(S),Y.push(S),re.add(j),te.push(D),void 0===v&&(v=D),void 0===w&&(w=D),Z.add(D[0]),$.add(D[1]),ee.add(D[2]),void 0!==w&&u(w,D)<0&&(w=D),void 0!==v&&u(v,D)>0&&(v=D),ne.push(D),this.skip;case"Dimension":if(!this.declaration)break;return qe.push(e.unit,this.declaration.property),this.skip;case"Url":s("data:",e.value)&&R.push(e.value);break;case"Value":if(k(e))break;var F=this.declaration.property;if(x(e)&&me.push(d(e)),I("z-index",F))return k(e)||be.push(d(e)),this.skip;if(I("font",F)){if(m(e)||we.push(function(e,t){var r="";return i.default(e,{reverse:!0,enter:function(e){if("String"===e.type){var n=e.loc.start,i=t({loc:{start:{line:n.line,column:n.column},end:{line:n.line,column:n.column+1}}});return r=i+e.value+i+r}return"Operator"===e.type&&44===e.value.charCodeAt(0)?r=e.value+r:"Identifier"===e.type?h[e.name]?this.skip:r=e.name+r:void 0}}),r}(e,d)),!g(e)){var P=function(e){var t,r=!1;return i.default(e,function(e){switch(e.type){case"Number":if(48===e.value.charCodeAt(0))return t="0",this.break;case"Operator":47===e.value.charCodeAt(0)&&(r=!0);break;case"Dimension":if(!r)return t=e.value+e.unit,this.break;case"Identifier":if(b[e.name])return t=e.name,this.break}}),t}(e);P&&ke.push(P)}break}if(I("font-size",F)){g(e)||ke.push(d(e));break}if(I("font-family",F)){m(e)||we.push(d(e));break}if(I("transition",F)||I("animation",F)){for(var ze=function(e,t){var r=!1,n=[],i=[];return e.forEach(function(e){return"Operator"===e.type?r=!1:"Dimension"===e.type&&!1===r?(r=!0,n.push(t(e))):"Identifier"===e.type&&p[e.name]?i.push(t(e)):"Function"!==e.type||"cubic-bezier"!==e.name&&"steps"!==e.name?void 0:i.push(t(e))}),[n,i]}(e.children,d),Se=ze[0],Oe=ze[1],Ie=0;Ie<Se.length;Ie++)ye.push(Se[Ie]);for(var Ce=0;Ce<Oe.length;Ce++)pe.push(Oe[Ce]);break}if(I("animation-duration",F)||I("transition-duration",F)){ye.push(d(e));break}if(I("transition-timing-function",F)||I("animation-timing-function",F)){pe.push(d(e));break}I("text-shadow",F)?k(e)||ve.push(d(e)):I("box-shadow",F)&&(k(e)||ge.push(d(e))),i.default(e,function(e){switch(e.type){case"Hash":return xe.push("#"+e.value,F),this.skip;case"Identifier":var t=e.name;return t.length>20||t.length<3||c[t.toLowerCase()]&&xe.push(d(e),F),this.skip;case"Function":if(function(e,t){if(e.length!==t.length)return!1;for(var r=0;r<e.length;r++)if(!1===a(e.charCodeAt(r),t.charCodeAt(r)))return!1;return!0}("var",e.name))return this.skip;f[e.name.toLowerCase()]&&xe.push(d(e),F)}});break;case"Declaration":se++;var De=d(e);oe.push(De),e.important&&(ue++,this.atrule&&o("keyframes",this.atrule.name)&&le++);var je=e.property;ce.push(je),y(je)?de.push(je):function(e){if(O(e)||y(e))return!1;var t=e.charCodeAt(0);return 47===t||95===t||43===t||42===t||38===t||36===t||35===t}(je)?fe.push(je):O(je)&&he.push(je)}});var ze=R.count(),Se=Object.keys(ze.unique).join("").length,Oe=oe.count(),Ie=re.size(),Ce=Z.aggregate(),De=$.aggregate(),je=ee.aggregate(),Re=te.count(),Ue=new q(re.toArray()).count(),Fe=Y.count(),Pe=new q(J.toArray()).count(),Ae=new q(Q.toArray()).count(),_e=new q(W.toArray()).count(),Te=Object.assign;return{stylesheet:{sourceLinesOfCode:A+Ie+se+X.size(),linesOfCode:r.length,size:e.length,comments:{total:D,size:j},embeddedContent:Te(ze,{size:{total:Se,ratio:0===e.length?0:Se/e.length}})},atrules:{fontface:{total:_.length,totalUnique:_.length,unique:_,uniquenessRatio:0===_.length?0:1},import:B.count(),media:E.count(),charset:H.count(),supports:K.count(),keyframes:Te(L.count(),{prefixed:Te(M.count(),{ratio:0===L.size()?0:M.size()/L.size()})}),container:N.count(),layer:T.count()},rules:{total:V,empty:{total:G,ratio:0===V?0:G/V},sizes:Te(J.aggregate(),{items:J.toArray(),unique:Pe.unique,totalUnique:Pe.totalUnique,uniquenessRatio:Pe.uniquenessRatio}),selectors:Te(Q.aggregate(),{items:Q.toArray(),unique:Ae.unique,totalUnique:Ae.totalUnique,uniquenessRatio:Ae.uniquenessRatio}),declarations:Te(W.aggregate(),{items:W.toArray(),unique:_e.unique,totalUnique:_e.totalUnique,uniquenessRatio:_e.uniquenessRatio})},selectors:{total:Ie,totalUnique:Fe,uniquenessRatio:0===Ie?0:Fe/Ie,specificity:{min:void 0===w?[0,0,0]:w,max:void 0===v?[0,0,0]:v,sum:[Ce.sum,De.sum,je.sum],mean:[Ce.mean,De.mean,je.mean],mode:[Ce.mode,De.mode,je.mode],median:[Ce.median,De.median,je.median],items:ne,unique:Re.unique,totalUnique:Re.totalUnique,uniquenessRatio:Re.uniquenessRatio},complexity:Te(re.aggregate(),Ue,{items:re.toArray()}),id:Te(ie.count(),{ratio:0===Ie?0:ie.size()/Ie}),accessibility:Te(ae.count(),{ratio:0===Ie?0:ae.size()/Ie}),keyframes:X.count()},declarations:{total:se,unique:{total:Oe,ratio:0===se?0:Oe/se},importants:{total:ue,ratio:0===se?0:ue/se,inKeyframes:{total:le,ratio:0===ue?0:le/ue}}},properties:Te(ce.count(),{prefixed:Te(de.count(),{ratio:0===ce.size()?0:de.size()/ce.size()}),custom:Te(he.count(),{ratio:0===ce.size()?0:he.size()/ce.size()}),browserhacks:Te(fe.count(),{ratio:0===ce.size()?0:fe.size()/ce.size()})}),values:{colors:xe.count(),fontFamilies:we.count(),fontSizes:ke.count(),zindexes:be.count(),textShadows:ve.count(),boxShadows:ge.count(),animations:{durations:ye.count(),timingFunctions:pe.count()},prefixes:me.count(),units:qe.count()},__meta__:{parseTime:P-U,analyzeTime:new Date-P,total:new Date-t}}},exports.compareSpecificity=u;
1
+ var e=require("css-tree/parser"),t=require("css-tree/walker"),r=require("@bramus/specificity/core");function n(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var i=/*#__PURE__*/n(e),a=/*#__PURE__*/n(t);function o(e,t){return t>=65&&t<=90&&(t|=32),e===t}function s(e,t){if(e.length!==t.length)return!1;for(var r=0;r<e.length;r++)if(!1===o(e.charCodeAt(r),t.charCodeAt(r)))return!1;return!0}function u(e,t){var r=t.length-e.length;if(r<0)return!1;for(var n=t.length-1;n>=r;n--)if(!1===o(e.charCodeAt(n-r),t.charCodeAt(n)))return!1;return!0}function l(e,t){if(t.length<e.length)return!1;for(var r=0;r<e.length;r++)if(!1===o(e.charCodeAt(r),t.charCodeAt(r)))return!1;return!0}function c(e,t,r){return s(t,e.property)&&"Identifier"===e.value.children.first.type&&s(r,e.value.children.first.name)}function f(e){return 45===e.charCodeAt(0)&&45!==e.charCodeAt(1)&&-1!==e.indexOf("-",2)}function d(e,t){return e[0]===t[0]?e[1]===t[1]?t[2]-e[2]:t[1]-e[1]:t[0]-e[0]}function h(e,t){var r=[];return a.default(e,{visit:"Selector",enter:function(e){r.push(t(e))}}),r}function m(e){return s(e,"not")||s(e,"nth-child")||s(e,"nth-last-child")||s(e,"where")||s(e,"is")||s(e,"has")||s(e,"matches")||s(e,"-webkit-any")||s(e,"-moz-any")}function w(e){var t=!1;return a.default(e,function(e){if("AttributeSelector"==e.type){if(s("role",e.name.name)||l("aria-",e.name.name))return t=!0,this.break}else if("PseudoClassSelector"==e.type&&m(e.name)){var r=h(e,w);if(0===r.length)return;return r.some(function(e){return 1==e})?(t=!0,this.skip):this.skip}}),t}function v(e){var t=0;return a.default(e,function(e){if("Selector"!=e.type&&"Nth"!=e.type){if(t++,"IdSelector"!=e.type&&"ClassSelector"!=e.type&&"PseudoElementSelector"!=e.type&&"TypeSelector"!=e.type&&"PseudoClassSelector"!=e.type||f(e.name)&&t++,"AttributeSelector"==e.type)return Boolean(e.value)&&t++,f(e.name.name)&&t++,this.skip;if("PseudoClassSelector"==e.type&&m(e.name)){var r=h(e,v);if(0===r.length)return;return r.forEach(function(e){return t+=e}),this.skip}}}),t}var b=new Set(["aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkgrey","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkslategrey","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dimgrey","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","green","greenyellow","grey","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgreen","lightgrey","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightslategrey","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","rebeccapurple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","slategrey","snow","springgreen","steelblue","tan","teal","thistle","tomato","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen"]),g=new Set(["canvas","canvastext","linktext","visitedtext","activetext","buttonface","buttontext","buttonborder","field","fieldtext","highlight","highlighttext","selecteditem","selecteditemtext","mark","marktext","graytext"]),p=new Set(["rgb","rgba","hsl","hsla","hwb","lab","lch","oklab","oklch","color"]),k=new Set(["currentcolor","transparent"]),y=new Set(["inherit","initial","unset","revert","caption","icon","menu","message-box","small-caption","status-bar"]),x=new Set(["normal","xx-small","x-small","small","medium","large","x-large","xx-large","larger","smaller","bold","bolder","lighter","ultra-condensed","extra-condensed","condensed","semi-condensed","semi-expanded","expanded","extra-expanded","ultra-expanded","italic","oblique"]);function q(e){var t=e.children.first;return"Identifier"===t.type&&y.has(t.name)}var S=new Set(["xx-small","x-small","small","medium","large","x-large","xx-large","larger","smaller"]),z=new Set(["inherit","initial","unset","revert","caption","icon","menu","message-box","small-caption","status-bar"]);function I(e){var t=e.children.first;return"Identifier"===t.type&&z.has(t.name)}var R=new Set(["auto","inherit","initial","unset","revert","none"]);function C(e){if(!e.children)return!1;var t=e.children.first;return!!t&&!(e.children.size>1)&&"Identifier"===t.type&&R.has(t.name)}var D=new Set(["linear","ease","ease-in","ease-out","ease-in-out","step-start","step-end"]);function U(e){if(!e.children)return!1;for(var t=e.children.toArray(),r=0;r<t.length;r++){var n=t[r],i=n.type,a=n.name;if("Identifier"===i&&f(a))return!0;if("Function"===i){if(f(a))return!0;if(U(n))return!0}}return!1}var O=/*#__PURE__*/function(){function e(e){if(this.t={},this.i=0,this.o=0,e)for(var t=0;t<e.length;t++)this.push(e[t])}var t=e.prototype;return t.push=function(e){this.i++,this.t[e]?this.t[e]++:(this.t[e]=1,this.o++)},t.size=function(){return this.i},t.count=function(){return{total:this.i,totalUnique:this.o,unique:this.t,uniquenessRatio:0===this.i?0:this.o/this.i}},e}(),j=/*#__PURE__*/function(){function e(){this.u=new O,this.l={}}var t=e.prototype;return t.push=function(e,t){this.u.push(e),this.l[t]||(this.l[t]=new O),this.l[t].push(e)},t.count=function(){var e={};for(var t in this.l)e[t]=this.l[t].count();return Object.assign(this.u.count(),{itemsPerContext:e})},e}(),F=/*#__PURE__*/function(){function e(){this.t=[]}var t=e.prototype;return t.push=function(e){this.t.push(e)},t.size=function(){return this.t.length},t.aggregate=function(){if(0===this.t.length)return{min:0,max:0,mean:0,mode:0,median:0,range:0,sum:0};var e,t,r,n=this.t.slice().sort(function(e,t){return e-t}),i=n[0],a=n[n.length-1],o=this.t.reduce(function(e,t){return e+t}),s=function(e){for(var t=Object.create(null),r=-1,n=0,i=0,a=0;a<e.length;a++){var o=e[a],s=(t[o]||0)+1;t[o]=s,s>r&&(r=s,n=0,i=0),s>=r&&(n++,i+=o)}return i/n}(this.t),u=(t=(e=n).length/2)!==(r=Math.floor(t))?e[r]:(e[r]+e[r-1])/2;return{min:i,max:a,mean:o/this.t.length,mode:s,median:u,range:a-i,sum:o}},t.toArray=function(){return this.t},e}();function P(e){return!(e.length<3)&&45===e.charCodeAt(0)&&45===e.charCodeAt(1)}function _(e,t){return!P(t)&&u(e,t)}function A(e,t){return 0===t?0:e/t}exports.analyze=function(e){var t=Date.now(),n=e.split(/\r?\n/g);function o(t){return e.substring(t.loc.start.offset,t.loc.end.offset)}var h,m,y=0,z=0,R=new O,M={total:0,totalUnique:0,uniquenessRatio:0,unique:{}},T=Date.now(),N=i.default(e,{parseCustomProperty:!0,positions:!0,onComment:function(e){y++,z+=e.length}}),B=Date.now(),E=0,H=[],K=new O,L=new O,Q=new O,V=new O,G=new O,J=new O,W=new O,X=new O,Y=new O,Z=new O,$=0,ee=0,te=new F,re=new F,ne=new F,ie=new O,ae=new Set,oe=new F,se=new F,ue=new F,le=new O,ce=new F,fe=[],de=new O,he=new O,me=new Set,we=0,ve=0,be=0,ge=new O,pe=new O,ke=new O,ye=new O,xe=new O,qe=new F,Se=new O,ze=new O,Ie=new O,Re=new O,Ce=new O,De=new O,Ue=new O,Oe=new O,je=new O,Fe=new j,Pe=new O,_e=new j;a.default(N,function(e){switch(e.type){case"Atrule":E++;var t=e.name;if("font-face"===t){var n={};e.block.children.forEach(function(e){return n[e.property]=o(e.value)}),H.push(n);break}if("media"===t){var i=o(e.prelude).trim();Q.push(i),function(e){var t=!1;return a.default(e,function(e){if("MediaQuery"===e.type&&1===e.children.size&&"Identifier"===e.children.first.type&&(l("\\0",(e=e.children.first).name)||u("\\9 ",e.name)))return t=!0,this.break;if("MediaFeature"===e.type){if(null!==e.value&&"\\0"===e.value.unit)return t=!0,this.break;if(s("-moz-images-in-menus",e.name)||s("min--moz-device-pixel-ratio",e.name)||s("-ms-high-contrast",e.name))return t=!0,this.break;if(s("min-resolution",e.name)&&s(".001",e.value.value)&&s("dpcm",e.value.unit))return t=!0,this.break;if(s("-webkit-min-device-pixel-ratio",e.name)&&(s("0",e.value.value)||s("10000",e.value.value)))return t=!0,this.break}}),t}(e.prelude)&&V.push(i);break}if("supports"===t){var y=o(e.prelude);J.push(y),function(e){var t=!1;return a.default(e,function(e){if("Declaration"===e.type&&(c(e,"-webkit-appearance","none")||c(e,"-moz-appearance","meterbar")))return t=!0,this.break}),t}(e.prelude)&&W.push(y);break}if(u("keyframes",t)){var z="@"+t+" "+o(e.prelude);f(t)&&Y.push(z),X.push(z);break}if("import"===t){L.push(o(e.prelude));break}if("charset"===t){G.push(o(e.prelude));break}if("container"===t){Z.push(o(e.prelude));break}"layer"===t&&o(e.prelude).trim().split(",").forEach(function(e){return K.push(e.trim())});break;case"Rule":var O=e.prelude.children?e.prelude.children.size:0,j=e.block.children?e.block.children.size:0;te.push(O+j),re.push(O),ne.push(j),$++,0===j&&ee++;break;case"Selector":var F=o(e);if(this.atrule&&u("keyframes",this.atrule.name))return ie.push(F),this.skip;var A=r.calculate(e)[0].value,T=[A.a,A.b,A.c];return T[0]>0&&de.push(F),w(e)&&he.push(F),ae.add(F),ce.push(v(e)),le.push(T),void 0===h&&(h=T),void 0===m&&(m=T),oe.push(T[0]),se.push(T[1]),ue.push(T[2]),void 0!==m&&d(m,T)<0&&(m=T),void 0!==h&&d(h,T)>0&&(h=T),fe.push(T),this.skip;case"Dimension":if(!this.declaration)break;return _e.push(e.unit,this.declaration.property),this.skip;case"Url":if(l("data:",e.value)){var N=e.value,B=N.length,Ae=function(e){var t=e.indexOf(";");if(-1===t){var r=e.indexOf(",");return e.substring(5,r)}return e.substring(5,t)}(N);M.total++,Ae in M.unique?(M.unique[Ae].count++,M.unique[Ae].size+=B):(M.totalUnique++,M.unique[Ae]={count:1,size:B}),R.push(N)}break;case"Value":if(C(e))break;var Me=this.declaration,Te=Me.property,Ne=Me.important;if(U(e)&&Se.push(o(e)),"string"==typeof Ne&&ze.push(o(e)+"!"+Ne),e.children&&e.children.last&&"Identifier"===e.children.last.type&&u("\\9",e.children.last.name)&&ze.push(o(e)),_("z-index",Te))return C(e)||Ie.push(o(e)),this.skip;if(_("font",Te)){if(q(e)||De.push(function(e,t){var r="";return a.default(e,{reverse:!0,enter:function(e){if("String"===e.type){var n=e.loc.start.offset,i=t({loc:{start:{offset:n},end:{offset:n+1}}});return r=i+e.value+i+r}return"Operator"===e.type&&44===e.value.charCodeAt(0)?r=e.value+r:"Identifier"===e.type?x.has(e.name)?this.skip:r=e.name+r:void 0}}),r}(e,o)),!I(e)){var Be=function(e){var t,r=!1;return a.default(e,function(e){switch(e.type){case"Number":if(48===e.value.charCodeAt(0))return t="0",this.break;case"Operator":47===e.value.charCodeAt(0)&&(r=!0);break;case"Dimension":if(!r)return t=e.value+e.unit,this.break;case"Identifier":if(S.has(e.name))return t=e.name,this.break}}),t}(e);Be&&Ue.push(Be)}break}if(_("font-size",Te)){I(e)||Ue.push(o(e));break}if(_("font-family",Te)){q(e)||De.push(o(e));break}if(_("transition",Te)||_("animation",Te)){for(var Ee=function(e,t){var r=!1,n=[],i=[];return e.forEach(function(e){return"Operator"===e.type?r=!1:"Dimension"===e.type&&!1===r?(r=!0,n.push(t(e))):"Identifier"===e.type&&D.has(e.name)?i.push(t(e)):"Function"!==e.type||"cubic-bezier"!==e.name&&"steps"!==e.name?void 0:i.push(t(e))}),[n,i]}(e.children,o),He=Ee[0],Ke=Ee[1],Le=0;Le<He.length;Le++)je.push(He[Le]);for(var Qe=0;Qe<Ke.length;Qe++)Oe.push(Ke[Qe]);break}if(_("animation-duration",Te)||_("transition-duration",Te)){je.push(o(e));break}if(_("transition-timing-function",Te)||_("animation-timing-function",Te)){Oe.push(o(e));break}_("text-shadow",Te)?C(e)||Re.push(o(e)):_("box-shadow",Te)&&(C(e)||Ce.push(o(e))),a.default(e,function(e){switch(e.type){case"Hash":var t=e.value.length;return Fe.push("#"+e.value,Te),Pe.push("hex"+t),this.skip;case"Identifier":var r=e.name;if(r.length>20||r.length<3)return this.skip;var n=o(e),i=r.toLowerCase();return b.has(i)?(Fe.push(n,Te),Pe.push("named")):k.has(i)?(Fe.push(n,Te),Pe.push(i)):g.has(i)&&(Fe.push(n,Te),Pe.push("system")),this.skip;case"Function":if(s("var",e.name))return this.skip;var a=e.name.toLowerCase(),u=o(e);p.has(a)&&(Fe.push(u,Te),Pe.push(a))}});break;case"Declaration":if(null!==this.atrulePrelude)return this.skip;we++,me.add(o(e)),!0===e.important&&(ve++,this.atrule&&u("keyframes",this.atrule.name)&&be++);var Ve=e.property;pe.push(Ve),f(Ve)?(ye.push(Ve),qe.push(2)):function(e){if(P(e)||f(e))return!1;var t=e.charCodeAt(0);return 47===t||95===t||43===t||42===t||38===t||36===t||35===t}(Ve)?(ke.push(Ve),qe.push(2)):P(Ve)?(xe.push(Ve),qe.push(2),!0===e.important&&ge.push(Ve)):qe.push(1)}});var Ae=R.count(),Me=Object.keys(Ae.unique).join("").length,Te=me.size,Ne=ce.size(),Be=oe.aggregate(),Ee=se.aggregate(),He=ue.aggregate(),Ke=le.count(),Le=new O(ce.toArray()).count(),Qe=ae.size,Ve=new O(te.toArray()).count(),Ge=new O(re.toArray()).count(),Je=new O(ne.toArray()).count(),We=Object.assign;return{stylesheet:{sourceLinesOfCode:E+Ne+we+ie.size(),linesOfCode:n.length,size:e.length,comments:{total:y,size:z},embeddedContent:We(Ae,{size:{total:Me,ratio:A(Me,e.length)},types:We(M,{uniquenessRatio:A(M.totalUnique,M.total)})})},atrules:{fontface:{total:H.length,totalUnique:H.length,unique:H,uniquenessRatio:0===H.length?0:1},import:L.count(),media:We(Q.count(),{browserhacks:V.count()}),charset:G.count(),supports:We(J.count(),{browserhacks:W.count()}),keyframes:We(X.count(),{prefixed:We(Y.count(),{ratio:A(Y.size(),X.size())})}),container:Z.count(),layer:K.count()},rules:{total:$,empty:{total:ee,ratio:A(ee,$)},sizes:We(te.aggregate(),{items:te.toArray(),unique:Ve.unique,totalUnique:Ve.totalUnique,uniquenessRatio:Ve.uniquenessRatio}),selectors:We(re.aggregate(),{items:re.toArray(),unique:Ge.unique,totalUnique:Ge.totalUnique,uniquenessRatio:Ge.uniquenessRatio}),declarations:We(ne.aggregate(),{items:ne.toArray(),unique:Je.unique,totalUnique:Je.totalUnique,uniquenessRatio:Je.uniquenessRatio})},selectors:{total:Ne,totalUnique:Qe,uniquenessRatio:A(Qe,Ne),specificity:{min:void 0===m?[0,0,0]:m,max:void 0===h?[0,0,0]:h,sum:[Be.sum,Ee.sum,He.sum],mean:[Be.mean,Ee.mean,He.mean],mode:[Be.mode,Ee.mode,He.mode],median:[Be.median,Ee.median,He.median],items:fe,unique:Ke.unique,totalUnique:Ke.totalUnique,uniquenessRatio:Ke.uniquenessRatio},complexity:We(ce.aggregate(),Le,{items:ce.toArray()}),id:We(de.count(),{ratio:A(de.size(),Ne)}),accessibility:We(he.count(),{ratio:A(he.size(),Ne)}),keyframes:ie.count()},declarations:{total:we,totalUnique:Te,uniquenessRatio:A(Te,we),unique:{total:Te,ratio:A(Te,we)},importants:{total:ve,ratio:A(ve,we),inKeyframes:{total:be,ratio:A(be,ve)}}},properties:We(pe.count(),{prefixed:We(ye.count(),{ratio:A(ye.size(),pe.size())}),custom:We(xe.count(),{ratio:A(xe.size(),pe.size()),importants:We(ge.count(),{ratio:A(ge.size(),xe.size())})}),browserhacks:We(ke.count(),{ratio:A(ke.size(),pe.size())}),complexity:qe.aggregate()}),values:{colors:We(Fe.count(),{formats:Pe.count()}),fontFamilies:De.count(),fontSizes:Ue.count(),zindexes:Ie.count(),textShadows:Re.count(),boxShadows:Ce.count(),animations:{durations:je.count(),timingFunctions:Oe.count()},prefixes:Se.count(),browserhacks:ze.count(),units:_e.count()},__meta__:{parseTime:B-T,analyzeTime:Date.now()-B,total:Date.now()-t}}},exports.compareSpecificity=d;
2
2
  //# sourceMappingURL=analyzer.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"analyzer.cjs","sources":["../src/string-utils.js","../src/selectors/specificity.js","../src/values/colors.js","../src/values/font-families.js","../src/values/font-sizes.js","../src/values/values.js","../src/values/animations.js","../src/vendor-prefix.js","../src/values/vendor-prefix.js","../src/countable-collection.js","../src/context-collection.js","../src/aggregate-collection.js","../src/properties/property-utils.js","../src/occurrence-counter.js","../src/index.js"],"sourcesContent":["/**\n * Case-insensitive compare two character codes\n * @param {string} charA\n * @param {string} charB\n * @see https://github.com/csstree/csstree/blob/41f276e8862d8223eeaa01a3d113ab70bb13d2d9/lib/tokenizer/utils.js#L22\n */\nfunction compareChar(referenceCode, testCode) {\n // if uppercase\n if (testCode >= 0x0041 && testCode <= 0x005A) {\n // shifting the 6th bit makes a letter lowercase\n testCode = testCode | 32\n }\n return referenceCode === testCode\n}\n\n/**\n * Case-insensitive string-comparison\n * @param {string} base\n * @param {string} test\n * @returns {boolean} true if the two strings are the same, false otherwise\n */\nexport function strEquals(base, test) {\n if (base.length !== test.length) return false\n\n for (let i = 0; i < base.length; i++) {\n if (compareChar(base.charCodeAt(i), test.charCodeAt(i)) === false) {\n return false\n }\n }\n\n return true\n}\n\n/**\n * Case-insensitive testing whether a string ends with a given substring\n * @param {string} base e.g. '-webkit-transform'\n * @param {string} cmp e.g. 'transform'\n * @returns {boolean} true if `test` ends with `base`, false otherwise\n */\nexport function endsWith(base, test) {\n const offset = test.length - base.length\n\n if (offset < 0) {\n return false\n }\n\n for (let i = test.length - 1; i >= offset; i--) {\n if (compareChar(base.charCodeAt(i - offset), test.charCodeAt(i)) === false) {\n return false\n }\n }\n\n return true\n}\n\n/**\n * Case-insensitive testing whether a string starts with a given substring\n * @param {string} base\n * @param {test} test\n * @returns {boolean} true if `test` starts with `base`, false otherwise\n */\nexport function startsWith(base, test) {\n if (test.length < base.length) return false\n\n for (let i = 0; i < base.length; i++) {\n if (compareChar(base.charCodeAt(i), test.charCodeAt(i)) === false) {\n return false\n }\n }\n\n return true\n}\n","import walk from 'css-tree/walker'\nimport { startsWith } from '../string-utils.js'\n\n/**\n * Compare specificity A to Specificity B\n * @param {[number,number,number]} a - Specificity A\n * @param {[number,number,number]} b - Specificity B\n * @returns {number} sortIndex - 0 when a==b, 1 when a<b, -1 when a>b\n */\nfunction compareSpecificity(a, b) {\n if (a[0] === b[0]) {\n if (a[1] === b[1]) {\n return b[2] - a[2]\n }\n\n return b[1] - a[1]\n }\n\n return b[0] - a[0]\n}\n\n/**\n *\n * @param {import('css-tree').SelectorList} selectorListAst\n * @returns {Selector} topSpecificitySelector\n */\nfunction selectorListSpecificities(selectorListAst) {\n const childSelectors = []\n walk(selectorListAst, {\n visit: 'Selector',\n enter(node) {\n childSelectors.push(analyzeSpecificity(node))\n }\n })\n\n return childSelectors.sort((a, b) => compareSpecificity(a.specificity, b.specificity))\n}\n\n/**\n * Get the Specificity for the AST of a Selector Node\n * @param {import('css-tree').Selector} ast - AST Node for a Selector\n * @return {Object}\n * @property {[number,number,number]} specificity\n * @property {number} complexity\n * @property {Boolean} isId\n * @property {Boolean} isA11y\n */\nconst analyzeSpecificity = (node) => {\n let A = 0\n let B = 0\n let C = 0\n let complexity = 0\n let isA11y = false\n\n walk(node, function (selector) {\n switch (selector.type) {\n case 'IdSelector': {\n A++\n complexity++\n break\n }\n case 'ClassSelector': {\n B++\n complexity++\n break\n }\n case 'AttributeSelector': {\n B++\n complexity++\n\n // Add 1 for [attr=value] (or any variation using *= $= ^= |= )\n if (Boolean(selector.value)) {\n complexity++\n }\n\n isA11y = selector.name.name === 'role' || startsWith('aria-', selector.name.name)\n break\n }\n case 'PseudoElementSelector':\n case 'TypeSelector': {\n complexity++\n\n // 42 === '*'.charCodeAt(0)\n if (selector.name.charCodeAt(0) === 42 && selector.name.length === 1) {\n break\n }\n\n C++\n break\n }\n case 'PseudoClassSelector': {\n switch (selector.name) {\n case 'before':\n case 'after':\n case 'first-letter':\n case 'first-line': {\n C++\n complexity++\n return this.skip\n }\n\n // The specificity of an :is(), :not(), or :has() pseudo-class is\n // replaced by the specificity of the most specific complex\n // selector in its selector list argument.\n case 'where':\n case 'is':\n case 'has':\n case 'matches':\n case '-webkit-any':\n case '-moz-any':\n case 'not':\n case 'nth-child':\n case 'nth-last-child': {\n // The specificity of an :nth-child() or :nth-last-child() selector\n // is the specificity of the pseudo class itself (counting as one\n // pseudo-class selector) plus the specificity of the most\n // specific complex selector in its selector list argument (if any).\n if (selector.name === 'nth-child' || selector.name === 'nth-last-child') {\n // +1 for the pseudo class itself\n B++\n }\n\n const selectorList = selectorListSpecificities(selector)\n\n // Bail out for empty/non-existent :nth-child() params\n if (selectorList.length === 0) return\n\n // The specificity of a :where() pseudo-class is replaced by zero,\n // but it does count towards complexity.\n if (selector.name !== 'where') {\n const [topA, topB, topC] = selectorList[0].specificity\n A += topA\n B += topB\n C += topC\n }\n\n for (let i = 0; i < selectorList.length; i++) {\n const listItem = selectorList[i]\n if (listItem.isA11y) {\n isA11y = true\n }\n complexity += listItem.complexity\n }\n\n complexity++\n return this.skip\n }\n\n default: {\n // Regular pseudo classes have specificity [0,1,0]\n complexity++\n B++\n return this.skip\n }\n }\n }\n case 'Combinator': {\n complexity++\n break\n }\n }\n })\n\n return {\n /** @type {[number,number,number]} */\n specificity: [A, B, C],\n complexity,\n isId: A > 0,\n isA11y\n }\n}\n\nexport {\n analyzeSpecificity,\n compareSpecificity,\n}","export const colorNames = {\n // CSS Named Colors\n // Spec: https://drafts.csswg.org/css-color/#named-colors\n aliceblue: 1,\n antiquewhite: 1,\n aqua: 1,\n aquamarine: 1,\n azure: 1,\n beige: 1,\n bisque: 1,\n black: 1,\n blanchedalmond: 1,\n blue: 1,\n blueviolet: 1,\n brown: 1,\n burlywood: 1,\n cadetblue: 1,\n chartreuse: 1,\n chocolate: 1,\n coral: 1,\n cornflowerblue: 1,\n cornsilk: 1,\n crimson: 1,\n cyan: 1,\n darkblue: 1,\n darkcyan: 1,\n darkgoldenrod: 1,\n darkgray: 1,\n darkgreen: 1,\n darkgrey: 1,\n darkkhaki: 1,\n darkmagenta: 1,\n darkolivegreen: 1,\n darkorange: 1,\n darkorchid: 1,\n darkred: 1,\n darksalmon: 1,\n darkseagreen: 1,\n darkslateblue: 1,\n darkslategray: 1,\n darkslategrey: 1,\n darkturquoise: 1,\n darkviolet: 1,\n deeppink: 1,\n deepskyblue: 1,\n dimgray: 1,\n dimgrey: 1,\n dodgerblue: 1,\n firebrick: 1,\n floralwhite: 1,\n forestgreen: 1,\n fuchsia: 1,\n gainsboro: 1,\n ghostwhite: 1,\n gold: 1,\n goldenrod: 1,\n gray: 1,\n green: 1,\n greenyellow: 1,\n grey: 1,\n honeydew: 1,\n hotpink: 1,\n indianred: 1,\n indigo: 1,\n ivory: 1,\n khaki: 1,\n lavender: 1,\n lavenderblush: 1,\n lawngreen: 1,\n lemonchiffon: 1,\n lightblue: 1,\n lightcoral: 1,\n lightcyan: 1,\n lightgoldenrodyellow: 1,\n lightgray: 1,\n lightgreen: 1,\n lightgrey: 1,\n lightpink: 1,\n lightsalmon: 1,\n lightseagreen: 1,\n lightskyblue: 1,\n lightslategray: 1,\n lightslategrey: 1,\n lightsteelblue: 1,\n lightyellow: 1,\n lime: 1,\n limegreen: 1,\n linen: 1,\n magenta: 1,\n maroon: 1,\n mediumaquamarine: 1,\n mediumblue: 1,\n mediumorchid: 1,\n mediumpurple: 1,\n mediumseagreen: 1,\n mediumslateblue: 1,\n mediumspringgreen: 1,\n mediumturquoise: 1,\n mediumvioletred: 1,\n midnightblue: 1,\n mintcream: 1,\n mistyrose: 1,\n moccasin: 1,\n navajowhite: 1,\n navy: 1,\n oldlace: 1,\n olive: 1,\n olivedrab: 1,\n orange: 1,\n orangered: 1,\n orchid: 1,\n palegoldenrod: 1,\n palegreen: 1,\n paleturquoise: 1,\n palevioletred: 1,\n papayawhip: 1,\n peachpuff: 1,\n peru: 1,\n pink: 1,\n plum: 1,\n powderblue: 1,\n purple: 1,\n rebeccapurple: 1,\n red: 1,\n rosybrown: 1,\n royalblue: 1,\n saddlebrown: 1,\n salmon: 1,\n sandybrown: 1,\n seagreen: 1,\n seashell: 1,\n sienna: 1,\n silver: 1,\n skyblue: 1,\n slateblue: 1,\n slategray: 1,\n slategrey: 1,\n snow: 1,\n springgreen: 1,\n steelblue: 1,\n tan: 1,\n teal: 1,\n thistle: 1,\n tomato: 1,\n turquoise: 1,\n violet: 1,\n wheat: 1,\n white: 1,\n whitesmoke: 1,\n yellow: 1,\n yellowgreen: 1,\n\n // CSS System Colors\n // Spec: https://drafts.csswg.org/css-color/#css-system-colors\n canvas: 1,\n canvastext: 1,\n linktext: 1,\n visitedtext: 1,\n activetext: 1,\n buttonface: 1,\n buttontext: 1,\n buttonborder: 1,\n field: 1,\n fieldtext: 1,\n highlight: 1,\n highlighttext: 1,\n selecteditem: 1,\n selecteditemtext: 1,\n mark: 1,\n marktext: 1,\n graytext: 1,\n\n // TODO: Deprecated CSS System colors\n // Spec: https://drafts.csswg.org/css-color/#deprecated-system-colors\n}\n\nexport const colorFunctions = {\n rgb: 1,\n rgba: 1,\n hsl: 1,\n hsla: 1,\n hwb: 1,\n lab: 1,\n lch: 1,\n oklab: 1,\n oklch: 1,\n color: 1,\n}\n","import walk from 'css-tree/walker'\n\nconst systemKeywords = {\n // Global CSS keywords\n 'inherit': 1,\n 'initial': 1,\n 'unset': 1,\n 'revert': 1,\n\n // System font keywords\n 'caption': 1,\n 'icon': 1,\n 'menu': 1,\n 'message-box': 1,\n 'small-caption': 1,\n 'status-bar': 1,\n}\n\nconst keywordDisallowList = {\n // font-weight, font-stretch, font-style\n 'normal': 1,\n\n // font-size keywords\n 'xx-small': 1,\n 'x-small': 1,\n 'small': 1,\n 'medium': 1,\n 'large': 1,\n 'x-large': 1,\n 'xx-large': 1,\n 'larger': 1,\n 'smaller': 1,\n\n // font-weight keywords\n 'bold': 1,\n 'bolder': 1,\n 'lighter': 1,\n\n // font-stretch keywords\n 'ultra-condensed': 1,\n 'extra-condensed': 1,\n 'condensed': 1,\n 'semi-condensed': 1,\n 'semi-expanded': 1,\n 'expanded': 1,\n 'extra-expanded': 1,\n 'ultra-expanded': 1,\n\n // font-style keywords\n 'italic': 1,\n 'oblique': 1,\n}\n\nconst COMMA = 44 // ','.charCodeAt(0) === 44\n\nexport function isFontFamilyKeyword(node) {\n const firstChild = node.children.first\n return firstChild.type === 'Identifier' && systemKeywords[firstChild.name]\n}\n\nexport function getFamilyFromFont(node, stringifyNode) {\n let parts = ''\n\n walk(node, {\n reverse: true,\n enter: function (fontNode) {\n if (fontNode.type === 'String') {\n const loc = fontNode.loc.start\n // Stringify the first character to get the correct quote character\n const quote = stringifyNode({\n loc: {\n start: {\n line: loc.line,\n column: loc.column\n },\n end: {\n line: loc.line,\n column: loc.column + 1\n }\n }\n })\n return parts = quote + fontNode.value + quote + parts\n }\n if (fontNode.type === 'Operator' && fontNode.value.charCodeAt(0) === COMMA) {\n return parts = fontNode.value + parts\n }\n if (fontNode.type === 'Identifier') {\n if (keywordDisallowList[fontNode.name]) {\n return this.skip\n }\n return parts = fontNode.name + parts\n }\n }\n })\n\n return parts\n}\n","import walk from 'css-tree/walker'\n\nconst sizeKeywords = {\n 'xx-small': 1,\n 'x-small': 1,\n 'small': 1,\n 'medium': 1,\n 'large': 1,\n 'x-large': 1,\n 'xx-large': 1,\n 'larger': 1,\n 'smaller': 1,\n}\n\nconst keywords = {\n // Global CSS keywords\n 'inherit': 1,\n 'initial': 1,\n 'unset': 1,\n 'revert': 1,\n\n // System font keywords\n 'caption': 1,\n 'icon': 1,\n 'menu': 1,\n 'message-box': 1,\n 'small-caption': 1,\n 'status-bar': 1,\n}\n\nconst ZERO = 48 // '0'.charCodeAt(0) === 48\nconst SLASH = 47 // '/'.charCodeAt(0) === 47\n\nexport function isFontSizeKeyword(node) {\n const firstChild = node.children.first\n return firstChild.type === 'Identifier' && keywords[firstChild.name]\n}\n\nexport function getSizeFromFont(node) {\n let operator = false\n let size\n\n walk(node, function (fontNode) {\n switch (fontNode.type) {\n case 'Number': {\n // Special case for `font: 0/0 a`\n if (fontNode.value.charCodeAt(0) === ZERO) {\n size = '0'\n return this.break\n }\n }\n case 'Operator': {\n if (fontNode.value.charCodeAt(0) === SLASH) {\n operator = true\n }\n break\n }\n case 'Dimension': {\n if (!operator) {\n size = fontNode.value + fontNode.unit\n return this.break\n }\n }\n case 'Identifier': {\n if (sizeKeywords[fontNode.name]) {\n size = fontNode.name\n return this.break\n }\n }\n }\n })\n\n return size\n}\n","const keywords = {\n 'auto': 1,\n 'inherit': 1,\n 'initial': 1,\n 'unset': 1,\n 'revert': 1,\n 'none': 1, // for `text-shadow`, `box-shadow` and `background`\n}\n\nexport function isValueKeyword(node) {\n if (!node.children) return false\n const firstChild = node.children.first\n\n if (!firstChild) return false\n if (node.children.size > 1) return false\n return firstChild.type === 'Identifier' && keywords[firstChild.name]\n}\n","const timingKeywords = {\n 'linear': 1,\n 'ease': 1,\n 'ease-in': 1,\n 'ease-out': 1,\n 'ease-in-out': 1,\n 'step-start': 1,\n 'step-end': 1,\n}\n\nexport function analyzeAnimation(children, stringifyNode) {\n let durationFound = false\n const durations = []\n const timingFunctions = []\n\n children.forEach(child => {\n // Right after a ',' we start over again\n if (child.type === 'Operator') {\n return durationFound = false\n }\n if (child.type === 'Dimension' && durationFound === false) {\n durationFound = true\n return durations.push(stringifyNode(child))\n }\n if (child.type === 'Identifier' && timingKeywords[child.name]) {\n return timingFunctions.push(stringifyNode(child))\n }\n if (child.type === 'Function'\n && (\n child.name === 'cubic-bezier' || child.name === 'steps'\n )\n ) {\n return timingFunctions.push(stringifyNode(child))\n }\n })\n\n return [durations, timingFunctions]\n}\n","const HYPHENMINUS = 45; // '-'.charCodeAt()\n\n/**\n * @param {string} keyword\n * @returns {boolean}\n */\nfunction hasVendorPrefix(keyword) {\n if (keyword.charCodeAt(0) === HYPHENMINUS && keyword.charCodeAt(1) !== HYPHENMINUS) {\n // String must have a 2nd occurrence of '-', at least at position 3 (offset=2)\n if (keyword.indexOf('-', 2) !== -1) {\n return true\n }\n }\n\n return false\n}\n\nexport {\n hasVendorPrefix\n}","import { hasVendorPrefix } from '../vendor-prefix.js'\n\nexport function isAstVendorPrefixed(node) {\n if (!node.children) {\n return false\n }\n\n const children = node.children.toArray()\n\n for (let index = 0; index < children.length; index++) {\n const node = children[index]\n const { type, name } = node;\n\n if (type === 'Identifier' && hasVendorPrefix(name)) {\n return true\n }\n\n if (type === 'Function') {\n if (hasVendorPrefix(name)) {\n return true\n }\n\n if (isAstVendorPrefixed(node)) {\n return true\n }\n }\n }\n\n return false\n}\n","class CountableCollection {\n /**\n * @param {string[]} initial\n */\n constructor(initial) {\n /** @type [index: string]: string */\n this._items = {}\n /** @type number */\n this._total = 0\n /** @type number */\n this._totalUnique = 0\n\n if (initial) {\n for (let i = 0; i < initial.length; i++) {\n this.push(initial[i])\n }\n }\n }\n\n /**\n * Push an item to the end of this collection\n * @param {string} item\n * @returns {void}\n */\n push(item) {\n this._total++\n\n if (this._items[item]) {\n this._items[item]++\n return\n }\n\n this._items[item] = 1\n this._totalUnique++\n }\n\n /**\n * Get the size of this collection\n * @returns {number} the size of this collection\n */\n size() {\n return this._total\n }\n\n /**\n * Get the counts of this collection, like total, uniques, etc.\n */\n count() {\n return {\n total: this._total,\n totalUnique: this._totalUnique,\n unique: this._items,\n uniquenessRatio: this._total === 0 ? 0 : this._totalUnique / this._total,\n }\n }\n}\n\nexport {\n CountableCollection\n}","import { CountableCollection } from './countable-collection.js'\n\nclass ContextCollection {\n constructor() {\n this._list = new CountableCollection()\n /** @type {[index; string]: CountableCollection} */\n this._contexts = {}\n }\n\n /**\n * Add an item to this _list's context\n * @param {string} item Item to push\n * @param {string} context Context to push Item to\n */\n push(item, context) {\n this._list.push(item)\n\n if (!this._contexts[context]) {\n this._contexts[context] = new CountableCollection()\n }\n\n this._contexts[context].push(item)\n }\n\n count() {\n /** @type {[index: string]: string} */\n const itemsPerContext = {}\n\n for (let context in this._contexts) {\n itemsPerContext[context] = this._contexts[context].count()\n }\n\n return Object.assign(this._list.count(), {\n itemsPerContext\n })\n }\n}\n\nexport {\n ContextCollection\n}","/**\n * Find the mode (most occurring value) in an array of Numbers\n * Takes the mean/average of multiple values if multiple values occur the same amount of times.\n *\n * @see https://github.com/angus-c/just/blob/684af9ca0c7808bc78543ec89379b1fdfce502b1/packages/array-mode/index.js\n * @param {Array} arr - Array to find the mode value for\n * @returns {Number} mode - The `mode` value of `arr`\n */\nfunction Mode(arr) {\n const frequencies = Object.create(null)\n let maxOccurrences = -1\n let maxOccurenceCount = 0\n let sum = 0\n\n for (let i = 0; i < arr.length; i++) {\n const element = arr[i]\n const updatedCount = (frequencies[element] || 0) + 1\n frequencies[element] = updatedCount\n\n if (updatedCount > maxOccurrences) {\n maxOccurrences = updatedCount\n maxOccurenceCount = 0\n sum = 0\n }\n\n if (updatedCount >= maxOccurrences) {\n maxOccurenceCount++\n sum += element\n }\n }\n\n return sum / maxOccurenceCount\n}\n\n/**\n * Find the middle number in an Array of Numbers\n * Returns the average of 2 numbers if the Array length is an even number\n * @see https://github.com/angus-c/just/blob/684af9ca0c7808bc78543ec89379b1fdfce502b1/packages/array-median/index.js\n * @param {Array} arr - A sorted Array\n * @returns {Number} - The array's Median\n */\nfunction Median(arr) {\n const middle = arr.length / 2\n const lowerMiddleRank = Math.floor(middle)\n\n if (middle !== lowerMiddleRank) {\n return arr[lowerMiddleRank]\n }\n return (arr[lowerMiddleRank] + arr[lowerMiddleRank - 1]) / 2\n}\n\nclass AggregateCollection {\n constructor() {\n /** @type number[] */\n this._items = []\n }\n\n /**\n * Add a new Integer at the end of this AggregateCollection\n * @param {number} item - The item to add\n */\n add(item) {\n this._items.push(item)\n }\n\n size() {\n return this._items.length\n }\n\n aggregate() {\n if (this._items.length === 0) {\n return {\n min: 0,\n max: 0,\n mean: 0,\n mode: 0,\n median: 0,\n range: 0,\n sum: 0,\n }\n }\n\n // TODO: can we avoid this sort()? It's slow\n /** @type Number[] */\n const sorted = this._items.slice().sort((a, b) => a - b)\n const min = sorted[0]\n const max = sorted[sorted.length - 1]\n\n const sum = this._items.reduce((total, num) => (total += num))\n const mode = Mode(this._items)\n const median = Median(sorted)\n\n return {\n min,\n max,\n mean: sum / this._items.length,\n mode,\n median,\n range: max - min,\n sum,\n }\n }\n\n /**\n * @returns {number[]} All _items in this collection\n */\n toArray() {\n return this._items\n }\n}\n\nexport {\n AggregateCollection\n}","import { hasVendorPrefix } from '../vendor-prefix.js'\nimport { endsWith } from '../string-utils.js'\n\n/**\n * @param {string} property\n * @see https://github.com/csstree/csstree/blob/master/lib/utils/names.js#L69\n */\nexport function isHack(property) {\n if (isCustom(property) || hasVendorPrefix(property)) return false\n\n let code = property.charCodeAt(0)\n\n return code === 47 // /\n || code === 95 // _\n || code === 43 // +\n || code === 42 // *\n || code === 38 // &\n || code === 36 // $\n || code === 35 // #\n}\n\nexport function isCustom(property) {\n if (property.length < 3) return false\n // 45 === '-'.charCodeAt(0)\n return property.charCodeAt(0) === 45 && property.charCodeAt(1) === 45\n}\n\nexport function isProperty(basename, property) {\n if (isCustom(property)) return false\n return endsWith(basename, property)\n}","export class OccurrenceCounter {\n constructor() {\n this._items = Object.create(null)\n }\n\n push(item) {\n if (this._items[item]) {\n return this._items[item]++\n }\n\n return this._items[item] = 1\n }\n\n count() {\n return Object.keys(this._items).length\n }\n}\n","import parse from 'css-tree/parser'\nimport walk from 'css-tree/walker'\nimport { analyzeSpecificity, compareSpecificity } from './selectors/specificity.js'\nimport { colorFunctions, colorNames } from './values/colors.js'\nimport { isFontFamilyKeyword, getFamilyFromFont } from './values/font-families.js'\nimport { isFontSizeKeyword, getSizeFromFont } from './values/font-sizes.js'\nimport { isValueKeyword } from './values/values.js'\nimport { analyzeAnimation } from './values/animations.js'\nimport { isAstVendorPrefixed } from './values/vendor-prefix.js'\nimport { ContextCollection } from './context-collection.js'\nimport { CountableCollection } from './countable-collection.js'\nimport { AggregateCollection } from './aggregate-collection.js'\nimport { strEquals, startsWith, endsWith } from './string-utils.js'\nimport { hasVendorPrefix } from './vendor-prefix.js'\nimport { isCustom, isHack, isProperty } from './properties/property-utils.js'\nimport { OccurrenceCounter } from './occurrence-counter.js'\n\n/**\n * Analyze CSS\n * @param {string} css\n */\nconst analyze = (css) => {\n const start = new Date()\n\n // We need all lines later on when we need to stringify the AST again\n // e.g. for Selectors\n const lines = css.split(/\\r?\\n/)\n\n /**\n * Recreate the authored CSS from a CSSTree node\n * @param {import('css-tree').CssNode} node - Node from CSSTree AST to stringify\n * @returns {string} str - The stringified node\n */\n function stringifyNode(node) {\n const start = node.loc.start\n const end = node.loc.end\n const lineCount = end.line - start.line\n\n // Single-line nodes\n if (lineCount === 0) {\n return lines[start.line - 1].substring(start.column - 1, end.column - 1)\n }\n\n // Multi-line nodes\n let value = ''\n\n for (let i = start.line; i <= end.line; i++) {\n const line = lines[i - 1]\n // First line\n if (i === start.line) {\n value += line.substring(start.column - 1) + '\\n'\n continue\n }\n // Last line\n if (i === end.line) {\n value += line.substring(0, end.column - 1)\n continue\n }\n // All lines in between first and last\n value += line + '\\n'\n }\n\n return value\n }\n\n // Stylesheet\n let totalComments = 0\n let commentsSize = 0\n const embeds = new CountableCollection()\n\n const startParse = new Date()\n\n const ast = parse(css, {\n parseAtrulePrelude: false,\n parseCustomProperty: true, // To find font-families, colors, etc.\n positions: true, // So we can use stringifyNode()\n onComment: function (comment) {\n totalComments++\n commentsSize += comment.length\n },\n })\n\n const startAnalysis = new Date()\n\n // Atrules\n let totalAtRules = 0\n /** @type {{[index: string]: string}[]} */\n const fontfaces = []\n const layers = new CountableCollection()\n const imports = new CountableCollection()\n const medias = new CountableCollection()\n const charsets = new CountableCollection()\n const supports = new CountableCollection()\n const keyframes = new CountableCollection()\n const prefixedKeyframes = new CountableCollection()\n const containers = new CountableCollection()\n\n // Rules\n let totalRules = 0\n let emptyRules = 0\n const ruleSizes = new AggregateCollection()\n const selectorsPerRule = new AggregateCollection()\n const declarationsPerRule = new AggregateCollection()\n\n // Selectors\n const keyframeSelectors = new CountableCollection()\n /** @type number */\n const uniqueSelectors = new OccurrenceCounter()\n /** @type [number,number,number] */\n let maxSpecificity\n /** @type [number,number,number] */\n let minSpecificity\n const specificityA = new AggregateCollection()\n const specificityB = new AggregateCollection()\n const specificityC = new AggregateCollection()\n const uniqueSpecificities = new CountableCollection()\n const selectorComplexities = new AggregateCollection()\n /** @type [number,number,number][] */\n const specificities = []\n const ids = new CountableCollection()\n const a11y = new CountableCollection()\n\n // Declarations\n const uniqueDeclarations = new OccurrenceCounter()\n let totalDeclarations = 0\n let importantDeclarations = 0\n let importantsInKeyframes = 0\n\n // Properties\n const properties = new CountableCollection()\n const propertyHacks = new CountableCollection()\n const propertyVendorPrefixes = new CountableCollection()\n const customProperties = new CountableCollection()\n\n // Values\n const vendorPrefixedValues = new CountableCollection()\n const zindex = new CountableCollection()\n const textShadows = new CountableCollection()\n const boxShadows = new CountableCollection()\n const fontFamilies = new CountableCollection()\n const fontSizes = new CountableCollection()\n const timingFunctions = new CountableCollection()\n const durations = new CountableCollection()\n const colors = new ContextCollection()\n const units = new ContextCollection()\n\n walk(ast, function (node) {\n switch (node.type) {\n case 'Atrule': {\n totalAtRules++\n const atRuleName = node.name\n\n if (atRuleName === 'font-face') {\n /** @type {[index: string]: string} */\n const descriptors = {}\n\n node.block.children.forEach(\n /** @param {import('css-tree').Declaration} descriptor */\n descriptor => (descriptors[descriptor.property] = stringifyNode(descriptor.value))\n )\n\n fontfaces.push(descriptors)\n break\n }\n if (atRuleName === 'media') {\n medias.push(node.prelude.value)\n break\n }\n if (atRuleName === 'supports') {\n supports.push(node.prelude.value)\n break\n }\n if (endsWith('keyframes', atRuleName)) {\n const name = '@' + atRuleName + ' ' + node.prelude.value\n if (hasVendorPrefix(atRuleName)) {\n prefixedKeyframes.push(name)\n }\n keyframes.push(name)\n break\n }\n if (atRuleName === 'import') {\n imports.push(node.prelude.value)\n break\n }\n if (atRuleName === 'charset') {\n charsets.push(node.prelude.value)\n break\n }\n if (atRuleName === 'container') {\n containers.push(node.prelude.value)\n break\n }\n if (atRuleName === 'layer') {\n containers.push(\n node.prelude.value.trim()\n .split(',')\n .map(name => name.trim())\n .forEach(name => layers.push(name))\n )\n }\n break\n }\n case 'Rule': {\n const numSelectors = node.prelude.children ? node.prelude.children.size : 0\n const numDeclarations = node.block.children ? node.block.children.size : 0\n\n ruleSizes.add(numSelectors + numDeclarations)\n selectorsPerRule.add(numSelectors)\n declarationsPerRule.add(numDeclarations)\n\n totalRules++\n\n if (numDeclarations === 0) {\n emptyRules++\n }\n break\n }\n case 'Selector': {\n const selector = stringifyNode(node)\n\n if (this.atrule && endsWith('keyframes', this.atrule.name)) {\n keyframeSelectors.push(selector)\n return this.skip\n }\n\n const { specificity, complexity, isId, isA11y } = analyzeSpecificity(node)\n\n if (isId) {\n ids.push(selector)\n }\n\n if (isA11y) {\n a11y.push(selector)\n }\n\n uniqueSelectors.push(selector)\n selectorComplexities.add(complexity)\n uniqueSpecificities.push(specificity)\n\n if (maxSpecificity === undefined) {\n maxSpecificity = specificity\n }\n\n if (minSpecificity === undefined) {\n minSpecificity = specificity\n }\n\n specificityA.add(specificity[0])\n specificityB.add(specificity[1])\n specificityC.add(specificity[2])\n\n if (minSpecificity !== undefined && compareSpecificity(minSpecificity, specificity) < 0) {\n minSpecificity = specificity\n }\n\n if (maxSpecificity !== undefined && compareSpecificity(maxSpecificity, specificity) > 0) {\n maxSpecificity = specificity\n }\n\n specificities.push(specificity)\n\n // Avoid deeper walking of selectors to not mess with\n // our specificity calculations in case of a selector\n // with :where() or :is() that contain SelectorLists\n // as children\n return this.skip\n }\n case 'Dimension': {\n if (!this.declaration) {\n break\n }\n\n units.push(node.unit, this.declaration.property)\n\n return this.skip\n }\n case 'Url': {\n if (startsWith('data:', node.value)) {\n embeds.push(node.value)\n }\n break\n }\n case 'Value': {\n if (isValueKeyword(node)) {\n break\n }\n\n const property = this.declaration.property\n\n if (isAstVendorPrefixed(node)) {\n vendorPrefixedValues.push(stringifyNode(node))\n }\n\n // Process properties first that don't have colors,\n // so we can avoid further walking them;\n if (isProperty('z-index', property)) {\n if (!isValueKeyword(node)) {\n zindex.push(stringifyNode(node))\n }\n return this.skip\n } else if (isProperty('font', property)) {\n if (!isFontFamilyKeyword(node)) {\n fontFamilies.push(getFamilyFromFont(node, stringifyNode))\n }\n if (!isFontSizeKeyword(node)) {\n const size = getSizeFromFont(node)\n if (size) {\n fontSizes.push(size)\n }\n }\n break\n } else if (isProperty('font-size', property)) {\n if (!isFontSizeKeyword(node)) {\n fontSizes.push(stringifyNode(node))\n }\n break\n } else if (isProperty('font-family', property)) {\n if (!isFontFamilyKeyword(node)) {\n fontFamilies.push(stringifyNode(node))\n }\n break\n } else if (isProperty('transition', property) || isProperty('animation', property)) {\n const [times, fns] = analyzeAnimation(node.children, stringifyNode)\n for (let i = 0; i < times.length; i++) {\n durations.push(times[i])\n }\n for (let i = 0; i < fns.length; i++) {\n timingFunctions.push(fns[i])\n }\n break\n } else if (isProperty('animation-duration', property) || isProperty('transition-duration', property)) {\n durations.push(stringifyNode(node))\n break\n } else if (isProperty('transition-timing-function', property) || isProperty('animation-timing-function', property)) {\n timingFunctions.push(stringifyNode(node))\n break\n } else if (isProperty('text-shadow', property)) {\n if (!isValueKeyword(node)) {\n textShadows.push(stringifyNode(node))\n }\n // no break here: potentially contains colors\n } else if (isProperty('box-shadow', property)) {\n if (!isValueKeyword(node)) {\n boxShadows.push(stringifyNode(node))\n }\n // no break here: potentially contains colors\n }\n\n walk(node, function (valueNode) {\n switch (valueNode.type) {\n case 'Hash': {\n colors.push('#' + valueNode.value, property)\n\n return this.skip\n }\n case 'Identifier': {\n const { name } = valueNode\n // Bail out if it can't be a color name\n // 20 === 'lightgoldenrodyellow'.length\n // 3 === 'red'.length\n if (name.length > 20 || name.length < 3) {\n return this.skip\n }\n if (colorNames[name.toLowerCase()]) {\n colors.push(stringifyNode(valueNode), property)\n }\n return this.skip\n }\n case 'Function': {\n // Don't walk var() multiple times\n if (strEquals('var', valueNode.name)) {\n return this.skip\n }\n if (colorFunctions[valueNode.name.toLowerCase()]) {\n colors.push(stringifyNode(valueNode), property)\n }\n // No this.skip here intentionally,\n // otherwise we'll miss colors in linear-gradient() etc.\n }\n }\n })\n break\n }\n case 'Declaration': {\n totalDeclarations++\n\n const declaration = stringifyNode(node)\n uniqueDeclarations.push(declaration)\n\n if (node.important) {\n importantDeclarations++\n\n if (this.atrule && endsWith('keyframes', this.atrule.name)) {\n importantsInKeyframes++\n }\n }\n\n const { property } = node\n\n properties.push(property)\n\n if (hasVendorPrefix(property)) {\n propertyVendorPrefixes.push(property)\n } else if (isHack(property)) {\n propertyHacks.push(property)\n } else if (isCustom(property)) {\n customProperties.push(property)\n }\n break\n }\n }\n })\n\n const embeddedContent = embeds.count()\n const embedSize = Object.keys(embeddedContent.unique).join('').length\n\n const totalUniqueDeclarations = uniqueDeclarations.count()\n\n const totalSelectors = selectorComplexities.size()\n const specificitiesA = specificityA.aggregate()\n const specificitiesB = specificityB.aggregate()\n const specificitiesC = specificityC.aggregate()\n const uniqueSpecificitiesCount = uniqueSpecificities.count()\n const complexityCount = new CountableCollection(selectorComplexities.toArray()).count()\n const totalUniqueSelectors = uniqueSelectors.count()\n const uniqueRuleSize = new CountableCollection(ruleSizes.toArray()).count()\n const uniqueSelectorsPerRule = new CountableCollection(selectorsPerRule.toArray()).count()\n const uniqueDeclarationsPerRule = new CountableCollection(declarationsPerRule.toArray()).count()\n const assign = Object.assign\n\n return {\n stylesheet: {\n sourceLinesOfCode: totalAtRules + totalSelectors + totalDeclarations + keyframeSelectors.size(),\n linesOfCode: lines.length,\n size: css.length,\n comments: {\n total: totalComments,\n size: commentsSize,\n },\n embeddedContent: assign(embeddedContent, {\n size: {\n total: embedSize,\n ratio: css.length === 0 ? 0 : embedSize / css.length,\n },\n }),\n },\n atrules: {\n fontface: {\n total: fontfaces.length,\n totalUnique: fontfaces.length,\n unique: fontfaces,\n uniquenessRatio: fontfaces.length === 0 ? 0 : 1\n },\n import: imports.count(),\n media: medias.count(),\n charset: charsets.count(),\n supports: supports.count(),\n keyframes: assign(\n keyframes.count(), {\n prefixed: assign(\n prefixedKeyframes.count(), {\n ratio: keyframes.size() === 0 ? 0 : prefixedKeyframes.size() / keyframes.size()\n }),\n }),\n container: containers.count(),\n layer: layers.count(),\n },\n rules: {\n total: totalRules,\n empty: {\n total: emptyRules,\n ratio: totalRules === 0 ? 0 : emptyRules / totalRules\n },\n sizes: assign(\n ruleSizes.aggregate(),\n {\n items: ruleSizes.toArray(),\n unique: uniqueRuleSize.unique,\n totalUnique: uniqueRuleSize.totalUnique,\n uniquenessRatio: uniqueRuleSize.uniquenessRatio\n },\n ),\n selectors: assign(\n selectorsPerRule.aggregate(),\n {\n items: selectorsPerRule.toArray(),\n unique: uniqueSelectorsPerRule.unique,\n totalUnique: uniqueSelectorsPerRule.totalUnique,\n uniquenessRatio: uniqueSelectorsPerRule.uniquenessRatio\n },\n ),\n declarations: assign(\n declarationsPerRule.aggregate(),\n {\n items: declarationsPerRule.toArray(),\n unique: uniqueDeclarationsPerRule.unique,\n totalUnique: uniqueDeclarationsPerRule.totalUnique,\n uniquenessRatio: uniqueDeclarationsPerRule.uniquenessRatio,\n },\n ),\n },\n selectors: {\n total: totalSelectors,\n totalUnique: totalUniqueSelectors,\n uniquenessRatio: totalSelectors === 0 ? 0 : totalUniqueSelectors / totalSelectors,\n specificity: {\n min: minSpecificity === undefined ? [0, 0, 0] : minSpecificity,\n max: maxSpecificity === undefined ? [0, 0, 0] : maxSpecificity,\n sum: [specificitiesA.sum, specificitiesB.sum, specificitiesC.sum],\n mean: [specificitiesA.mean, specificitiesB.mean, specificitiesC.mean],\n mode: [specificitiesA.mode, specificitiesB.mode, specificitiesC.mode],\n median: [specificitiesA.median, specificitiesB.median, specificitiesC.median],\n items: specificities,\n unique: uniqueSpecificitiesCount.unique,\n totalUnique: uniqueSpecificitiesCount.totalUnique,\n uniquenessRatio: uniqueSpecificitiesCount.uniquenessRatio,\n },\n complexity: assign(\n selectorComplexities.aggregate(),\n complexityCount, {\n items: selectorComplexities.toArray(),\n }),\n id: assign(\n ids.count(), {\n ratio: totalSelectors === 0 ? 0 : ids.size() / totalSelectors,\n }),\n accessibility: assign(\n a11y.count(), {\n ratio: totalSelectors === 0 ? 0 : a11y.size() / totalSelectors,\n }),\n keyframes: keyframeSelectors.count(),\n },\n declarations: {\n total: totalDeclarations,\n unique: {\n total: totalUniqueDeclarations,\n ratio: totalDeclarations === 0 ? 0 : totalUniqueDeclarations / totalDeclarations,\n },\n importants: {\n total: importantDeclarations,\n ratio: totalDeclarations === 0 ? 0 : importantDeclarations / totalDeclarations,\n inKeyframes: {\n total: importantsInKeyframes,\n ratio: importantDeclarations === 0 ? 0 : importantsInKeyframes / importantDeclarations,\n },\n },\n },\n properties: assign(\n properties.count(), {\n prefixed: assign(\n propertyVendorPrefixes.count(), {\n ratio: properties.size() === 0 ? 0 : propertyVendorPrefixes.size() / properties.size(),\n }),\n custom: assign(\n customProperties.count(), {\n ratio: properties.size() === 0 ? 0 : customProperties.size() / properties.size(),\n }),\n browserhacks: assign(\n propertyHacks.count(), {\n ratio: properties.size() === 0 ? 0 : propertyHacks.size() / properties.size(),\n }),\n }),\n values: {\n colors: colors.count(),\n fontFamilies: fontFamilies.count(),\n fontSizes: fontSizes.count(),\n zindexes: zindex.count(),\n textShadows: textShadows.count(),\n boxShadows: boxShadows.count(),\n animations: {\n durations: durations.count(),\n timingFunctions: timingFunctions.count(),\n },\n prefixes: vendorPrefixedValues.count(),\n units: units.count(),\n },\n __meta__: {\n parseTime: startAnalysis - startParse,\n analyzeTime: new Date() - startAnalysis,\n total: new Date() - start\n }\n }\n}\n\nexport {\n analyze,\n compareSpecificity,\n}\n"],"names":["compareChar","referenceCode","testCode","endsWith","base","test","offset","length","i","charCodeAt","startsWith","compareSpecificity","a","b","analyzeSpecificity","node","A","B","C","complexity","isA11y","walk","selector","type","Boolean","value","name","skip","selectorList","childSelectors","visit","enter","push","sort","specificity","listItem","isId","colorNames","aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkgrey","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkslategrey","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dimgrey","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","green","greenyellow","grey","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgreen","lightgrey","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightslategrey","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","rebeccapurple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","slategrey","snow","springgreen","steelblue","tan","teal","thistle","tomato","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen","canvas","canvastext","linktext","visitedtext","activetext","buttonface","buttontext","buttonborder","field","fieldtext","highlight","highlighttext","selecteditem","selecteditemtext","mark","marktext","graytext","colorFunctions","rgb","rgba","hsl","hsla","hwb","lab","lch","oklab","oklch","color","systemKeywords","inherit","initial","unset","revert","caption","icon","menu","keywordDisallowList","normal","small","medium","large","larger","smaller","bold","bolder","lighter","condensed","expanded","italic","oblique","isFontFamilyKeyword","firstChild","children","first","sizeKeywords","keywords","isFontSizeKeyword","auto","none","isValueKeyword","size","timingKeywords","linear","ease","hasVendorPrefix","keyword","indexOf","isAstVendorPrefixed","toArray","index","CountableCollection","this","_items","_total","_totalUnique","item","count","total","totalUnique","unique","uniquenessRatio","ContextCollection","_list","_contexts","context","itemsPerContext","Object","assign","AggregateCollection","add","aggregate","min","max","mean","mode","median","range","sum","arr","middle","lowerMiddleRank","sorted","slice","reduce","num","frequencies","create","maxOccurrences","maxOccurenceCount","element","updatedCount","Mode","Math","floor","isCustom","property","isProperty","basename","OccurrenceCounter","keys","css","start","Date","lines","split","stringifyNode","loc","end","line","substring","column","maxSpecificity","minSpecificity","totalComments","commentsSize","embeds","startParse","ast","parse","parseAtrulePrelude","parseCustomProperty","positions","onComment","comment","startAnalysis","totalAtRules","fontfaces","layers","imports","medias","charsets","supports","keyframes","prefixedKeyframes","containers","totalRules","emptyRules","ruleSizes","selectorsPerRule","declarationsPerRule","keyframeSelectors","uniqueSelectors","specificityA","specificityB","specificityC","uniqueSpecificities","selectorComplexities","specificities","ids","a11y","uniqueDeclarations","totalDeclarations","importantDeclarations","importantsInKeyframes","properties","propertyHacks","propertyVendorPrefixes","customProperties","vendorPrefixedValues","zindex","textShadows","boxShadows","fontFamilies","fontSizes","timingFunctions","durations","colors","units","atRuleName","descriptors","block","forEach","descriptor","prelude","trim","map","numSelectors","numDeclarations","atrule","undefined","declaration","unit","parts","reverse","fontNode","quote","getFamilyFromFont","operator","getSizeFromFont","durationFound","child","analyzeAnimation","times","fns","valueNode","toLowerCase","strEquals","important","code","isHack","embeddedContent","embedSize","join","totalUniqueDeclarations","totalSelectors","specificitiesA","specificitiesB","specificitiesC","uniqueSpecificitiesCount","complexityCount","totalUniqueSelectors","uniqueRuleSize","uniqueSelectorsPerRule","uniqueDeclarationsPerRule","stylesheet","sourceLinesOfCode","linesOfCode","comments","ratio","atrules","fontface","import","media","charset","prefixed","container","layer","rules","empty","sizes","items","selectors","declarations","id","accessibility","importants","inKeyframes","custom","browserhacks","values","zindexes","animations","prefixes","__meta__","parseTime","analyzeTime"],"mappings":"kLAMA,SAASA,EAAYC,EAAeC,GAMlC,OAJIA,GAAY,IAAUA,GAAY,KAEpCA,GAAsB,IAEjBD,IAAkBC,WA2BXC,EAASC,EAAMC,GAC7B,IAAMC,EAASD,EAAKE,OAASH,EAAKG,OAElC,GAAID,EAAS,EACX,SAGF,IAAK,I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H,EAAgBR,EAC3BiI,YAAa,IAAI/I,KAASsB,EAC1BnE,MAAO,IAAI6C,KAASD"}
1
+ {"version":3,"file":"analyzer.cjs","sources":["../src/string-utils.js","../src/atrules/atrules.js","../src/vendor-prefix.js","../src/selectors/utils.js","../src/values/colors.js","../src/values/font-families.js","../src/values/font-sizes.js","../src/values/values.js","../src/values/animations.js","../src/values/vendor-prefix.js","../src/countable-collection.js","../src/context-collection.js","../src/aggregate-collection.js","../src/properties/property-utils.js","../src/index.js","../src/stylesheet/stylesheet.js"],"sourcesContent":["/**\n * Case-insensitive compare two character codes\n * @param {string} charA\n * @param {string} charB\n * @see https://github.com/csstree/csstree/blob/41f276e8862d8223eeaa01a3d113ab70bb13d2d9/lib/tokenizer/utils.js#L22\n */\nfunction compareChar(referenceCode, testCode) {\n // if uppercase\n if (testCode >= 0x0041 && testCode <= 0x005A) {\n // shifting the 6th bit makes a letter lowercase\n testCode = testCode | 32\n }\n return referenceCode === testCode\n}\n\n/**\n * Case-insensitive string-comparison\n * @param {string} base\n * @param {string} test\n * @returns {boolean} true if the two strings are the same, false otherwise\n */\nexport function strEquals(base, test) {\n if (base.length !== test.length) return false\n\n for (let i = 0; i < base.length; i++) {\n if (compareChar(base.charCodeAt(i), test.charCodeAt(i)) === false) {\n return false\n }\n }\n\n return true\n}\n\n/**\n * Case-insensitive testing whether a string ends with a given substring\n * @param {string} base e.g. '-webkit-transform'\n * @param {string} cmp e.g. 'transform'\n * @returns {boolean} true if `test` ends with `base`, false otherwise\n */\nexport function endsWith(base, test) {\n const offset = test.length - base.length\n\n if (offset < 0) {\n return false\n }\n\n for (let i = test.length - 1; i >= offset; i--) {\n if (compareChar(base.charCodeAt(i - offset), test.charCodeAt(i)) === false) {\n return false\n }\n }\n\n return true\n}\n\n/**\n * Case-insensitive testing whether a string starts with a given substring\n * @param {string} base\n * @param {test} test\n * @returns {boolean} true if `test` starts with `base`, false otherwise\n */\nexport function startsWith(base, test) {\n if (test.length < base.length) return false\n\n for (let i = 0; i < base.length; i++) {\n if (compareChar(base.charCodeAt(i), test.charCodeAt(i)) === false) {\n return false\n }\n }\n\n return true\n}\n","import { strEquals, startsWith, endsWith } from '../string-utils.js'\nimport walk from 'css-tree/walker'\n\n/**\n * Check whether node.property === property and node.value === value,\n * but case-insensitive and fast.\n * @param {import('css-tree').Declaration} node\n * @param {string} property - The CSS property to compare with (case-insensitive)\n * @param {string} value - The identifier/keyword value to compare with\n * @returns true if declaratioNode is the given property: value, false otherwise\n */\nfunction isPropertyValue(node, property, value) {\n return strEquals(property, node.property)\n && node.value.children.first.type === 'Identifier'\n && strEquals(value, node.value.children.first.name)\n}\n\n/**\n * Check if an @supports atRule is a browserhack\n * @param {import('css-tree').AtrulePrelude} prelude\n * @returns true if the atrule is a browserhack\n */\nexport function isSupportsBrowserhack(prelude) {\n let returnValue = false\n\n walk(prelude, function (node) {\n if (node.type === 'Declaration') {\n if (\n isPropertyValue(node, '-webkit-appearance', 'none')\n || isPropertyValue(node, '-moz-appearance', 'meterbar')\n ) {\n returnValue = true\n return this.break\n }\n }\n })\n\n return returnValue\n}\n\n/**\n * Check if a @media atRule is a browserhack\n * @param {import('css-tree').AtrulePrelude} prelude\n * @returns true if the atrule is a browserhack\n */\nexport function isMediaBrowserhack(prelude) {\n let returnValue = false\n\n walk(prelude, function (node) {\n if (node.type === 'MediaQuery'\n && node.children.size === 1\n && node.children.first.type === 'Identifier'\n ) {\n node = node.children.first\n // Note: CSSTree adds a trailing space to \\\\9\n if (startsWith('\\\\0', node.name) || endsWith('\\\\9 ', node.name)) {\n returnValue = true\n return this.break\n }\n }\n if (node.type === 'MediaFeature') {\n if (node.value !== null && node.value.unit === '\\\\0') {\n returnValue = true\n return this.break\n }\n if (strEquals('-moz-images-in-menus', node.name)\n || strEquals('min--moz-device-pixel-ratio', node.name)\n || strEquals('-ms-high-contrast', node.name)\n ) {\n returnValue = true\n return this.break\n }\n if (strEquals('min-resolution', node.name)\n && strEquals('.001', node.value.value)\n && strEquals('dpcm', node.value.unit)\n ) {\n returnValue = true\n return this.break\n }\n if (strEquals('-webkit-min-device-pixel-ratio', node.name)) {\n if ((strEquals('0', node.value.value) || strEquals('10000', node.value.value))) {\n returnValue = true\n return this.break\n }\n }\n }\n })\n\n return returnValue\n}","const HYPHENMINUS = 45; // '-'.charCodeAt()\n\n/**\n * @param {string} keyword\n * @returns {boolean}\n */\nfunction hasVendorPrefix(keyword) {\n if (keyword.charCodeAt(0) === HYPHENMINUS && keyword.charCodeAt(1) !== HYPHENMINUS) {\n // String must have a 2nd occurrence of '-', at least at position 3 (offset=2)\n if (keyword.indexOf('-', 2) !== -1) {\n return true\n }\n }\n\n return false\n}\n\nexport {\n hasVendorPrefix\n}","import walk from 'css-tree/walker'\nimport { startsWith, strEquals } from '../string-utils.js'\nimport { hasVendorPrefix } from '../vendor-prefix.js'\n\n/**\n * Compare specificity A to Specificity B\n * @param {[number,number,number]} a - Specificity A\n * @param {[number,number,number]} b - Specificity B\n * @returns {number} sortIndex - 0 when a==b, 1 when a<b, -1 when a>b\n */\nexport function compareSpecificity(a, b) {\n if (a[0] === b[0]) {\n if (a[1] === b[1]) {\n return b[2] - a[2]\n }\n\n return b[1] - a[1]\n }\n\n return b[0] - a[0]\n}\n\n/**\n *\n * @param {import('css-tree').SelectorList} selectorListAst\n * @returns {Selector[]} Analyzed selectors in the selectorList\n */\nfunction analyzeList(selectorListAst, cb) {\n const childSelectors = []\n walk(selectorListAst, {\n visit: 'Selector',\n enter: function (node) {\n childSelectors.push(cb(node))\n }\n })\n\n return childSelectors\n}\n\nfunction isPseudoFunction(name) {\n return (\n strEquals(name, 'not')\n || strEquals(name, 'nth-child')\n || strEquals(name, 'nth-last-child')\n || strEquals(name, 'where')\n || strEquals(name, 'is')\n || strEquals(name, 'has')\n || strEquals(name, 'matches')\n || strEquals(name, '-webkit-any')\n || strEquals(name, '-moz-any')\n )\n}\n\nexport function isAccessibility(selector) {\n let isA11y = false\n\n walk(selector, function (node) {\n if (node.type == 'AttributeSelector') {\n if (strEquals('role', node.name.name) || startsWith('aria-', node.name.name)) {\n isA11y = true\n return this.break\n }\n } else if (node.type == 'PseudoClassSelector') {\n if (isPseudoFunction(node.name)) {\n const list = analyzeList(node, isAccessibility)\n\n // Bail out for empty/non-existent :nth-child() params\n if (list.length === 0) return\n\n if (list.some(b => b == true)) {\n isA11y = true\n return this.skip\n }\n\n return this.skip\n }\n }\n })\n\n return isA11y;\n}\n\n/**\n * Get the Complexity for the AST of a Selector Node\n * @param {import('css-tree').Selector} ast - AST Node for a Selector\n * @return {number} - The numeric complexity of the Selector\n */\nexport function getComplexity(selector) {\n let complexity = 0\n\n walk(selector, function (node) {\n if (node.type == 'Selector' || node.type == 'Nth') return\n\n complexity++\n\n if (node.type == 'IdSelector'\n || node.type == 'ClassSelector'\n || node.type == 'PseudoElementSelector'\n || node.type == 'TypeSelector'\n || node.type == 'PseudoClassSelector'\n ) {\n if (hasVendorPrefix(node.name)) {\n complexity++\n }\n }\n\n if (node.type == 'AttributeSelector') {\n if (Boolean(node.value)) {\n complexity++\n }\n if (hasVendorPrefix(node.name.name)) {\n complexity++\n }\n return this.skip\n }\n\n if (node.type == 'PseudoClassSelector') {\n if (isPseudoFunction(node.name)) {\n const selectorList = analyzeList(node, getComplexity)\n\n // Bail out for empty/non-existent :nth-child() params\n if (selectorList.length === 0) return\n\n selectorList.forEach(c => complexity += c)\n return this.skip\n }\n }\n })\n\n return complexity\n}\n","export const namedColors = new Set([\n // CSS Named Colors\n // Spec: https://drafts.csswg.org/css-color/#named-colors\n 'aliceblue',\n 'antiquewhite',\n 'aqua',\n 'aquamarine',\n 'azure',\n 'beige',\n 'bisque',\n 'black',\n 'blanchedalmond',\n 'blue',\n 'blueviolet',\n 'brown',\n 'burlywood',\n 'cadetblue',\n 'chartreuse',\n 'chocolate',\n 'coral',\n 'cornflowerblue',\n 'cornsilk',\n 'crimson',\n 'cyan',\n 'darkblue',\n 'darkcyan',\n 'darkgoldenrod',\n 'darkgray',\n 'darkgreen',\n 'darkgrey',\n 'darkkhaki',\n 'darkmagenta',\n 'darkolivegreen',\n 'darkorange',\n 'darkorchid',\n 'darkred',\n 'darksalmon',\n 'darkseagreen',\n 'darkslateblue',\n 'darkslategray',\n 'darkslategrey',\n 'darkturquoise',\n 'darkviolet',\n 'deeppink',\n 'deepskyblue',\n 'dimgray',\n 'dimgrey',\n 'dodgerblue',\n 'firebrick',\n 'floralwhite',\n 'forestgreen',\n 'fuchsia',\n 'gainsboro',\n 'ghostwhite',\n 'gold',\n 'goldenrod',\n 'gray',\n 'green',\n 'greenyellow',\n 'grey',\n 'honeydew',\n 'hotpink',\n 'indianred',\n 'indigo',\n 'ivory',\n 'khaki',\n 'lavender',\n 'lavenderblush',\n 'lawngreen',\n 'lemonchiffon',\n 'lightblue',\n 'lightcoral',\n 'lightcyan',\n 'lightgoldenrodyellow',\n 'lightgray',\n 'lightgreen',\n 'lightgrey',\n 'lightpink',\n 'lightsalmon',\n 'lightseagreen',\n 'lightskyblue',\n 'lightslategray',\n 'lightslategrey',\n 'lightsteelblue',\n 'lightyellow',\n 'lime',\n 'limegreen',\n 'linen',\n 'magenta',\n 'maroon',\n 'mediumaquamarine',\n 'mediumblue',\n 'mediumorchid',\n 'mediumpurple',\n 'mediumseagreen',\n 'mediumslateblue',\n 'mediumspringgreen',\n 'mediumturquoise',\n 'mediumvioletred',\n 'midnightblue',\n 'mintcream',\n 'mistyrose',\n 'moccasin',\n 'navajowhite',\n 'navy',\n 'oldlace',\n 'olive',\n 'olivedrab',\n 'orange',\n 'orangered',\n 'orchid',\n 'palegoldenrod',\n 'palegreen',\n 'paleturquoise',\n 'palevioletred',\n 'papayawhip',\n 'peachpuff',\n 'peru',\n 'pink',\n 'plum',\n 'powderblue',\n 'purple',\n 'rebeccapurple',\n 'red',\n 'rosybrown',\n 'royalblue',\n 'saddlebrown',\n 'salmon',\n 'sandybrown',\n 'seagreen',\n 'seashell',\n 'sienna',\n 'silver',\n 'skyblue',\n 'slateblue',\n 'slategray',\n 'slategrey',\n 'snow',\n 'springgreen',\n 'steelblue',\n 'tan',\n 'teal',\n 'thistle',\n 'tomato',\n 'turquoise',\n 'violet',\n 'wheat',\n 'white',\n 'whitesmoke',\n 'yellow',\n 'yellowgreen',\n])\n\nexport const systemColors = new Set([\n // CSS System Colors\n // Spec: https://drafts.csswg.org/css-color/#css-system-colors\n 'canvas',\n 'canvastext',\n 'linktext',\n 'visitedtext',\n 'activetext',\n 'buttonface',\n 'buttontext',\n 'buttonborder',\n 'field',\n 'fieldtext',\n 'highlight',\n 'highlighttext',\n 'selecteditem',\n 'selecteditemtext',\n 'mark',\n 'marktext',\n 'graytext',\n\n // TODO: Deprecated CSS System colors\n // Spec: https://drafts.csswg.org/css-color/#deprecated-system-colors\n])\n\nexport const colorFunctions = new Set([\n 'rgb',\n 'rgba',\n 'hsl',\n 'hsla',\n 'hwb',\n 'lab',\n 'lch',\n 'oklab',\n 'oklch',\n 'color',\n])\n\nexport const colorKeywords = new Set([\n 'currentcolor',\n 'transparent',\n])\n","import walk from 'css-tree/walker'\n\nconst systemKeywords = new Set([\n // Global CSS keywords\n 'inherit',\n 'initial',\n 'unset',\n 'revert',\n\n // System font keywords\n 'caption',\n 'icon',\n 'menu',\n 'message-box',\n 'small-caption',\n 'status-bar',\n])\n\nconst keywordDisallowList = new Set([\n // font-weight, font-stretch, font-style\n 'normal',\n\n // font-size keywords\n 'xx-small',\n 'x-small',\n 'small',\n 'medium',\n 'large',\n 'x-large',\n 'xx-large',\n 'larger',\n 'smaller',\n\n // font-weight keywords\n 'bold',\n 'bolder',\n 'lighter',\n\n // font-stretch keywords\n 'ultra-condensed',\n 'extra-condensed',\n 'condensed',\n 'semi-condensed',\n 'semi-expanded',\n 'expanded',\n 'extra-expanded',\n 'ultra-expanded',\n\n // font-style keywords\n 'italic',\n 'oblique',\n])\n\nconst COMMA = 44 // ','.charCodeAt(0) === 44\n\nexport function isFontFamilyKeyword(node) {\n const firstChild = node.children.first\n return firstChild.type === 'Identifier' && systemKeywords.has(firstChild.name)\n}\n\nexport function getFamilyFromFont(node, stringifyNode) {\n let parts = ''\n\n walk(node, {\n reverse: true,\n enter: function (fontNode) {\n if (fontNode.type === 'String') {\n const offset = fontNode.loc.start.offset\n // Stringify the first character to get the correct quote character\n const quote = stringifyNode({\n loc: {\n start: { offset },\n end: { offset: offset + 1 }\n }\n })\n return parts = quote + fontNode.value + quote + parts\n }\n if (fontNode.type === 'Operator' && fontNode.value.charCodeAt(0) === COMMA) {\n return parts = fontNode.value + parts\n }\n if (fontNode.type === 'Identifier') {\n if (keywordDisallowList.has(fontNode.name)) {\n return this.skip\n }\n return parts = fontNode.name + parts\n }\n }\n })\n\n return parts\n}\n","import walk from 'css-tree/walker'\n\nconst sizeKeywords = new Set([\n 'xx-small',\n 'x-small',\n 'small',\n 'medium',\n 'large',\n 'x-large',\n 'xx-large',\n 'larger',\n 'smaller',\n])\n\nconst keywords = new Set([\n // Global CSS keywords\n 'inherit',\n 'initial',\n 'unset',\n 'revert',\n\n // System font keywords\n 'caption',\n 'icon',\n 'menu',\n 'message-box',\n 'small-caption',\n 'status-bar',\n])\n\nconst ZERO = 48 // '0'.charCodeAt(0) === 48\nconst SLASH = 47 // '/'.charCodeAt(0) === 47\n\nexport function isFontSizeKeyword(node) {\n const firstChild = node.children.first\n return firstChild.type === 'Identifier' && keywords.has(firstChild.name)\n}\n\nexport function getSizeFromFont(node) {\n let operator = false\n let size\n\n walk(node, function (fontNode) {\n switch (fontNode.type) {\n case 'Number': {\n // Special case for `font: 0/0 a`\n if (fontNode.value.charCodeAt(0) === ZERO) {\n size = '0'\n return this.break\n }\n }\n case 'Operator': {\n if (fontNode.value.charCodeAt(0) === SLASH) {\n operator = true\n }\n break\n }\n case 'Dimension': {\n if (!operator) {\n size = fontNode.value + fontNode.unit\n return this.break\n }\n }\n case 'Identifier': {\n if (sizeKeywords.has(fontNode.name)) {\n size = fontNode.name\n return this.break\n }\n }\n }\n })\n\n return size\n}\n","const keywords = new Set([\n 'auto',\n 'inherit',\n 'initial',\n 'unset',\n 'revert',\n 'none', // for `text-shadow`, `box-shadow` and `background`\n])\n\nexport function isValueKeyword(node) {\n if (!node.children) return false\n const firstChild = node.children.first\n if (!firstChild) return false\n\n if (node.children.size > 1) return false\n return firstChild.type === 'Identifier' && keywords.has(firstChild.name)\n}\n","const timingKeywords = new Set([\n 'linear',\n 'ease',\n 'ease-in',\n 'ease-out',\n 'ease-in-out',\n 'step-start',\n 'step-end',\n])\n\nexport function analyzeAnimation(children, stringifyNode) {\n let durationFound = false\n const durations = []\n const timingFunctions = []\n\n children.forEach(child => {\n // Right after a ',' we start over again\n if (child.type === 'Operator') {\n return durationFound = false\n }\n if (child.type === 'Dimension' && durationFound === false) {\n durationFound = true\n return durations.push(stringifyNode(child))\n }\n if (child.type === 'Identifier' && timingKeywords.has(child.name)) {\n return timingFunctions.push(stringifyNode(child))\n }\n if (child.type === 'Function'\n && (\n child.name === 'cubic-bezier' || child.name === 'steps'\n )\n ) {\n return timingFunctions.push(stringifyNode(child))\n }\n })\n\n return [durations, timingFunctions]\n}\n","import { hasVendorPrefix } from '../vendor-prefix.js'\n\nexport function isAstVendorPrefixed(node) {\n if (!node.children) {\n return false\n }\n\n const children = node.children.toArray()\n\n for (let index = 0; index < children.length; index++) {\n const node = children[index]\n const { type, name } = node;\n\n if (type === 'Identifier' && hasVendorPrefix(name)) {\n return true\n }\n\n if (type === 'Function') {\n if (hasVendorPrefix(name)) {\n return true\n }\n\n if (isAstVendorPrefixed(node)) {\n return true\n }\n }\n }\n\n return false\n}\n","class CountableCollection {\n /**\n * @param {string[]} initial\n */\n constructor(initial) {\n /** @type [index: string]: string */\n this._items = {}\n /** @type number */\n this._total = 0\n /** @type number */\n this._totalUnique = 0\n\n if (initial) {\n for (let i = 0; i < initial.length; i++) {\n this.push(initial[i])\n }\n }\n }\n\n /**\n * Push an item to the end of this collection\n * @param {string} item\n * @returns {void}\n */\n push(item) {\n this._total++\n\n if (this._items[item]) {\n this._items[item]++\n return\n }\n\n this._items[item] = 1\n this._totalUnique++\n }\n\n /**\n * Get the size of this collection\n * @returns {number} the size of this collection\n */\n size() {\n return this._total\n }\n\n /**\n * Get the counts of this collection, like total, uniques, etc.\n */\n count() {\n return {\n total: this._total,\n totalUnique: this._totalUnique,\n unique: this._items,\n uniquenessRatio: this._total === 0 ? 0 : this._totalUnique / this._total,\n }\n }\n}\n\nexport {\n CountableCollection\n}","import { CountableCollection } from './countable-collection.js'\n\nclass ContextCollection {\n constructor() {\n this._list = new CountableCollection()\n /** @type {[index; string]: CountableCollection} */\n this._contexts = {}\n }\n\n /**\n * Add an item to this _list's context\n * @param {string} item Item to push\n * @param {string} context Context to push Item to\n */\n push(item, context) {\n this._list.push(item)\n\n if (!this._contexts[context]) {\n this._contexts[context] = new CountableCollection()\n }\n\n this._contexts[context].push(item)\n }\n\n count() {\n const itemsPerContext = {}\n\n for (let context in this._contexts) {\n itemsPerContext[context] = this._contexts[context].count()\n }\n\n return Object.assign(this._list.count(), {\n itemsPerContext\n })\n }\n}\n\nexport {\n ContextCollection\n}","/**\n * Find the mode (most occurring value) in an array of Numbers\n * Takes the mean/average of multiple values if multiple values occur the same amount of times.\n *\n * @see https://github.com/angus-c/just/blob/684af9ca0c7808bc78543ec89379b1fdfce502b1/packages/array-mode/index.js\n * @param {Array} arr - Array to find the mode value for\n * @returns {Number} mode - The `mode` value of `arr`\n */\nfunction Mode(arr) {\n const frequencies = Object.create(null)\n let maxOccurrences = -1\n let maxOccurenceCount = 0\n let sum = 0\n\n for (let i = 0; i < arr.length; i++) {\n const element = arr[i]\n const updatedCount = (frequencies[element] || 0) + 1\n frequencies[element] = updatedCount\n\n if (updatedCount > maxOccurrences) {\n maxOccurrences = updatedCount\n maxOccurenceCount = 0\n sum = 0\n }\n\n if (updatedCount >= maxOccurrences) {\n maxOccurenceCount++\n sum += element\n }\n }\n\n return sum / maxOccurenceCount\n}\n\n/**\n * Find the middle number in an Array of Numbers\n * Returns the average of 2 numbers if the Array length is an even number\n * @see https://github.com/angus-c/just/blob/684af9ca0c7808bc78543ec89379b1fdfce502b1/packages/array-median/index.js\n * @param {Array} arr - A sorted Array\n * @returns {Number} - The array's Median\n */\nfunction Median(arr) {\n const middle = arr.length / 2\n const lowerMiddleRank = Math.floor(middle)\n\n if (middle !== lowerMiddleRank) {\n return arr[lowerMiddleRank]\n }\n return (arr[lowerMiddleRank] + arr[lowerMiddleRank - 1]) / 2\n}\n\nclass AggregateCollection {\n constructor() {\n /** @type number[] */\n this._items = []\n }\n\n /**\n * Add a new Integer at the end of this AggregateCollection\n * @param {number} item - The item to add\n */\n push(item) {\n this._items.push(item)\n }\n\n size() {\n return this._items.length\n }\n\n aggregate() {\n if (this._items.length === 0) {\n return {\n min: 0,\n max: 0,\n mean: 0,\n mode: 0,\n median: 0,\n range: 0,\n sum: 0,\n }\n }\n\n // TODO: can we avoid this sort()? It's slow\n /** @type Number[] */\n const sorted = this._items.slice().sort((a, b) => a - b)\n const min = sorted[0]\n const max = sorted[sorted.length - 1]\n\n const sum = this._items.reduce((total, num) => (total += num))\n const mode = Mode(this._items)\n const median = Median(sorted)\n\n return {\n min,\n max,\n mean: sum / this._items.length,\n mode,\n median,\n range: max - min,\n sum,\n }\n }\n\n /**\n * @returns {number[]} All _items in this collection\n */\n toArray() {\n return this._items\n }\n}\n\nexport {\n AggregateCollection\n}","import { hasVendorPrefix } from '../vendor-prefix.js'\nimport { endsWith } from '../string-utils.js'\n\n/**\n * @param {string} property\n * @see https://github.com/csstree/csstree/blob/master/lib/utils/names.js#L69\n */\nexport function isHack(property) {\n if (isCustom(property) || hasVendorPrefix(property)) return false\n\n let code = property.charCodeAt(0)\n\n return code === 47 // /\n || code === 95 // _\n || code === 43 // +\n || code === 42 // *\n || code === 38 // &\n || code === 36 // $\n || code === 35 // #\n}\n\nexport function isCustom(property) {\n if (property.length < 3) return false\n // 45 === '-'.charCodeAt(0)\n return property.charCodeAt(0) === 45 && property.charCodeAt(1) === 45\n}\n\nexport function isProperty(basename, property) {\n if (isCustom(property)) return false\n return endsWith(basename, property)\n}","import parse from 'css-tree/parser'\nimport walk from 'css-tree/walker'\nimport { calculate } from '@bramus/specificity/core'\nimport { isSupportsBrowserhack, isMediaBrowserhack } from './atrules/atrules.js'\nimport { getComplexity, isAccessibility, compareSpecificity } from './selectors/utils.js'\nimport { colorFunctions, colorKeywords, namedColors, systemColors } from './values/colors.js'\nimport { isFontFamilyKeyword, getFamilyFromFont } from './values/font-families.js'\nimport { isFontSizeKeyword, getSizeFromFont } from './values/font-sizes.js'\nimport { isValueKeyword } from './values/values.js'\nimport { analyzeAnimation } from './values/animations.js'\nimport { isAstVendorPrefixed } from './values/vendor-prefix.js'\nimport { ContextCollection } from './context-collection.js'\nimport { CountableCollection } from './countable-collection.js'\nimport { AggregateCollection } from './aggregate-collection.js'\nimport { strEquals, startsWith, endsWith } from './string-utils.js'\nimport { hasVendorPrefix } from './vendor-prefix.js'\nimport { isCustom, isHack, isProperty } from './properties/property-utils.js'\nimport { getEmbedType } from './stylesheet/stylesheet.js'\n\nfunction ratio(part, total) {\n if (total === 0) return 0\n return part / total\n}\n\n/**\n * Analyze CSS\n * @param {string} css\n */\nconst analyze = (css) => {\n const start = Date.now()\n let lines = css.split(/\\r?\\n/g)\n\n /**\n * Recreate the authored CSS from a CSSTree node\n * @param {import('css-tree').CssNode} node - Node from CSSTree AST to stringify\n * @returns {string} str - The stringified node\n */\n function stringifyNode(node) {\n return css.substring(node.loc.start.offset, node.loc.end.offset)\n }\n\n // Stylesheet\n let totalComments = 0\n let commentsSize = 0\n const embeds = new CountableCollection()\n const embedTypes = {\n total: 0,\n totalUnique: 0,\n uniquenessRatio: 0,\n unique: {}\n }\n\n const startParse = Date.now()\n\n const ast = parse(css, {\n parseCustomProperty: true, // To find font-families, colors, etc.\n positions: true, // So we can use stringifyNode()\n onComment: function (comment) {\n totalComments++\n commentsSize += comment.length\n },\n })\n\n const startAnalysis = Date.now()\n\n // Atrules\n let totalAtRules = 0\n /** @type {string}[]} */\n const fontfaces = []\n const layers = new CountableCollection()\n const imports = new CountableCollection()\n const medias = new CountableCollection()\n const mediaBrowserhacks = new CountableCollection()\n const charsets = new CountableCollection()\n const supports = new CountableCollection()\n const supportsBrowserhacks = new CountableCollection()\n const keyframes = new CountableCollection()\n const prefixedKeyframes = new CountableCollection()\n const containers = new CountableCollection()\n\n // Rules\n let totalRules = 0\n let emptyRules = 0\n const ruleSizes = new AggregateCollection()\n const selectorsPerRule = new AggregateCollection()\n const declarationsPerRule = new AggregateCollection()\n\n // Selectors\n const keyframeSelectors = new CountableCollection()\n const uniqueSelectors = new Set()\n /** @type [number,number,number] */\n let maxSpecificity\n /** @type [number,number,number] */\n let minSpecificity\n const specificityA = new AggregateCollection()\n const specificityB = new AggregateCollection()\n const specificityC = new AggregateCollection()\n const uniqueSpecificities = new CountableCollection()\n const selectorComplexities = new AggregateCollection()\n /** @type [number,number,number][] */\n const specificities = []\n const ids = new CountableCollection()\n const a11y = new CountableCollection()\n\n // Declarations\n const uniqueDeclarations = new Set()\n let totalDeclarations = 0\n let importantDeclarations = 0\n let importantsInKeyframes = 0\n let importantCustomProperties = new CountableCollection()\n\n // Properties\n const properties = new CountableCollection()\n const propertyHacks = new CountableCollection()\n const propertyVendorPrefixes = new CountableCollection()\n const customProperties = new CountableCollection()\n const propertyComplexities = new AggregateCollection()\n\n // Values\n const vendorPrefixedValues = new CountableCollection()\n const valueBrowserhacks = new CountableCollection()\n const zindex = new CountableCollection()\n const textShadows = new CountableCollection()\n const boxShadows = new CountableCollection()\n const fontFamilies = new CountableCollection()\n const fontSizes = new CountableCollection()\n const timingFunctions = new CountableCollection()\n const durations = new CountableCollection()\n const colors = new ContextCollection()\n const colorFormats = new CountableCollection()\n const units = new ContextCollection()\n\n walk(ast, function (node) {\n switch (node.type) {\n case 'Atrule': {\n totalAtRules++\n const atRuleName = node.name\n\n if (atRuleName === 'font-face') {\n /** @type {[index: string]: string} */\n const descriptors = {}\n\n node.block.children.forEach(\n /** @param {import('css-tree').Declaration} descriptor */\n descriptor => (descriptors[descriptor.property] = stringifyNode(descriptor.value))\n )\n\n fontfaces.push(descriptors)\n break\n }\n\n if (atRuleName === 'media') {\n const prelude = stringifyNode(node.prelude).trim()\n medias.push(prelude)\n if (isMediaBrowserhack(node.prelude)) {\n mediaBrowserhacks.push(prelude)\n }\n break\n }\n if (atRuleName === 'supports') {\n const prelude = stringifyNode(node.prelude)\n supports.push(prelude)\n if (isSupportsBrowserhack(node.prelude)) {\n supportsBrowserhacks.push(prelude)\n }\n break\n }\n if (endsWith('keyframes', atRuleName)) {\n const name = '@' + atRuleName + ' ' + stringifyNode(node.prelude)\n if (hasVendorPrefix(atRuleName)) {\n prefixedKeyframes.push(name)\n }\n keyframes.push(name)\n break\n }\n if (atRuleName === 'import') {\n imports.push(stringifyNode(node.prelude))\n break\n }\n if (atRuleName === 'charset') {\n charsets.push(stringifyNode(node.prelude))\n break\n }\n if (atRuleName === 'container') {\n containers.push(stringifyNode(node.prelude))\n break\n }\n if (atRuleName === 'layer') {\n const prelude = stringifyNode(node.prelude)\n prelude.trim()\n .split(',')\n .forEach(name => layers.push(name.trim()))\n }\n break\n }\n case 'Rule': {\n const numSelectors = node.prelude.children ? node.prelude.children.size : 0\n const numDeclarations = node.block.children ? node.block.children.size : 0\n\n ruleSizes.push(numSelectors + numDeclarations)\n selectorsPerRule.push(numSelectors)\n declarationsPerRule.push(numDeclarations)\n\n totalRules++\n\n if (numDeclarations === 0) {\n emptyRules++\n }\n break\n }\n case 'Selector': {\n const selector = stringifyNode(node)\n\n if (this.atrule && endsWith('keyframes', this.atrule.name)) {\n keyframeSelectors.push(selector)\n return this.skip\n }\n\n const [{ value: specificityObj }] = calculate(node)\n const specificity = [specificityObj.a, specificityObj.b, specificityObj.c]\n\n if (specificity[0] > 0) {\n ids.push(selector)\n }\n\n if (isAccessibility(node)) {\n a11y.push(selector)\n }\n\n uniqueSelectors.add(selector)\n selectorComplexities.push(getComplexity(node))\n uniqueSpecificities.push(specificity)\n\n if (maxSpecificity === undefined) {\n maxSpecificity = specificity\n }\n\n if (minSpecificity === undefined) {\n minSpecificity = specificity\n }\n\n specificityA.push(specificity[0])\n specificityB.push(specificity[1])\n specificityC.push(specificity[2])\n\n if (minSpecificity !== undefined && compareSpecificity(minSpecificity, specificity) < 0) {\n minSpecificity = specificity\n }\n\n if (maxSpecificity !== undefined && compareSpecificity(maxSpecificity, specificity) > 0) {\n maxSpecificity = specificity\n }\n\n specificities.push(specificity)\n\n // Avoid deeper walking of selectors to not mess with\n // our specificity calculations in case of a selector\n // with :where() or :is() that contain SelectorLists\n // as children\n return this.skip\n }\n case 'Dimension': {\n if (!this.declaration) {\n break\n }\n\n units.push(node.unit, this.declaration.property)\n\n return this.skip\n }\n case 'Url': {\n if (startsWith('data:', node.value)) {\n var embed = node.value\n var size = embed.length\n var type = getEmbedType(embed)\n\n embedTypes.total++\n\n if (type in embedTypes.unique) {\n embedTypes.unique[type].count++\n embedTypes.unique[type].size += size\n } else {\n embedTypes.totalUnique++\n embedTypes.unique[type] = {\n count: 1,\n size,\n }\n }\n\n // @deprecated\n embeds.push(embed)\n }\n break\n }\n case 'Value': {\n if (isValueKeyword(node)) {\n break\n }\n\n const declaration = this.declaration\n const { property, important } = declaration\n\n if (isAstVendorPrefixed(node)) {\n vendorPrefixedValues.push(stringifyNode(node))\n }\n\n // i.e. `property: value !ie`\n if (typeof important === 'string') {\n valueBrowserhacks.push(stringifyNode(node) + '!' + important)\n }\n\n // i.e. `property: value\\9`\n if (node.children\n && node.children.last\n && node.children.last.type === 'Identifier'\n && endsWith('\\\\9', node.children.last.name)\n ) {\n valueBrowserhacks.push(stringifyNode(node))\n }\n\n // Process properties first that don't have colors,\n // so we can avoid further walking them;\n if (isProperty('z-index', property)) {\n if (!isValueKeyword(node)) {\n zindex.push(stringifyNode(node))\n }\n return this.skip\n } else if (isProperty('font', property)) {\n if (!isFontFamilyKeyword(node)) {\n fontFamilies.push(getFamilyFromFont(node, stringifyNode))\n }\n if (!isFontSizeKeyword(node)) {\n const size = getSizeFromFont(node)\n if (size) {\n fontSizes.push(size)\n }\n }\n break\n } else if (isProperty('font-size', property)) {\n if (!isFontSizeKeyword(node)) {\n fontSizes.push(stringifyNode(node))\n }\n break\n } else if (isProperty('font-family', property)) {\n if (!isFontFamilyKeyword(node)) {\n fontFamilies.push(stringifyNode(node))\n }\n break\n } else if (isProperty('transition', property) || isProperty('animation', property)) {\n const [times, fns] = analyzeAnimation(node.children, stringifyNode)\n for (let i = 0; i < times.length; i++) {\n durations.push(times[i])\n }\n for (let i = 0; i < fns.length; i++) {\n timingFunctions.push(fns[i])\n }\n break\n } else if (isProperty('animation-duration', property) || isProperty('transition-duration', property)) {\n durations.push(stringifyNode(node))\n break\n } else if (isProperty('transition-timing-function', property) || isProperty('animation-timing-function', property)) {\n timingFunctions.push(stringifyNode(node))\n break\n } else if (isProperty('text-shadow', property)) {\n if (!isValueKeyword(node)) {\n textShadows.push(stringifyNode(node))\n }\n // no break here: potentially contains colors\n } else if (isProperty('box-shadow', property)) {\n if (!isValueKeyword(node)) {\n boxShadows.push(stringifyNode(node))\n }\n // no break here: potentially contains colors\n }\n\n walk(node, function (valueNode) {\n switch (valueNode.type) {\n case 'Hash': {\n const hexLength = valueNode.value.length\n colors.push('#' + valueNode.value, property)\n colorFormats.push(`hex` + hexLength)\n\n return this.skip\n }\n case 'Identifier': {\n const { name } = valueNode\n // Bail out if it can't be a color name\n // 20 === 'lightgoldenrodyellow'.length\n // 3 === 'red'.length\n if (name.length > 20 || name.length < 3) {\n return this.skip\n }\n const stringified = stringifyNode(valueNode)\n const lowerCased = name.toLowerCase()\n\n if (namedColors.has(lowerCased)) {\n colors.push(stringified, property)\n colorFormats.push('named')\n } else if (colorKeywords.has(lowerCased)) {\n colors.push(stringified, property)\n colorFormats.push(lowerCased)\n } else if (systemColors.has(lowerCased)) {\n colors.push(stringified, property)\n colorFormats.push('system')\n }\n return this.skip\n }\n case 'Function': {\n // Don't walk var() multiple times\n if (strEquals('var', valueNode.name)) {\n return this.skip\n }\n const fnName = valueNode.name.toLowerCase()\n const stringified = stringifyNode(valueNode)\n if (colorFunctions.has(fnName)) {\n colors.push(stringified, property)\n colorFormats.push(fnName)\n }\n // No this.skip here intentionally,\n // otherwise we'll miss colors in linear-gradient() etc.\n }\n }\n })\n break\n }\n case 'Declaration': {\n // Do not process Declarations in atRule preludes\n // because we will handle them manually\n if (this.atrulePrelude !== null) {\n return this.skip\n }\n\n totalDeclarations++\n\n uniqueDeclarations.add(stringifyNode(node))\n\n if (node.important === true) {\n importantDeclarations++\n\n if (this.atrule && endsWith('keyframes', this.atrule.name)) {\n importantsInKeyframes++\n }\n }\n\n const { property } = node\n\n properties.push(property)\n\n if (hasVendorPrefix(property)) {\n propertyVendorPrefixes.push(property)\n propertyComplexities.push(2)\n } else if (isHack(property)) {\n propertyHacks.push(property)\n propertyComplexities.push(2)\n } else if (isCustom(property)) {\n customProperties.push(property)\n propertyComplexities.push(2)\n if (node.important === true) {\n importantCustomProperties.push(property)\n }\n } else {\n propertyComplexities.push(1)\n }\n break\n }\n }\n })\n\n const embeddedContent = embeds.count()\n const embedSize = Object.keys(embeddedContent.unique).join('').length\n\n const totalUniqueDeclarations = uniqueDeclarations.size\n\n const totalSelectors = selectorComplexities.size()\n const specificitiesA = specificityA.aggregate()\n const specificitiesB = specificityB.aggregate()\n const specificitiesC = specificityC.aggregate()\n const uniqueSpecificitiesCount = uniqueSpecificities.count()\n const complexityCount = new CountableCollection(selectorComplexities.toArray()).count()\n const totalUniqueSelectors = uniqueSelectors.size\n const uniqueRuleSize = new CountableCollection(ruleSizes.toArray()).count()\n const uniqueSelectorsPerRule = new CountableCollection(selectorsPerRule.toArray()).count()\n const uniqueDeclarationsPerRule = new CountableCollection(declarationsPerRule.toArray()).count()\n const assign = Object.assign\n\n return {\n stylesheet: {\n sourceLinesOfCode: totalAtRules + totalSelectors + totalDeclarations + keyframeSelectors.size(),\n linesOfCode: lines.length,\n size: css.length,\n comments: {\n total: totalComments,\n size: commentsSize,\n },\n embeddedContent: assign(embeddedContent, {\n size: {\n total: embedSize,\n ratio: ratio(embedSize, css.length),\n },\n types: assign(\n embedTypes,\n {\n uniquenessRatio: ratio(embedTypes.totalUnique, embedTypes.total)\n })\n }),\n },\n atrules: {\n fontface: {\n total: fontfaces.length,\n totalUnique: fontfaces.length,\n unique: fontfaces,\n uniquenessRatio: fontfaces.length === 0 ? 0 : 1\n },\n import: imports.count(),\n media: assign(\n medias.count(),\n {\n browserhacks: mediaBrowserhacks.count(),\n }\n ),\n charset: charsets.count(),\n supports: assign(\n supports.count(),\n {\n browserhacks: supportsBrowserhacks.count(),\n },\n ),\n keyframes: assign(\n keyframes.count(), {\n prefixed: assign(\n prefixedKeyframes.count(), {\n ratio: ratio(prefixedKeyframes.size(), keyframes.size())\n }),\n }),\n container: containers.count(),\n layer: layers.count(),\n },\n rules: {\n total: totalRules,\n empty: {\n total: emptyRules,\n ratio: ratio(emptyRules, totalRules)\n },\n sizes: assign(\n ruleSizes.aggregate(),\n {\n items: ruleSizes.toArray(),\n unique: uniqueRuleSize.unique,\n totalUnique: uniqueRuleSize.totalUnique,\n uniquenessRatio: uniqueRuleSize.uniquenessRatio\n },\n ),\n selectors: assign(\n selectorsPerRule.aggregate(),\n {\n items: selectorsPerRule.toArray(),\n unique: uniqueSelectorsPerRule.unique,\n totalUnique: uniqueSelectorsPerRule.totalUnique,\n uniquenessRatio: uniqueSelectorsPerRule.uniquenessRatio\n },\n ),\n declarations: assign(\n declarationsPerRule.aggregate(),\n {\n items: declarationsPerRule.toArray(),\n unique: uniqueDeclarationsPerRule.unique,\n totalUnique: uniqueDeclarationsPerRule.totalUnique,\n uniquenessRatio: uniqueDeclarationsPerRule.uniquenessRatio,\n },\n ),\n },\n selectors: {\n total: totalSelectors,\n totalUnique: totalUniqueSelectors,\n uniquenessRatio: ratio(totalUniqueSelectors, totalSelectors),\n specificity: {\n /** @type [number, number, number] */\n min: minSpecificity === undefined ? [0, 0, 0] : minSpecificity,\n /** @type [number, number, number] */\n max: maxSpecificity === undefined ? [0, 0, 0] : maxSpecificity,\n /** @type [number, number, number] */\n sum: [specificitiesA.sum, specificitiesB.sum, specificitiesC.sum],\n /** @type [number, number, number] */\n mean: [specificitiesA.mean, specificitiesB.mean, specificitiesC.mean],\n /** @type [number, number, number] */\n mode: [specificitiesA.mode, specificitiesB.mode, specificitiesC.mode],\n /** @type [number, number, number] */\n median: [specificitiesA.median, specificitiesB.median, specificitiesC.median],\n items: specificities,\n unique: uniqueSpecificitiesCount.unique,\n totalUnique: uniqueSpecificitiesCount.totalUnique,\n uniquenessRatio: uniqueSpecificitiesCount.uniquenessRatio,\n },\n complexity: assign(\n selectorComplexities.aggregate(),\n complexityCount, {\n items: selectorComplexities.toArray(),\n }),\n id: assign(\n ids.count(), {\n ratio: ratio(ids.size(), totalSelectors),\n }),\n accessibility: assign(\n a11y.count(), {\n ratio: ratio(a11y.size(), totalSelectors),\n }),\n keyframes: keyframeSelectors.count(),\n },\n declarations: {\n total: totalDeclarations,\n totalUnique: totalUniqueDeclarations,\n uniquenessRatio: ratio(totalUniqueDeclarations, totalDeclarations),\n // @TODO: deprecated, remove in next major version\n unique: {\n total: totalUniqueDeclarations,\n ratio: ratio(totalUniqueDeclarations, totalDeclarations),\n },\n importants: {\n total: importantDeclarations,\n ratio: ratio(importantDeclarations, totalDeclarations),\n inKeyframes: {\n total: importantsInKeyframes,\n ratio: ratio(importantsInKeyframes, importantDeclarations),\n },\n },\n },\n properties: assign(\n properties.count(),\n {\n prefixed: assign(\n propertyVendorPrefixes.count(),\n {\n ratio: ratio(propertyVendorPrefixes.size(), properties.size()),\n },\n ),\n custom: assign(\n customProperties.count(),\n {\n ratio: ratio(customProperties.size(), properties.size()),\n importants: assign(\n importantCustomProperties.count(),\n {\n ratio: ratio(importantCustomProperties.size(), customProperties.size()),\n }\n ),\n },\n ),\n browserhacks: assign(\n propertyHacks.count(), {\n ratio: ratio(propertyHacks.size(), properties.size()),\n }),\n complexity: propertyComplexities.aggregate(),\n }),\n values: {\n colors: assign(\n colors.count(),\n {\n formats: colorFormats.count(),\n },\n ),\n fontFamilies: fontFamilies.count(),\n fontSizes: fontSizes.count(),\n zindexes: zindex.count(),\n textShadows: textShadows.count(),\n boxShadows: boxShadows.count(),\n animations: {\n durations: durations.count(),\n timingFunctions: timingFunctions.count(),\n },\n prefixes: vendorPrefixedValues.count(),\n browserhacks: valueBrowserhacks.count(),\n units: units.count(),\n },\n __meta__: {\n parseTime: startAnalysis - startParse,\n analyzeTime: Date.now() - startAnalysis,\n total: Date.now() - start\n }\n }\n}\n\nexport {\n analyze,\n compareSpecificity,\n}\n","export function getEmbedType(embed) {\n\t// data:image/gif;base64,R0lG\n\tvar start = 5 // `data:`.length\n\tvar semicolon = embed.indexOf(';')\n\n\tif (semicolon === -1) {\n\t\tvar comma = embed.indexOf(',')\n\t\treturn embed.substring(start, comma)\n\t}\n\n\treturn embed.substring(start, semicolon)\n}"],"names":["compareChar","referenceCode","testCode","strEquals","base","test","length","i","charCodeAt","endsWith","offset","startsWith","isPropertyValue","node","property","value","children","first","type","name","hasVendorPrefix","keyword","indexOf","compareSpecificity","a","b","analyzeList","selectorListAst","cb","childSelectors","walk","visit","enter","push","isPseudoFunction","isAccessibility","selector","isA11y","list","some","skip","getComplexity","complexity","Boolean","selectorList","forEach","c","namedColors","Set","systemColors","colorFunctions","colorKeywords","systemKeywords","keywordDisallowList","isFontFamilyKeyword","firstChild","has","sizeKeywords","keywords","isFontSizeKeyword","isValueKeyword","size","timingKeywords","isAstVendorPrefixed","toArray","index","CountableCollection","initial","this","_items","_total","_totalUnique","item","count","total","totalUnique","unique","uniquenessRatio","ContextCollection","_list","_contexts","context","itemsPerContext","Object","assign","AggregateCollection","aggregate","min","max","mean","mode","median","range","sum","arr","middle","lowerMiddleRank","sorted","slice","sort","reduce","num","frequencies","create","maxOccurrences","maxOccurenceCount","element","updatedCount","Mode","Math","floor","isCustom","isProperty","basename","ratio","part","css","start","Date","now","lines","split","stringifyNode","substring","loc","end","maxSpecificity","minSpecificity","totalComments","commentsSize","embeds","embedTypes","startParse","ast","parse","parseCustomProperty","positions","onComment","comment","startAnalysis","totalAtRules","fontfaces","layers","imports","medias","mediaBrowserhacks","charsets","supports","supportsBrowserhacks","keyframes","prefixedKeyframes","containers","totalRules","emptyRules","ruleSizes","selectorsPerRule","declarationsPerRule","keyframeSelectors","uniqueSelectors","specificityA","specificityB","specificityC","uniqueSpecificities","selectorComplexities","specificities","ids","a11y","uniqueDeclarations","totalDeclarations","importantDeclarations","importantsInKeyframes","importantCustomProperties","properties","propertyHacks","propertyVendorPrefixes","customProperties","propertyComplexities","vendorPrefixedValues","valueBrowserhacks","zindex","textShadows","boxShadows","fontFamilies","fontSizes","timingFunctions","durations","colors","colorFormats","units","atRuleName","descriptors","block","descriptor","prelude","trim","returnValue","unit","isMediaBrowserhack","isSupportsBrowserhack","numSelectors","numDeclarations","atrule","specificityObj","calculate","specificity","add","undefined","declaration","embed","semicolon","comma","getEmbedType","important","last","parts","reverse","fontNode","quote","getFamilyFromFont","operator","getSizeFromFont","durationFound","child","analyzeAnimation","times","fns","valueNode","hexLength","stringified","lowerCased","toLowerCase","fnName","atrulePrelude","code","isHack","embeddedContent","embedSize","keys","join","totalUniqueDeclarations","totalSelectors","specificitiesA","specificitiesB","specificitiesC","uniqueSpecificitiesCount","complexityCount","totalUniqueSelectors","uniqueRuleSize","uniqueSelectorsPerRule","uniqueDeclarationsPerRule","stylesheet","sourceLinesOfCode","linesOfCode","comments","types","atrules","fontface","import","media","browserhacks","charset","prefixed","container","layer","rules","empty","sizes","items","selectors","declarations","id","accessibility","importants","inKeyframes","custom","values","formats","zindexes","animations","prefixes","__meta__","parseTime","analyzeTime"],"mappings":"wNAMA,SAASA,EAAYC,EAAeC,GAMlC,OAJIA,GAAY,IAAUA,GAAY,KAEpCA,GAAsB,IAEjBD,IAAkBC,CAC1B,UAQeC,EAAUC,EAAMC,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,SAAAC,UAAKJ,GAAcI,CAAlB,QACVN,IACb,EAEJ,GAEME,CACR,KClIYK,EAAc,IAAIC,IAAI,CAGjC,YACA,eACA,OACA,aACA,QACA,QACA,SACA,QACA,iBACA,OACA,aACA,QACA,YACA,YACA,aACA,YACA,QACA,iBACA,WACA,UACA,OACA,WACA,WACA,gBACA,WACA,YACA,WACA,YACA,cACA,iBACA,aACA,aACA,UACA,aACA,eACA,gBACA,gBACA,gBACA,gBACA,aACA,WACA,cACA,UACA,UACA,aACA,YACA,cACA,cACA,UACA,YACA,aACA,OACA,YACA,OACA,QACA,cACA,OACA,WACA,UACA,YACA,SACA,QACA,QACA,WACA,gBACA,YACA,eACA,YACA,aACA,YACA,uBACA,YACA,aACA,YACA,YACA,cACA,gBACA,eACA,iBACA,iBACA,iBACA,cACA,OACA,YACA,QACA,UACA,SACA,mBACA,aACA,eACA,eACA,iBACA,kBACA,oBACA,kBACA,kBACA,eACA,YACA,YACA,WACA,cACA,OACA,UACA,QACA,YACA,SACA,YACA,SACA,gBACA,YACA,gBACA,gBACA,aACA,YACA,OACA,OACA,OACA,aACA,SACA,gBACA,MACA,YACA,YACA,cACA,SACA,aACA,WACA,WACA,SACA,SACA,UACA,YACA,YACA,YACA,OACA,cACA,YACA,MACA,OACA,UACA,SACA,YACA,SACA,QACA,QACA,aACA,SACA,gBAGWC,EAAe,IAAID,IAAI,CAGlC,SACA,aACA,WACA,cACA,aACA,aACA,aACA,eACA,QACA,YACA,YACA,gBACA,eACA,mBACA,OACA,WACA,aAMWE,EAAiB,IAAIF,IAAI,CACpC,MACA,OACA,MACA,OACA,MACA,MACA,MACA,QACA,QACA,UAGWG,EAAgB,IAAIH,IAAI,CACnC,eACA,gBC/LII,EAAiB,IAAIJ,IAAI,CAE7B,UACA,UACA,QACA,SAGA,UACA,OACA,OACA,cACA,gBACA,eAGIK,EAAsB,IAAIL,IAAI,CAElC,SAGA,WACA,UACA,QACA,SACA,QACA,UACA,WACA,SACA,UAGA,OACA,S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AAcjF,GAAkBzG,QAChCmH,MAAOA,GAAMnH,SAEf+M,SAAU,CACRC,UAAW9I,EAAgBP,EAC3BsJ,YAAapK,KAAKC,MAAQoB,EAC1BjE,MAAO4C,KAAKC,MAAQF,GAGzB"}
@@ -1,2 +1,2 @@
1
- import e from"css-tree/parser";import t from"css-tree/walker";function n(e,t){return t>=65&&t<=90&&(t|=32),e===t}function i(e,t){const i=t.length-e.length;if(i<0)return!1;for(let r=t.length-1;r>=i;r--)if(!1===n(e.charCodeAt(r-i),t.charCodeAt(r)))return!1;return!0}function r(e,t){if(t.length<e.length)return!1;for(let i=0;i<e.length;i++)if(!1===n(e.charCodeAt(i),t.charCodeAt(i)))return!1;return!0}function a(e,t){return e[0]===t[0]?e[1]===t[1]?t[2]-e[2]:t[1]-e[1]:t[0]-e[0]}const s=e=>{let n=0,i=0,o=0,l=0,u=!1;return t(e,function(e){switch(e.type){case"IdSelector":n++,l++;break;case"ClassSelector":i++,l++;break;case"AttributeSelector":i++,l++,Boolean(e.value)&&l++,u="role"===e.name.name||r("aria-",e.name.name);break;case"PseudoElementSelector":case"TypeSelector":if(l++,42===e.name.charCodeAt(0)&&1===e.name.length)break;o++;break;case"PseudoClassSelector":switch(e.name){case"before":case"after":case"first-letter":case"first-line":return o++,l++,this.skip;case"where":case"is":case"has":case"matches":case"-webkit-any":case"-moz-any":case"not":case"nth-child":case"nth-last-child":{"nth-child"!==e.name&&"nth-last-child"!==e.name||i++;const r=function(e){const n=[];return t(e,{visit:"Selector",enter(e){n.push(s(e))}}),n.sort((e,t)=>a(e.specificity,t.specificity))}(e);if(0===r.length)return;if("where"!==e.name){const[e,t,a]=r[0].specificity;n+=e,i+=t,o+=a}for(let e=0;e<r.length;e++){const t=r[e];t.isA11y&&(u=!0),l+=t.complexity}return l++,this.skip}default:return l++,i++,this.skip}case"Combinator":l++}}),{specificity:[n,i,o],complexity:l,isId:n>0,isA11y:u}},o={aliceblue:1,antiquewhite:1,aqua:1,aquamarine:1,azure:1,beige:1,bisque:1,black:1,blanchedalmond:1,blue:1,blueviolet:1,brown:1,burlywood:1,cadetblue:1,chartreuse:1,chocolate:1,coral:1,cornflowerblue:1,cornsilk:1,crimson:1,cyan:1,darkblue:1,darkcyan:1,darkgoldenrod:1,darkgray:1,darkgreen:1,darkgrey:1,darkkhaki:1,darkmagenta:1,darkolivegreen:1,darkorange:1,darkorchid:1,darkred:1,darksalmon:1,darkseagreen:1,darkslateblue:1,darkslategray:1,darkslategrey:1,darkturquoise:1,darkviolet:1,deeppink:1,deepskyblue:1,dimgray:1,dimgrey:1,dodgerblue:1,firebrick:1,floralwhite:1,forestgreen:1,fuchsia:1,gainsboro:1,ghostwhite:1,gold:1,goldenrod:1,gray:1,green:1,greenyellow:1,grey:1,honeydew:1,hotpink:1,indianred:1,indigo:1,ivory:1,khaki:1,lavender:1,lavenderblush:1,lawngreen:1,lemonchiffon:1,lightblue:1,lightcoral:1,lightcyan:1,lightgoldenrodyellow:1,lightgray:1,lightgreen:1,lightgrey:1,lightpink:1,lightsalmon:1,lightseagreen:1,lightskyblue:1,lightslategray:1,lightslategrey:1,lightsteelblue:1,lightyellow:1,lime:1,limegreen:1,linen:1,magenta:1,maroon:1,mediumaquamarine:1,mediumblue:1,mediumorchid:1,mediumpurple:1,mediumseagreen:1,mediumslateblue:1,mediumspringgreen:1,mediumturquoise:1,mediumvioletred:1,midnightblue:1,mintcream:1,mistyrose:1,moccasin:1,navajowhite:1,navy:1,oldlace:1,olive:1,olivedrab:1,orange:1,orangered:1,orchid:1,palegoldenrod:1,palegreen:1,paleturquoise:1,palevioletred:1,papayawhip:1,peachpuff:1,peru:1,pink:1,plum:1,powderblue:1,purple:1,rebeccapurple:1,red:1,rosybrown:1,royalblue:1,saddlebrown:1,salmon:1,sandybrown:1,seagreen:1,seashell:1,sienna:1,silver:1,skyblue:1,slateblue:1,slategray:1,slategrey:1,snow:1,springgreen:1,steelblue:1,tan:1,teal:1,thistle:1,tomato:1,turquoise:1,violet:1,wheat:1,white:1,whitesmoke:1,yellow:1,yellowgreen:1,canvas:1,canvastext:1,linktext:1,visitedtext:1,activetext:1,buttonface:1,buttontext:1,buttonborder:1,field:1,fieldtext:1,highlight:1,highlighttext:1,selecteditem:1,selecteditemtext:1,mark:1,marktext:1,graytext:1},l={rgb:1,rgba:1,hsl:1,hsla:1,hwb:1,lab:1,lch:1,oklab:1,oklch:1,color:1},u={inherit:1,initial:1,unset:1,revert:1,caption:1,icon:1,menu:1,"message-box":1,"small-caption":1,"status-bar":1},c={normal:1,"xx-small":1,"x-small":1,small:1,medium:1,large:1,"x-large":1,"xx-large":1,larger:1,smaller:1,bold:1,bolder:1,lighter:1,"ultra-condensed":1,"extra-condensed":1,condensed:1,"semi-condensed":1,"semi-expanded":1,expanded:1,"extra-expanded":1,"ultra-expanded":1,italic:1,oblique:1};function d(e){const t=e.children.first;return"Identifier"===t.type&&u[t.name]}const h={"xx-small":1,"x-small":1,small:1,medium:1,large:1,"x-large":1,"xx-large":1,larger:1,smaller:1},m={inherit:1,initial:1,unset:1,revert:1,caption:1,icon:1,menu:1,"message-box":1,"small-caption":1,"status-bar":1};function f(e){const t=e.children.first;return"Identifier"===t.type&&m[t.name]}const b={auto:1,inherit:1,initial:1,unset:1,revert:1,none:1};function g(e){if(!e.children)return!1;const t=e.children.first;return!!t&&!(e.children.size>1)&&"Identifier"===t.type&&b[t.name]}const w={linear:1,ease:1,"ease-in":1,"ease-out":1,"ease-in-out":1,"step-start":1,"step-end":1};function p(e){return 45===e.charCodeAt(0)&&45!==e.charCodeAt(1)&&-1!==e.indexOf("-",2)}function k(e){if(!e.children)return!1;const t=e.children.toArray();for(let e=0;e<t.length;e++){const n=t[e],{type:i,name:r}=n;if("Identifier"===i&&p(r))return!0;if("Function"===i){if(p(r))return!0;if(k(n))return!0}}return!1}class y{constructor(e){if(this.t={},this.i=0,this.o=0,e)for(let t=0;t<e.length;t++)this.push(e[t])}push(e){this.i++,this.t[e]?this.t[e]++:(this.t[e]=1,this.o++)}size(){return this.i}count(){return{total:this.i,totalUnique:this.o,unique:this.t,uniquenessRatio:0===this.i?0:this.o/this.i}}}class x{constructor(){this.l=new y,this.u={}}push(e,t){this.l.push(e),this.u[t]||(this.u[t]=new y),this.u[t].push(e)}count(){const e={};for(let t in this.u)e[t]=this.u[t].count();return Object.assign(this.l.count(),{itemsPerContext:e})}}class v{constructor(){this.t=[]}add(e){this.t.push(e)}size(){return this.t.length}aggregate(){if(0===this.t.length)return{min:0,max:0,mean:0,mode:0,median:0,range:0,sum:0};const e=this.t.slice().sort((e,t)=>e-t),t=e[0],n=e[e.length-1],i=this.t.reduce((e,t)=>e+t),r=function(e){const t=Object.create(null);let n=-1,i=0,r=0;for(let a=0;a<e.length;a++){const s=e[a],o=(t[s]||0)+1;t[s]=o,o>n&&(n=o,i=0,r=0),o>=n&&(i++,r+=s)}return r/i}(this.t),a=function(e){const t=e.length/2,n=Math.floor(t);return t!==n?e[n]:(e[n]+e[n-1])/2}(e);return{min:t,max:n,mean:i/this.t.length,mode:r,median:a,range:n-t,sum:i}}toArray(){return this.t}}function q(e){return!(e.length<3)&&45===e.charCodeAt(0)&&45===e.charCodeAt(1)}function z(e,t){return!q(t)&&i(e,t)}class S{constructor(){this.t=Object.create(null)}push(e){return this.t[e]?this.t[e]++:this.t[e]=1}count(){return Object.keys(this.t).length}}const I=u=>{const m=new Date,b=u.split(/\r?\n/);function I(e){const t=e.loc.start,n=e.loc.end;if(0==n.line-t.line)return b[t.line-1].substring(t.column-1,n.column-1);let i="";for(let e=t.line;e<=n.line;e++){const r=b[e-1];i+=e!==t.line?e!==n.line?r+"\n":r.substring(0,n.column-1):r.substring(t.column-1)+"\n"}return i}let O=0,C=0;const D=new y,R=new Date,U=e(u,{parseAtrulePrelude:!1,parseCustomProperty:!0,positions:!0,onComment:function(e){O++,C+=e.length}}),j=new Date;let A=0;const F=[],P=new y,_=new y,T=new y,B=new y,E=new y,H=new y,K=new y,L=new y;let M=0,N=0;const V=new v,G=new v,J=new v,Q=new y,W=new S;let X,Y;const Z=new v,$=new v,ee=new v,te=new y,ne=new v,ie=[],re=new y,ae=new y,se=new S;let oe=0,le=0,ue=0;const ce=new y,de=new y,he=new y,me=new y,fe=new y,be=new y,ge=new y,we=new y,pe=new y,ke=new y,ye=new y,xe=new y,ve=new x,qe=new x;t(U,function(e){switch(e.type){case"Atrule":{A++;const t=e.name;if("font-face"===t){const t={};e.block.children.forEach(e=>t[e.property]=I(e.value)),F.push(t);break}if("media"===t){T.push(e.prelude.value);break}if("supports"===t){E.push(e.prelude.value);break}if(i("keyframes",t)){const n="@"+t+" "+e.prelude.value;p(t)&&K.push(n),H.push(n);break}if("import"===t){_.push(e.prelude.value);break}if("charset"===t){B.push(e.prelude.value);break}if("container"===t){L.push(e.prelude.value);break}"layer"===t&&L.push(e.prelude.value.trim().split(",").map(e=>e.trim()).forEach(e=>P.push(e)));break}case"Rule":{const t=e.prelude.children?e.prelude.children.size:0,n=e.block.children?e.block.children.size:0;V.add(t+n),G.add(t),J.add(n),M++,0===n&&N++;break}case"Selector":{const t=I(e);if(this.atrule&&i("keyframes",this.atrule.name))return Q.push(t),this.skip;const{specificity:n,complexity:r,isId:o,isA11y:l}=s(e);return o&&re.push(t),l&&ae.push(t),W.push(t),ne.add(r),te.push(n),void 0===X&&(X=n),void 0===Y&&(Y=n),Z.add(n[0]),$.add(n[1]),ee.add(n[2]),void 0!==Y&&a(Y,n)<0&&(Y=n),void 0!==X&&a(X,n)>0&&(X=n),ie.push(n),this.skip}case"Dimension":if(!this.declaration)break;return qe.push(e.unit,this.declaration.property),this.skip;case"Url":r("data:",e.value)&&D.push(e.value);break;case"Value":{if(g(e))break;const i=this.declaration.property;if(k(e)&&fe.push(I(e)),z("z-index",i))return g(e)||be.push(I(e)),this.skip;if(z("font",i)){if(d(e)||pe.push(function(e,n){let i="";return t(e,{reverse:!0,enter:function(e){if("String"===e.type){const t=e.loc.start,r=n({loc:{start:{line:t.line,column:t.column},end:{line:t.line,column:t.column+1}}});return i=r+e.value+r+i}return"Operator"===e.type&&44===e.value.charCodeAt(0)?i=e.value+i:"Identifier"===e.type?c[e.name]?this.skip:i=e.name+i:void 0}}),i}(e,I)),!f(e)){const n=function(e){let n,i=!1;return t(e,function(e){switch(e.type){case"Number":if(48===e.value.charCodeAt(0))return n="0",this.break;case"Operator":47===e.value.charCodeAt(0)&&(i=!0);break;case"Dimension":if(!i)return n=e.value+e.unit,this.break;case"Identifier":if(h[e.name])return n=e.name,this.break}}),n}(e);n&&ke.push(n)}break}if(z("font-size",i)){f(e)||ke.push(I(e));break}if(z("font-family",i)){d(e)||pe.push(I(e));break}if(z("transition",i)||z("animation",i)){const[t,n]=function(e,t){let n=!1;const i=[],r=[];return e.forEach(e=>"Operator"===e.type?n=!1:"Dimension"===e.type&&!1===n?(n=!0,i.push(t(e))):"Identifier"===e.type&&w[e.name]?r.push(t(e)):"Function"!==e.type||"cubic-bezier"!==e.name&&"steps"!==e.name?void 0:r.push(t(e))),[i,r]}(e.children,I);for(let e=0;e<t.length;e++)xe.push(t[e]);for(let e=0;e<n.length;e++)ye.push(n[e]);break}if(z("animation-duration",i)||z("transition-duration",i)){xe.push(I(e));break}if(z("transition-timing-function",i)||z("animation-timing-function",i)){ye.push(I(e));break}z("text-shadow",i)?g(e)||ge.push(I(e)):z("box-shadow",i)&&(g(e)||we.push(I(e))),t(e,function(e){switch(e.type){case"Hash":return ve.push("#"+e.value,i),this.skip;case"Identifier":{const{name:t}=e;return t.length>20||t.length<3||o[t.toLowerCase()]&&ve.push(I(e),i),this.skip}case"Function":if(function(e,t){if(e.length!==t.length)return!1;for(let i=0;i<e.length;i++)if(!1===n(e.charCodeAt(i),t.charCodeAt(i)))return!1;return!0}("var",e.name))return this.skip;l[e.name.toLowerCase()]&&ve.push(I(e),i)}});break}case"Declaration":{oe++;const t=I(e);se.push(t),e.important&&(le++,this.atrule&&i("keyframes",this.atrule.name)&&ue++);const{property:n}=e;ce.push(n),p(n)?he.push(n):function(e){if(q(e)||p(e))return!1;let t=e.charCodeAt(0);return 47===t||95===t||43===t||42===t||38===t||36===t||35===t}(n)?de.push(n):q(n)&&me.push(n);break}}});const ze=D.count(),Se=Object.keys(ze.unique).join("").length,Ie=se.count(),Oe=ne.size(),Ce=Z.aggregate(),De=$.aggregate(),Re=ee.aggregate(),Ue=te.count(),je=new y(ne.toArray()).count(),Ae=W.count(),Fe=new y(V.toArray()).count(),Pe=new y(G.toArray()).count(),_e=new y(J.toArray()).count(),Te=Object.assign;return{stylesheet:{sourceLinesOfCode:A+Oe+oe+Q.size(),linesOfCode:b.length,size:u.length,comments:{total:O,size:C},embeddedContent:Te(ze,{size:{total:Se,ratio:0===u.length?0:Se/u.length}})},atrules:{fontface:{total:F.length,totalUnique:F.length,unique:F,uniquenessRatio:0===F.length?0:1},import:_.count(),media:T.count(),charset:B.count(),supports:E.count(),keyframes:Te(H.count(),{prefixed:Te(K.count(),{ratio:0===H.size()?0:K.size()/H.size()})}),container:L.count(),layer:P.count()},rules:{total:M,empty:{total:N,ratio:0===M?0:N/M},sizes:Te(V.aggregate(),{items:V.toArray(),unique:Fe.unique,totalUnique:Fe.totalUnique,uniquenessRatio:Fe.uniquenessRatio}),selectors:Te(G.aggregate(),{items:G.toArray(),unique:Pe.unique,totalUnique:Pe.totalUnique,uniquenessRatio:Pe.uniquenessRatio}),declarations:Te(J.aggregate(),{items:J.toArray(),unique:_e.unique,totalUnique:_e.totalUnique,uniquenessRatio:_e.uniquenessRatio})},selectors:{total:Oe,totalUnique:Ae,uniquenessRatio:0===Oe?0:Ae/Oe,specificity:{min:void 0===Y?[0,0,0]:Y,max:void 0===X?[0,0,0]:X,sum:[Ce.sum,De.sum,Re.sum],mean:[Ce.mean,De.mean,Re.mean],mode:[Ce.mode,De.mode,Re.mode],median:[Ce.median,De.median,Re.median],items:ie,unique:Ue.unique,totalUnique:Ue.totalUnique,uniquenessRatio:Ue.uniquenessRatio},complexity:Te(ne.aggregate(),je,{items:ne.toArray()}),id:Te(re.count(),{ratio:0===Oe?0:re.size()/Oe}),accessibility:Te(ae.count(),{ratio:0===Oe?0:ae.size()/Oe}),keyframes:Q.count()},declarations:{total:oe,unique:{total:Ie,ratio:0===oe?0:Ie/oe},importants:{total:le,ratio:0===oe?0:le/oe,inKeyframes:{total:ue,ratio:0===le?0:ue/le}}},properties:Te(ce.count(),{prefixed:Te(he.count(),{ratio:0===ce.size()?0:he.size()/ce.size()}),custom:Te(me.count(),{ratio:0===ce.size()?0:me.size()/ce.size()}),browserhacks:Te(de.count(),{ratio:0===ce.size()?0:de.size()/ce.size()})}),values:{colors:ve.count(),fontFamilies:pe.count(),fontSizes:ke.count(),zindexes:be.count(),textShadows:ge.count(),boxShadows:we.count(),animations:{durations:xe.count(),timingFunctions:ye.count()},prefixes:fe.count(),units:qe.count()},__meta__:{parseTime:j-R,analyzeTime:new Date-j,total:new Date-m}}};export{I as analyze,a as compareSpecificity};
1
+ import e from"css-tree/parser";import t from"css-tree/walker";import{calculate as n}from"@bramus/specificity/core";function i(e,t){return t>=65&&t<=90&&(t|=32),e===t}function r(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!1===i(e.charCodeAt(n),t.charCodeAt(n)))return!1;return!0}function o(e,t){const n=t.length-e.length;if(n<0)return!1;for(let r=t.length-1;r>=n;r--)if(!1===i(e.charCodeAt(r-n),t.charCodeAt(r)))return!1;return!0}function a(e,t){if(t.length<e.length)return!1;for(let n=0;n<e.length;n++)if(!1===i(e.charCodeAt(n),t.charCodeAt(n)))return!1;return!0}function s(e,t,n){return r(t,e.property)&&"Identifier"===e.value.children.first.type&&r(n,e.value.children.first.name)}function u(e){return 45===e.charCodeAt(0)&&45!==e.charCodeAt(1)&&-1!==e.indexOf("-",2)}function l(e,t){return e[0]===t[0]?e[1]===t[1]?t[2]-e[2]:t[1]-e[1]:t[0]-e[0]}function c(e,n){const i=[];return t(e,{visit:"Selector",enter:function(e){i.push(n(e))}}),i}function f(e){return r(e,"not")||r(e,"nth-child")||r(e,"nth-last-child")||r(e,"where")||r(e,"is")||r(e,"has")||r(e,"matches")||r(e,"-webkit-any")||r(e,"-moz-any")}function d(e){let n=!1;return t(e,function(e){if("AttributeSelector"==e.type){if(r("role",e.name.name)||a("aria-",e.name.name))return n=!0,this.break}else if("PseudoClassSelector"==e.type&&f(e.name)){const t=c(e,d);if(0===t.length)return;return t.some(e=>1==e)?(n=!0,this.skip):this.skip}}),n}function m(e){let n=0;return t(e,function(e){if("Selector"!=e.type&&"Nth"!=e.type){if(n++,"IdSelector"!=e.type&&"ClassSelector"!=e.type&&"PseudoElementSelector"!=e.type&&"TypeSelector"!=e.type&&"PseudoClassSelector"!=e.type||u(e.name)&&n++,"AttributeSelector"==e.type)return Boolean(e.value)&&n++,u(e.name.name)&&n++,this.skip;if("PseudoClassSelector"==e.type&&f(e.name)){const t=c(e,m);if(0===t.length)return;return t.forEach(e=>n+=e),this.skip}}}),n}const h=new Set(["aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkgrey","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkslategrey","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dimgrey","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","green","greenyellow","grey","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgreen","lightgrey","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightslategrey","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","rebeccapurple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","slategrey","snow","springgreen","steelblue","tan","teal","thistle","tomato","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen"]),w=new Set(["canvas","canvastext","linktext","visitedtext","activetext","buttonface","buttontext","buttonborder","field","fieldtext","highlight","highlighttext","selecteditem","selecteditemtext","mark","marktext","graytext"]),g=new Set(["rgb","rgba","hsl","hsla","hwb","lab","lch","oklab","oklch","color"]),b=new Set(["currentcolor","transparent"]),p=new Set(["inherit","initial","unset","revert","caption","icon","menu","message-box","small-caption","status-bar"]),k=new Set(["normal","xx-small","x-small","small","medium","large","x-large","xx-large","larger","smaller","bold","bolder","lighter","ultra-condensed","extra-condensed","condensed","semi-condensed","semi-expanded","expanded","extra-expanded","ultra-expanded","italic","oblique"]);function y(e){const t=e.children.first;return"Identifier"===t.type&&p.has(t.name)}const x=new Set(["xx-small","x-small","small","medium","large","x-large","xx-large","larger","smaller"]),v=new Set(["inherit","initial","unset","revert","caption","icon","menu","message-box","small-caption","status-bar"]);function q(e){const t=e.children.first;return"Identifier"===t.type&&v.has(t.name)}const S=new Set(["auto","inherit","initial","unset","revert","none"]);function z(e){if(!e.children)return!1;const t=e.children.first;return!!t&&!(e.children.size>1)&&"Identifier"===t.type&&S.has(t.name)}const I=new Set(["linear","ease","ease-in","ease-out","ease-in-out","step-start","step-end"]);function R(e){if(!e.children)return!1;const t=e.children.toArray();for(let e=0;e<t.length;e++){const n=t[e],{type:i,name:r}=n;if("Identifier"===i&&u(r))return!0;if("Function"===i){if(u(r))return!0;if(R(n))return!0}}return!1}class C{constructor(e){if(this.t={},this.i=0,this.o=0,e)for(let t=0;t<e.length;t++)this.push(e[t])}push(e){this.i++,this.t[e]?this.t[e]++:(this.t[e]=1,this.o++)}size(){return this.i}count(){return{total:this.i,totalUnique:this.o,unique:this.t,uniquenessRatio:0===this.i?0:this.o/this.i}}}class D{constructor(){this.u=new C,this.l={}}push(e,t){this.u.push(e),this.l[t]||(this.l[t]=new C),this.l[t].push(e)}count(){const e={};for(let t in this.l)e[t]=this.l[t].count();return Object.assign(this.u.count(),{itemsPerContext:e})}}class U{constructor(){this.t=[]}push(e){this.t.push(e)}size(){return this.t.length}aggregate(){if(0===this.t.length)return{min:0,max:0,mean:0,mode:0,median:0,range:0,sum:0};const e=this.t.slice().sort((e,t)=>e-t),t=e[0],n=e[e.length-1],i=this.t.reduce((e,t)=>e+t),r=function(e){const t=Object.create(null);let n=-1,i=0,r=0;for(let o=0;o<e.length;o++){const a=e[o],s=(t[a]||0)+1;t[a]=s,s>n&&(n=s,i=0,r=0),s>=n&&(i++,r+=a)}return r/i}(this.t),o=function(e){const t=e.length/2,n=Math.floor(t);return t!==n?e[n]:(e[n]+e[n-1])/2}(e);return{min:t,max:n,mean:i/this.t.length,mode:r,median:o,range:n-t,sum:i}}toArray(){return this.t}}function O(e){return!(e.length<3)&&45===e.charCodeAt(0)&&45===e.charCodeAt(1)}function F(e,t){return!O(t)&&o(e,t)}function P(e,t){return 0===t?0:e/t}const j=i=>{const c=Date.now();let f=i.split(/\r?\n/g);function p(e){return i.substring(e.loc.start.offset,e.loc.end.offset)}let v=0,S=0;const j=new C,A={total:0,totalUnique:0,uniquenessRatio:0,unique:{}},_=Date.now(),M=e(i,{parseCustomProperty:!0,positions:!0,onComment:function(e){v++,S+=e.length}}),T=Date.now();let N=0;const B=[],E=new C,H=new C,K=new C,L=new C,Q=new C,V=new C,G=new C,J=new C,W=new C,X=new C;let Y=0,Z=0;const $=new U,ee=new U,te=new U,ne=new C,ie=new Set;let re,oe;const ae=new U,se=new U,ue=new U,le=new C,ce=new U,fe=[],de=new C,me=new C,he=new Set;let we=0,ge=0,be=0,pe=new C;const ke=new C,ye=new C,xe=new C,ve=new C,qe=new U,Se=new C,ze=new C,Ie=new C,Re=new C,Ce=new C,De=new C,Ue=new C,Oe=new C,Fe=new C,Pe=new D,je=new C,Ae=new D;t(M,function(e){switch(e.type){case"Atrule":{N++;const n=e.name;if("font-face"===n){const t={};e.block.children.forEach(e=>t[e.property]=p(e.value)),B.push(t);break}if("media"===n){const n=p(e.prelude).trim();K.push(n),function(e){let n=!1;return t(e,function(e){if("MediaQuery"===e.type&&1===e.children.size&&"Identifier"===e.children.first.type&&(a("\\0",(e=e.children.first).name)||o("\\9 ",e.name)))return n=!0,this.break;if("MediaFeature"===e.type){if(null!==e.value&&"\\0"===e.value.unit)return n=!0,this.break;if(r("-moz-images-in-menus",e.name)||r("min--moz-device-pixel-ratio",e.name)||r("-ms-high-contrast",e.name))return n=!0,this.break;if(r("min-resolution",e.name)&&r(".001",e.value.value)&&r("dpcm",e.value.unit))return n=!0,this.break;if(r("-webkit-min-device-pixel-ratio",e.name)&&(r("0",e.value.value)||r("10000",e.value.value)))return n=!0,this.break}}),n}(e.prelude)&&L.push(n);break}if("supports"===n){const n=p(e.prelude);V.push(n),function(e){let n=!1;return t(e,function(e){if("Declaration"===e.type&&(s(e,"-webkit-appearance","none")||s(e,"-moz-appearance","meterbar")))return n=!0,this.break}),n}(e.prelude)&&G.push(n);break}if(o("keyframes",n)){const t="@"+n+" "+p(e.prelude);u(n)&&W.push(t),J.push(t);break}if("import"===n){H.push(p(e.prelude));break}if("charset"===n){Q.push(p(e.prelude));break}if("container"===n){X.push(p(e.prelude));break}"layer"===n&&p(e.prelude).trim().split(",").forEach(e=>E.push(e.trim()));break}case"Rule":{const t=e.prelude.children?e.prelude.children.size:0,n=e.block.children?e.block.children.size:0;$.push(t+n),ee.push(t),te.push(n),Y++,0===n&&Z++;break}case"Selector":{const t=p(e);if(this.atrule&&o("keyframes",this.atrule.name))return ne.push(t),this.skip;const[{value:i}]=n(e),r=[i.a,i.b,i.c];return r[0]>0&&de.push(t),d(e)&&me.push(t),ie.add(t),ce.push(m(e)),le.push(r),void 0===re&&(re=r),void 0===oe&&(oe=r),ae.push(r[0]),se.push(r[1]),ue.push(r[2]),void 0!==oe&&l(oe,r)<0&&(oe=r),void 0!==re&&l(re,r)>0&&(re=r),fe.push(r),this.skip}case"Dimension":if(!this.declaration)break;return Ae.push(e.unit,this.declaration.property),this.skip;case"Url":if(a("data:",e.value)){var i=e.value,c=i.length,f=function(e){var t=e.indexOf(";");if(-1===t){var n=e.indexOf(",");return e.substring(5,n)}return e.substring(5,t)}(i);A.total++,f in A.unique?(A.unique[f].count++,A.unique[f].size+=c):(A.totalUnique++,A.unique[f]={count:1,size:c}),j.push(i)}break;case"Value":{if(z(e))break;const n=this.declaration,{property:i,important:a}=n;if(R(e)&&Se.push(p(e)),"string"==typeof a&&ze.push(p(e)+"!"+a),e.children&&e.children.last&&"Identifier"===e.children.last.type&&o("\\9",e.children.last.name)&&ze.push(p(e)),F("z-index",i))return z(e)||Ie.push(p(e)),this.skip;if(F("font",i)){if(y(e)||De.push(function(e,n){let i="";return t(e,{reverse:!0,enter:function(e){if("String"===e.type){const t=e.loc.start.offset,r=n({loc:{start:{offset:t},end:{offset:t+1}}});return i=r+e.value+r+i}return"Operator"===e.type&&44===e.value.charCodeAt(0)?i=e.value+i:"Identifier"===e.type?k.has(e.name)?this.skip:i=e.name+i:void 0}}),i}(e,p)),!q(e)){const n=function(e){let n,i=!1;return t(e,function(e){switch(e.type){case"Number":if(48===e.value.charCodeAt(0))return n="0",this.break;case"Operator":47===e.value.charCodeAt(0)&&(i=!0);break;case"Dimension":if(!i)return n=e.value+e.unit,this.break;case"Identifier":if(x.has(e.name))return n=e.name,this.break}}),n}(e);n&&Ue.push(n)}break}if(F("font-size",i)){q(e)||Ue.push(p(e));break}if(F("font-family",i)){y(e)||De.push(p(e));break}if(F("transition",i)||F("animation",i)){const[t,n]=function(e,t){let n=!1;const i=[],r=[];return e.forEach(e=>"Operator"===e.type?n=!1:"Dimension"===e.type&&!1===n?(n=!0,i.push(t(e))):"Identifier"===e.type&&I.has(e.name)?r.push(t(e)):"Function"!==e.type||"cubic-bezier"!==e.name&&"steps"!==e.name?void 0:r.push(t(e))),[i,r]}(e.children,p);for(let e=0;e<t.length;e++)Fe.push(t[e]);for(let e=0;e<n.length;e++)Oe.push(n[e]);break}if(F("animation-duration",i)||F("transition-duration",i)){Fe.push(p(e));break}if(F("transition-timing-function",i)||F("animation-timing-function",i)){Oe.push(p(e));break}F("text-shadow",i)?z(e)||Re.push(p(e)):F("box-shadow",i)&&(z(e)||Ce.push(p(e))),t(e,function(e){switch(e.type){case"Hash":{const t=e.value.length;return Pe.push("#"+e.value,i),je.push("hex"+t),this.skip}case"Identifier":{const{name:t}=e;if(t.length>20||t.length<3)return this.skip;const n=p(e),r=t.toLowerCase();return h.has(r)?(Pe.push(n,i),je.push("named")):b.has(r)?(Pe.push(n,i),je.push(r)):w.has(r)&&(Pe.push(n,i),je.push("system")),this.skip}case"Function":{if(r("var",e.name))return this.skip;const t=e.name.toLowerCase(),n=p(e);g.has(t)&&(Pe.push(n,i),je.push(t))}}});break}case"Declaration":{if(null!==this.atrulePrelude)return this.skip;we++,he.add(p(e)),!0===e.important&&(ge++,this.atrule&&o("keyframes",this.atrule.name)&&be++);const{property:t}=e;ke.push(t),u(t)?(xe.push(t),qe.push(2)):function(e){if(O(e)||u(e))return!1;let t=e.charCodeAt(0);return 47===t||95===t||43===t||42===t||38===t||36===t||35===t}(t)?(ye.push(t),qe.push(2)):O(t)?(ve.push(t),qe.push(2),!0===e.important&&pe.push(t)):qe.push(1);break}}});const _e=j.count(),Me=Object.keys(_e.unique).join("").length,Te=he.size,Ne=ce.size(),Be=ae.aggregate(),Ee=se.aggregate(),He=ue.aggregate(),Ke=le.count(),Le=new C(ce.toArray()).count(),Qe=ie.size,Ve=new C($.toArray()).count(),Ge=new C(ee.toArray()).count(),Je=new C(te.toArray()).count(),We=Object.assign;return{stylesheet:{sourceLinesOfCode:N+Ne+we+ne.size(),linesOfCode:f.length,size:i.length,comments:{total:v,size:S},embeddedContent:We(_e,{size:{total:Me,ratio:P(Me,i.length)},types:We(A,{uniquenessRatio:P(A.totalUnique,A.total)})})},atrules:{fontface:{total:B.length,totalUnique:B.length,unique:B,uniquenessRatio:0===B.length?0:1},import:H.count(),media:We(K.count(),{browserhacks:L.count()}),charset:Q.count(),supports:We(V.count(),{browserhacks:G.count()}),keyframes:We(J.count(),{prefixed:We(W.count(),{ratio:P(W.size(),J.size())})}),container:X.count(),layer:E.count()},rules:{total:Y,empty:{total:Z,ratio:P(Z,Y)},sizes:We($.aggregate(),{items:$.toArray(),unique:Ve.unique,totalUnique:Ve.totalUnique,uniquenessRatio:Ve.uniquenessRatio}),selectors:We(ee.aggregate(),{items:ee.toArray(),unique:Ge.unique,totalUnique:Ge.totalUnique,uniquenessRatio:Ge.uniquenessRatio}),declarations:We(te.aggregate(),{items:te.toArray(),unique:Je.unique,totalUnique:Je.totalUnique,uniquenessRatio:Je.uniquenessRatio})},selectors:{total:Ne,totalUnique:Qe,uniquenessRatio:P(Qe,Ne),specificity:{min:void 0===oe?[0,0,0]:oe,max:void 0===re?[0,0,0]:re,sum:[Be.sum,Ee.sum,He.sum],mean:[Be.mean,Ee.mean,He.mean],mode:[Be.mode,Ee.mode,He.mode],median:[Be.median,Ee.median,He.median],items:fe,unique:Ke.unique,totalUnique:Ke.totalUnique,uniquenessRatio:Ke.uniquenessRatio},complexity:We(ce.aggregate(),Le,{items:ce.toArray()}),id:We(de.count(),{ratio:P(de.size(),Ne)}),accessibility:We(me.count(),{ratio:P(me.size(),Ne)}),keyframes:ne.count()},declarations:{total:we,totalUnique:Te,uniquenessRatio:P(Te,we),unique:{total:Te,ratio:P(Te,we)},importants:{total:ge,ratio:P(ge,we),inKeyframes:{total:be,ratio:P(be,ge)}}},properties:We(ke.count(),{prefixed:We(xe.count(),{ratio:P(xe.size(),ke.size())}),custom:We(ve.count(),{ratio:P(ve.size(),ke.size()),importants:We(pe.count(),{ratio:P(pe.size(),ve.size())})}),browserhacks:We(ye.count(),{ratio:P(ye.size(),ke.size())}),complexity:qe.aggregate()}),values:{colors:We(Pe.count(),{formats:je.count()}),fontFamilies:De.count(),fontSizes:Ue.count(),zindexes:Ie.count(),textShadows:Re.count(),boxShadows:Ce.count(),animations:{durations:Fe.count(),timingFunctions:Oe.count()},prefixes:Se.count(),browserhacks:ze.count(),units:Ae.count()},__meta__:{parseTime:T-_,analyzeTime:Date.now()-T,total:Date.now()-c}}};export{j as analyze,l as compareSpecificity};
2
2
  //# sourceMappingURL=analyzer.modern.js.map