css-tree-animatable
Version:
Fork of css-tree with all but animatable CSS properties removed
1 lines • 123 kB
JavaScript
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).csstree=t()}(this,(function(){"use strict";function e(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var t,n,r,a,i,s,o,c,l,u,h,p,f,d,y,g,m,k,x,v,b,S,C,w,A,T,P,L,E,D,O,B,I,N,R,M,F,W,z,Y,U,j,q,H,V,K,Q,G,X,_,Z,$,J,ee,te,ne,re,ae,ie,se,oe,ce,le,ue,he,pe,fe,de,ye,ge,me,ke={};function xe(){if(n)return t;function e(e){return{prev:null,next:null,data:e}}function r(e,t,n){var r;return null!==i?(r=i,i=i.cursor,r.prev=t,r.next=n,r.cursor=e.cursor):r={prev:t,next:n,cursor:e.cursor},e.cursor=r,r}function a(e){var t=e.cursor;e.cursor=t.cursor,t.prev=null,t.next=null,t.cursor=i,i=t}n=1;var i=null,s=function(){this.cursor=null,this.head=null,this.tail=null};return s.createItem=e,s.prototype.createItem=e,s.prototype.updateCursors=function(e,t,n,r){for(var a=this.cursor;null!==a;)a.prev===e&&(a.prev=t),a.next===n&&(a.next=r),a=a.cursor},s.prototype.getSize=function(){for(var e=0,t=this.head;t;)e++,t=t.next;return e},s.prototype.fromArray=function(t){var n=null;this.head=null;for(var r=0;r<t.length;r++){var a=e(t[r]);null!==n?n.next=a:this.head=a,a.prev=n,n=a}return this.tail=n,this},s.prototype.toArray=function(){for(var e=this.head,t=[];e;)t.push(e.data),e=e.next;return t},s.prototype.toJSON=s.prototype.toArray,s.prototype.isEmpty=function(){return null===this.head},s.prototype.first=function(){return this.head&&this.head.data},s.prototype.last=function(){return this.tail&&this.tail.data},s.prototype.each=function(e,t){var n;void 0===t&&(t=this);for(var i=r(this,null,this.head);null!==i.next;)n=i.next,i.next=n.next,e.call(t,n.data,n,this);a(this)},s.prototype.forEach=s.prototype.each,s.prototype.eachRight=function(e,t){var n;void 0===t&&(t=this);for(var i=r(this,this.tail,null);null!==i.prev;)n=i.prev,i.prev=n.prev,e.call(t,n.data,n,this);a(this)},s.prototype.forEachRight=s.prototype.eachRight,s.prototype.nextUntil=function(e,t,n){if(null!==e){var i;void 0===n&&(n=this);for(var s=r(this,null,e);null!==s.next&&(i=s.next,s.next=i.next,!t.call(n,i.data,i,this)););a(this)}},s.prototype.prevUntil=function(e,t,n){if(null!==e){var i;void 0===n&&(n=this);for(var s=r(this,e,null);null!==s.prev&&(i=s.prev,s.prev=i.prev,!t.call(n,i.data,i,this)););a(this)}},s.prototype.some=function(e,t){var n=this.head;for(void 0===t&&(t=this);null!==n;){if(e.call(t,n.data,n,this))return!0;n=n.next}return!1},s.prototype.map=function(e,t){var n=new s,r=this.head;for(void 0===t&&(t=this);null!==r;)n.appendData(e.call(t,r.data,r,this)),r=r.next;return n},s.prototype.filter=function(e,t){var n=new s,r=this.head;for(void 0===t&&(t=this);null!==r;)e.call(t,r.data,r,this)&&n.appendData(r.data),r=r.next;return n},s.prototype.clear=function(){this.head=null,this.tail=null},s.prototype.copy=function(){for(var t=new s,n=this.head;null!==n;)t.insert(e(n.data)),n=n.next;return t},s.prototype.prepend=function(e){return this.updateCursors(null,e,this.head,e),null!==this.head?(this.head.prev=e,e.next=this.head):this.tail=e,this.head=e,this},s.prototype.prependData=function(t){return this.prepend(e(t))},s.prototype.append=function(e){return this.insert(e)},s.prototype.appendData=function(t){return this.insert(e(t))},s.prototype.insert=function(e,t){if(null!=t)if(this.updateCursors(t.prev,e,t,e),null===t.prev){if(this.head!==t)throw new Error("before doesn't belong to list");this.head=e,t.prev=e,e.next=t,this.updateCursors(null,e)}else t.prev.next=e,e.prev=t.prev,t.prev=e,e.next=t;else this.updateCursors(this.tail,e,null,e),null!==this.tail?(this.tail.next=e,e.prev=this.tail):this.head=e,this.tail=e;return this},s.prototype.insertData=function(t,n){return this.insert(e(t),n)},s.prototype.remove=function(e){if(this.updateCursors(e,e.prev,e,e.next),null!==e.prev)e.prev.next=e.next;else{if(this.head!==e)throw new Error("item doesn't belong to list");this.head=e.next}if(null!==e.next)e.next.prev=e.prev;else{if(this.tail!==e)throw new Error("item doesn't belong to list");this.tail=e.prev}return e.prev=null,e.next=null,e},s.prototype.push=function(t){this.insert(e(t))},s.prototype.pop=function(){if(null!==this.tail)return this.remove(this.tail)},s.prototype.unshift=function(t){this.prepend(e(t))},s.prototype.shift=function(){if(null!==this.head)return this.remove(this.head)},s.prototype.prependList=function(e){return this.insertList(e,this.head)},s.prototype.appendList=function(e){return this.insertList(e)},s.prototype.insertList=function(e,t){return null===e.head||(null!=t?(this.updateCursors(t.prev,e.tail,t,e.head),null!==t.prev?(t.prev.next=e.head,e.head.prev=t.prev):this.head=e.head,t.prev=e.tail,e.tail.next=t):(this.updateCursors(this.tail,e.tail,null,e.head),null!==this.tail?(this.tail.next=e.head,e.head.prev=this.tail):this.head=e.head,this.tail=e.tail),e.head=null,e.tail=null),this},s.prototype.replace=function(e,t){"head"in t?this.insertList(t,e):this.insert(t,e),this.remove(e)},t=s}function ve(){return a?r:(a=1,r=function(e,t){var n=Object.create(SyntaxError.prototype),r=new Error;return n.name=e,n.message=t,Object.defineProperty(n,"stack",{get:function(){return(r.stack||"").replace(/^(.+\n){1,3}/,e+": "+t+"\n")}}),n})}function be(){if(s)return i;s=1;var e=ve(),t=" ";function n(e,n){function r(e,t){return a.slice(e,t).map((function(t,n){for(var r=String(e+n+1);r.length<l;)r=" "+r;return r+" |"+t})).join("\n")}var a=e.source.split(/\r\n?|\n|\f/),i=e.line,s=e.column,o=Math.max(1,i-n)-1,c=Math.min(i+n,a.length+1),l=Math.max(4,String(c).length)+1,u=0;(s+=(t.length-1)*(a[i-1].substr(0,s-1).match(/\t/g)||[]).length)>100&&(u=s-60+3,s=58);for(var h=o;h<=c;h++)h>=0&&h<a.length&&(a[h]=a[h].replace(/\t/g,t),a[h]=(u>0&&a[h].length>u?"…":"")+a[h].substr(u,98)+(a[h].length>u+100-1?"…":""));return[r(o,i),new Array(s+l+2).join("-")+"^",r(i,c)].filter(Boolean).join("\n")}return i=function(t,r,a,i,s){var o=e("SyntaxError",t);return o.source=r,o.offset=a,o.line=i,o.column=s,o.sourceFragment=function(e){return n(o,isNaN(e)?0:e)},Object.defineProperty(o,"formattedMessage",{get:function(){return"Parse error: "+o.message+"\n"+n(o,2)}}),o.parseError={offset:a,line:i,column:s},o}}function Se(){if(c)return o;c=1;var e={EOF:0,Ident:1,Function:2,AtKeyword:3,Hash:4,String:5,BadString:6,Url:7,BadUrl:8,Delim:9,Number:10,Percentage:11,Dimension:12,WhiteSpace:13,CDO:14,CDC:15,Colon:16,Semicolon:17,Comma:18,LeftSquareBracket:19,RightSquareBracket:20,LeftParenthesis:21,RightParenthesis:22,LeftCurlyBracket:23,RightCurlyBracket:24,Comment:25},t=Object.keys(e).reduce((function(t,n){return t[e[n]]=n,t}),{});return o={TYPE:e,NAME:t}}function Ce(){if(u)return l;u=1;function e(e){return e>=48&&e<=57}function t(e){return e>=65&&e<=90}function n(e){return e>=97&&e<=122}function r(e){return t(e)||n(e)}function a(e){return e>=128}function i(e){return r(e)||a(e)||95===e}function s(e){return e>=0&&e<=8||11===e||e>=14&&e<=31||127===e}function o(e){return 10===e||13===e||12===e}function c(e){return o(e)||32===e||9===e}function h(e,t){return 92===e&&(!o(t)&&0!==t)}var p=new Array(128);d.Eof=128,d.WhiteSpace=130,d.Digit=131,d.NameStart=132,d.NonPrintable=133;for(var f=0;f<p.length;f++)switch(!0){case c(f):p[f]=d.WhiteSpace;break;case e(f):p[f]=d.Digit;break;case i(f):p[f]=d.NameStart;break;case s(f):p[f]=d.NonPrintable;break;default:p[f]=f||d.Eof}function d(e){return e<128?p[e]:d.NameStart}return l={isDigit:e,isHexDigit:function(t){return e(t)||t>=65&&t<=70||t>=97&&t<=102},isUppercaseLetter:t,isLowercaseLetter:n,isLetter:r,isNonAscii:a,isNameStart:i,isName:function(t){return i(t)||e(t)||45===t},isNonPrintable:s,isNewline:o,isWhiteSpace:c,isValidEscape:h,isIdentifierStart:function(e,t,n){return 45===e?i(t)||45===t||h(t,n):!!i(e)||92===e&&h(e,t)},isNumberStart:function(t,n,r){return 43===t||45===t?e(n)?2:46===n&&e(r)?3:0:46===t?e(n)?2:0:e(t)?1:0},isBOM:function(e){return 65279===e||65534===e?1:0},charCodeCategory:d}}function we(){if(p)return h;p=1;var e=Ce(),t=e.isDigit,n=e.isHexDigit,r=e.isUppercaseLetter,a=e.isName,i=e.isWhiteSpace,s=e.isValidEscape;function o(e,t){return t<e.length?e.charCodeAt(t):0}function c(e,t,n){return 13===n&&10===o(e,t+1)?2:1}function l(e,t,n){var a=e.charCodeAt(t);return r(a)&&(a|=32),a===n}function u(e,n){for(;n<e.length&&t(e.charCodeAt(n));n++);return n}function f(e,t){if(n(o(e,(t+=2)-1))){for(var r=Math.min(e.length,t+5);t<r&&n(o(e,t));t++);var a=o(e,t);i(a)&&(t+=c(e,t,a))}return t}return h={consumeEscaped:f,consumeName:function(e,t){for(;t<e.length;t++){var n=e.charCodeAt(t);if(!a(n)){if(!s(n,o(e,t+1)))break;t=f(e,t)-1}}return t},consumeNumber:function(e,n){var r=e.charCodeAt(n);if(43!==r&&45!==r||(r=e.charCodeAt(n+=1)),t(r)&&(n=u(e,n+1),r=e.charCodeAt(n)),46===r&&t(e.charCodeAt(n+1))&&(r=e.charCodeAt(n+=2),n=u(e,n)),l(e,n,101)){var a=0;45!==(r=e.charCodeAt(n+1))&&43!==r||(a=1,r=e.charCodeAt(n+2)),t(r)&&(n=u(e,n+1+a+1))}return n},consumeBadUrlRemnants:function(e,t){for(;t<e.length;t++){var n=e.charCodeAt(t);if(41===n){t++;break}s(n,o(e,t+1))&&(t=f(e,t))}return t},cmpChar:l,cmpStr:function(e,t,n,a){if(n-t!==a.length)return!1;if(t<0||n>e.length)return!1;for(var i=t;i<n;i++){var s=e.charCodeAt(i),o=a.charCodeAt(i-t);if(r(s)&&(s|=32),s!==o)return!1}return!0},getNewlineLength:c,findWhiteSpaceStart:function(e,t){for(;t>=0&&i(e.charCodeAt(t));t--);return t+1},findWhiteSpaceEnd:function(e,t){for(;t<e.length&&i(e.charCodeAt(t));t++);return t}}}function Ae(){if(d)return f;d=1;var e=Se(),t=e.TYPE,n=e.NAME,r=we().cmpStr,a=t.EOF,i=t.WhiteSpace,s=t.Comment,o=16777215,c=24,l=function(){this.offsetAndType=null,this.balance=null,this.reset()};return l.prototype={reset:function(){this.eof=!1,this.tokenIndex=-1,this.tokenType=0,this.tokenStart=this.firstCharOffset,this.tokenEnd=this.firstCharOffset},lookupType:function(e){return(e+=this.tokenIndex)<this.tokenCount?this.offsetAndType[e]>>c:a},lookupOffset:function(e){return(e+=this.tokenIndex)<this.tokenCount?this.offsetAndType[e-1]&o:this.source.length},lookupValue:function(e,t){return(e+=this.tokenIndex)<this.tokenCount&&r(this.source,this.offsetAndType[e-1]&o,this.offsetAndType[e]&o,t)},getTokenStart:function(e){return e===this.tokenIndex?this.tokenStart:e>0?e<this.tokenCount?this.offsetAndType[e-1]&o:this.offsetAndType[this.tokenCount]&o:this.firstCharOffset},getRawLength:function(e,t){var n,r=e,a=this.offsetAndType[Math.max(r-1,0)]&o;e:for(;r<this.tokenCount&&!((n=this.balance[r])<e);r++)switch(t(this.offsetAndType[r]>>c,this.source,a)){case 1:break e;case 2:r++;break e;default:a=this.offsetAndType[r]&o,this.balance[n]===r&&(r=n)}return r-this.tokenIndex},isBalanceEdge:function(e){return this.balance[this.tokenIndex]<e},isDelim:function(e,n){return n?this.lookupType(n)===t.Delim&&this.source.charCodeAt(this.lookupOffset(n))===e:this.tokenType===t.Delim&&this.source.charCodeAt(this.tokenStart)===e},getTokenValue:function(){return this.source.substring(this.tokenStart,this.tokenEnd)},getTokenLength:function(){return this.tokenEnd-this.tokenStart},substrToCursor:function(e){return this.source.substring(e,this.tokenStart)},skipWS:function(){for(var e=this.tokenIndex,t=0;e<this.tokenCount&&this.offsetAndType[e]>>c===i;e++,t++);t>0&&this.skip(t)},skipSC:function(){for(;this.tokenType===i||this.tokenType===s;)this.next()},skip:function(e){var t=this.tokenIndex+e;t<this.tokenCount?(this.tokenIndex=t,this.tokenStart=this.offsetAndType[t-1]&o,t=this.offsetAndType[t],this.tokenType=t>>c,this.tokenEnd=t&o):(this.tokenIndex=this.tokenCount,this.next())},next:function(){var e=this.tokenIndex+1;e<this.tokenCount?(this.tokenIndex=e,this.tokenStart=this.tokenEnd,e=this.offsetAndType[e],this.tokenType=e>>c,this.tokenEnd=e&o):(this.tokenIndex=this.tokenCount,this.eof=!0,this.tokenType=a,this.tokenStart=this.tokenEnd=this.source.length)},dump:function(){var e=this.firstCharOffset;return Array.prototype.slice.call(this.offsetAndType,0,this.tokenCount).map((function(t,r){var a=e,i=t&o;return e=i,{idx:r,type:n[t>>c],chunk:this.source.substring(a,i),balance:this.balance[r]}}),this)}},f=l}function Te(){if(g)return y;function e(e){return e}function t(e,n,r,a){var i,s;switch(e.type){case"Group":i=function(e,n,r,a){var i=" "===e.combinator||a?e.combinator:" "+e.combinator+" ",s=e.terms.map((function(e){return t(e,n,r,a)})).join(i);return(e.explicit||r)&&(s=(a||","===s[0]?"[":"[ ")+s+(a?"]":" ]")),s}(e,n,r,a)+(e.disallowEmpty?"!":"");break;case"Multiplier":return t(e.term,n,r,a)+n(0===(s=e).min&&0===s.max?"*":0===s.min&&1===s.max?"?":1===s.min&&0===s.max?s.comma?"#":"+":1===s.min&&1===s.max?"":(s.comma?"#":"")+(s.min===s.max?"{"+s.min+"}":"{"+s.min+","+(0!==s.max?s.max:"")+"}"),e);case"Type":i="<"+e.name+(e.opts?n(function(e){switch(e.type){case"Range":return" ["+(null===e.min?"-∞":e.min)+","+(null===e.max?"∞":e.max)+"]";default:throw new Error("Unknown node type `"+e.type+"`")}}(e.opts),e.opts):"")+">";break;case"Property":i="<'"+e.name+"'>";break;case"Keyword":i=e.name;break;case"AtKeyword":i="@"+e.name;break;case"Function":i=e.name+"(";break;case"String":case"Token":i=e.value;break;case"Comma":i=",";break;default:throw new Error("Unknown node type `"+e.type+"`")}return n(i,e)}return g=1,y=function(n,r){var a=e,i=!1,s=!1;return"function"==typeof r?a=r:r&&(i=Boolean(r.forceBraces),s=Boolean(r.compact),"function"==typeof r.decorate&&(a=r.decorate)),t(n,a,i,s)}}function Pe(){if(k)return m;k=1;var e=ve(),t=Te();function n(e,t){var n=e&&e.loc&&e.loc[t];return n?{offset:n.offset,line:n.line,column:n.column}:null}return m={SyntaxReferenceError:function(t,n){var r=e("SyntaxReferenceError",t+(n?" `"+n+"`":""));return r.reference=n,r},MatchError:function(r,a,i,s){var o=e("SyntaxMatchError",r),c=function(e){for(var t=e.tokens,n=e.longestMatch,r=n<t.length?t[n].node:null,a=-1,i=0,s="",o=0;o<t.length;o++)o===n&&(a=s.length),null!==r&&t[o].node===r&&(o<=n?i++:i=0),s+=t[o].value;return{node:r,css:s,mismatchOffset:-1===a?s.length:a,last:null===r||i>1}}(s),l=c.mismatchOffset||0,u=c.node||i,h=n(u,"end"),p=c.last?h:n(u,"start"),f=c.css;return o.rawMessage=r,o.syntax=a?t(a):"<generic>",o.css=f,o.mismatchOffset=l,o.loc={source:u&&u.loc&&u.loc.source||"<unknown>",start:p,end:h},o.line=p?p.line:void 0,o.column=p?p.column:void 0,o.offset=p?p.offset:void 0,o.message=r+"\n syntax: "+o.syntax+"\n value: "+(o.css||"<empty string>")+"\n --------"+new Array(o.mismatchOffset+1).join("-")+"^",o}}}function Le(){if(v)return x;v=1;var e=Object.prototype.hasOwnProperty,t=Object.create(null),n=Object.create(null);function r(e,t){return t=t||0,e.length-t>=2&&45===e.charCodeAt(t)&&45===e.charCodeAt(t+1)}function a(e,t){if(t=t||0,e.length-t>=3&&45===e.charCodeAt(t)&&45!==e.charCodeAt(t+1)){var n=e.indexOf("-",t+2);if(-1!==n)return e.substring(t,n+1)}return""}return x={keyword:function(n){if(e.call(t,n))return t[n];var i=n.toLowerCase();if(e.call(t,i))return t[n]=t[i];var s=r(i,0),o=s?"":a(i,0);return t[n]=Object.freeze({basename:i.substr(o.length),name:i,vendor:o,prefix:o,custom:s})},property:function(t){if(e.call(n,t))return n[t];var i=t,s=t[0];"/"===s?s="/"===t[1]?"//":"/":"_"!==s&&"*"!==s&&"$"!==s&&"#"!==s&&"+"!==s&&"&"!==s&&(s="");var o=r(i,s.length);if(!o&&(i=i.toLowerCase(),e.call(n,i)))return n[t]=n[i];var c=o?"":a(i,s.length),l=i.substr(0,s.length+c.length);return n[t]=Object.freeze({basename:i.substr(l.length),name:i.substr(s.length),hack:s,vendor:c,prefix:l,custom:o})},isCustomProperty:r,vendorPrefix:a}}function Ee(){if(S)return b;S=1;var e="undefined"!=typeof Uint32Array?Uint32Array:Array;return b=function(t,n){return null===t||t.length<n?new e(Math.max(n+1024,16384)):t}}function De(){if(w)return C;w=1;var e=Ae(),t=Ee(),n=Se(),r=n.TYPE,a=Ce(),i=a.isNewline,s=a.isName,o=a.isValidEscape,c=a.isNumberStart,l=a.isIdentifierStart,u=a.charCodeCategory,h=a.isBOM,p=we(),f=p.cmpStr,d=p.getNewlineLength,y=p.findWhiteSpaceEnd,g=p.consumeEscaped,m=p.consumeName,k=p.consumeNumber,x=p.consumeBadUrlRemnants,v=16777215,b=24;function S(n,a){function p(e){return e<A?n.charCodeAt(e):0}function S(){return D=k(n,D),l(p(D),p(D+1),p(D+2))?(R=r.Dimension,void(D=m(n,D))):37===p(D)?(R=r.Percentage,void D++):void(R=r.Number)}function C(){const e=D;return D=m(n,D),f(n,e,D,"url")&&40===p(D)?34===p(D=y(n,D+1))||39===p(D)?(R=r.Function,void(D=e+4)):void function(){for(R=r.Url,D=y(n,D);D<n.length;D++){var e=n.charCodeAt(D);switch(u(e)){case 41:return void D++;case u.Eof:return;case u.WhiteSpace:return 41===p(D=y(n,D))||D>=n.length?void(D<n.length&&D++):(D=x(n,D),void(R=r.BadUrl));case 34:case 39:case 40:case u.NonPrintable:return D=x(n,D),void(R=r.BadUrl);case 92:if(o(e,p(D+1))){D=g(n,D)-1;break}return D=x(n,D),void(R=r.BadUrl)}}}():40===p(D)?(R=r.Function,void D++):void(R=r.Ident)}function w(e){for(e||(e=p(D++)),R=r.String;D<n.length;D++){var t=n.charCodeAt(D);switch(u(t)){case e:return void D++;case u.Eof:return;case u.WhiteSpace:if(i(t))return D+=d(n,D,t),void(R=r.BadString);break;case 92:if(D===n.length-1)break;var a=p(D+1);i(a)?D+=d(n,D+1,a):o(t,a)&&(D=g(n,D)-1)}}}a||(a=new e);for(var A=(n=String(n||"")).length,T=t(a.offsetAndType,A+1),P=t(a.balance,A+1),L=0,E=h(p(0)),D=E,O=0,B=0,I=0;D<A;){var N=n.charCodeAt(D),R=0;switch(P[L]=A,u(N)){case u.WhiteSpace:R=r.WhiteSpace,D=y(n,D+1);break;case 34:w();break;case 35:s(p(D+1))||o(p(D+1),p(D+2))?(R=r.Hash,D=m(n,D+1)):(R=r.Delim,D++);break;case 39:w();break;case 40:R=r.LeftParenthesis,D++;break;case 41:R=r.RightParenthesis,D++;break;case 43:c(N,p(D+1),p(D+2))?S():(R=r.Delim,D++);break;case 44:R=r.Comma,D++;break;case 45:c(N,p(D+1),p(D+2))?S():45===p(D+1)&&62===p(D+2)?(R=r.CDC,D+=3):l(N,p(D+1),p(D+2))?C():(R=r.Delim,D++);break;case 46:c(N,p(D+1),p(D+2))?S():(R=r.Delim,D++);break;case 47:42===p(D+1)?(R=r.Comment,1===(D=n.indexOf("*/",D+2)+2)&&(D=n.length)):(R=r.Delim,D++);break;case 58:R=r.Colon,D++;break;case 59:R=r.Semicolon,D++;break;case 60:33===p(D+1)&&45===p(D+2)&&45===p(D+3)?(R=r.CDO,D+=4):(R=r.Delim,D++);break;case 64:l(p(D+1),p(D+2),p(D+3))?(R=r.AtKeyword,D=m(n,D+1)):(R=r.Delim,D++);break;case 91:R=r.LeftSquareBracket,D++;break;case 92:o(N,p(D+1))?C():(R=r.Delim,D++);break;case 93:R=r.RightSquareBracket,D++;break;case 123:R=r.LeftCurlyBracket,D++;break;case 125:R=r.RightCurlyBracket,D++;break;case u.Digit:S();break;case u.NameStart:C();break;case u.Eof:break;default:R=r.Delim,D++}switch(R){case O:for(O=(B=P[I=B&v])>>b,P[L]=I,P[I++]=L;I<L;I++)P[I]===A&&(P[I]=L);break;case r.LeftParenthesis:case r.Function:P[L]=B,B=(O=r.RightParenthesis)<<b|L;break;case r.LeftSquareBracket:P[L]=B,B=(O=r.RightSquareBracket)<<b|L;break;case r.LeftCurlyBracket:P[L]=B,B=(O=r.RightCurlyBracket)<<b|L}T[L++]=R<<b|D}for(T[L]=r.EOF<<b|D,P[L]=A,P[A]=A;0!==B;)B=P[I=B&v],P[I]=A;return a.source=n,a.firstCharOffset=E,a.offsetAndType=T,a.tokenCount=L,a.balance=P,a.reset(),a.next(),a}return Object.keys(n).forEach((function(e){S[e]=n[e]})),Object.keys(a).forEach((function(e){S[e]=a[e]})),Object.keys(p).forEach((function(e){S[e]=p[e]})),C=S}function Oe(){if(D)return E;D=1;var e,t=De(),n=t.isIdentifierStart,r=t.isHexDigit,a=t.isDigit,i=t.cmpStr,s=t.consumeNumber,o=t.TYPE,c=function(){if(T)return A;T=1;var e=De().isDigit,t=De().cmpChar,n=De().TYPE,r=n.Delim,a=n.WhiteSpace,i=n.Comment,s=n.Ident,o=n.Number,c=n.Dimension,l=45,u=!0;function h(e,t){return null!==e&&e.type===r&&e.value.charCodeAt(0)===t}function p(e,t,n){for(;null!==e&&(e.type===a||e.type===i);)e=n(++t);return t}function f(t,n,r,a){if(!t)return 0;var i=t.value.charCodeAt(n);if(43===i||i===l){if(r)return 0;n++}for(;n<t.value.length;n++)if(!e(t.value.charCodeAt(n)))return 0;return a+1}function d(e,t,n){var r=!1,a=p(e,t,n);if(null===(e=n(a)))return t;if(e.type!==o){if(!h(e,43)&&!h(e,l))return t;if(r=!0,a=p(n(++a),a,n),null===(e=n(a))&&e.type!==o)return 0}if(!r){var i=e.value.charCodeAt(0);if(43!==i&&i!==l)return 0}return f(e,r?0:1,r,a)}return A=function(n,r){var a=0;if(!n)return 0;if(n.type===o)return f(n,0,!1,a);if(n.type===s&&n.value.charCodeAt(0)===l){if(!t(n.value,1,110))return 0;switch(n.value.length){case 2:return d(r(++a),a,r);case 3:return n.value.charCodeAt(2)!==l?0:(a=p(r(++a),a,r),f(n=r(a),0,u,a));default:return n.value.charCodeAt(2)!==l?0:f(n,3,u,a)}}else if(n.type===s||h(n,43)&&r(a+1).type===s){if(n.type!==s&&(n=r(++a)),null===n||!t(n.value,0,110))return 0;switch(n.value.length){case 1:return d(r(++a),a,r);case 2:return n.value.charCodeAt(1)!==l?0:(a=p(r(++a),a,r),f(n=r(a),0,u,a));default:return n.value.charCodeAt(1)!==l?0:f(n,2,u,a)}}else if(n.type===c){for(var i=n.value.charCodeAt(0),y=43===i||i===l?1:0,g=y;g<n.value.length&&e(n.value.charCodeAt(g));g++);return g===y?0:t(n.value,g,110)?g+1===n.value.length?d(r(++a),a,r):n.value.charCodeAt(g+1)!==l?0:g+2===n.value.length?(a=p(r(++a),a,r),f(n=r(a),0,u,a)):f(n,g+2,u,a):0}return 0}}(),l=function(){if(L)return P;L=1;var e=De().isHexDigit,t=De().cmpChar,n=De().TYPE,r=n.Ident,a=n.Delim,i=n.Number,s=n.Dimension;function o(e,t){return null!==e&&e.type===a&&e.value.charCodeAt(0)===t}function c(e,t){return e.value.charCodeAt(0)===t}function l(t,n,r){for(var a=n,i=0;a<t.value.length;a++){var s=t.value.charCodeAt(a);if(45===s&&r&&0!==i)return l(t,n+i+1,!1)>0?6:0;if(!e(s))return 0;if(++i>6)return 0}return i}function u(e,t,n){if(!e)return 0;for(;o(n(t),63);){if(++e>6)return 0;t++}return t}return P=function(e,n){var a=0;if(null===e||e.type!==r||!t(e.value,0,117))return 0;if(null===(e=n(++a)))return 0;if(o(e,43))return null===(e=n(++a))?0:e.type===r?u(l(e,0,!0),++a,n):o(e,63)?u(1,++a,n):0;if(e.type===i){if(!c(e,43))return 0;var h=l(e,1,!0);return 0===h?0:null===(e=n(++a))?a:e.type===s||e.type===i?c(e,45)&&l(e,1,!1)?a+1:0:u(h,a,n)}return e.type===s&&c(e,43)?u(l(e,1,!0),++a,n):0}}(),u=["unset","initial","inherit"],h=["calc(","-moz-calc(","-webkit-calc("];function p(e,t){return t<e.length?e.charCodeAt(t):0}function f(e,t){return i(e,0,e.length,t)}function d(e,t){for(var n=0;n<t.length;n++)if(f(e,t[n]))return!0;return!1}function y(e,t){return t===e.length-2&&(92===e.charCodeAt(t)&&a(e.charCodeAt(t+1)))}function g(e,t,n){if(e&&"Range"===e.type){var r=Number(void 0!==n&&n!==t.length?t.substr(0,n):t);if(isNaN(r))return!0;if(null!==e.min&&r<e.min)return!0;if(null!==e.max&&r>e.max)return!0}return!1}function m(e,t){var n=e.index,r=0;do{if(r++,e.balance<=n)break}while(e=t(r));return r}function k(e){return function(t,n,r){return null===t?0:t.type===o.Function&&d(t.value,h)?m(t,n):e(t,n,r)}}function x(e){return function(t){return null===t||t.type!==e?0:1}}function v(e){return function(t,n,r){if(null===t||t.type!==o.Dimension)return 0;var a=s(t.value,0);if(null!==e){var i=t.value.indexOf("\\",a),c=-1!==i&&y(t.value,i)?t.value.substring(a,i):t.value.substr(a);if(!1===e.hasOwnProperty(c.toLowerCase()))return 0}return g(r,t.value,a)?0:1}}function b(e){return"function"!=typeof e&&(e=function(){return 0}),function(t,n,r){return null!==t&&t.type===o.Number&&0===Number(t.value)?1:e(t,n,r)}}return E={"ident-token":x(o.Ident),"function-token":x(o.Function),"at-keyword-token":x(o.AtKeyword),"hash-token":x(o.Hash),"string-token":x(o.String),"bad-string-token":x(o.BadString),"url-token":x(o.Url),"bad-url-token":x(o.BadUrl),"delim-token":x(o.Delim),"number-token":x(o.Number),"percentage-token":x(o.Percentage),"dimension-token":x(o.Dimension),"whitespace-token":x(o.WhiteSpace),"CDO-token":x(o.CDO),"CDC-token":x(o.CDC),"colon-token":x(o.Colon),"semicolon-token":x(o.Semicolon),"comma-token":x(o.Comma),"[-token":x(o.LeftSquareBracket),"]-token":x(o.RightSquareBracket),"(-token":x(o.LeftParenthesis),")-token":x(o.RightParenthesis),"{-token":x(o.LeftCurlyBracket),"}-token":x(o.RightCurlyBracket),string:x(o.String),ident:x(o.Ident),"custom-ident":function(e){if(null===e||e.type!==o.Ident)return 0;var t=e.value.toLowerCase();return d(t,u)||f(t,"default")?0:1},"custom-property-name":function(e){return null===e||e.type!==o.Ident||45!==p(e.value,0)||45!==p(e.value,1)?0:1},"hex-color":function(e){if(null===e||e.type!==o.Hash)return 0;var t=e.value.length;if(4!==t&&5!==t&&7!==t&&9!==t)return 0;for(var n=1;n<t;n++)if(!r(e.value.charCodeAt(n)))return 0;return 1},"id-selector":function(e){return null===e||e.type!==o.Hash?0:n(p(e.value,1),p(e.value,2),p(e.value,3))?1:0},"an-plus-b":c,urange:l,"declaration-value":function(e,t){if(!e)return 0;var n=0,r=0,a=e.index;e:do{switch(e.type){case o.BadString:case o.BadUrl:break e;case o.RightCurlyBracket:case o.RightParenthesis:case o.RightSquareBracket:if(e.balance>e.index||e.balance<a)break e;r--;break;case o.Semicolon:if(0===r)break e;break;case o.Delim:if("!"===e.value&&0===r)break e;break;case o.Function:case o.LeftParenthesis:case o.LeftSquareBracket:case o.LeftCurlyBracket:r++}if(n++,e.balance<=a)break}while(e=t(n));return n},"any-value":function(e,t){if(!e)return 0;var n=e.index,r=0;e:do{switch(e.type){case o.BadString:case o.BadUrl:break e;case o.RightCurlyBracket:case o.RightParenthesis:case o.RightSquareBracket:if(e.balance>e.index||e.balance<n)break e}if(r++,e.balance<=n)break}while(e=t(r));return r},dimension:k(v(null)),angle:k(v({deg:!0,grad:!0,rad:!0,turn:!0})),decibel:k(v({db:!0})),frequency:k(v({hz:!0,khz:!0})),flex:k(v({fr:!0})),length:k(b(v({px:!0,mm:!0,cm:!0,in:!0,pt:!0,pc:!0,q:!0,em:!0,ex:!0,ch:!0,rem:!0,vh:!0,vw:!0,vmin:!0,vmax:!0,vm:!0}))),resolution:k(v({dpi:!0,dpcm:!0,dppx:!0,x:!0})),semitones:k(v({st:!0})),time:k(v({s:!0,ms:!0})),percentage:k((function(e,t,n){return null===e||e.type!==o.Percentage||g(n,e.value,e.value.length-1)?0:1})),zero:b(),number:k((function(e,t,n){if(null===e)return 0;var r=s(e.value,0);return r===e.value.length||y(e.value,r)?g(n,e.value,r)?0:1:0})),integer:k((function(e,t,n){if(null===e||e.type!==o.Number)return 0;for(var r=43===e.value.charCodeAt(0)||45===e.value.charCodeAt(0)?1:0;r<e.value.length;r++)if(!a(e.value.charCodeAt(r)))return 0;return g(n,e.value,r)?0:1})),"-ms-legacy-expression":(e="expression",e+="(",function(t,n){return null!==t&&f(t.value,e)?m(t,n):0})}}function Be(){if(B)return O;B=1;var e=ve();return O=function(t,n,r){var a=e("SyntaxError",t);return a.input=n,a.offset=r,a.rawMessage=t,a.message=a.rawMessage+"\n "+a.input+"\n--"+new Array((a.offset||a.input.length)+1).join("-")+"^",a}}function Ie(){if(M)return R;M=1;var e=function(){if(N)return I;N=1;var e=Be(),t=function(e){this.str=e,this.pos=0};return t.prototype={charCodeAt:function(e){return e<this.str.length?this.str.charCodeAt(e):0},charCode:function(){return this.charCodeAt(this.pos)},nextCharCode:function(){return this.charCodeAt(this.pos+1)},nextNonWsCode:function(e){return this.charCodeAt(this.findWsEnd(e))},findWsEnd:function(e){for(;e<this.str.length;e++){var t=this.str.charCodeAt(e);if(13!==t&&10!==t&&12!==t&&32!==t&&9!==t)break}return e},substringToPos:function(e){return this.str.substring(this.pos,this.pos=e)},eat:function(e){this.charCode()!==e&&this.error("Expect `"+String.fromCharCode(e)+"`"),this.pos++},peek:function(){return this.pos<this.str.length?this.str.charAt(this.pos++):""},error:function(t){throw new e(t,this.str,this.pos)}},I=t}(),t=123,n=function(e){for(var t="function"==typeof Uint32Array?new Uint32Array(128):new Array(128),n=0;n<128;n++)t[n]=e(String.fromCharCode(n))?1:0;return t}((function(e){return/[a-zA-Z0-9\-]/.test(e)})),r={" ":1,"&&":2,"||":3,"|":4};function a(e){return e.substringToPos(e.findWsEnd(e.pos))}function i(e){for(var t=e.pos;t<e.str.length;t++){var r=e.str.charCodeAt(t);if(r>=128||0===n[r])break}return e.pos===t&&e.error("Expect a keyword"),e.substringToPos(t)}function s(e){for(var t=e.pos;t<e.str.length;t++){var n=e.str.charCodeAt(t);if(n<48||n>57)break}return e.pos===t&&e.error("Expect a number"),e.substringToPos(t)}function o(e){var t=e.str.indexOf("'",e.pos+1);return-1===t&&(e.pos=e.str.length,e.error("Expect an apostrophe")),e.substringToPos(t+1)}function c(e){var n,r=null;return e.eat(t),n=s(e),44===e.charCode()?(e.pos++,125!==e.charCode()&&(r=s(e))):r=n,e.eat(125),{min:Number(n),max:r?Number(r):0}}function l(e,n){var r=function(e){var n=null,r=!1;switch(e.charCode()){case 42:e.pos++,n={min:0,max:0};break;case 43:e.pos++,n={min:1,max:0};break;case 63:e.pos++,n={min:0,max:1};break;case 35:e.pos++,r=!0,n=e.charCode()===t?c(e):{min:1,max:0};break;case t:n=c(e);break;default:return null}return{type:"Multiplier",comma:r,min:n.min,max:n.max,term:null}}(e);return null!==r?(r.term=n,r):n}function u(e){var t=e.peek();return""===t?null:{type:"Token",value:t}}function h(e){var t,n=null;return e.eat(60),t=i(e),40===e.charCode()&&41===e.nextCharCode()&&(e.pos+=2,t+="()"),91===e.charCodeAt(e.findWsEnd(e.pos))&&(a(e),n=function(e){var t=null,n=null,r=1;return e.eat(91),45===e.charCode()&&(e.peek(),r=-1),-1==r&&8734===e.charCode()?e.peek():t=r*Number(s(e)),a(e),e.eat(44),a(e),8734===e.charCode()?e.peek():(r=1,45===e.charCode()&&(e.peek(),r=-1),n=r*Number(s(e))),e.eat(93),null===t&&null===n?null:{type:"Range",min:t,max:n}}(e)),e.eat(62),l(e,{type:"Type",name:t,opts:n})}function p(e,t){function n(e,t){return{type:"Group",terms:e,combinator:t,disallowEmpty:!1,explicit:!1}}for(t=Object.keys(t).sort((function(e,t){return r[e]-r[t]}));t.length>0;){for(var a=t.shift(),i=0,s=0;i<e.length;i++){var o=e[i];"Combinator"===o.type&&(o.value===a?(-1===s&&(s=i-1),e.splice(i,1),i--):(-1!==s&&i-s>1&&(e.splice(s,i-s,n(e.slice(s,i),a)),i=s+1),s=-1))}-1!==s&&t.length&&e.splice(s,i-s,n(e.slice(s,i),a))}return a}function f(e){for(var t,n=[],r={},a=null,i=e.pos;t=d(e);)"Spaces"!==t.type&&("Combinator"===t.type?(null!==a&&"Combinator"!==a.type||(e.pos=i,e.error("Unexpected combinator")),r[t.value]=!0):null!==a&&"Combinator"!==a.type&&(r[" "]=!0,n.push({type:"Combinator",value:" "})),n.push(t),a=t,i=e.pos);return null!==a&&"Combinator"===a.type&&(e.pos-=i,e.error("Unexpected combinator")),{type:"Group",terms:n,combinator:p(n,r)||" ",disallowEmpty:!1,explicit:!1}}function d(e){var r=e.charCode();if(r<128&&1===n[r])return function(e){var t;return t=i(e),40===e.charCode()?(e.pos++,{type:"Function",name:t}):l(e,{type:"Keyword",name:t})}(e);switch(r){case 93:break;case 91:return l(e,function(e){var t;return e.eat(91),t=f(e),e.eat(93),t.explicit=!0,33===e.charCode()&&(e.pos++,t.disallowEmpty=!0),t}(e));case 60:return 39===e.nextCharCode()?function(e){var t;return e.eat(60),e.eat(39),t=i(e),e.eat(39),e.eat(62),l(e,{type:"Property",name:t})}(e):h(e);case 124:return{type:"Combinator",value:e.substringToPos(124===e.nextCharCode()?e.pos+2:e.pos+1)};case 38:return e.pos++,e.eat(38),{type:"Combinator",value:"&&"};case 44:return e.pos++,{type:"Comma"};case 39:return l(e,{type:"String",value:o(e)});case 32:case 9:case 10:case 13:case 12:return{type:"Spaces",value:a(e)};case 64:return(r=e.nextCharCode())<128&&1===n[r]?(e.pos++,{type:"AtKeyword",name:i(e)}):u(e);case 42:case 43:case 63:case 35:case 33:break;case t:if((r=e.nextCharCode())<48||r>57)return u(e);break;default:return u(e)}}function y(t){var n=new e(t),r=f(n);return n.pos!==t.length&&n.error("Unexpected input"),1===r.terms.length&&"Group"===r.terms[0].type&&(r=r.terms[0]),r}return y("[a&&<b>#|<'c'>*||e() f{2} /,(% g#{1,2} h{2,})]!"),R=y}function Ne(){if(W)return F;W=1;var e=function(){};function t(t){return"function"==typeof t?t:e}return F=function(n,r,a){var i=e,s=e;if("function"==typeof r?i=r:r&&(i=t(r.enter),s=t(r.leave)),i===e&&s===e)throw new Error("Neither `enter` nor `leave` walker handler is set or both aren't a function");!function e(t){switch(i.call(a,t),t.type){case"Group":t.terms.forEach(e);break;case"Multiplier":e(t.term);break;case"Type":case"Property":case"Keyword":case"AtKeyword":case"Function":case"String":case"Token":case"Comma":break;default:throw new Error("Unknown type: "+t.type)}s.call(a,t)}(n)}}function Re(){if(j)return U;j=1;var e=Ie(),t={type:"Match"},n={type:"Mismatch"},r={type:"DisallowEmpty"};function a(e,r,a){return r===t&&a===n||e===t&&r===t&&a===t?e:("If"===e.type&&e.else===n&&r===t&&(r=e.then,e=e.match),{type:"If",match:e,then:r,else:a})}function i(e){return e.length>2&&40===e.charCodeAt(e.length-2)&&41===e.charCodeAt(e.length-1)}function s(e){return"Keyword"===e.type||"AtKeyword"===e.type||"Function"===e.type||"Type"===e.type&&i(e.name)}function o(e,r,c){switch(e){case" ":for(var l=t,u=r.length-1;u>=0;u--){l=a(f=r[u],l,n)}return l;case"|":l=n;var h=null;for(u=r.length-1;u>=0;u--){if(s(f=r[u])&&(null===h&&u>0&&s(r[u-1])&&(l=a({type:"Enum",map:h=Object.create(null)},t,l)),null!==h)){var p=(i(f.name)?f.name.slice(0,-1):f.name).toLowerCase();if(p in h==!1){h[p]=f;continue}}h=null,l=a(f,t,l)}return l;case"&&":if(r.length>5)return{type:"MatchOnce",terms:r,all:!0};for(l=n,u=r.length-1;u>=0;u--){var f=r[u];d=r.length>1?o(e,r.filter((function(e){return e!==f})),!1):t,l=a(f,d,l)}return l;case"||":if(r.length>5)return{type:"MatchOnce",terms:r,all:!1};for(l=c?t:n,u=r.length-1;u>=0;u--){var d;f=r[u];d=r.length>1?o(e,r.filter((function(e){return e!==f})),!0):t,l=a(f,d,l)}return l}}function c(e){if("function"==typeof e)return{type:"Generic",fn:e};switch(e.type){case"Group":var i=o(e.combinator,e.terms.map(c),!1);return e.disallowEmpty&&(i=a(i,r,n)),i;case"Multiplier":return function(e){var i=t,s=c(e.term);if(0===e.max)s=a(s,r,n),(i=a(s,null,n)).then=a(t,t,i),e.comma&&(i.then.else=a({type:"Comma",syntax:e},i,n));else for(var o=e.min||1;o<=e.max;o++)e.comma&&i!==t&&(i=a({type:"Comma",syntax:e},i,n)),i=a(s,a(t,t,i),n);if(0===e.min)i=a(t,t,i);else for(o=0;o<e.min-1;o++)e.comma&&i!==t&&(i=a({type:"Comma",syntax:e},i,n)),i=a(s,i,n);return i}(e);case"Type":case"Property":return{type:e.type,name:e.name,syntax:e};case"Keyword":return{type:e.type,name:e.name.toLowerCase(),syntax:e};case"AtKeyword":return{type:e.type,name:"@"+e.name.toLowerCase(),syntax:e};case"Function":return{type:e.type,name:e.name.toLowerCase()+"(",syntax:e};case"String":return 3===e.value.length?{type:"Token",value:e.value.charAt(1),syntax:e}:{type:e.type,value:e.value.substr(1,e.value.length-2).replace(/\\'/g,"'"),syntax:e};case"Token":return{type:e.type,value:e.value,syntax:e};case"Comma":return{type:e.type,syntax:e};default:throw new Error("Unknown node type:",e.type)}}return U={MATCH:t,MISMATCH:n,DISALLOW_EMPTY:r,buildMatchGraph:function(t,n){return"string"==typeof t&&(t=e(t)),{type:"MatchGraph",match:c(t),syntax:n||null,source:t}}}}function Me(){if(K)return V;function e(e){function t(e){return null!==e&&("Type"===e.type||"Property"===e.type||"Keyword"===e.type)}var n=null;return null!==this.matched&&function r(a){if(Array.isArray(a.match)){for(var i=0;i<a.match.length;i++)if(r(a.match[i]))return t(a.syntax)&&n.unshift(a.syntax),!0}else if(a.node===e)return n=t(a.syntax)?[a.syntax]:[],!0;return!1}(this.matched),n}function t(t,n,r){var a=e.call(t,n);return null!==a&&a.some(r)}return K=1,V={getTrace:e,isType:function(e,n){return t(this,e,(function(e){return"Type"===e.type&&e.name===n}))},isProperty:function(e,n){return t(this,e,(function(e){return"Property"===e.type&&e.name===n}))},isKeyword:function(e){return t(this,e,(function(e){return"Keyword"===e.type}))}}}function Fe(){if(G)return Q;G=1;var e=xe();function t(e){return"node"in e?e.node:t(e.match[0])}function n(e){return"node"in e?e.node:n(e.match[e.match.length-1])}return Q={matchFragments:function(r,a,i,s,o){var c=[];return null!==i.matched&&function i(l){if(null!==l.syntax&&l.syntax.type===s&&l.syntax.name===o){var u=t(l),h=n(l);r.syntax.walk(a,(function(t,n,r){if(t===u){var a=new e;do{if(a.appendData(n.data),n.data===h)break;n=n.next}while(null!==n);c.push({parent:r,nodes:a})}}))}Array.isArray(l.match)&&l.match.forEach(i)}(i.matched),c}}}function We(){if($)return Z;$=1;var e=Pe().SyntaxReferenceError,t=Pe().MatchError,n=Le(),r=Oe(),a=Ie(),i=Te(),s=Ne(),o=function(){if(Y)return z;Y=1;var e=De(),t=new(Ae()),n={decorator:function(e){var t=null,n={len:0,node:null},a=[n],i="";return{children:e.children,node:function(n){var r=t;t=n,e.node.call(this,n),t=r},chunk:function(e){i+=e,n.node!==t?a.push({len:e.length,node:t}):n.len+=e.length},result:function(){return r(i,a)}}}};function r(n,r){var a=[],i=0,s=0,o=r?r[s].node:null;for(e(n,t);!t.eof;){if(r)for(;s<r.length&&i+r[s].len<=t.tokenStart;)i+=r[s++].len,o=r[s].node;a.push({type:t.tokenType,value:t.getTokenValue(),index:t.tokenIndex,balance:t.balance[t.tokenIndex],node:o}),t.next()}return a}return z=function(e,t){return"string"==typeof e?r(e,null):t.generate(e,n)}}(),c=Re().buildMatchGraph,l=function(){if(H)return q;H=1;var e=Object.prototype.hasOwnProperty,t=Re(),n=t.MATCH,r=t.MISMATCH,a=t.DISALLOW_EMPTY,i=Se().TYPE,s="Match",o=0;function c(e){for(var t=null,n=null,r=e;null!==r;)n=r.prev,r.prev=t,t=r,r=n;return t}function l(e,t){if(e.length!==t.length)return!1;for(var n=0;n<e.length;n++){var r=e.charCodeAt(n);if(r>=65&&r<=90&&(r|=32),r!==t.charCodeAt(n))return!1}return!0}function u(e){return null===e||e.type===i.Comma||e.type===i.Function||e.type===i.LeftParenthesis||e.type===i.LeftSquareBracket||e.type===i.LeftCurlyBracket||e.type===i.Delim}function h(e){return null===e||e.type===i.RightParenthesis||e.type===i.RightSquareBracket||e.type===i.RightCurlyBracket||e.type===i.Delim}function p(t,c,p){function f(){do{P++,T=P<t.length?t[P]:null}while(null!==T&&(T.type===i.WhiteSpace||T.type===i.Comment))}function d(e){var n=P+e;return n<t.length?t[n]:null}function y(e,t){return{nextState:e,matchStack:E,syntaxStack:v,thenStack:b,tokenIndex:P,prev:t}}function g(e){b={nextState:e,matchStack:E,syntaxStack:v,prev:b}}function m(e){S=y(e,S)}function k(){E={type:1,syntax:c.syntax,token:T,prev:E},f(),C=null,P>L&&(L=P)}function x(){E=2===E.type?E.prev:{type:3,syntax:v.syntax,token:E.token,prev:E},v=v.prev}var v=null,b=null,S=null,C=null,w=0,A=null,T=null,P=-1,L=0,E={type:0,syntax:null,token:null,prev:null};for(f();null===A&&++w<15e3;)switch(c.type){case"Match":if(null===b){if(null!==T&&(P!==t.length-1||"\\0"!==T.value&&"\\9"!==T.value)){c=r;break}A=s;break}if((c=b.nextState)===a){if(b.matchStack===E){c=r;break}c=n}for(;b.syntaxStack!==v;)x();b=b.prev;break;case"Mismatch":if(null!==C&&!1!==C)(null===S||P>S.tokenIndex)&&(S=C,C=!1);else if(null===S){A="Mismatch";break}c=S.nextState,b=S.thenStack,v=S.syntaxStack,E=S.matchStack,P=S.tokenIndex,T=P<t.length?t[P]:null,S=S.prev;break;case"MatchGraph":c=c.match;break;case"If":c.else!==r&&m(c.else),c.then!==n&&g(c.then),c=c.match;break;case"MatchOnce":c={type:"MatchOnceBuffer",syntax:c,index:0,mask:0};break;case"MatchOnceBuffer":var D=c.syntax.terms;if(c.index===D.length){if(0===c.mask||c.syntax.all){c=r;break}c=n;break}if(c.mask===(1<<D.length)-1){c=n;break}for(;c.index<D.length;c.index++){var O=1<<c.index;if(0==(c.mask&O)){m(c),g({type:"AddMatchOnce",syntax:c.syntax,mask:c.mask|O}),c=D[c.index++];break}}break;case"AddMatchOnce":c={type:"MatchOnceBuffer",syntax:c.syntax,index:0,mask:c.mask};break;case"Enum":if(null!==T&&(-1!==(M=T.value.toLowerCase()).indexOf("\\")&&(M=M.replace(/\\[09].*$/,"")),e.call(c.map,M))){c=c.map[M];break}c=r;break;case"Generic":var B=null!==v?v.opts:null,I=P+Math.floor(c.fn(T,d,B));if(!isNaN(I)&&I>P){for(;P<I;)k();c=n}else c=r;break;case"Type":case"Property":var N="Type"===c.type?"types":"properties",R=e.call(p,N)?p[N][c.name]:null;if(!R||!R.match)throw new Error("Bad syntax reference: "+("Type"===c.type?"<"+c.name+">":"<'"+c.name+"'>"));if(!1!==C&&null!==T&&"Type"===c.type&&("custom-ident"===c.name&&T.type===i.Ident||"length"===c.name&&"0"===T.value)){null===C&&(C=y(c,S)),c=r;break}v={syntax:c.syntax,opts:c.syntax.opts||null!==v&&v.opts||null,prev:v},E={type:2,syntax:c.syntax,token:E.token,prev:E},c=R.match;break;case"Keyword":var M=c.name;if(null!==T){var F=T.value;if(-1!==F.indexOf("\\")&&(F=F.replace(/\\[09].*$/,"")),l(F,M)){k(),c=n;break}}c=r;break;case"AtKeyword":case"Function":if(null!==T&&l(T.value,c.name)){k(),c=n;break}c=r;break;case"Token":if(null!==T&&T.value===c.value){k(),c=n;break}c=r;break;case"Comma":null!==T&&T.type===i.Comma?u(E.token)?c=r:(k(),c=h(T)?r:n):c=u(E.token)||h(T)?n:r;break;case"String":var W="";for(I=P;I<t.length&&W.length<c.value.length;I++)W+=t[I].value;if(l(W,c.value)){for(;P<I;)k();c=n}else c=r;break;default:throw new Error("Unknown node type: "+c.type)}switch(o+=w,A){case null:console.warn("[csstree-match] BREAK after 15000 iterations"),A="Maximum iteration number exceeded (please fill an issue on https://github.com/csstree/csstree/issues)",E=null;break;case s:for(;null!==v;)x();break;default:E=null}return{tokens:t,reason:A,iterations:w,match:E,longestMatch:L}}return q={matchAsList:function(e,t,n){var r=p(e,t,n||{});if(null!==r.match){var a=c(r.match).prev;for(r.match=[];null!==a;){switch(a.type){case 0:break;case 2:case 3:r.match.push({type:a.type,syntax:a.syntax});break;default:r.match.push({token:a.token.value,node:a.token.node})}a=a.prev}}return r},matchAsTree:function(e,t,n){var r=p(e,t,n||{});if(null===r.match)return r;var a=r.match,i=r.match={syntax:t.syntax||null,match:[]},s=[i];for(a=c(a).prev;null!==a;){switch(a.type){case 2:i.match.push(i={syntax:a.syntax,match:[]}),s.push(i);break;case 3:s.pop(),i=s[s.length-1];break;default:i.match.push({syntax:a.syntax||null,token:a.token.value,node:a.token.node})}a=a.prev}return r},getTotalIterationCount:function(){return o}}}().matchAsTree,u=Me(),h=Fe(),p=function(){if(_)return X;_=1;var e=xe(),t=Object.prototype.hasOwnProperty;function n(e){return"number"==typeof e&&isFinite(e)&&Math.floor(e)===e&&e>=0}function r(e){return Boolean(e)&&n(e.offset)&&n(e.line)&&n(e.column)}function a(n,a){return function(i,s){if(!i||i.constructor!==Object)return s(i,"Type of node should be an Object");for(var o in i){var c=!0;if(!1!==t.call(i,o)){if("type"===o)i.type!==n&&s(i,"Wrong node type `"+i.type+"`, expected `"+n+"`");else if("loc"===o){if(null===i.loc)continue;if(i.loc&&i.loc.constructor===Object)if("string"!=typeof i.loc.source)o+=".source";else if(r(i.loc.start)){if(r(i.loc.end))continue;o+=".end"}else o+=".start";c=!1}else if(a.hasOwnProperty(o)){var l=0;for(c=!1;!c&&l<a[o].length;l++){var u=a[o][l];switch(u){case String:c="string"==typeof i[o];break;case Boolean:c="boolean"==typeof i[o];break;case null:c=null===i[o];break;default:"string"==typeof u?c=i[o]&&i[o].type===u:Array.isArray(u)&&(c=i[o]instanceof e)}}}else s(i,"Unknown field `"+o+"` for "+n+" node type");c||s(i,"Bad value for `"+n+"."+o+"`")}}for(var o in a)t.call(a,o)&&!1===t.call(i,o)&&s(i,"Field `"+n+"."+o+"` is missed")}}function i(e,n){var r=n.structure,i={type:String,loc:!0},s={type:'"'+e+'"'};for(var o in r)if(!1!==t.call(r,o)){for(var c=[],l=i[o]=Array.isArray(r[o])?r[o].slice():[r[o]],u=0;u<l.length;u++){var h=l[u];if(h===String||h===Boolean)c.push(h.name);else if(null===h)c.push("null");else if("string"==typeof h)c.push("<"+h+">");else{if(!Array.isArray(h))throw new Error("Wrong value `"+h+"` in `"+e+"."+o+"` structure definition");c.push("List")}}s[o]=c.join(" | ")}return{docs:s,check:a(e,i)}}return X={getStructureFromConfig:function(e){var n={};if(e.node)for(var r in e.node)if(t.call(e.node,r)){var a=e.node[r];if(!a.structure)throw new Error("Missed `structure` field in `"+r+"` node type definition");n[r]=i(r,a)}return n}}}().getStructureFromConfig,f=c("inherit | initial | unset"),d=c("inherit | initial | unset | <-ms-legacy-expression>");function y(e,t,n){var r={};for(var a in e)e[a].syntax&&(r[a]=n?e[a].syntax:i(e[a].syntax,{compact:t}));return r}function g(e,t,n){return{matched:e,iterations:n,error:t,getTrace:u.getTrace,isType:u.isType,isProperty:u.isProperty,isKeyword:u.isKeyword}}function m(e,n,r,a){var i,s=o(r,e.syntax);return function(e){for(var t=0;t<e.length;t++)if("var("===e[t].value.toLowerCase())return!0;return!1}(s)?g(null,new Error("Matching for a tree with var() is not supported")):(a&&(i=l(s,e.valueCommonSyntax,e)),a&&i.match||(i=l(s,n.match,e)).match?g(i.match,null,i.iterations):g(null,new t(i.reason,n.syntax,r,i),i.iterations))}var k=function(e,t,n){if(this.valueCommonSyntax=f,this.syntax=t,this.generic=!1,this.atrules={},this.properties={},this.types={},this.structure=n||p(e),e){if(e.types)for(var a in e.types)this.addType_(a,e.types[a]);if(e.generic)for(var a in this.generic=!0,r)this.addType_(a,r[a]);if(e.atrules)for(var a in e.atrules)this.addAtrule_(a,e.atrules[a]);if(e.properties)for(var a in e.properties)this.addProperty_(a,e.properties[a])}};return k.prototype={structure:{},checkStructure:function(e){function t(e,t){r.push({node:e,message:t})}var n=this.structure,r=[];return this.syntax.walk(e,(function(e){n.hasOwnProperty(e.type)?n[e.type].check(e,t):t(e,"Unknown node type `"+e.type+"`")})),!!r.length&&r},createDescriptor:function(e,t,n){var r={type:t,name:n},i={type:t,name:n,syntax:null,match:null};return"function"==typeof e?i.match=c(e,r):("string"==typeof e?Object.defineProperty(i,"syntax",{get:function(){return Object.defineProperty(i,"syntax",{value:a(e)}),i.syntax}}):i.syntax=e,Object.defineProperty(i,"match",{get:function(){return Object.defineProperty(i,"match",{value:c(i.syntax,r)}),i.match}})),i},addAtrule_:function(e,t){this.atrules[e]={prelude:t.prelude?this.createDescriptor(t.prelude,"AtrulePrelude",e):null,descriptors:t.descriptors?Object.keys(t.descriptors).reduce(((e,n)=>(e[n]=this.createDescriptor(t.descriptors[n],"AtruleDescriptor",n),e)),{}):null}},addProperty_:function(e,t){this.properties[e]=this.createDescriptor(t,"Property",e)},addType_:function(e,t){this.types[e]=this.createDescriptor(t,"Type",e),t===r["-ms-legacy-expression"]&&(this.valueCommonSyntax=d)},matchAtrulePrelude:function(t,r){var a=n.keyword(t),i=a.vendor?this.getAtrulePrelude(a.name)||this.getAtrulePrelude(a.basename):this.getAtrulePrelude(a.name);return i?m(this,i,r,!0):a.basename in this.atrules?g(null,new Error("At-rule `"+t+"` should not contain a prelude")):g(null,new e("Unknown at-rule",t))},matchAtruleDescriptor:function(t,r,a){var i=n.keyword(t),s=n.keyword(r),o=i.vendor?this.atrules[i.name]||this.atrules[i.basename]:this.atrules[i.name];if(!o)return g(null,new e("Unknown at-rule",t));if(!o.descriptors)return g(null,new Error("At-rule `"+t+"` has no known descriptors"));var c=s.vendor?o.descriptors[s.name]||o.descriptors[s.basename]:o.descriptors[s.name];return c?m(this,c,a,!0):g(null,new e("Unknown at-rule descriptor",r))},matchDeclaration:function(e){return"Declaration"!==e.type?g(null,new Error("Not a Declaration node")):this.matchProperty(e.property,e.value)},matchProperty:function(t,r){var a=n.property(t);if(a.custom)return g(null,new Error("Lexer matching doesn't applicable for custom properties"));var i=a.vendor?this.getProperty(a.name)||this.getProperty(a.basename):this.getProperty(a.name);return i?m(this,i,r,!0):g(null,new e("Unknown property",t))},matchType:function(t,n){var r=this.getType(t);return r?m(this,r,n,!1):g(null,new e("Unknown type",t))},match:function(t,n){return"string"==typeof t||t&&t.type?("string"!=typeof t&&t.match||(t=this.createDescriptor(t,"Type","anonymous")),m(this,t,n,!1)):g(null,new e("Bad syntax"))},findValueFragments:function(e,t,n,r){return h.matchFragments(this,t,this.matchProperty(e,t),n,r)},findDeclarationValueFragments:function(e,t,n){return h.matchFragments(this,e.value,this.matchDeclaration(e),t,n)},findAllFragments:function(e,t,n){var r=[];return this.syntax.walk(e,{visit:"Declaration",enter:function(e){r.push.apply(r,this.findDeclarationValueFragments(e,t,n))}.bind(this)}),r},getAtrulePrelude:function(e){return this.atrules.hasOwnProperty(e)?this.atrules[e].prelude:null},getAtruleDescriptor:function(e,t){return this.atrules.hasOwnProperty(e)&&this.atrules.declarators&&this.atrules[e].declarators[t]||null},getProperty:function(e){return this.properties.hasOwnProperty(e)?this.properties[e]:null},getType:function(e){return this.types.hasOwnProperty(e)?this.types[e]:null},validate:function(){function e(r,a,i,o){if(i.hasOwnProperty(a))return i[a];i[a]=!1,null!==o.syntax&&s(o.syntax,(function(s){if("Type"===s.type||"Property"===s.type){var o="Type"===s.type?r.types:r.properties,c="Type"===s.type?t:n;o.hasOwnProperty(s.name)&&!e(r,s.name,c,o[s.name])||(i[a]=!0)}}),this)}var t={},n={};for(var r in this.types)e(this,r,t,this.types[r]);for(var r in this.properties)e(this,r,n,this.properties[r]);return t=Object.keys(t).filter((function(e){return t[e]})),n=Object.keys(n).filter((function(e){return n[e]})),t.length||n.length?{types:t,properties:n}:null},dump:function(e,t){return{generic:this.generic,types:y(this.types,!t,e),properties:y(this.properties,!t,e)}},toString:function(){return JSON.stringify(this.dump())}},Z=k}function ze(){return ee?J:(ee=1,J={SyntaxError:Be(),parse:Ie(),generate:Te(),walk:Ne()})}function Ye(){if(ne)return te;ne=1;var e=Ee(),t=De().isBOM;var n=function(){this.lines=null,this.columns=null,this.linesAndColumnsComputed=!1};return n.prototype={setSource:function(e,t,n,r){this.source=e,this.startOffset=void 0===t?0:t,this.startLine=void 0===n?1:n,this.startColumn=void 0===r?1:r,this.linesAndColumnsComputed=!1},ensureLinesAndColumnsComputed:function(){this.linesAndColumnsComputed||(!function(n,r){for(var a=r.length,i=e(n.lines,a),s=n.startLine,o=e(n.columns,a),c=n.startColumn,l=r.length>0?t(r.charCodeAt(0)):0;l<a;l++){var u=r.charCodeAt(l);i[l]=s,o[l]=c++,10!==u&&13!==u&&12!==u||(13===u&&l+1<a&&10===r.charCodeAt(l+1)&&(i[++l]=s,o[l]=c),s++,c=1)}i[l]=s,o[l]=c,n.lines=i,n.columns=o}(this,this.source),this.linesAndColumnsComputed=!0)},getLocation:function(e,t){return this.ensureLinesAndColumnsComputed(),{source:t,offset:this.startOffset+e,line:this.lines[e],column:this.columns[e]}},getLocationRange:function(e,t,n){return this.ensureLinesAndColumnsComputed(),{source:n,start:{offset:this.startOffset+e,line:this.lines[e],column:this.columns[e]},end:{offset:this.startOffset+t,line:this.lines[t],column:this.columns[t]}}}},te=n}function Ue(){if(ae)return re;ae=1;var e=De().TYPE,t=e.WhiteSpace,n=e.Comment;return re=function(e){var r=this.createList(),a=null,i={recognizer:e,space:null,ignoreWS:!1,ignoreWSAfter:!1};for(this.scanner.skipSC();!this.scanner.eof;){switch(this.scanner.tokenType){case n:this.scanner.next();continue;case t:i.ignoreWS?this.scanner.next():i.space=this.WhiteSpace();continue}if(void 0===(a=e.getNode.call(this,i)))break;null!==i.space&&(r.push(i.space),i.space=null),r.push(a),i.ignoreWSAfter?(i.ignoreWSAfter=!1,i.ignoreWS=!0):i.ignoreWS=!1}return r}}function je(){if(se)r