securityos/node_modules/css-tree/dist/csstree.js

12 lines
168 KiB
JavaScript
Raw Permalink Normal View History

2024-09-06 15:32:35 +00:00
var csstree=(()=>{var ns=Object.create;var kt=Object.defineProperty;var os=Object.getOwnPropertyDescriptor;var is=Object.getOwnPropertyNames;var as=Object.getPrototypeOf,ss=Object.prototype.hasOwnProperty;var ze=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),b=(e,t)=>{for(var r in t)kt(e,r,{get:t[r],enumerable:!0})},jo=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of is(t))!ss.call(e,o)&&o!==r&&kt(e,o,{get:()=>t[o],enumerable:!(n=os(t,o))||n.enumerable});return e};var ls=(e,t,r)=>(r=e!=null?ns(as(e)):{},jo(t||!e||!e.__esModule?kt(r,"default",{value:e,enumerable:!0}):r,e)),cs=e=>jo(kt({},"__esModule",{value:!0}),e);var ri=ze(dr=>{var ti="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split("");dr.encode=function(e){if(0<=e&&e<ti.length)return ti[e];throw new TypeError("Must be between 0 and 63: "+e)};dr.decode=function(e){var t=65,r=90,n=97,o=122,i=48,s=57,u=43,c=47,a=26,l=52;return t<=e&&e<=r?e-t:n<=e&&e<=o?e-n+a:i<=e&&e<=s?e-i+l:e==u?62:e==c?63:-1}});var si=ze(br=>{var ni=ri(),gr=5,oi=1<<gr,ii=oi-1,ai=oi;function ws(e){return e<0?(-e<<1)+1:(e<<1)+0}function vs(e){var t=(e&1)===1,r=e>>1;return t?-r:r}br.encode=function(t){var r="",n,o=ws(t);do n=o&ii,o>>>=gr,o>0&&(n|=ai),r+=ni.encode(n);while(o>0);return r};br.decode=function(t,r,n){var o=t.length,i=0,s=0,u,c;do{if(r>=o)throw new Error("Expected more digits in base 64 VLQ value.");if(c=ni.decode(t.charCodeAt(r++)),c===-1)throw new Error("Invalid base64 digit: "+t.charAt(r-1));u=!!(c&ai),c&=ii,i=i+(c<<s),s+=gr}while(u);n.value=vs(i),n.rest=r}});var It=ze(K=>{function Ss(e,t,r){if(t in e)return e[t];if(arguments.length===3)return r;throw new Error('"'+t+'" is a required argument.')}K.getArg=Ss;var li=/^(?:([\w+\-.]+):)?\/\/(?:(\w+:\w+)@)?([\w.-]*)(?::(\d+))?(.*)$/,Cs=/^data:.+\,.+$/;function nt(e){var t=e.match(li);return t?{scheme:t[1],auth:t[2],host:t[3],port:t[4],path:t[5]}:null}K.urlParse=nt;function We(e){var t="";return e.scheme&&(t+=e.scheme+":"),t+="//",e.auth&&(t+=e.auth+"@"),e.host&&(t+=e.host),e.port&&(t+=":"+e.port),e.path&&(t+=e.path),t}K.urlGenerate=We;var As=32;function Ts(e){var t=[];return function(r){for(var n=0;n<t.length;n++)if(t[n].input===r){var o=t[0];return t[0]=t[n],t[n]=o,t[0].result}var i=e(r);return t.unshift({input:r,result:i}),t.length>As&&t.pop(),i}}var xr=Ts(function(t){var r=t,n=nt(t);if(n){if(!n.path)return t;r=n.path}for(var o=K.isAbsolute(r),i=[],s=0,u=0;;)if(s=u,u=r.indexOf("/",s),u===-1){i.push(r.slice(s));break}else for(i.push(r.slice(s,u));u<r.length&&r[u]==="/";)u++;for(var c,a=0,u=i.length-1;u>=0;u--)c=i[u],c==="."?i.splice(u,1):c===".."?a++:a>0&&(c===""?(i.splice(u+1,a),a=0):(i.splice(u,2),a--));return r=i.join("/"),r===""&&(r=o?"/":"."),n?(n.path=r,We(n)):r});K.normalize=xr;function ci(e,t){e===""&&(e="."),t===""&&(t=".");var r=nt(t),n=nt(e);if(n&&(e=n.path||"/"),r&&!r.scheme)return n&&(r.scheme=n.scheme),We(r);if(r||t.match(Cs))return t;if(n&&!n.host&&!n.path)return n.host=t,We(n);var o=t.charAt(0)==="/"?t:xr(e.replace(/\/+$/,"")+"/"+t);return n?(n.path=o,We(n)):o}K.join=ci;K.isAbsolute=function(e){return e.charAt(0)==="/"||li.test(e)};function Es(e,t){e===""&&(e="."),e=e.replace(/\/$/,"");for(var r=0;t.indexOf(e+"/")!==0;){var n=e.lastIndexOf("/");if(n<0||(e=e.slice(0,n),e.match(/^([^\/]+:\/)?\/*$/)))return t;++r}return Array(r+1).join("../")+t.substr(e.length+1)}K.relative=Es;var ui=function(){var e=Object.create(null);return!("__proto__"in e)}();function pi(e){return e}function Ls(e){return hi(e)?"$"+e:e}K.toSetString=ui?pi:Ls;function Ps(e){return hi(e)?e.slice(1):e}K.fromSetString=ui?pi:Ps;function hi(e){if(!e)return!1;var t=e.length;if(t<9||e.charCodeAt(t-1)!==95||e.charCodeAt(t-2)!==95||e.charCodeAt(t-3)!==111||e.charCodeAt(t-4)!==116||e.charCodeAt(t-5)!==111||e.charCodeAt(t-6)!==114||e.charCodeAt(t-7)!==112||e.charCodeAt(t-8)!==95||e.charCodeAt(t-9)!==95)return!1;for(var r=t-10;r>=0;r--)if(e.charCodeAt(r)!==36)return!1;return!0}function Is(e,t,r){var n=be(e.source,t.source);return n!==0||(n=e.originalLine-t.originalLine,n!==0)||(n=e.originalColumn-t.originalColumn,n!==0
`)}})}var pr=100,Vo=60,Ko=" ";function Qo({source:e,line:t,column:r},n){function o(l,p){return i.slice(l,p).map((m,f)=>String(l+f+1).padStart(c)+" |"+m).join(`
`)}let i=e.split(/\r\n?|\n|\f/),s=Math.max(1,t-n)-1,u=Math.min(t+n,i.length+1),c=Math.max(4,String(u).length)+1,a=0;r+=(Ko.length-1)*(i[t-1].substr(0,r-1).match(/\t/g)||[]).length,r>pr&&(a=r-Vo+3,r=Vo-2);for(let l=s;l<=u;l++)l>=0&&l<i.length&&(i[l]=i[l].replace(/\t/g,Ko),i[l]=(a>0&&i[l].length>a?"\u2026":"")+i[l].substr(a,pr-2)+(i[l].length>a+pr-1?"\u2026":""));return[o(s,t),new Array(r+c+2).join("-")+"^",o(t,u)].filter(Boolean).join(`
`)}function hr(e,t,r,n,o){return Object.assign(Le("SyntaxError",e),{source:t,offset:r,line:n,column:o,sourceFragment(s){return Qo({source:t,line:n,column:o},isNaN(s)?0:s)},get formattedMessage(){return`Parse error: ${e}
`+Qo({source:t,line:n,column:o},2)}})}function Xo(e){let t=this.createList(),r=!1,n={recognizer:e};for(;!this.eof;){switch(this.tokenType){case 25:this.next();continue;case 13:r=!0,this.next();continue}let o=e.getNode.call(this,n);if(o===void 0)break;r&&(e.onWhiteSpace&&e.onWhiteSpace.call(this,o,t,n),r=!1),t.push(o)}return r&&e.onWhiteSpace&&e.onWhiteSpace.call(this,null,t,n),t}var $o=()=>{},bs=33,xs=35,mr=59,Zo=123,Jo=0;function ys(e){return function(){return this[e]()}}function fr(e){let t=Object.create(null);for(let r in e){let n=e[r],o=n.parse||n;o&&(t[r]=o)}return t}function ks(e){let t={context:Object.create(null),scope:Object.assign(Object.create(null),e.scope),atrule:fr(e.atrule),pseudo:fr(e.pseudo),node:fr(e.node)};for(let r in e.parseContext)switch(typeof e.parseContext[r]){case"function":t.context[r]=e.parseContext[r];break;case"string":t.context[r]=ys(e.parseContext[r]);break}return{config:t,...t,...t.node}}function ei(e){let t="",r="<unknown>",n=!1,o=$o,i=!1,s=new Pt,u=Object.assign(new Ue,ks(e||{}),{parseAtrulePrelude:!0,parseRulePrelude:!0,parseValue:!0,parseCustomProperty:!1,readSequence:Xo,consumeUntilBalanceEnd:()=>0,consumeUntilLeftCurlyBracket(a){return a===Zo?1:0},consumeUntilLeftCurlyBracketOrSemicolon(a){return a===Zo||a===mr?1:0},consumeUntilExclamationMarkOrSemicolon(a){return a===bs||a===mr?1:0},consumeUntilSemicolonIncluded(a){return a===mr?2:0},createList(){return new D},createSingleNodeList(a){return new D().appendData(a)},getFirstListNode(a){return a&&a.first},getLastListNode(a){return a&&a.last},parseWithFallback(a,l){let p=this.tokenIndex;try{return a.call(this)}catch(m){if(i)throw m;let f=l.call(this,p);return i=!0,o(m,f),i=!1,f}},lookupNonWSType(a){let l;do if(l=this.lookupType(a++),l!==13)return l;while(l!==Jo);return Jo},charCodeAt(a){return a>=0&&a<t.length?t.charCodeAt(a):0},substring(a,l){return t.substring(a,l)},substrToCursor(a){return this.source.substring(a,this.tokenStart)},cmpChar(a,l){return de(t,a,l)},cmpStr(a,l,p){return ge(t,a,l,p)},consume(a){let l=this.tokenStart;return this.eat(a),this.substrToCursor(l)},consumeFunctionName(){let a=t.substring(this.tokenStart,this.tokenEnd-1);return this.eat(2),a},consumeNumber(a){let l=t.substring(this.tokenStart,Te(t,this.tokenStart));return this.eat(a),l},eat(a){if(this.tokenType!==a){let l=Ee[a].slice(0,-6).replace(/-/g," ").replace(/^./,f=>f.toUpperCase()),p=`${/[[\](){}]/.test(l)?`"${l}"`:l} is expected`,m=this.tokenStart;switch(a){case 1:this.tokenType===2||this.tokenType===7?(m=this.tokenEnd-1,p="Identifier is expected but function found"):p="Identifier is expected";break;case 4:this.isDelim(xs)&&(this.next(),m++,p="Name is expected");break;case 11:this.tokenType===10&&(m=this.tokenEnd,p="Percent sign is expected");break}this.error(p,m)}this.next()},eatIdent(a){(this.tokenType!==1||this.lookupValue(0,a)===!1)&&this.error(`Identifier "${a}" is expected`),this.next()},eatDelim(a){this.isDelim(a)||this.error(`Delim "${String.fromCharCode(a)}" is expected`),this.next()},getLocation(a,l){return n?s.getLocationRange(a,l,r):null},getLocationFromList(a){if(n){let l=this.getFirstListNode(a),p=this.getLastListNode(a);return s.getLocationRange(l!==null?l.loc.start.offset-s.startOffset:this.tokenStart,p!==null?p.loc.end.offset-s.startOffset:this.tokenStart,r)}return null},error(a,l){let p=typeof l<"u"&&l<t.length?s.getLocation(l):this.eof?s.getLocation(Wo(t,t.length-1)):s.getLocation(this.tokenStart);throw new hr(a||"Unexpected input",t,p.offset,p.line,p.column)}});return Object.assign(function(a,l){t=a,l=l||{},u.setSource(t,ve),s.setSource(t,l.offset,l.line,l.column),r=l.filename||"<unknown>",n=Boolean(l.positions),o=typeof l.onParseError=="function"?l.onParseError:$o,i=!1,u.parseAtrulePrelude="parseAtrulePrelude"in l?Boolean(l.parseAtrulePrelude):!0,u.parseRulePrelude="parseRulePrelude"in l?Boolean(l.parseRulePrelude):!0,u.parseValue="parseValue"in l?Boolean(l.parseValue):!0,u.parseCustomProperty="parseCustomProperty"in l?Boolean(l.parseCustomProperty):!1;let{context:p="default",onComment:m}=l;if(!(p in u.context))throw new Error("Unkno
`,13,!0)},emit(c){o+=c},result(){return o}};n&&(typeof n.decorator=="function"&&(s=n.decorator(s)),n.sourceMap&&(s=vi(s)),n.mode in Nt&&(s.tokenBefore=Nt[n.mode]));let u={node:c=>s.node(c),children:Hs,token:(c,a)=>s.token(c,a),tokenize:Ys};return s.node(r),s.result()}}function Ti(e){return{fromPlainObject(t){return e(t,{enter(r){r.children&&!(r.children instanceof D)&&(r.children=new D().fromArray(r.children))}}),t},toPlainObject(t){return e(t,{leave(r){r.children&&r.children instanceof D&&(r.children=r.children.toArray())}}),t}}}var{hasOwnProperty:Sr}=Object.prototype,it=function(){};function Ei(e){return typeof e=="function"?e:it}function Li(e,t){return function(r,n,o){r.type===t&&e.call(this,r,n,o)}}function Gs(e,t){let r=t.structure,n=[];for(let o in r){if(Sr.call(r,o)===!1)continue;let i=r[o],s={name:o,type:!1,nullable:!1};Array.isArray(i)||(i=[i]);for(let u of i)u===null?s.nullable=!0:typeof u=="string"?s.type="node":Array.isArray(u)&&(s.type="list");s.type&&n.push(s)}return n.length?{context:t.walkContext,fields:n}:null}function Vs(e){let t={};for(let r in e.node)if(Sr.call(e.node,r)){let n=e.node[r];if(!n.structure)throw new Error("Missed `structure` field in `"+r+"` node type definition");t[r]=Gs(r,n)}return t}function Pi(e,t){let r=e.fields.slice(),n=e.context,o=typeof n=="string";return t&&r.reverse(),function(i,s,u,c){let a;o&&(a=s[n],s[n]=i);for(let l of r){let p=i[l.name];if(!l.nullable||p){if(l.type==="list"){if(t?p.reduceRight(c,!1):p.reduce(c,!1))return!0}else if(u(p))return!0}}o&&(s[n]=a)}}function Ii({StyleSheet:e,Atrule:t,Rule:r,Block:n,DeclarationList:o}){return{Atrule:{StyleSheet:e,Atrule:t,Rule:r,Block:n},Rule:{StyleSheet:e,Atrule:t,Rule:r,Block:n},Declaration:{StyleSheet:e,Atrule:t,Rule:r,Block:n,DeclarationList:o}}}function Di(e){let t=Vs(e),r={},n={},o=Symbol("break-walk"),i=Symbol("skip-node");for(let a in t)Sr.call(t,a)&&t[a]!==null&&(r[a]=Pi(t[a],!1),n[a]=Pi(t[a],!0));let s=Ii(r),u=Ii(n),c=function(a,l){function p(S,R,ke){let z=m.call(X,S,R,ke);return z===o?!0:z===i?!1:!!(P.hasOwnProperty(S.type)&&P[S.type](S,X,p,te)||f.call(X,S,R,ke)===o)}let m=it,f=it,P=r,te=(S,R,ke,z)=>S||p(R,ke,z),X={break:o,skip:i,root:a,stylesheet:null,atrule:null,atrulePrelude:null,rule:null,selector:null,block:null,declaration:null,function:null};if(typeof l=="function")m=l;else if(l&&(m=Ei(l.enter),f=Ei(l.leave),l.reverse&&(P=n),l.visit)){if(s.hasOwnProperty(l.visit))P=l.reverse?u[l.visit]:s[l.visit];else if(!t.hasOwnProperty(l.visit))throw new Error("Bad value `"+l.visit+"` for `visit` option (should be: "+Object.keys(t).sort().join(", ")+")");m=Li(m,l.visit),f=Li(f,l.visit)}if(m===it&&f===it)throw new Error("Neither `enter` nor `leave` walker handler is set or both aren't a function");p(a)};return c.break=o,c.skip=i,c.find=function(a,l){let p=null;return c(a,function(m,f,P){if(l.call(this,m,f,P))return p=m,o}),p},c.findLast=function(a,l){let p=null;return c(a,{reverse:!0,enter(m,f,P){if(l.call(this,m,f,P))return p=m,o}}),p},c.findAll=function(a,l){let p=[];return c(a,function(m,f,P){l.call(this,m,f,P)&&p.push(m)}),p},c}function Ks(e){return e}function Qs(e){let{min:t,max:r,comma:n}=e;return t===0&&r===0?n?"#?":"*":t===0&&r===1?"?":t===1&&r===0?n?"#":"+":t===1&&r===1?"":(n?"#":"")+(t===r?"{"+t+"}":"{"+t+","+(r!==0?r:"")+"}")}function Xs(e){switch(e.type){case"Range":return" ["+(e.min===null?"-\u221E":e.min)+","+(e.max===null?"\u221E":e.max)+"]";default:throw new Error("Unknown node type `"+e.type+"`")}}function $s(e,t,r,n){let o=e.combinator===" "||n?e.combinator:" "+e.combinator+" ",i=e.terms.map(s=>Cr(s,t,r,n)).join(o);return e.explicit||r?(n||i[0]===","?"[":"[ ")+i+(n?"]":" ]"):i}function Cr(e,t,r,n){let o;switch(e.type){case"Group":o=$s(e,t,r,n)+(e.disallowEmpty?"!":"");break;case"Multiplier":return Cr(e.term,t,r,n)+t(Qs(e),e);case"Type":o="<"+e.name+(e.opts?t(Xs(e.opts),e.opts):"")+">";break;case"Property":o="<'"+e.name+"'>";break;case"Keyword":o=e.name;break;case"AtKeyword":o="@"+e.name;break;case"Function":o=e.name+"(";break;case"String":case"Token":o=e.value;break;case"Comma":o=",";break;default:throw new E
syntax: `+o.syntax+`
value: `+(i||"<empty string>")+`
--------`+new Array(o.mismatchOffset+1).join("-")+"^",Object.assign(o,c),o.loc={source:r&&r.loc&&r.loc.source||"<unknown>",start:c,end:a},o};var Mt=new Map,Ye=new Map,Rt=45,st=el,Ft=tl,Js=Ar;function lt(e,t){return t=t||0,e.length-t>=2&&e.charCodeAt(t)===Rt&&e.charCodeAt(t+1)===Rt}function Ar(e,t){if(t=t||0,e.length-t>=3&&e.charCodeAt(t)===Rt&&e.charCodeAt(t+1)!==Rt){let r=e.indexOf("-",t+2);if(r!==-1)return e.substring(t,r+1)}return""}function el(e){if(Mt.has(e))return Mt.get(e);let t=e.toLowerCase(),r=Mt.get(t);if(r===void 0){let n=lt(t,0),o=n?"":Ar(t,0);r=Object.freeze({basename:t.substr(o.length),name:t,prefix:o,vendor:o,custom:n})}return Mt.set(e,r),r}function tl(e){if(Ye.has(e))return Ye.get(e);let t=e,r=e[0];r==="/"?r=e[1]==="/"?"//":"/":r!=="_"&&r!=="*"&&r!=="$"&&r!=="#"&&r!=="+"&&r!=="&"&&(r="");let n=lt(t,r.length);if(!n&&(t=t.toLowerCase(),Ye.has(t))){let u=Ye.get(t);return Ye.set(e,u),u}let o=n?"":Ar(t,r.length),i=t.substr(0,r.length+o.length),s=Object.freeze({basename:t.substr(i.length),name:t.substr(r.length),hack:r,vendor:o,prefix:i,custom:n});return Ye.set(e,s),s}var Bt=["initial","inherit","unset","revert","revert-layer"];var ut=43,he=45,Tr=110,Ge=!0,nl=!1;function Lr(e,t){return e!==null&&e.type===9&&e.value.charCodeAt(0)===t}function ct(e,t,r){for(;e!==null&&(e.type===13||e.type===25);)e=r(++t);return t}function Se(e,t,r,n){if(!e)return 0;let o=e.value.charCodeAt(t);if(o===ut||o===he){if(r)return 0;t++}for(;t<e.value.length;t++)if(!B(e.value.charCodeAt(t)))return 0;return n+1}function Er(e,t,r){let n=!1,o=ct(e,t,r);if(e=r(o),e===null)return t;if(e.type!==10)if(Lr(e,ut)||Lr(e,he)){if(n=!0,o=ct(r(++o),o,r),e=r(o),e===null||e.type!==10)return 0}else return t;if(!n){let i=e.value.charCodeAt(0);if(i!==ut&&i!==he)return 0}return Se(e,n?0:1,n,o)}function Pr(e,t){let r=0;if(!e)return 0;if(e.type===10)return Se(e,0,nl,r);if(e.type===1&&e.value.charCodeAt(0)===he){if(!de(e.value,1,Tr))return 0;switch(e.value.length){case 2:return Er(t(++r),r,t);case 3:return e.value.charCodeAt(2)!==he?0:(r=ct(t(++r),r,t),e=t(r),Se(e,0,Ge,r));default:return e.value.charCodeAt(2)!==he?0:Se(e,3,Ge,r)}}else if(e.type===1||Lr(e,ut)&&t(r+1).type===1){if(e.type!==1&&(e=t(++r)),e===null||!de(e.value,0,Tr))return 0;switch(e.value.length){case 1:return Er(t(++r),r,t);case 2:return e.value.charCodeAt(1)!==he?0:(r=ct(t(++r),r,t),e=t(r),Se(e,0,Ge,r));default:return e.value.charCodeAt(1)!==he?0:Se(e,2,Ge,r)}}else if(e.type===12){let n=e.value.charCodeAt(0),o=n===ut||n===he?1:0,i=o;for(;i<e.value.length&&B(e.value.charCodeAt(i));i++);return i===o||!de(e.value,i,Tr)?0:i+1===e.value.length?Er(t(++r),r,t):e.value.charCodeAt(i+1)!==he?0:i+2===e.value.length?(r=ct(t(++r),r,t),e=t(r),Se(e,0,Ge,r)):Se(e,i+2,Ge,r)}return 0}var ol=43,zi=45,Mi=63,il=117;function Ir(e,t){return e!==null&&e.type===9&&e.value.charCodeAt(0)===t}function al(e,t){return e.value.charCodeAt(0)===t}function pt(e,t,r){let n=0;for(let o=t;o<e.value.length;o++){let i=e.value.charCodeAt(o);if(i===zi&&r&&n!==0)return pt(e,t+n+1,!1),6;if(!ee(i)||++n>6)return 0}return n}function _t(e,t,r){if(!e)return 0;for(;Ir(r(t),Mi);){if(++e>6)return 0;t++}return t}function Dr(e,t){let r=0;if(e===null||e.type!==1||!de(e.value,0,il)||(e=t(++r),e===null))return 0;if(Ir(e,ol))return e=t(++r),e===null?0:e.type===1?_t(pt(e,0,!0),++r,t):Ir(e,Mi)?_t(1,++r,t):0;if(e.type===10){let n=pt(e,1,!0);return n===0?0:(e=t(++r),e===null?r:e.type===12||e.type===10?!al(e,zi)||!pt(e,1,!1)?0:r+1:_t(n,r,t))}return e.type===12?_t(pt(e,1,!0),++r,t):0}var sl=["calc(","-moz-calc(","-webkit-calc("],Or=new Map([[2,22],[21,22],[19,20],[23,24]]);function le(e,t){return t<e.length?e.charCodeAt(t):0}function Ri(e,t){return ge(e,0,e.length,t)}function Fi(e,t){for(let r=0;r<t.length;r++)if(Ri(e,t[r]))return!0;return!1}function Bi(e,t){return t!==e.length-2?!1:le(e,t)===92&&B(le(e,t+1))}function qt(e,t,r){if(e&&e.type==="Range"){let n=Number(r!==void 0&&r!==t.length?t.substr(0,r):t);if(isNaN(n)||e.min!==null&&n<e.min&&typeof e.min!="string"||e.max!==null&&n>e.max&&typeof e.max!="string")return!0}return!1}function ll(e,t){let r=0,n
`+t+`
--`+new Array((r||t.length)+1).join("-")+"^"})}var Pl=9,Il=10,Dl=12,Ol=13,Nl=32,Wt=class{constructor(t){this.str=t,this.pos=0}charCodeAt(t){return t<this.str.length?this.str.charCodeAt(t):0}charCode(){return this.charCodeAt(this.pos)}nextCharCode(){return this.charCodeAt(this.pos+1)}nextNonWsCode(t){return this.charCodeAt(this.findWsEnd(t))}findWsEnd(t){for(;t<this.str.length;t++){let r=this.str.charCodeAt(t);if(r!==Ol&&r!==Il&&r!==Dl&&r!==Nl&&r!==Pl)break}return t}substringToPos(t){return this.str.substring(this.pos,this.pos=t)}eat(t){this.charCode()!==t&&this.error("Expect `"+String.fromCharCode(t)+"`"),this.pos++}peek(){return this.pos<this.str.length?this.str.charAt(this.pos++):""}error(t){throw new jt(t,this.str,this.pos)}};var zl=9,Ml=10,Rl=12,Fl=13,Bl=32,Ki=33,Mr=35,Ui=38,Ht=39,Qi=40,_l=41,Xi=42,Rr=43,Fr=44,ji=45,Br=60,$i=62,zr=63,ql=64,Kt=91,_r=93,Yt=123,Wi=124,Hi=125,Yi=8734,ht=new Uint8Array(128).map((e,t)=>/[a-zA-Z0-9\-]/.test(String.fromCharCode(t))?1:0),Gi={" ":1,"&&":2,"||":3,"|":4};function Gt(e){return e.substringToPos(e.findWsEnd(e.pos))}function Ve(e){let t=e.pos;for(;t<e.str.length;t++){let r=e.str.charCodeAt(t);if(r>=128||ht[r]===0)break}return e.pos===t&&e.error("Expect a keyword"),e.substringToPos(t)}function Vt(e){let t=e.pos;for(;t<e.str.length;t++){let r=e.str.charCodeAt(t);if(r<48||r>57)break}return e.pos===t&&e.error("Expect a number"),e.substringToPos(t)}function Ul(e){let t=e.str.indexOf("'",e.pos+1);return t===-1&&(e.pos=e.str.length,e.error("Expect an apostrophe")),e.substringToPos(t+1)}function Vi(e){let t=null,r=null;return e.eat(Yt),t=Vt(e),e.charCode()===Fr?(e.pos++,e.charCode()!==Hi&&(r=Vt(e))):r=t,e.eat(Hi),{min:Number(t),max:r?Number(r):0}}function jl(e){let t=null,r=!1;switch(e.charCode()){case Xi:e.pos++,t={min:0,max:0};break;case Rr:e.pos++,t={min:1,max:0};break;case zr:e.pos++,t={min:0,max:1};break;case Mr:e.pos++,r=!0,e.charCode()===Yt?t=Vi(e):e.charCode()===zr?(e.pos++,t={min:0,max:0}):t={min:1,max:0};break;case Yt:t=Vi(e);break;default:return null}return{type:"Multiplier",comma:r,min:t.min,max:t.max,term:null}}function Ke(e,t){let r=jl(e);return r!==null?(r.term=t,e.charCode()===Mr&&e.charCodeAt(e.pos-1)===Rr?Ke(e,r):r):t}function Nr(e){let t=e.peek();return t===""?null:{type:"Token",value:t}}function Wl(e){let t;return e.eat(Br),e.eat(Ht),t=Ve(e),e.eat(Ht),e.eat($i),Ke(e,{type:"Property",name:t})}function Hl(e){let t=null,r=null,n=1;return e.eat(Kt),e.charCode()===ji&&(e.peek(),n=-1),n==-1&&e.charCode()===Yi?e.peek():(t=n*Number(Vt(e)),ht[e.charCode()]!==0&&(t+=Ve(e))),Gt(e),e.eat(Fr),Gt(e),e.charCode()===Yi?e.peek():(n=1,e.charCode()===ji&&(e.peek(),n=-1),r=n*Number(Vt(e)),ht[e.charCode()]!==0&&(r+=Ve(e))),e.eat(_r),{type:"Range",min:t,max:r}}function Yl(e){let t,r=null;return e.eat(Br),t=Ve(e),e.charCode()===Qi&&e.nextCharCode()===_l&&(e.pos+=2,t+="()"),e.charCodeAt(e.findWsEnd(e.pos))===Kt&&(Gt(e),r=Hl(e)),e.eat($i),Ke(e,{type:"Type",name:t,opts:r})}function Gl(e){let t=Ve(e);return e.charCode()===Qi?(e.pos++,{type:"Function",name:t}):Ke(e,{type:"Keyword",name:t})}function Vl(e,t){function r(o,i){return{type:"Group",terms:o,combinator:i,disallowEmpty:!1,explicit:!1}}let n;for(t=Object.keys(t).sort((o,i)=>Gi[o]-Gi[i]);t.length>0;){n=t.shift();let o=0,i=0;for(;o<e.length;o++){let s=e[o];s.type==="Combinator"&&(s.value===n?(i===-1&&(i=o-1),e.splice(o,1),o--):(i!==-1&&o-i>1&&(e.splice(i,o-i,r(e.slice(i,o),n)),o=i+1),i=-1))}i!==-1&&t.length&&e.splice(i,o-i,r(e.slice(i,o),n))}return n}function Zi(e){let t=[],r={},n,o=null,i=e.pos;for(;n=Ql(e);)n.type!=="Spaces"&&(n.type==="Combinator"?((o===null||o.type==="Combinator")&&(e.pos=i,e.error("Unexpected combinator")),r[n.value]=!0):o!==null&&o.type!=="Combinator"&&(r[" "]=!0,t.push({type:"Combinator",value:" "})),t.push(n),o=n,i=e.pos);return o!==null&&o.type==="Combinator"&&(e.pos-=i,e.error("Unexpected combinator")),{type:"Group",terms:t,combinator:Vl(t,r)||" ",disallowEmpty:!1,explicit:!1}}function Kl(e){let t;return e.eat(Kt),t=Zi(e),e.eat(_r),t.explicit=!0,e.charCode()===Ki&&(e.pos++,t.disallowEmpty=!0),t}function Ql(e){let t=e