You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
2 lines
26 KiB
2 lines
26 KiB
5 months ago
|
function y(i){i={...ae,...i};var l=i.inline,m=i.tokenHooks,b=i.documentTypes||{},G=i.mediaTypes||{},J=i.mediaFeatures||{},Q=i.mediaValueKeywords||{},O=i.propertyKeywords||{},F=i.nonStandardPropertyKeywords||{},R=i.fontProperties||{},ee=i.counterDescriptors||{},N=i.colorKeywords||{},V=i.valueKeywords||{},g=i.allowNested,re=i.lineComment,oe=i.supportsAtComponent===!0,W=i.highlightNonStandardPropertyKeywords!==!1,w,n;function c(e,o){return w=o,e}function ie(e,o){var r=e.next();if(m[r]){var t=m[r](e,o);if(t!==!1)return t}if(r=="@")return e.eatWhile(/[\w\\\-]/),c("def",e.current());if(r=="="||(r=="~"||r=="|")&&e.eat("="))return c(null,"compare");if(r=='"'||r=="'")return o.tokenize=$(r),o.tokenize(e,o);if(r=="#")return e.eatWhile(/[\w\\\-]/),c("atom","hash");if(r=="!")return e.match(/^\s*\w*/),c("keyword","important");if(/\d/.test(r)||r=="."&&e.eat(/\d/))return e.eatWhile(/[\w.%]/),c("number","unit");if(r==="-"){if(/[\d.]/.test(e.peek()))return e.eatWhile(/[\w.%]/),c("number","unit");if(e.match(/^-[\w\\\-]*/))return e.eatWhile(/[\w\\\-]/),e.match(/^\s*:/,!1)?c("def","variable-definition"):c("variableName","variable");if(e.match(/^\w+-/))return c("meta","meta")}else return/[,+>*\/]/.test(r)?c(null,"select-op"):r=="."&&e.match(/^-?[_a-z][_a-z0-9-]*/i)?c("qualifier","qualifier"):/[:;{}\[\]\(\)]/.test(r)?c(null,r):e.match(/^[\w-.]+(?=\()/)?(/^(url(-prefix)?|domain|regexp)$/i.test(e.current())&&(o.tokenize=te),c("variableName.function","variable")):/[\w\\\-]/.test(r)?(e.eatWhile(/[\w\\\-]/),c("property","word")):c(null,null)}function $(e){return function(o,r){for(var t=!1,d;(d=o.next())!=null;){if(d==e&&!t){e==")"&&o.backUp(1);break}t=!t&&d=="\\"}return(d==e||!t&&e!=")")&&(r.tokenize=null),c("string","string")}}function te(e,o){return e.next(),e.match(/^\s*[\"\')]/,!1)?o.tokenize=null:o.tokenize=$(")"),c(null,"(")}function D(e,o,r){this.type=e,this.indent=o,this.prev=r}function s(e,o,r,t){return e.context=new D(r,o.indentation()+(t===!1?0:o.indentUnit),e.context),r}function u(e){return e.context.prev&&(e.context=e.context.prev),e.context.type}function k(e,o,r){return a[r.context.type](e,o,r)}function h(e,o,r,t){for(var d=t||1;d>0;d--)r.context=r.context.prev;return k(e,o,r)}function L(e){var o=e.current().toLowerCase();V.hasOwnProperty(o)?n="atom":N.hasOwnProperty(o)?n="keyword":n="variable"}var a={};return a.top=function(e,o,r){if(e=="{")return s(r,o,"block");if(e=="}"&&r.context.prev)return u(r);if(oe&&/@component/i.test(e))return s(r,o,"atComponentBlock");if(/^@(-moz-)?document$/i.test(e))return s(r,o,"documentTypes");if(/^@(media|supports|(-moz-)?document|import)$/i.test(e))return s(r,o,"atBlock");if(/^@(font-face|counter-style)/i.test(e))return r.stateArg=e,"restricted_atBlock_before";if(/^@(-(moz|ms|o|webkit)-)?keyframes$/i.test(e))return"keyframes";if(e&&e.charAt(0)=="@")return s(r,o,"at");if(e=="hash")n="builtin";else if(e=="word")n="tag";else{if(e=="variable-definition")return"maybeprop";if(e=="interpolation")return s(r,o,"interpolation");if(e==":")return"pseudo";if(g&&e=="(")return s(r,o,"parens")}return r.context.type},a.block=function(e,o,r){if(e=="word"){var t=o.current().toLowerCase();return O.hasOwnProperty(t)?(n="property","maybeprop"):F.hasOwnProperty(t)?(n=W?"string.special":"property","maybeprop"):g?(n=o.match(/^\s*:(?:\s|$)/,!1)?"property":"tag","block"):(n="error","maybeprop")}else return e=="meta"?"block":!g&&(e=="hash"||e=="qualifier")?(n="error","block"):a.top(e,o,r)},a.maybeprop=function(e,o,r){return e==":"?s(r,o,"prop"):k(e,o,r)},a.prop=function(e,o,r){if(e==";")return u(r);if(e=="{"&&g)return s(r,o,"propBlock");if(e=="}"||e=="{")return h(e,o,r);if(e=="(")return s(r,o,"parens");if(e=="hash"&&!/^#([0-9a-fA-F]{3,4}|[0-9a-fA-F]{6}|[0-9a-fA-F]{8})$/.test(o.current()))n="error";else if(e=="word")L(o);else if(e=="interpolation")return s(r,o,"interpolation");return"prop"},a.propBlock=function(e,o,r){return e=="}"?u(r):e=="word"?(n="property","maybeprop"):r.context.type},a.parens=function(e,o,r){return e=="{"||e=="}"?h(e,o,r):e==")"?u(r):e=="("?s(r,o,"parens"):e=="interpolation"?s(r,o,"interpolation"):(e=="word"
|