SiteOrigin CSS - Version 1.0.3

Version Description

  • 29 October 2015=
  • Changed video image
  • Adjust revision times by GMT offset.
  • Don't overwrite media queries sub styles, rather just append them.
Download this release

Release Info

Developer gpriday
Plugin Icon 128x128 SiteOrigin CSS
Version 1.0.3
Comparing to
See all releases

Code changes from version 1.0.2 to 1.0.3

Files changed (39) hide show
  1. css/images/video.jpg +0 -0
  2. js/css.js +1 -1
  3. js/css.min.js +1 -79
  4. js/csslint.min.js +4 -277
  5. js/editor.min.js +1 -63
  6. js/inspector.min.js +1 -26
  7. js/jquery.sizes.min.js +1 -8
  8. js/specificity.min.js +1 -3
  9. lib/codemirror/addon/fold/brace-fold.min.js +1 -15
  10. lib/codemirror/addon/fold/comment-fold.min.js +1 -10
  11. lib/codemirror/addon/fold/foldcode.min.js +1 -18
  12. lib/codemirror/addon/fold/foldgutter.min.js +1 -20
  13. lib/codemirror/addon/fold/indent-fold.min.js +1 -6
  14. lib/codemirror/addon/fold/markdown-fold.min.js +1 -8
  15. lib/codemirror/addon/fold/xml-fold.min.js +1 -27
  16. lib/codemirror/addon/hint/anyword-hint.min.js +1 -6
  17. lib/codemirror/addon/hint/css-hint.min.js +1 -11
  18. lib/codemirror/addon/hint/html-hint.min.js +1 -9
  19. lib/codemirror/addon/hint/javascript-hint.min.js +1 -26
  20. lib/codemirror/addon/hint/show-hint.min.js +1 -35
  21. lib/codemirror/addon/hint/sql-hint.min.js +1 -38
  22. lib/codemirror/addon/hint/xml-hint.min.js +1 -22
  23. lib/codemirror/addon/lint/coffeescript-lint.min.js +1 -6
  24. lib/codemirror/addon/lint/css-lint.min.js +1 -6
  25. lib/codemirror/addon/lint/javascript-lint.min.js +1 -15
  26. lib/codemirror/addon/lint/json-lint.min.js +1 -7
  27. lib/codemirror/addon/lint/lint.min.js +1 -34
  28. lib/codemirror/addon/lint/yaml-lint.min.js +1 -7
  29. lib/codemirror/addon/merge/merge.min.js +1 -109
  30. lib/codemirror/lib/codemirror.min.js +5 -1036
  31. lib/codemirror/mode/css/css.min.js +1 -57
  32. lib/codemirror/mode/css/less_test.min.js +1 -3
  33. lib/codemirror/mode/css/scss_test.min.js +1 -3
  34. lib/codemirror/mode/css/test.min.js +1 -3
  35. lib/codemirror/mode/sass/sass.min.js +1 -67
  36. lib/minicolors/jquery.minicolors.min.js +1 -49
  37. readme.txt +10 -5
  38. so-css.php +3 -3
  39. tpl/page.php +2 -7
css/images/video.jpg CHANGED
Binary file
js/css.js CHANGED
@@ -442,7 +442,7 @@
442
  }
443
  }
444
  else {
445
- cssObject.subStyles = minimalObject.subStyles; //TODO, make this intelligent too
446
  }
447
 
448
  }
442
  }
443
  }
444
  else {
445
+ cssObject.subStyles = cssObject.subStyles.concat(minimalObject.subStyles); //TODO, make this intelligent too
446
  }
447
 
448
  }
js/css.min.js CHANGED
@@ -1,79 +1 @@
1
-
2
- (function($){'use strict';var fi=function(){this.cssImportStatements=[];this.cssKeyframeStatements=[];this.cssRegex=new RegExp('([\\s\\S]*?){([\\s\\S]*?)}','gi');this.cssMediaQueryRegex='((@media [\\s\\S]*?){([\\s\\S]*?}\\s*?)})';this.cssKeyframeRegex='((@.*?keyframes [\\s\\S]*?){([\\s\\S]*?}\\s*?)})';this.combinedCSSRegex='((\\s*?@media[\\s\\S]*?){([\\s\\S]*?)}\\s*?})|(([\\s\\S]*?){([\\s\\S]*?)})';this.cssCommentsRegex='(\\/\\*[\\s\\S]*?\\*\\/)';this.cssImportStatementRegex=new RegExp('@import .*?;','gi');};fi.prototype.stripComments=function(cssString){var regex=new RegExp(this.cssCommentsRegex,'gi');return cssString.replace(regex,'');};fi.prototype.parseCSS=function(source){if(source===undefined){return[];}
3
- var css=[];while(true){var imports=this.cssImportStatementRegex.exec(source);if(imports!==null){this.cssImportStatements.push(imports[0]);css.push({selector:'@imports',type:'imports',styles:imports[0]});}
4
- else{break;}}
5
- source=source.replace(this.cssImportStatementRegex,'');var keyframesRegex=new RegExp(this.cssKeyframeRegex,'gi');var arr;while(true){arr=keyframesRegex.exec(source);if(arr===null){break;}
6
- css.push({selector:'@keyframes',type:'keyframes',styles:arr[0]});}
7
- source=source.replace(keyframesRegex,'');var unified=new RegExp(this.combinedCSSRegex,'gi');while(true){arr=unified.exec(source);if(arr===null){break;}
8
- var selector='';if(arr[2]===undefined){selector=arr[5].split('\r\n').join('\n').trim();}
9
- else{selector=arr[2].split('\r\n').join('\n').trim();}
10
- var commentsRegex=new RegExp(this.cssCommentsRegex,'gi');var comments=commentsRegex.exec(selector);if(comments!==null){selector=selector.replace(commentsRegex,'').trim();}
11
- selector=selector.replace(/\n+/,"\n");if(selector.indexOf('@media')!==-1){var cssObject={selector:selector,type:'media',subStyles:this.parseCSS(arr[3]+'\n}')};if(comments!==null){cssObject.comments=comments[0];}
12
- css.push(cssObject);}
13
- else{var rules=this.parseRules(arr[6]);var style={selector:selector,rules:rules};if(selector==='@font-face'){style.type='font-face';}
14
- if(comments!==null){style.comments=comments[0];}
15
- css.push(style);}}
16
- return css;};fi.prototype.parseRules=function(rules){rules=rules.split('\r\n').join('\n');var ret=[];rules=rules.split(';');for(var i=0;i<rules.length;i++){var line=rules[i];line=line.trim();if(line.indexOf(':')!==-1){line=line.split(':');var cssDirective=line[0].trim();var cssValue=line.slice(1).join(':').trim();ret.push({directive:cssDirective,value:cssValue});}
17
- else{if(line.trim().substr(0,7)==='base64,'){ret[ret.length-1].value+=line.trim();}
18
- else{if(line.length>0){ret.push({directive:'',value:line,defective:true});}}}}
19
- return ret;};fi.prototype.findCorrespondingRule=function(rules,directive,value){if(value===undefined){value=false;}
20
- var ret=false;for(var i=0;i<rules.length;i++){if(rules[i].directive==directive){ret=rules[i];if(value===rules[i].value){break;}}}
21
- return ret;};fi.prototype.findBySelector=function(cssObjectArray,selector,contains){if(contains===undefined){contains=false;}
22
- var found=[];for(var i=0;i<cssObjectArray.length;i++){if(contains===false){if(cssObjectArray[i].selector===selector){found.push(cssObjectArray[i]);}}
23
- else{if(cssObjectArray[i].selector.indexOf(selector)!==-1){found.push(cssObjectArray[i]);}}}
24
- if(found.length<2){return found;}
25
- else{var base=found[0];for(i=1;i<found.length;i++){this.intelligentCSSPush([base],found[i]);}
26
- return[base];}};fi.prototype.deleteBySelector=function(cssObjectArray,selector){var ret=[];for(var i=0;i<cssObjectArray.length;i++){if(cssObjectArray[i].selector!==selector){ret.push(cssObjectArray[i]);}}
27
- return ret;};fi.prototype.compressCSS=function(cssObjectArray){var compressed=[];var done={};for(var i=0;i<cssObjectArray.length;i++){var obj=cssObjectArray[i];if(done[obj.selector]===true){continue;}
28
- var found=this.findBySelector(cssObjectArray,obj.selector);if(found.length!==0){compressed.push(found[0]);done[obj.selector]=true;}}
29
- return compressed;};fi.prototype.cssDiff=function(css1,css2){if(css1.selector!==css2.selector){return false;}
30
- if((css1.type==='media'||css2.type==='media')){return false;}
31
- var diff={selector:css1.selector,rules:[]};var rule1,rule2;for(var i=0;i<css1.rules.length;i++){rule1=css1.rules[i];rule2=this.findCorrespondingRule(css2.rules,rule1.directive,rule1.value);if(rule2===false){diff.rules.push(rule1);}
32
- else{if(rule1.value!==rule2.value){diff.rules.push(rule1);}}}
33
- for(var ii=0;ii<css2.rules.length;ii++){rule2=css2.rules[ii];rule1=this.findCorrespondingRule(css1.rules,rule2.directive);if(rule1===false){rule2.type='DELETED';diff.rules.push(rule2);}}
34
- if(diff.rules.length===0){return false;}
35
- return diff;};fi.prototype.intelligentMerge=function(cssObjectArray,newArray,reverse){if(reverse===undefined){reverse=false;}
36
- for(var i=0;i<newArray.length;i++){this.intelligentCSSPush(cssObjectArray,newArray[i],reverse);}
37
- for(i=0;i<cssObjectArray.length;i++){var cobj=cssObjectArray[i];if(cobj.type==='media'||(cobj.type==='keyframes')){continue;}
38
- cobj.rules=this.compactRules(cobj.rules);}};fi.prototype.intelligentCSSPush=function(cssObjectArray,minimalObject,reverse){var pushSelector=minimalObject.selector;var cssObject=false;if(reverse===undefined){reverse=false;}
39
- if(reverse===false){for(var i=0;i<cssObjectArray.length;i++){if(cssObjectArray[i].selector===minimalObject.selector){cssObject=cssObjectArray[i];break;}}}
40
- else{for(var j=cssObjectArray.length-1;j>-1;j--){if(cssObjectArray[j].selector===minimalObject.selector){cssObject=cssObjectArray[j];break;}}}
41
- if(cssObject===false){cssObjectArray.push(minimalObject);}
42
- else{if(minimalObject.type!=='media'){for(var ii=0;ii<minimalObject.rules.length;ii++){var rule=minimalObject.rules[ii];var oldRule=this.findCorrespondingRule(cssObject.rules,rule.directive);if(oldRule===false){cssObject.rules.push(rule);}else if(rule.type==='DELETED'){oldRule.type='DELETED';}
43
- else{oldRule.value=rule.value;}}}
44
- else{cssObject.subStyles=minimalObject.subStyles;}}};fi.prototype.compactRules=function(rules){var newRules=[];for(var i=0;i<rules.length;i++){if(rules[i].type!=='DELETED'){newRules.push(rules[i]);}}
45
- return newRules;};fi.prototype.getCSSForEditor=function(cssBase,depth){if(depth===undefined){depth=0;}
46
- var ret='';if(cssBase===undefined){cssBase=this.css;}
47
- for(var i=0;i<cssBase.length;i++){if(cssBase[i].type==='imports'){ret+=cssBase[i].styles+'\n\n';}}
48
- for(i=0;i<cssBase.length;i++){var tmp=cssBase[i];if(tmp.selector===undefined){continue;}
49
- var comments="";if(tmp.comments!==undefined){comments=tmp.comments+'\n';}
50
- if(tmp.type==='media'){ret+=comments+tmp.selector+'{\n';ret+=this.getCSSForEditor(tmp.subStyles,depth+1);ret+='}\n\n';}
51
- else if(tmp.type!=='keyframes'&&tmp.type!=='imports'){ret+=this.getSpaces(depth)+comments+tmp.selector+' {\n';ret+=this.getCSSOfRules(tmp.rules,depth+1);ret+=this.getSpaces(depth)+'}\n\n';}}
52
- for(i=0;i<cssBase.length;i++){if(cssBase[i].type==='keyframes'){ret+=cssBase[i].styles+'\n\n';}}
53
- return ret;};fi.prototype.getImports=function(cssObjectArray){var imps=[];for(var i=0;i<cssObjectArray.length;i++){if(cssObjectArray[i].type==='imports'){imps.push(cssObjectArray[i].styles);}}
54
- return imps;};fi.prototype.getCSSOfRules=function(rules,depth){var ret='';for(var i=0;i<rules.length;i++){if(rules[i]===undefined){continue;}
55
- if(rules[i].value===''){continue;}
56
- if(rules[i].defective===undefined){ret+=this.getSpaces(depth)+rules[i].directive+': '+rules[i].value+';\n';}
57
- else{ret+=this.getSpaces(depth)+rules[i].value+';\n';}}
58
- return ret||'\n';};fi.prototype.getSpaces=function(num){var ret='';for(var i=0;i<num*2;i++){ret+=' ';}
59
- return ret;};fi.prototype.applyNamespacing=function(css,forcedNamespace){var cssObjectArray=css;var namespaceClass='.'+this.cssPreviewNamespace;if(forcedNamespace!==undefined){namespaceClass=forcedNamespace;}
60
- if(typeof css==='string'){cssObjectArray=this.parseCSS(css);}
61
- for(var i=0;i<cssObjectArray.length;i++){var obj=cssObjectArray[i];if(obj.selector.indexOf('@font-face')>-1||obj.selector.indexOf('keyframes')>-1||obj.selector.indexOf('@import')>-1||obj.selector.indexOf('.form-all')>-1||obj.selector.indexOf('#stage')>-1){continue;}
62
- if(obj.type!=='media'){var selector=obj.selector.split(',');var newSelector=[];for(var j=0;j<selector.length;j++){if(selector[j].indexOf('.supernova')===-1){newSelector.push(namespaceClass+' '+selector[j]);}
63
- else{newSelector.push(selector[j]);}}
64
- obj.selector=newSelector.join(',');}
65
- else{obj.subStyles=this.applyNamespacing(obj.subStyles,forcedNamespace);}}
66
- return cssObjectArray;};fi.prototype.clearNamespacing=function(css,returnObj){if(returnObj===undefined){returnObj=false;}
67
- var cssObjectArray=css;var namespaceClass='.'+this.cssPreviewNamespace;if(typeof css==='string'){cssObjectArray=this.parseCSS(css);}
68
- for(var i=0;i<cssObjectArray.length;i++){var obj=cssObjectArray[i];if(obj.type!=='media'){var selector=obj.selector.split(',');var newSelector=[];for(var j=0;j<selector.length;j++){newSelector.push(selector[j].split(namespaceClass+' ').join(''));}
69
- obj.selector=newSelector.join(',');}
70
- else{obj.subStyles=this.clearNamespacing(obj.subStyles,true);}}
71
- if(returnObj===false){return this.getCSSForEditor(cssObjectArray);}
72
- else{return cssObjectArray;}};fi.prototype.createStyleElement=function(id,css,format){if(format===undefined){format=false;}
73
- if(this.testMode===false&&format!=='nonamespace'){css=this.applyNamespacing(css);}
74
- if(typeof css!=='string'){css=this.getCSSForEditor(css);}
75
- if(format===true){css=this.getCSSForEditor(this.parseCSS(css));}
76
- if(this.testMode!==false){return this.testMode('create style #'+id,css);}
77
- var __el=document.getElementById(id);if(__el){__el.parentNode.removeChild(__el);}
78
- var head=document.head||document.getElementsByTagName('head')[0],style=document.createElement('style');style.id=id;style.type='text/css';head.appendChild(style);if(style.styleSheet&&!style.sheet){style.styleSheet.cssText=css;}
79
- else{style.appendChild(document.createTextNode(css));}};window.cssjs=fi;})();
1
+ !function(e){"use strict";var t=function(){this.cssImportStatements=[],this.cssKeyframeStatements=[],this.cssRegex=new RegExp("([\\s\\S]*?){([\\s\\S]*?)}","gi"),this.cssMediaQueryRegex="((@media [\\s\\S]*?){([\\s\\S]*?}\\s*?)})",this.cssKeyframeRegex="((@.*?keyframes [\\s\\S]*?){([\\s\\S]*?}\\s*?)})",this.combinedCSSRegex="((\\s*?@media[\\s\\S]*?){([\\s\\S]*?)}\\s*?})|(([\\s\\S]*?){([\\s\\S]*?)})",this.cssCommentsRegex="(\\/\\*[\\s\\S]*?\\*\\/)",this.cssImportStatementRegex=new RegExp("@import .*?;","gi")};t.prototype.stripComments=function(e){var t=new RegExp(this.cssCommentsRegex,"gi");return e.replace(t,"")},t.prototype.parseCSS=function(e){if(void 0===e)return[];for(var t=[];;){var s=this.cssImportStatementRegex.exec(e);if(null===s)break;this.cssImportStatements.push(s[0]),t.push({selector:"@imports",type:"imports",styles:s[0]})}e=e.replace(this.cssImportStatementRegex,"");for(var r,i=new RegExp(this.cssKeyframeRegex,"gi");;){if(r=i.exec(e),null===r)break;t.push({selector:"@keyframes",type:"keyframes",styles:r[0]})}e=e.replace(i,"");for(var n=new RegExp(this.combinedCSSRegex,"gi");;){if(r=n.exec(e),null===r)break;var o="";o=void 0===r[2]?r[5].split("\r\n").join("\n").trim():r[2].split("\r\n").join("\n").trim();var l=new RegExp(this.cssCommentsRegex,"gi"),p=l.exec(o);if(null!==p&&(o=o.replace(l,"").trim()),o=o.replace(/\n+/,"\n"),-1!==o.indexOf("@media")){var a={selector:o,type:"media",subStyles:this.parseCSS(r[3]+"\n}")};null!==p&&(a.comments=p[0]),t.push(a)}else{var c=this.parseRules(r[6]),u={selector:o,rules:c};"@font-face"===o&&(u.type="font-face"),null!==p&&(u.comments=p[0]),t.push(u)}}return t},t.prototype.parseRules=function(e){e=e.split("\r\n").join("\n");var t=[];e=e.split(";");for(var s=0;s<e.length;s++){var r=e[s];if(r=r.trim(),-1!==r.indexOf(":")){r=r.split(":");var i=r[0].trim(),n=r.slice(1).join(":").trim();t.push({directive:i,value:n})}else"base64,"===r.trim().substr(0,7)?t[t.length-1].value+=r.trim():r.length>0&&t.push({directive:"",value:r,defective:!0})}return t},t.prototype.findCorrespondingRule=function(e,t,s){void 0===s&&(s=!1);for(var r=!1,i=0;i<e.length&&(e[i].directive!=t||(r=e[i],s!==e[i].value));i++);return r},t.prototype.findBySelector=function(e,t,s){void 0===s&&(s=!1);for(var r=[],i=0;i<e.length;i++)s===!1?e[i].selector===t&&r.push(e[i]):-1!==e[i].selector.indexOf(t)&&r.push(e[i]);if(r.length<2)return r;var n=r[0];for(i=1;i<r.length;i++)this.intelligentCSSPush([n],r[i]);return[n]},t.prototype.deleteBySelector=function(e,t){for(var s=[],r=0;r<e.length;r++)e[r].selector!==t&&s.push(e[r]);return s},t.prototype.compressCSS=function(e){for(var t=[],s={},r=0;r<e.length;r++){var i=e[r];if(s[i.selector]!==!0){var n=this.findBySelector(e,i.selector);0!==n.length&&(t.push(n[0]),s[i.selector]=!0)}}return t},t.prototype.cssDiff=function(e,t){if(e.selector!==t.selector)return!1;if("media"===e.type||"media"===t.type)return!1;for(var s,r,i={selector:e.selector,rules:[]},n=0;n<e.rules.length;n++)s=e.rules[n],r=this.findCorrespondingRule(t.rules,s.directive,s.value),r===!1?i.rules.push(s):s.value!==r.value&&i.rules.push(s);for(var o=0;o<t.rules.length;o++)r=t.rules[o],s=this.findCorrespondingRule(e.rules,r.directive),s===!1&&(r.type="DELETED",i.rules.push(r));return 0===i.rules.length?!1:i},t.prototype.intelligentMerge=function(e,t,s){void 0===s&&(s=!1);for(var r=0;r<t.length;r++)this.intelligentCSSPush(e,t[r],s);for(r=0;r<e.length;r++){var i=e[r];"media"!==i.type&&"keyframes"!==i.type&&(i.rules=this.compactRules(i.rules))}},t.prototype.intelligentCSSPush=function(e,t,s){var r=(t.selector,!1);if(void 0===s&&(s=!1),s===!1){for(var i=0;i<e.length;i++)if(e[i].selector===t.selector){r=e[i];break}}else for(var n=e.length-1;n>-1;n--)if(e[n].selector===t.selector){r=e[n];break}if(r===!1)e.push(t);else if("media"!==t.type)for(var o=0;o<t.rules.length;o++){var l=t.rules[o],p=this.findCorrespondingRule(r.rules,l.directive);p===!1?r.rules.push(l):"DELETED"===l.type?p.type="DELETED":p.value=l.value}else r.subStyles=r.subStyles.concat(t.subStyles)},t.prototype.compactRules=function(e){for(var t=[],s=0;s<e.length;s++)"DELETED"!==e[s].type&&t.push(e[s]);return t},t.prototype.getCSSForEditor=function(e,t){void 0===t&&(t=0);var s="";void 0===e&&(e=this.css);for(var r=0;r<e.length;r++)"imports"===e[r].type&&(s+=e[r].styles+"\n\n");for(r=0;r<e.length;r++){var i=e[r];if(void 0!==i.selector){var n="";void 0!==i.comments&&(n=i.comments+"\n"),"media"===i.type?(s+=n+i.selector+"{\n",s+=this.getCSSForEditor(i.subStyles,t+1),s+="}\n\n"):"keyframes"!==i.type&&"imports"!==i.type&&(s+=this.getSpaces(t)+n+i.selector+" {\n",s+=this.getCSSOfRules(i.rules,t+1),s+=this.getSpaces(t)+"}\n\n")}}for(r=0;r<e.length;r++)"keyframes"===e[r].type&&(s+=e[r].styles+"\n\n");return s},t.prototype.getImports=function(e){for(var t=[],s=0;s<e.length;s++)"imports"===e[s].type&&t.push(e[s].styles);return t},t.prototype.getCSSOfRules=function(e,t){for(var s="",r=0;r<e.length;r++)void 0!==e[r]&&""!==e[r].value&&(s+=void 0===e[r].defective?this.getSpaces(t)+e[r].directive+": "+e[r].value+";\n":this.getSpaces(t)+e[r].value+";\n");return s||"\n"},t.prototype.getSpaces=function(e){for(var t="",s=0;2*e>s;s++)t+=" ";return t},t.prototype.applyNamespacing=function(e,t){var s=e,r="."+this.cssPreviewNamespace;void 0!==t&&(r=t),"string"==typeof e&&(s=this.parseCSS(e));for(var i=0;i<s.length;i++){var n=s[i];if(!(n.selector.indexOf("@font-face")>-1||n.selector.indexOf("keyframes")>-1||n.selector.indexOf("@import")>-1||n.selector.indexOf(".form-all")>-1||n.selector.indexOf("#stage")>-1))if("media"!==n.type){for(var o=n.selector.split(","),l=[],p=0;p<o.length;p++)-1===o[p].indexOf(".supernova")?l.push(r+" "+o[p]):l.push(o[p]);n.selector=l.join(",")}else n.subStyles=this.applyNamespacing(n.subStyles,t)}return s},t.prototype.clearNamespacing=function(e,t){void 0===t&&(t=!1);var s=e,r="."+this.cssPreviewNamespace;"string"==typeof e&&(s=this.parseCSS(e));for(var i=0;i<s.length;i++){var n=s[i];if("media"!==n.type){for(var o=n.selector.split(","),l=[],p=0;p<o.length;p++)l.push(o[p].split(r+" ").join(""));n.selector=l.join(",")}else n.subStyles=this.clearNamespacing(n.subStyles,!0)}return t===!1?this.getCSSForEditor(s):s},t.prototype.createStyleElement=function(e,t,s){if(void 0===s&&(s=!1),this.testMode===!1&&"nonamespace"!==s&&(t=this.applyNamespacing(t)),"string"!=typeof t&&(t=this.getCSSForEditor(t)),s===!0&&(t=this.getCSSForEditor(this.parseCSS(t))),this.testMode!==!1)return this.testMode("create style #"+e,t);var r=document.getElementById(e);r&&r.parentNode.removeChild(r);var i=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.id=e,n.type="text/css",i.appendChild(n),n.styleSheet&&!n.sheet?n.styleSheet.cssText=t:n.appendChild(document.createTextNode(t))},window.cssjs=t}();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
js/csslint.min.js CHANGED
@@ -1,277 +1,4 @@
1
-
2
- var exports=exports||{};var CSSLint=(function(){var parserlib={};(function(){function EventTarget(){this._listeners={};}
3
- EventTarget.prototype={constructor:EventTarget,addListener:function(type,listener){if(!this._listeners[type]){this._listeners[type]=[];}
4
- this._listeners[type].push(listener);},fire:function(event){if(typeof event=="string"){event={type:event};}
5
- if(typeof event.target!="undefined"){event.target=this;}
6
- if(typeof event.type=="undefined"){throw new Error("Event object missing 'type' property.");}
7
- if(this._listeners[event.type]){var listeners=this._listeners[event.type].concat();for(var i=0,len=listeners.length;i<len;i++){listeners[i].call(this,event);}}},removeListener:function(type,listener){if(this._listeners[type]){var listeners=this._listeners[type];for(var i=0,len=listeners.length;i<len;i++){if(listeners[i]===listener){listeners.splice(i,1);break;}}}}};function StringReader(text){this._input=text.replace(/\n\r?/g,"\n");this._line=1;this._col=1;this._cursor=0;}
8
- StringReader.prototype={constructor:StringReader,getCol:function(){return this._col;},getLine:function(){return this._line;},eof:function(){return(this._cursor==this._input.length);},peek:function(count){var c=null;count=(typeof count=="undefined"?1:count);if(this._cursor<this._input.length){c=this._input.charAt(this._cursor+count-1);}
9
- return c;},read:function(){var c=null;if(this._cursor<this._input.length){if(this._input.charAt(this._cursor)=="\n"){this._line++;this._col=1;}else{this._col++;}
10
- c=this._input.charAt(this._cursor++);}
11
- return c;},mark:function(){this._bookmark={cursor:this._cursor,line:this._line,col:this._col};},reset:function(){if(this._bookmark){this._cursor=this._bookmark.cursor;this._line=this._bookmark.line;this._col=this._bookmark.col;delete this._bookmark;}},readTo:function(pattern){var buffer="",c;while(buffer.length<pattern.length||buffer.lastIndexOf(pattern)!=buffer.length-pattern.length){c=this.read();if(c){buffer+=c;}else{throw new Error("Expected \""+pattern+"\" at line "+this._line+", col "+this._col+".");}}
12
- return buffer;},readWhile:function(filter){var buffer="",c=this.read();while(c!==null&&filter(c)){buffer+=c;c=this.read();}
13
- return buffer;},readMatch:function(matcher){var source=this._input.substring(this._cursor),value=null;if(typeof matcher=="string"){if(source.indexOf(matcher)===0){value=this.readCount(matcher.length);}}else if(matcher instanceof RegExp){if(matcher.test(source)){value=this.readCount(RegExp.lastMatch.length);}}
14
- return value;},readCount:function(count){var buffer="";while(count--){buffer+=this.read();}
15
- return buffer;}};function SyntaxError(message,line,col){this.col=col;this.line=line;this.message=message;}
16
- SyntaxError.prototype=new Error();function SyntaxUnit(text,line,col,type){this.col=col;this.line=line;this.text=text;this.type=type;}
17
- SyntaxUnit.fromToken=function(token){return new SyntaxUnit(token.value,token.startLine,token.startCol);};SyntaxUnit.prototype={constructor:SyntaxUnit,valueOf:function(){return this.toString();},toString:function(){return this.text;}};function TokenStreamBase(input,tokenData){this._reader=input?new StringReader(input.toString()):null;this._token=null;this._tokenData=tokenData;this._lt=[];this._ltIndex=0;this._ltIndexCache=[];}
18
- TokenStreamBase.createTokenData=function(tokens){var nameMap=[],typeMap={},tokenData=tokens.concat([]),i=0,len=tokenData.length+1;tokenData.UNKNOWN=-1;tokenData.unshift({name:"EOF"});for(;i<len;i++){nameMap.push(tokenData[i].name);tokenData[tokenData[i].name]=i;if(tokenData[i].text){typeMap[tokenData[i].text]=i;}}
19
- tokenData.name=function(tt){return nameMap[tt];};tokenData.type=function(c){return typeMap[c];};return tokenData;};TokenStreamBase.prototype={constructor:TokenStreamBase,match:function(tokenTypes,channel){if(!(tokenTypes instanceof Array)){tokenTypes=[tokenTypes];}
20
- var tt=this.get(channel),i=0,len=tokenTypes.length;while(i<len){if(tt==tokenTypes[i++]){return true;}}
21
- this.unget();return false;},mustMatch:function(tokenTypes,channel){var token;if(!(tokenTypes instanceof Array)){tokenTypes=[tokenTypes];}
22
- if(!this.match.apply(this,arguments)){token=this.LT(1);throw new SyntaxError("Expected "+this._tokenData[tokenTypes[0]].name+" at line "+token.startLine+", col "+token.startCol+".",token.startLine,token.startCol);}},advance:function(tokenTypes,channel){while(this.LA(0)!==0&&!this.match(tokenTypes,channel)){this.get();}
23
- return this.LA(0);},get:function(channel){var tokenInfo=this._tokenData,reader=this._reader,value,i=0,len=tokenInfo.length,found=false,token,info;if(this._lt.length&&this._ltIndex>=0&&this._ltIndex<this._lt.length){i++;this._token=this._lt[this._ltIndex++];info=tokenInfo[this._token.type];while((info.channel!==undefined&&channel!==info.channel)&&this._ltIndex<this._lt.length){this._token=this._lt[this._ltIndex++];info=tokenInfo[this._token.type];i++;}
24
- if((info.channel===undefined||channel===info.channel)&&this._ltIndex<=this._lt.length){this._ltIndexCache.push(i);return this._token.type;}}
25
- token=this._getToken();if(token.type>-1&&!tokenInfo[token.type].hide){token.channel=tokenInfo[token.type].channel;this._token=token;this._lt.push(token);this._ltIndexCache.push(this._lt.length-this._ltIndex+i);if(this._lt.length>5){this._lt.shift();}
26
- if(this._ltIndexCache.length>5){this._ltIndexCache.shift();}
27
- this._ltIndex=this._lt.length;}
28
- info=tokenInfo[token.type];if(info&&(info.hide||(info.channel!==undefined&&channel!==info.channel))){return this.get(channel);}else{return token.type;}},LA:function(index){var total=index,tt;if(index>0){if(index>5){throw new Error("Too much lookahead.");}
29
- while(total){tt=this.get();total--;}
30
- while(total<index){this.unget();total++;}}else if(index<0){if(this._lt[this._ltIndex+index]){tt=this._lt[this._ltIndex+index].type;}else{throw new Error("Too much lookbehind.");}}else{tt=this._token.type;}
31
- return tt;},LT:function(index){this.LA(index);return this._lt[this._ltIndex+index-1];},peek:function(){return this.LA(1);},token:function(){return this._token;},tokenName:function(tokenType){if(tokenType<0||tokenType>this._tokenData.length){return"UNKNOWN_TOKEN";}else{return this._tokenData[tokenType].name;}},tokenType:function(tokenName){return this._tokenData[tokenName]||-1;},unget:function(){if(this._ltIndexCache.length){this._ltIndex-=this._ltIndexCache.pop();this._token=this._lt[this._ltIndex-1];}else{throw new Error("Too much lookahead.");}}};parserlib.util={StringReader:StringReader,SyntaxError:SyntaxError,SyntaxUnit:SyntaxUnit,EventTarget:EventTarget,TokenStreamBase:TokenStreamBase};})();(function(){var EventTarget=parserlib.util.EventTarget,TokenStreamBase=parserlib.util.TokenStreamBase,StringReader=parserlib.util.StringReader,SyntaxError=parserlib.util.SyntaxError,SyntaxUnit=parserlib.util.SyntaxUnit;var Colors={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgreen:"#90ee90",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370d8",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#d87093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32",activeBorder:"Active window border.",activecaption:"Active window caption.",appworkspace:"Background color of multiple document interface.",background:"Desktop background.",buttonface:"The face background color for 3-D elements that appear 3-D due to one layer of surrounding border.",buttonhighlight:"The color of the border facing the light source for 3-D elements that appear 3-D due to one layer of surrounding border.",buttonshadow:"The color of the border away from the light source for 3-D elements that appear 3-D due to one layer of surrounding border.",buttontext:"Text on push buttons.",captiontext:"Text in caption, size box, and scrollbar arrow box.",graytext:"Grayed (disabled) text. This color is set to #000 if the current display driver does not support a solid gray color.",highlight:"Item(s) selected in a control.",highlighttext:"Text of item(s) selected in a control.",inactiveborder:"Inactive window border.",inactivecaption:"Inactive window caption.",inactivecaptiontext:"Color of text in an inactive caption.",infobackground:"Background color for tooltip controls.",infotext:"Text color for tooltip controls.",menu:"Menu background.",menutext:"Text in menus.",scrollbar:"Scroll bar gray area.",threeddarkshadow:"The color of the darker (generally outer) of the two borders away from the light source for 3-D elements that appear 3-D due to two concentric layers of surrounding border.",threedface:"The face background color for 3-D elements that appear 3-D due to two concentric layers of surrounding border.",threedhighlight:"The color of the lighter (generally outer) of the two borders facing the light source for 3-D elements that appear 3-D due to two concentric layers of surrounding border.",threedlightshadow:"The color of the darker (generally inner) of the two borders facing the light source for 3-D elements that appear 3-D due to two concentric layers of surrounding border.",threedshadow:"The color of the lighter (generally inner) of the two borders away from the light source for 3-D elements that appear 3-D due to two concentric layers of surrounding border.",window:"Window background.",windowframe:"Window frame.",windowtext:"Text in windows."};function Combinator(text,line,col){SyntaxUnit.call(this,text,line,col,Parser.COMBINATOR_TYPE);this.type="unknown";if(/^\s+$/.test(text)){this.type="descendant";}else if(text==">"){this.type="child";}else if(text=="+"){this.type="adjacent-sibling";}else if(text=="~"){this.type="sibling";}}
32
- Combinator.prototype=new SyntaxUnit();Combinator.prototype.constructor=Combinator;function MediaFeature(name,value){SyntaxUnit.call(this,"("+name+(value!==null?":"+value:"")+")",name.startLine,name.startCol,Parser.MEDIA_FEATURE_TYPE);this.name=name;this.value=value;}
33
- MediaFeature.prototype=new SyntaxUnit();MediaFeature.prototype.constructor=MediaFeature;function MediaQuery(modifier,mediaType,features,line,col){SyntaxUnit.call(this,(modifier?modifier+" ":"")+(mediaType?mediaType:"")+(mediaType&&features.length>0?" and ":"")+features.join(" and "),line,col,Parser.MEDIA_QUERY_TYPE);this.modifier=modifier;this.mediaType=mediaType;this.features=features;}
34
- MediaQuery.prototype=new SyntaxUnit();MediaQuery.prototype.constructor=MediaQuery;function Parser(options){EventTarget.call(this);this.options=options||{};this._tokenStream=null;}
35
- Parser.DEFAULT_TYPE=0;Parser.COMBINATOR_TYPE=1;Parser.MEDIA_FEATURE_TYPE=2;Parser.MEDIA_QUERY_TYPE=3;Parser.PROPERTY_NAME_TYPE=4;Parser.PROPERTY_VALUE_TYPE=5;Parser.PROPERTY_VALUE_PART_TYPE=6;Parser.SELECTOR_TYPE=7;Parser.SELECTOR_PART_TYPE=8;Parser.SELECTOR_SUB_PART_TYPE=9;Parser.prototype=function(){var proto=new EventTarget(),prop,additions={constructor:Parser,DEFAULT_TYPE:0,COMBINATOR_TYPE:1,MEDIA_FEATURE_TYPE:2,MEDIA_QUERY_TYPE:3,PROPERTY_NAME_TYPE:4,PROPERTY_VALUE_TYPE:5,PROPERTY_VALUE_PART_TYPE:6,SELECTOR_TYPE:7,SELECTOR_PART_TYPE:8,SELECTOR_SUB_PART_TYPE:9,_stylesheet:function(){var tokenStream=this._tokenStream,charset=null,count,token,tt;this.fire("startstylesheet");this._charset();this._skipCruft();while(tokenStream.peek()==Tokens.IMPORT_SYM){this._import();this._skipCruft();}
36
- while(tokenStream.peek()==Tokens.NAMESPACE_SYM){this._namespace();this._skipCruft();}
37
- tt=tokenStream.peek();while(tt>Tokens.EOF){try{switch(tt){case Tokens.MEDIA_SYM:this._media();this._skipCruft();break;case Tokens.PAGE_SYM:this._page();this._skipCruft();break;case Tokens.FONT_FACE_SYM:this._font_face();this._skipCruft();break;case Tokens.KEYFRAMES_SYM:this._keyframes();this._skipCruft();break;case Tokens.VIEWPORT_SYM:this._viewport();this._skipCruft();break;case Tokens.UNKNOWN_SYM:tokenStream.get();if(!this.options.strict){this.fire({type:"error",error:null,message:"Unknown @ rule: "+tokenStream.LT(0).value+".",line:tokenStream.LT(0).startLine,col:tokenStream.LT(0).startCol});count=0;while(tokenStream.advance([Tokens.LBRACE,Tokens.RBRACE])==Tokens.LBRACE){count++;}
38
- while(count){tokenStream.advance([Tokens.RBRACE]);count--;}}else{throw new SyntaxError("Unknown @ rule.",tokenStream.LT(0).startLine,tokenStream.LT(0).startCol);}
39
- break;case Tokens.S:this._readWhitespace();break;default:if(!this._ruleset()){switch(tt){case Tokens.CHARSET_SYM:token=tokenStream.LT(1);this._charset(false);throw new SyntaxError("@charset not allowed here.",token.startLine,token.startCol);case Tokens.IMPORT_SYM:token=tokenStream.LT(1);this._import(false);throw new SyntaxError("@import not allowed here.",token.startLine,token.startCol);case Tokens.NAMESPACE_SYM:token=tokenStream.LT(1);this._namespace(false);throw new SyntaxError("@namespace not allowed here.",token.startLine,token.startCol);default:tokenStream.get();this._unexpectedToken(tokenStream.token());}}}}catch(ex){if(ex instanceof SyntaxError&&!this.options.strict){this.fire({type:"error",error:ex,message:ex.message,line:ex.line,col:ex.col});}else{throw ex;}}
40
- tt=tokenStream.peek();}
41
- if(tt!=Tokens.EOF){this._unexpectedToken(tokenStream.token());}
42
- this.fire("endstylesheet");},_charset:function(emit){var tokenStream=this._tokenStream,charset,token,line,col;if(tokenStream.match(Tokens.CHARSET_SYM)){line=tokenStream.token().startLine;col=tokenStream.token().startCol;this._readWhitespace();tokenStream.mustMatch(Tokens.STRING);token=tokenStream.token();charset=token.value;this._readWhitespace();tokenStream.mustMatch(Tokens.SEMICOLON);if(emit!==false){this.fire({type:"charset",charset:charset,line:line,col:col});}}},_import:function(emit){var tokenStream=this._tokenStream,tt,uri,importToken,mediaList=[];tokenStream.mustMatch(Tokens.IMPORT_SYM);importToken=tokenStream.token();this._readWhitespace();tokenStream.mustMatch([Tokens.STRING,Tokens.URI]);uri=tokenStream.token().value.replace(/(?:url\()?["']([^"']+)["']\)?/,"$1");this._readWhitespace();mediaList=this._media_query_list();tokenStream.mustMatch(Tokens.SEMICOLON);this._readWhitespace();if(emit!==false){this.fire({type:"import",uri:uri,media:mediaList,line:importToken.startLine,col:importToken.startCol});}},_namespace:function(emit){var tokenStream=this._tokenStream,line,col,prefix,uri;tokenStream.mustMatch(Tokens.NAMESPACE_SYM);line=tokenStream.token().startLine;col=tokenStream.token().startCol;this._readWhitespace();if(tokenStream.match(Tokens.IDENT)){prefix=tokenStream.token().value;this._readWhitespace();}
43
- tokenStream.mustMatch([Tokens.STRING,Tokens.URI]);uri=tokenStream.token().value.replace(/(?:url\()?["']([^"']+)["']\)?/,"$1");this._readWhitespace();tokenStream.mustMatch(Tokens.SEMICOLON);this._readWhitespace();if(emit!==false){this.fire({type:"namespace",prefix:prefix,uri:uri,line:line,col:col});}},_media:function(){var tokenStream=this._tokenStream,line,col,mediaList;tokenStream.mustMatch(Tokens.MEDIA_SYM);line=tokenStream.token().startLine;col=tokenStream.token().startCol;this._readWhitespace();mediaList=this._media_query_list();tokenStream.mustMatch(Tokens.LBRACE);this._readWhitespace();this.fire({type:"startmedia",media:mediaList,line:line,col:col});while(true){if(tokenStream.peek()==Tokens.PAGE_SYM){this._page();}else if(tokenStream.peek()==Tokens.FONT_FACE_SYM){this._font_face();}else if(!this._ruleset()){break;}}
44
- tokenStream.mustMatch(Tokens.RBRACE);this._readWhitespace();this.fire({type:"endmedia",media:mediaList,line:line,col:col});},_media_query_list:function(){var tokenStream=this._tokenStream,mediaList=[];this._readWhitespace();if(tokenStream.peek()==Tokens.IDENT||tokenStream.peek()==Tokens.LPAREN){mediaList.push(this._media_query());}
45
- while(tokenStream.match(Tokens.COMMA)){this._readWhitespace();mediaList.push(this._media_query());}
46
- return mediaList;},_media_query:function(){var tokenStream=this._tokenStream,type=null,ident=null,token=null,expressions=[];if(tokenStream.match(Tokens.IDENT)){ident=tokenStream.token().value.toLowerCase();if(ident!="only"&&ident!="not"){tokenStream.unget();ident=null;}else{token=tokenStream.token();}}
47
- this._readWhitespace();if(tokenStream.peek()==Tokens.IDENT){type=this._media_type();if(token===null){token=tokenStream.token();}}else if(tokenStream.peek()==Tokens.LPAREN){if(token===null){token=tokenStream.LT(1);}
48
- expressions.push(this._media_expression());}
49
- if(type===null&&expressions.length===0){return null;}else{this._readWhitespace();while(tokenStream.match(Tokens.IDENT)){if(tokenStream.token().value.toLowerCase()!="and"){this._unexpectedToken(tokenStream.token());}
50
- this._readWhitespace();expressions.push(this._media_expression());}}
51
- return new MediaQuery(ident,type,expressions,token.startLine,token.startCol);},_media_type:function(){return this._media_feature();},_media_expression:function(){var tokenStream=this._tokenStream,feature=null,token,expression=null;tokenStream.mustMatch(Tokens.LPAREN);feature=this._media_feature();this._readWhitespace();if(tokenStream.match(Tokens.COLON)){this._readWhitespace();token=tokenStream.LT(1);expression=this._expression();}
52
- tokenStream.mustMatch(Tokens.RPAREN);this._readWhitespace();return new MediaFeature(feature,(expression?new SyntaxUnit(expression,token.startLine,token.startCol):null));},_media_feature:function(){var tokenStream=this._tokenStream;tokenStream.mustMatch(Tokens.IDENT);return SyntaxUnit.fromToken(tokenStream.token());},_page:function(){var tokenStream=this._tokenStream,line,col,identifier=null,pseudoPage=null;tokenStream.mustMatch(Tokens.PAGE_SYM);line=tokenStream.token().startLine;col=tokenStream.token().startCol;this._readWhitespace();if(tokenStream.match(Tokens.IDENT)){identifier=tokenStream.token().value;if(identifier.toLowerCase()==="auto"){this._unexpectedToken(tokenStream.token());}}
53
- if(tokenStream.peek()==Tokens.COLON){pseudoPage=this._pseudo_page();}
54
- this._readWhitespace();this.fire({type:"startpage",id:identifier,pseudo:pseudoPage,line:line,col:col});this._readDeclarations(true,true);this.fire({type:"endpage",id:identifier,pseudo:pseudoPage,line:line,col:col});},_margin:function(){var tokenStream=this._tokenStream,line,col,marginSym=this._margin_sym();if(marginSym){line=tokenStream.token().startLine;col=tokenStream.token().startCol;this.fire({type:"startpagemargin",margin:marginSym,line:line,col:col});this._readDeclarations(true);this.fire({type:"endpagemargin",margin:marginSym,line:line,col:col});return true;}else{return false;}},_margin_sym:function(){var tokenStream=this._tokenStream;if(tokenStream.match([Tokens.TOPLEFTCORNER_SYM,Tokens.TOPLEFT_SYM,Tokens.TOPCENTER_SYM,Tokens.TOPRIGHT_SYM,Tokens.TOPRIGHTCORNER_SYM,Tokens.BOTTOMLEFTCORNER_SYM,Tokens.BOTTOMLEFT_SYM,Tokens.BOTTOMCENTER_SYM,Tokens.BOTTOMRIGHT_SYM,Tokens.BOTTOMRIGHTCORNER_SYM,Tokens.LEFTTOP_SYM,Tokens.LEFTMIDDLE_SYM,Tokens.LEFTBOTTOM_SYM,Tokens.RIGHTTOP_SYM,Tokens.RIGHTMIDDLE_SYM,Tokens.RIGHTBOTTOM_SYM]))
55
- {return SyntaxUnit.fromToken(tokenStream.token());}else{return null;}},_pseudo_page:function(){var tokenStream=this._tokenStream;tokenStream.mustMatch(Tokens.COLON);tokenStream.mustMatch(Tokens.IDENT);return tokenStream.token().value;},_font_face:function(){var tokenStream=this._tokenStream,line,col;tokenStream.mustMatch(Tokens.FONT_FACE_SYM);line=tokenStream.token().startLine;col=tokenStream.token().startCol;this._readWhitespace();this.fire({type:"startfontface",line:line,col:col});this._readDeclarations(true);this.fire({type:"endfontface",line:line,col:col});},_viewport:function(){var tokenStream=this._tokenStream,line,col;tokenStream.mustMatch(Tokens.VIEWPORT_SYM);line=tokenStream.token().startLine;col=tokenStream.token().startCol;this._readWhitespace();this.fire({type:"startviewport",line:line,col:col});this._readDeclarations(true);this.fire({type:"endviewport",line:line,col:col});},_operator:function(inFunction){var tokenStream=this._tokenStream,token=null;if(tokenStream.match([Tokens.SLASH,Tokens.COMMA])||(inFunction&&tokenStream.match([Tokens.PLUS,Tokens.STAR,Tokens.MINUS]))){token=tokenStream.token();this._readWhitespace();}
56
- return token?PropertyValuePart.fromToken(token):null;},_combinator:function(){var tokenStream=this._tokenStream,value=null,token;if(tokenStream.match([Tokens.PLUS,Tokens.GREATER,Tokens.TILDE])){token=tokenStream.token();value=new Combinator(token.value,token.startLine,token.startCol);this._readWhitespace();}
57
- return value;},_unary_operator:function(){var tokenStream=this._tokenStream;if(tokenStream.match([Tokens.MINUS,Tokens.PLUS])){return tokenStream.token().value;}else{return null;}},_property:function(){var tokenStream=this._tokenStream,value=null,hack=null,tokenValue,token,line,col;if(tokenStream.peek()==Tokens.STAR&&this.options.starHack){tokenStream.get();token=tokenStream.token();hack=token.value;line=token.startLine;col=token.startCol;}
58
- if(tokenStream.match(Tokens.IDENT)){token=tokenStream.token();tokenValue=token.value;if(tokenValue.charAt(0)=="_"&&this.options.underscoreHack){hack="_";tokenValue=tokenValue.substring(1);}
59
- value=new PropertyName(tokenValue,hack,(line||token.startLine),(col||token.startCol));this._readWhitespace();}
60
- return value;},_ruleset:function(){var tokenStream=this._tokenStream,tt,selectors;try{selectors=this._selectors_group();}catch(ex){if(ex instanceof SyntaxError&&!this.options.strict){this.fire({type:"error",error:ex,message:ex.message,line:ex.line,col:ex.col});tt=tokenStream.advance([Tokens.RBRACE]);if(tt==Tokens.RBRACE){}else{throw ex;}}else{throw ex;}
61
- return true;}
62
- if(selectors){this.fire({type:"startrule",selectors:selectors,line:selectors[0].line,col:selectors[0].col});this._readDeclarations(true);this.fire({type:"endrule",selectors:selectors,line:selectors[0].line,col:selectors[0].col});}
63
- return selectors;},_selectors_group:function(){var tokenStream=this._tokenStream,selectors=[],selector;selector=this._selector();if(selector!==null){selectors.push(selector);while(tokenStream.match(Tokens.COMMA)){this._readWhitespace();selector=this._selector();if(selector!==null){selectors.push(selector);}else{this._unexpectedToken(tokenStream.LT(1));}}}
64
- return selectors.length?selectors:null;},_selector:function(){var tokenStream=this._tokenStream,selector=[],nextSelector=null,combinator=null,ws=null;nextSelector=this._simple_selector_sequence();if(nextSelector===null){return null;}
65
- selector.push(nextSelector);do{combinator=this._combinator();if(combinator!==null){selector.push(combinator);nextSelector=this._simple_selector_sequence();if(nextSelector===null){this._unexpectedToken(tokenStream.LT(1));}else{selector.push(nextSelector);}}else{if(this._readWhitespace()){ws=new Combinator(tokenStream.token().value,tokenStream.token().startLine,tokenStream.token().startCol);combinator=this._combinator();nextSelector=this._simple_selector_sequence();if(nextSelector===null){if(combinator!==null){this._unexpectedToken(tokenStream.LT(1));}}else{if(combinator!==null){selector.push(combinator);}else{selector.push(ws);}
66
- selector.push(nextSelector);}}else{break;}}}while(true);return new Selector(selector,selector[0].line,selector[0].col);},_simple_selector_sequence:function(){var tokenStream=this._tokenStream,elementName=null,modifiers=[],selectorText="",components=[function(){return tokenStream.match(Tokens.HASH)?new SelectorSubPart(tokenStream.token().value,"id",tokenStream.token().startLine,tokenStream.token().startCol):null;},this._class,this._attrib,this._pseudo,this._negation],i=0,len=components.length,component=null,found=false,line,col;line=tokenStream.LT(1).startLine;col=tokenStream.LT(1).startCol;elementName=this._type_selector();if(!elementName){elementName=this._universal();}
67
- if(elementName!==null){selectorText+=elementName;}
68
- while(true){if(tokenStream.peek()===Tokens.S){break;}
69
- while(i<len&&component===null){component=components[i++].call(this);}
70
- if(component===null){if(selectorText===""){return null;}else{break;}}else{i=0;modifiers.push(component);selectorText+=component.toString();component=null;}}
71
- return selectorText!==""?new SelectorPart(elementName,modifiers,selectorText,line,col):null;},_type_selector:function(){var tokenStream=this._tokenStream,ns=this._namespace_prefix(),elementName=this._element_name();if(!elementName){if(ns){tokenStream.unget();if(ns.length>1){tokenStream.unget();}}
72
- return null;}else{if(ns){elementName.text=ns+elementName.text;elementName.col-=ns.length;}
73
- return elementName;}},_class:function(){var tokenStream=this._tokenStream,token;if(tokenStream.match(Tokens.DOT)){tokenStream.mustMatch(Tokens.IDENT);token=tokenStream.token();return new SelectorSubPart("."+token.value,"class",token.startLine,token.startCol-1);}else{return null;}},_element_name:function(){var tokenStream=this._tokenStream,token;if(tokenStream.match(Tokens.IDENT)){token=tokenStream.token();return new SelectorSubPart(token.value,"elementName",token.startLine,token.startCol);}else{return null;}},_namespace_prefix:function(){var tokenStream=this._tokenStream,value="";if(tokenStream.LA(1)===Tokens.PIPE||tokenStream.LA(2)===Tokens.PIPE){if(tokenStream.match([Tokens.IDENT,Tokens.STAR])){value+=tokenStream.token().value;}
74
- tokenStream.mustMatch(Tokens.PIPE);value+="|";}
75
- return value.length?value:null;},_universal:function(){var tokenStream=this._tokenStream,value="",ns;ns=this._namespace_prefix();if(ns){value+=ns;}
76
- if(tokenStream.match(Tokens.STAR)){value+="*";}
77
- return value.length?value:null;},_attrib:function(){var tokenStream=this._tokenStream,value=null,ns,token;if(tokenStream.match(Tokens.LBRACKET)){token=tokenStream.token();value=token.value;value+=this._readWhitespace();ns=this._namespace_prefix();if(ns){value+=ns;}
78
- tokenStream.mustMatch(Tokens.IDENT);value+=tokenStream.token().value;value+=this._readWhitespace();if(tokenStream.match([Tokens.PREFIXMATCH,Tokens.SUFFIXMATCH,Tokens.SUBSTRINGMATCH,Tokens.EQUALS,Tokens.INCLUDES,Tokens.DASHMATCH])){value+=tokenStream.token().value;value+=this._readWhitespace();tokenStream.mustMatch([Tokens.IDENT,Tokens.STRING]);value+=tokenStream.token().value;value+=this._readWhitespace();}
79
- tokenStream.mustMatch(Tokens.RBRACKET);return new SelectorSubPart(value+"]","attribute",token.startLine,token.startCol);}else{return null;}},_pseudo:function(){var tokenStream=this._tokenStream,pseudo=null,colons=":",line,col;if(tokenStream.match(Tokens.COLON)){if(tokenStream.match(Tokens.COLON)){colons+=":";}
80
- if(tokenStream.match(Tokens.IDENT)){pseudo=tokenStream.token().value;line=tokenStream.token().startLine;col=tokenStream.token().startCol-colons.length;}else if(tokenStream.peek()==Tokens.FUNCTION){line=tokenStream.LT(1).startLine;col=tokenStream.LT(1).startCol-colons.length;pseudo=this._functional_pseudo();}
81
- if(pseudo){pseudo=new SelectorSubPart(colons+pseudo,"pseudo",line,col);}}
82
- return pseudo;},_functional_pseudo:function(){var tokenStream=this._tokenStream,value=null;if(tokenStream.match(Tokens.FUNCTION)){value=tokenStream.token().value;value+=this._readWhitespace();value+=this._expression();tokenStream.mustMatch(Tokens.RPAREN);value+=")";}
83
- return value;},_expression:function(){var tokenStream=this._tokenStream,value="";while(tokenStream.match([Tokens.PLUS,Tokens.MINUS,Tokens.DIMENSION,Tokens.NUMBER,Tokens.STRING,Tokens.IDENT,Tokens.LENGTH,Tokens.FREQ,Tokens.ANGLE,Tokens.TIME,Tokens.RESOLUTION,Tokens.SLASH])){value+=tokenStream.token().value;value+=this._readWhitespace();}
84
- return value.length?value:null;},_negation:function(){var tokenStream=this._tokenStream,line,col,value="",arg,subpart=null;if(tokenStream.match(Tokens.NOT)){value=tokenStream.token().value;line=tokenStream.token().startLine;col=tokenStream.token().startCol;value+=this._readWhitespace();arg=this._negation_arg();value+=arg;value+=this._readWhitespace();tokenStream.match(Tokens.RPAREN);value+=tokenStream.token().value;subpart=new SelectorSubPart(value,"not",line,col);subpart.args.push(arg);}
85
- return subpart;},_negation_arg:function(){var tokenStream=this._tokenStream,args=[this._type_selector,this._universal,function(){return tokenStream.match(Tokens.HASH)?new SelectorSubPart(tokenStream.token().value,"id",tokenStream.token().startLine,tokenStream.token().startCol):null;},this._class,this._attrib,this._pseudo],arg=null,i=0,len=args.length,elementName,line,col,part;line=tokenStream.LT(1).startLine;col=tokenStream.LT(1).startCol;while(i<len&&arg===null){arg=args[i].call(this);i++;}
86
- if(arg===null){this._unexpectedToken(tokenStream.LT(1));}
87
- if(arg.type=="elementName"){part=new SelectorPart(arg,[],arg.toString(),line,col);}else{part=new SelectorPart(null,[arg],arg.toString(),line,col);}
88
- return part;},_declaration:function(){var tokenStream=this._tokenStream,property=null,expr=null,prio=null,error=null,invalid=null,propertyName="";property=this._property();if(property!==null){tokenStream.mustMatch(Tokens.COLON);this._readWhitespace();expr=this._expr();if(!expr||expr.length===0){this._unexpectedToken(tokenStream.LT(1));}
89
- prio=this._prio();propertyName=property.toString();if(this.options.starHack&&property.hack=="*"||this.options.underscoreHack&&property.hack=="_"){propertyName=property.text;}
90
- try{this._validateProperty(propertyName,expr);}catch(ex){invalid=ex;}
91
- this.fire({type:"property",property:property,value:expr,important:prio,line:property.line,col:property.col,invalid:invalid});return true;}else{return false;}},_prio:function(){var tokenStream=this._tokenStream,result=tokenStream.match(Tokens.IMPORTANT_SYM);this._readWhitespace();return result;},_expr:function(inFunction){var tokenStream=this._tokenStream,values=[],value=null,operator=null;value=this._term();if(value!==null){values.push(value);do{operator=this._operator(inFunction);if(operator){values.push(operator);}
92
- value=this._term();if(value===null){break;}else{values.push(value);}}while(true);}
93
- return values.length>0?new PropertyValue(values,values[0].line,values[0].col):null;},_term:function(){var tokenStream=this._tokenStream,unary=null,value=null,token,line,col;unary=this._unary_operator();if(unary!==null){line=tokenStream.token().startLine;col=tokenStream.token().startCol;}
94
- if(tokenStream.peek()==Tokens.IE_FUNCTION&&this.options.ieFilters){value=this._ie_function();if(unary===null){line=tokenStream.token().startLine;col=tokenStream.token().startCol;}}else if(tokenStream.match([Tokens.NUMBER,Tokens.PERCENTAGE,Tokens.LENGTH,Tokens.ANGLE,Tokens.TIME,Tokens.FREQ,Tokens.STRING,Tokens.IDENT,Tokens.URI,Tokens.UNICODE_RANGE])){value=tokenStream.token().value;if(unary===null){line=tokenStream.token().startLine;col=tokenStream.token().startCol;}
95
- this._readWhitespace();}else{token=this._hexcolor();if(token===null){if(unary===null){line=tokenStream.LT(1).startLine;col=tokenStream.LT(1).startCol;}
96
- if(value===null){if(tokenStream.LA(3)==Tokens.EQUALS&&this.options.ieFilters){value=this._ie_function();}else{value=this._function();}}}else{value=token.value;if(unary===null){line=token.startLine;col=token.startCol;}}}
97
- return value!==null?new PropertyValuePart(unary!==null?unary+value:value,line,col):null;},_function:function(){var tokenStream=this._tokenStream,functionText=null,expr=null,lt;if(tokenStream.match(Tokens.FUNCTION)){functionText=tokenStream.token().value;this._readWhitespace();expr=this._expr(true);functionText+=expr;if(this.options.ieFilters&&tokenStream.peek()==Tokens.EQUALS){do{if(this._readWhitespace()){functionText+=tokenStream.token().value;}
98
- if(tokenStream.LA(0)==Tokens.COMMA){functionText+=tokenStream.token().value;}
99
- tokenStream.match(Tokens.IDENT);functionText+=tokenStream.token().value;tokenStream.match(Tokens.EQUALS);functionText+=tokenStream.token().value;lt=tokenStream.peek();while(lt!=Tokens.COMMA&&lt!=Tokens.S&&lt!=Tokens.RPAREN){tokenStream.get();functionText+=tokenStream.token().value;lt=tokenStream.peek();}}while(tokenStream.match([Tokens.COMMA,Tokens.S]));}
100
- tokenStream.match(Tokens.RPAREN);functionText+=")";this._readWhitespace();}
101
- return functionText;},_ie_function:function(){var tokenStream=this._tokenStream,functionText=null,expr=null,lt;if(tokenStream.match([Tokens.IE_FUNCTION,Tokens.FUNCTION])){functionText=tokenStream.token().value;do{if(this._readWhitespace()){functionText+=tokenStream.token().value;}
102
- if(tokenStream.LA(0)==Tokens.COMMA){functionText+=tokenStream.token().value;}
103
- tokenStream.match(Tokens.IDENT);functionText+=tokenStream.token().value;tokenStream.match(Tokens.EQUALS);functionText+=tokenStream.token().value;lt=tokenStream.peek();while(lt!=Tokens.COMMA&&lt!=Tokens.S&&lt!=Tokens.RPAREN){tokenStream.get();functionText+=tokenStream.token().value;lt=tokenStream.peek();}}while(tokenStream.match([Tokens.COMMA,Tokens.S]));tokenStream.match(Tokens.RPAREN);functionText+=")";this._readWhitespace();}
104
- return functionText;},_hexcolor:function(){var tokenStream=this._tokenStream,token=null,color;if(tokenStream.match(Tokens.HASH)){token=tokenStream.token();color=token.value;if(!/#[a-f0-9]{3,6}/i.test(color)){throw new SyntaxError("Expected a hex color but found '"+color+"' at line "+token.startLine+", col "+token.startCol+".",token.startLine,token.startCol);}
105
- this._readWhitespace();}
106
- return token;},_keyframes:function(){var tokenStream=this._tokenStream,token,tt,name,prefix="";tokenStream.mustMatch(Tokens.KEYFRAMES_SYM);token=tokenStream.token();if(/^@\-([^\-]+)\-/.test(token.value)){prefix=RegExp.$1;}
107
- this._readWhitespace();name=this._keyframe_name();this._readWhitespace();tokenStream.mustMatch(Tokens.LBRACE);this.fire({type:"startkeyframes",name:name,prefix:prefix,line:token.startLine,col:token.startCol});this._readWhitespace();tt=tokenStream.peek();while(tt==Tokens.IDENT||tt==Tokens.PERCENTAGE){this._keyframe_rule();this._readWhitespace();tt=tokenStream.peek();}
108
- this.fire({type:"endkeyframes",name:name,prefix:prefix,line:token.startLine,col:token.startCol});this._readWhitespace();tokenStream.mustMatch(Tokens.RBRACE);},_keyframe_name:function(){var tokenStream=this._tokenStream,token;tokenStream.mustMatch([Tokens.IDENT,Tokens.STRING]);return SyntaxUnit.fromToken(tokenStream.token());},_keyframe_rule:function(){var tokenStream=this._tokenStream,token,keyList=this._key_list();this.fire({type:"startkeyframerule",keys:keyList,line:keyList[0].line,col:keyList[0].col});this._readDeclarations(true);this.fire({type:"endkeyframerule",keys:keyList,line:keyList[0].line,col:keyList[0].col});},_key_list:function(){var tokenStream=this._tokenStream,token,key,keyList=[];keyList.push(this._key());this._readWhitespace();while(tokenStream.match(Tokens.COMMA)){this._readWhitespace();keyList.push(this._key());this._readWhitespace();}
109
- return keyList;},_key:function(){var tokenStream=this._tokenStream,token;if(tokenStream.match(Tokens.PERCENTAGE)){return SyntaxUnit.fromToken(tokenStream.token());}else if(tokenStream.match(Tokens.IDENT)){token=tokenStream.token();if(/from|to/i.test(token.value)){return SyntaxUnit.fromToken(token);}
110
- tokenStream.unget();}
111
- this._unexpectedToken(tokenStream.LT(1));},_skipCruft:function(){while(this._tokenStream.match([Tokens.S,Tokens.CDO,Tokens.CDC])){}},_readDeclarations:function(checkStart,readMargins){var tokenStream=this._tokenStream,tt;this._readWhitespace();if(checkStart){tokenStream.mustMatch(Tokens.LBRACE);}
112
- this._readWhitespace();try{while(true){if(tokenStream.match(Tokens.SEMICOLON)||(readMargins&&this._margin())){}else if(this._declaration()){if(!tokenStream.match(Tokens.SEMICOLON)){break;}}else{break;}
113
- this._readWhitespace();}
114
- tokenStream.mustMatch(Tokens.RBRACE);this._readWhitespace();}catch(ex){if(ex instanceof SyntaxError&&!this.options.strict){this.fire({type:"error",error:ex,message:ex.message,line:ex.line,col:ex.col});tt=tokenStream.advance([Tokens.SEMICOLON,Tokens.RBRACE]);if(tt==Tokens.SEMICOLON){this._readDeclarations(false,readMargins);}else if(tt!=Tokens.RBRACE){throw ex;}}else{throw ex;}}},_readWhitespace:function(){var tokenStream=this._tokenStream,ws="";while(tokenStream.match(Tokens.S)){ws+=tokenStream.token().value;}
115
- return ws;},_unexpectedToken:function(token){throw new SyntaxError("Unexpected token '"+token.value+"' at line "+token.startLine+", col "+token.startCol+".",token.startLine,token.startCol);},_verifyEnd:function(){if(this._tokenStream.LA(1)!=Tokens.EOF){this._unexpectedToken(this._tokenStream.LT(1));}},_validateProperty:function(property,value){Validation.validate(property,value);},parse:function(input){this._tokenStream=new TokenStream(input,Tokens);this._stylesheet();},parseStyleSheet:function(input){return this.parse(input);},parseMediaQuery:function(input){this._tokenStream=new TokenStream(input,Tokens);var result=this._media_query();this._verifyEnd();return result;},parsePropertyValue:function(input){this._tokenStream=new TokenStream(input,Tokens);this._readWhitespace();var result=this._expr();this._readWhitespace();this._verifyEnd();return result;},parseRule:function(input){this._tokenStream=new TokenStream(input,Tokens);this._readWhitespace();var result=this._ruleset();this._readWhitespace();this._verifyEnd();return result;},parseSelector:function(input){this._tokenStream=new TokenStream(input,Tokens);this._readWhitespace();var result=this._selector();this._readWhitespace();this._verifyEnd();return result;},parseStyleAttribute:function(input){input+="}";this._tokenStream=new TokenStream(input,Tokens);this._readDeclarations();}};for(prop in additions){if(additions.hasOwnProperty(prop)){proto[prop]=additions[prop];}}
116
- return proto;}();var Properties={"alignment-adjust":"auto | baseline | before-edge | text-before-edge | middle | central | after-edge | text-after-edge | ideographic | alphabetic | hanging | mathematical | <percentage> | <length>","alignment-baseline":"baseline | use-script | before-edge | text-before-edge | after-edge | text-after-edge | central | middle | ideographic | alphabetic | hanging | mathematical","animation":1,"animation-delay":{multi:"<time>",comma:true},"animation-direction":{multi:"normal | alternate",comma:true},"animation-duration":{multi:"<time>",comma:true},"animation-iteration-count":{multi:"<number> | infinite",comma:true},"animation-name":{multi:"none | <ident>",comma:true},"animation-play-state":{multi:"running | paused",comma:true},"animation-timing-function":1,"-moz-animation-delay":{multi:"<time>",comma:true},"-moz-animation-direction":{multi:"normal | alternate",comma:true},"-moz-animation-duration":{multi:"<time>",comma:true},"-moz-animation-iteration-count":{multi:"<number> | infinite",comma:true},"-moz-animation-name":{multi:"none | <ident>",comma:true},"-moz-animation-play-state":{multi:"running | paused",comma:true},"-ms-animation-delay":{multi:"<time>",comma:true},"-ms-animation-direction":{multi:"normal | alternate",comma:true},"-ms-animation-duration":{multi:"<time>",comma:true},"-ms-animation-iteration-count":{multi:"<number> | infinite",comma:true},"-ms-animation-name":{multi:"none | <ident>",comma:true},"-ms-animation-play-state":{multi:"running | paused",comma:true},"-webkit-animation-delay":{multi:"<time>",comma:true},"-webkit-animation-direction":{multi:"normal | alternate",comma:true},"-webkit-animation-duration":{multi:"<time>",comma:true},"-webkit-animation-iteration-count":{multi:"<number> | infinite",comma:true},"-webkit-animation-name":{multi:"none | <ident>",comma:true},"-webkit-animation-play-state":{multi:"running | paused",comma:true},"-o-animation-delay":{multi:"<time>",comma:true},"-o-animation-direction":{multi:"normal | alternate",comma:true},"-o-animation-duration":{multi:"<time>",comma:true},"-o-animation-iteration-count":{multi:"<number> | infinite",comma:true},"-o-animation-name":{multi:"none | <ident>",comma:true},"-o-animation-play-state":{multi:"running | paused",comma:true},"appearance":"icon | window | desktop | workspace | document | tooltip | dialog | button | push-button | hyperlink | radio-button | checkbox | menu-item | tab | menu | menubar | pull-down-menu | pop-up-menu | list-menu | radio-group | checkbox-group | outline-tree | range | field | combo-box | signature | password | normal | none | inherit","azimuth":function(expression){var simple="<angle> | leftwards | rightwards | inherit",direction="left-side | far-left | left | center-left | center | center-right | right | far-right | right-side",behind=false,valid=false,part;if(!ValidationTypes.isAny(expression,simple)){if(ValidationTypes.isAny(expression,"behind")){behind=true;valid=true;}
117
- if(ValidationTypes.isAny(expression,direction)){valid=true;if(!behind){ValidationTypes.isAny(expression,"behind");}}}
118
- if(expression.hasNext()){part=expression.next();if(valid){throw new ValidationError("Expected end of value but found '"+part+"'.",part.line,part.col);}else{throw new ValidationError("Expected (<'azimuth'>) but found '"+part+"'.",part.line,part.col);}}},"backface-visibility":"visible | hidden","background":1,"background-attachment":{multi:"<attachment>",comma:true},"background-clip":{multi:"<box>",comma:true},"background-color":"<color> | inherit","background-image":{multi:"<bg-image>",comma:true},"background-origin":{multi:"<box>",comma:true},"background-position":{multi:"<bg-position>",comma:true},"background-repeat":{multi:"<repeat-style>"},"background-size":{multi:"<bg-size>",comma:true},"baseline-shift":"baseline | sub | super | <percentage> | <length>","behavior":1,"binding":1,"bleed":"<length>","bookmark-label":"<content> | <attr> | <string>","bookmark-level":"none | <integer>","bookmark-state":"open | closed","bookmark-target":"none | <uri> | <attr>","border":"<border-width> || <border-style> || <color>","border-bottom":"<border-width> || <border-style> || <color>","border-bottom-color":"<color> | inherit","border-bottom-left-radius":"<x-one-radius>","border-bottom-right-radius":"<x-one-radius>","border-bottom-style":"<border-style>","border-bottom-width":"<border-width>","border-collapse":"collapse | separate | inherit","border-color":{multi:"<color> | inherit",max:4},"border-image":1,"border-image-outset":{multi:"<length> | <number>",max:4},"border-image-repeat":{multi:"stretch | repeat | round",max:2},"border-image-slice":function(expression){var valid=false,numeric="<number> | <percentage>",fill=false,count=0,max=4,part;if(ValidationTypes.isAny(expression,"fill")){fill=true;valid=true;}
119
- while(expression.hasNext()&&count<max){valid=ValidationTypes.isAny(expression,numeric);if(!valid){break;}
120
- count++;}
121
- if(!fill){ValidationTypes.isAny(expression,"fill");}else{valid=true;}
122
- if(expression.hasNext()){part=expression.next();if(valid){throw new ValidationError("Expected end of value but found '"+part+"'.",part.line,part.col);}else{throw new ValidationError("Expected ([<number> | <percentage>]{1,4} && fill?) but found '"+part+"'.",part.line,part.col);}}},"border-image-source":"<image> | none","border-image-width":{multi:"<length> | <percentage> | <number> | auto",max:4},"border-left":"<border-width> || <border-style> || <color>","border-left-color":"<color> | inherit","border-left-style":"<border-style>","border-left-width":"<border-width>","border-radius":function(expression){var valid=false,simple="<length> | <percentage> | inherit",slash=false,fill=false,count=0,max=8,part;while(expression.hasNext()&&count<max){valid=ValidationTypes.isAny(expression,simple);if(!valid){if(expression.peek()=="/"&&count>0&&!slash){slash=true;max=count+5;expression.next();}else{break;}}
123
- count++;}
124
- if(expression.hasNext()){part=expression.next();if(valid){throw new ValidationError("Expected end of value but found '"+part+"'.",part.line,part.col);}else{throw new ValidationError("Expected (<'border-radius'>) but found '"+part+"'.",part.line,part.col);}}},"border-right":"<border-width> || <border-style> || <color>","border-right-color":"<color> | inherit","border-right-style":"<border-style>","border-right-width":"<border-width>","border-spacing":{multi:"<length> | inherit",max:2},"border-style":{multi:"<border-style>",max:4},"border-top":"<border-width> || <border-style> || <color>","border-top-color":"<color> | inherit","border-top-left-radius":"<x-one-radius>","border-top-right-radius":"<x-one-radius>","border-top-style":"<border-style>","border-top-width":"<border-width>","border-width":{multi:"<border-width>",max:4},"bottom":"<margin-width> | inherit","box-align":"start | end | center | baseline | stretch","box-decoration-break":"slice |clone","box-direction":"normal | reverse | inherit","box-flex":"<number>","box-flex-group":"<integer>","box-lines":"single | multiple","box-ordinal-group":"<integer>","box-orient":"horizontal | vertical | inline-axis | block-axis | inherit","box-pack":"start | end | center | justify","box-shadow":function(expression){var result=false,part;if(!ValidationTypes.isAny(expression,"none")){Validation.multiProperty("<shadow>",expression,true,Infinity);}else{if(expression.hasNext()){part=expression.next();throw new ValidationError("Expected end of value but found '"+part+"'.",part.line,part.col);}}},"box-sizing":"content-box | border-box | inherit","break-after":"auto | always | avoid | left | right | page | column | avoid-page | avoid-column","break-before":"auto | always | avoid | left | right | page | column | avoid-page | avoid-column","break-inside":"auto | avoid | avoid-page | avoid-column","caption-side":"top | bottom | inherit","clear":"none | right | left | both | inherit","clip":1,"color":"<color> | inherit","color-profile":1,"column-count":"<integer> | auto","column-fill":"auto | balance","column-gap":"<length> | normal","column-rule":"<border-width> || <border-style> || <color>","column-rule-color":"<color>","column-rule-style":"<border-style>","column-rule-width":"<border-width>","column-span":"none | all","column-width":"<length> | auto","columns":1,"content":1,"counter-increment":1,"counter-reset":1,"crop":"<shape> | auto","cue":"cue-after | cue-before | inherit","cue-after":1,"cue-before":1,"cursor":1,"direction":"ltr | rtl | inherit","display":"inline | block | list-item | inline-block | table | inline-table | table-row-group | table-header-group | table-footer-group | table-row | table-column-group | table-column | table-cell | table-caption | box | inline-box | grid | inline-grid | none | inherit | -moz-box | -moz-inline-block | -moz-inline-box | -moz-inline-grid | -moz-inline-stack | -moz-inline-table | -moz-grid | -moz-grid-group | -moz-grid-line | -moz-groupbox | -moz-deck | -moz-popup | -moz-stack | -moz-marker | -webkit-box | -webkit-inline-box","dominant-baseline":1,"drop-initial-after-adjust":"central | middle | after-edge | text-after-edge | ideographic | alphabetic | mathematical | <percentage> | <length>","drop-initial-after-align":"baseline | use-script | before-edge | text-before-edge | after-edge | text-after-edge | central | middle | ideographic | alphabetic | hanging | mathematical","drop-initial-before-adjust":"before-edge | text-before-edge | central | middle | hanging | mathematical | <percentage> | <length>","drop-initial-before-align":"caps-height | baseline | use-script | before-edge | text-before-edge | after-edge | text-after-edge | central | middle | ideographic | alphabetic | hanging | mathematical","drop-initial-size":"auto | line | <length> | <percentage>","drop-initial-value":"initial | <integer>","elevation":"<angle> | below | level | above | higher | lower | inherit","empty-cells":"show | hide | inherit","filter":1,"fit":"fill | hidden | meet | slice","fit-position":1,"float":"left | right | none | inherit","float-offset":1,"font":1,"font-family":1,"font-size":"<absolute-size> | <relative-size> | <length> | <percentage> | inherit","font-size-adjust":"<number> | none | inherit","font-stretch":"normal | ultra-condensed | extra-condensed | condensed | semi-condensed | semi-expanded | expanded | extra-expanded | ultra-expanded | inherit","font-style":"normal | italic | oblique | inherit","font-variant":"normal | small-caps | inherit","font-weight":"normal | bold | bolder | lighter | 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900 | inherit","grid-cell-stacking":"columns | rows | layer","grid-column":1,"grid-columns":1,"grid-column-align":"start | end | center | stretch","grid-column-sizing":1,"grid-column-span":"<integer>","grid-flow":"none | rows | columns","grid-layer":"<integer>","grid-row":1,"grid-rows":1,"grid-row-align":"start | end | center | stretch","grid-row-span":"<integer>","grid-row-sizing":1,"hanging-punctuation":1,"height":"<margin-width> | inherit","hyphenate-after":"<integer> | auto","hyphenate-before":"<integer> | auto","hyphenate-character":"<string> | auto","hyphenate-lines":"no-limit | <integer>","hyphenate-resource":1,"hyphens":"none | manual | auto","icon":1,"image-orientation":"angle | auto","image-rendering":1,"image-resolution":1,"inline-box-align":"initial | last | <integer>","left":"<margin-width> | inherit","letter-spacing":"<length> | normal | inherit","line-height":"<number> | <length> | <percentage> | normal | inherit","line-break":"auto | loose | normal | strict","line-stacking":1,"line-stacking-ruby":"exclude-ruby | include-ruby","line-stacking-shift":"consider-shifts | disregard-shifts","line-stacking-strategy":"inline-line-height | block-line-height | max-height | grid-height","list-style":1,"list-style-image":"<uri> | none | inherit","list-style-position":"inside | outside | inherit","list-style-type":"disc | circle | square | decimal | decimal-leading-zero | lower-roman | upper-roman | lower-greek | lower-latin | upper-latin | armenian | georgian | lower-alpha | upper-alpha | none | inherit","margin":{multi:"<margin-width> | inherit",max:4},"margin-bottom":"<margin-width> | inherit","margin-left":"<margin-width> | inherit","margin-right":"<margin-width> | inherit","margin-top":"<margin-width> | inherit","mark":1,"mark-after":1,"mark-before":1,"marks":1,"marquee-direction":1,"marquee-play-count":1,"marquee-speed":1,"marquee-style":1,"max-height":"<length> | <percentage> | none | inherit","max-width":"<length> | <percentage> | none | inherit","min-height":"<length> | <percentage> | inherit","min-width":"<length> | <percentage> | inherit","move-to":1,"nav-down":1,"nav-index":1,"nav-left":1,"nav-right":1,"nav-up":1,"opacity":"<number> | inherit","orphans":"<integer> | inherit","outline":1,"outline-color":"<color> | invert | inherit","outline-offset":1,"outline-style":"<border-style> | inherit","outline-width":"<border-width> | inherit","overflow":"visible | hidden | scroll | auto | inherit","overflow-style":1,"overflow-x":1,"overflow-y":1,"padding":{multi:"<padding-width> | inherit",max:4},"padding-bottom":"<padding-width> | inherit","padding-left":"<padding-width> | inherit","padding-right":"<padding-width> | inherit","padding-top":"<padding-width> | inherit","page":1,"page-break-after":"auto | always | avoid | left | right | inherit","page-break-before":"auto | always | avoid | left | right | inherit","page-break-inside":"auto | avoid | inherit","page-policy":1,"pause":1,"pause-after":1,"pause-before":1,"perspective":1,"perspective-origin":1,"phonemes":1,"pitch":1,"pitch-range":1,"play-during":1,"pointer-events":"auto | none | visiblePainted | visibleFill | visibleStroke | visible | painted | fill | stroke | all | inherit","position":"static | relative | absolute | fixed | inherit","presentation-level":1,"punctuation-trim":1,"quotes":1,"rendering-intent":1,"resize":1,"rest":1,"rest-after":1,"rest-before":1,"richness":1,"right":"<margin-width> | inherit","rotation":1,"rotation-point":1,"ruby-align":1,"ruby-overhang":1,"ruby-position":1,"ruby-span":1,"size":1,"speak":"normal | none | spell-out | inherit","speak-header":"once | always | inherit","speak-numeral":"digits | continuous | inherit","speak-punctuation":"code | none | inherit","speech-rate":1,"src":1,"stress":1,"string-set":1,"table-layout":"auto | fixed | inherit","tab-size":"<integer> | <length>","target":1,"target-name":1,"target-new":1,"target-position":1,"text-align":"left | right | center | justify | inherit","text-align-last":1,"text-decoration":1,"text-emphasis":1,"text-height":1,"text-indent":"<length> | <percentage> | inherit","text-justify":"auto | none | inter-word | inter-ideograph | inter-cluster | distribute | kashida","text-outline":1,"text-overflow":1,"text-rendering":"auto | optimizeSpeed | optimizeLegibility | geometricPrecision | inherit","text-shadow":1,"text-transform":"capitalize | uppercase | lowercase | none | inherit","text-wrap":"normal | none | avoid","top":"<margin-width> | inherit","transform":1,"transform-origin":1,"transform-style":1,"transition":1,"transition-delay":1,"transition-duration":1,"transition-property":1,"transition-timing-function":1,"unicode-bidi":"normal | embed | bidi-override | inherit","user-modify":"read-only | read-write | write-only | inherit","user-select":"none | text | toggle | element | elements | all | inherit","vertical-align":"auto | use-script | baseline | sub | super | top | text-top | central | middle | bottom | text-bottom | <percentage> | <length>","visibility":"visible | hidden | collapse | inherit","voice-balance":1,"voice-duration":1,"voice-family":1,"voice-pitch":1,"voice-pitch-range":1,"voice-rate":1,"voice-stress":1,"voice-volume":1,"volume":1,"white-space":"normal | pre | nowrap | pre-wrap | pre-line | inherit | -pre-wrap | -o-pre-wrap | -moz-pre-wrap | -hp-pre-wrap","white-space-collapse":1,"widows":"<integer> | inherit","width":"<length> | <percentage> | auto | inherit","word-break":"normal | keep-all | break-all","word-spacing":"<length> | normal | inherit","word-wrap":1,"z-index":"<integer> | auto | inherit","zoom":"<number> | <percentage> | normal"};function PropertyName(text,hack,line,col){SyntaxUnit.call(this,text,line,col,Parser.PROPERTY_NAME_TYPE);this.hack=hack;}
125
- PropertyName.prototype=new SyntaxUnit();PropertyName.prototype.constructor=PropertyName;PropertyName.prototype.toString=function(){return(this.hack?this.hack:"")+this.text;};function PropertyValue(parts,line,col){SyntaxUnit.call(this,parts.join(" "),line,col,Parser.PROPERTY_VALUE_TYPE);this.parts=parts;}
126
- PropertyValue.prototype=new SyntaxUnit();PropertyValue.prototype.constructor=PropertyValue;function PropertyValueIterator(value){this._i=0;this._parts=value.parts;this._marks=[];this.value=value;}
127
- PropertyValueIterator.prototype.count=function(){return this._parts.length;};PropertyValueIterator.prototype.isFirst=function(){return this._i===0;};PropertyValueIterator.prototype.hasNext=function(){return(this._i<this._parts.length);};PropertyValueIterator.prototype.mark=function(){this._marks.push(this._i);};PropertyValueIterator.prototype.peek=function(count){return this.hasNext()?this._parts[this._i+(count||0)]:null;};PropertyValueIterator.prototype.next=function(){return this.hasNext()?this._parts[this._i++]:null;};PropertyValueIterator.prototype.previous=function(){return this._i>0?this._parts[--this._i]:null;};PropertyValueIterator.prototype.restore=function(){if(this._marks.length){this._i=this._marks.pop();}};function PropertyValuePart(text,line,col){SyntaxUnit.call(this,text,line,col,Parser.PROPERTY_VALUE_PART_TYPE);this.type="unknown";var temp;if(/^([+\-]?[\d\.]+)([a-z]+)$/i.test(text)){this.type="dimension";this.value=+RegExp.$1;this.units=RegExp.$2;switch(this.units.toLowerCase()){case"em":case"rem":case"ex":case"px":case"cm":case"mm":case"in":case"pt":case"pc":case"ch":case"vh":case"vw":case"vm":this.type="length";break;case"deg":case"rad":case"grad":this.type="angle";break;case"ms":case"s":this.type="time";break;case"hz":case"khz":this.type="frequency";break;case"dpi":case"dpcm":this.type="resolution";break;}}else if(/^([+\-]?[\d\.]+)%$/i.test(text)){this.type="percentage";this.value=+RegExp.$1;}else if(/^([+\-]?[\d\.]+)%$/i.test(text)){this.type="percentage";this.value=+RegExp.$1;}else if(/^([+\-]?\d+)$/i.test(text)){this.type="integer";this.value=+RegExp.$1;}else if(/^([+\-]?[\d\.]+)$/i.test(text)){this.type="number";this.value=+RegExp.$1;}else if(/^#([a-f0-9]{3,6})/i.test(text)){this.type="color";temp=RegExp.$1;if(temp.length==3){this.red=parseInt(temp.charAt(0)+temp.charAt(0),16);this.green=parseInt(temp.charAt(1)+temp.charAt(1),16);this.blue=parseInt(temp.charAt(2)+temp.charAt(2),16);}else{this.red=parseInt(temp.substring(0,2),16);this.green=parseInt(temp.substring(2,4),16);this.blue=parseInt(temp.substring(4,6),16);}}else if(/^rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)/i.test(text)){this.type="color";this.red=+RegExp.$1;this.green=+RegExp.$2;this.blue=+RegExp.$3;}else if(/^rgb\(\s*(\d+)%\s*,\s*(\d+)%\s*,\s*(\d+)%\s*\)/i.test(text)){this.type="color";this.red=+RegExp.$1*255/100;this.green=+RegExp.$2*255/100;this.blue=+RegExp.$3*255/100;}else if(/^rgba\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*([\d\.]+)\s*\)/i.test(text)){this.type="color";this.red=+RegExp.$1;this.green=+RegExp.$2;this.blue=+RegExp.$3;this.alpha=+RegExp.$4;}else if(/^rgba\(\s*(\d+)%\s*,\s*(\d+)%\s*,\s*(\d+)%\s*,\s*([\d\.]+)\s*\)/i.test(text)){this.type="color";this.red=+RegExp.$1*255/100;this.green=+RegExp.$2*255/100;this.blue=+RegExp.$3*255/100;this.alpha=+RegExp.$4;}else if(/^hsl\(\s*(\d+)\s*,\s*(\d+)%\s*,\s*(\d+)%\s*\)/i.test(text)){this.type="color";this.hue=+RegExp.$1;this.saturation=+RegExp.$2/100;this.lightness=+RegExp.$3/100;}else if(/^hsla\(\s*(\d+)\s*,\s*(\d+)%\s*,\s*(\d+)%\s*,\s*([\d\.]+)\s*\)/i.test(text)){this.type="color";this.hue=+RegExp.$1;this.saturation=+RegExp.$2/100;this.lightness=+RegExp.$3/100;this.alpha=+RegExp.$4;}else if(/^url\(["']?([^\)"']+)["']?\)/i.test(text)){this.type="uri";this.uri=RegExp.$1;}else if(/^([^\(]+)\(/i.test(text)){this.type="function";this.name=RegExp.$1;this.value=text;}else if(/^["'][^"']*["']/.test(text)){this.type="string";this.value=eval(text);}else if(Colors[text.toLowerCase()]){this.type="color";temp=Colors[text.toLowerCase()].substring(1);this.red=parseInt(temp.substring(0,2),16);this.green=parseInt(temp.substring(2,4),16);this.blue=parseInt(temp.substring(4,6),16);}else if(/^[\,\/]$/.test(text)){this.type="operator";this.value=text;}else if(/^[a-z\-\u0080-\uFFFF][a-z0-9\-\u0080-\uFFFF]*$/i.test(text)){this.type="identifier";this.value=text;}}
128
- PropertyValuePart.prototype=new SyntaxUnit();PropertyValuePart.prototype.constructor=PropertyValuePart;PropertyValuePart.fromToken=function(token){return new PropertyValuePart(token.value,token.startLine,token.startCol);};var Pseudos={":first-letter":1,":first-line":1,":before":1,":after":1};Pseudos.ELEMENT=1;Pseudos.CLASS=2;Pseudos.isElement=function(pseudo){return pseudo.indexOf("::")===0||Pseudos[pseudo.toLowerCase()]==Pseudos.ELEMENT;};function Selector(parts,line,col){SyntaxUnit.call(this,parts.join(" "),line,col,Parser.SELECTOR_TYPE);this.parts=parts;this.specificity=Specificity.calculate(this);}
129
- Selector.prototype=new SyntaxUnit();Selector.prototype.constructor=Selector;function SelectorPart(elementName,modifiers,text,line,col){SyntaxUnit.call(this,text,line,col,Parser.SELECTOR_PART_TYPE);this.elementName=elementName;this.modifiers=modifiers;}
130
- SelectorPart.prototype=new SyntaxUnit();SelectorPart.prototype.constructor=SelectorPart;function SelectorSubPart(text,type,line,col){SyntaxUnit.call(this,text,line,col,Parser.SELECTOR_SUB_PART_TYPE);this.type=type;this.args=[];}
131
- SelectorSubPart.prototype=new SyntaxUnit();SelectorSubPart.prototype.constructor=SelectorSubPart;function Specificity(a,b,c,d){this.a=a;this.b=b;this.c=c;this.d=d;}
132
- Specificity.prototype={constructor:Specificity,compare:function(other){var comps=["a","b","c","d"],i,len;for(i=0,len=comps.length;i<len;i++){if(this[comps[i]]<other[comps[i]]){return-1;}else if(this[comps[i]]>other[comps[i]]){return 1;}}
133
- return 0;},valueOf:function(){return(this.a*1000)+(this.b*100)+(this.c*10)+this.d;},toString:function(){return this.a+","+this.b+","+this.c+","+this.d;}};Specificity.calculate=function(selector){var i,len,part,b=0,c=0,d=0;function updateValues(part){var i,j,len,num,elementName=part.elementName?part.elementName.text:"",modifier;if(elementName&&elementName.charAt(elementName.length-1)!="*"){d++;}
134
- for(i=0,len=part.modifiers.length;i<len;i++){modifier=part.modifiers[i];switch(modifier.type){case"class":case"attribute":c++;break;case"id":b++;break;case"pseudo":if(Pseudos.isElement(modifier.text)){d++;}else{c++;}
135
- break;case"not":for(j=0,num=modifier.args.length;j<num;j++){updateValues(modifier.args[j]);}}}}
136
- for(i=0,len=selector.parts.length;i<len;i++){part=selector.parts[i];if(part instanceof SelectorPart){updateValues(part);}}
137
- return new Specificity(0,b,c,d);};var h=/^[0-9a-fA-F]$/,nonascii=/^[\u0080-\uFFFF]$/,nl=/\n|\r\n|\r|\f/;function isHexDigit(c){return c!==null&&h.test(c);}
138
- function isDigit(c){return c!==null&&/\d/.test(c);}
139
- function isWhitespace(c){return c!==null&&/\s/.test(c);}
140
- function isNewLine(c){return c!==null&&nl.test(c);}
141
- function isNameStart(c){return c!==null&&(/[a-z_\u0080-\uFFFF\\]/i.test(c));}
142
- function isNameChar(c){return c!==null&&(isNameStart(c)||/[0-9\-\\]/.test(c));}
143
- function isIdentStart(c){return c!==null&&(isNameStart(c)||/\-\\/.test(c));}
144
- function mix(receiver,supplier){for(var prop in supplier){if(supplier.hasOwnProperty(prop)){receiver[prop]=supplier[prop];}}
145
- return receiver;}
146
- function TokenStream(input){TokenStreamBase.call(this,input,Tokens);}
147
- TokenStream.prototype=mix(new TokenStreamBase(),{_getToken:function(channel){var c,reader=this._reader,token=null,startLine=reader.getLine(),startCol=reader.getCol();c=reader.read();while(c){switch(c){case"/":if(reader.peek()=="*"){token=this.commentToken(c,startLine,startCol);}else{token=this.charToken(c,startLine,startCol);}
148
- break;case"|":case"~":case"^":case"$":case"*":if(reader.peek()=="="){token=this.comparisonToken(c,startLine,startCol);}else{token=this.charToken(c,startLine,startCol);}
149
- break;case"\"":case"'":token=this.stringToken(c,startLine,startCol);break;case"#":if(isNameChar(reader.peek())){token=this.hashToken(c,startLine,startCol);}else{token=this.charToken(c,startLine,startCol);}
150
- break;case".":if(isDigit(reader.peek())){token=this.numberToken(c,startLine,startCol);}else{token=this.charToken(c,startLine,startCol);}
151
- break;case"-":if(reader.peek()=="-"){token=this.htmlCommentEndToken(c,startLine,startCol);}else if(isNameStart(reader.peek())){token=this.identOrFunctionToken(c,startLine,startCol);}else{token=this.charToken(c,startLine,startCol);}
152
- break;case"!":token=this.importantToken(c,startLine,startCol);break;case"@":token=this.atRuleToken(c,startLine,startCol);break;case":":token=this.notToken(c,startLine,startCol);break;case"<":token=this.htmlCommentStartToken(c,startLine,startCol);break;case"U":case"u":if(reader.peek()=="+"){token=this.unicodeRangeToken(c,startLine,startCol);break;}
153
- default:if(isDigit(c)){token=this.numberToken(c,startLine,startCol);}else
154
- if(isWhitespace(c)){token=this.whitespaceToken(c,startLine,startCol);}else
155
- if(isIdentStart(c)){token=this.identOrFunctionToken(c,startLine,startCol);}else
156
- {token=this.charToken(c,startLine,startCol);}}
157
- break;}
158
- if(!token&&c===null){token=this.createToken(Tokens.EOF,null,startLine,startCol);}
159
- return token;},createToken:function(tt,value,startLine,startCol,options){var reader=this._reader;options=options||{};return{value:value,type:tt,channel:options.channel,hide:options.hide||false,startLine:startLine,startCol:startCol,endLine:reader.getLine(),endCol:reader.getCol()};},atRuleToken:function(first,startLine,startCol){var rule=first,reader=this._reader,tt=Tokens.CHAR,valid=false,ident,c;reader.mark();ident=this.readName();rule=first+ident;tt=Tokens.type(rule.toLowerCase());if(tt==Tokens.CHAR||tt==Tokens.UNKNOWN){if(rule.length>1){tt=Tokens.UNKNOWN_SYM;}else{tt=Tokens.CHAR;rule=first;reader.reset();}}
160
- return this.createToken(tt,rule,startLine,startCol);},charToken:function(c,startLine,startCol){var tt=Tokens.type(c);if(tt==-1){tt=Tokens.CHAR;}
161
- return this.createToken(tt,c,startLine,startCol);},commentToken:function(first,startLine,startCol){var reader=this._reader,comment=this.readComment(first);return this.createToken(Tokens.COMMENT,comment,startLine,startCol);},comparisonToken:function(c,startLine,startCol){var reader=this._reader,comparison=c+reader.read(),tt=Tokens.type(comparison)||Tokens.CHAR;return this.createToken(tt,comparison,startLine,startCol);},hashToken:function(first,startLine,startCol){var reader=this._reader,name=this.readName(first);return this.createToken(Tokens.HASH,name,startLine,startCol);},htmlCommentStartToken:function(first,startLine,startCol){var reader=this._reader,text=first;reader.mark();text+=reader.readCount(3);if(text=="<!--"){return this.createToken(Tokens.CDO,text,startLine,startCol);}else{reader.reset();return this.charToken(first,startLine,startCol);}},htmlCommentEndToken:function(first,startLine,startCol){var reader=this._reader,text=first;reader.mark();text+=reader.readCount(2);if(text=="-->"){return this.createToken(Tokens.CDC,text,startLine,startCol);}else{reader.reset();return this.charToken(first,startLine,startCol);}},identOrFunctionToken:function(first,startLine,startCol){var reader=this._reader,ident=this.readName(first),tt=Tokens.IDENT;if(reader.peek()=="("){ident+=reader.read();if(ident.toLowerCase()=="url("){tt=Tokens.URI;ident=this.readURI(ident);if(ident.toLowerCase()=="url("){tt=Tokens.FUNCTION;}}else{tt=Tokens.FUNCTION;}}else if(reader.peek()==":"){if(ident.toLowerCase()=="progid"){ident+=reader.readTo("(");tt=Tokens.IE_FUNCTION;}}
162
- return this.createToken(tt,ident,startLine,startCol);},importantToken:function(first,startLine,startCol){var reader=this._reader,important=first,tt=Tokens.CHAR,temp,c;reader.mark();c=reader.read();while(c){if(c=="/"){if(reader.peek()!="*"){break;}else{temp=this.readComment(c);if(temp===""){break;}}}else if(isWhitespace(c)){important+=c+this.readWhitespace();}else if(/i/i.test(c)){temp=reader.readCount(8);if(/mportant/i.test(temp)){important+=c+temp;tt=Tokens.IMPORTANT_SYM;}
163
- break;}else{break;}
164
- c=reader.read();}
165
- if(tt==Tokens.CHAR){reader.reset();return this.charToken(first,startLine,startCol);}else{return this.createToken(tt,important,startLine,startCol);}},notToken:function(first,startLine,startCol){var reader=this._reader,text=first;reader.mark();text+=reader.readCount(4);if(text.toLowerCase()==":not("){return this.createToken(Tokens.NOT,text,startLine,startCol);}else{reader.reset();return this.charToken(first,startLine,startCol);}},numberToken:function(first,startLine,startCol){var reader=this._reader,value=this.readNumber(first),ident,tt=Tokens.NUMBER,c=reader.peek();if(isIdentStart(c)){ident=this.readName(reader.read());value+=ident;if(/^em$|^ex$|^px$|^gd$|^rem$|^vw$|^vh$|^vm$|^ch$|^cm$|^mm$|^in$|^pt$|^pc$/i.test(ident)){tt=Tokens.LENGTH;}else if(/^deg|^rad$|^grad$/i.test(ident)){tt=Tokens.ANGLE;}else if(/^ms$|^s$/i.test(ident)){tt=Tokens.TIME;}else if(/^hz$|^khz$/i.test(ident)){tt=Tokens.FREQ;}else if(/^dpi$|^dpcm$/i.test(ident)){tt=Tokens.RESOLUTION;}else{tt=Tokens.DIMENSION;}}else if(c=="%"){value+=reader.read();tt=Tokens.PERCENTAGE;}
166
- return this.createToken(tt,value,startLine,startCol);},stringToken:function(first,startLine,startCol){var delim=first,string=first,reader=this._reader,prev=first,tt=Tokens.STRING,c=reader.read();while(c){string+=c;if(c==delim&&prev!="\\"){break;}
167
- if(isNewLine(reader.peek())&&c!="\\"){tt=Tokens.INVALID;break;}
168
- prev=c;c=reader.read();}
169
- if(c===null){tt=Tokens.INVALID;}
170
- return this.createToken(tt,string,startLine,startCol);},unicodeRangeToken:function(first,startLine,startCol){var reader=this._reader,value=first,temp,tt=Tokens.CHAR;if(reader.peek()=="+"){reader.mark();value+=reader.read();value+=this.readUnicodeRangePart(true);if(value.length==2){reader.reset();}else{tt=Tokens.UNICODE_RANGE;if(value.indexOf("?")==-1){if(reader.peek()=="-"){reader.mark();temp=reader.read();temp+=this.readUnicodeRangePart(false);if(temp.length==1){reader.reset();}else{value+=temp;}}}}}
171
- return this.createToken(tt,value,startLine,startCol);},whitespaceToken:function(first,startLine,startCol){var reader=this._reader,value=first+this.readWhitespace();return this.createToken(Tokens.S,value,startLine,startCol);},readUnicodeRangePart:function(allowQuestionMark){var reader=this._reader,part="",c=reader.peek();while(isHexDigit(c)&&part.length<6){reader.read();part+=c;c=reader.peek();}
172
- if(allowQuestionMark){while(c=="?"&&part.length<6){reader.read();part+=c;c=reader.peek();}}
173
- return part;},readWhitespace:function(){var reader=this._reader,whitespace="",c=reader.peek();while(isWhitespace(c)){reader.read();whitespace+=c;c=reader.peek();}
174
- return whitespace;},readNumber:function(first){var reader=this._reader,number=first,hasDot=(first=="."),c=reader.peek();while(c){if(isDigit(c)){number+=reader.read();}else if(c=="."){if(hasDot){break;}else{hasDot=true;number+=reader.read();}}else{break;}
175
- c=reader.peek();}
176
- return number;},readString:function(){var reader=this._reader,delim=reader.read(),string=delim,prev=delim,c=reader.peek();while(c){c=reader.read();string+=c;if(c==delim&&prev!="\\"){break;}
177
- if(isNewLine(reader.peek())&&c!="\\"){string="";break;}
178
- prev=c;c=reader.peek();}
179
- if(c===null){string="";}
180
- return string;},readURI:function(first){var reader=this._reader,uri=first,inner="",c=reader.peek();reader.mark();while(c&&isWhitespace(c)){reader.read();c=reader.peek();}
181
- if(c=="'"||c=="\""){inner=this.readString();}else{inner=this.readURL();}
182
- c=reader.peek();while(c&&isWhitespace(c)){reader.read();c=reader.peek();}
183
- if(inner===""||c!=")"){uri=first;reader.reset();}else{uri+=inner+reader.read();}
184
- return uri;},readURL:function(){var reader=this._reader,url="",c=reader.peek();while(/^[!#$%&\\*-~]$/.test(c)){url+=reader.read();c=reader.peek();}
185
- return url;},readName:function(first){var reader=this._reader,ident=first||"",c=reader.peek();while(true){if(c=="\\"){ident+=this.readEscape(reader.read());c=reader.peek();}else if(c&&isNameChar(c)){ident+=reader.read();c=reader.peek();}else{break;}}
186
- return ident;},readEscape:function(first){var reader=this._reader,cssEscape=first||"",i=0,c=reader.peek();if(isHexDigit(c)){do{cssEscape+=reader.read();c=reader.peek();}while(c&&isHexDigit(c)&&++i<6);}
187
- if(cssEscape.length==3&&/\s/.test(c)||cssEscape.length==7||cssEscape.length==1){reader.read();}else{c="";}
188
- return cssEscape+c;},readComment:function(first){var reader=this._reader,comment=first||"",c=reader.read();if(c=="*"){while(c){comment+=c;if(comment.length>2&&c=="*"&&reader.peek()=="/"){comment+=reader.read();break;}
189
- c=reader.read();}
190
- return comment;}else{return"";}}});var Tokens=[{name:"CDO"},{name:"CDC"},{name:"S",whitespace:true},{name:"COMMENT",comment:true,hide:true,channel:"comment"},{name:"INCLUDES",text:"~="},{name:"DASHMATCH",text:"|="},{name:"PREFIXMATCH",text:"^="},{name:"SUFFIXMATCH",text:"$="},{name:"SUBSTRINGMATCH",text:"*="},{name:"STRING"},{name:"IDENT"},{name:"HASH"},{name:"IMPORT_SYM",text:"@import"},{name:"PAGE_SYM",text:"@page"},{name:"MEDIA_SYM",text:"@media"},{name:"FONT_FACE_SYM",text:"@font-face"},{name:"CHARSET_SYM",text:"@charset"},{name:"NAMESPACE_SYM",text:"@namespace"},{name:"VIEWPORT_SYM",text:"@viewport"},{name:"UNKNOWN_SYM"},{name:"KEYFRAMES_SYM",text:["@keyframes","@-webkit-keyframes","@-moz-keyframes","@-o-keyframes"]},{name:"IMPORTANT_SYM"},{name:"LENGTH"},{name:"ANGLE"},{name:"TIME"},{name:"FREQ"},{name:"DIMENSION"},{name:"PERCENTAGE"},{name:"NUMBER"},{name:"URI"},{name:"FUNCTION"},{name:"UNICODE_RANGE"},{name:"INVALID"},{name:"PLUS",text:"+"},{name:"GREATER",text:">"},{name:"COMMA",text:","},{name:"TILDE",text:"~"},{name:"NOT"},{name:"TOPLEFTCORNER_SYM",text:"@top-left-corner"},{name:"TOPLEFT_SYM",text:"@top-left"},{name:"TOPCENTER_SYM",text:"@top-center"},{name:"TOPRIGHT_SYM",text:"@top-right"},{name:"TOPRIGHTCORNER_SYM",text:"@top-right-corner"},{name:"BOTTOMLEFTCORNER_SYM",text:"@bottom-left-corner"},{name:"BOTTOMLEFT_SYM",text:"@bottom-left"},{name:"BOTTOMCENTER_SYM",text:"@bottom-center"},{name:"BOTTOMRIGHT_SYM",text:"@bottom-right"},{name:"BOTTOMRIGHTCORNER_SYM",text:"@bottom-right-corner"},{name:"LEFTTOP_SYM",text:"@left-top"},{name:"LEFTMIDDLE_SYM",text:"@left-middle"},{name:"LEFTBOTTOM_SYM",text:"@left-bottom"},{name:"RIGHTTOP_SYM",text:"@right-top"},{name:"RIGHTMIDDLE_SYM",text:"@right-middle"},{name:"RIGHTBOTTOM_SYM",text:"@right-bottom"},{name:"RESOLUTION",state:"media"},{name:"IE_FUNCTION"},{name:"CHAR"},{name:"PIPE",text:"|"},{name:"SLASH",text:"/"},{name:"MINUS",text:"-"},{name:"STAR",text:"*"},{name:"LBRACE",text:"{"},{name:"RBRACE",text:"}"},{name:"LBRACKET",text:"["},{name:"RBRACKET",text:"]"},{name:"EQUALS",text:"="},{name:"COLON",text:":"},{name:"SEMICOLON",text:";"},{name:"LPAREN",text:"("},{name:"RPAREN",text:")"},{name:"DOT",text:"."}];(function(){var nameMap=[],typeMap={};Tokens.UNKNOWN=-1;Tokens.unshift({name:"EOF"});for(var i=0,len=Tokens.length;i<len;i++){nameMap.push(Tokens[i].name);Tokens[Tokens[i].name]=i;if(Tokens[i].text){if(Tokens[i].text instanceof Array){for(var j=0;j<Tokens[i].text.length;j++){typeMap[Tokens[i].text[j]]=i;}}else{typeMap[Tokens[i].text]=i;}}}
191
- Tokens.name=function(tt){return nameMap[tt];};Tokens.type=function(c){return typeMap[c]||-1;};})();var Validation={validate:function(property,value){var name=property.toString().toLowerCase(),parts=value.parts,expression=new PropertyValueIterator(value),spec=Properties[name],part,valid,j,count,msg,types,last,literals,max,multi,group;if(!spec){if(name.indexOf("-")!==0){throw new ValidationError("Unknown property '"+property+"'.",property.line,property.col);}}else if(typeof spec!="number"){if(typeof spec=="string"){if(spec.indexOf("||")>-1){this.groupProperty(spec,expression);}else{this.singleProperty(spec,expression,1);}}else if(spec.multi){this.multiProperty(spec.multi,expression,spec.comma,spec.max||Infinity);}else if(typeof spec=="function"){spec(expression);}}},singleProperty:function(types,expression,max,partial){var result=false,value=expression.value,count=0,part;while(expression.hasNext()&&count<max){result=ValidationTypes.isAny(expression,types);if(!result){break;}
192
- count++;}
193
- if(!result){if(expression.hasNext()&&!expression.isFirst()){part=expression.peek();throw new ValidationError("Expected end of value but found '"+part+"'.",part.line,part.col);}else{throw new ValidationError("Expected ("+types+") but found '"+value+"'.",value.line,value.col);}}else if(expression.hasNext()){part=expression.next();throw new ValidationError("Expected end of value but found '"+part+"'.",part.line,part.col);}},multiProperty:function(types,expression,comma,max){var result=false,value=expression.value,count=0,sep=false,part;while(expression.hasNext()&&!result&&count<max){if(ValidationTypes.isAny(expression,types)){count++;if(!expression.hasNext()){result=true;}else if(comma){if(expression.peek()==","){part=expression.next();}else{break;}}}else{break;}}
194
- if(!result){if(expression.hasNext()&&!expression.isFirst()){part=expression.peek();throw new ValidationError("Expected end of value but found '"+part+"'.",part.line,part.col);}else{part=expression.previous();if(comma&&part==","){throw new ValidationError("Expected end of value but found '"+part+"'.",part.line,part.col);}else{throw new ValidationError("Expected ("+types+") but found '"+value+"'.",value.line,value.col);}}}else if(expression.hasNext()){part=expression.next();throw new ValidationError("Expected end of value but found '"+part+"'.",part.line,part.col);}},groupProperty:function(types,expression,comma){var result=false,value=expression.value,typeCount=types.split("||").length,groups={count:0},partial=false,name,part;while(expression.hasNext()&&!result){name=ValidationTypes.isAnyOfGroup(expression,types);if(name){if(groups[name]){break;}else{groups[name]=1;groups.count++;partial=true;if(groups.count==typeCount||!expression.hasNext()){result=true;}}}else{break;}}
195
- if(!result){if(partial&&expression.hasNext()){part=expression.peek();throw new ValidationError("Expected end of value but found '"+part+"'.",part.line,part.col);}else{throw new ValidationError("Expected ("+types+") but found '"+value+"'.",value.line,value.col);}}else if(expression.hasNext()){part=expression.next();throw new ValidationError("Expected end of value but found '"+part+"'.",part.line,part.col);}}};function ValidationError(message,line,col){this.col=col;this.line=line;this.message=message;}
196
- ValidationError.prototype=new Error();var ValidationTypes={isLiteral:function(part,literals){var text=part.text.toString().toLowerCase(),args=literals.split(" | "),i,len,found=false;for(i=0,len=args.length;i<len&&!found;i++){if(text==args[i].toLowerCase()){found=true;}}
197
- return found;},isSimple:function(type){return!!this.simple[type];},isComplex:function(type){return!!this.complex[type];},isAny:function(expression,types){var args=types.split(" | "),i,len,found=false;for(i=0,len=args.length;i<len&&!found&&expression.hasNext();i++){found=this.isType(expression,args[i]);}
198
- return found;},isAnyOfGroup:function(expression,types){var args=types.split(" || "),i,len,found=false;for(i=0,len=args.length;i<len&&!found;i++){found=this.isType(expression,args[i]);}
199
- return found?args[i-1]:false;},isType:function(expression,type){var part=expression.peek(),result=false;if(type.charAt(0)!="<"){result=this.isLiteral(part,type);if(result){expression.next();}}else if(this.simple[type]){result=this.simple[type](part);if(result){expression.next();}}else{result=this.complex[type](expression);}
200
- return result;},simple:{"<absolute-size>":function(part){return ValidationTypes.isLiteral(part,"xx-small | x-small | small | medium | large | x-large | xx-large");},"<attachment>":function(part){return ValidationTypes.isLiteral(part,"scroll | fixed | local");},"<attr>":function(part){return part.type=="function"&&part.name=="attr";},"<bg-image>":function(part){return this["<image>"](part)||this["<gradient>"](part)||part=="none";},"<gradient>":function(part){return part.type=="function"&&/^(?:\-(?:ms|moz|o|webkit)\-)?(?:repeating\-)?(?:radial\-|linear\-)?gradient/i.test(part);},"<box>":function(part){return ValidationTypes.isLiteral(part,"padding-box | border-box | content-box");},"<content>":function(part){return part.type=="function"&&part.name=="content";},"<relative-size>":function(part){return ValidationTypes.isLiteral(part,"smaller | larger");},"<ident>":function(part){return part.type=="identifier";},"<length>":function(part){if(part.type=="function"&&/^(?:\-(?:ms|moz|o|webkit)\-)?calc/i.test(part)){return true;}else{return part.type=="length"||part.type=="number"||part.type=="integer"||part=="0";}},"<color>":function(part){return part.type=="color"||part=="transparent";},"<number>":function(part){return part.type=="number"||this["<integer>"](part);},"<integer>":function(part){return part.type=="integer";},"<line>":function(part){return part.type=="integer";},"<angle>":function(part){return part.type=="angle";},"<uri>":function(part){return part.type=="uri";},"<image>":function(part){return this["<uri>"](part);},"<percentage>":function(part){return part.type=="percentage"||part=="0";},"<border-width>":function(part){return this["<length>"](part)||ValidationTypes.isLiteral(part,"thin | medium | thick");},"<border-style>":function(part){return ValidationTypes.isLiteral(part,"none | hidden | dotted | dashed | solid | double | groove | ridge | inset | outset");},"<margin-width>":function(part){return this["<length>"](part)||this["<percentage>"](part)||ValidationTypes.isLiteral(part,"auto");},"<padding-width>":function(part){return this["<length>"](part)||this["<percentage>"](part);},"<shape>":function(part){return part.type=="function"&&(part.name=="rect"||part.name=="inset-rect");},"<time>":function(part){return part.type=="time";}},complex:{"<bg-position>":function(expression){var types=this,result=false,numeric="<percentage> | <length>",xDir="left | right",yDir="top | bottom",count=0,hasNext=function(){return expression.hasNext()&&expression.peek()!=",";};while(expression.peek(count)&&expression.peek(count)!=","){count++;}
201
- if(count<3){if(ValidationTypes.isAny(expression,xDir+" | center | "+numeric)){result=true;ValidationTypes.isAny(expression,yDir+" | center | "+numeric);}else if(ValidationTypes.isAny(expression,yDir)){result=true;ValidationTypes.isAny(expression,xDir+" | center");}}else{if(ValidationTypes.isAny(expression,xDir)){if(ValidationTypes.isAny(expression,yDir)){result=true;ValidationTypes.isAny(expression,numeric);}else if(ValidationTypes.isAny(expression,numeric)){if(ValidationTypes.isAny(expression,yDir)){result=true;ValidationTypes.isAny(expression,numeric);}else if(ValidationTypes.isAny(expression,"center")){result=true;}}}else if(ValidationTypes.isAny(expression,yDir)){if(ValidationTypes.isAny(expression,xDir)){result=true;ValidationTypes.isAny(expression,numeric);}else if(ValidationTypes.isAny(expression,numeric)){if(ValidationTypes.isAny(expression,xDir)){result=true;ValidationTypes.isAny(expression,numeric);}else if(ValidationTypes.isAny(expression,"center")){result=true;}}}else if(ValidationTypes.isAny(expression,"center")){if(ValidationTypes.isAny(expression,xDir+" | "+yDir)){result=true;ValidationTypes.isAny(expression,numeric);}}}
202
- return result;},"<bg-size>":function(expression){var types=this,result=false,numeric="<percentage> | <length> | auto",part,i,len;if(ValidationTypes.isAny(expression,"cover | contain")){result=true;}else if(ValidationTypes.isAny(expression,numeric)){result=true;ValidationTypes.isAny(expression,numeric);}
203
- return result;},"<repeat-style>":function(expression){var result=false,values="repeat | space | round | no-repeat",part;if(expression.hasNext()){part=expression.next();if(ValidationTypes.isLiteral(part,"repeat-x | repeat-y")){result=true;}else if(ValidationTypes.isLiteral(part,values)){result=true;if(expression.hasNext()&&ValidationTypes.isLiteral(expression.peek(),values)){expression.next();}}}
204
- return result;},"<shadow>":function(expression){var result=false,count=0,inset=false,color=false,part;if(expression.hasNext()){if(ValidationTypes.isAny(expression,"inset")){inset=true;}
205
- if(ValidationTypes.isAny(expression,"<color>")){color=true;}
206
- while(ValidationTypes.isAny(expression,"<length>")&&count<4){count++;}
207
- if(expression.hasNext()){if(!color){ValidationTypes.isAny(expression,"<color>");}
208
- if(!inset){ValidationTypes.isAny(expression,"inset");}}
209
- result=(count>=2&&count<=4);}
210
- return result;},"<x-one-radius>":function(expression){var result=false,simple="<length> | <percentage> | inherit";if(ValidationTypes.isAny(expression,simple)){result=true;ValidationTypes.isAny(expression,simple);}
211
- return result;}}};parserlib.css={Colors:Colors,Combinator:Combinator,Parser:Parser,PropertyName:PropertyName,PropertyValue:PropertyValue,PropertyValuePart:PropertyValuePart,MediaFeature:MediaFeature,MediaQuery:MediaQuery,Selector:Selector,SelectorPart:SelectorPart,SelectorSubPart:SelectorSubPart,Specificity:Specificity,TokenStream:TokenStream,Tokens:Tokens,ValidationError:ValidationError};})();(function(){for(var prop in parserlib){exports[prop]=parserlib[prop];}})();var CSSLint=(function(){var rules=[],formatters=[],embeddedRuleset=/\/\*csslint([^\*]*)\*\//,api=new parserlib.util.EventTarget();api.version="0.10.0";api.addRule=function(rule){rules.push(rule);rules[rule.id]=rule;};api.clearRules=function(){rules=[];};api.getRules=function(){return[].concat(rules).sort(function(a,b){return a.id>b.id?1:0;});};api.getRuleset=function(){var ruleset={},i=0,len=rules.length;while(i<len){ruleset[rules[i++].id]=1;}
212
- return ruleset;};function applyEmbeddedRuleset(text,ruleset){var valueMap,embedded=text&&text.match(embeddedRuleset),rules=embedded&&embedded[1];if(rules){valueMap={"true":2,"":1,"false":0,"2":2,"1":1,"0":0};rules.toLowerCase().split(",").forEach(function(rule){var pair=rule.split(":"),property=pair[0]||"",value=pair[1]||"";ruleset[property.trim()]=valueMap[value.trim()];});}
213
- return ruleset;}
214
- api.addFormatter=function(formatter){formatters[formatter.id]=formatter;};api.getFormatter=function(formatId){return formatters[formatId];};api.format=function(results,filename,formatId,options){var formatter=this.getFormatter(formatId),result=null;if(formatter){result=formatter.startFormat();result+=formatter.formatResults(results,filename,options||{});result+=formatter.endFormat();}
215
- return result;};api.hasFormat=function(formatId){return formatters.hasOwnProperty(formatId);};api.verify=function(text,ruleset){var i=0,len=rules.length,reporter,lines,report,parser=new parserlib.css.Parser({starHack:true,ieFilters:true,underscoreHack:true,strict:false});lines=text.replace(/\n\r?/g,"$split$").split('$split$');if(!ruleset){ruleset=this.getRuleset();}
216
- if(embeddedRuleset.test(text)){ruleset=applyEmbeddedRuleset(text,ruleset);}
217
- reporter=new Reporter(lines,ruleset);ruleset.errors=2;for(i in ruleset){if(ruleset.hasOwnProperty(i)&&ruleset[i]){if(rules[i]){rules[i].init(parser,reporter);}}}
218
- try{parser.parse(text);}catch(ex){reporter.error("Fatal error, cannot continue: "+ex.message,ex.line,ex.col,{});}
219
- report={messages:reporter.messages,stats:reporter.stats,ruleset:reporter.ruleset};report.messages.sort(function(a,b){if(a.rollup&&!b.rollup){return 1;}else if(!a.rollup&&b.rollup){return-1;}else{return a.line-b.line;}});return report;};return api;})();function Reporter(lines,ruleset){this.messages=[];this.stats=[];this.lines=lines;this.ruleset=ruleset;}
220
- Reporter.prototype={constructor:Reporter,error:function(message,line,col,rule){this.messages.push({type:"error",line:line,col:col,message:message,evidence:this.lines[line-1],rule:rule||{}});},warn:function(message,line,col,rule){this.report(message,line,col,rule);},report:function(message,line,col,rule){this.messages.push({type:this.ruleset[rule.id]==2?"error":"warning",line:line,col:col,message:message,evidence:this.lines[line-1],rule:rule});},info:function(message,line,col,rule){this.messages.push({type:"info",line:line,col:col,message:message,evidence:this.lines[line-1],rule:rule});},rollupError:function(message,rule){this.messages.push({type:"error",rollup:true,message:message,rule:rule});},rollupWarn:function(message,rule){this.messages.push({type:"warning",rollup:true,message:message,rule:rule});},stat:function(name,value){this.stats[name]=value;}};CSSLint._Reporter=Reporter;CSSLint.Util={mix:function(receiver,supplier){var prop;for(prop in supplier){if(supplier.hasOwnProperty(prop)){receiver[prop]=supplier[prop];}}
221
- return prop;},indexOf:function(values,value){if(values.indexOf){return values.indexOf(value);}else{for(var i=0,len=values.length;i<len;i++){if(values[i]===value){return i;}}
222
- return-1;}},forEach:function(values,func){if(values.forEach){return values.forEach(func);}else{for(var i=0,len=values.length;i<len;i++){func(values[i],i,values);}}}};CSSLint.addRule({id:"adjoining-classes",name:"Disallow adjoining classes",desc:"Don't use adjoining classes.",browsers:"IE6",init:function(parser,reporter){var rule=this;parser.addListener("startrule",function(event){var selectors=event.selectors,selector,part,modifier,classCount,i,j,k;for(i=0;i<selectors.length;i++){selector=selectors[i];for(j=0;j<selector.parts.length;j++){part=selector.parts[j];if(part.type==parser.SELECTOR_PART_TYPE){classCount=0;for(k=0;k<part.modifiers.length;k++){modifier=part.modifiers[k];if(modifier.type=="class"){classCount++;}
223
- if(classCount>1){reporter.report("Don't use adjoining classes.",part.line,part.col,rule);}}}}}});}});CSSLint.addRule({id:"box-model",name:"Beware of broken box size",desc:"Don't use width or height when using padding or border.",browsers:"All",init:function(parser,reporter){var rule=this,widthProperties={border:1,"border-left":1,"border-right":1,padding:1,"padding-left":1,"padding-right":1},heightProperties={border:1,"border-bottom":1,"border-top":1,padding:1,"padding-bottom":1,"padding-top":1},properties,boxSizing=false;function startRule(){properties={};boxSizing=false;}
224
- function endRule(){var prop,value;if(!boxSizing){if(properties.height){for(prop in heightProperties){if(heightProperties.hasOwnProperty(prop)&&properties[prop]){value=properties[prop].value;if(!(prop=="padding"&&value.parts.length===2&&value.parts[0].value===0)){reporter.report("Using height with "+prop+" can sometimes make elements larger than you expect.",properties[prop].line,properties[prop].col,rule);}}}}
225
- if(properties.width){for(prop in widthProperties){if(widthProperties.hasOwnProperty(prop)&&properties[prop]){value=properties[prop].value;if(!(prop=="padding"&&value.parts.length===2&&value.parts[1].value===0)){reporter.report("Using width with "+prop+" can sometimes make elements larger than you expect.",properties[prop].line,properties[prop].col,rule);}}}}}}
226
- parser.addListener("startrule",startRule);parser.addListener("startfontface",startRule);parser.addListener("startpage",startRule);parser.addListener("startpagemargin",startRule);parser.addListener("startkeyframerule",startRule);parser.addListener("property",function(event){var name=event.property.text.toLowerCase();if(heightProperties[name]||widthProperties[name]){if(!/^0\S*$/.test(event.value)&&!(name=="border"&&event.value=="none")){properties[name]={line:event.property.line,col:event.property.col,value:event.value};}}else{if(/^(width|height)/i.test(name)&&/^(length|percentage)/.test(event.value.parts[0].type)){properties[name]=1;}else if(name=="box-sizing"){boxSizing=true;}}});parser.addListener("endrule",endRule);parser.addListener("endfontface",endRule);parser.addListener("endpage",endRule);parser.addListener("endpagemargin",endRule);parser.addListener("endkeyframerule",endRule);}});CSSLint.addRule({id:"box-sizing",name:"Disallow use of box-sizing",desc:"The box-sizing properties isn't supported in IE6 and IE7.",browsers:"IE6, IE7",tags:["Compatibility"],init:function(parser,reporter){var rule=this;parser.addListener("property",function(event){var name=event.property.text.toLowerCase();if(name=="box-sizing"){reporter.report("The box-sizing property isn't supported in IE6 and IE7.",event.line,event.col,rule);}});}});CSSLint.addRule({id:"bulletproof-font-face",name:"Use the bulletproof @font-face syntax",desc:"Use the bulletproof @font-face syntax to avoid 404's in old IE (http://www.fontspring.com/blog/the-new-bulletproof-font-face-syntax).",browsers:"All",init:function(parser,reporter){var rule=this,count=0,fontFaceRule=false,firstSrc=true,ruleFailed=false,line,col;parser.addListener("startfontface",function(event){fontFaceRule=true;});parser.addListener("property",function(event){if(!fontFaceRule){return;}
227
- var propertyName=event.property.toString().toLowerCase(),value=event.value.toString();line=event.line;col=event.col;if(propertyName==='src'){var regex=/^\s?url\(['"].+\.eot\?.*['"]\)\s*format\(['"]embedded-opentype['"]\).*$/i;if(!value.match(regex)&&firstSrc){ruleFailed=true;firstSrc=false;}else if(value.match(regex)&&!firstSrc){ruleFailed=false;}}});parser.addListener("endfontface",function(event){fontFaceRule=false;if(ruleFailed){reporter.report("@font-face declaration doesn't follow the fontspring bulletproof syntax.",line,col,rule);}});}});CSSLint.addRule({id:"compatible-vendor-prefixes",name:"Require compatible vendor prefixes",desc:"Include all compatible vendor prefixes to reach a wider range of users.",browsers:"All",init:function(parser,reporter){var rule=this,compatiblePrefixes,properties,prop,variations,prefixed,i,len,inKeyFrame=false,arrayPush=Array.prototype.push,applyTo=[];compatiblePrefixes={"animation":"webkit moz","animation-delay":"webkit moz","animation-direction":"webkit moz","animation-duration":"webkit moz","animation-fill-mode":"webkit moz","animation-iteration-count":"webkit moz","animation-name":"webkit moz","animation-play-state":"webkit moz","animation-timing-function":"webkit moz","appearance":"webkit moz","border-end":"webkit moz","border-end-color":"webkit moz","border-end-style":"webkit moz","border-end-width":"webkit moz","border-image":"webkit moz o","border-radius":"webkit","border-start":"webkit moz","border-start-color":"webkit moz","border-start-style":"webkit moz","border-start-width":"webkit moz","box-align":"webkit moz ms","box-direction":"webkit moz ms","box-flex":"webkit moz ms","box-lines":"webkit ms","box-ordinal-group":"webkit moz ms","box-orient":"webkit moz ms","box-pack":"webkit moz ms","box-sizing":"webkit moz","box-shadow":"webkit moz","column-count":"webkit moz ms","column-gap":"webkit moz ms","column-rule":"webkit moz ms","column-rule-color":"webkit moz ms","column-rule-style":"webkit moz ms","column-rule-width":"webkit moz ms","column-width":"webkit moz ms","hyphens":"epub moz","line-break":"webkit ms","margin-end":"webkit moz","margin-start":"webkit moz","marquee-speed":"webkit wap","marquee-style":"webkit wap","padding-end":"webkit moz","padding-start":"webkit moz","tab-size":"moz o","text-size-adjust":"webkit ms","transform":"webkit moz ms o","transform-origin":"webkit moz ms o","transition":"webkit moz o","transition-delay":"webkit moz o","transition-duration":"webkit moz o","transition-property":"webkit moz o","transition-timing-function":"webkit moz o","user-modify":"webkit moz","user-select":"webkit moz ms","word-break":"epub ms","writing-mode":"epub ms"};for(prop in compatiblePrefixes){if(compatiblePrefixes.hasOwnProperty(prop)){variations=[];prefixed=compatiblePrefixes[prop].split(' ');for(i=0,len=prefixed.length;i<len;i++){variations.push('-'+prefixed[i]+'-'+prop);}
228
- compatiblePrefixes[prop]=variations;arrayPush.apply(applyTo,variations);}}
229
- parser.addListener("startrule",function(){properties=[];});parser.addListener("startkeyframes",function(event){inKeyFrame=event.prefix||true;});parser.addListener("endkeyframes",function(event){inKeyFrame=false;});parser.addListener("property",function(event){var name=event.property;if(CSSLint.Util.indexOf(applyTo,name.text)>-1){if(!inKeyFrame||typeof inKeyFrame!="string"||name.text.indexOf("-"+inKeyFrame+"-")!==0){properties.push(name);}}});parser.addListener("endrule",function(event){if(!properties.length){return;}
230
- var propertyGroups={},i,len,name,prop,variations,value,full,actual,item,propertiesSpecified;for(i=0,len=properties.length;i<len;i++){name=properties[i];for(prop in compatiblePrefixes){if(compatiblePrefixes.hasOwnProperty(prop)){variations=compatiblePrefixes[prop];if(CSSLint.Util.indexOf(variations,name.text)>-1){if(!propertyGroups[prop]){propertyGroups[prop]={full:variations.slice(0),actual:[],actualNodes:[]};}
231
- if(CSSLint.Util.indexOf(propertyGroups[prop].actual,name.text)===-1){propertyGroups[prop].actual.push(name.text);propertyGroups[prop].actualNodes.push(name);}}}}}
232
- for(prop in propertyGroups){if(propertyGroups.hasOwnProperty(prop)){value=propertyGroups[prop];full=value.full;actual=value.actual;if(full.length>actual.length){for(i=0,len=full.length;i<len;i++){item=full[i];if(CSSLint.Util.indexOf(actual,item)===-1){propertiesSpecified=(actual.length===1)?actual[0]:(actual.length==2)?actual.join(" and "):actual.join(", ");reporter.report("The property "+item+" is compatible with "+propertiesSpecified+" and should be included as well.",value.actualNodes[0].line,value.actualNodes[0].col,rule);}}}}}});}});CSSLint.addRule({id:"display-property-grouping",name:"Require properties appropriate for display",desc:"Certain properties shouldn't be used with certain display property values.",browsers:"All",init:function(parser,reporter){var rule=this;var propertiesToCheck={display:1,"float":"none",height:1,width:1,margin:1,"margin-left":1,"margin-right":1,"margin-bottom":1,"margin-top":1,padding:1,"padding-left":1,"padding-right":1,"padding-bottom":1,"padding-top":1,"vertical-align":1},properties;function reportProperty(name,display,msg){if(properties[name]){if(typeof propertiesToCheck[name]!="string"||properties[name].value.toLowerCase()!=propertiesToCheck[name]){reporter.report(msg||name+" can't be used with display: "+display+".",properties[name].line,properties[name].col,rule);}}}
233
- function startRule(){properties={};}
234
- function endRule(){var display=properties.display?properties.display.value:null;if(display){switch(display){case"inline":reportProperty("height",display);reportProperty("width",display);reportProperty("margin",display);reportProperty("margin-top",display);reportProperty("margin-bottom",display);reportProperty("float",display,"display:inline has no effect on floated elements (but may be used to fix the IE6 double-margin bug).");break;case"block":reportProperty("vertical-align",display);break;case"inline-block":reportProperty("float",display);break;default:if(display.indexOf("table-")===0){reportProperty("margin",display);reportProperty("margin-left",display);reportProperty("margin-right",display);reportProperty("margin-top",display);reportProperty("margin-bottom",display);reportProperty("float",display);}}}}
235
- parser.addListener("startrule",startRule);parser.addListener("startfontface",startRule);parser.addListener("startkeyframerule",startRule);parser.addListener("startpagemargin",startRule);parser.addListener("startpage",startRule);parser.addListener("property",function(event){var name=event.property.text.toLowerCase();if(propertiesToCheck[name]){properties[name]={value:event.value.text,line:event.property.line,col:event.property.col};}});parser.addListener("endrule",endRule);parser.addListener("endfontface",endRule);parser.addListener("endkeyframerule",endRule);parser.addListener("endpagemargin",endRule);parser.addListener("endpage",endRule);}});CSSLint.addRule({id:"duplicate-background-images",name:"Disallow duplicate background images",desc:"Every background-image should be unique. Use a common class for e.g. sprites.",browsers:"All",init:function(parser,reporter){var rule=this,stack={};parser.addListener("property",function(event){var name=event.property.text,value=event.value,i,len;if(name.match(/background/i)){for(i=0,len=value.parts.length;i<len;i++){if(value.parts[i].type=='uri'){if(typeof stack[value.parts[i].uri]==='undefined'){stack[value.parts[i].uri]=event;}
236
- else{reporter.report("Background image '"+value.parts[i].uri+"' was used multiple times, first declared at line "+stack[value.parts[i].uri].line+", col "+stack[value.parts[i].uri].col+".",event.line,event.col,rule);}}}}});}});CSSLint.addRule({id:"duplicate-properties",name:"Disallow duplicate properties",desc:"Duplicate properties must appear one after the other.",browsers:"All",init:function(parser,reporter){var rule=this,properties,lastProperty;function startRule(event){properties={};}
237
- parser.addListener("startrule",startRule);parser.addListener("startfontface",startRule);parser.addListener("startpage",startRule);parser.addListener("startpagemargin",startRule);parser.addListener("startkeyframerule",startRule);parser.addListener("property",function(event){var property=event.property,name=property.text.toLowerCase();if(properties[name]&&(lastProperty!=name||properties[name]==event.value.text)){reporter.report("Duplicate property '"+event.property+"' found.",event.line,event.col,rule);}
238
- properties[name]=event.value.text;lastProperty=name;});}});CSSLint.addRule({id:"empty-rules",name:"Disallow empty rules",desc:"Rules without any properties specified should be removed.",browsers:"All",init:function(parser,reporter){var rule=this,count=0;parser.addListener("startrule",function(){count=0;});parser.addListener("property",function(){count++;});parser.addListener("endrule",function(event){var selectors=event.selectors;if(count===0){reporter.report("Rule is empty.",selectors[0].line,selectors[0].col,rule);}});}});CSSLint.addRule({id:"errors",name:"Parsing Errors",desc:"This rule looks for recoverable syntax errors.",browsers:"All",init:function(parser,reporter){var rule=this;parser.addListener("error",function(event){reporter.error(event.message,event.line,event.col,rule);});}});CSSLint.addRule({id:"fallback-colors",name:"Require fallback colors",desc:"For older browsers that don't support RGBA, HSL, or HSLA, provide a fallback color.",browsers:"IE6,IE7,IE8",init:function(parser,reporter){var rule=this,lastProperty,propertiesToCheck={color:1,background:1,"border-color":1,"border-top-color":1,"border-right-color":1,"border-bottom-color":1,"border-left-color":1,border:1,"border-top":1,"border-right":1,"border-bottom":1,"border-left":1,"background-color":1},properties;function startRule(event){properties={};lastProperty=null;}
239
- parser.addListener("startrule",startRule);parser.addListener("startfontface",startRule);parser.addListener("startpage",startRule);parser.addListener("startpagemargin",startRule);parser.addListener("startkeyframerule",startRule);parser.addListener("property",function(event){var property=event.property,name=property.text.toLowerCase(),parts=event.value.parts,i=0,colorType="",len=parts.length;if(propertiesToCheck[name]){while(i<len){if(parts[i].type=="color"){if("alpha"in parts[i]||"hue"in parts[i]){if(/([^\)]+)\(/.test(parts[i])){colorType=RegExp.$1.toUpperCase();}
240
- if(!lastProperty||(lastProperty.property.text.toLowerCase()!=name||lastProperty.colorType!="compat")){reporter.report("Fallback "+name+" (hex or RGB) should precede "+colorType+" "+name+".",event.line,event.col,rule);}}else{event.colorType="compat";}}
241
- i++;}}
242
- lastProperty=event;});}});CSSLint.addRule({id:"floats",name:"Disallow too many floats",desc:"This rule tests if the float property is used too many times",browsers:"All",init:function(parser,reporter){var rule=this;var count=0;parser.addListener("property",function(event){if(event.property.text.toLowerCase()=="float"&&event.value.text.toLowerCase()!="none"){count++;}});parser.addListener("endstylesheet",function(){reporter.stat("floats",count);if(count>=10){reporter.rollupWarn("Too many floats ("+count+"), you're probably using them for layout. Consider using a grid system instead.",rule);}});}});CSSLint.addRule({id:"font-faces",name:"Don't use too many web fonts",desc:"Too many different web fonts in the same stylesheet.",browsers:"All",init:function(parser,reporter){var rule=this,count=0;parser.addListener("startfontface",function(){count++;});parser.addListener("endstylesheet",function(){if(count>5){reporter.rollupWarn("Too many @font-face declarations ("+count+").",rule);}});}});CSSLint.addRule({id:"font-sizes",name:"Disallow too many font sizes",desc:"Checks the number of font-size declarations.",browsers:"All",init:function(parser,reporter){var rule=this,count=0;parser.addListener("property",function(event){if(event.property=="font-size"){count++;}});parser.addListener("endstylesheet",function(){reporter.stat("font-sizes",count);if(count>=10){reporter.rollupWarn("Too many font-size declarations ("+count+"), abstraction needed.",rule);}});}});CSSLint.addRule({id:"gradients",name:"Require all gradient definitions",desc:"When using a vendor-prefixed gradient, make sure to use them all.",browsers:"All",init:function(parser,reporter){var rule=this,gradients;parser.addListener("startrule",function(){gradients={moz:0,webkit:0,oldWebkit:0,o:0};});parser.addListener("property",function(event){if(/\-(moz|o|webkit)(?:\-(?:linear|radial))\-gradient/i.test(event.value)){gradients[RegExp.$1]=1;}else if(/\-webkit\-gradient/i.test(event.value)){gradients.oldWebkit=1;}});parser.addListener("endrule",function(event){var missing=[];if(!gradients.moz){missing.push("Firefox 3.6+");}
243
- if(!gradients.webkit){missing.push("Webkit (Safari 5+, Chrome)");}
244
- if(!gradients.oldWebkit){missing.push("Old Webkit (Safari 4+, Chrome)");}
245
- if(!gradients.o){missing.push("Opera 11.1+");}
246
- if(missing.length&&missing.length<4){reporter.report("Missing vendor-prefixed CSS gradients for "+missing.join(", ")+".",event.selectors[0].line,event.selectors[0].col,rule);}});}});CSSLint.addRule({id:"ids",name:"Disallow IDs in selectors",desc:"Selectors should not contain IDs.",browsers:"All",init:function(parser,reporter){var rule=this;parser.addListener("startrule",function(event){var selectors=event.selectors,selector,part,modifier,idCount,i,j,k;for(i=0;i<selectors.length;i++){selector=selectors[i];idCount=0;for(j=0;j<selector.parts.length;j++){part=selector.parts[j];if(part.type==parser.SELECTOR_PART_TYPE){for(k=0;k<part.modifiers.length;k++){modifier=part.modifiers[k];if(modifier.type=="id"){idCount++;}}}}
247
- if(idCount==1){reporter.report("Don't use IDs in selectors.",selector.line,selector.col,rule);}else if(idCount>1){reporter.report(idCount+" IDs in the selector, really?",selector.line,selector.col,rule);}}});}});CSSLint.addRule({id:"import",name:"Disallow @import",desc:"Don't use @import, use <link> instead.",browsers:"All",init:function(parser,reporter){var rule=this;parser.addListener("import",function(event){reporter.report("@import prevents parallel downloads, use <link> instead.",event.line,event.col,rule);});}});CSSLint.addRule({id:"important",name:"Disallow !important",desc:"Be careful when using !important declaration",browsers:"All",init:function(parser,reporter){var rule=this,count=0;parser.addListener("property",function(event){if(event.important===true){count++;reporter.report("Use of !important",event.line,event.col,rule);}});parser.addListener("endstylesheet",function(){reporter.stat("important",count);if(count>=10){reporter.rollupWarn("Too many !important declarations ("+count+"), try to use less than 10 to avoid specificity issues.",rule);}});}});CSSLint.addRule({id:"known-properties",name:"Require use of known properties",desc:"Properties should be known (listed in CSS3 specification) or be a vendor-prefixed property.",browsers:"All",init:function(parser,reporter){var rule=this;parser.addListener("property",function(event){var name=event.property.text.toLowerCase();if(event.invalid){reporter.report(event.invalid.message,event.line,event.col,rule);}});}});CSSLint.addRule({id:"outline-none",name:"Disallow outline: none",desc:"Use of outline: none or outline: 0 should be limited to :focus rules.",browsers:"All",tags:["Accessibility"],init:function(parser,reporter){var rule=this,lastRule;function startRule(event){if(event.selectors){lastRule={line:event.line,col:event.col,selectors:event.selectors,propCount:0,outline:false};}else{lastRule=null;}}
248
- function endRule(event){if(lastRule){if(lastRule.outline){if(lastRule.selectors.toString().toLowerCase().indexOf(":focus")==-1){reporter.report("Outlines should only be modified using :focus.",lastRule.line,lastRule.col,rule);}else if(lastRule.propCount==1){reporter.report("Outlines shouldn't be hidden unless other visual changes are made.",lastRule.line,lastRule.col,rule);}}}}
249
- parser.addListener("startrule",startRule);parser.addListener("startfontface",startRule);parser.addListener("startpage",startRule);parser.addListener("startpagemargin",startRule);parser.addListener("startkeyframerule",startRule);parser.addListener("property",function(event){var name=event.property.text.toLowerCase(),value=event.value;if(lastRule){lastRule.propCount++;if(name=="outline"&&(value=="none"||value=="0")){lastRule.outline=true;}}});parser.addListener("endrule",endRule);parser.addListener("endfontface",endRule);parser.addListener("endpage",endRule);parser.addListener("endpagemargin",endRule);parser.addListener("endkeyframerule",endRule);}});CSSLint.addRule({id:"overqualified-elements",name:"Disallow overqualified elements",desc:"Don't use classes or IDs with elements (a.foo or a#foo).",browsers:"All",init:function(parser,reporter){var rule=this,classes={};parser.addListener("startrule",function(event){var selectors=event.selectors,selector,part,modifier,i,j,k;for(i=0;i<selectors.length;i++){selector=selectors[i];for(j=0;j<selector.parts.length;j++){part=selector.parts[j];if(part.type==parser.SELECTOR_PART_TYPE){for(k=0;k<part.modifiers.length;k++){modifier=part.modifiers[k];if(part.elementName&&modifier.type=="id"){reporter.report("Element ("+part+") is overqualified, just use "+modifier+" without element name.",part.line,part.col,rule);}else if(modifier.type=="class"){if(!classes[modifier]){classes[modifier]=[];}
250
- classes[modifier].push({modifier:modifier,part:part});}}}}}});parser.addListener("endstylesheet",function(){var prop;for(prop in classes){if(classes.hasOwnProperty(prop)){if(classes[prop].length==1&&classes[prop][0].part.elementName){reporter.report("Element ("+classes[prop][0].part+") is overqualified, just use "+classes[prop][0].modifier+" without element name.",classes[prop][0].part.line,classes[prop][0].part.col,rule);}}}});}});CSSLint.addRule({id:"qualified-headings",name:"Disallow qualified headings",desc:"Headings should not be qualified (namespaced).",browsers:"All",init:function(parser,reporter){var rule=this;parser.addListener("startrule",function(event){var selectors=event.selectors,selector,part,i,j;for(i=0;i<selectors.length;i++){selector=selectors[i];for(j=0;j<selector.parts.length;j++){part=selector.parts[j];if(part.type==parser.SELECTOR_PART_TYPE){if(part.elementName&&/h[1-6]/.test(part.elementName.toString())&&j>0){reporter.report("Heading ("+part.elementName+") should not be qualified.",part.line,part.col,rule);}}}}});}});CSSLint.addRule({id:"regex-selectors",name:"Disallow selectors that look like regexs",desc:"Selectors that look like regular expressions are slow and should be avoided.",browsers:"All",init:function(parser,reporter){var rule=this;parser.addListener("startrule",function(event){var selectors=event.selectors,selector,part,modifier,i,j,k;for(i=0;i<selectors.length;i++){selector=selectors[i];for(j=0;j<selector.parts.length;j++){part=selector.parts[j];if(part.type==parser.SELECTOR_PART_TYPE){for(k=0;k<part.modifiers.length;k++){modifier=part.modifiers[k];if(modifier.type=="attribute"){if(/([\~\|\^\$\*]=)/.test(modifier)){reporter.report("Attribute selectors with "+RegExp.$1+" are slow!",modifier.line,modifier.col,rule);}}}}}}});}});CSSLint.addRule({id:"rules-count",name:"Rules Count",desc:"Track how many rules there are.",browsers:"All",init:function(parser,reporter){var rule=this,count=0;parser.addListener("startrule",function(){count++;});parser.addListener("endstylesheet",function(){reporter.stat("rule-count",count);});}});CSSLint.addRule({id:"selector-max-approaching",name:"Warn when approaching the 4095 selector limit for IE",desc:"Will warn when selector count is >= 3800 selectors.",browsers:"IE",init:function(parser,reporter){var rule=this,count=0;parser.addListener('startrule',function(event){count+=event.selectors.length;});parser.addListener("endstylesheet",function(){if(count>=3800){reporter.report("You have "+count+" selectors. Internet Explorer supports a maximum of 4095 selectors per stylesheet. Consider refactoring.",0,0,rule);}});}});CSSLint.addRule({id:"selector-max",name:"Error when past the 4095 selector limit for IE",desc:"Will error when selector count is > 4095.",browsers:"IE",init:function(parser,reporter){var rule=this,count=0;parser.addListener('startrule',function(event){count+=event.selectors.length;});parser.addListener("endstylesheet",function(){if(count>4095){reporter.report("You have "+count+" selectors. Internet Explorer supports a maximum of 4095 selectors per stylesheet. Consider refactoring.",0,0,rule);}});}});CSSLint.addRule({id:"shorthand",name:"Require shorthand properties",desc:"Use shorthand properties where possible.",browsers:"All",init:function(parser,reporter){var rule=this,prop,i,len,propertiesToCheck={},properties,mapping={"margin":["margin-top","margin-bottom","margin-left","margin-right"],"padding":["padding-top","padding-bottom","padding-left","padding-right"]};for(prop in mapping){if(mapping.hasOwnProperty(prop)){for(i=0,len=mapping[prop].length;i<len;i++){propertiesToCheck[mapping[prop][i]]=prop;}}}
251
- function startRule(event){properties={};}
252
- function endRule(event){var prop,i,len,total;for(prop in mapping){if(mapping.hasOwnProperty(prop)){total=0;for(i=0,len=mapping[prop].length;i<len;i++){total+=properties[mapping[prop][i]]?1:0;}
253
- if(total==mapping[prop].length){reporter.report("The properties "+mapping[prop].join(", ")+" can be replaced by "+prop+".",event.line,event.col,rule);}}}}
254
- parser.addListener("startrule",startRule);parser.addListener("startfontface",startRule);parser.addListener("property",function(event){var name=event.property.toString().toLowerCase(),value=event.value.parts[0].value;if(propertiesToCheck[name]){properties[name]=1;}});parser.addListener("endrule",endRule);parser.addListener("endfontface",endRule);}});CSSLint.addRule({id:"star-property-hack",name:"Disallow properties with a star prefix",desc:"Checks for the star property hack (targets IE6/7)",browsers:"All",init:function(parser,reporter){var rule=this;parser.addListener("property",function(event){var property=event.property;if(property.hack=="*"){reporter.report("Property with star prefix found.",event.property.line,event.property.col,rule);}});}});CSSLint.addRule({id:"text-indent",name:"Disallow negative text-indent",desc:"Checks for text indent less than -99px",browsers:"All",init:function(parser,reporter){var rule=this,textIndent,direction;function startRule(event){textIndent=false;direction="inherit";}
255
- function endRule(event){if(textIndent&&direction!="ltr"){reporter.report("Negative text-indent doesn't work well with RTL. If you use text-indent for image replacement explicitly set direction for that item to ltr.",textIndent.line,textIndent.col,rule);}}
256
- parser.addListener("startrule",startRule);parser.addListener("startfontface",startRule);parser.addListener("property",function(event){var name=event.property.toString().toLowerCase(),value=event.value;if(name=="text-indent"&&value.parts[0].value<-99){textIndent=event.property;}else if(name=="direction"&&value=="ltr"){direction="ltr";}});parser.addListener("endrule",endRule);parser.addListener("endfontface",endRule);}});CSSLint.addRule({id:"underscore-property-hack",name:"Disallow properties with an underscore prefix",desc:"Checks for the underscore property hack (targets IE6)",browsers:"All",init:function(parser,reporter){var rule=this;parser.addListener("property",function(event){var property=event.property;if(property.hack=="_"){reporter.report("Property with underscore prefix found.",event.property.line,event.property.col,rule);}});}});CSSLint.addRule({id:"unique-headings",name:"Headings should only be defined once",desc:"Headings should be defined only once.",browsers:"All",init:function(parser,reporter){var rule=this;var headings={h1:0,h2:0,h3:0,h4:0,h5:0,h6:0};parser.addListener("startrule",function(event){var selectors=event.selectors,selector,part,pseudo,i,j;for(i=0;i<selectors.length;i++){selector=selectors[i];part=selector.parts[selector.parts.length-1];if(part.elementName&&/(h[1-6])/i.test(part.elementName.toString())){for(j=0;j<part.modifiers.length;j++){if(part.modifiers[j].type=="pseudo"){pseudo=true;break;}}
257
- if(!pseudo){headings[RegExp.$1]++;if(headings[RegExp.$1]>1){reporter.report("Heading ("+part.elementName+") has already been defined.",part.line,part.col,rule);}}}}});parser.addListener("endstylesheet",function(event){var prop,messages=[];for(prop in headings){if(headings.hasOwnProperty(prop)){if(headings[prop]>1){messages.push(headings[prop]+" "+prop+"s");}}}
258
- if(messages.length){reporter.rollupWarn("You have "+messages.join(", ")+" defined in this stylesheet.",rule);}});}});CSSLint.addRule({id:"universal-selector",name:"Disallow universal selector",desc:"The universal selector (*) is known to be slow.",browsers:"All",init:function(parser,reporter){var rule=this;parser.addListener("startrule",function(event){var selectors=event.selectors,selector,part,modifier,i,j,k;for(i=0;i<selectors.length;i++){selector=selectors[i];part=selector.parts[selector.parts.length-1];if(part.elementName=="*"){reporter.report(rule.desc,part.line,part.col,rule);}}});}});CSSLint.addRule({id:"unqualified-attributes",name:"Disallow unqualified attribute selectors",desc:"Unqualified attribute selectors are known to be slow.",browsers:"All",init:function(parser,reporter){var rule=this;parser.addListener("startrule",function(event){var selectors=event.selectors,selector,part,modifier,i,j,k;for(i=0;i<selectors.length;i++){selector=selectors[i];part=selector.parts[selector.parts.length-1];if(part.type==parser.SELECTOR_PART_TYPE){for(k=0;k<part.modifiers.length;k++){modifier=part.modifiers[k];if(modifier.type=="attribute"&&(!part.elementName||part.elementName=="*")){reporter.report(rule.desc,part.line,part.col,rule);}}}}});}});CSSLint.addRule({id:"vendor-prefix",name:"Require standard property with vendor prefix",desc:"When using a vendor-prefixed property, make sure to include the standard one.",browsers:"All",init:function(parser,reporter){var rule=this,properties,num,propertiesToCheck={"-webkit-border-radius":"border-radius","-webkit-border-top-left-radius":"border-top-left-radius","-webkit-border-top-right-radius":"border-top-right-radius","-webkit-border-bottom-left-radius":"border-bottom-left-radius","-webkit-border-bottom-right-radius":"border-bottom-right-radius","-o-border-radius":"border-radius","-o-border-top-left-radius":"border-top-left-radius","-o-border-top-right-radius":"border-top-right-radius","-o-border-bottom-left-radius":"border-bottom-left-radius","-o-border-bottom-right-radius":"border-bottom-right-radius","-moz-border-radius":"border-radius","-moz-border-radius-topleft":"border-top-left-radius","-moz-border-radius-topright":"border-top-right-radius","-moz-border-radius-bottomleft":"border-bottom-left-radius","-moz-border-radius-bottomright":"border-bottom-right-radius","-moz-column-count":"column-count","-webkit-column-count":"column-count","-moz-column-gap":"column-gap","-webkit-column-gap":"column-gap","-moz-column-rule":"column-rule","-webkit-column-rule":"column-rule","-moz-column-rule-style":"column-rule-style","-webkit-column-rule-style":"column-rule-style","-moz-column-rule-color":"column-rule-color","-webkit-column-rule-color":"column-rule-color","-moz-column-rule-width":"column-rule-width","-webkit-column-rule-width":"column-rule-width","-moz-column-width":"column-width","-webkit-column-width":"column-width","-webkit-column-span":"column-span","-webkit-columns":"columns","-moz-box-shadow":"box-shadow","-webkit-box-shadow":"box-shadow","-moz-transform":"transform","-webkit-transform":"transform","-o-transform":"transform","-ms-transform":"transform","-moz-transform-origin":"transform-origin","-webkit-transform-origin":"transform-origin","-o-transform-origin":"transform-origin","-ms-transform-origin":"transform-origin","-moz-box-sizing":"box-sizing","-webkit-box-sizing":"box-sizing","-moz-user-select":"user-select","-khtml-user-select":"user-select","-webkit-user-select":"user-select"};function startRule(){properties={};num=1;}
259
- function endRule(event){var prop,i,len,standard,needed,actual,needsStandard=[];for(prop in properties){if(propertiesToCheck[prop]){needsStandard.push({actual:prop,needed:propertiesToCheck[prop]});}}
260
- for(i=0,len=needsStandard.length;i<len;i++){needed=needsStandard[i].needed;actual=needsStandard[i].actual;if(!properties[needed]){reporter.report("Missing standard property '"+needed+"' to go along with '"+actual+"'.",properties[actual][0].name.line,properties[actual][0].name.col,rule);}else{if(properties[needed][0].pos<properties[actual][0].pos){reporter.report("Standard property '"+needed+"' should come after vendor-prefixed property '"+actual+"'.",properties[actual][0].name.line,properties[actual][0].name.col,rule);}}}}
261
- parser.addListener("startrule",startRule);parser.addListener("startfontface",startRule);parser.addListener("startpage",startRule);parser.addListener("startpagemargin",startRule);parser.addListener("startkeyframerule",startRule);parser.addListener("property",function(event){var name=event.property.text.toLowerCase();if(!properties[name]){properties[name]=[];}
262
- properties[name].push({name:event.property,value:event.value,pos:num++});});parser.addListener("endrule",endRule);parser.addListener("endfontface",endRule);parser.addListener("endpage",endRule);parser.addListener("endpagemargin",endRule);parser.addListener("endkeyframerule",endRule);}});CSSLint.addRule({id:"zero-units",name:"Disallow units for 0 values",desc:"You don't need to specify units when a value is 0.",browsers:"All",init:function(parser,reporter){var rule=this;parser.addListener("property",function(event){var parts=event.value.parts,i=0,len=parts.length;while(i<len){if((parts[i].units||parts[i].type=="percentage")&&parts[i].value===0&&parts[i].type!="time"){reporter.report("Values of 0 shouldn't have units specified.",parts[i].line,parts[i].col,rule);}
263
- i++;}});}});(function(){var xmlEscape=function(str){if(!str||str.constructor!==String){return"";}
264
- return str.replace(/[\"&><]/g,function(match){switch(match){case"\"":return"&quot;";case"&":return"&amp;";case"<":return"&lt;";case">":return"&gt;";}});};CSSLint.addFormatter({id:"checkstyle-xml",name:"Checkstyle XML format",startFormat:function(){return"<?xml version=\"1.0\" encoding=\"utf-8\"?><checkstyle>";},endFormat:function(){return"</checkstyle>";},readError:function(filename,message){return"<file name=\""+xmlEscape(filename)+"\"><error line=\"0\" column=\"0\" severty=\"error\" message=\""+xmlEscape(message)+"\"></error></file>";},formatResults:function(results,filename,options){var messages=results.messages,output=[];var generateSource=function(rule){if(!rule||!('name'in rule)){return"";}
265
- return'net.csslint.'+rule.name.replace(/\s/g,'');};if(messages.length>0){output.push("<file name=\""+filename+"\">");CSSLint.Util.forEach(messages,function(message,i){if(!message.rollup){output.push("<error line=\""+message.line+"\" column=\""+message.col+"\" severity=\""+message.type+"\""+" message=\""+xmlEscape(message.message)+"\" source=\""+generateSource(message.rule)+"\"/>");}});output.push("</file>");}
266
- return output.join("");}});}());CSSLint.addFormatter({id:"compact",name:"Compact, 'porcelain' format",startFormat:function(){return"";},endFormat:function(){return"";},formatResults:function(results,filename,options){var messages=results.messages,output="";options=options||{};var capitalize=function(str){return str.charAt(0).toUpperCase()+str.slice(1);};if(messages.length===0){return options.quiet?"":filename+": Lint Free!";}
267
- CSSLint.Util.forEach(messages,function(message,i){if(message.rollup){output+=filename+": "+capitalize(message.type)+" - "+message.message+"\n";}else{output+=filename+": "+"line "+message.line+", col "+message.col+", "+capitalize(message.type)+" - "+message.message+"\n";}});return output;}});CSSLint.addFormatter({id:"csslint-xml",name:"CSSLint XML format",startFormat:function(){return"<?xml version=\"1.0\" encoding=\"utf-8\"?><csslint>";},endFormat:function(){return"</csslint>";},formatResults:function(results,filename,options){var messages=results.messages,output=[];var escapeSpecialCharacters=function(str){if(!str||str.constructor!==String){return"";}
268
- return str.replace(/\"/g,"'").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;");};if(messages.length>0){output.push("<file name=\""+filename+"\">");CSSLint.Util.forEach(messages,function(message,i){if(message.rollup){output.push("<issue severity=\""+message.type+"\" reason=\""+escapeSpecialCharacters(message.message)+"\" evidence=\""+escapeSpecialCharacters(message.evidence)+"\"/>");}else{output.push("<issue line=\""+message.line+"\" char=\""+message.col+"\" severity=\""+message.type+"\""+" reason=\""+escapeSpecialCharacters(message.message)+"\" evidence=\""+escapeSpecialCharacters(message.evidence)+"\"/>");}});output.push("</file>");}
269
- return output.join("");}});CSSLint.addFormatter({id:"junit-xml",name:"JUNIT XML format",startFormat:function(){return"<?xml version=\"1.0\" encoding=\"utf-8\"?><testsuites>";},endFormat:function(){return"</testsuites>";},formatResults:function(results,filename,options){var messages=results.messages,output=[],tests={'error':0,'failure':0};var generateSource=function(rule){if(!rule||!('name'in rule)){return"";}
270
- return'net.csslint.'+rule.name.replace(/\s/g,'');};var escapeSpecialCharacters=function(str){if(!str||str.constructor!==String){return"";}
271
- return str.replace(/\"/g,"'").replace(/</g,"&lt;").replace(/>/g,"&gt;");};if(messages.length>0){messages.forEach(function(message,i){var type=message.type==='warning'?'error':message.type;if(!message.rollup){output.push("<testcase time=\"0\" name=\""+generateSource(message.rule)+"\">");output.push("<"+type+" message=\""+escapeSpecialCharacters(message.message)+"\"><![CDATA["+message.line+':'+message.col+':'+escapeSpecialCharacters(message.evidence)+"]]></"+type+">");output.push("</testcase>");tests[type]+=1;}});output.unshift("<testsuite time=\"0\" tests=\""+messages.length+"\" skipped=\"0\" errors=\""+tests.error+"\" failures=\""+tests.failure+"\" package=\"net.csslint\" name=\""+filename+"\">");output.push("</testsuite>");}
272
- return output.join("");}});CSSLint.addFormatter({id:"lint-xml",name:"Lint XML format",startFormat:function(){return"<?xml version=\"1.0\" encoding=\"utf-8\"?><lint>";},endFormat:function(){return"</lint>";},formatResults:function(results,filename,options){var messages=results.messages,output=[];var escapeSpecialCharacters=function(str){if(!str||str.constructor!==String){return"";}
273
- return str.replace(/\"/g,"'").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;");};if(messages.length>0){output.push("<file name=\""+filename+"\">");CSSLint.Util.forEach(messages,function(message,i){if(message.rollup){output.push("<issue severity=\""+message.type+"\" reason=\""+escapeSpecialCharacters(message.message)+"\" evidence=\""+escapeSpecialCharacters(message.evidence)+"\"/>");}else{output.push("<issue line=\""+message.line+"\" char=\""+message.col+"\" severity=\""+message.type+"\""+" reason=\""+escapeSpecialCharacters(message.message)+"\" evidence=\""+escapeSpecialCharacters(message.evidence)+"\"/>");}});output.push("</file>");}
274
- return output.join("");}});CSSLint.addFormatter({id:"text",name:"Plain Text",startFormat:function(){return"";},endFormat:function(){return"";},formatResults:function(results,filename,options){var messages=results.messages,output="";options=options||{};if(messages.length===0){return options.quiet?"":"\n\ncsslint: No errors in "+filename+".";}
275
- output="\n\ncsslint: There are "+messages.length+" problems in "+filename+".";var pos=filename.lastIndexOf("/"),shortFilename=filename;if(pos===-1){pos=filename.lastIndexOf("\\");}
276
- if(pos>-1){shortFilename=filename.substring(pos+1);}
277
- CSSLint.Util.forEach(messages,function(message,i){output=output+"\n\n"+shortFilename;if(message.rollup){output+="\n"+(i+1)+": "+message.type;output+="\n"+message.message;}else{output+="\n"+(i+1)+": "+message.type+" at line "+message.line+", col "+message.col;output+="\n"+message.message;output+="\n"+message.evidence;}});return output;}});return CSSLint;})();
1
+ var exports=exports||{},CSSLint=function(){function Reporter(e,t){this.messages=[],this.stats=[],this.lines=e,this.ruleset=t}var parserlib={};!function(){function e(){this._listeners={}}function t(e){this._input=e.replace(/\n\r?/g,"\n"),this._line=1,this._col=1,this._cursor=0}function r(e,t,r){this.col=r,this.line=t,this.message=e}function n(e,t,r,n){this.col=r,this.line=t,this.text=e,this.type=n}function i(e,r){this._reader=e?new t(e.toString()):null,this._token=null,this._tokenData=r,this._lt=[],this._ltIndex=0,this._ltIndexCache=[]}e.prototype={constructor:e,addListener:function(e,t){this._listeners[e]||(this._listeners[e]=[]),this._listeners[e].push(t)},fire:function(e){if("string"==typeof e&&(e={type:e}),"undefined"!=typeof e.target&&(e.target=this),"undefined"==typeof e.type)throw new Error("Event object missing 'type' property.");if(this._listeners[e.type])for(var t=this._listeners[e.type].concat(),r=0,n=t.length;n>r;r++)t[r].call(this,e)},removeListener:function(e,t){if(this._listeners[e])for(var r=this._listeners[e],n=0,i=r.length;i>n;n++)if(r[n]===t){r.splice(n,1);break}}},t.prototype={constructor:t,getCol:function(){return this._col},getLine:function(){return this._line},eof:function(){return this._cursor==this._input.length},peek:function(e){var t=null;return e="undefined"==typeof e?1:e,this._cursor<this._input.length&&(t=this._input.charAt(this._cursor+e-1)),t},read:function(){var e=null;return this._cursor<this._input.length&&("\n"==this._input.charAt(this._cursor)?(this._line++,this._col=1):this._col++,e=this._input.charAt(this._cursor++)),e},mark:function(){this._bookmark={cursor:this._cursor,line:this._line,col:this._col}},reset:function(){this._bookmark&&(this._cursor=this._bookmark.cursor,this._line=this._bookmark.line,this._col=this._bookmark.col,delete this._bookmark)},readTo:function(e){for(var t,r="";r.length<e.length||r.lastIndexOf(e)!=r.length-e.length;){if(t=this.read(),!t)throw new Error('Expected "'+e+'" at line '+this._line+", col "+this._col+".");r+=t}return r},readWhile:function(e){for(var t="",r=this.read();null!==r&&e(r);)t+=r,r=this.read();return t},readMatch:function(e){var t=this._input.substring(this._cursor),r=null;return"string"==typeof e?0===t.indexOf(e)&&(r=this.readCount(e.length)):e instanceof RegExp&&e.test(t)&&(r=this.readCount(RegExp.lastMatch.length)),r},readCount:function(e){for(var t="";e--;)t+=this.read();return t}},r.prototype=new Error,n.fromToken=function(e){return new n(e.value,e.startLine,e.startCol)},n.prototype={constructor:n,valueOf:function(){return this.toString()},toString:function(){return this.text}},i.createTokenData=function(e){var t=[],r={},n=e.concat([]),i=0,o=n.length+1;for(n.UNKNOWN=-1,n.unshift({name:"EOF"});o>i;i++)t.push(n[i].name),n[n[i].name]=i,n[i].text&&(r[n[i].text]=i);return n.name=function(e){return t[e]},n.type=function(e){return r[e]},n},i.prototype={constructor:i,match:function(e,t){e instanceof Array||(e=[e]);for(var r=this.get(t),n=0,i=e.length;i>n;)if(r==e[n++])return!0;return this.unget(),!1},mustMatch:function(e,t){var n;if(e instanceof Array||(e=[e]),!this.match.apply(this,arguments))throw n=this.LT(1),new r("Expected "+this._tokenData[e[0]].name+" at line "+n.startLine+", col "+n.startCol+".",n.startLine,n.startCol)},advance:function(e,t){for(;0!==this.LA(0)&&!this.match(e,t);)this.get();return this.LA(0)},get:function(e){var t,r,n=this._tokenData,i=(this._reader,0);n.length;if(this._lt.length&&this._ltIndex>=0&&this._ltIndex<this._lt.length){for(i++,this._token=this._lt[this._ltIndex++],r=n[this._token.type];void 0!==r.channel&&e!==r.channel&&this._ltIndex<this._lt.length;)this._token=this._lt[this._ltIndex++],r=n[this._token.type],i++;if((void 0===r.channel||e===r.channel)&&this._ltIndex<=this._lt.length)return this._ltIndexCache.push(i),this._token.type}return t=this._getToken(),t.type>-1&&!n[t.type].hide&&(t.channel=n[t.type].channel,this._token=t,this._lt.push(t),this._ltIndexCache.push(this._lt.length-this._ltIndex+i),this._lt.length>5&&this._lt.shift(),this._ltIndexCache.length>5&&this._ltIndexCache.shift(),this._ltIndex=this._lt.length),r=n[t.type],r&&(r.hide||void 0!==r.channel&&e!==r.channel)?this.get(e):t.type},LA:function(e){var t,r=e;if(e>0){if(e>5)throw new Error("Too much lookahead.");for(;r;)t=this.get(),r--;for(;e>r;)this.unget(),r++}else if(0>e){if(!this._lt[this._ltIndex+e])throw new Error("Too much lookbehind.");t=this._lt[this._ltIndex+e].type}else t=this._token.type;return t},LT:function(e){return this.LA(e),this._lt[this._ltIndex+e-1]},peek:function(){return this.LA(1)},token:function(){return this._token},tokenName:function(e){return 0>e||e>this._tokenData.length?"UNKNOWN_TOKEN":this._tokenData[e].name},tokenType:function(e){return this._tokenData[e]||-1},unget:function(){if(!this._ltIndexCache.length)throw new Error("Too much lookahead.");this._ltIndex-=this._ltIndexCache.pop(),this._token=this._lt[this._ltIndex-1]}},parserlib.util={StringReader:t,SyntaxError:r,SyntaxUnit:n,EventTarget:e,TokenStreamBase:i}}(),function(){function Combinator(e,t,r){SyntaxUnit.call(this,e,t,r,Parser.COMBINATOR_TYPE),this.type="unknown",/^\s+$/.test(e)?this.type="descendant":">"==e?this.type="child":"+"==e?this.type="adjacent-sibling":"~"==e&&(this.type="sibling")}function MediaFeature(e,t){SyntaxUnit.call(this,"("+e+(null!==t?":"+t:"")+")",e.startLine,e.startCol,Parser.MEDIA_FEATURE_TYPE),this.name=e,this.value=t}function MediaQuery(e,t,r,n,i){SyntaxUnit.call(this,(e?e+" ":"")+(t?t:"")+(t&&r.length>0?" and ":"")+r.join(" and "),n,i,Parser.MEDIA_QUERY_TYPE),this.modifier=e,this.mediaType=t,this.features=r}function Parser(e){EventTarget.call(this),this.options=e||{},this._tokenStream=null}function PropertyName(e,t,r,n){SyntaxUnit.call(this,e,r,n,Parser.PROPERTY_NAME_TYPE),this.hack=t}function PropertyValue(e,t,r){SyntaxUnit.call(this,e.join(" "),t,r,Parser.PROPERTY_VALUE_TYPE),this.parts=e}function PropertyValueIterator(e){this._i=0,this._parts=e.parts,this._marks=[],this.value=e}function PropertyValuePart(text,line,col){SyntaxUnit.call(this,text,line,col,Parser.PROPERTY_VALUE_PART_TYPE),this.type="unknown";var temp;if(/^([+\-]?[\d\.]+)([a-z]+)$/i.test(text))switch(this.type="dimension",this.value=+RegExp.$1,this.units=RegExp.$2,this.units.toLowerCase()){case"em":case"rem":case"ex":case"px":case"cm":case"mm":case"in":case"pt":case"pc":case"ch":case"vh":case"vw":case"vm":this.type="length";break;case"deg":case"rad":case"grad":this.type="angle";break;case"ms":case"s":this.type="time";break;case"hz":case"khz":this.type="frequency";break;case"dpi":case"dpcm":this.type="resolution"}else/^([+\-]?[\d\.]+)%$/i.test(text)?(this.type="percentage",this.value=+RegExp.$1):/^([+\-]?[\d\.]+)%$/i.test(text)?(this.type="percentage",this.value=+RegExp.$1):/^([+\-]?\d+)$/i.test(text)?(this.type="integer",this.value=+RegExp.$1):/^([+\-]?[\d\.]+)$/i.test(text)?(this.type="number",this.value=+RegExp.$1):/^#([a-f0-9]{3,6})/i.test(text)?(this.type="color",temp=RegExp.$1,3==temp.length?(this.red=parseInt(temp.charAt(0)+temp.charAt(0),16),this.green=parseInt(temp.charAt(1)+temp.charAt(1),16),this.blue=parseInt(temp.charAt(2)+temp.charAt(2),16)):(this.red=parseInt(temp.substring(0,2),16),this.green=parseInt(temp.substring(2,4),16),this.blue=parseInt(temp.substring(4,6),16))):/^rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)/i.test(text)?(this.type="color",this.red=+RegExp.$1,this.green=+RegExp.$2,this.blue=+RegExp.$3):/^rgb\(\s*(\d+)%\s*,\s*(\d+)%\s*,\s*(\d+)%\s*\)/i.test(text)?(this.type="color",this.red=255*+RegExp.$1/100,this.green=255*+RegExp.$2/100,this.blue=255*+RegExp.$3/100):/^rgba\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*([\d\.]+)\s*\)/i.test(text)?(this.type="color",this.red=+RegExp.$1,this.green=+RegExp.$2,this.blue=+RegExp.$3,this.alpha=+RegExp.$4):/^rgba\(\s*(\d+)%\s*,\s*(\d+)%\s*,\s*(\d+)%\s*,\s*([\d\.]+)\s*\)/i.test(text)?(this.type="color",this.red=255*+RegExp.$1/100,this.green=255*+RegExp.$2/100,this.blue=255*+RegExp.$3/100,this.alpha=+RegExp.$4):/^hsl\(\s*(\d+)\s*,\s*(\d+)%\s*,\s*(\d+)%\s*\)/i.test(text)?(this.type="color",this.hue=+RegExp.$1,this.saturation=+RegExp.$2/100,this.lightness=+RegExp.$3/100):/^hsla\(\s*(\d+)\s*,\s*(\d+)%\s*,\s*(\d+)%\s*,\s*([\d\.]+)\s*\)/i.test(text)?(this.type="color",this.hue=+RegExp.$1,this.saturation=+RegExp.$2/100,this.lightness=+RegExp.$3/100,this.alpha=+RegExp.$4):/^url\(["']?([^\)"']+)["']?\)/i.test(text)?(this.type="uri",this.uri=RegExp.$1):/^([^\(]+)\(/i.test(text)?(this.type="function",this.name=RegExp.$1,this.value=text):/^["'][^"']*["']/.test(text)?(this.type="string",this.value=eval(text)):Colors[text.toLowerCase()]?(this.type="color",temp=Colors[text.toLowerCase()].substring(1),this.red=parseInt(temp.substring(0,2),16),this.green=parseInt(temp.substring(2,4),16),this.blue=parseInt(temp.substring(4,6),16)):/^[\,\/]$/.test(text)?(this.type="operator",this.value=text):/^[a-z\-\u0080-\uFFFF][a-z0-9\-\u0080-\uFFFF]*$/i.test(text)&&(this.type="identifier",this.value=text)}function Selector(e,t,r){SyntaxUnit.call(this,e.join(" "),t,r,Parser.SELECTOR_TYPE),this.parts=e,this.specificity=Specificity.calculate(this)}function SelectorPart(e,t,r,n,i){SyntaxUnit.call(this,r,n,i,Parser.SELECTOR_PART_TYPE),this.elementName=e,this.modifiers=t}function SelectorSubPart(e,t,r,n){SyntaxUnit.call(this,e,r,n,Parser.SELECTOR_SUB_PART_TYPE),this.type=t,this.args=[]}function Specificity(e,t,r,n){this.a=e,this.b=t,this.c=r,this.d=n}function isHexDigit(e){return null!==e&&h.test(e)}function isDigit(e){return null!==e&&/\d/.test(e)}function isWhitespace(e){return null!==e&&/\s/.test(e)}function isNewLine(e){return null!==e&&nl.test(e)}function isNameStart(e){return null!==e&&/[a-z_\u0080-\uFFFF\\]/i.test(e)}function isNameChar(e){return null!==e&&(isNameStart(e)||/[0-9\-\\]/.test(e))}function isIdentStart(e){return null!==e&&(isNameStart(e)||/\-\\/.test(e))}function mix(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r]);return e}function TokenStream(e){TokenStreamBase.call(this,e,Tokens)}function ValidationError(e,t,r){this.col=r,this.line=t,this.message=e}var EventTarget=parserlib.util.EventTarget,TokenStreamBase=parserlib.util.TokenStreamBase,StringReader=parserlib.util.StringReader,SyntaxError=parserlib.util.SyntaxError,SyntaxUnit=parserlib.util.SyntaxUnit,Colors={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgreen:"#90ee90",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370d8",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#d87093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32",activeBorder:"Active window border.",activecaption:"Active window caption.",appworkspace:"Background color of multiple document interface.",background:"Desktop background.",buttonface:"The face background color for 3-D elements that appear 3-D due to one layer of surrounding border.",buttonhighlight:"The color of the border facing the light source for 3-D elements that appear 3-D due to one layer of surrounding border.",buttonshadow:"The color of the border away from the light source for 3-D elements that appear 3-D due to one layer of surrounding border.",buttontext:"Text on push buttons.",captiontext:"Text in caption, size box, and scrollbar arrow box.",graytext:"Grayed (disabled) text. This color is set to #000 if the current display driver does not support a solid gray color.",highlight:"Item(s) selected in a control.",highlighttext:"Text of item(s) selected in a control.",inactiveborder:"Inactive window border.",inactivecaption:"Inactive window caption.",inactivecaptiontext:"Color of text in an inactive caption.",infobackground:"Background color for tooltip controls.",infotext:"Text color for tooltip controls.",menu:"Menu background.",menutext:"Text in menus.",scrollbar:"Scroll bar gray area.",threeddarkshadow:"The color of the darker (generally outer) of the two borders away from the light source for 3-D elements that appear 3-D due to two concentric layers of surrounding border.",threedface:"The face background color for 3-D elements that appear 3-D due to two concentric layers of surrounding border.",threedhighlight:"The color of the lighter (generally outer) of the two borders facing the light source for 3-D elements that appear 3-D due to two concentric layers of surrounding border.",threedlightshadow:"The color of the darker (generally inner) of the two borders facing the light source for 3-D elements that appear 3-D due to two concentric layers of surrounding border.",threedshadow:"The color of the lighter (generally inner) of the two borders away from the light source for 3-D elements that appear 3-D due to two concentric layers of surrounding border.",window:"Window background.",windowframe:"Window frame.",windowtext:"Text in windows."};Combinator.prototype=new SyntaxUnit,Combinator.prototype.constructor=Combinator,MediaFeature.prototype=new SyntaxUnit,MediaFeature.prototype.constructor=MediaFeature,MediaQuery.prototype=new SyntaxUnit,MediaQuery.prototype.constructor=MediaQuery,Parser.DEFAULT_TYPE=0,Parser.COMBINATOR_TYPE=1,Parser.MEDIA_FEATURE_TYPE=2,Parser.MEDIA_QUERY_TYPE=3,Parser.PROPERTY_NAME_TYPE=4,Parser.PROPERTY_VALUE_TYPE=5,Parser.PROPERTY_VALUE_PART_TYPE=6,Parser.SELECTOR_TYPE=7,Parser.SELECTOR_PART_TYPE=8,Parser.SELECTOR_SUB_PART_TYPE=9,Parser.prototype=function(){var e,t=new EventTarget,r={constructor:Parser,DEFAULT_TYPE:0,COMBINATOR_TYPE:1,MEDIA_FEATURE_TYPE:2,MEDIA_QUERY_TYPE:3,PROPERTY_NAME_TYPE:4,PROPERTY_VALUE_TYPE:5,PROPERTY_VALUE_PART_TYPE:6,SELECTOR_TYPE:7,SELECTOR_PART_TYPE:8,SELECTOR_SUB_PART_TYPE:9,_stylesheet:function(){var e,t,r,n=this._tokenStream;for(this.fire("startstylesheet"),this._charset(),this._skipCruft();n.peek()==Tokens.IMPORT_SYM;)this._import(),this._skipCruft();for(;n.peek()==Tokens.NAMESPACE_SYM;)this._namespace(),this._skipCruft();for(r=n.peek();r>Tokens.EOF;){try{switch(r){case Tokens.MEDIA_SYM:this._media(),this._skipCruft();break;case Tokens.PAGE_SYM:this._page(),this._skipCruft();break;case Tokens.FONT_FACE_SYM:this._font_face(),this._skipCruft();break;case Tokens.KEYFRAMES_SYM:this._keyframes(),this._skipCruft();break;case Tokens.VIEWPORT_SYM:this._viewport(),this._skipCruft();break;case Tokens.UNKNOWN_SYM:if(n.get(),this.options.strict)throw new SyntaxError("Unknown @ rule.",n.LT(0).startLine,n.LT(0).startCol);for(this.fire({type:"error",error:null,message:"Unknown @ rule: "+n.LT(0).value+".",line:n.LT(0).startLine,col:n.LT(0).startCol}),e=0;n.advance([Tokens.LBRACE,Tokens.RBRACE])==Tokens.LBRACE;)e++;for(;e;)n.advance([Tokens.RBRACE]),e--;break;case Tokens.S:this._readWhitespace();break;default:if(!this._ruleset())switch(r){case Tokens.CHARSET_SYM:throw t=n.LT(1),this._charset(!1),new SyntaxError("@charset not allowed here.",t.startLine,t.startCol);case Tokens.IMPORT_SYM:throw t=n.LT(1),this._import(!1),new SyntaxError("@import not allowed here.",t.startLine,t.startCol);case Tokens.NAMESPACE_SYM:throw t=n.LT(1),this._namespace(!1),new SyntaxError("@namespace not allowed here.",t.startLine,t.startCol);default:n.get(),this._unexpectedToken(n.token())}}}catch(i){if(!(i instanceof SyntaxError)||this.options.strict)throw i;this.fire({type:"error",error:i,message:i.message,line:i.line,col:i.col})}r=n.peek()}r!=Tokens.EOF&&this._unexpectedToken(n.token()),this.fire("endstylesheet")},_charset:function(e){var t,r,n,i,o=this._tokenStream;o.match(Tokens.CHARSET_SYM)&&(n=o.token().startLine,i=o.token().startCol,this._readWhitespace(),o.mustMatch(Tokens.STRING),r=o.token(),t=r.value,this._readWhitespace(),o.mustMatch(Tokens.SEMICOLON),e!==!1&&this.fire({type:"charset",charset:t,line:n,col:i}))},_import:function(e){var t,r,n=this._tokenStream,i=[];n.mustMatch(Tokens.IMPORT_SYM),r=n.token(),this._readWhitespace(),n.mustMatch([Tokens.STRING,Tokens.URI]),t=n.token().value.replace(/(?:url\()?["']([^"']+)["']\)?/,"$1"),this._readWhitespace(),i=this._media_query_list(),n.mustMatch(Tokens.SEMICOLON),this._readWhitespace(),e!==!1&&this.fire({type:"import",uri:t,media:i,line:r.startLine,col:r.startCol})},_namespace:function(e){var t,r,n,i,o=this._tokenStream;o.mustMatch(Tokens.NAMESPACE_SYM),t=o.token().startLine,r=o.token().startCol,this._readWhitespace(),o.match(Tokens.IDENT)&&(n=o.token().value,this._readWhitespace()),o.mustMatch([Tokens.STRING,Tokens.URI]),i=o.token().value.replace(/(?:url\()?["']([^"']+)["']\)?/,"$1"),this._readWhitespace(),o.mustMatch(Tokens.SEMICOLON),this._readWhitespace(),e!==!1&&this.fire({type:"namespace",prefix:n,uri:i,line:t,col:r})},_media:function(){var e,t,r,n=this._tokenStream;for(n.mustMatch(Tokens.MEDIA_SYM),e=n.token().startLine,t=n.token().startCol,this._readWhitespace(),r=this._media_query_list(),n.mustMatch(Tokens.LBRACE),this._readWhitespace(),this.fire({type:"startmedia",media:r,line:e,col:t});;)if(n.peek()==Tokens.PAGE_SYM)this._page();else if(n.peek()==Tokens.FONT_FACE_SYM)this._font_face();else if(!this._ruleset())break;n.mustMatch(Tokens.RBRACE),this._readWhitespace(),this.fire({type:"endmedia",media:r,line:e,col:t})},_media_query_list:function(){var e=this._tokenStream,t=[];for(this._readWhitespace(),(e.peek()==Tokens.IDENT||e.peek()==Tokens.LPAREN)&&t.push(this._media_query());e.match(Tokens.COMMA);)this._readWhitespace(),t.push(this._media_query());return t},_media_query:function(){var e=this._tokenStream,t=null,r=null,n=null,i=[];if(e.match(Tokens.IDENT)&&(r=e.token().value.toLowerCase(),"only"!=r&&"not"!=r?(e.unget(),r=null):n=e.token()),this._readWhitespace(),e.peek()==Tokens.IDENT?(t=this._media_type(),null===n&&(n=e.token())):e.peek()==Tokens.LPAREN&&(null===n&&(n=e.LT(1)),i.push(this._media_expression())),null===t&&0===i.length)return null;for(this._readWhitespace();e.match(Tokens.IDENT);)"and"!=e.token().value.toLowerCase()&&this._unexpectedToken(e.token()),this._readWhitespace(),i.push(this._media_expression());return new MediaQuery(r,t,i,n.startLine,n.startCol)},_media_type:function(){return this._media_feature()},_media_expression:function(){var e,t=this._tokenStream,r=null,n=null;return t.mustMatch(Tokens.LPAREN),r=this._media_feature(),this._readWhitespace(),t.match(Tokens.COLON)&&(this._readWhitespace(),e=t.LT(1),n=this._expression()),t.mustMatch(Tokens.RPAREN),this._readWhitespace(),new MediaFeature(r,n?new SyntaxUnit(n,e.startLine,e.startCol):null)},_media_feature:function(){var e=this._tokenStream;return e.mustMatch(Tokens.IDENT),SyntaxUnit.fromToken(e.token())},_page:function(){var e,t,r=this._tokenStream,n=null,i=null;r.mustMatch(Tokens.PAGE_SYM),e=r.token().startLine,t=r.token().startCol,this._readWhitespace(),r.match(Tokens.IDENT)&&(n=r.token().value,"auto"===n.toLowerCase()&&this._unexpectedToken(r.token())),r.peek()==Tokens.COLON&&(i=this._pseudo_page()),this._readWhitespace(),this.fire({type:"startpage",id:n,pseudo:i,line:e,col:t}),this._readDeclarations(!0,!0),this.fire({type:"endpage",id:n,pseudo:i,line:e,col:t})},_margin:function(){var e,t,r=this._tokenStream,n=this._margin_sym();return n?(e=r.token().startLine,t=r.token().startCol,this.fire({type:"startpagemargin",margin:n,line:e,col:t}),this._readDeclarations(!0),this.fire({type:"endpagemargin",margin:n,line:e,col:t}),!0):!1},_margin_sym:function(){var e=this._tokenStream;return e.match([Tokens.TOPLEFTCORNER_SYM,Tokens.TOPLEFT_SYM,Tokens.TOPCENTER_SYM,Tokens.TOPRIGHT_SYM,Tokens.TOPRIGHTCORNER_SYM,Tokens.BOTTOMLEFTCORNER_SYM,Tokens.BOTTOMLEFT_SYM,Tokens.BOTTOMCENTER_SYM,Tokens.BOTTOMRIGHT_SYM,Tokens.BOTTOMRIGHTCORNER_SYM,Tokens.LEFTTOP_SYM,Tokens.LEFTMIDDLE_SYM,Tokens.LEFTBOTTOM_SYM,Tokens.RIGHTTOP_SYM,Tokens.RIGHTMIDDLE_SYM,Tokens.RIGHTBOTTOM_SYM])?SyntaxUnit.fromToken(e.token()):null},_pseudo_page:function(){var e=this._tokenStream;return e.mustMatch(Tokens.COLON),e.mustMatch(Tokens.IDENT),e.token().value},_font_face:function(){var e,t,r=this._tokenStream;r.mustMatch(Tokens.FONT_FACE_SYM),e=r.token().startLine,t=r.token().startCol,this._readWhitespace(),this.fire({type:"startfontface",line:e,col:t}),this._readDeclarations(!0),this.fire({type:"endfontface",line:e,col:t})},_viewport:function(){var e,t,r=this._tokenStream;r.mustMatch(Tokens.VIEWPORT_SYM),e=r.token().startLine,t=r.token().startCol,this._readWhitespace(),this.fire({type:"startviewport",line:e,col:t}),this._readDeclarations(!0),this.fire({type:"endviewport",line:e,col:t})},_operator:function(e){var t=this._tokenStream,r=null;return(t.match([Tokens.SLASH,Tokens.COMMA])||e&&t.match([Tokens.PLUS,Tokens.STAR,Tokens.MINUS]))&&(r=t.token(),this._readWhitespace()),r?PropertyValuePart.fromToken(r):null},_combinator:function(){var e,t=this._tokenStream,r=null;return t.match([Tokens.PLUS,Tokens.GREATER,Tokens.TILDE])&&(e=t.token(),r=new Combinator(e.value,e.startLine,e.startCol),this._readWhitespace()),r},_unary_operator:function(){var e=this._tokenStream;return e.match([Tokens.MINUS,Tokens.PLUS])?e.token().value:null},_property:function(){var e,t,r,n,i=this._tokenStream,o=null,a=null;return i.peek()==Tokens.STAR&&this.options.starHack&&(i.get(),t=i.token(),a=t.value,r=t.startLine,n=t.startCol),i.match(Tokens.IDENT)&&(t=i.token(),e=t.value,"_"==e.charAt(0)&&this.options.underscoreHack&&(a="_",e=e.substring(1)),o=new PropertyName(e,a,r||t.startLine,n||t.startCol),this._readWhitespace()),o},_ruleset:function(){var e,t,r=this._tokenStream;try{t=this._selectors_group()}catch(n){if(!(n instanceof SyntaxError)||this.options.strict)throw n;if(this.fire({type:"error",error:n,message:n.message,line:n.line,col:n.col}),e=r.advance([Tokens.RBRACE]),e!=Tokens.RBRACE)throw n;return!0}return t&&(this.fire({type:"startrule",selectors:t,line:t[0].line,col:t[0].col}),this._readDeclarations(!0),this.fire({type:"endrule",selectors:t,line:t[0].line,col:t[0].col})),t},_selectors_group:function(){var e,t=this._tokenStream,r=[];if(e=this._selector(),null!==e)for(r.push(e);t.match(Tokens.COMMA);)this._readWhitespace(),e=this._selector(),null!==e?r.push(e):this._unexpectedToken(t.LT(1));return r.length?r:null},_selector:function(){var e=this._tokenStream,t=[],r=null,n=null,i=null;if(r=this._simple_selector_sequence(),null===r)return null;for(t.push(r);;)if(n=this._combinator(),null!==n)t.push(n),r=this._simple_selector_sequence(),null===r?this._unexpectedToken(e.LT(1)):t.push(r);else{if(!this._readWhitespace())break;i=new Combinator(e.token().value,e.token().startLine,e.token().startCol),n=this._combinator(),r=this._simple_selector_sequence(),null===r?null!==n&&this._unexpectedToken(e.LT(1)):(null!==n?t.push(n):t.push(i),t.push(r))}return new Selector(t,t[0].line,t[0].col)},_simple_selector_sequence:function(){var e,t,r=this._tokenStream,n=null,i=[],o="",a=[function(){return r.match(Tokens.HASH)?new SelectorSubPart(r.token().value,"id",r.token().startLine,r.token().startCol):null},this._class,this._attrib,this._pseudo,this._negation],s=0,l=a.length,u=null;for(e=r.LT(1).startLine,t=r.LT(1).startCol,n=this._type_selector(),n||(n=this._universal()),null!==n&&(o+=n);;){if(r.peek()===Tokens.S)break;for(;l>s&&null===u;)u=a[s++].call(this);if(null===u){if(""===o)return null;break}s=0,i.push(u),o+=u.toString(),u=null}return""!==o?new SelectorPart(n,i,o,e,t):null},_type_selector:function(){var e=this._tokenStream,t=this._namespace_prefix(),r=this._element_name();return r?(t&&(r.text=t+r.text,r.col-=t.length),r):(t&&(e.unget(),t.length>1&&e.unget()),null)},_class:function(){var e,t=this._tokenStream;return t.match(Tokens.DOT)?(t.mustMatch(Tokens.IDENT),e=t.token(),new SelectorSubPart("."+e.value,"class",e.startLine,e.startCol-1)):null},_element_name:function(){var e,t=this._tokenStream;return t.match(Tokens.IDENT)?(e=t.token(),new SelectorSubPart(e.value,"elementName",e.startLine,e.startCol)):null},_namespace_prefix:function(){var e=this._tokenStream,t="";return(e.LA(1)===Tokens.PIPE||e.LA(2)===Tokens.PIPE)&&(e.match([Tokens.IDENT,Tokens.STAR])&&(t+=e.token().value),e.mustMatch(Tokens.PIPE),t+="|"),t.length?t:null},_universal:function(){var e,t=this._tokenStream,r="";return e=this._namespace_prefix(),e&&(r+=e),t.match(Tokens.STAR)&&(r+="*"),r.length?r:null},_attrib:function(){var e,t,r=this._tokenStream,n=null;return r.match(Tokens.LBRACKET)?(t=r.token(),n=t.value,n+=this._readWhitespace(),e=this._namespace_prefix(),e&&(n+=e),r.mustMatch(Tokens.IDENT),n+=r.token().value,n+=this._readWhitespace(),r.match([Tokens.PREFIXMATCH,Tokens.SUFFIXMATCH,Tokens.SUBSTRINGMATCH,Tokens.EQUALS,Tokens.INCLUDES,Tokens.DASHMATCH])&&(n+=r.token().value,n+=this._readWhitespace(),r.mustMatch([Tokens.IDENT,Tokens.STRING]),n+=r.token().value,n+=this._readWhitespace()),r.mustMatch(Tokens.RBRACKET),new SelectorSubPart(n+"]","attribute",t.startLine,t.startCol)):null},_pseudo:function(){var e,t,r=this._tokenStream,n=null,i=":";return r.match(Tokens.COLON)&&(r.match(Tokens.COLON)&&(i+=":"),r.match(Tokens.IDENT)?(n=r.token().value,e=r.token().startLine,t=r.token().startCol-i.length):r.peek()==Tokens.FUNCTION&&(e=r.LT(1).startLine,t=r.LT(1).startCol-i.length,n=this._functional_pseudo()),n&&(n=new SelectorSubPart(i+n,"pseudo",e,t))),n},_functional_pseudo:function(){var e=this._tokenStream,t=null;return e.match(Tokens.FUNCTION)&&(t=e.token().value,t+=this._readWhitespace(),t+=this._expression(),e.mustMatch(Tokens.RPAREN),t+=")"),t},_expression:function(){for(var e=this._tokenStream,t="";e.match([Tokens.PLUS,Tokens.MINUS,Tokens.DIMENSION,Tokens.NUMBER,Tokens.STRING,Tokens.IDENT,Tokens.LENGTH,Tokens.FREQ,Tokens.ANGLE,Tokens.TIME,Tokens.RESOLUTION,Tokens.SLASH]);)t+=e.token().value,t+=this._readWhitespace();return t.length?t:null},_negation:function(){var e,t,r,n=this._tokenStream,i="",o=null;return n.match(Tokens.NOT)&&(i=n.token().value,e=n.token().startLine,t=n.token().startCol,i+=this._readWhitespace(),r=this._negation_arg(),i+=r,i+=this._readWhitespace(),n.match(Tokens.RPAREN),i+=n.token().value,o=new SelectorSubPart(i,"not",e,t),o.args.push(r)),o},_negation_arg:function(){var e,t,r,n=this._tokenStream,i=[this._type_selector,this._universal,function(){return n.match(Tokens.HASH)?new SelectorSubPart(n.token().value,"id",n.token().startLine,n.token().startCol):null},this._class,this._attrib,this._pseudo],o=null,a=0,s=i.length;for(e=n.LT(1).startLine,t=n.LT(1).startCol;s>a&&null===o;)o=i[a].call(this),a++;return null===o&&this._unexpectedToken(n.LT(1)),r="elementName"==o.type?new SelectorPart(o,[],o.toString(),e,t):new SelectorPart(null,[o],o.toString(),e,t)},_declaration:function(){var e=this._tokenStream,t=null,r=null,n=null,i=null,o="";if(t=this._property(),null!==t){e.mustMatch(Tokens.COLON),this._readWhitespace(),r=this._expr(),r&&0!==r.length||this._unexpectedToken(e.LT(1)),n=this._prio(),o=t.toString(),(this.options.starHack&&"*"==t.hack||this.options.underscoreHack&&"_"==t.hack)&&(o=t.text);try{this._validateProperty(o,r)}catch(a){i=a}return this.fire({type:"property",property:t,value:r,important:n,line:t.line,col:t.col,invalid:i}),!0}return!1},_prio:function(){var e=this._tokenStream,t=e.match(Tokens.IMPORTANT_SYM);return this._readWhitespace(),t},_expr:function(e){var t=(this._tokenStream,[]),r=null,n=null;if(r=this._term(),null!==r)for(t.push(r);;){if(n=this._operator(e),n&&t.push(n),r=this._term(),null===r)break;t.push(r)}return t.length>0?new PropertyValue(t,t[0].line,t[0].col):null},_term:function(){var e,t,r,n=this._tokenStream,i=null,o=null;return i=this._unary_operator(),null!==i&&(t=n.token().startLine,r=n.token().startCol),n.peek()==Tokens.IE_FUNCTION&&this.options.ieFilters?(o=this._ie_function(),null===i&&(t=n.token().startLine,r=n.token().startCol)):n.match([Tokens.NUMBER,Tokens.PERCENTAGE,Tokens.LENGTH,Tokens.ANGLE,Tokens.TIME,Tokens.FREQ,Tokens.STRING,Tokens.IDENT,Tokens.URI,Tokens.UNICODE_RANGE])?(o=n.token().value,null===i&&(t=n.token().startLine,r=n.token().startCol),this._readWhitespace()):(e=this._hexcolor(),null===e?(null===i&&(t=n.LT(1).startLine,r=n.LT(1).startCol),null===o&&(o=n.LA(3)==Tokens.EQUALS&&this.options.ieFilters?this._ie_function():this._function())):(o=e.value,null===i&&(t=e.startLine,r=e.startCol))),null!==o?new PropertyValuePart(null!==i?i+o:o,t,r):null},_function:function(){var e,t=this._tokenStream,r=null,n=null;if(t.match(Tokens.FUNCTION)){if(r=t.token().value,this._readWhitespace(),n=this._expr(!0),r+=n,this.options.ieFilters&&t.peek()==Tokens.EQUALS)do for(this._readWhitespace()&&(r+=t.token().value),t.LA(0)==Tokens.COMMA&&(r+=t.token().value),t.match(Tokens.IDENT),r+=t.token().value,t.match(Tokens.EQUALS),r+=t.token().value,e=t.peek();e!=Tokens.COMMA&&e!=Tokens.S&&e!=Tokens.RPAREN;)t.get(),r+=t.token().value,e=t.peek();while(t.match([Tokens.COMMA,Tokens.S]));t.match(Tokens.RPAREN),r+=")",this._readWhitespace()}return r},_ie_function:function(){var e,t=this._tokenStream,r=null;if(t.match([Tokens.IE_FUNCTION,Tokens.FUNCTION])){r=t.token().value;do for(this._readWhitespace()&&(r+=t.token().value),t.LA(0)==Tokens.COMMA&&(r+=t.token().value),t.match(Tokens.IDENT),r+=t.token().value,t.match(Tokens.EQUALS),r+=t.token().value,e=t.peek();e!=Tokens.COMMA&&e!=Tokens.S&&e!=Tokens.RPAREN;)t.get(),r+=t.token().value,e=t.peek();while(t.match([Tokens.COMMA,Tokens.S]));t.match(Tokens.RPAREN),r+=")",this._readWhitespace()}return r},_hexcolor:function(){var e,t=this._tokenStream,r=null;if(t.match(Tokens.HASH)){if(r=t.token(),e=r.value,!/#[a-f0-9]{3,6}/i.test(e))throw new SyntaxError("Expected a hex color but found '"+e+"' at line "+r.startLine+", col "+r.startCol+".",r.startLine,r.startCol);this._readWhitespace()}return r},_keyframes:function(){var e,t,r,n=this._tokenStream,i="";for(n.mustMatch(Tokens.KEYFRAMES_SYM),e=n.token(),/^@\-([^\-]+)\-/.test(e.value)&&(i=RegExp.$1),this._readWhitespace(),r=this._keyframe_name(),
2
+ this._readWhitespace(),n.mustMatch(Tokens.LBRACE),this.fire({type:"startkeyframes",name:r,prefix:i,line:e.startLine,col:e.startCol}),this._readWhitespace(),t=n.peek();t==Tokens.IDENT||t==Tokens.PERCENTAGE;)this._keyframe_rule(),this._readWhitespace(),t=n.peek();this.fire({type:"endkeyframes",name:r,prefix:i,line:e.startLine,col:e.startCol}),this._readWhitespace(),n.mustMatch(Tokens.RBRACE)},_keyframe_name:function(){var e=this._tokenStream;return e.mustMatch([Tokens.IDENT,Tokens.STRING]),SyntaxUnit.fromToken(e.token())},_keyframe_rule:function(){var e=(this._tokenStream,this._key_list());this.fire({type:"startkeyframerule",keys:e,line:e[0].line,col:e[0].col}),this._readDeclarations(!0),this.fire({type:"endkeyframerule",keys:e,line:e[0].line,col:e[0].col})},_key_list:function(){var e=this._tokenStream,t=[];for(t.push(this._key()),this._readWhitespace();e.match(Tokens.COMMA);)this._readWhitespace(),t.push(this._key()),this._readWhitespace();return t},_key:function(){var e,t=this._tokenStream;if(t.match(Tokens.PERCENTAGE))return SyntaxUnit.fromToken(t.token());if(t.match(Tokens.IDENT)){if(e=t.token(),/from|to/i.test(e.value))return SyntaxUnit.fromToken(e);t.unget()}this._unexpectedToken(t.LT(1))},_skipCruft:function(){for(;this._tokenStream.match([Tokens.S,Tokens.CDO,Tokens.CDC]););},_readDeclarations:function(e,t){var r,n=this._tokenStream;this._readWhitespace(),e&&n.mustMatch(Tokens.LBRACE),this._readWhitespace();try{for(;;){if(n.match(Tokens.SEMICOLON)||t&&this._margin());else{if(!this._declaration())break;if(!n.match(Tokens.SEMICOLON))break}this._readWhitespace()}n.mustMatch(Tokens.RBRACE),this._readWhitespace()}catch(i){if(!(i instanceof SyntaxError)||this.options.strict)throw i;if(this.fire({type:"error",error:i,message:i.message,line:i.line,col:i.col}),r=n.advance([Tokens.SEMICOLON,Tokens.RBRACE]),r==Tokens.SEMICOLON)this._readDeclarations(!1,t);else if(r!=Tokens.RBRACE)throw i}},_readWhitespace:function(){for(var e=this._tokenStream,t="";e.match(Tokens.S);)t+=e.token().value;return t},_unexpectedToken:function(e){throw new SyntaxError("Unexpected token '"+e.value+"' at line "+e.startLine+", col "+e.startCol+".",e.startLine,e.startCol)},_verifyEnd:function(){this._tokenStream.LA(1)!=Tokens.EOF&&this._unexpectedToken(this._tokenStream.LT(1))},_validateProperty:function(e,t){Validation.validate(e,t)},parse:function(e){this._tokenStream=new TokenStream(e,Tokens),this._stylesheet()},parseStyleSheet:function(e){return this.parse(e)},parseMediaQuery:function(e){this._tokenStream=new TokenStream(e,Tokens);var t=this._media_query();return this._verifyEnd(),t},parsePropertyValue:function(e){this._tokenStream=new TokenStream(e,Tokens),this._readWhitespace();var t=this._expr();return this._readWhitespace(),this._verifyEnd(),t},parseRule:function(e){this._tokenStream=new TokenStream(e,Tokens),this._readWhitespace();var t=this._ruleset();return this._readWhitespace(),this._verifyEnd(),t},parseSelector:function(e){this._tokenStream=new TokenStream(e,Tokens),this._readWhitespace();var t=this._selector();return this._readWhitespace(),this._verifyEnd(),t},parseStyleAttribute:function(e){e+="}",this._tokenStream=new TokenStream(e,Tokens),this._readDeclarations()}};for(e in r)r.hasOwnProperty(e)&&(t[e]=r[e]);return t}();var Properties={"alignment-adjust":"auto | baseline | before-edge | text-before-edge | middle | central | after-edge | text-after-edge | ideographic | alphabetic | hanging | mathematical | <percentage> | <length>","alignment-baseline":"baseline | use-script | before-edge | text-before-edge | after-edge | text-after-edge | central | middle | ideographic | alphabetic | hanging | mathematical",animation:1,"animation-delay":{multi:"<time>",comma:!0},"animation-direction":{multi:"normal | alternate",comma:!0},"animation-duration":{multi:"<time>",comma:!0},"animation-iteration-count":{multi:"<number> | infinite",comma:!0},"animation-name":{multi:"none | <ident>",comma:!0},"animation-play-state":{multi:"running | paused",comma:!0},"animation-timing-function":1,"-moz-animation-delay":{multi:"<time>",comma:!0},"-moz-animation-direction":{multi:"normal | alternate",comma:!0},"-moz-animation-duration":{multi:"<time>",comma:!0},"-moz-animation-iteration-count":{multi:"<number> | infinite",comma:!0},"-moz-animation-name":{multi:"none | <ident>",comma:!0},"-moz-animation-play-state":{multi:"running | paused",comma:!0},"-ms-animation-delay":{multi:"<time>",comma:!0},"-ms-animation-direction":{multi:"normal | alternate",comma:!0},"-ms-animation-duration":{multi:"<time>",comma:!0},"-ms-animation-iteration-count":{multi:"<number> | infinite",comma:!0},"-ms-animation-name":{multi:"none | <ident>",comma:!0},"-ms-animation-play-state":{multi:"running | paused",comma:!0},"-webkit-animation-delay":{multi:"<time>",comma:!0},"-webkit-animation-direction":{multi:"normal | alternate",comma:!0},"-webkit-animation-duration":{multi:"<time>",comma:!0},"-webkit-animation-iteration-count":{multi:"<number> | infinite",comma:!0},"-webkit-animation-name":{multi:"none | <ident>",comma:!0},"-webkit-animation-play-state":{multi:"running | paused",comma:!0},"-o-animation-delay":{multi:"<time>",comma:!0},"-o-animation-direction":{multi:"normal | alternate",comma:!0},"-o-animation-duration":{multi:"<time>",comma:!0},"-o-animation-iteration-count":{multi:"<number> | infinite",comma:!0},"-o-animation-name":{multi:"none | <ident>",comma:!0},"-o-animation-play-state":{multi:"running | paused",comma:!0},appearance:"icon | window | desktop | workspace | document | tooltip | dialog | button | push-button | hyperlink | radio-button | checkbox | menu-item | tab | menu | menubar | pull-down-menu | pop-up-menu | list-menu | radio-group | checkbox-group | outline-tree | range | field | combo-box | signature | password | normal | none | inherit",azimuth:function(e){var t,r="<angle> | leftwards | rightwards | inherit",n="left-side | far-left | left | center-left | center | center-right | right | far-right | right-side",i=!1,o=!1;if(ValidationTypes.isAny(e,r)||(ValidationTypes.isAny(e,"behind")&&(i=!0,o=!0),ValidationTypes.isAny(e,n)&&(o=!0,i||ValidationTypes.isAny(e,"behind"))),e.hasNext())throw t=e.next(),o?new ValidationError("Expected end of value but found '"+t+"'.",t.line,t.col):new ValidationError("Expected (<'azimuth'>) but found '"+t+"'.",t.line,t.col)},"backface-visibility":"visible | hidden",background:1,"background-attachment":{multi:"<attachment>",comma:!0},"background-clip":{multi:"<box>",comma:!0},"background-color":"<color> | inherit","background-image":{multi:"<bg-image>",comma:!0},"background-origin":{multi:"<box>",comma:!0},"background-position":{multi:"<bg-position>",comma:!0},"background-repeat":{multi:"<repeat-style>"},"background-size":{multi:"<bg-size>",comma:!0},"baseline-shift":"baseline | sub | super | <percentage> | <length>",behavior:1,binding:1,bleed:"<length>","bookmark-label":"<content> | <attr> | <string>","bookmark-level":"none | <integer>","bookmark-state":"open | closed","bookmark-target":"none | <uri> | <attr>",border:"<border-width> || <border-style> || <color>","border-bottom":"<border-width> || <border-style> || <color>","border-bottom-color":"<color> | inherit","border-bottom-left-radius":"<x-one-radius>","border-bottom-right-radius":"<x-one-radius>","border-bottom-style":"<border-style>","border-bottom-width":"<border-width>","border-collapse":"collapse | separate | inherit","border-color":{multi:"<color> | inherit",max:4},"border-image":1,"border-image-outset":{multi:"<length> | <number>",max:4},"border-image-repeat":{multi:"stretch | repeat | round",max:2},"border-image-slice":function(e){var t,r=!1,n="<number> | <percentage>",i=!1,o=0,a=4;for(ValidationTypes.isAny(e,"fill")&&(i=!0,r=!0);e.hasNext()&&a>o&&(r=ValidationTypes.isAny(e,n));)o++;if(i?r=!0:ValidationTypes.isAny(e,"fill"),e.hasNext())throw t=e.next(),r?new ValidationError("Expected end of value but found '"+t+"'.",t.line,t.col):new ValidationError("Expected ([<number> | <percentage>]{1,4} && fill?) but found '"+t+"'.",t.line,t.col)},"border-image-source":"<image> | none","border-image-width":{multi:"<length> | <percentage> | <number> | auto",max:4},"border-left":"<border-width> || <border-style> || <color>","border-left-color":"<color> | inherit","border-left-style":"<border-style>","border-left-width":"<border-width>","border-radius":function(e){for(var t,r=!1,n="<length> | <percentage> | inherit",i=!1,o=0,a=8;e.hasNext()&&a>o;){if(r=ValidationTypes.isAny(e,n),!r){if(!("/"==e.peek()&&o>0)||i)break;i=!0,a=o+5,e.next()}o++}if(e.hasNext())throw t=e.next(),r?new ValidationError("Expected end of value but found '"+t+"'.",t.line,t.col):new ValidationError("Expected (<'border-radius'>) but found '"+t+"'.",t.line,t.col)},"border-right":"<border-width> || <border-style> || <color>","border-right-color":"<color> | inherit","border-right-style":"<border-style>","border-right-width":"<border-width>","border-spacing":{multi:"<length> | inherit",max:2},"border-style":{multi:"<border-style>",max:4},"border-top":"<border-width> || <border-style> || <color>","border-top-color":"<color> | inherit","border-top-left-radius":"<x-one-radius>","border-top-right-radius":"<x-one-radius>","border-top-style":"<border-style>","border-top-width":"<border-width>","border-width":{multi:"<border-width>",max:4},bottom:"<margin-width> | inherit","box-align":"start | end | center | baseline | stretch","box-decoration-break":"slice |clone","box-direction":"normal | reverse | inherit","box-flex":"<number>","box-flex-group":"<integer>","box-lines":"single | multiple","box-ordinal-group":"<integer>","box-orient":"horizontal | vertical | inline-axis | block-axis | inherit","box-pack":"start | end | center | justify","box-shadow":function(e){var t;if(ValidationTypes.isAny(e,"none")){if(e.hasNext())throw t=e.next(),new ValidationError("Expected end of value but found '"+t+"'.",t.line,t.col)}else Validation.multiProperty("<shadow>",e,!0,1/0)},"box-sizing":"content-box | border-box | inherit","break-after":"auto | always | avoid | left | right | page | column | avoid-page | avoid-column","break-before":"auto | always | avoid | left | right | page | column | avoid-page | avoid-column","break-inside":"auto | avoid | avoid-page | avoid-column","caption-side":"top | bottom | inherit",clear:"none | right | left | both | inherit",clip:1,color:"<color> | inherit","color-profile":1,"column-count":"<integer> | auto","column-fill":"auto | balance","column-gap":"<length> | normal","column-rule":"<border-width> || <border-style> || <color>","column-rule-color":"<color>","column-rule-style":"<border-style>","column-rule-width":"<border-width>","column-span":"none | all","column-width":"<length> | auto",columns:1,content:1,"counter-increment":1,"counter-reset":1,crop:"<shape> | auto",cue:"cue-after | cue-before | inherit","cue-after":1,"cue-before":1,cursor:1,direction:"ltr | rtl | inherit",display:"inline | block | list-item | inline-block | table | inline-table | table-row-group | table-header-group | table-footer-group | table-row | table-column-group | table-column | table-cell | table-caption | box | inline-box | grid | inline-grid | none | inherit | -moz-box | -moz-inline-block | -moz-inline-box | -moz-inline-grid | -moz-inline-stack | -moz-inline-table | -moz-grid | -moz-grid-group | -moz-grid-line | -moz-groupbox | -moz-deck | -moz-popup | -moz-stack | -moz-marker | -webkit-box | -webkit-inline-box","dominant-baseline":1,"drop-initial-after-adjust":"central | middle | after-edge | text-after-edge | ideographic | alphabetic | mathematical | <percentage> | <length>","drop-initial-after-align":"baseline | use-script | before-edge | text-before-edge | after-edge | text-after-edge | central | middle | ideographic | alphabetic | hanging | mathematical","drop-initial-before-adjust":"before-edge | text-before-edge | central | middle | hanging | mathematical | <percentage> | <length>","drop-initial-before-align":"caps-height | baseline | use-script | before-edge | text-before-edge | after-edge | text-after-edge | central | middle | ideographic | alphabetic | hanging | mathematical","drop-initial-size":"auto | line | <length> | <percentage>","drop-initial-value":"initial | <integer>",elevation:"<angle> | below | level | above | higher | lower | inherit","empty-cells":"show | hide | inherit",filter:1,fit:"fill | hidden | meet | slice","fit-position":1,"float":"left | right | none | inherit","float-offset":1,font:1,"font-family":1,"font-size":"<absolute-size> | <relative-size> | <length> | <percentage> | inherit","font-size-adjust":"<number> | none | inherit","font-stretch":"normal | ultra-condensed | extra-condensed | condensed | semi-condensed | semi-expanded | expanded | extra-expanded | ultra-expanded | inherit","font-style":"normal | italic | oblique | inherit","font-variant":"normal | small-caps | inherit","font-weight":"normal | bold | bolder | lighter | 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900 | inherit","grid-cell-stacking":"columns | rows | layer","grid-column":1,"grid-columns":1,"grid-column-align":"start | end | center | stretch","grid-column-sizing":1,"grid-column-span":"<integer>","grid-flow":"none | rows | columns","grid-layer":"<integer>","grid-row":1,"grid-rows":1,"grid-row-align":"start | end | center | stretch","grid-row-span":"<integer>","grid-row-sizing":1,"hanging-punctuation":1,height:"<margin-width> | inherit","hyphenate-after":"<integer> | auto","hyphenate-before":"<integer> | auto","hyphenate-character":"<string> | auto","hyphenate-lines":"no-limit | <integer>","hyphenate-resource":1,hyphens:"none | manual | auto",icon:1,"image-orientation":"angle | auto","image-rendering":1,"image-resolution":1,"inline-box-align":"initial | last | <integer>",left:"<margin-width> | inherit","letter-spacing":"<length> | normal | inherit","line-height":"<number> | <length> | <percentage> | normal | inherit","line-break":"auto | loose | normal | strict","line-stacking":1,"line-stacking-ruby":"exclude-ruby | include-ruby","line-stacking-shift":"consider-shifts | disregard-shifts","line-stacking-strategy":"inline-line-height | block-line-height | max-height | grid-height","list-style":1,"list-style-image":"<uri> | none | inherit","list-style-position":"inside | outside | inherit","list-style-type":"disc | circle | square | decimal | decimal-leading-zero | lower-roman | upper-roman | lower-greek | lower-latin | upper-latin | armenian | georgian | lower-alpha | upper-alpha | none | inherit",margin:{multi:"<margin-width> | inherit",max:4},"margin-bottom":"<margin-width> | inherit","margin-left":"<margin-width> | inherit","margin-right":"<margin-width> | inherit","margin-top":"<margin-width> | inherit",mark:1,"mark-after":1,"mark-before":1,marks:1,"marquee-direction":1,"marquee-play-count":1,"marquee-speed":1,"marquee-style":1,"max-height":"<length> | <percentage> | none | inherit","max-width":"<length> | <percentage> | none | inherit","min-height":"<length> | <percentage> | inherit","min-width":"<length> | <percentage> | inherit","move-to":1,"nav-down":1,"nav-index":1,"nav-left":1,"nav-right":1,"nav-up":1,opacity:"<number> | inherit",orphans:"<integer> | inherit",outline:1,"outline-color":"<color> | invert | inherit","outline-offset":1,"outline-style":"<border-style> | inherit","outline-width":"<border-width> | inherit",overflow:"visible | hidden | scroll | auto | inherit","overflow-style":1,"overflow-x":1,"overflow-y":1,padding:{multi:"<padding-width> | inherit",max:4},"padding-bottom":"<padding-width> | inherit","padding-left":"<padding-width> | inherit","padding-right":"<padding-width> | inherit","padding-top":"<padding-width> | inherit",page:1,"page-break-after":"auto | always | avoid | left | right | inherit","page-break-before":"auto | always | avoid | left | right | inherit","page-break-inside":"auto | avoid | inherit","page-policy":1,pause:1,"pause-after":1,"pause-before":1,perspective:1,"perspective-origin":1,phonemes:1,pitch:1,"pitch-range":1,"play-during":1,"pointer-events":"auto | none | visiblePainted | visibleFill | visibleStroke | visible | painted | fill | stroke | all | inherit",position:"static | relative | absolute | fixed | inherit","presentation-level":1,"punctuation-trim":1,quotes:1,"rendering-intent":1,resize:1,rest:1,"rest-after":1,"rest-before":1,richness:1,right:"<margin-width> | inherit",rotation:1,"rotation-point":1,"ruby-align":1,"ruby-overhang":1,"ruby-position":1,"ruby-span":1,size:1,speak:"normal | none | spell-out | inherit","speak-header":"once | always | inherit","speak-numeral":"digits | continuous | inherit","speak-punctuation":"code | none | inherit","speech-rate":1,src:1,stress:1,"string-set":1,"table-layout":"auto | fixed | inherit","tab-size":"<integer> | <length>",target:1,"target-name":1,"target-new":1,"target-position":1,"text-align":"left | right | center | justify | inherit","text-align-last":1,"text-decoration":1,"text-emphasis":1,"text-height":1,"text-indent":"<length> | <percentage> | inherit","text-justify":"auto | none | inter-word | inter-ideograph | inter-cluster | distribute | kashida","text-outline":1,"text-overflow":1,"text-rendering":"auto | optimizeSpeed | optimizeLegibility | geometricPrecision | inherit","text-shadow":1,"text-transform":"capitalize | uppercase | lowercase | none | inherit","text-wrap":"normal | none | avoid",top:"<margin-width> | inherit",transform:1,"transform-origin":1,"transform-style":1,transition:1,"transition-delay":1,"transition-duration":1,"transition-property":1,"transition-timing-function":1,"unicode-bidi":"normal | embed | bidi-override | inherit","user-modify":"read-only | read-write | write-only | inherit","user-select":"none | text | toggle | element | elements | all | inherit","vertical-align":"auto | use-script | baseline | sub | super | top | text-top | central | middle | bottom | text-bottom | <percentage> | <length>",visibility:"visible | hidden | collapse | inherit","voice-balance":1,"voice-duration":1,"voice-family":1,"voice-pitch":1,"voice-pitch-range":1,"voice-rate":1,"voice-stress":1,"voice-volume":1,volume:1,"white-space":"normal | pre | nowrap | pre-wrap | pre-line | inherit | -pre-wrap | -o-pre-wrap | -moz-pre-wrap | -hp-pre-wrap","white-space-collapse":1,widows:"<integer> | inherit",width:"<length> | <percentage> | auto | inherit","word-break":"normal | keep-all | break-all","word-spacing":"<length> | normal | inherit","word-wrap":1,"z-index":"<integer> | auto | inherit",zoom:"<number> | <percentage> | normal"};PropertyName.prototype=new SyntaxUnit,PropertyName.prototype.constructor=PropertyName,PropertyName.prototype.toString=function(){return(this.hack?this.hack:"")+this.text},PropertyValue.prototype=new SyntaxUnit,PropertyValue.prototype.constructor=PropertyValue,PropertyValueIterator.prototype.count=function(){return this._parts.length},PropertyValueIterator.prototype.isFirst=function(){return 0===this._i},PropertyValueIterator.prototype.hasNext=function(){return this._i<this._parts.length},PropertyValueIterator.prototype.mark=function(){this._marks.push(this._i)},PropertyValueIterator.prototype.peek=function(e){return this.hasNext()?this._parts[this._i+(e||0)]:null},PropertyValueIterator.prototype.next=function(){return this.hasNext()?this._parts[this._i++]:null},PropertyValueIterator.prototype.previous=function(){return this._i>0?this._parts[--this._i]:null},PropertyValueIterator.prototype.restore=function(){this._marks.length&&(this._i=this._marks.pop())},PropertyValuePart.prototype=new SyntaxUnit,PropertyValuePart.prototype.constructor=PropertyValuePart,PropertyValuePart.fromToken=function(e){return new PropertyValuePart(e.value,e.startLine,e.startCol)};var Pseudos={":first-letter":1,":first-line":1,":before":1,":after":1};Pseudos.ELEMENT=1,Pseudos.CLASS=2,Pseudos.isElement=function(e){return 0===e.indexOf("::")||Pseudos[e.toLowerCase()]==Pseudos.ELEMENT},Selector.prototype=new SyntaxUnit,Selector.prototype.constructor=Selector,SelectorPart.prototype=new SyntaxUnit,SelectorPart.prototype.constructor=SelectorPart,SelectorSubPart.prototype=new SyntaxUnit,SelectorSubPart.prototype.constructor=SelectorSubPart,Specificity.prototype={constructor:Specificity,compare:function(e){var t,r,n=["a","b","c","d"];for(t=0,r=n.length;r>t;t++){if(this[n[t]]<e[n[t]])return-1;if(this[n[t]]>e[n[t]])return 1}return 0},valueOf:function(){return 1e3*this.a+100*this.b+10*this.c+this.d},toString:function(){return this.a+","+this.b+","+this.c+","+this.d}},Specificity.calculate=function(e){function t(e){var r,n,i,l,u,d=e.elementName?e.elementName.text:"";for(d&&"*"!=d.charAt(d.length-1)&&s++,r=0,i=e.modifiers.length;i>r;r++)switch(u=e.modifiers[r],u.type){case"class":case"attribute":a++;break;case"id":o++;break;case"pseudo":Pseudos.isElement(u.text)?s++:a++;break;case"not":for(n=0,l=u.args.length;l>n;n++)t(u.args[n])}}var r,n,i,o=0,a=0,s=0;for(r=0,n=e.parts.length;n>r;r++)i=e.parts[r],i instanceof SelectorPart&&t(i);return new Specificity(0,o,a,s)};var h=/^[0-9a-fA-F]$/,nonascii=/^[\u0080-\uFFFF]$/,nl=/\n|\r\n|\r|\f/;TokenStream.prototype=mix(new TokenStreamBase,{_getToken:function(e){var t,r=this._reader,n=null,i=r.getLine(),o=r.getCol();for(t=r.read();t;){switch(t){case"/":n="*"==r.peek()?this.commentToken(t,i,o):this.charToken(t,i,o);break;case"|":case"~":case"^":case"$":case"*":n="="==r.peek()?this.comparisonToken(t,i,o):this.charToken(t,i,o);break;case'"':case"'":n=this.stringToken(t,i,o);break;case"#":n=isNameChar(r.peek())?this.hashToken(t,i,o):this.charToken(t,i,o);break;case".":n=isDigit(r.peek())?this.numberToken(t,i,o):this.charToken(t,i,o);break;case"-":n="-"==r.peek()?this.htmlCommentEndToken(t,i,o):isNameStart(r.peek())?this.identOrFunctionToken(t,i,o):this.charToken(t,i,o);break;case"!":n=this.importantToken(t,i,o);break;case"@":n=this.atRuleToken(t,i,o);break;case":":n=this.notToken(t,i,o);break;case"<":n=this.htmlCommentStartToken(t,i,o);break;case"U":case"u":if("+"==r.peek()){n=this.unicodeRangeToken(t,i,o);break}default:n=isDigit(t)?this.numberToken(t,i,o):isWhitespace(t)?this.whitespaceToken(t,i,o):isIdentStart(t)?this.identOrFunctionToken(t,i,o):this.charToken(t,i,o)}break}return n||null!==t||(n=this.createToken(Tokens.EOF,null,i,o)),n},createToken:function(e,t,r,n,i){var o=this._reader;return i=i||{},{value:t,type:e,channel:i.channel,hide:i.hide||!1,startLine:r,startCol:n,endLine:o.getLine(),endCol:o.getCol()}},atRuleToken:function(e,t,r){var n,i=e,o=this._reader,a=Tokens.CHAR;return o.mark(),n=this.readName(),i=e+n,a=Tokens.type(i.toLowerCase()),(a==Tokens.CHAR||a==Tokens.UNKNOWN)&&(i.length>1?a=Tokens.UNKNOWN_SYM:(a=Tokens.CHAR,i=e,o.reset())),this.createToken(a,i,t,r)},charToken:function(e,t,r){var n=Tokens.type(e);return-1==n&&(n=Tokens.CHAR),this.createToken(n,e,t,r)},commentToken:function(e,t,r){var n=(this._reader,this.readComment(e));return this.createToken(Tokens.COMMENT,n,t,r)},comparisonToken:function(e,t,r){var n=this._reader,i=e+n.read(),o=Tokens.type(i)||Tokens.CHAR;return this.createToken(o,i,t,r)},hashToken:function(e,t,r){var n=(this._reader,this.readName(e));return this.createToken(Tokens.HASH,n,t,r)},htmlCommentStartToken:function(e,t,r){var n=this._reader,i=e;return n.mark(),i+=n.readCount(3),"<!--"==i?this.createToken(Tokens.CDO,i,t,r):(n.reset(),this.charToken(e,t,r))},htmlCommentEndToken:function(e,t,r){var n=this._reader,i=e;return n.mark(),i+=n.readCount(2),"-->"==i?this.createToken(Tokens.CDC,i,t,r):(n.reset(),this.charToken(e,t,r))},identOrFunctionToken:function(e,t,r){var n=this._reader,i=this.readName(e),o=Tokens.IDENT;return"("==n.peek()?(i+=n.read(),"url("==i.toLowerCase()?(o=Tokens.URI,i=this.readURI(i),"url("==i.toLowerCase()&&(o=Tokens.FUNCTION)):o=Tokens.FUNCTION):":"==n.peek()&&"progid"==i.toLowerCase()&&(i+=n.readTo("("),o=Tokens.IE_FUNCTION),this.createToken(o,i,t,r)},importantToken:function(e,t,r){var n,i,o=this._reader,a=e,s=Tokens.CHAR;for(o.mark(),i=o.read();i;){if("/"==i){if("*"!=o.peek())break;if(n=this.readComment(i),""===n)break}else{if(!isWhitespace(i)){if(/i/i.test(i)){n=o.readCount(8),/mportant/i.test(n)&&(a+=i+n,s=Tokens.IMPORTANT_SYM);break}break}a+=i+this.readWhitespace()}i=o.read()}return s==Tokens.CHAR?(o.reset(),this.charToken(e,t,r)):this.createToken(s,a,t,r)},notToken:function(e,t,r){var n=this._reader,i=e;return n.mark(),i+=n.readCount(4),":not("==i.toLowerCase()?this.createToken(Tokens.NOT,i,t,r):(n.reset(),this.charToken(e,t,r))},numberToken:function(e,t,r){var n,i=this._reader,o=this.readNumber(e),a=Tokens.NUMBER,s=i.peek();return isIdentStart(s)?(n=this.readName(i.read()),o+=n,a=/^em$|^ex$|^px$|^gd$|^rem$|^vw$|^vh$|^vm$|^ch$|^cm$|^mm$|^in$|^pt$|^pc$/i.test(n)?Tokens.LENGTH:/^deg|^rad$|^grad$/i.test(n)?Tokens.ANGLE:/^ms$|^s$/i.test(n)?Tokens.TIME:/^hz$|^khz$/i.test(n)?Tokens.FREQ:/^dpi$|^dpcm$/i.test(n)?Tokens.RESOLUTION:Tokens.DIMENSION):"%"==s&&(o+=i.read(),a=Tokens.PERCENTAGE),this.createToken(a,o,t,r)},stringToken:function(e,t,r){for(var n=e,i=e,o=this._reader,a=e,s=Tokens.STRING,l=o.read();l&&(i+=l,l!=n||"\\"==a);){if(isNewLine(o.peek())&&"\\"!=l){s=Tokens.INVALID;break}a=l,l=o.read()}return null===l&&(s=Tokens.INVALID),this.createToken(s,i,t,r)},unicodeRangeToken:function(e,t,r){var n,i=this._reader,o=e,a=Tokens.CHAR;return"+"==i.peek()&&(i.mark(),o+=i.read(),o+=this.readUnicodeRangePart(!0),2==o.length?i.reset():(a=Tokens.UNICODE_RANGE,-1==o.indexOf("?")&&"-"==i.peek()&&(i.mark(),n=i.read(),n+=this.readUnicodeRangePart(!1),1==n.length?i.reset():o+=n))),this.createToken(a,o,t,r)},whitespaceToken:function(e,t,r){var n=(this._reader,e+this.readWhitespace());return this.createToken(Tokens.S,n,t,r)},readUnicodeRangePart:function(e){for(var t=this._reader,r="",n=t.peek();isHexDigit(n)&&r.length<6;)t.read(),r+=n,n=t.peek();if(e)for(;"?"==n&&r.length<6;)t.read(),r+=n,n=t.peek();return r},readWhitespace:function(){for(var e=this._reader,t="",r=e.peek();isWhitespace(r);)e.read(),t+=r,r=e.peek();return t},readNumber:function(e){for(var t=this._reader,r=e,n="."==e,i=t.peek();i;){if(isDigit(i))r+=t.read();else{if("."!=i)break;if(n)break;n=!0,r+=t.read()}i=t.peek()}return r},readString:function(){for(var e=this._reader,t=e.read(),r=t,n=t,i=e.peek();i&&(i=e.read(),r+=i,i!=t||"\\"==n);){if(isNewLine(e.peek())&&"\\"!=i){r="";break}n=i,i=e.peek()}return null===i&&(r=""),r},readURI:function(e){var t=this._reader,r=e,n="",i=t.peek();for(t.mark();i&&isWhitespace(i);)t.read(),i=t.peek();for(n="'"==i||'"'==i?this.readString():this.readURL(),i=t.peek();i&&isWhitespace(i);)t.read(),i=t.peek();return""===n||")"!=i?(r=e,t.reset()):r+=n+t.read(),r},readURL:function(){for(var e=this._reader,t="",r=e.peek();/^[!#$%&\\*-~]$/.test(r);)t+=e.read(),r=e.peek();return t},readName:function(e){for(var t=this._reader,r=e||"",n=t.peek();;)if("\\"==n)r+=this.readEscape(t.read()),n=t.peek();else{if(!n||!isNameChar(n))break;r+=t.read(),n=t.peek()}return r},readEscape:function(e){var t=this._reader,r=e||"",n=0,i=t.peek();if(isHexDigit(i))do r+=t.read(),i=t.peek();while(i&&isHexDigit(i)&&++n<6);return 3==r.length&&/\s/.test(i)||7==r.length||1==r.length?t.read():i="",r+i},readComment:function(e){var t=this._reader,r=e||"",n=t.read();if("*"==n){for(;n;){if(r+=n,r.length>2&&"*"==n&&"/"==t.peek()){r+=t.read();break}n=t.read()}return r}return""}});var Tokens=[{name:"CDO"},{name:"CDC"},{name:"S",whitespace:!0},{name:"COMMENT",comment:!0,hide:!0,channel:"comment"},{name:"INCLUDES",text:"~="},{name:"DASHMATCH",text:"|="},{name:"PREFIXMATCH",text:"^="},{name:"SUFFIXMATCH",text:"$="},{name:"SUBSTRINGMATCH",text:"*="},{name:"STRING"},{name:"IDENT"},{name:"HASH"},{name:"IMPORT_SYM",text:"@import"},{name:"PAGE_SYM",text:"@page"},{name:"MEDIA_SYM",text:"@media"},{name:"FONT_FACE_SYM",text:"@font-face"},{name:"CHARSET_SYM",text:"@charset"},{name:"NAMESPACE_SYM",text:"@namespace"},{name:"VIEWPORT_SYM",text:"@viewport"},{name:"UNKNOWN_SYM"},{name:"KEYFRAMES_SYM",text:["@keyframes","@-webkit-keyframes","@-moz-keyframes","@-o-keyframes"]},{name:"IMPORTANT_SYM"},{name:"LENGTH"},{name:"ANGLE"},{name:"TIME"},{name:"FREQ"},{name:"DIMENSION"},{name:"PERCENTAGE"},{name:"NUMBER"},{name:"URI"},{name:"FUNCTION"},{name:"UNICODE_RANGE"},{name:"INVALID"},{name:"PLUS",text:"+"},{name:"GREATER",text:">"},{name:"COMMA",text:","},{name:"TILDE",text:"~"},{name:"NOT"},{name:"TOPLEFTCORNER_SYM",text:"@top-left-corner"},{name:"TOPLEFT_SYM",text:"@top-left"},{name:"TOPCENTER_SYM",text:"@top-center"},{name:"TOPRIGHT_SYM",text:"@top-right"},{name:"TOPRIGHTCORNER_SYM",text:"@top-right-corner"},{name:"BOTTOMLEFTCORNER_SYM",text:"@bottom-left-corner"},{name:"BOTTOMLEFT_SYM",text:"@bottom-left"},{name:"BOTTOMCENTER_SYM",text:"@bottom-center"},{name:"BOTTOMRIGHT_SYM",text:"@bottom-right"},{name:"BOTTOMRIGHTCORNER_SYM",text:"@bottom-right-corner"},{name:"LEFTTOP_SYM",text:"@left-top"},{name:"LEFTMIDDLE_SYM",text:"@left-middle"},{name:"LEFTBOTTOM_SYM",text:"@left-bottom"},{name:"RIGHTTOP_SYM",text:"@right-top"},{name:"RIGHTMIDDLE_SYM",text:"@right-middle"},{name:"RIGHTBOTTOM_SYM",text:"@right-bottom"},{name:"RESOLUTION",state:"media"},{name:"IE_FUNCTION"},{name:"CHAR"},{name:"PIPE",text:"|"},{name:"SLASH",text:"/"},{name:"MINUS",text:"-"},{name:"STAR",text:"*"},{name:"LBRACE",text:"{"},{name:"RBRACE",text:"}"},{name:"LBRACKET",text:"["},{name:"RBRACKET",text:"]"},{name:"EQUALS",text:"="},{name:"COLON",text:":"},{name:"SEMICOLON",text:";"},{name:"LPAREN",text:"("},{name:"RPAREN",text:")"},{name:"DOT",text:"."}];!function(){var e=[],t={};Tokens.UNKNOWN=-1,Tokens.unshift({name:"EOF"});for(var r=0,n=Tokens.length;n>r;r++)if(e.push(Tokens[r].name),Tokens[Tokens[r].name]=r,Tokens[r].text)if(Tokens[r].text instanceof Array)for(var i=0;i<Tokens[r].text.length;i++)t[Tokens[r].text[i]]=r;else t[Tokens[r].text]=r;Tokens.name=function(t){return e[t]},Tokens.type=function(e){return t[e]||-1}}();var Validation={validate:function(e,t){var r=e.toString().toLowerCase(),n=(t.parts,new PropertyValueIterator(t)),i=Properties[r];if(i)"number"!=typeof i&&("string"==typeof i?i.indexOf("||")>-1?this.groupProperty(i,n):this.singleProperty(i,n,1):i.multi?this.multiProperty(i.multi,n,i.comma,i.max||1/0):"function"==typeof i&&i(n));else if(0!==r.indexOf("-"))throw new ValidationError("Unknown property '"+e+"'.",e.line,e.col)},singleProperty:function(e,t,r,n){for(var i,o=!1,a=t.value,s=0;t.hasNext()&&r>s&&(o=ValidationTypes.isAny(t,e));)s++;if(!o)throw t.hasNext()&&!t.isFirst()?(i=t.peek(),new ValidationError("Expected end of value but found '"+i+"'.",i.line,i.col)):new ValidationError("Expected ("+e+") but found '"+a+"'.",a.line,a.col);if(t.hasNext())throw i=t.next(),new ValidationError("Expected end of value but found '"+i+"'.",i.line,i.col)},multiProperty:function(e,t,r,n){for(var i,o=!1,a=t.value,s=0;t.hasNext()&&!o&&n>s&&ValidationTypes.isAny(t,e);)if(s++,t.hasNext()){if(r){if(","!=t.peek())break;i=t.next()}}else o=!0;if(!o)throw t.hasNext()&&!t.isFirst()?(i=t.peek(),new ValidationError("Expected end of value but found '"+i+"'.",i.line,i.col)):(i=t.previous(),r&&","==i?new ValidationError("Expected end of value but found '"+i+"'.",i.line,i.col):new ValidationError("Expected ("+e+") but found '"+a+"'.",a.line,a.col));if(t.hasNext())throw i=t.next(),new ValidationError("Expected end of value but found '"+i+"'.",i.line,i.col)},groupProperty:function(e,t,r){for(var n,i,o=!1,a=t.value,s=e.split("||").length,l={count:0},u=!1;t.hasNext()&&!o&&(n=ValidationTypes.isAnyOfGroup(t,e))&&!l[n];)l[n]=1,l.count++,u=!0,l.count!=s&&t.hasNext()||(o=!0);if(!o)throw u&&t.hasNext()?(i=t.peek(),new ValidationError("Expected end of value but found '"+i+"'.",i.line,i.col)):new ValidationError("Expected ("+e+") but found '"+a+"'.",a.line,a.col);if(t.hasNext())throw i=t.next(),new ValidationError("Expected end of value but found '"+i+"'.",i.line,i.col)}};ValidationError.prototype=new Error;var ValidationTypes={isLiteral:function(e,t){var r,n,i=e.text.toString().toLowerCase(),o=t.split(" | "),a=!1;for(r=0,n=o.length;n>r&&!a;r++)i==o[r].toLowerCase()&&(a=!0);return a},isSimple:function(e){return!!this.simple[e]},isComplex:function(e){return!!this.complex[e];
3
+ },isAny:function(e,t){var r,n,i=t.split(" | "),o=!1;for(r=0,n=i.length;n>r&&!o&&e.hasNext();r++)o=this.isType(e,i[r]);return o},isAnyOfGroup:function(e,t){var r,n,i=t.split(" || "),o=!1;for(r=0,n=i.length;n>r&&!o;r++)o=this.isType(e,i[r]);return o?i[r-1]:!1},isType:function(e,t){var r=e.peek(),n=!1;return"<"!=t.charAt(0)?(n=this.isLiteral(r,t),n&&e.next()):this.simple[t]?(n=this.simple[t](r),n&&e.next()):n=this.complex[t](e),n},simple:{"<absolute-size>":function(e){return ValidationTypes.isLiteral(e,"xx-small | x-small | small | medium | large | x-large | xx-large")},"<attachment>":function(e){return ValidationTypes.isLiteral(e,"scroll | fixed | local")},"<attr>":function(e){return"function"==e.type&&"attr"==e.name},"<bg-image>":function(e){return this["<image>"](e)||this["<gradient>"](e)||"none"==e},"<gradient>":function(e){return"function"==e.type&&/^(?:\-(?:ms|moz|o|webkit)\-)?(?:repeating\-)?(?:radial\-|linear\-)?gradient/i.test(e)},"<box>":function(e){return ValidationTypes.isLiteral(e,"padding-box | border-box | content-box")},"<content>":function(e){return"function"==e.type&&"content"==e.name},"<relative-size>":function(e){return ValidationTypes.isLiteral(e,"smaller | larger")},"<ident>":function(e){return"identifier"==e.type},"<length>":function(e){return"function"==e.type&&/^(?:\-(?:ms|moz|o|webkit)\-)?calc/i.test(e)?!0:"length"==e.type||"number"==e.type||"integer"==e.type||"0"==e},"<color>":function(e){return"color"==e.type||"transparent"==e},"<number>":function(e){return"number"==e.type||this["<integer>"](e)},"<integer>":function(e){return"integer"==e.type},"<line>":function(e){return"integer"==e.type},"<angle>":function(e){return"angle"==e.type},"<uri>":function(e){return"uri"==e.type},"<image>":function(e){return this["<uri>"](e)},"<percentage>":function(e){return"percentage"==e.type||"0"==e},"<border-width>":function(e){return this["<length>"](e)||ValidationTypes.isLiteral(e,"thin | medium | thick")},"<border-style>":function(e){return ValidationTypes.isLiteral(e,"none | hidden | dotted | dashed | solid | double | groove | ridge | inset | outset")},"<margin-width>":function(e){return this["<length>"](e)||this["<percentage>"](e)||ValidationTypes.isLiteral(e,"auto")},"<padding-width>":function(e){return this["<length>"](e)||this["<percentage>"](e)},"<shape>":function(e){return"function"==e.type&&("rect"==e.name||"inset-rect"==e.name)},"<time>":function(e){return"time"==e.type}},complex:{"<bg-position>":function(e){for(var t=!1,r="<percentage> | <length>",n="left | right",i="top | bottom",o=0;e.peek(o)&&","!=e.peek(o);)o++;return 3>o?ValidationTypes.isAny(e,n+" | center | "+r)?(t=!0,ValidationTypes.isAny(e,i+" | center | "+r)):ValidationTypes.isAny(e,i)&&(t=!0,ValidationTypes.isAny(e,n+" | center")):ValidationTypes.isAny(e,n)?ValidationTypes.isAny(e,i)?(t=!0,ValidationTypes.isAny(e,r)):ValidationTypes.isAny(e,r)&&(ValidationTypes.isAny(e,i)?(t=!0,ValidationTypes.isAny(e,r)):ValidationTypes.isAny(e,"center")&&(t=!0)):ValidationTypes.isAny(e,i)?ValidationTypes.isAny(e,n)?(t=!0,ValidationTypes.isAny(e,r)):ValidationTypes.isAny(e,r)&&(ValidationTypes.isAny(e,n)?(t=!0,ValidationTypes.isAny(e,r)):ValidationTypes.isAny(e,"center")&&(t=!0)):ValidationTypes.isAny(e,"center")&&ValidationTypes.isAny(e,n+" | "+i)&&(t=!0,ValidationTypes.isAny(e,r)),t},"<bg-size>":function(e){var t=!1,r="<percentage> | <length> | auto";return ValidationTypes.isAny(e,"cover | contain")?t=!0:ValidationTypes.isAny(e,r)&&(t=!0,ValidationTypes.isAny(e,r)),t},"<repeat-style>":function(e){var t,r=!1,n="repeat | space | round | no-repeat";return e.hasNext()&&(t=e.next(),ValidationTypes.isLiteral(t,"repeat-x | repeat-y")?r=!0:ValidationTypes.isLiteral(t,n)&&(r=!0,e.hasNext()&&ValidationTypes.isLiteral(e.peek(),n)&&e.next())),r},"<shadow>":function(e){var t=!1,r=0,n=!1,i=!1;if(e.hasNext()){for(ValidationTypes.isAny(e,"inset")&&(n=!0),ValidationTypes.isAny(e,"<color>")&&(i=!0);ValidationTypes.isAny(e,"<length>")&&4>r;)r++;e.hasNext()&&(i||ValidationTypes.isAny(e,"<color>"),n||ValidationTypes.isAny(e,"inset")),t=r>=2&&4>=r}return t},"<x-one-radius>":function(e){var t=!1,r="<length> | <percentage> | inherit";return ValidationTypes.isAny(e,r)&&(t=!0,ValidationTypes.isAny(e,r)),t}}};parserlib.css={Colors:Colors,Combinator:Combinator,Parser:Parser,PropertyName:PropertyName,PropertyValue:PropertyValue,PropertyValuePart:PropertyValuePart,MediaFeature:MediaFeature,MediaQuery:MediaQuery,Selector:Selector,SelectorPart:SelectorPart,SelectorSubPart:SelectorSubPart,Specificity:Specificity,TokenStream:TokenStream,Tokens:Tokens,ValidationError:ValidationError}}(),function(){for(var e in parserlib)exports[e]=parserlib[e]}();var CSSLint=function(){function e(e,t){var r,i=e&&e.match(n),o=i&&i[1];return o&&(r={"true":2,"":1,"false":0,2:2,1:1,0:0},o.toLowerCase().split(",").forEach(function(e){var n=e.split(":"),i=n[0]||"",o=n[1]||"";t[i.trim()]=r[o.trim()]})),t}var t=[],r=[],n=/\/\*csslint([^\*]*)\*\//,i=new parserlib.util.EventTarget;return i.version="0.10.0",i.addRule=function(e){t.push(e),t[e.id]=e},i.clearRules=function(){t=[]},i.getRules=function(){return[].concat(t).sort(function(e,t){return e.id>t.id?1:0})},i.getRuleset=function(){for(var e={},r=0,n=t.length;n>r;)e[t[r++].id]=1;return e},i.addFormatter=function(e){r[e.id]=e},i.getFormatter=function(e){return r[e]},i.format=function(e,t,r,n){var i=this.getFormatter(r),o=null;return i&&(o=i.startFormat(),o+=i.formatResults(e,t,n||{}),o+=i.endFormat()),o},i.hasFormat=function(e){return r.hasOwnProperty(e)},i.verify=function(r,i){var o,a,s,l=0,u=(t.length,new parserlib.css.Parser({starHack:!0,ieFilters:!0,underscoreHack:!0,strict:!1}));a=r.replace(/\n\r?/g,"$split$").split("$split$"),i||(i=this.getRuleset()),n.test(r)&&(i=e(r,i)),o=new Reporter(a,i),i.errors=2;for(l in i)i.hasOwnProperty(l)&&i[l]&&t[l]&&t[l].init(u,o);try{u.parse(r)}catch(d){o.error("Fatal error, cannot continue: "+d.message,d.line,d.col,{})}return s={messages:o.messages,stats:o.stats,ruleset:o.ruleset},s.messages.sort(function(e,t){return e.rollup&&!t.rollup?1:!e.rollup&&t.rollup?-1:e.line-t.line}),s},i}();return Reporter.prototype={constructor:Reporter,error:function(e,t,r,n){this.messages.push({type:"error",line:t,col:r,message:e,evidence:this.lines[t-1],rule:n||{}})},warn:function(e,t,r,n){this.report(e,t,r,n)},report:function(e,t,r,n){this.messages.push({type:2==this.ruleset[n.id]?"error":"warning",line:t,col:r,message:e,evidence:this.lines[t-1],rule:n})},info:function(e,t,r,n){this.messages.push({type:"info",line:t,col:r,message:e,evidence:this.lines[t-1],rule:n})},rollupError:function(e,t){this.messages.push({type:"error",rollup:!0,message:e,rule:t})},rollupWarn:function(e,t){this.messages.push({type:"warning",rollup:!0,message:e,rule:t})},stat:function(e,t){this.stats[e]=t}},CSSLint._Reporter=Reporter,CSSLint.Util={mix:function(e,t){var r;for(r in t)t.hasOwnProperty(r)&&(e[r]=t[r]);return r},indexOf:function(e,t){if(e.indexOf)return e.indexOf(t);for(var r=0,n=e.length;n>r;r++)if(e[r]===t)return r;return-1},forEach:function(e,t){if(e.forEach)return e.forEach(t);for(var r=0,n=e.length;n>r;r++)t(e[r],r,e)}},CSSLint.addRule({id:"adjoining-classes",name:"Disallow adjoining classes",desc:"Don't use adjoining classes.",browsers:"IE6",init:function(e,t){var r=this;e.addListener("startrule",function(n){var i,o,a,s,l,u,d,c=n.selectors;for(l=0;l<c.length;l++)for(i=c[l],u=0;u<i.parts.length;u++)if(o=i.parts[u],o.type==e.SELECTOR_PART_TYPE)for(s=0,d=0;d<o.modifiers.length;d++)a=o.modifiers[d],"class"==a.type&&s++,s>1&&t.report("Don't use adjoining classes.",o.line,o.col,r)})}}),CSSLint.addRule({id:"box-model",name:"Beware of broken box size",desc:"Don't use width or height when using padding or border.",browsers:"All",init:function(e,t){function r(){i={},l=!1}function n(){var e,r;if(!l){if(i.height)for(e in s)s.hasOwnProperty(e)&&i[e]&&(r=i[e].value,("padding"!=e||2!==r.parts.length||0!==r.parts[0].value)&&t.report("Using height with "+e+" can sometimes make elements larger than you expect.",i[e].line,i[e].col,o));if(i.width)for(e in a)a.hasOwnProperty(e)&&i[e]&&(r=i[e].value,("padding"!=e||2!==r.parts.length||0!==r.parts[1].value)&&t.report("Using width with "+e+" can sometimes make elements larger than you expect.",i[e].line,i[e].col,o))}}var i,o=this,a={border:1,"border-left":1,"border-right":1,padding:1,"padding-left":1,"padding-right":1},s={border:1,"border-bottom":1,"border-top":1,padding:1,"padding-bottom":1,"padding-top":1},l=!1;e.addListener("startrule",r),e.addListener("startfontface",r),e.addListener("startpage",r),e.addListener("startpagemargin",r),e.addListener("startkeyframerule",r),e.addListener("property",function(e){var t=e.property.text.toLowerCase();s[t]||a[t]?/^0\S*$/.test(e.value)||"border"==t&&"none"==e.value||(i[t]={line:e.property.line,col:e.property.col,value:e.value}):/^(width|height)/i.test(t)&&/^(length|percentage)/.test(e.value.parts[0].type)?i[t]=1:"box-sizing"==t&&(l=!0)}),e.addListener("endrule",n),e.addListener("endfontface",n),e.addListener("endpage",n),e.addListener("endpagemargin",n),e.addListener("endkeyframerule",n)}}),CSSLint.addRule({id:"box-sizing",name:"Disallow use of box-sizing",desc:"The box-sizing properties isn't supported in IE6 and IE7.",browsers:"IE6, IE7",tags:["Compatibility"],init:function(e,t){var r=this;e.addListener("property",function(e){var n=e.property.text.toLowerCase();"box-sizing"==n&&t.report("The box-sizing property isn't supported in IE6 and IE7.",e.line,e.col,r)})}}),CSSLint.addRule({id:"bulletproof-font-face",name:"Use the bulletproof @font-face syntax",desc:"Use the bulletproof @font-face syntax to avoid 404's in old IE (http://www.fontspring.com/blog/the-new-bulletproof-font-face-syntax).",browsers:"All",init:function(e,t){var r,n,i=this,o=!1,a=!0,s=!1;e.addListener("startfontface",function(e){o=!0}),e.addListener("property",function(e){if(o){var t=e.property.toString().toLowerCase(),i=e.value.toString();if(r=e.line,n=e.col,"src"===t){var l=/^\s?url\(['"].+\.eot\?.*['"]\)\s*format\(['"]embedded-opentype['"]\).*$/i;!i.match(l)&&a?(s=!0,a=!1):i.match(l)&&!a&&(s=!1)}}}),e.addListener("endfontface",function(e){o=!1,s&&t.report("@font-face declaration doesn't follow the fontspring bulletproof syntax.",r,n,i)})}}),CSSLint.addRule({id:"compatible-vendor-prefixes",name:"Require compatible vendor prefixes",desc:"Include all compatible vendor prefixes to reach a wider range of users.",browsers:"All",init:function(e,t){var r,n,i,o,a,s,l,u=this,d=!1,c=Array.prototype.push,h=[];r={animation:"webkit moz","animation-delay":"webkit moz","animation-direction":"webkit moz","animation-duration":"webkit moz","animation-fill-mode":"webkit moz","animation-iteration-count":"webkit moz","animation-name":"webkit moz","animation-play-state":"webkit moz","animation-timing-function":"webkit moz",appearance:"webkit moz","border-end":"webkit moz","border-end-color":"webkit moz","border-end-style":"webkit moz","border-end-width":"webkit moz","border-image":"webkit moz o","border-radius":"webkit","border-start":"webkit moz","border-start-color":"webkit moz","border-start-style":"webkit moz","border-start-width":"webkit moz","box-align":"webkit moz ms","box-direction":"webkit moz ms","box-flex":"webkit moz ms","box-lines":"webkit ms","box-ordinal-group":"webkit moz ms","box-orient":"webkit moz ms","box-pack":"webkit moz ms","box-sizing":"webkit moz","box-shadow":"webkit moz","column-count":"webkit moz ms","column-gap":"webkit moz ms","column-rule":"webkit moz ms","column-rule-color":"webkit moz ms","column-rule-style":"webkit moz ms","column-rule-width":"webkit moz ms","column-width":"webkit moz ms",hyphens:"epub moz","line-break":"webkit ms","margin-end":"webkit moz","margin-start":"webkit moz","marquee-speed":"webkit wap","marquee-style":"webkit wap","padding-end":"webkit moz","padding-start":"webkit moz","tab-size":"moz o","text-size-adjust":"webkit ms",transform:"webkit moz ms o","transform-origin":"webkit moz ms o",transition:"webkit moz o","transition-delay":"webkit moz o","transition-duration":"webkit moz o","transition-property":"webkit moz o","transition-timing-function":"webkit moz o","user-modify":"webkit moz","user-select":"webkit moz ms","word-break":"epub ms","writing-mode":"epub ms"};for(i in r)if(r.hasOwnProperty(i)){for(o=[],a=r[i].split(" "),s=0,l=a.length;l>s;s++)o.push("-"+a[s]+"-"+i);r[i]=o,c.apply(h,o)}e.addListener("startrule",function(){n=[]}),e.addListener("startkeyframes",function(e){d=e.prefix||!0}),e.addListener("endkeyframes",function(e){d=!1}),e.addListener("property",function(e){var t=e.property;CSSLint.Util.indexOf(h,t.text)>-1&&(d&&"string"==typeof d&&0===t.text.indexOf("-"+d+"-")||n.push(t))}),e.addListener("endrule",function(e){if(n.length){var i,o,a,s,l,d,c,h,p,m,f={};for(i=0,o=n.length;o>i;i++){a=n[i];for(s in r)r.hasOwnProperty(s)&&(l=r[s],CSSLint.Util.indexOf(l,a.text)>-1&&(f[s]||(f[s]={full:l.slice(0),actual:[],actualNodes:[]}),-1===CSSLint.Util.indexOf(f[s].actual,a.text)&&(f[s].actual.push(a.text),f[s].actualNodes.push(a))))}for(s in f)if(f.hasOwnProperty(s)&&(d=f[s],c=d.full,h=d.actual,c.length>h.length))for(i=0,o=c.length;o>i;i++)p=c[i],-1===CSSLint.Util.indexOf(h,p)&&(m=1===h.length?h[0]:2==h.length?h.join(" and "):h.join(", "),t.report("The property "+p+" is compatible with "+m+" and should be included as well.",d.actualNodes[0].line,d.actualNodes[0].col,u))}})}}),CSSLint.addRule({id:"display-property-grouping",name:"Require properties appropriate for display",desc:"Certain properties shouldn't be used with certain display property values.",browsers:"All",init:function(e,t){function r(e,r,n){o[e]&&("string"!=typeof s[e]||o[e].value.toLowerCase()!=s[e])&&t.report(n||e+" can't be used with display: "+r+".",o[e].line,o[e].col,a)}function n(){o={}}function i(){var e=o.display?o.display.value:null;if(e)switch(e){case"inline":r("height",e),r("width",e),r("margin",e),r("margin-top",e),r("margin-bottom",e),r("float",e,"display:inline has no effect on floated elements (but may be used to fix the IE6 double-margin bug).");break;case"block":r("vertical-align",e);break;case"inline-block":r("float",e);break;default:0===e.indexOf("table-")&&(r("margin",e),r("margin-left",e),r("margin-right",e),r("margin-top",e),r("margin-bottom",e),r("float",e))}}var o,a=this,s={display:1,"float":"none",height:1,width:1,margin:1,"margin-left":1,"margin-right":1,"margin-bottom":1,"margin-top":1,padding:1,"padding-left":1,"padding-right":1,"padding-bottom":1,"padding-top":1,"vertical-align":1};e.addListener("startrule",n),e.addListener("startfontface",n),e.addListener("startkeyframerule",n),e.addListener("startpagemargin",n),e.addListener("startpage",n),e.addListener("property",function(e){var t=e.property.text.toLowerCase();s[t]&&(o[t]={value:e.value.text,line:e.property.line,col:e.property.col})}),e.addListener("endrule",i),e.addListener("endfontface",i),e.addListener("endkeyframerule",i),e.addListener("endpagemargin",i),e.addListener("endpage",i)}}),CSSLint.addRule({id:"duplicate-background-images",name:"Disallow duplicate background images",desc:"Every background-image should be unique. Use a common class for e.g. sprites.",browsers:"All",init:function(e,t){var r=this,n={};e.addListener("property",function(e){var i,o,a=e.property.text,s=e.value;if(a.match(/background/i))for(i=0,o=s.parts.length;o>i;i++)"uri"==s.parts[i].type&&("undefined"==typeof n[s.parts[i].uri]?n[s.parts[i].uri]=e:t.report("Background image '"+s.parts[i].uri+"' was used multiple times, first declared at line "+n[s.parts[i].uri].line+", col "+n[s.parts[i].uri].col+".",e.line,e.col,r))})}}),CSSLint.addRule({id:"duplicate-properties",name:"Disallow duplicate properties",desc:"Duplicate properties must appear one after the other.",browsers:"All",init:function(e,t){function r(e){n={}}var n,i,o=this;e.addListener("startrule",r),e.addListener("startfontface",r),e.addListener("startpage",r),e.addListener("startpagemargin",r),e.addListener("startkeyframerule",r),e.addListener("property",function(e){var r=e.property,a=r.text.toLowerCase();!n[a]||i==a&&n[a]!=e.value.text||t.report("Duplicate property '"+e.property+"' found.",e.line,e.col,o),n[a]=e.value.text,i=a})}}),CSSLint.addRule({id:"empty-rules",name:"Disallow empty rules",desc:"Rules without any properties specified should be removed.",browsers:"All",init:function(e,t){var r=this,n=0;e.addListener("startrule",function(){n=0}),e.addListener("property",function(){n++}),e.addListener("endrule",function(e){var i=e.selectors;0===n&&t.report("Rule is empty.",i[0].line,i[0].col,r)})}}),CSSLint.addRule({id:"errors",name:"Parsing Errors",desc:"This rule looks for recoverable syntax errors.",browsers:"All",init:function(e,t){var r=this;e.addListener("error",function(e){t.error(e.message,e.line,e.col,r)})}}),CSSLint.addRule({id:"fallback-colors",name:"Require fallback colors",desc:"For older browsers that don't support RGBA, HSL, or HSLA, provide a fallback color.",browsers:"IE6,IE7,IE8",init:function(e,t){function r(e){i={},n=null}var n,i,o=this,a={color:1,background:1,"border-color":1,"border-top-color":1,"border-right-color":1,"border-bottom-color":1,"border-left-color":1,border:1,"border-top":1,"border-right":1,"border-bottom":1,"border-left":1,"background-color":1};e.addListener("startrule",r),e.addListener("startfontface",r),e.addListener("startpage",r),e.addListener("startpagemargin",r),e.addListener("startkeyframerule",r),e.addListener("property",function(e){var r=e.property,i=r.text.toLowerCase(),s=e.value.parts,l=0,u="",d=s.length;if(a[i])for(;d>l;)"color"==s[l].type&&("alpha"in s[l]||"hue"in s[l]?(/([^\)]+)\(/.test(s[l])&&(u=RegExp.$1.toUpperCase()),n&&n.property.text.toLowerCase()==i&&"compat"==n.colorType||t.report("Fallback "+i+" (hex or RGB) should precede "+u+" "+i+".",e.line,e.col,o)):e.colorType="compat"),l++;n=e})}}),CSSLint.addRule({id:"floats",name:"Disallow too many floats",desc:"This rule tests if the float property is used too many times",browsers:"All",init:function(e,t){var r=this,n=0;e.addListener("property",function(e){"float"==e.property.text.toLowerCase()&&"none"!=e.value.text.toLowerCase()&&n++}),e.addListener("endstylesheet",function(){t.stat("floats",n),n>=10&&t.rollupWarn("Too many floats ("+n+"), you're probably using them for layout. Consider using a grid system instead.",r)})}}),CSSLint.addRule({id:"font-faces",name:"Don't use too many web fonts",desc:"Too many different web fonts in the same stylesheet.",browsers:"All",init:function(e,t){var r=this,n=0;e.addListener("startfontface",function(){n++}),e.addListener("endstylesheet",function(){n>5&&t.rollupWarn("Too many @font-face declarations ("+n+").",r)})}}),CSSLint.addRule({id:"font-sizes",name:"Disallow too many font sizes",desc:"Checks the number of font-size declarations.",browsers:"All",init:function(e,t){var r=this,n=0;e.addListener("property",function(e){"font-size"==e.property&&n++}),e.addListener("endstylesheet",function(){t.stat("font-sizes",n),n>=10&&t.rollupWarn("Too many font-size declarations ("+n+"), abstraction needed.",r)})}}),CSSLint.addRule({id:"gradients",name:"Require all gradient definitions",desc:"When using a vendor-prefixed gradient, make sure to use them all.",browsers:"All",init:function(e,t){var r,n=this;e.addListener("startrule",function(){r={moz:0,webkit:0,oldWebkit:0,o:0}}),e.addListener("property",function(e){/\-(moz|o|webkit)(?:\-(?:linear|radial))\-gradient/i.test(e.value)?r[RegExp.$1]=1:/\-webkit\-gradient/i.test(e.value)&&(r.oldWebkit=1)}),e.addListener("endrule",function(e){var i=[];r.moz||i.push("Firefox 3.6+"),r.webkit||i.push("Webkit (Safari 5+, Chrome)"),r.oldWebkit||i.push("Old Webkit (Safari 4+, Chrome)"),r.o||i.push("Opera 11.1+"),i.length&&i.length<4&&t.report("Missing vendor-prefixed CSS gradients for "+i.join(", ")+".",e.selectors[0].line,e.selectors[0].col,n)})}}),CSSLint.addRule({id:"ids",name:"Disallow IDs in selectors",desc:"Selectors should not contain IDs.",browsers:"All",init:function(e,t){var r=this;e.addListener("startrule",function(n){var i,o,a,s,l,u,d,c=n.selectors;for(l=0;l<c.length;l++){for(i=c[l],s=0,u=0;u<i.parts.length;u++)if(o=i.parts[u],o.type==e.SELECTOR_PART_TYPE)for(d=0;d<o.modifiers.length;d++)a=o.modifiers[d],"id"==a.type&&s++;1==s?t.report("Don't use IDs in selectors.",i.line,i.col,r):s>1&&t.report(s+" IDs in the selector, really?",i.line,i.col,r)}})}}),CSSLint.addRule({id:"import",name:"Disallow @import",desc:"Don't use @import, use <link> instead.",browsers:"All",init:function(e,t){var r=this;e.addListener("import",function(e){t.report("@import prevents parallel downloads, use <link> instead.",e.line,e.col,r)})}}),CSSLint.addRule({id:"important",name:"Disallow !important",desc:"Be careful when using !important declaration",browsers:"All",init:function(e,t){var r=this,n=0;e.addListener("property",function(e){e.important===!0&&(n++,t.report("Use of !important",e.line,e.col,r))}),e.addListener("endstylesheet",function(){t.stat("important",n),n>=10&&t.rollupWarn("Too many !important declarations ("+n+"), try to use less than 10 to avoid specificity issues.",r)})}}),CSSLint.addRule({id:"known-properties",name:"Require use of known properties",desc:"Properties should be known (listed in CSS3 specification) or be a vendor-prefixed property.",browsers:"All",init:function(e,t){var r=this;e.addListener("property",function(e){e.property.text.toLowerCase();e.invalid&&t.report(e.invalid.message,e.line,e.col,r)})}}),CSSLint.addRule({id:"outline-none",name:"Disallow outline: none",desc:"Use of outline: none or outline: 0 should be limited to :focus rules.",browsers:"All",tags:["Accessibility"],init:function(e,t){function r(e){i=e.selectors?{line:e.line,col:e.col,selectors:e.selectors,propCount:0,outline:!1}:null}function n(e){i&&i.outline&&(-1==i.selectors.toString().toLowerCase().indexOf(":focus")?t.report("Outlines should only be modified using :focus.",i.line,i.col,o):1==i.propCount&&t.report("Outlines shouldn't be hidden unless other visual changes are made.",i.line,i.col,o))}var i,o=this;e.addListener("startrule",r),e.addListener("startfontface",r),e.addListener("startpage",r),e.addListener("startpagemargin",r),e.addListener("startkeyframerule",r),e.addListener("property",function(e){var t=e.property.text.toLowerCase(),r=e.value;i&&(i.propCount++,"outline"!=t||"none"!=r&&"0"!=r||(i.outline=!0))}),e.addListener("endrule",n),e.addListener("endfontface",n),e.addListener("endpage",n),e.addListener("endpagemargin",n),e.addListener("endkeyframerule",n)}}),CSSLint.addRule({id:"overqualified-elements",name:"Disallow overqualified elements",desc:"Don't use classes or IDs with elements (a.foo or a#foo).",browsers:"All",init:function(e,t){var r=this,n={};e.addListener("startrule",function(i){var o,a,s,l,u,d,c=i.selectors;for(l=0;l<c.length;l++)for(o=c[l],u=0;u<o.parts.length;u++)if(a=o.parts[u],a.type==e.SELECTOR_PART_TYPE)for(d=0;d<a.modifiers.length;d++)s=a.modifiers[d],a.elementName&&"id"==s.type?t.report("Element ("+a+") is overqualified, just use "+s+" without element name.",a.line,a.col,r):"class"==s.type&&(n[s]||(n[s]=[]),n[s].push({modifier:s,part:a}))}),e.addListener("endstylesheet",function(){var e;for(e in n)n.hasOwnProperty(e)&&1==n[e].length&&n[e][0].part.elementName&&t.report("Element ("+n[e][0].part+") is overqualified, just use "+n[e][0].modifier+" without element name.",n[e][0].part.line,n[e][0].part.col,r)})}}),CSSLint.addRule({id:"qualified-headings",name:"Disallow qualified headings",desc:"Headings should not be qualified (namespaced).",browsers:"All",init:function(e,t){var r=this;e.addListener("startrule",function(n){var i,o,a,s,l=n.selectors;for(a=0;a<l.length;a++)for(i=l[a],s=0;s<i.parts.length;s++)o=i.parts[s],o.type==e.SELECTOR_PART_TYPE&&o.elementName&&/h[1-6]/.test(o.elementName.toString())&&s>0&&t.report("Heading ("+o.elementName+") should not be qualified.",o.line,o.col,r)})}}),CSSLint.addRule({id:"regex-selectors",name:"Disallow selectors that look like regexs",desc:"Selectors that look like regular expressions are slow and should be avoided.",browsers:"All",init:function(e,t){var r=this;e.addListener("startrule",function(n){var i,o,a,s,l,u,d=n.selectors;for(s=0;s<d.length;s++)for(i=d[s],l=0;l<i.parts.length;l++)if(o=i.parts[l],o.type==e.SELECTOR_PART_TYPE)for(u=0;u<o.modifiers.length;u++)a=o.modifiers[u],"attribute"==a.type&&/([\~\|\^\$\*]=)/.test(a)&&t.report("Attribute selectors with "+RegExp.$1+" are slow!",a.line,a.col,r)})}}),CSSLint.addRule({id:"rules-count",name:"Rules Count",desc:"Track how many rules there are.",browsers:"All",init:function(e,t){var r=0;e.addListener("startrule",function(){r++}),e.addListener("endstylesheet",function(){t.stat("rule-count",r)})}}),CSSLint.addRule({id:"selector-max-approaching",name:"Warn when approaching the 4095 selector limit for IE",desc:"Will warn when selector count is >= 3800 selectors.",browsers:"IE",init:function(e,t){var r=this,n=0;e.addListener("startrule",function(e){n+=e.selectors.length}),e.addListener("endstylesheet",function(){n>=3800&&t.report("You have "+n+" selectors. Internet Explorer supports a maximum of 4095 selectors per stylesheet. Consider refactoring.",0,0,r)})}}),CSSLint.addRule({id:"selector-max",name:"Error when past the 4095 selector limit for IE",desc:"Will error when selector count is > 4095.",browsers:"IE",init:function(e,t){var r=this,n=0;e.addListener("startrule",function(e){n+=e.selectors.length}),e.addListener("endstylesheet",function(){n>4095&&t.report("You have "+n+" selectors. Internet Explorer supports a maximum of 4095 selectors per stylesheet. Consider refactoring.",0,0,r)})}}),CSSLint.addRule({id:"shorthand",name:"Require shorthand properties",desc:"Use shorthand properties where possible.",browsers:"All",init:function(e,t){function r(e){s={}}function n(e){var r,n,i,o;for(r in d)if(d.hasOwnProperty(r)){for(o=0,n=0,i=d[r].length;i>n;n++)o+=s[d[r][n]]?1:0;o==d[r].length&&t.report("The properties "+d[r].join(", ")+" can be replaced by "+r+".",e.line,e.col,l)}}var i,o,a,s,l=this,u={},d={margin:["margin-top","margin-bottom","margin-left","margin-right"],padding:["padding-top","padding-bottom","padding-left","padding-right"]};for(i in d)if(d.hasOwnProperty(i))for(o=0,a=d[i].length;a>o;o++)u[d[i][o]]=i;e.addListener("startrule",r),e.addListener("startfontface",r),e.addListener("property",function(e){var t=e.property.toString().toLowerCase();e.value.parts[0].value;u[t]&&(s[t]=1)}),e.addListener("endrule",n),e.addListener("endfontface",n)}}),CSSLint.addRule({id:"star-property-hack",name:"Disallow properties with a star prefix",desc:"Checks for the star property hack (targets IE6/7)",browsers:"All",init:function(e,t){var r=this;e.addListener("property",function(e){var n=e.property;"*"==n.hack&&t.report("Property with star prefix found.",e.property.line,e.property.col,r)})}}),CSSLint.addRule({id:"text-indent",name:"Disallow negative text-indent",desc:"Checks for text indent less than -99px",browsers:"All",init:function(e,t){function r(e){i=!1,o="inherit"}function n(e){i&&"ltr"!=o&&t.report("Negative text-indent doesn't work well with RTL. If you use text-indent for image replacement explicitly set direction for that item to ltr.",i.line,i.col,a)}var i,o,a=this;e.addListener("startrule",r),e.addListener("startfontface",r),e.addListener("property",function(e){var t=e.property.toString().toLowerCase(),r=e.value;"text-indent"==t&&r.parts[0].value<-99?i=e.property:"direction"==t&&"ltr"==r&&(o="ltr")}),e.addListener("endrule",n),e.addListener("endfontface",n)}}),CSSLint.addRule({id:"underscore-property-hack",name:"Disallow properties with an underscore prefix",desc:"Checks for the underscore property hack (targets IE6)",browsers:"All",init:function(e,t){var r=this;e.addListener("property",function(e){var n=e.property;"_"==n.hack&&t.report("Property with underscore prefix found.",e.property.line,e.property.col,r)})}}),CSSLint.addRule({id:"unique-headings",name:"Headings should only be defined once",desc:"Headings should be defined only once.",browsers:"All",init:function(e,t){var r=this,n={h1:0,h2:0,h3:0,h4:0,h5:0,h6:0};e.addListener("startrule",function(e){var i,o,a,s,l,u=e.selectors;for(s=0;s<u.length;s++)if(i=u[s],o=i.parts[i.parts.length-1],o.elementName&&/(h[1-6])/i.test(o.elementName.toString())){for(l=0;l<o.modifiers.length;l++)if("pseudo"==o.modifiers[l].type){a=!0;break}a||(n[RegExp.$1]++,n[RegExp.$1]>1&&t.report("Heading ("+o.elementName+") has already been defined.",o.line,o.col,r))}}),e.addListener("endstylesheet",function(e){var i,o=[];for(i in n)n.hasOwnProperty(i)&&n[i]>1&&o.push(n[i]+" "+i+"s");o.length&&t.rollupWarn("You have "+o.join(", ")+" defined in this stylesheet.",r)})}}),CSSLint.addRule({id:"universal-selector",name:"Disallow universal selector",desc:"The universal selector (*) is known to be slow.",browsers:"All",init:function(e,t){var r=this;e.addListener("startrule",function(e){var n,i,o,a=e.selectors;for(o=0;o<a.length;o++)n=a[o],i=n.parts[n.parts.length-1],"*"==i.elementName&&t.report(r.desc,i.line,i.col,r)})}}),CSSLint.addRule({id:"unqualified-attributes",name:"Disallow unqualified attribute selectors",desc:"Unqualified attribute selectors are known to be slow.",browsers:"All",init:function(e,t){var r=this;e.addListener("startrule",function(n){var i,o,a,s,l,u=n.selectors;for(s=0;s<u.length;s++)if(i=u[s],o=i.parts[i.parts.length-1],o.type==e.SELECTOR_PART_TYPE)for(l=0;l<o.modifiers.length;l++)a=o.modifiers[l],"attribute"!=a.type||o.elementName&&"*"!=o.elementName||t.report(r.desc,o.line,o.col,r)})}}),CSSLint.addRule({id:"vendor-prefix",name:"Require standard property with vendor prefix",desc:"When using a vendor-prefixed property, make sure to include the standard one.",browsers:"All",init:function(e,t){function r(){i={},o=1}function n(e){var r,n,o,l,u,d=[];for(r in i)s[r]&&d.push({actual:r,needed:s[r]});for(n=0,o=d.length;o>n;n++)l=d[n].needed,u=d[n].actual,i[l]?i[l][0].pos<i[u][0].pos&&t.report("Standard property '"+l+"' should come after vendor-prefixed property '"+u+"'.",i[u][0].name.line,i[u][0].name.col,a):t.report("Missing standard property '"+l+"' to go along with '"+u+"'.",i[u][0].name.line,i[u][0].name.col,a)}var i,o,a=this,s={"-webkit-border-radius":"border-radius","-webkit-border-top-left-radius":"border-top-left-radius","-webkit-border-top-right-radius":"border-top-right-radius","-webkit-border-bottom-left-radius":"border-bottom-left-radius","-webkit-border-bottom-right-radius":"border-bottom-right-radius","-o-border-radius":"border-radius","-o-border-top-left-radius":"border-top-left-radius","-o-border-top-right-radius":"border-top-right-radius","-o-border-bottom-left-radius":"border-bottom-left-radius","-o-border-bottom-right-radius":"border-bottom-right-radius","-moz-border-radius":"border-radius","-moz-border-radius-topleft":"border-top-left-radius","-moz-border-radius-topright":"border-top-right-radius","-moz-border-radius-bottomleft":"border-bottom-left-radius","-moz-border-radius-bottomright":"border-bottom-right-radius","-moz-column-count":"column-count","-webkit-column-count":"column-count","-moz-column-gap":"column-gap","-webkit-column-gap":"column-gap","-moz-column-rule":"column-rule","-webkit-column-rule":"column-rule","-moz-column-rule-style":"column-rule-style","-webkit-column-rule-style":"column-rule-style","-moz-column-rule-color":"column-rule-color","-webkit-column-rule-color":"column-rule-color","-moz-column-rule-width":"column-rule-width","-webkit-column-rule-width":"column-rule-width","-moz-column-width":"column-width","-webkit-column-width":"column-width","-webkit-column-span":"column-span","-webkit-columns":"columns","-moz-box-shadow":"box-shadow","-webkit-box-shadow":"box-shadow","-moz-transform":"transform","-webkit-transform":"transform","-o-transform":"transform","-ms-transform":"transform","-moz-transform-origin":"transform-origin","-webkit-transform-origin":"transform-origin","-o-transform-origin":"transform-origin","-ms-transform-origin":"transform-origin","-moz-box-sizing":"box-sizing","-webkit-box-sizing":"box-sizing","-moz-user-select":"user-select",
4
+ "-khtml-user-select":"user-select","-webkit-user-select":"user-select"};e.addListener("startrule",r),e.addListener("startfontface",r),e.addListener("startpage",r),e.addListener("startpagemargin",r),e.addListener("startkeyframerule",r),e.addListener("property",function(e){var t=e.property.text.toLowerCase();i[t]||(i[t]=[]),i[t].push({name:e.property,value:e.value,pos:o++})}),e.addListener("endrule",n),e.addListener("endfontface",n),e.addListener("endpage",n),e.addListener("endpagemargin",n),e.addListener("endkeyframerule",n)}}),CSSLint.addRule({id:"zero-units",name:"Disallow units for 0 values",desc:"You don't need to specify units when a value is 0.",browsers:"All",init:function(e,t){var r=this;e.addListener("property",function(e){for(var n=e.value.parts,i=0,o=n.length;o>i;)!n[i].units&&"percentage"!=n[i].type||0!==n[i].value||"time"==n[i].type||t.report("Values of 0 shouldn't have units specified.",n[i].line,n[i].col,r),i++})}}),function(){var e=function(e){return e&&e.constructor===String?e.replace(/[\"&><]/g,function(e){switch(e){case'"':return"&quot;";case"&":return"&amp;";case"<":return"&lt;";case">":return"&gt;"}}):""};CSSLint.addFormatter({id:"checkstyle-xml",name:"Checkstyle XML format",startFormat:function(){return'<?xml version="1.0" encoding="utf-8"?><checkstyle>'},endFormat:function(){return"</checkstyle>"},readError:function(t,r){return'<file name="'+e(t)+'"><error line="0" column="0" severty="error" message="'+e(r)+'"></error></file>'},formatResults:function(t,r,n){var i=t.messages,o=[],a=function(e){return e&&"name"in e?"net.csslint."+e.name.replace(/\s/g,""):""};return i.length>0&&(o.push('<file name="'+r+'">'),CSSLint.Util.forEach(i,function(t,r){t.rollup||o.push('<error line="'+t.line+'" column="'+t.col+'" severity="'+t.type+'" message="'+e(t.message)+'" source="'+a(t.rule)+'"/>')}),o.push("</file>")),o.join("")}})}(),CSSLint.addFormatter({id:"compact",name:"Compact, 'porcelain' format",startFormat:function(){return""},endFormat:function(){return""},formatResults:function(e,t,r){var n=e.messages,i="";r=r||{};var o=function(e){return e.charAt(0).toUpperCase()+e.slice(1)};return 0===n.length?r.quiet?"":t+": Lint Free!":(CSSLint.Util.forEach(n,function(e,r){i+=e.rollup?t+": "+o(e.type)+" - "+e.message+"\n":t+": line "+e.line+", col "+e.col+", "+o(e.type)+" - "+e.message+"\n"}),i)}}),CSSLint.addFormatter({id:"csslint-xml",name:"CSSLint XML format",startFormat:function(){return'<?xml version="1.0" encoding="utf-8"?><csslint>'},endFormat:function(){return"</csslint>"},formatResults:function(e,t,r){var n=e.messages,i=[],o=function(e){return e&&e.constructor===String?e.replace(/\"/g,"'").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;"):""};return n.length>0&&(i.push('<file name="'+t+'">'),CSSLint.Util.forEach(n,function(e,t){e.rollup?i.push('<issue severity="'+e.type+'" reason="'+o(e.message)+'" evidence="'+o(e.evidence)+'"/>'):i.push('<issue line="'+e.line+'" char="'+e.col+'" severity="'+e.type+'" reason="'+o(e.message)+'" evidence="'+o(e.evidence)+'"/>')}),i.push("</file>")),i.join("")}}),CSSLint.addFormatter({id:"junit-xml",name:"JUNIT XML format",startFormat:function(){return'<?xml version="1.0" encoding="utf-8"?><testsuites>'},endFormat:function(){return"</testsuites>"},formatResults:function(e,t,r){var n=e.messages,i=[],o={error:0,failure:0},a=function(e){return e&&"name"in e?"net.csslint."+e.name.replace(/\s/g,""):""},s=function(e){return e&&e.constructor===String?e.replace(/\"/g,"'").replace(/</g,"&lt;").replace(/>/g,"&gt;"):""};return n.length>0&&(n.forEach(function(e,t){var r="warning"===e.type?"error":e.type;e.rollup||(i.push('<testcase time="0" name="'+a(e.rule)+'">'),i.push("<"+r+' message="'+s(e.message)+'"><![CDATA['+e.line+":"+e.col+":"+s(e.evidence)+"]]></"+r+">"),i.push("</testcase>"),o[r]+=1)}),i.unshift('<testsuite time="0" tests="'+n.length+'" skipped="0" errors="'+o.error+'" failures="'+o.failure+'" package="net.csslint" name="'+t+'">'),i.push("</testsuite>")),i.join("")}}),CSSLint.addFormatter({id:"lint-xml",name:"Lint XML format",startFormat:function(){return'<?xml version="1.0" encoding="utf-8"?><lint>'},endFormat:function(){return"</lint>"},formatResults:function(e,t,r){var n=e.messages,i=[],o=function(e){return e&&e.constructor===String?e.replace(/\"/g,"'").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;"):""};return n.length>0&&(i.push('<file name="'+t+'">'),CSSLint.Util.forEach(n,function(e,t){e.rollup?i.push('<issue severity="'+e.type+'" reason="'+o(e.message)+'" evidence="'+o(e.evidence)+'"/>'):i.push('<issue line="'+e.line+'" char="'+e.col+'" severity="'+e.type+'" reason="'+o(e.message)+'" evidence="'+o(e.evidence)+'"/>')}),i.push("</file>")),i.join("")}}),CSSLint.addFormatter({id:"text",name:"Plain Text",startFormat:function(){return""},endFormat:function(){return""},formatResults:function(e,t,r){var n=e.messages,i="";if(r=r||{},0===n.length)return r.quiet?"":"\n\ncsslint: No errors in "+t+".";i="\n\ncsslint: There are "+n.length+" problems in "+t+".";var o=t.lastIndexOf("/"),a=t;return-1===o&&(o=t.lastIndexOf("\\")),o>-1&&(a=t.substring(o+1)),CSSLint.Util.forEach(n,function(e,t){i=i+"\n\n"+a,e.rollup?(i+="\n"+(t+1)+": "+e.type,i+="\n"+e.message):(i+="\n"+(t+1)+": "+e.type+" at line "+e.line+", col "+e.col,i+="\n"+e.message,i+="\n"+e.evidence)}),i}}),CSSLint}();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
js/editor.min.js CHANGED
@@ -1,63 +1 @@
1
-
2
- (function($,_,socssOptions){var socss={model:{},collection:{},view:{},fn:{}};window.socss=socss;socss.view.toolbar=Backbone.View.extend({button:_.template('<li><a href="#" class="toolbar-button socss-button"><%= text %></a></li>'),editor:null,initialize:function(attr){this.editor=attr.editor;var thisView=this;this.$('.editor-expand').click(function(e){e.preventDefault();$(this).blur();thisView.trigger('click_expand');});this.$('.editor-visual').click(function(e){e.preventDefault();$(this).blur();thisView.trigger('click_visual');});},addButton:function(text,action){var thisView=this;var button=$(this.button({text:text})).appendTo(this.$('.toolbar-function-buttons .toolbar-buttons')).click(function(e){e.preventDefault();$(this).blur();thisView.trigger('click_'+action);});return button;}});socss.view.editor=Backbone.View.extend({codeMirror:null,snippets:null,toolbar:null,visualProperties:null,inspector:null,cssSelectors:[],initialize:function(args){this.setupEditor();},render:function(){var thisView=this;this.toolbar=new socss.view.toolbar({editor:this,el:this.$('.custom-css-toolbar')});this.toolbar.editor=this;this.toolbar.render();this.visualProperties=new socss.view.properties({editor:this,el:$('#so-custom-css-properties')});this.visualProperties.render();this.toolbar.on('click_expand',function(){thisView.toggleExpand();});this.toolbar.on('click_visual',function(){thisView.visualProperties.loadCSS(thisView.codeMirror.getValue());thisView.visualProperties.show();});this.preview=new socss.view.preview({editor:this,el:this.$('.custom-css-preview')});this.preview.render();},setupEditor:function(){var thisView=this;this.registerCodeMirrorAutocomplete();this.codeMirror=CodeMirror.fromTextArea(this.$('textarea.css-editor').get(0),{tabSize:2,mode:'css',theme:'neat',gutters:["CodeMirror-lint-markers"],lint:true});var startCss=this.$('textarea.css-editor').val();this.$el.on('submit',function(){startCss=thisView.codeMirror.getValue();});$(window).bind('beforeunload',function(){if(thisView.codeMirror.getValue()!==startCss){return socssOptions.loc.leave;}});this.$el.find('.custom-css-container').css('overflow','visible');this.scaleEditor();$(window).resize(function(){thisView.scaleEditor();});this.setupCodeMirrorExtensions();},registerCodeMirrorAutocomplete:function(){var thisView=this;var pseudoClasses={link:1,visited:1,active:1,hover:1,focus:1,"first-letter":1,"first-line":1,"first-child":1,before:1,after:1,lang:1};CodeMirror.registerHelper("hint","css",function(cm){var cur=cm.getCursor(),token=cm.getTokenAt(cur);var inner=CodeMirror.innerMode(cm.getMode(),token.state);if(inner.mode.name!=="css"){return;}
3
- if(token.type==="keyword"&&"!important".indexOf(token.string)===0){return{list:["!important"],from:CodeMirror.Pos(cur.line,token.start),to:CodeMirror.Pos(cur.line,token.end)};}
4
- var start=token.start,end=cur.ch,word=token.string.slice(0,end-start);if(/[^\w$_-]/.test(word)){word="";start=end=cur.ch;}
5
- var spec=CodeMirror.resolveMode("text/css");var result=[];function add(keywords){for(var name in keywords){if(!word||name.lastIndexOf(word,0)===0){result.push(name);}}}
6
- var st=inner.state.state;if(st==='top'){var line=cm.getLine(cur.line).trim();var selectors=thisView.cssSelectors;for(var i=0;i<selectors.length;i++){if(selectors[i].selector.indexOf(line)!==-1){result.push(selectors[i].selector);}}
7
- if(result.length){return{list:result,from:CodeMirror.Pos(cur.line,0),to:CodeMirror.Pos(cur.line,end)};}}
8
- else{if(st==="pseudo"||token.type==="variable-3"){add(pseudoClasses);}
9
- else if(st==="block"||st==="maybeprop"){add(spec.propertyKeywords);}
10
- else if(st==="prop"||st==="parens"||st==="at"||st==="params"){add(spec.valueKeywords);add(spec.colorKeywords);}
11
- else if(st==="media"||st==="media_parens"){add(spec.mediaTypes);add(spec.mediaFeatures);}
12
- if(result.length){return{list:result,from:CodeMirror.Pos(cur.line,start),to:CodeMirror.Pos(cur.line,end)};}}});},setupCodeMirrorExtensions:function(){var thisView=this;this.codeMirror.on('cursorActivity',function(cm){var cur=cm.getCursor(),token=cm.getTokenAt(cur);var inner=CodeMirror.innerMode(cm.getMode(),token.state);if(token.type==='qualifier'||token.type==='tag'||token.type==='builtin'){var line=cm.getLine(cur.line);var selector=line.substring(0,token.end);thisView.preview.highlight(selector);}
13
- else{thisView.preview.clearHighlight();}});this.codeMirror.on('keyup',function(cm,e){if((e.keyCode>=65&&e.keyCode<=90)||(e.keyCode===189&&!e.shiftKey)||(e.keyCode===190&&!e.shiftKey)||(e.keyCode===51&&e.shiftKey)||(e.keyCode===189&&e.shiftKey)){cm.showHint(e);}});},scaleEditor:function(){if(this.$el.hasClass('expanded')){this.codeMirror.setSize('100%',$(window).outerHeight()-this.$('.custom-css-toolbar').outerHeight());}
14
- else{this.codeMirror.setSize('100%','auto');}},isExpanded:function(){return this.$el.hasClass('expanded');},toggleExpand:function(){this.$el.toggleClass('expanded');this.scaleEditor();},setExpand:function(expanded){if(expanded){this.$el.addClass('expanded');}
15
- else{this.$el.removeClass('expanded');}
16
- this.scaleEditor();},setSnippets:function(snippets){if(!_.isEmpty(snippets)){var thisView=this;this.snippets=new socss.view.snippets({snippets:snippets});this.snippets.editor=this;this.snippets.render();this.toolbar.addButton('Snippets','snippets');this.toolbar.on('click_snippets',function(){thisView.snippets.show();});}},addCode:function(css){var editor=this.codeMirror;var before_css='';if(editor.doc.lineCount()===1&&editor.doc.getLine(editor.doc.lastLine()).length===0){before_css="";}
17
- else if(editor.doc.getLine(editor.doc.lastLine()).length===0){before_css="\n";}
18
- else{before_css="\n\n";}
19
- editor.doc.setCursor(editor.doc.lastLine(),editor.doc.getLine(editor.doc.lastLine()).length);editor.doc.replaceSelection(before_css+css);},addEmptySelector:function(selector){this.addCode(selector+" {\n \n}");},setInspector:function(inspector){var thisView=this;this.inspector=inspector;this.cssSelectors=inspector.pageSelectors;inspector.on('click_selector',function(selector){if(thisView.visualProperties.isVisible()){thisView.visualProperties.addSelector(selector);}
20
- else{thisView.addEmptySelector(selector);}});inspector.on('click_property',function(property){if(!thisView.visualProperties.isVisible()){thisView.codeMirror.replaceSelection(property+";\n ");}});inspector.on('set_active_element',function(el,selectors){if(thisView.visualProperties.isVisible()&&selectors.length){thisView.visualProperties.addSelector(selectors[0].selector);}});}});socss.view.preview=Backbone.View.extend({template:_.template('<iframe class="preview-iframe" seamless="seamless"></iframe>'),editor:null,initialize:function(attr){this.editor=attr.editor;var thisView=this;this.editor.codeMirror.on('change',function(cm,c){thisView.updatePreviewCss();});},render:function(){var thisView=this;this.$el.html(this.template());this.$('.preview-iframe').attr('src',socssOptions.homeURL).load(function(){var $$=$(this);$$.contents().find('a').each(function(){var href=$(this).attr('href');if(href===undefined){return true;}
21
- var firstSeperator=(href.indexOf('?')===-1?'?':'&');$(this).attr('href',href+firstSeperator+'so_css_preview=1');});thisView.updatePreviewCss();}).mouseleave(function(){thisView.clearHighlight();});},updatePreviewCss:function(){var preview=this.$('.preview-iframe');if(preview.length===0){return;}
22
- var head=preview.contents().find('head');if(head.find('style.siteorigin-custom-css').length===0){head.append('<style class="siteorigin-custom-css" type="text/css"></style>');}
23
- var style=head.find('style.siteorigin-custom-css');var css=this.editor.codeMirror.getValue();style.html(css);},highlight:function(selector){try{this.editor.inspector.hl.highlight(selector);}
24
- catch(err){console.log('No inspector to highlight with');}},clearHighlight:function(){try{this.editor.inspector.hl.clear();}
25
- catch(err){console.log('No inspector to highlight with');}}});socss.view.snippets=Backbone.View.extend({template:_.template($('#template-snippet-browser').html()),snippet:_.template('<li class="snippet"><%- name %></li>'),className:'css-editor-snippet-browser',snippets:null,editor:null,events:{'click .close':'hide','click .buttons .insert-snippet':'insertSnippet'},currentSnippet:null,initialize:function(args){this.snippets=args.snippets;},render:function(){var thisView=this;var clickSnippet=function(e){e.preventDefault();var $$=$(this);thisView.$('.snippets li.snippet').removeClass('active');$(this).addClass('active');thisView.viewSnippet({name:$$.html(),description:$$.data('description'),css:$$.data('css')});};this.$el.html(this.template());for(var i=0;i<this.snippets.length;i++){$(this.snippet({name:this.snippets[i].Name})).data({'description':this.snippets[i].Description,'css':this.snippets[i].css}).appendTo(this.$('ul.snippets')).click(clickSnippet);}
26
- thisView.$('.snippets li.snippet').eq(0).click();this.attach();return this;},viewSnippet:function(args){var w=this.$('.main .snippet-view');w.find('.snippet-title').html(args.name);w.find('.snippet-description').html(args.description);w.find('.snippet-code').html(args.css);this.currentSnippet=args;},insertSnippet:function(){var editor=this.editor.codeMirror;var css=this.currentSnippet.css;var before_css='';if(editor.doc.lineCount()===1&&editor.doc.getLine(editor.doc.lastLine()).length===0){before_css="";}
27
- else if(editor.doc.getLine(editor.doc.lastLine()).length===0){before_css="\n";}
28
- else{before_css="\n\n";}
29
- editor.doc.setCursor(editor.doc.lastLine(),editor.doc.getLine(editor.doc.lastLine()).length);editor.doc.replaceSelection(before_css+css);this.hide();},attach:function(){this.$el.appendTo('body');},show:function(){this.$el.show();},hide:function(){this.$el.hide();}});socss.view.properties=Backbone.View.extend({model:socss.model.cssRules,tabTemplate:_.template('<li data-section="<%- id %>"><span class="fa fa-<%- icon %>"></span> <%- title %></li>'),sectionTemplate:_.template('<div class="section" data-section="<%- id %>"><table class="fields-table"><tbody></tbody></table></div>'),controllerTemplate:_.template('<tr><th scope="row"><%- title %></th><td></td></tr>'),propertyControllers:[],editor:null,css:'',parsed:{},activeSelector:'',editorExpandedBefore:false,events:{'click .close':'hide'},initialize:function(attr){this.parser=new cssjs();this.editor=attr.editor;},render:function(){var thisView=this;var controllers=socssOptions.propertyControllers;for(var id in controllers){var $t=$(this.tabTemplate({id:id,icon:controllers[id].icon,title:controllers[id].title})).appendTo(this.$('.section-tabs'));var $s=$(this.sectionTemplate({id:id})).appendTo(this.$('.sections'));if(!_.isEmpty(controllers[id].controllers)){for(var i=0;i<controllers[id].controllers.length;i++){var $c=$(thisView.controllerTemplate({title:controllers[id].controllers[i].title})).appendTo($s.find('tbody'));var controllerAtts=controllers[id].controllers[i];var controller;if(typeof socss.view.properties.controllers[controllerAtts.type]==='undefined'){controller=new socss.view.propertyController({el:$c.find('td'),propertiesView:thisView,args:(typeof controllerAtts.args==='undefined'?{}:controllerAtts.args)});}
30
- else{controller=new socss.view.properties.controllers[controllerAtts.type]({el:$c.find('td'),propertiesView:thisView,args:(typeof controllerAtts.args==='undefined'?{}:controllerAtts.args)});}
31
- thisView.propertyControllers.push(controller);controller.render();controller.initChangeEvents();}}}
32
- this.$('.section-tabs li').click(function(){var $$=$(this);var show=thisView.$('.sections .section[data-section="'+$$.data('section')+'"]');thisView.$('.sections .section').not(show).hide().removeClass('active');show.show().addClass('active');thisView.$('.section-tabs li').not($$).removeClass('active');$$.addClass('active');}).eq(0).click();this.$('.toolbar select').change(function(){thisView.setActivateSelector($(this).find(':selected').data('selector'));});},setRuleValue:function(rule,value){if(typeof this.activeSelector==='undefined'||typeof this.activeSelector.rules==='undefined'){return;}
33
- var newRule=true;for(var i=0;i<this.activeSelector.rules.length;i++){if(this.activeSelector.rules[i].directive===rule){this.activeSelector.rules[i].value=value;newRule=false;break;}}
34
- if(newRule){this.activeSelector.rules.push({directive:rule,value:value});}
35
- this.updateMainEditor(false);},getRuleValue:function(rule){if(typeof this.activeSelector==='undefined'||typeof this.activeSelector.rules==='undefined'){return'';}
36
- for(var i=0;i<this.activeSelector.rules.length;i++){if(this.activeSelector.rules[i].directive===rule){return this.activeSelector.rules[i].value;}}
37
- return'';},updateMainEditor:function(compress){var css;if(typeof compress==='undefined'||compress===true){css=this.parser.compressCSS(this.parsed);css=css.filter(function(v){return(typeof v.type!=='undefined'||v.rules.length>0);});}
38
- else{css=this.parsed;}
39
- this.editor.codeMirror.setValue(this.parser.getCSSForEditor(css).trim());},show:function(){this.editorExpandedBefore=this.editor.isExpanded();this.editor.setExpand(true);this.$el.show().animate({'left':0},'fast');},hide:function(){this.editor.setExpand(this.editorExpandedBefore);this.$el.animate({'left':-338},'fast',function(){$(this).hide();});this.updateMainEditor(true);},isVisible:function(){return this.$el.is(':visible');},loadCSS:function(css,activeSelector){this.css=css;this.parsed=this.parser.compressCSS(this.parser.parseCSS(css));var dropdown=this.$('.toolbar select').empty();for(var i=0;i<this.parsed.length;i++){var rule=this.parsed[i];if(typeof rule.subStyles!=='undefined'){for(var j=0;j<rule.subStyles.length;j++){var subRule=rule.subStyles[j];dropdown.append($('<option>').html(rule.selector+': '+subRule.selector).attr('val',rule.selector+': '+subRule.selector).data('selector',subRule));}}
40
- else{dropdown.append($('<option>').html(rule.selector).attr('val',rule.selector).data('selector',rule));}}
41
- if(typeof activeSelector==='undefined'){activeSelector=dropdown.find('option').eq(0).attr('val');}
42
- dropdown.val(activeSelector).change();},setActivateSelector:function(selector){this.activeSelector=selector;for(var i=0;i<this.propertyControllers.length;i++){this.propertyControllers[i].refreshFromRule();}},addSelector:function(selector){var dropdown=this.$('.toolbar select');dropdown.val(selector);if(dropdown.val()===selector){dropdown.change();}
43
- else{this.editor.addEmptySelector(selector);this.loadCSS(this.editor.codeMirror.getValue(),selector);}
44
- dropdown.addClass('highlighted');setTimeout(function(){dropdown.removeClass('highlighted');},2000);}});socss.view.propertyController=Backbone.View.extend({template:_.template('<input type="text" value="" />'),activeRule:null,args:null,propertiesView:null,initialize:function(args){this.args=args.args;this.propertiesView=args.propertiesView;this.on('set_value',this.updateRule,this);this.on('change',this.updateRule,this);},render:function(){this.$el.append($(this.template({})));this.field=this.$('input');},initChangeEvents:function(){var thisView=this;this.field.on('change keyup',function(){thisView.trigger('change',$(this).val());});},updateRule:function(){this.propertiesView.setRuleValue(this.args.property,this.getValue());},refreshFromRule:function(){var value=this.propertiesView.getRuleValue(this.args.property);this.setValue(value,{silent:true});},getValue:function(){return this.field.val();},setValue:function(val,options){options=_.extend({silent:false},options);this.field.val(val);if(!options.silent){this.trigger('set_value',val);}},reset:function(options){options=_.extend({silent:false},options);this.setValue('',options);}});socss.view.properties.controllers={};socss.view.properties.controllers.color=socss.view.propertyController.extend({template:_.template('<input type="text" value="" />'),render:function(){var thisView=this;this.$el.append($(this.template({})));this.field=this.$el.find('input');this.field.minicolors({});},initChangeEvents:function(){var thisView=this;this.field.on('change keyup',function(){thisView.trigger('change',thisView.field.minicolors('value'));});},getValue:function(){return this.field.minicolors('value');},setValue:function(val,options){options=_.extend({silent:false},options);this.field.minicolors('value',val);if(!options.silent){this.trigger('set_value',val);}}});socss.view.properties.controllers.select=socss.view.propertyController.extend({template:_.template('<select></select>'),render:function(){var thisView=this;this.$el.append($(this.template({})));this.field=this.$el.find('select');this.field.append($('<option value=""></option>').html(''));for(var k in this.args.options){this.field.append($('<option></option>').attr('value',k).html(this.args.options[k]));}
45
- if(typeof this.args.option_icons!=='undefined'){this.setupVisualSelect();}},setupVisualSelect:function(){var thisView=this;this.field.hide();var $tc=$('<div class="select-tabs"></div>').appendTo(this.$el);$('<div class="select-tab" data-value=""><span class="fa fa-circle-o"></span></div>').appendTo($tc);for(var k in this.args.option_icons){$('<div class="select-tab"></div>').appendTo($tc).append($('<span class="fa"></span>').addClass('fa-'+this.args.option_icons[k])).attr('data-value',k);}
46
- $tc.find('.select-tab').css('width',100/($tc.find('>div').length)+"%").click(function(){var $t=$(this);$tc.find('.select-tab').removeClass('active');$t.addClass('active');thisView.field.val($t.data('value')).change();});},setValue:function(val,options){options=_.extend({silent:false},options);this.field.val(val);this.$('.select-tabs .select-tab').removeClass('active').filter('[data-value="'+val+'"]').addClass('active');if(!options.silent){this.trigger('set_value',val);}}});socss.view.properties.controllers.image=socss.view.propertyController.extend({template:_.template('<input type="text" value="" /> <span class="select socss-button"><span class="fa fa-upload"></span></span>'),render:function(){var thisView=this;this.media=wp.media({title:socssOptions.loc.select_image,library:{type:'image'},button:{text:socssOptions.loc.select,close:false}});this.$el.append($(this.template({select:socssOptions.loc.select})));this.field=this.$el.find('input');this.$('.select').click(function(){thisView.media.open();});this.media.on('select',function(){var attachment=this.state().get('selection').first().attributes;var val=thisView.args.value.replace('{{url}}',attachment.url);thisView.field.val(val).change();thisView.media.close();},this.media);}});socss.view.properties.controllers.measurement=socss.view.propertyController.extend({wrapperClass:'socss-field-measurement',render:function(){this.$el.append($(this.template({})));this.field=this.$('input');this.setupMeasurementField(this.field,{});},setValue:function(val,options){options=_.extend({silent:false},options);this.field.val(val).trigger('measurement_refresh');if(!options.silent){this.trigger('set_value',val);}},units:['px','%','em','cm','mm','in','pt','pc','ex','ch','rem','vw','vh','vmin','vmax'],parseUnits:function(value){var escapeRegExp=function(str){return str.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&");};var regexUnits=this.units.map(escapeRegExp);var regex=new RegExp('([0-9\\.\\-]+)('+regexUnits.join('|')+')?','i');var result=regex.exec(value);if(result===null){return{value:'',unit:''};}
47
- else{return{value:result[1],unit:result[2]===undefined?'':result[2]};}},setupMeasurementField:function($el,options){var thisView=this;var $p=$el.parent();options=_.extend({defaultUnit:'px'},options);$el.hide();$p.addClass(this.wrapperClass).data('unit',options.defaultUnit);var $fi=$('<input type="text" class="socss-field-input"/>').appendTo($p);var $da=$('<span class="dashicons dashicons-arrow-down"></span>').appendTo($p);var $dd=$('<ul class="dropdown"></ul>').appendTo($p);var $u=$('<span class="units"></span>').html(options.defaultUnit).appendTo($p);for(var i=0;i<thisView.units.length;i++){var $o=$('<li></li>').html(thisView.units[i]).data('unit',thisView.units[i]);if(thisView.units[i]===options.defaultUnit){$o.addClass('active');}
48
- $dd.append($o);}
49
- var updateValue=function(){var value=thisView.parseUnits($fi.val());if(value.unit!==''&&value.unit!==$p.data('unit')){$fi.val(value.value);setUnit(value.unit);}
50
- if(value.value===''){$el.val('');}
51
- else{$el.val(value.value+$p.data('unit'));}};var setUnit=function(unit){$u.html(unit);$p.data('unit',unit);$fi.trigger('keydown');};$da.click(function(){$dd.toggle();});$dd.find('li').click(function(){$dd.toggle();setUnit($(this).data('unit'));updateValue();$el.trigger('change');});$fi.on('keyup keydown',function(e){var $$=$(this);var char='';if(e.type==='keydown'){if(e.keyCode>=48&&e.keyCode<=57){char=String.fromCharCode(e.keyCode);}
52
- else if(e.keyCode===189){char='-';}
53
- else if(e.keyCode===190){char='.';}}
54
- var $pl=$('<span class="socss-hidden-placeholder"></span>').css({'font-size':'14px'}).html($fi.val()+char).appendTo('body');var width=$pl.width();width=Math.min(width,63);$pl.remove();$u.css('left',width+12);});$fi.on('keyup',function(e){updateValue();$el.trigger('change');});$el.on('measurement_refresh',function(){var value=thisView.parseUnits($el.val());$fi.val(value.value);var unit=value.unit===''?options.defaultUnit:value.unit;$p.data('unit',unit);$u.html(unit);var $pl=$('<span class="socss-hidden-placeholder"></span>').css({'font-size':'14px'}).html(value.value).appendTo('body');var width=$pl.width();width=Math.min(width,63);$pl.remove();$u.css('left',width+12);});var $diw=$('<div class="socss-diw"></div>').appendTo($p);var $dec=$('<div class="dec-button socss-button"><span class="fa fa-minus"></span></div>').appendTo($diw);var $inc=$('<div class="inc-button socss-button"><span class="fa fa-plus"></span></div>').appendTo($diw);$inc.click(function(){var value=thisView.parseUnits($el.val());if(value.value===''){return true;}
55
- var newVal=Math.ceil(value.value*1.05);$fi.val(newVal);updateValue();$el.trigger('change').trigger('measurement_refresh');});$dec.click(function(){var value=thisView.parseUnits($el.val());if(value.value===''){return true;}
56
- var newVal=Math.floor(value.value/1.05);$fi.val(newVal);updateValue();$el.trigger('change').trigger('measurement_refresh');});}});socss.view.properties.controllers.number=socss.view.propertyController.extend({render:function(){this.$el.append($(this.template({})));this.field=this.$('input');this.setupNumberField(this.field,this.args);},setupNumberField:function($el,options){options=_.extend({change:null,default:0,increment:1,decrement:-1,max:null,min:null},options);var $p=$el.parent();$p.addClass('socss-field-number');var $diw=$('<div class="socss-diw"></div>').appendTo($p);var $dec=$('<div class="dec-button socss-button">-</div>').appendTo($diw);var $inc=$('<div class="inc-button socss-button">+</div>').appendTo($diw);$diw.find('> div').click(function(e){e.preventDefault();var val=options.default;if($el.val()!==''){val=Number($el.val());}
57
- val=val+($(this).is($dec)?options.decrement:options.increment);val=Math.round(val*100)/100;if(options.max!==null){val=Math.min(options.max,val);}
58
- if(options.min!==null){val=Math.max(options.min,val);}
59
- $el.val(val);$el.trigger('change');});return this;}});socss.view.properties.controllers.sides=socss.view.propertyController.extend({template:_.template($('#template-sides-field').html().trim()),controllers:[],render:function(){var thisView=this;this.$el.append($(this.template({})));this.field=this.$el.find('input');if(!thisView.args.hasAll){this.$('.select-tab').eq(0).remove();this.$('.select-tab').css('width','25%');}
60
- this.$('.select-tab').each(function(){var dir=$(this).data('direction');var container=$('<li class="side">').appendTo(thisView.$('.sides')).hide();for(var i=0;i<thisView.args.controllers.length;i++){var controllerArgs=thisView.args.controllers[i];if(typeof socss.view.properties.controllers[controllerArgs.type]){var property='';if(dir==='all'){property=controllerArgs.args.propertyAll;}
61
- else{property=controllerArgs.args.property.replace('{dir}',dir);}
62
- var theseControllerArgs=_.extend({},controllerArgs.args,{property:property});var controller=new socss.view.properties.controllers[controllerArgs.type]({el:$('<div>').appendTo(container),propertiesView:thisView.propertiesView,args:theseControllerArgs});controller.render();controller.initChangeEvents();thisView.propertiesView.propertyControllers.push(controller);}}
63
- $(this).on('click',function(){thisView.$('.select-tab').removeClass('active');$(this).addClass('active');thisView.$('.sides .side').hide();container.show();});});this.$('.select-tab').eq(0).click();}});})(jQuery,_,socssOptions);jQuery(function($){var socss=window.socss;var editor=new socss.view.editor({el:$('#so-custom-css-form').get(0)});editor.render();editor.setSnippets(socssOptions.snippets);window.socss.mainEditor=editor;$('#so-custom-css-getting-started a.hide').click(function(e){e.preventDefault();$('#so-custom-css-getting-started').slideUp();$.get($(this).attr('href'));});});
1
+ !function(e,t,i){var s={model:{},collection:{},view:{},fn:{}};window.socss=s,s.view.toolbar=Backbone.View.extend({button:t.template('<li><a href="#" class="toolbar-button socss-button"><%= text %></a></li>'),editor:null,initialize:function(t){this.editor=t.editor;var i=this;this.$(".editor-expand").click(function(t){t.preventDefault(),e(this).blur(),i.trigger("click_expand")}),this.$(".editor-visual").click(function(t){t.preventDefault(),e(this).blur(),i.trigger("click_visual")})},addButton:function(t,i){var s=this,n=e(this.button({text:t})).appendTo(this.$(".toolbar-function-buttons .toolbar-buttons")).click(function(t){t.preventDefault(),e(this).blur(),s.trigger("click_"+i)});return n}}),s.view.editor=Backbone.View.extend({codeMirror:null,snippets:null,toolbar:null,visualProperties:null,inspector:null,cssSelectors:[],initialize:function(e){this.setupEditor()},render:function(){var t=this;this.toolbar=new s.view.toolbar({editor:this,el:this.$(".custom-css-toolbar")}),this.toolbar.editor=this,this.toolbar.render(),this.visualProperties=new s.view.properties({editor:this,el:e("#so-custom-css-properties")}),this.visualProperties.render(),this.toolbar.on("click_expand",function(){t.toggleExpand()}),this.toolbar.on("click_visual",function(){t.visualProperties.loadCSS(t.codeMirror.getValue()),t.visualProperties.show()}),this.preview=new s.view.preview({editor:this,el:this.$(".custom-css-preview")}),this.preview.render()},setupEditor:function(){var t=this;this.registerCodeMirrorAutocomplete(),this.codeMirror=CodeMirror.fromTextArea(this.$("textarea.css-editor").get(0),{tabSize:2,mode:"css",theme:"neat",gutters:["CodeMirror-lint-markers"],lint:!0});var s=this.$("textarea.css-editor").val();this.$el.on("submit",function(){s=t.codeMirror.getValue()}),e(window).bind("beforeunload",function(){return t.codeMirror.getValue()!==s?i.loc.leave:void 0}),this.$el.find(".custom-css-container").css("overflow","visible"),this.scaleEditor(),e(window).resize(function(){t.scaleEditor()}),this.setupCodeMirrorExtensions()},registerCodeMirrorAutocomplete:function(){var e=this,t={link:1,visited:1,active:1,hover:1,focus:1,"first-letter":1,"first-line":1,"first-child":1,before:1,after:1,lang:1};CodeMirror.registerHelper("hint","css",function(i){function s(e){for(var t in e)c&&0!==t.lastIndexOf(c,0)||p.push(t)}var n=i.getCursor(),r=i.getTokenAt(n),o=CodeMirror.innerMode(i.getMode(),r.state);if("css"===o.mode.name){if("keyword"===r.type&&0==="!important".indexOf(r.string))return{list:["!important"],from:CodeMirror.Pos(n.line,r.start),to:CodeMirror.Pos(n.line,r.end)};var a=r.start,l=n.ch,c=r.string.slice(0,l-a);/[^\w$_-]/.test(c)&&(c="",a=l=n.ch);var d=CodeMirror.resolveMode("text/css"),p=[],h=o.state.state;if("top"===h){for(var u=i.getLine(n.line).trim(),v=e.cssSelectors,f=0;f<v.length;f++)-1!==v[f].selector.indexOf(u)&&p.push(v[f].selector);if(p.length)return{list:p,from:CodeMirror.Pos(n.line,0),to:CodeMirror.Pos(n.line,l)}}else if("pseudo"===h||"variable-3"===r.type?s(t):"block"===h||"maybeprop"===h?s(d.propertyKeywords):"prop"===h||"parens"===h||"at"===h||"params"===h?(s(d.valueKeywords),s(d.colorKeywords)):("media"===h||"media_parens"===h)&&(s(d.mediaTypes),s(d.mediaFeatures)),p.length)return{list:p,from:CodeMirror.Pos(n.line,a),to:CodeMirror.Pos(n.line,l)}}})},setupCodeMirrorExtensions:function(){var e=this;this.codeMirror.on("cursorActivity",function(t){var i=t.getCursor(),s=t.getTokenAt(i);CodeMirror.innerMode(t.getMode(),s.state);if("qualifier"===s.type||"tag"===s.type||"builtin"===s.type){var n=t.getLine(i.line),r=n.substring(0,s.end);e.preview.highlight(r)}else e.preview.clearHighlight()}),this.codeMirror.on("keyup",function(e,t){(t.keyCode>=65&&t.keyCode<=90||189===t.keyCode&&!t.shiftKey||190===t.keyCode&&!t.shiftKey||51===t.keyCode&&t.shiftKey||189===t.keyCode&&t.shiftKey)&&e.showHint(t)})},scaleEditor:function(){this.$el.hasClass("expanded")?this.codeMirror.setSize("100%",e(window).outerHeight()-this.$(".custom-css-toolbar").outerHeight()):this.codeMirror.setSize("100%","auto")},isExpanded:function(){return this.$el.hasClass("expanded")},toggleExpand:function(){this.$el.toggleClass("expanded"),this.scaleEditor()},setExpand:function(e){e?this.$el.addClass("expanded"):this.$el.removeClass("expanded"),this.scaleEditor()},setSnippets:function(e){if(!t.isEmpty(e)){var i=this;this.snippets=new s.view.snippets({snippets:e}),this.snippets.editor=this,this.snippets.render(),this.toolbar.addButton("Snippets","snippets"),this.toolbar.on("click_snippets",function(){i.snippets.show()})}},addCode:function(e){var t=this.codeMirror,i="";i=1===t.doc.lineCount()&&0===t.doc.getLine(t.doc.lastLine()).length?"":0===t.doc.getLine(t.doc.lastLine()).length?"\n":"\n\n",t.doc.setCursor(t.doc.lastLine(),t.doc.getLine(t.doc.lastLine()).length),t.doc.replaceSelection(i+e)},addEmptySelector:function(e){this.addCode(e+" {\n \n}")},setInspector:function(e){var t=this;this.inspector=e,this.cssSelectors=e.pageSelectors,e.on("click_selector",function(e){t.visualProperties.isVisible()?t.visualProperties.addSelector(e):t.addEmptySelector(e)}),e.on("click_property",function(e){t.visualProperties.isVisible()||t.codeMirror.replaceSelection(e+";\n ")}),e.on("set_active_element",function(e,i){t.visualProperties.isVisible()&&i.length&&t.visualProperties.addSelector(i[0].selector)})}}),s.view.preview=Backbone.View.extend({template:t.template('<iframe class="preview-iframe" seamless="seamless"></iframe>'),editor:null,initialize:function(e){this.editor=e.editor;var t=this;this.editor.codeMirror.on("change",function(e,i){t.updatePreviewCss()})},render:function(){var t=this;this.$el.html(this.template()),this.$(".preview-iframe").attr("src",i.homeURL).load(function(){var i=e(this);i.contents().find("a").each(function(){var t=e(this).attr("href");if(void 0===t)return!0;var i=-1===t.indexOf("?")?"?":"&";e(this).attr("href",t+i+"so_css_preview=1")}),t.updatePreviewCss()}).mouseleave(function(){t.clearHighlight()})},updatePreviewCss:function(){var e=this.$(".preview-iframe");if(0!==e.length){var t=e.contents().find("head");0===t.find("style.siteorigin-custom-css").length&&t.append('<style class="siteorigin-custom-css" type="text/css"></style>');var i=t.find("style.siteorigin-custom-css"),s=this.editor.codeMirror.getValue();i.html(s)}},highlight:function(e){try{this.editor.inspector.hl.highlight(e)}catch(t){console.log("No inspector to highlight with")}},clearHighlight:function(){try{this.editor.inspector.hl.clear()}catch(e){console.log("No inspector to highlight with")}}}),s.view.snippets=Backbone.View.extend({template:t.template(e("#template-snippet-browser").html()),snippet:t.template('<li class="snippet"><%- name %></li>'),className:"css-editor-snippet-browser",snippets:null,editor:null,events:{"click .close":"hide","click .buttons .insert-snippet":"insertSnippet"},currentSnippet:null,initialize:function(e){this.snippets=e.snippets},render:function(){var t=this,i=function(i){i.preventDefault();var s=e(this);t.$(".snippets li.snippet").removeClass("active"),e(this).addClass("active"),t.viewSnippet({name:s.html(),description:s.data("description"),css:s.data("css")})};this.$el.html(this.template());for(var s=0;s<this.snippets.length;s++)e(this.snippet({name:this.snippets[s].Name})).data({description:this.snippets[s].Description,css:this.snippets[s].css}).appendTo(this.$("ul.snippets")).click(i);return t.$(".snippets li.snippet").eq(0).click(),this.attach(),this},viewSnippet:function(e){var t=this.$(".main .snippet-view");t.find(".snippet-title").html(e.name),t.find(".snippet-description").html(e.description),t.find(".snippet-code").html(e.css),this.currentSnippet=e},insertSnippet:function(){var e=this.editor.codeMirror,t=this.currentSnippet.css,i="";i=1===e.doc.lineCount()&&0===e.doc.getLine(e.doc.lastLine()).length?"":0===e.doc.getLine(e.doc.lastLine()).length?"\n":"\n\n",e.doc.setCursor(e.doc.lastLine(),e.doc.getLine(e.doc.lastLine()).length),e.doc.replaceSelection(i+t),this.hide()},attach:function(){this.$el.appendTo("body")},show:function(){this.$el.show()},hide:function(){this.$el.hide()}}),s.view.properties=Backbone.View.extend({model:s.model.cssRules,tabTemplate:t.template('<li data-section="<%- id %>"><span class="fa fa-<%- icon %>"></span> <%- title %></li>'),sectionTemplate:t.template('<div class="section" data-section="<%- id %>"><table class="fields-table"><tbody></tbody></table></div>'),controllerTemplate:t.template('<tr><th scope="row"><%- title %></th><td></td></tr>'),propertyControllers:[],editor:null,css:"",parsed:{},activeSelector:"",editorExpandedBefore:!1,events:{"click .close":"hide"},initialize:function(e){this.parser=new cssjs,this.editor=e.editor},render:function(){var n=this,r=i.propertyControllers;for(var o in r){var a=(e(this.tabTemplate({id:o,icon:r[o].icon,title:r[o].title})).appendTo(this.$(".section-tabs")),e(this.sectionTemplate({id:o})).appendTo(this.$(".sections")));if(!t.isEmpty(r[o].controllers))for(var l=0;l<r[o].controllers.length;l++){var c,d=e(n.controllerTemplate({title:r[o].controllers[l].title})).appendTo(a.find("tbody")),p=r[o].controllers[l];c="undefined"==typeof s.view.properties.controllers[p.type]?new s.view.propertyController({el:d.find("td"),propertiesView:n,args:"undefined"==typeof p.args?{}:p.args}):new s.view.properties.controllers[p.type]({el:d.find("td"),propertiesView:n,args:"undefined"==typeof p.args?{}:p.args}),n.propertyControllers.push(c),c.render(),c.initChangeEvents()}}this.$(".section-tabs li").click(function(){var t=e(this),i=n.$('.sections .section[data-section="'+t.data("section")+'"]');n.$(".sections .section").not(i).hide().removeClass("active"),i.show().addClass("active"),n.$(".section-tabs li").not(t).removeClass("active"),t.addClass("active")}).eq(0).click(),this.$(".toolbar select").change(function(){n.setActivateSelector(e(this).find(":selected").data("selector"))})},setRuleValue:function(e,t){if("undefined"!=typeof this.activeSelector&&"undefined"!=typeof this.activeSelector.rules){for(var i=!0,s=0;s<this.activeSelector.rules.length;s++)if(this.activeSelector.rules[s].directive===e){this.activeSelector.rules[s].value=t,i=!1;break}i&&this.activeSelector.rules.push({directive:e,value:t}),this.updateMainEditor(!1)}},getRuleValue:function(e){if("undefined"==typeof this.activeSelector||"undefined"==typeof this.activeSelector.rules)return"";for(var t=0;t<this.activeSelector.rules.length;t++)if(this.activeSelector.rules[t].directive===e)return this.activeSelector.rules[t].value;return""},updateMainEditor:function(e){var t;"undefined"==typeof e||e===!0?(t=this.parser.compressCSS(this.parsed),t=t.filter(function(e){return"undefined"!=typeof e.type||e.rules.length>0})):t=this.parsed,this.editor.codeMirror.setValue(this.parser.getCSSForEditor(t).trim())},show:function(){this.editorExpandedBefore=this.editor.isExpanded(),this.editor.setExpand(!0),this.$el.show().animate({left:0},"fast")},hide:function(){this.editor.setExpand(this.editorExpandedBefore),this.$el.animate({left:-338},"fast",function(){e(this).hide()}),this.updateMainEditor(!0)},isVisible:function(){return this.$el.is(":visible")},loadCSS:function(t,i){this.css=t,this.parsed=this.parser.compressCSS(this.parser.parseCSS(t));for(var s=this.$(".toolbar select").empty(),n=0;n<this.parsed.length;n++){var r=this.parsed[n];if("undefined"!=typeof r.subStyles)for(var o=0;o<r.subStyles.length;o++){var a=r.subStyles[o];s.append(e("<option>").html(r.selector+": "+a.selector).attr("val",r.selector+": "+a.selector).data("selector",a))}else s.append(e("<option>").html(r.selector).attr("val",r.selector).data("selector",r))}"undefined"==typeof i&&(i=s.find("option").eq(0).attr("val")),s.val(i).change()},setActivateSelector:function(e){this.activeSelector=e;for(var t=0;t<this.propertyControllers.length;t++)this.propertyControllers[t].refreshFromRule()},addSelector:function(e){var t=this.$(".toolbar select");t.val(e),t.val()===e?t.change():(this.editor.addEmptySelector(e),this.loadCSS(this.editor.codeMirror.getValue(),e)),t.addClass("highlighted"),setTimeout(function(){t.removeClass("highlighted")},2e3)}}),s.view.propertyController=Backbone.View.extend({template:t.template('<input type="text" value="" />'),activeRule:null,args:null,propertiesView:null,initialize:function(e){this.args=e.args,this.propertiesView=e.propertiesView,this.on("set_value",this.updateRule,this),this.on("change",this.updateRule,this)},render:function(){this.$el.append(e(this.template({}))),this.field=this.$("input")},initChangeEvents:function(){var t=this;this.field.on("change keyup",function(){t.trigger("change",e(this).val())})},updateRule:function(){this.propertiesView.setRuleValue(this.args.property,this.getValue())},refreshFromRule:function(){var e=this.propertiesView.getRuleValue(this.args.property);this.setValue(e,{silent:!0})},getValue:function(){return this.field.val()},setValue:function(e,i){i=t.extend({silent:!1},i),this.field.val(e),i.silent||this.trigger("set_value",e)},reset:function(e){e=t.extend({silent:!1},e),this.setValue("",e)}}),s.view.properties.controllers={},s.view.properties.controllers.color=s.view.propertyController.extend({template:t.template('<input type="text" value="" />'),render:function(){this.$el.append(e(this.template({}))),this.field=this.$el.find("input"),this.field.minicolors({})},initChangeEvents:function(){var e=this;this.field.on("change keyup",function(){e.trigger("change",e.field.minicolors("value"))})},getValue:function(){return this.field.minicolors("value")},setValue:function(e,i){i=t.extend({silent:!1},i),this.field.minicolors("value",e),i.silent||this.trigger("set_value",e)}}),s.view.properties.controllers.select=s.view.propertyController.extend({template:t.template("<select></select>"),render:function(){this.$el.append(e(this.template({}))),this.field=this.$el.find("select"),this.field.append(e('<option value=""></option>').html(""));for(var t in this.args.options)this.field.append(e("<option></option>").attr("value",t).html(this.args.options[t]));"undefined"!=typeof this.args.option_icons&&this.setupVisualSelect()},setupVisualSelect:function(){var t=this;this.field.hide();var i=e('<div class="select-tabs"></div>').appendTo(this.$el);e('<div class="select-tab" data-value=""><span class="fa fa-circle-o"></span></div>').appendTo(i);for(var s in this.args.option_icons)e('<div class="select-tab"></div>').appendTo(i).append(e('<span class="fa"></span>').addClass("fa-"+this.args.option_icons[s])).attr("data-value",s);i.find(".select-tab").css("width",100/i.find(">div").length+"%").click(function(){var s=e(this);i.find(".select-tab").removeClass("active"),s.addClass("active"),t.field.val(s.data("value")).change()})},setValue:function(e,i){i=t.extend({silent:!1},i),this.field.val(e),this.$(".select-tabs .select-tab").removeClass("active").filter('[data-value="'+e+'"]').addClass("active"),i.silent||this.trigger("set_value",e)}}),s.view.properties.controllers.image=s.view.propertyController.extend({template:t.template('<input type="text" value="" /> <span class="select socss-button"><span class="fa fa-upload"></span></span>'),render:function(){var t=this;this.media=wp.media({title:i.loc.select_image,library:{type:"image"},button:{text:i.loc.select,close:!1}}),this.$el.append(e(this.template({select:i.loc.select}))),this.field=this.$el.find("input"),this.$(".select").click(function(){t.media.open()}),this.media.on("select",function(){var e=this.state().get("selection").first().attributes,i=t.args.value.replace("{{url}}",e.url);t.field.val(i).change(),t.media.close()},this.media)}}),s.view.properties.controllers.measurement=s.view.propertyController.extend({wrapperClass:"socss-field-measurement",render:function(){this.$el.append(e(this.template({}))),this.field=this.$("input"),this.setupMeasurementField(this.field,{})},setValue:function(e,i){i=t.extend({silent:!1},i),this.field.val(e).trigger("measurement_refresh"),i.silent||this.trigger("set_value",e)},units:["px","%","em","cm","mm","in","pt","pc","ex","ch","rem","vw","vh","vmin","vmax"],parseUnits:function(e){var t=function(e){return e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")},i=this.units.map(t),s=new RegExp("([0-9\\.\\-]+)("+i.join("|")+")?","i"),n=s.exec(e);return null===n?{value:"",unit:""}:{value:n[1],unit:void 0===n[2]?"":n[2]}},setupMeasurementField:function(i,s){var n=this,r=i.parent();s=t.extend({defaultUnit:"px"},s),i.hide(),r.addClass(this.wrapperClass).data("unit",s.defaultUnit);for(var o=e('<input type="text" class="socss-field-input"/>').appendTo(r),a=e('<span class="dashicons dashicons-arrow-down"></span>').appendTo(r),l=e('<ul class="dropdown"></ul>').appendTo(r),c=e('<span class="units"></span>').html(s.defaultUnit).appendTo(r),d=0;d<n.units.length;d++){var p=e("<li></li>").html(n.units[d]).data("unit",n.units[d]);n.units[d]===s.defaultUnit&&p.addClass("active"),l.append(p)}var h=function(){var e=n.parseUnits(o.val());""!==e.unit&&e.unit!==r.data("unit")&&(o.val(e.value),u(e.unit)),""===e.value?i.val(""):i.val(e.value+r.data("unit"))},u=function(e){c.html(e),r.data("unit",e),o.trigger("keydown")};a.click(function(){l.toggle()}),l.find("li").click(function(){l.toggle(),u(e(this).data("unit")),h(),i.trigger("change")}),o.on("keyup keydown",function(t){var i=(e(this),"");"keydown"===t.type&&(t.keyCode>=48&&t.keyCode<=57?i=String.fromCharCode(t.keyCode):189===t.keyCode?i="-":190===t.keyCode&&(i="."));var s=e('<span class="socss-hidden-placeholder"></span>').css({"font-size":"14px"}).html(o.val()+i).appendTo("body"),n=s.width();n=Math.min(n,63),s.remove(),c.css("left",n+12)}),o.on("keyup",function(e){h(),i.trigger("change")}),i.on("measurement_refresh",function(){var t=n.parseUnits(i.val());o.val(t.value);var a=""===t.unit?s.defaultUnit:t.unit;r.data("unit",a),c.html(a);var l=e('<span class="socss-hidden-placeholder"></span>').css({"font-size":"14px"}).html(t.value).appendTo("body"),d=l.width();d=Math.min(d,63),l.remove(),c.css("left",d+12)});var v=e('<div class="socss-diw"></div>').appendTo(r),f=e('<div class="dec-button socss-button"><span class="fa fa-minus"></span></div>').appendTo(v),g=e('<div class="inc-button socss-button"><span class="fa fa-plus"></span></div>').appendTo(v);g.click(function(){var e=n.parseUnits(i.val());if(""===e.value)return!0;var t=Math.ceil(1.05*e.value);o.val(t),h(),i.trigger("change").trigger("measurement_refresh")}),f.click(function(){var e=n.parseUnits(i.val());if(""===e.value)return!0;var t=Math.floor(e.value/1.05);o.val(t),h(),i.trigger("change").trigger("measurement_refresh")})}}),s.view.properties.controllers.number=s.view.propertyController.extend({render:function(){this.$el.append(e(this.template({}))),this.field=this.$("input"),this.setupNumberField(this.field,this.args)},setupNumberField:function(i,s){s=t.extend({change:null,"default":0,increment:1,decrement:-1,max:null,min:null},s);var n=i.parent();n.addClass("socss-field-number");var r=e('<div class="socss-diw"></div>').appendTo(n),o=e('<div class="dec-button socss-button">-</div>').appendTo(r);e('<div class="inc-button socss-button">+</div>').appendTo(r);return r.find("> div").click(function(t){t.preventDefault();var n=s["default"];""!==i.val()&&(n=Number(i.val())),n+=e(this).is(o)?s.decrement:s.increment,n=Math.round(100*n)/100,null!==s.max&&(n=Math.min(s.max,n)),null!==s.min&&(n=Math.max(s.min,n)),i.val(n),i.trigger("change")}),this}}),s.view.properties.controllers.sides=s.view.propertyController.extend({template:t.template(e("#template-sides-field").html().trim()),controllers:[],render:function(){var i=this;this.$el.append(e(this.template({}))),this.field=this.$el.find("input"),i.args.hasAll||(this.$(".select-tab").eq(0).remove(),this.$(".select-tab").css("width","25%")),this.$(".select-tab").each(function(){for(var n=e(this).data("direction"),r=e('<li class="side">').appendTo(i.$(".sides")).hide(),o=0;o<i.args.controllers.length;o++){var a=i.args.controllers[o],l="";l="all"===n?a.args.propertyAll:a.args.property.replace("{dir}",n);var c=t.extend({},a.args,{property:l}),d=new s.view.properties.controllers[a.type]({el:e("<div>").appendTo(r),propertiesView:i.propertiesView,args:c});d.render(),d.initChangeEvents(),i.propertiesView.propertyControllers.push(d)}e(this).on("click",function(){i.$(".select-tab").removeClass("active"),e(this).addClass("active"),i.$(".sides .side").hide(),r.show()})}),this.$(".select-tab").eq(0).click()}})}(jQuery,_,socssOptions),jQuery(function(e){var t=window.socss,i=new t.view.editor({el:e("#so-custom-css-form").get(0)});i.render(),i.setSnippets(socssOptions.snippets),window.socss.mainEditor=i,e("#so-custom-css-getting-started a.hide").click(function(t){t.preventDefault(),e("#so-custom-css-getting-started").slideUp(),e.get(e(this).attr("href"))})});
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
js/inspector.min.js CHANGED
@@ -1,26 +1 @@
1
-
2
- (function($,_,socssOptions){var socss={model:{},collection:{},view:{},fn:{}};socss.view.inspector=Backbone.View.extend({active:false,hl:false,hoverEl:false,pageSelectors:[],selectorTemplate:_.template('<div class="socss-selector"><%= selector %></div>'),initialize:function(){var thisView=this;this.hl=new socss.view.highlighter();this.hl.initialize();this.pageSelectors=socss.fn.pageSelectors();$('body').on('mouseover','*',function(e){if(!thisView.active){return true;}
3
- var $$=$(this);if($$.closest('.socss-element').length===0){e.stopPropagation();thisView.setHoverEl($(this));}});$('body *').click(function(e){if(!thisView.active||thisView.$el.is(':hover')){return true;}
4
- e.preventDefault();e.stopPropagation();var $$=$(this);$$.blur();thisView.setActiveEl(thisView.hoverEl);});this.$('.socss-enable-inspector').click(function(){thisView.toggleActive();});this.$el.mouseenter(function(){thisView.hl.clear();});try{parent.socss.mainEditor.setInspector(this);}
5
- catch(err){console.log('No editor to register this inspector with');}},setHoverEl:function(hoverEl){this.hoverEl=hoverEl;this.hl.highlight(hoverEl);},activate:function(){this.active=true;$('body').addClass('socss-active');$('body').removeClass('socss-inactive');},deactivate:function(){this.active=false;$('body').addClass('socss-inactive');$('body').removeClass('socss-active');this.hl.clear();this.$('.socss-hierarchy').empty();},toggleActive:function(){if(this.active){this.deactivate();}
6
- else{this.activate();}},setActiveEl:function(el){var thisView=this;var $h=this.$('.socss-hierarchy');$h.empty();if(el.prop('tagName').toLowerCase()!=='body'){var cel=$(el);do{$(this.selectorTemplate({selector:socss.fn.elSelector(cel)})).prependTo($h).data('el',cel);cel=cel.parent();}while(cel.prop('tagName').toLowerCase()!=='body');$(this.selectorTemplate({selector:'body'})).prependTo($h).data('el',$('body'));this.$('.socss-hierarchy .socss-selector').hover(function(){thisView.hl.highlight($(this).data('el'));}).click(function(e){e.preventDefault();e.stopPropagation();thisView.setActiveEl($(this).data('el'));});}
7
- $h.scrollLeft(99999);var selectors=this.pageSelectors.filter(function(a){try{return el.is(a.selector);}
8
- catch(err){return false;}});var container=this.$('.socss-selectors-window').empty();_.each(selectors,function(selector){container.append($(thisView.selectorTemplate(selector)).data(selector));});container.find('> div').mouseenter(function(){thisView.hl.highlight($(this).data('selector'));}).click(function(e){e.preventDefault();e.stopPropagation();thisView.trigger('click_selector',$(this).data('selector'));});var attributes=socss.fn.elementAttributes(el);container=this.$('.socss-properties-window').empty();_.each(attributes,function(v,k){container.append($(thisView.selectorTemplate({selector:'<strong>'+k+'</strong>: '+v})).data('property',k+': '+v));});container.find('> div').click(function(e){e.preventDefault();e.stopPropagation();thisView.trigger('click_property',$(this).data('property'));});var link=el.closest('a[href]');var linkContainer=this.$('.socss-link');if(link.length){linkContainer.show().find('a').html(link.attr('href').replace(/[\?&]*so_css_preview=1/,'')).attr('href',link.attr('href'));}
9
- else{linkContainer.hide();}
10
- this.trigger('set_active_element',el,selectors);}});socss.view.highlighter=Backbone.View.extend({template:_.template($('#socss-template-hover').html().trim()),highlighted:[],highlight:function(els){this.clear();var thisView=this;$(els).each(function(i,el){el=$(el);if(!el.is(':visible')){return true;}
11
- var hl=$(thisView.template());hl.css({'top':el.offset().top,'left':el.offset().left,'width':el.outerWidth(),'height':el.outerHeight()}).appendTo('body');var g;var padding=el.padding();for(var k in padding){if(parseInt(padding[k])>0){g=hl.find('.socss-guide-padding.socss-guide-'+k).show();if(k==='top'||k==='bottom'){g.css('height',padding[k]);}
12
- else{g.css('width',padding[k]);g.css({'width':padding[k],'top':padding.top,'bottom':padding.bottom});}}}
13
- var margin=el.margin();for(var k in margin){if(parseInt(margin[k])>0){g=hl.find('.socss-guide-margin.socss-guide-'+k).show();if(k==='top'||k==='bottom'){g.css('height',margin[k]);}
14
- else{g.css('width',margin[k]);}}}
15
- thisView.highlighted.push(hl);});},clear:function(){while(this.highlighted.length){this.highlighted.pop().remove();}}});socss.parsedCss={};socss.fn.getParsedCss=function(){if(Object.keys(socss.parsedCss).length===0){var parser=new cssjs();$('.socss-theme-styles').each(function(){var $$=$(this);var p=parser.parseCSS($$.html());socss.parsedCss[$$.attr('id')]=p;});}
16
- return socss.parsedCss;};socss.fn.pageSelectors=function(){var selectors=[];var parsedCss=socss.fn.getParsedCss();for(var k in parsedCss){for(var i=0;i<parsedCss[k].length;i++){if(typeof parsedCss[k][i].selector==='undefined'){continue;}
17
- var ruleSpecificity=SPECIFICITY.calculate(parsedCss[k][i].selector);for(var j=0;j<ruleSpecificity.length;j++){selectors.push({'selector':ruleSpecificity[j].selector.trim(),'specificity':parseInt(ruleSpecificity[j].specificity.replace(/,/g,''))});}}}
18
- $('body *').each(function(){var $$=$(this);var elName=socss.fn.elSelector($$);var ruleSpecificity=SPECIFICITY.calculate(elName);for(var k=0;k<ruleSpecificity.length;k++){selectors.push({'selector':ruleSpecificity[k].selector.trim(),'specificity':parseInt(ruleSpecificity[k].specificity.replace(/,/g,''))});}});selectors=_.uniq(selectors,false,function(a){return a.selector;});selectors.sort(function(a,b){return a.specificity>b.specificity?-1:1;});return selectors;};socss.fn.elementAttributes=function(el){if(!document.styleSheets){return[];}
19
- var elProperties=[];var trimFunc=function(e){return e.trim();};var filterFunc=function(e){return e!=='';};var splitFunc=function(e){return e.split(':').map(trimFunc);};var parsedCss=socss.fn.getParsedCss();for(var k in parsedCss){for(var i=0;i<parsedCss[k].length;i++){if(typeof parsedCss[k][i].selector==='undefined'||typeof parsedCss[k][i].type!=='undefined'||parsedCss[k][i].selector[0]==='@'){continue;}
20
- var ruleSpecificity=SPECIFICITY.calculate(parsedCss[k][i].selector);for(var j=0;j<ruleSpecificity.length;j++){try{if(el.is(ruleSpecificity[j].selector)){for(var l=0;l<parsedCss[k][i].rules.length;l++){elProperties.push({'name':parsedCss[k][i].rules[l].directive,'value':parsedCss[k][i].rules[l].value,'specificity':parseInt(ruleSpecificity[j].specificity.replace(/,/g,''))});}}}
21
- catch(e){}}}}
22
- elProperties.sort(function(a,b){return a.specificity>b.specificity?1:-1;}).reverse();var returnProperties={};for(var pi=0;pi<elProperties.length;pi++){if(typeof returnProperties[elProperties[pi].name]==='undefined'){returnProperties[elProperties[pi].name]=elProperties[pi].value;}}
23
- return returnProperties;};socss.fn.elSelector=function(el){var elName='';if(el.attr('id')!==undefined){elName+='#'+el.attr('id');}
24
- if(el.attr('class')!==undefined){elName+='.'+el.attr('class').replace(/\s+/,'.');}
25
- if(elName===''){elName=el.prop('tagName').toLowerCase();}
26
- return elName;};window.socssInspector=socss;})(jQuery,_,socssOptions);jQuery(function($){var socss=window.socssInspector;var inspector=new socss.view.inspector({el:$('#socss-inspector-interface').get(0)});inspector.activate();window.socssInspector.mainInspector=inspector;});
1
+ !function(e,t,s){var i={model:{},collection:{},view:{},fn:{}};i.view.inspector=Backbone.View.extend({active:!1,hl:!1,hoverEl:!1,pageSelectors:[],selectorTemplate:t.template('<div class="socss-selector"><%= selector %></div>'),initialize:function(){var t=this;this.hl=new i.view.highlighter,this.hl.initialize(),this.pageSelectors=i.fn.pageSelectors(),e("body").on("mouseover","*",function(s){if(!t.active)return!0;var i=e(this);0===i.closest(".socss-element").length&&(s.stopPropagation(),t.setHoverEl(e(this)))}),e("body *").click(function(s){if(!t.active||t.$el.is(":hover"))return!0;s.preventDefault(),s.stopPropagation();var i=e(this);i.blur(),t.setActiveEl(t.hoverEl)}),this.$(".socss-enable-inspector").click(function(){t.toggleActive()}),this.$el.mouseenter(function(){t.hl.clear()});try{parent.socss.mainEditor.setInspector(this)}catch(s){console.log("No editor to register this inspector with")}},setHoverEl:function(e){this.hoverEl=e,this.hl.highlight(e)},activate:function(){this.active=!0,e("body").addClass("socss-active"),e("body").removeClass("socss-inactive")},deactivate:function(){this.active=!1,e("body").addClass("socss-inactive"),e("body").removeClass("socss-active"),this.hl.clear(),this.$(".socss-hierarchy").empty()},toggleActive:function(){this.active?this.deactivate():this.activate()},setActiveEl:function(s){var r=this,o=this.$(".socss-hierarchy");if(o.empty(),"body"!==s.prop("tagName").toLowerCase()){var c=e(s);do e(this.selectorTemplate({selector:i.fn.elSelector(c)})).prependTo(o).data("el",c),c=c.parent();while("body"!==c.prop("tagName").toLowerCase());e(this.selectorTemplate({selector:"body"})).prependTo(o).data("el",e("body")),this.$(".socss-hierarchy .socss-selector").hover(function(){r.hl.highlight(e(this).data("el"))}).click(function(t){t.preventDefault(),t.stopPropagation(),r.setActiveEl(e(this).data("el"))})}o.scrollLeft(99999);var n=this.pageSelectors.filter(function(e){try{return s.is(e.selector)}catch(t){return!1}}),a=this.$(".socss-selectors-window").empty();t.each(n,function(t){a.append(e(r.selectorTemplate(t)).data(t))}),a.find("> div").mouseenter(function(){r.hl.highlight(e(this).data("selector"))}).click(function(t){t.preventDefault(),t.stopPropagation(),r.trigger("click_selector",e(this).data("selector"))});var l=i.fn.elementAttributes(s);a=this.$(".socss-properties-window").empty(),t.each(l,function(t,s){a.append(e(r.selectorTemplate({selector:"<strong>"+s+"</strong>: "+t})).data("property",s+": "+t))}),a.find("> div").click(function(t){t.preventDefault(),t.stopPropagation(),r.trigger("click_property",e(this).data("property"))});var h=s.closest("a[href]"),p=this.$(".socss-link");h.length?p.show().find("a").html(h.attr("href").replace(/[\?&]*so_css_preview=1/,"")).attr("href",h.attr("href")):p.hide(),this.trigger("set_active_element",s,n)}}),i.view.highlighter=Backbone.View.extend({template:t.template(e("#socss-template-hover").html().trim()),highlighted:[],highlight:function(t){this.clear();var s=this;e(t).each(function(t,i){if(i=e(i),!i.is(":visible"))return!0;var r=e(s.template());r.css({top:i.offset().top,left:i.offset().left,width:i.outerWidth(),height:i.outerHeight()}).appendTo("body");var o,c=i.padding();for(var n in c)parseInt(c[n])>0&&(o=r.find(".socss-guide-padding.socss-guide-"+n).show(),"top"===n||"bottom"===n?o.css("height",c[n]):(o.css("width",c[n]),o.css({width:c[n],top:c.top,bottom:c.bottom})));var a=i.margin();for(var n in a)parseInt(a[n])>0&&(o=r.find(".socss-guide-margin.socss-guide-"+n).show(),"top"===n||"bottom"===n?o.css("height",a[n]):o.css("width",a[n]));s.highlighted.push(r)})},clear:function(){for(;this.highlighted.length;)this.highlighted.pop().remove()}}),i.parsedCss={},i.fn.getParsedCss=function(){if(0===Object.keys(i.parsedCss).length){var t=new cssjs;e(".socss-theme-styles").each(function(){var s=e(this),r=t.parseCSS(s.html());i.parsedCss[s.attr("id")]=r})}return i.parsedCss},i.fn.pageSelectors=function(){var s=[],r=i.fn.getParsedCss();for(var o in r)for(var c=0;c<r[o].length;c++)if("undefined"!=typeof r[o][c].selector)for(var n=SPECIFICITY.calculate(r[o][c].selector),a=0;a<n.length;a++)s.push({selector:n[a].selector.trim(),specificity:parseInt(n[a].specificity.replace(/,/g,""))});return e("body *").each(function(){for(var t=e(this),r=i.fn.elSelector(t),o=SPECIFICITY.calculate(r),c=0;c<o.length;c++)s.push({selector:o[c].selector.trim(),specificity:parseInt(o[c].specificity.replace(/,/g,""))})}),s=t.uniq(s,!1,function(e){return e.selector}),s.sort(function(e,t){return e.specificity>t.specificity?-1:1}),s},i.fn.elementAttributes=function(e){if(!document.styleSheets)return[];var t=[],s=i.fn.getParsedCss();for(var r in s)for(var o=0;o<s[r].length;o++)if("undefined"!=typeof s[r][o].selector&&"undefined"==typeof s[r][o].type&&"@"!==s[r][o].selector[0])for(var c=SPECIFICITY.calculate(s[r][o].selector),n=0;n<c.length;n++)try{if(e.is(c[n].selector))for(var a=0;a<s[r][o].rules.length;a++)t.push({name:s[r][o].rules[a].directive,value:s[r][o].rules[a].value,specificity:parseInt(c[n].specificity.replace(/,/g,""))})}catch(l){}t.sort(function(e,t){return e.specificity>t.specificity?1:-1}).reverse();for(var h={},p=0;p<t.length;p++)"undefined"==typeof h[t[p].name]&&(h[t[p].name]=t[p].value);return h},i.fn.elSelector=function(e){var t="";return void 0!==e.attr("id")&&(t+="#"+e.attr("id")),void 0!==e.attr("class")&&(t+="."+e.attr("class").replace(/\s+/,".")),""===t&&(t=e.prop("tagName").toLowerCase()),t},window.socssInspector=i}(jQuery,_,socssOptions),jQuery(function(e){var t=window.socssInspector,s=new t.view.inspector({el:e("#socss-inspector-interface").get(0)});s.activate(),window.socssInspector.mainInspector=s});
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
js/jquery.sizes.min.js CHANGED
@@ -1,8 +1 @@
1
-
2
- (function($){'use strict';var num=function(value){return parseInt(value,10)||0;};$.each(['min','max'],function(i,name){$.fn[name+'Size']=function(value){var width,height;if(value){if(value.width!==undefined){this.css(name+'-width',value.width);}
3
- if(value.height!==undefined){this.css(name+'-height',value.height);}}else{width=this.css(name+'-width');height=this.css(name+'-height');return{'width':(name==='max'&&(width===undefined||width==='none'||num(width)===-1)&&Number.MAX_VALUE)||num(width),'height':(name==='max'&&(height===undefined||height==='none'||num(height)===-1)&&Number.MAX_VALUE)||num(height)};}
4
- return this;};});$.fn.isVisible=function(){return this.is(':visible');};$.each(['border','margin','padding'],function(i,name){$.fn[name]=function(value){if(value){if(value.top!==undefined){this.css(name+'-top'+(name==='border'?'-width':''),value.top);}
5
- if(value.bottom!==undefined){this.css(name+'-bottom'+(name==='border'?'-width':''),value.bottom);}
6
- if(value.left!==undefined){this.css(name+'-left'+(name==='border'?'-width':''),value.left);}
7
- if(value.right!==undefined){this.css(name+'-right'+(name==='border'?'-width':''),value.right);}}else{return{top:num(this.css(name+'-top'+(name==='border'?'-width':''))),bottom:num(this.css(name+'-bottom'+(name==='border'?'-width':''))),left:num(this.css(name+'-left'+(name==='border'?'-width':''))),right:num(this.css(name+'-right'+(name==='border'?'-width':'')))};}
8
- return this;};});}(jQuery));
1
+ !function(t){"use strict";var i=function(t){return parseInt(t,10)||0};t.each(["min","max"],function(s,h){t.fn[h+"Size"]=function(t){var s,o;return t?(void 0!==t.width&&this.css(h+"-width",t.width),void 0!==t.height&&this.css(h+"-height",t.height),this):(s=this.css(h+"-width"),o=this.css(h+"-height"),{width:"max"===h&&(void 0===s||"none"===s||-1===i(s))&&Number.MAX_VALUE||i(s),height:"max"===h&&(void 0===o||"none"===o||-1===i(o))&&Number.MAX_VALUE||i(o)})}}),t.fn.isVisible=function(){return this.is(":visible")},t.each(["border","margin","padding"],function(s,h){t.fn[h]=function(t){return t?(void 0!==t.top&&this.css(h+"-top"+("border"===h?"-width":""),t.top),void 0!==t.bottom&&this.css(h+"-bottom"+("border"===h?"-width":""),t.bottom),void 0!==t.left&&this.css(h+"-left"+("border"===h?"-width":""),t.left),void 0!==t.right&&this.css(h+"-right"+("border"===h?"-width":""),t.right),this):{top:i(this.css(h+"-top"+("border"===h?"-width":""))),bottom:i(this.css(h+"-bottom"+("border"===h?"-width":""))),left:i(this.css(h+"-left"+("border"===h?"-width":""))),right:i(this.css(h+"-right"+("border"===h?"-width":"")))}}})}(jQuery);
 
 
 
 
 
 
 
js/specificity.min.js CHANGED
@@ -1,3 +1 @@
1
-
2
- var SPECIFICITY=(function(){var calculate,calculateSingle;calculate=function(input){var selectors,selector,i,len,results=[];selectors=input.split(',');for(i=0,len=selectors.length;i<len;i+=1){selector=selectors[i];if(selector.length>0){results.push(calculateSingle(selector));}}
3
- return results;};calculateSingle=function(input){var selector=input,findMatch,typeCount={'a':0,'b':0,'c':0},parts=[],attributeRegex=/(\[[^\]]+\])/g,idRegex=/(#[^\s\+>~\.\[:]+)/g,classRegex=/(\.[^\s\+>~\.\[:]+)/g,pseudoElementRegex=/(::[^\s\+>~\.\[:]+|:first-line|:first-letter|:before|:after)/gi,pseudoClassWithBracketsRegex=/(:[\w-]+\([^\)]*\))/gi,pseudoClassRegex=/(:[^\s\+>~\.\[:]+)/g,elementRegex=/([^\s\+>~\.\[:]+)/g;findMatch=function(regex,type){var matches,i,len,match,index,length;if(regex.test(selector)){matches=selector.match(regex);for(i=0,len=matches.length;i<len;i+=1){typeCount[type]+=1;match=matches[i];index=selector.indexOf(match);length=match.length;parts.push({selector:match,type:type,index:index,length:length});selector=selector.replace(match,Array(length+1).join(' '));}}};(function(){var regex=/:not\(([^\)]*)\)/g;if(regex.test(selector)){selector=selector.replace(regex,' $1 ');}}());(function(){var regex=/{[^]*/gm,matches,i,len,match;if(regex.test(selector)){matches=selector.match(regex);for(i=0,len=matches.length;i<len;i+=1){match=matches[i];selector=selector.replace(match,Array(match.length+1).join(' '));}}}());findMatch(attributeRegex,'b');findMatch(idRegex,'a');findMatch(classRegex,'b');findMatch(pseudoElementRegex,'c');findMatch(pseudoClassWithBracketsRegex,'b');findMatch(pseudoClassRegex,'b');selector=selector.replace(/[\*\s\+>~]/g,' ');selector=selector.replace(/[#\.]/g,' ');findMatch(elementRegex,'c');parts.sort(function(a,b){return a.index-b.index;});return{selector:input,specificity:'0,'+typeCount.a.toString()+','+typeCount.b.toString()+','+typeCount.c.toString(),parts:parts};};return{calculate:calculate};}());
1
+ var SPECIFICITY=function(){var t,e;return t=function(t){var r,n,i,c,a=[];for(r=t.split(","),i=0,c=r.length;c>i;i+=1)n=r[i],n.length>0&&a.push(e(n));return a},e=function(t){var e,r=t,n={a:0,b:0,c:0},i=[],c=/(\[[^\]]+\])/g,a=/(#[^\s\+>~\.\[:]+)/g,g=/(\.[^\s\+>~\.\[:]+)/g,o=/(::[^\s\+>~\.\[:]+|:first-line|:first-letter|:before|:after)/gi,l=/(:[\w-]+\([^\)]*\))/gi,s=/(:[^\s\+>~\.\[:]+)/g,f=/([^\s\+>~\.\[:]+)/g;return e=function(t,e){var c,a,g,o,l,s;if(t.test(r))for(c=r.match(t),a=0,g=c.length;g>a;a+=1)n[e]+=1,o=c[a],l=r.indexOf(o),s=o.length,i.push({selector:o,type:e,index:l,length:s}),r=r.replace(o,Array(s+1).join(" "))},function(){var t=/:not\(([^\)]*)\)/g;t.test(r)&&(r=r.replace(t," $1 "))}(),function(){var t,e,n,i,c=/{[^]*/gm;if(c.test(r))for(t=r.match(c),e=0,n=t.length;n>e;e+=1)i=t[e],r=r.replace(i,Array(i.length+1).join(" "))}(),e(c,"b"),e(a,"a"),e(g,"b"),e(o,"c"),e(l,"b"),e(s,"b"),r=r.replace(/[\*\s\+>~]/g," "),r=r.replace(/[#\.]/g," "),e(f,"c"),i.sort(function(t,e){return t.index-e.index}),{selector:t,specificity:"0,"+n.a.toString()+","+n.b.toString()+","+n.c.toString(),parts:i}},{calculate:t}}();
 
 
lib/codemirror/addon/fold/brace-fold.min.js CHANGED
@@ -1,15 +1 @@
1
-
2
- (function(mod){if(typeof exports=="object"&&typeof module=="object")
3
- mod(require("../../lib/codemirror"));else if(typeof define=="function"&&define.amd)
4
- define(["../../lib/codemirror"],mod);else
5
- mod(CodeMirror);})(function(CodeMirror){"use strict";CodeMirror.registerHelper("fold","brace",function(cm,start){var line=start.line,lineText=cm.getLine(line);var startCh,tokenType;function findOpening(openCh){for(var at=start.ch,pass=0;;){var found=at<=0?-1:lineText.lastIndexOf(openCh,at-1);if(found==-1){if(pass==1)break;pass=1;at=lineText.length;continue;}
6
- if(pass==1&&found<start.ch)break;tokenType=cm.getTokenTypeAt(CodeMirror.Pos(line,found+1));if(!/^(comment|string)/.test(tokenType))return found+1;at=found-1;}}
7
- var startToken="{",endToken="}",startCh=findOpening("{");if(startCh==null){startToken="[",endToken="]";startCh=findOpening("[");}
8
- if(startCh==null)return;var count=1,lastLine=cm.lastLine(),end,endCh;outer:for(var i=line;i<=lastLine;++i){var text=cm.getLine(i),pos=i==line?startCh:0;for(;;){var nextOpen=text.indexOf(startToken,pos),nextClose=text.indexOf(endToken,pos);if(nextOpen<0)nextOpen=text.length;if(nextClose<0)nextClose=text.length;pos=Math.min(nextOpen,nextClose);if(pos==text.length)break;if(cm.getTokenTypeAt(CodeMirror.Pos(i,pos+1))==tokenType){if(pos==nextOpen)++count;else if(!--count){end=i;endCh=pos;break outer;}}
9
- ++pos;}}
10
- if(end==null||line==end&&endCh==startCh)return;return{from:CodeMirror.Pos(line,startCh),to:CodeMirror.Pos(end,endCh)};});CodeMirror.registerHelper("fold","import",function(cm,start){function hasImport(line){if(line<cm.firstLine()||line>cm.lastLine())return null;var start=cm.getTokenAt(CodeMirror.Pos(line,1));if(!/\S/.test(start.string))start=cm.getTokenAt(CodeMirror.Pos(line,start.end+1));if(start.type!="keyword"||start.string!="import")return null;for(var i=line,e=Math.min(cm.lastLine(),line+10);i<=e;++i){var text=cm.getLine(i),semi=text.indexOf(";");if(semi!=-1)return{startCh:start.end,end:CodeMirror.Pos(i,semi)};}}
11
- var start=start.line,has=hasImport(start),prev;if(!has||hasImport(start-1)||((prev=hasImport(start-2))&&prev.end.line==start-1))
12
- return null;for(var end=has.end;;){var next=hasImport(end.line+1);if(next==null)break;end=next.end;}
13
- return{from:cm.clipPos(CodeMirror.Pos(start,has.startCh+1)),to:end};});CodeMirror.registerHelper("fold","include",function(cm,start){function hasInclude(line){if(line<cm.firstLine()||line>cm.lastLine())return null;var start=cm.getTokenAt(CodeMirror.Pos(line,1));if(!/\S/.test(start.string))start=cm.getTokenAt(CodeMirror.Pos(line,start.end+1));if(start.type=="meta"&&start.string.slice(0,8)=="#include")return start.start+8;}
14
- var start=start.line,has=hasInclude(start);if(has==null||hasInclude(start-1)!=null)return null;for(var end=start;;){var next=hasInclude(end+1);if(next==null)break;++end;}
15
- return{from:CodeMirror.Pos(start,has+1),to:cm.clipPos(CodeMirror.Pos(end))};});});
1
+ !function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";e.registerHelper("fold","brace",function(r,n){function t(t){for(var i=n.ch,s=0;;){var u=0>=i?-1:f.lastIndexOf(t,i-1);if(-1!=u){if(1==s&&u<n.ch)break;if(o=r.getTokenTypeAt(e.Pos(l,u+1)),!/^(comment|string)/.test(o))return u+1;i=u-1}else{if(1==s)break;s=1,i=f.length}}}var i,o,l=n.line,f=r.getLine(l),s="{",u="}",i=t("{");if(null==i&&(s="[",u="]",i=t("[")),null!=i){var a,d,c=1,g=r.lastLine();e:for(var v=l;g>=v;++v)for(var p=r.getLine(v),m=v==l?i:0;;){var P=p.indexOf(s,m),k=p.indexOf(u,m);if(0>P&&(P=p.length),0>k&&(k=p.length),m=Math.min(P,k),m==p.length)break;if(r.getTokenTypeAt(e.Pos(v,m+1))==o)if(m==P)++c;else if(!--c){a=v,d=m;break e}++m}if(null!=a&&(l!=a||d!=i))return{from:e.Pos(l,i),to:e.Pos(a,d)}}}),e.registerHelper("fold","import",function(r,n){function t(n){if(n<r.firstLine()||n>r.lastLine())return null;var t=r.getTokenAt(e.Pos(n,1));if(/\S/.test(t.string)||(t=r.getTokenAt(e.Pos(n,t.end+1))),"keyword"!=t.type||"import"!=t.string)return null;for(var i=n,o=Math.min(r.lastLine(),n+10);o>=i;++i){var l=r.getLine(i),f=l.indexOf(";");if(-1!=f)return{startCh:t.end,end:e.Pos(i,f)}}}var i,n=n.line,o=t(n);if(!o||t(n-1)||(i=t(n-2))&&i.end.line==n-1)return null;for(var l=o.end;;){var f=t(l.line+1);if(null==f)break;l=f.end}return{from:r.clipPos(e.Pos(n,o.startCh+1)),to:l}}),e.registerHelper("fold","include",function(r,n){function t(n){if(n<r.firstLine()||n>r.lastLine())return null;var t=r.getTokenAt(e.Pos(n,1));return/\S/.test(t.string)||(t=r.getTokenAt(e.Pos(n,t.end+1))),"meta"==t.type&&"#include"==t.string.slice(0,8)?t.start+8:void 0}var n=n.line,i=t(n);if(null==i||null!=t(n-1))return null;for(var o=n;;){var l=t(o+1);if(null==l)break;++o}return{from:e.Pos(n,i+1),to:r.clipPos(e.Pos(o))}})});
 
 
 
 
 
 
 
 
 
 
 
 
 
 
lib/codemirror/addon/fold/comment-fold.min.js CHANGED
@@ -1,10 +1 @@
1
-
2
- (function(mod){if(typeof exports=="object"&&typeof module=="object")
3
- mod(require("../../lib/codemirror"));else if(typeof define=="function"&&define.amd)
4
- define(["../../lib/codemirror"],mod);else
5
- mod(CodeMirror);})(function(CodeMirror){"use strict";CodeMirror.registerGlobalHelper("fold","comment",function(mode){return mode.blockCommentStart&&mode.blockCommentEnd;},function(cm,start){var mode=cm.getModeAt(start),startToken=mode.blockCommentStart,endToken=mode.blockCommentEnd;if(!startToken||!endToken)return;var line=start.line,lineText=cm.getLine(line);var startCh;for(var at=start.ch,pass=0;;){var found=at<=0?-1:lineText.lastIndexOf(startToken,at-1);if(found==-1){if(pass==1)return;pass=1;at=lineText.length;continue;}
6
- if(pass==1&&found<start.ch)return;if(/comment/.test(cm.getTokenTypeAt(CodeMirror.Pos(line,found+1)))){startCh=found+startToken.length;break;}
7
- at=found-1;}
8
- var depth=1,lastLine=cm.lastLine(),end,endCh;outer:for(var i=line;i<=lastLine;++i){var text=cm.getLine(i),pos=i==line?startCh:0;for(;;){var nextOpen=text.indexOf(startToken,pos),nextClose=text.indexOf(endToken,pos);if(nextOpen<0)nextOpen=text.length;if(nextClose<0)nextClose=text.length;pos=Math.min(nextOpen,nextClose);if(pos==text.length)break;if(pos==nextOpen)++depth;else if(!--depth){end=i;endCh=pos;break outer;}
9
- ++pos;}}
10
- if(end==null||line==end&&endCh==startCh)return;return{from:CodeMirror.Pos(line,startCh),to:CodeMirror.Pos(end,endCh)};});});
1
+ !function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";e.registerGlobalHelper("fold","comment",function(e){return e.blockCommentStart&&e.blockCommentEnd},function(t,n){var o=t.getModeAt(n),r=o.blockCommentStart,i=o.blockCommentEnd;if(r&&i){for(var f,l=n.line,c=t.getLine(l),m=n.ch,a=0;;){var d=0>=m?-1:c.lastIndexOf(r,m-1);if(-1!=d){if(1==a&&d<n.ch)return;if(/comment/.test(t.getTokenTypeAt(e.Pos(l,d+1)))){f=d+r.length;break}m=d-1}else{if(1==a)return;a=1,m=c.length}}var u,b,s=1,g=t.lastLine();e:for(var h=l;g>=h;++h)for(var k=t.getLine(h),v=h==l?f:0;;){var p=k.indexOf(r,v),C=k.indexOf(i,v);if(0>p&&(p=k.length),0>C&&(C=k.length),v=Math.min(p,C),v==k.length)break;if(v==p)++s;else if(!--s){u=h,b=v;break e}++v}if(null!=u&&(l!=u||b!=f))return{from:e.Pos(l,f),to:e.Pos(u,b)}}})});
 
 
 
 
 
 
 
 
 
lib/codemirror/addon/fold/foldcode.min.js CHANGED
@@ -1,18 +1 @@
1
-
2
- (function(mod){if(typeof exports=="object"&&typeof module=="object")
3
- mod(require("../../lib/codemirror"));else if(typeof define=="function"&&define.amd)
4
- define(["../../lib/codemirror"],mod);else
5
- mod(CodeMirror);})(function(CodeMirror){"use strict";function doFold(cm,pos,options,force){if(options&&options.call){var finder=options;options=null;}else{var finder=getOption(cm,options,"rangeFinder");}
6
- if(typeof pos=="number")pos=CodeMirror.Pos(pos,0);var minSize=getOption(cm,options,"minFoldSize");function getRange(allowFolded){var range=finder(cm,pos);if(!range||range.to.line-range.from.line<minSize)return null;var marks=cm.findMarksAt(range.from);for(var i=0;i<marks.length;++i){if(marks[i].__isFold&&force!=="fold"){if(!allowFolded)return null;range.cleared=true;marks[i].clear();}}
7
- return range;}
8
- var range=getRange(true);if(getOption(cm,options,"scanUp"))while(!range&&pos.line>cm.firstLine()){pos=CodeMirror.Pos(pos.line-1,0);range=getRange(false);}
9
- if(!range||range.cleared||force==="unfold")return;var myWidget=makeWidget(cm,options);CodeMirror.on(myWidget,"mousedown",function(e){myRange.clear();CodeMirror.e_preventDefault(e);});var myRange=cm.markText(range.from,range.to,{replacedWith:myWidget,clearOnEnter:true,__isFold:true});myRange.on("clear",function(from,to){CodeMirror.signal(cm,"unfold",cm,from,to);});CodeMirror.signal(cm,"fold",cm,range.from,range.to);}
10
- function makeWidget(cm,options){var widget=getOption(cm,options,"widget");if(typeof widget=="string"){var text=document.createTextNode(widget);widget=document.createElement("span");widget.appendChild(text);widget.className="CodeMirror-foldmarker";}
11
- return widget;}
12
- CodeMirror.newFoldFunction=function(rangeFinder,widget){return function(cm,pos){doFold(cm,pos,{rangeFinder:rangeFinder,widget:widget});};};CodeMirror.defineExtension("foldCode",function(pos,options,force){doFold(this,pos,options,force);});CodeMirror.defineExtension("isFolded",function(pos){var marks=this.findMarksAt(pos);for(var i=0;i<marks.length;++i)
13
- if(marks[i].__isFold)return true;});CodeMirror.commands.toggleFold=function(cm){cm.foldCode(cm.getCursor());};CodeMirror.commands.fold=function(cm){cm.foldCode(cm.getCursor(),null,"fold");};CodeMirror.commands.unfold=function(cm){cm.foldCode(cm.getCursor(),null,"unfold");};CodeMirror.commands.foldAll=function(cm){cm.operation(function(){for(var i=cm.firstLine(),e=cm.lastLine();i<=e;i++)
14
- cm.foldCode(CodeMirror.Pos(i,0),null,"fold");});};CodeMirror.commands.unfoldAll=function(cm){cm.operation(function(){for(var i=cm.firstLine(),e=cm.lastLine();i<=e;i++)
15
- cm.foldCode(CodeMirror.Pos(i,0),null,"unfold");});};CodeMirror.registerHelper("fold","combine",function(){var funcs=Array.prototype.slice.call(arguments,0);return function(cm,start){for(var i=0;i<funcs.length;++i){var found=funcs[i](cm,start);if(found)return found;}};});CodeMirror.registerHelper("fold","auto",function(cm,start){var helpers=cm.getHelpers(start,"fold");for(var i=0;i<helpers.length;i++){var cur=helpers[i](cm,start);if(cur)return cur;}});var defaultOptions={rangeFinder:CodeMirror.fold.auto,widget:"\u2194",minFoldSize:0,scanUp:false};CodeMirror.defineOption("foldOptions",null);function getOption(cm,options,name){if(options&&options[name]!==undefined)
16
- return options[name];var editorOptions=cm.options.foldOptions;if(editorOptions&&editorOptions[name]!==undefined)
17
- return editorOptions[name];return defaultOptions[name];}
18
- CodeMirror.defineExtension("foldOption",function(options,name){return getOption(this,options,name);});});
1
+ !function(n){"object"==typeof exports&&"object"==typeof module?n(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],n):n(CodeMirror)}(function(n){"use strict";function o(o,i,t,f){function l(n){var e=d(o,i);if(!e||e.to.line-e.from.line<u)return null;for(var r=o.findMarksAt(e.from),t=0;t<r.length;++t)if(r[t].__isFold&&"fold"!==f){if(!n)return null;e.cleared=!0,r[t].clear()}return e}if(t&&t.call){var d=t;t=null}else var d=r(o,t,"rangeFinder");"number"==typeof i&&(i=n.Pos(i,0));var u=r(o,t,"minFoldSize"),a=l(!0);if(r(o,t,"scanUp"))for(;!a&&i.line>o.firstLine();)i=n.Pos(i.line-1,0),a=l(!1);if(a&&!a.cleared&&"unfold"!==f){var c=e(o,t);n.on(c,"mousedown",function(o){s.clear(),n.e_preventDefault(o)});var s=o.markText(a.from,a.to,{replacedWith:c,clearOnEnter:!0,__isFold:!0});s.on("clear",function(e,r){n.signal(o,"unfold",o,e,r)}),n.signal(o,"fold",o,a.from,a.to)}}function e(n,o){var e=r(n,o,"widget");if("string"==typeof e){var i=document.createTextNode(e);e=document.createElement("span"),e.appendChild(i),e.className="CodeMirror-foldmarker"}return e}function r(n,o,e){if(o&&void 0!==o[e])return o[e];var r=n.options.foldOptions;return r&&void 0!==r[e]?r[e]:i[e]}n.newFoldFunction=function(n,e){return function(r,i){o(r,i,{rangeFinder:n,widget:e})}},n.defineExtension("foldCode",function(n,e,r){o(this,n,e,r)}),n.defineExtension("isFolded",function(n){for(var o=this.findMarksAt(n),e=0;e<o.length;++e)if(o[e].__isFold)return!0}),n.commands.toggleFold=function(n){n.foldCode(n.getCursor())},n.commands.fold=function(n){n.foldCode(n.getCursor(),null,"fold")},n.commands.unfold=function(n){n.foldCode(n.getCursor(),null,"unfold")},n.commands.foldAll=function(o){o.operation(function(){for(var e=o.firstLine(),r=o.lastLine();r>=e;e++)o.foldCode(n.Pos(e,0),null,"fold")})},n.commands.unfoldAll=function(o){o.operation(function(){for(var e=o.firstLine(),r=o.lastLine();r>=e;e++)o.foldCode(n.Pos(e,0),null,"unfold")})},n.registerHelper("fold","combine",function(){var n=Array.prototype.slice.call(arguments,0);return function(o,e){for(var r=0;r<n.length;++r){var i=n[r](o,e);if(i)return i}}}),n.registerHelper("fold","auto",function(n,o){for(var e=n.getHelpers(o,"fold"),r=0;r<e.length;r++){var i=e[r](n,o);if(i)return i}});var i={rangeFinder:n.fold.auto,widget:"↔",minFoldSize:0,scanUp:!1};n.defineOption("foldOptions",null),n.defineExtension("foldOption",function(n,o){return r(this,n,o)})});
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
lib/codemirror/addon/fold/foldgutter.min.js CHANGED
@@ -1,20 +1 @@
1
-
2
- (function(mod){if(typeof exports=="object"&&typeof module=="object")
3
- mod(require("../../lib/codemirror"),require("./foldcode"));else if(typeof define=="function"&&define.amd)
4
- define(["../../lib/codemirror","./foldcode"],mod);else
5
- mod(CodeMirror);})(function(CodeMirror){"use strict";CodeMirror.defineOption("foldGutter",false,function(cm,val,old){if(old&&old!=CodeMirror.Init){cm.clearGutter(cm.state.foldGutter.options.gutter);cm.state.foldGutter=null;cm.off("gutterClick",onGutterClick);cm.off("change",onChange);cm.off("viewportChange",onViewportChange);cm.off("fold",onFold);cm.off("unfold",onFold);cm.off("swapDoc",updateInViewport);}
6
- if(val){cm.state.foldGutter=new State(parseOptions(val));updateInViewport(cm);cm.on("gutterClick",onGutterClick);cm.on("change",onChange);cm.on("viewportChange",onViewportChange);cm.on("fold",onFold);cm.on("unfold",onFold);cm.on("swapDoc",updateInViewport);}});var Pos=CodeMirror.Pos;function State(options){this.options=options;this.from=this.to=0;}
7
- function parseOptions(opts){if(opts===true)opts={};if(opts.gutter==null)opts.gutter="CodeMirror-foldgutter";if(opts.indicatorOpen==null)opts.indicatorOpen="CodeMirror-foldgutter-open";if(opts.indicatorFolded==null)opts.indicatorFolded="CodeMirror-foldgutter-folded";return opts;}
8
- function isFolded(cm,line){var marks=cm.findMarksAt(Pos(line));for(var i=0;i<marks.length;++i)
9
- if(marks[i].__isFold&&marks[i].find().from.line==line)return marks[i];}
10
- function marker(spec){if(typeof spec=="string"){var elt=document.createElement("div");elt.className=spec+" CodeMirror-guttermarker-subtle";return elt;}else{return spec.cloneNode(true);}}
11
- function updateFoldInfo(cm,from,to){var opts=cm.state.foldGutter.options,cur=from;var minSize=cm.foldOption(opts,"minFoldSize");var func=cm.foldOption(opts,"rangeFinder");cm.eachLine(from,to,function(line){var mark=null;if(isFolded(cm,cur)){mark=marker(opts.indicatorFolded);}else{var pos=Pos(cur,0);var range=func&&func(cm,pos);if(range&&range.to.line-range.from.line>=minSize)
12
- mark=marker(opts.indicatorOpen);}
13
- cm.setGutterMarker(line,opts.gutter,mark);++cur;});}
14
- function updateInViewport(cm){var vp=cm.getViewport(),state=cm.state.foldGutter;if(!state)return;cm.operation(function(){updateFoldInfo(cm,vp.from,vp.to);});state.from=vp.from;state.to=vp.to;}
15
- function onGutterClick(cm,line,gutter){var state=cm.state.foldGutter;if(!state)return;var opts=state.options;if(gutter!=opts.gutter)return;var folded=isFolded(cm,line);if(folded)folded.clear();else cm.foldCode(Pos(line,0),opts.rangeFinder);}
16
- function onChange(cm){var state=cm.state.foldGutter;if(!state)return;var opts=state.options;state.from=state.to=0;clearTimeout(state.changeUpdate);state.changeUpdate=setTimeout(function(){updateInViewport(cm);},opts.foldOnChangeTimeSpan||600);}
17
- function onViewportChange(cm){var state=cm.state.foldGutter;if(!state)return;var opts=state.options;clearTimeout(state.changeUpdate);state.changeUpdate=setTimeout(function(){var vp=cm.getViewport();if(state.from==state.to||vp.from-state.to>20||state.from-vp.to>20){updateInViewport(cm);}else{cm.operation(function(){if(vp.from<state.from){updateFoldInfo(cm,vp.from,state.from);state.from=vp.from;}
18
- if(vp.to>state.to){updateFoldInfo(cm,state.to,vp.to);state.to=vp.to;}});}},opts.updateViewportTimeSpan||400);}
19
- function onFold(cm,from){var state=cm.state.foldGutter;if(!state)return;var line=from.line;if(line>=state.from&&line<state.to)
20
- updateFoldInfo(cm,line,line+1);}});
1
+ !function(o){"object"==typeof exports&&"object"==typeof module?o(require("../../lib/codemirror"),require("./foldcode")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","./foldcode"],o):o(CodeMirror)}(function(o){"use strict";function t(o){this.options=o,this.from=this.to=0}function e(o){return o===!0&&(o={}),null==o.gutter&&(o.gutter="CodeMirror-foldgutter"),null==o.indicatorOpen&&(o.indicatorOpen="CodeMirror-foldgutter-open"),null==o.indicatorFolded&&(o.indicatorFolded="CodeMirror-foldgutter-folded"),o}function r(o,t){for(var e=o.findMarksAt(c(t)),r=0;r<e.length;++r)if(e[r].__isFold&&e[r].find().from.line==t)return e[r]}function n(o){if("string"==typeof o){var t=document.createElement("div");return t.className=o+" CodeMirror-guttermarker-subtle",t}return o.cloneNode(!0)}function i(o,t,e){var i=o.state.foldGutter.options,f=t,d=o.foldOption(i,"minFoldSize"),a=o.foldOption(i,"rangeFinder");o.eachLine(t,e,function(t){var e=null;if(r(o,f))e=n(i.indicatorFolded);else{var u=c(f,0),l=a&&a(o,u);l&&l.to.line-l.from.line>=d&&(e=n(i.indicatorOpen))}o.setGutterMarker(t,i.gutter,e),++f})}function f(o){var t=o.getViewport(),e=o.state.foldGutter;e&&(o.operation(function(){i(o,t.from,t.to)}),e.from=t.from,e.to=t.to)}function d(o,t,e){var n=o.state.foldGutter;if(n){var i=n.options;if(e==i.gutter){var f=r(o,t);f?f.clear():o.foldCode(c(t,0),i.rangeFinder)}}}function a(o){var t=o.state.foldGutter;if(t){var e=t.options;t.from=t.to=0,clearTimeout(t.changeUpdate),t.changeUpdate=setTimeout(function(){f(o)},e.foldOnChangeTimeSpan||600)}}function u(o){var t=o.state.foldGutter;if(t){var e=t.options;clearTimeout(t.changeUpdate),t.changeUpdate=setTimeout(function(){var e=o.getViewport();t.from==t.to||e.from-t.to>20||t.from-e.to>20?f(o):o.operation(function(){e.from<t.from&&(i(o,e.from,t.from),t.from=e.from),e.to>t.to&&(i(o,t.to,e.to),t.to=e.to)})},e.updateViewportTimeSpan||400)}}function l(o,t){var e=o.state.foldGutter;if(e){var r=t.line;r>=e.from&&r<e.to&&i(o,r,r+1)}}o.defineOption("foldGutter",!1,function(r,n,i){i&&i!=o.Init&&(r.clearGutter(r.state.foldGutter.options.gutter),r.state.foldGutter=null,r.off("gutterClick",d),r.off("change",a),r.off("viewportChange",u),r.off("fold",l),r.off("unfold",l),r.off("swapDoc",f)),n&&(r.state.foldGutter=new t(e(n)),f(r),r.on("gutterClick",d),r.on("change",a),r.on("viewportChange",u),r.on("fold",l),r.on("unfold",l),r.on("swapDoc",f))});var c=o.Pos});
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
lib/codemirror/addon/fold/indent-fold.min.js CHANGED
@@ -1,6 +1 @@
1
-
2
- (function(mod){if(typeof exports=="object"&&typeof module=="object")
3
- mod(require("../../lib/codemirror"));else if(typeof define=="function"&&define.amd)
4
- define(["../../lib/codemirror"],mod);else
5
- mod(CodeMirror);})(function(CodeMirror){"use strict";CodeMirror.registerHelper("fold","indent",function(cm,start){var tabSize=cm.getOption("tabSize"),firstLine=cm.getLine(start.line);if(!/\S/.test(firstLine))return;var getIndent=function(line){return CodeMirror.countColumn(line,null,tabSize);};var myIndent=getIndent(firstLine);var lastLineInFold=null;for(var i=start.line+1,end=cm.lastLine();i<=end;++i){var curLine=cm.getLine(i);var curIndent=getIndent(curLine);if(curIndent>myIndent){lastLineInFold=i;}else if(!/\S/.test(curLine)){}else{break;}}
6
- if(lastLineInFold)return{from:CodeMirror.Pos(start.line,firstLine.length),to:CodeMirror.Pos(lastLineInFold,cm.getLine(lastLineInFold).length)};});});
1
+ !function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";e.registerHelper("fold","indent",function(t,n){var i=t.getOption("tabSize"),o=t.getLine(n.line);if(/\S/.test(o)){for(var r=function(t){return e.countColumn(t,null,i)},f=r(o),l=null,u=n.line+1,c=t.lastLine();c>=u;++u){var d=t.getLine(u),s=r(d);if(s>f)l=u;else if(/\S/.test(d))break}return l?{from:e.Pos(n.line,o.length),to:e.Pos(l,t.getLine(l).length)}:void 0}})});
 
 
 
 
 
lib/codemirror/addon/fold/markdown-fold.min.js CHANGED
@@ -1,8 +1 @@
1
-
2
- (function(mod){if(typeof exports=="object"&&typeof module=="object")
3
- mod(require("../../lib/codemirror"));else if(typeof define=="function"&&define.amd)
4
- define(["../../lib/codemirror"],mod);else
5
- mod(CodeMirror);})(function(CodeMirror){"use strict";CodeMirror.registerHelper("fold","markdown",function(cm,start){var maxDepth=100;function isHeader(lineNo){var tokentype=cm.getTokenTypeAt(CodeMirror.Pos(lineNo,0));return tokentype&&/\bheader\b/.test(tokentype);}
6
- function headerLevel(lineNo,line,nextLine){var match=line&&line.match(/^#+/);if(match&&isHeader(lineNo))return match[0].length;match=nextLine&&nextLine.match(/^[=\-]+\s*$/);if(match&&isHeader(lineNo+1))return nextLine[0]=="="?1:2;return maxDepth;}
7
- var firstLine=cm.getLine(start.line),nextLine=cm.getLine(start.line+1);var level=headerLevel(start.line,firstLine,nextLine);if(level===maxDepth)return undefined;var lastLineNo=cm.lastLine();var end=start.line,nextNextLine=cm.getLine(end+2);while(end<lastLineNo){if(headerLevel(end+1,nextLine,nextNextLine)<=level)break;++end;nextLine=nextNextLine;nextNextLine=cm.getLine(end+2);}
8
- return{from:CodeMirror.Pos(start.line,firstLine.length),to:CodeMirror.Pos(end,cm.getLine(end).length)};});});
1
+ !function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";e.registerHelper("fold","markdown",function(n,t){function r(t){var r=n.getTokenTypeAt(e.Pos(t,0));return r&&/\bheader\b/.test(r)}function i(e,n,t){var i=n&&n.match(/^#+/);return i&&r(e)?i[0].length:(i=t&&t.match(/^[=\-]+\s*$/),i&&r(e+1)?"="==t[0]?1:2:o)}var o=100,f=n.getLine(t.line),l=n.getLine(t.line+1),c=i(t.line,f,l);if(c===o)return void 0;for(var u=n.lastLine(),d=t.line,a=n.getLine(d+2);u>d&&!(i(d+1,l,a)<=c);)++d,l=a,a=n.getLine(d+2);return{from:e.Pos(t.line,f.length),to:e.Pos(d,n.getLine(d).length)}})});
 
 
 
 
 
 
 
lib/codemirror/addon/fold/xml-fold.min.js CHANGED
@@ -1,27 +1 @@
1
-
2
- (function(mod){if(typeof exports=="object"&&typeof module=="object")
3
- mod(require("../../lib/codemirror"));else if(typeof define=="function"&&define.amd)
4
- define(["../../lib/codemirror"],mod);else
5
- mod(CodeMirror);})(function(CodeMirror){"use strict";var Pos=CodeMirror.Pos;function cmp(a,b){return a.line-b.line||a.ch-b.ch;}
6
- var nameStartChar="A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD";var nameChar=nameStartChar+"\-\:\.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040";var xmlTagStart=new RegExp("<(/?)(["+nameStartChar+"]["+nameChar+"]*)","g");function Iter(cm,line,ch,range){this.line=line;this.ch=ch;this.cm=cm;this.text=cm.getLine(line);this.min=range?range.from:cm.firstLine();this.max=range?range.to-1:cm.lastLine();}
7
- function tagAt(iter,ch){var type=iter.cm.getTokenTypeAt(Pos(iter.line,ch));return type&&/\btag\b/.test(type);}
8
- function nextLine(iter){if(iter.line>=iter.max)return;iter.ch=0;iter.text=iter.cm.getLine(++iter.line);return true;}
9
- function prevLine(iter){if(iter.line<=iter.min)return;iter.text=iter.cm.getLine(--iter.line);iter.ch=iter.text.length;return true;}
10
- function toTagEnd(iter){for(;;){var gt=iter.text.indexOf(">",iter.ch);if(gt==-1){if(nextLine(iter))continue;else return;}
11
- if(!tagAt(iter,gt+1)){iter.ch=gt+1;continue;}
12
- var lastSlash=iter.text.lastIndexOf("/",gt);var selfClose=lastSlash>-1&&!/\S/.test(iter.text.slice(lastSlash+1,gt));iter.ch=gt+1;return selfClose?"selfClose":"regular";}}
13
- function toTagStart(iter){for(;;){var lt=iter.ch?iter.text.lastIndexOf("<",iter.ch-1):-1;if(lt==-1){if(prevLine(iter))continue;else return;}
14
- if(!tagAt(iter,lt+1)){iter.ch=lt;continue;}
15
- xmlTagStart.lastIndex=lt;iter.ch=lt;var match=xmlTagStart.exec(iter.text);if(match&&match.index==lt)return match;}}
16
- function toNextTag(iter){for(;;){xmlTagStart.lastIndex=iter.ch;var found=xmlTagStart.exec(iter.text);if(!found){if(nextLine(iter))continue;else return;}
17
- if(!tagAt(iter,found.index+1)){iter.ch=found.index+1;continue;}
18
- iter.ch=found.index+found[0].length;return found;}}
19
- function toPrevTag(iter){for(;;){var gt=iter.ch?iter.text.lastIndexOf(">",iter.ch-1):-1;if(gt==-1){if(prevLine(iter))continue;else return;}
20
- if(!tagAt(iter,gt+1)){iter.ch=gt;continue;}
21
- var lastSlash=iter.text.lastIndexOf("/",gt);var selfClose=lastSlash>-1&&!/\S/.test(iter.text.slice(lastSlash+1,gt));iter.ch=gt+1;return selfClose?"selfClose":"regular";}}
22
- function findMatchingClose(iter,tag){var stack=[];for(;;){var next=toNextTag(iter),end,startLine=iter.line,startCh=iter.ch-(next?next[0].length:0);if(!next||!(end=toTagEnd(iter)))return;if(end=="selfClose")continue;if(next[1]){for(var i=stack.length-1;i>=0;--i)if(stack[i]==next[2]){stack.length=i;break;}
23
- if(i<0&&(!tag||tag==next[2]))return{tag:next[2],from:Pos(startLine,startCh),to:Pos(iter.line,iter.ch)};}else{stack.push(next[2]);}}}
24
- function findMatchingOpen(iter,tag){var stack=[];for(;;){var prev=toPrevTag(iter);if(!prev)return;if(prev=="selfClose"){toTagStart(iter);continue;}
25
- var endLine=iter.line,endCh=iter.ch;var start=toTagStart(iter);if(!start)return;if(start[1]){stack.push(start[2]);}else{for(var i=stack.length-1;i>=0;--i)if(stack[i]==start[2]){stack.length=i;break;}
26
- if(i<0&&(!tag||tag==start[2]))return{tag:start[2],from:Pos(iter.line,iter.ch),to:Pos(endLine,endCh)};}}}
27
- CodeMirror.registerHelper("fold","xml",function(cm,start){var iter=new Iter(cm,start.line,0);for(;;){var openTag=toNextTag(iter),end;if(!openTag||iter.line!=start.line||!(end=toTagEnd(iter)))return;if(!openTag[1]&&end!="selfClose"){var start=Pos(iter.line,iter.ch);var close=findMatchingClose(iter,openTag[2]);return close&&{from:start,to:close.from};}}});CodeMirror.findMatchingTag=function(cm,pos,range){var iter=new Iter(cm,pos.line,pos.ch,range);if(iter.text.indexOf(">")==-1&&iter.text.indexOf("<")==-1)return;var end=toTagEnd(iter),to=end&&Pos(iter.line,iter.ch);var start=end&&toTagStart(iter);if(!end||!start||cmp(iter,pos)>0)return;var here={from:Pos(iter.line,iter.ch),to:to,tag:start[2]};if(end=="selfClose")return{open:here,close:null,at:"open"};if(start[1]){return{open:findMatchingOpen(iter,start[2]),close:here,at:"close"};}else{iter=new Iter(cm,to.line,to.ch,range);return{open:here,close:findMatchingClose(iter,start[2]),at:"open"};}};CodeMirror.findEnclosingTag=function(cm,pos,range){var iter=new Iter(cm,pos.line,pos.ch,range);for(;;){var open=findMatchingOpen(iter);if(!open)break;var forward=new Iter(cm,pos.line,pos.ch,range);var close=findMatchingClose(forward,open.tag);if(close)return{open:open,close:close};}};CodeMirror.scanForClosingTag=function(cm,pos,name,end){var iter=new Iter(cm,pos.line,pos.ch,end?{from:0,to:end}:null);return findMatchingClose(iter,name);};});
1
+ !function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";function n(e,n){return e.line-n.line||e.ch-n.ch}function t(e,n,t,i){this.line=n,this.ch=t,this.cm=e,this.text=e.getLine(n),this.min=i?i.from:e.firstLine(),this.max=i?i.to-1:e.lastLine()}function i(e,n){var t=e.cm.getTokenTypeAt(h(e.line,n));return t&&/\btag\b/.test(t)}function r(e){return e.line>=e.max?void 0:(e.ch=0,e.text=e.cm.getLine(++e.line),!0)}function f(e){return e.line<=e.min?void 0:(e.text=e.cm.getLine(--e.line),e.ch=e.text.length,!0)}function o(e){for(;;){var n=e.text.indexOf(">",e.ch);if(-1==n){if(r(e))continue;return}{if(i(e,n+1)){var t=e.text.lastIndexOf("/",n),f=t>-1&&!/\S/.test(e.text.slice(t+1,n));return e.ch=n+1,f?"selfClose":"regular"}e.ch=n+1}}}function u(e){for(;;){var n=e.ch?e.text.lastIndexOf("<",e.ch-1):-1;if(-1==n){if(f(e))continue;return}if(i(e,n+1)){g.lastIndex=n,e.ch=n;var t=g.exec(e.text);if(t&&t.index==n)return t}else e.ch=n}}function c(e){for(;;){g.lastIndex=e.ch;var n=g.exec(e.text);if(!n){if(r(e))continue;return}{if(i(e,n.index+1))return e.ch=n.index+n[0].length,n;e.ch=n.index+1}}}function l(e){for(;;){var n=e.ch?e.text.lastIndexOf(">",e.ch-1):-1;if(-1==n){if(f(e))continue;return}{if(i(e,n+1)){var t=e.text.lastIndexOf("/",n),r=t>-1&&!/\S/.test(e.text.slice(t+1,n));return e.ch=n+1,r?"selfClose":"regular"}e.ch=n}}}function a(e,n){for(var t=[];;){var i,r=c(e),f=e.line,u=e.ch-(r?r[0].length:0);if(!r||!(i=o(e)))return;if("selfClose"!=i)if(r[1]){for(var l=t.length-1;l>=0;--l)if(t[l]==r[2]){t.length=l;break}if(0>l&&(!n||n==r[2]))return{tag:r[2],from:h(f,u),to:h(e.line,e.ch)}}else t.push(r[2])}}function s(e,n){for(var t=[];;){var i=l(e);if(!i)return;if("selfClose"!=i){var r=e.line,f=e.ch,o=u(e);if(!o)return;if(o[1])t.push(o[2]);else{for(var c=t.length-1;c>=0;--c)if(t[c]==o[2]){t.length=c;break}if(0>c&&(!n||n==o[2]))return{tag:o[2],from:h(e.line,e.ch),to:h(r,f)}}}else u(e)}}var h=e.Pos,x="A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD",v=x+"-:.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040",g=new RegExp("<(/?)(["+x+"]["+v+"]*)","g");e.registerHelper("fold","xml",function(e,n){for(var i=new t(e,n.line,0);;){var r,f=c(i);if(!f||i.line!=n.line||!(r=o(i)))return;if(!f[1]&&"selfClose"!=r){var n=h(i.line,i.ch),u=a(i,f[2]);return u&&{from:n,to:u.from}}}}),e.findMatchingTag=function(e,i,r){var f=new t(e,i.line,i.ch,r);if(-1!=f.text.indexOf(">")||-1!=f.text.indexOf("<")){var c=o(f),l=c&&h(f.line,f.ch),x=c&&u(f);if(c&&x&&!(n(f,i)>0)){var v={from:h(f.line,f.ch),to:l,tag:x[2]};return"selfClose"==c?{open:v,close:null,at:"open"}:x[1]?{open:s(f,x[2]),close:v,at:"close"}:(f=new t(e,l.line,l.ch,r),{open:v,close:a(f,x[2]),at:"open"})}}},e.findEnclosingTag=function(e,n,i){for(var r=new t(e,n.line,n.ch,i);;){var f=s(r);if(!f)break;var o=new t(e,n.line,n.ch,i),u=a(o,f.tag);if(u)return{open:f,close:u}}},e.scanForClosingTag=function(e,n,i,r){var f=new t(e,n.line,n.ch,r?{from:0,to:r}:null);return a(f,i)}});
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
lib/codemirror/addon/hint/anyword-hint.min.js CHANGED
@@ -1,6 +1 @@
1
-
2
- (function(mod){if(typeof exports=="object"&&typeof module=="object")
3
- mod(require("../../lib/codemirror"));else if(typeof define=="function"&&define.amd)
4
- define(["../../lib/codemirror"],mod);else
5
- mod(CodeMirror);})(function(CodeMirror){"use strict";var WORD=/[\w$]+/,RANGE=500;CodeMirror.registerHelper("hint","anyword",function(editor,options){var word=options&&options.word||WORD;var range=options&&options.range||RANGE;var cur=editor.getCursor(),curLine=editor.getLine(cur.line);var end=cur.ch,start=end;while(start&&word.test(curLine.charAt(start-1)))--start;var curWord=start!=end&&curLine.slice(start,end);var list=[],seen={};var re=new RegExp(word.source,"g");for(var dir=-1;dir<=1;dir+=2){var line=cur.line,endLine=Math.min(Math.max(line+dir*range,editor.firstLine()),editor.lastLine())+dir;for(;line!=endLine;line+=dir){var text=editor.getLine(line),m;while(m=re.exec(text)){if(line==cur.line&&m[0]===curWord)continue;if((!curWord||m[0].lastIndexOf(curWord,0)==0)&&!Object.prototype.hasOwnProperty.call(seen,m[0])){seen[m[0]]=true;list.push(m[0]);}}}}
6
- return{list:list,from:CodeMirror.Pos(cur.line,start),to:CodeMirror.Pos(cur.line,end)};});});
1
+ !function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";var r=/[\w$]+/,o=500;e.registerHelper("hint","anyword",function(t,i){for(var n=i&&i.word||r,f=i&&i.range||o,a=t.getCursor(),c=t.getLine(a.line),s=a.ch,l=s;l&&n.test(c.charAt(l-1));)--l;for(var d=l!=s&&c.slice(l,s),u=[],p={},g=new RegExp(n.source,"g"),h=-1;1>=h;h+=2)for(var m=a.line,y=Math.min(Math.max(m+h*f,t.firstLine()),t.lastLine())+h;m!=y;m+=h)for(var b,v=t.getLine(m);b=g.exec(v);)(m!=a.line||b[0]!==d)&&(d&&0!=b[0].lastIndexOf(d,0)||Object.prototype.hasOwnProperty.call(p,b[0])||(p[b[0]]=!0,u.push(b[0])));return{list:u,from:e.Pos(a.line,l),to:e.Pos(a.line,s)}})});
 
 
 
 
 
lib/codemirror/addon/hint/css-hint.min.js CHANGED
@@ -1,11 +1 @@
1
-
2
- (function(mod){if(typeof exports=="object"&&typeof module=="object")
3
- mod(require("../../lib/codemirror"),require("../../mode/css/css"));else if(typeof define=="function"&&define.amd)
4
- define(["../../lib/codemirror","../../mode/css/css"],mod);else
5
- mod(CodeMirror);})(function(CodeMirror){"use strict";var pseudoClasses={link:1,visited:1,active:1,hover:1,focus:1,"first-letter":1,"first-line":1,"first-child":1,before:1,after:1,lang:1};CodeMirror.registerHelper("hint","css",function(cm){var cur=cm.getCursor(),token=cm.getTokenAt(cur);var inner=CodeMirror.innerMode(cm.getMode(),token.state);if(inner.mode.name!="css")return;if(token.type=="keyword"&&"!important".indexOf(token.string)==0)
6
- return{list:["!important"],from:CodeMirror.Pos(cur.line,token.start),to:CodeMirror.Pos(cur.line,token.end)};var start=token.start,end=cur.ch,word=token.string.slice(0,end-start);if(/[^\w$_-]/.test(word)){word="";start=end=cur.ch;}
7
- var spec=CodeMirror.resolveMode("text/css");var result=[];function add(keywords){for(var name in keywords)
8
- if(!word||name.lastIndexOf(word,0)==0)
9
- result.push(name);}
10
- var st=inner.state.state;if(st=="pseudo"||token.type=="variable-3"){add(pseudoClasses);}else if(st=="block"||st=="maybeprop"){add(spec.propertyKeywords);}else if(st=="prop"||st=="parens"||st=="at"||st=="params"){add(spec.valueKeywords);add(spec.colorKeywords);}else if(st=="media"||st=="media_parens"){add(spec.mediaTypes);add(spec.mediaFeatures);}
11
- if(result.length)return{list:result,from:CodeMirror.Pos(cur.line,start),to:CodeMirror.Pos(cur.line,end)};});});
1
+ !function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror"),require("../../mode/css/css")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","../../mode/css/css"],e):e(CodeMirror)}(function(e){"use strict";var r={link:1,visited:1,active:1,hover:1,focus:1,"first-letter":1,"first-line":1,"first-child":1,before:1,after:1,lang:1};e.registerHelper("hint","css",function(t){function o(e){for(var r in e)c&&0!=r.lastIndexOf(c,0)||l.push(r)}var s=t.getCursor(),i=t.getTokenAt(s),n=e.innerMode(t.getMode(),i.state);if("css"==n.mode.name){if("keyword"==i.type&&0=="!important".indexOf(i.string))return{list:["!important"],from:e.Pos(s.line,i.start),to:e.Pos(s.line,i.end)};var a=i.start,d=s.ch,c=i.string.slice(0,d-a);/[^\w$_-]/.test(c)&&(c="",a=d=s.ch);var f=e.resolveMode("text/css"),l=[],p=n.state.state;return"pseudo"==p||"variable-3"==i.type?o(r):"block"==p||"maybeprop"==p?o(f.propertyKeywords):"prop"==p||"parens"==p||"at"==p||"params"==p?(o(f.valueKeywords),o(f.colorKeywords)):("media"==p||"media_parens"==p)&&(o(f.mediaTypes),o(f.mediaFeatures)),l.length?{list:l,from:e.Pos(s.line,a),to:e.Pos(s.line,d)}:void 0}})});
 
 
 
 
 
 
 
 
 
 
lib/codemirror/addon/hint/html-hint.min.js CHANGED
@@ -1,9 +1 @@
1
-
2
- (function(mod){if(typeof exports=="object"&&typeof module=="object")
3
- mod(require("../../lib/codemirror"),require("./xml-hint"));else if(typeof define=="function"&&define.amd)
4
- define(["../../lib/codemirror","./xml-hint"],mod);else
5
- mod(CodeMirror);})(function(CodeMirror){"use strict";var langs="ab aa af ak sq am ar an hy as av ae ay az bm ba eu be bn bh bi bs br bg my ca ch ce ny zh cv kw co cr hr cs da dv nl dz en eo et ee fo fj fi fr ff gl ka de el gn gu ht ha he hz hi ho hu ia id ie ga ig ik io is it iu ja jv kl kn kr ks kk km ki rw ky kv kg ko ku kj la lb lg li ln lo lt lu lv gv mk mg ms ml mt mi mr mh mn na nv nb nd ne ng nn no ii nr oc oj cu om or os pa pi fa pl ps pt qu rm rn ro ru sa sc sd se sm sg sr gd sn si sk sl so st es su sw ss sv ta te tg th ti bo tk tl tn to tr ts tt tw ty ug uk ur uz ve vi vo wa cy wo fy xh yi yo za zu".split(" ");var targets=["_blank","_self","_top","_parent"];var charsets=["ascii","utf-8","utf-16","latin1","latin1"];var methods=["get","post","put","delete"];var encs=["application/x-www-form-urlencoded","multipart/form-data","text/plain"];var media=["all","screen","print","embossed","braille","handheld","print","projection","screen","tty","tv","speech","3d-glasses","resolution [>][<][=] [X]","device-aspect-ratio: X/Y","orientation:portrait","orientation:landscape","device-height: [X]","device-width: [X]"];var s={attrs:{}};var data={a:{attrs:{href:null,ping:null,type:null,media:media,target:targets,hreflang:langs}},abbr:s,acronym:s,address:s,applet:s,area:{attrs:{alt:null,coords:null,href:null,target:null,ping:null,media:media,hreflang:langs,type:null,shape:["default","rect","circle","poly"]}},article:s,aside:s,audio:{attrs:{src:null,mediagroup:null,crossorigin:["anonymous","use-credentials"],preload:["none","metadata","auto"],autoplay:["","autoplay"],loop:["","loop"],controls:["","controls"]}},b:s,base:{attrs:{href:null,target:targets}},basefont:s,bdi:s,bdo:s,big:s,blockquote:{attrs:{cite:null}},body:s,br:s,button:{attrs:{form:null,formaction:null,name:null,value:null,autofocus:["","autofocus"],disabled:["","autofocus"],formenctype:encs,formmethod:methods,formnovalidate:["","novalidate"],formtarget:targets,type:["submit","reset","button"]}},canvas:{attrs:{width:null,height:null}},caption:s,center:s,cite:s,code:s,col:{attrs:{span:null}},colgroup:{attrs:{span:null}},command:{attrs:{type:["command","checkbox","radio"],label:null,icon:null,radiogroup:null,command:null,title:null,disabled:["","disabled"],checked:["","checked"]}},data:{attrs:{value:null}},datagrid:{attrs:{disabled:["","disabled"],multiple:["","multiple"]}},datalist:{attrs:{data:null}},dd:s,del:{attrs:{cite:null,datetime:null}},details:{attrs:{open:["","open"]}},dfn:s,dir:s,div:s,dl:s,dt:s,em:s,embed:{attrs:{src:null,type:null,width:null,height:null}},eventsource:{attrs:{src:null}},fieldset:{attrs:{disabled:["","disabled"],form:null,name:null}},figcaption:s,figure:s,font:s,footer:s,form:{attrs:{action:null,name:null,"accept-charset":charsets,autocomplete:["on","off"],enctype:encs,method:methods,novalidate:["","novalidate"],target:targets}},frame:s,frameset:s,h1:s,h2:s,h3:s,h4:s,h5:s,h6:s,head:{attrs:{},children:["title","base","link","style","meta","script","noscript","command"]},header:s,hgroup:s,hr:s,html:{attrs:{manifest:null},children:["head","body"]},i:s,iframe:{attrs:{src:null,srcdoc:null,name:null,width:null,height:null,sandbox:["allow-top-navigation","allow-same-origin","allow-forms","allow-scripts"],seamless:["","seamless"]}},img:{attrs:{alt:null,src:null,ismap:null,usemap:null,width:null,height:null,crossorigin:["anonymous","use-credentials"]}},input:{attrs:{alt:null,dirname:null,form:null,formaction:null,height:null,list:null,max:null,maxlength:null,min:null,name:null,pattern:null,placeholder:null,size:null,src:null,step:null,value:null,width:null,accept:["audio/*","video/*","image/*"],autocomplete:["on","off"],autofocus:["","autofocus"],checked:["","checked"],disabled:["","disabled"],formenctype:encs,formmethod:methods,formnovalidate:["","novalidate"],formtarget:targets,multiple:["","multiple"],readonly:["","readonly"],required:["","required"],type:["hidden","text","search","tel","url","email","password","datetime","date","month","week","time","datetime-local","number","range","color","checkbox","radio","file","submit","image","reset","button"]}},ins:{attrs:{cite:null,datetime:null}},kbd:s,keygen:{attrs:{challenge:null,form:null,name:null,autofocus:["","autofocus"],disabled:["","disabled"],keytype:["RSA"]}},label:{attrs:{"for":null,form:null}},legend:s,li:{attrs:{value:null}},link:{attrs:{href:null,type:null,hreflang:langs,media:media,sizes:["all","16x16","16x16 32x32","16x16 32x32 64x64"]}},map:{attrs:{name:null}},mark:s,menu:{attrs:{label:null,type:["list","context","toolbar"]}},meta:{attrs:{content:null,charset:charsets,name:["viewport","application-name","author","description","generator","keywords"],"http-equiv":["content-language","content-type","default-style","refresh"]}},meter:{attrs:{value:null,min:null,low:null,high:null,max:null,optimum:null}},nav:s,noframes:s,noscript:s,object:{attrs:{data:null,type:null,name:null,usemap:null,form:null,width:null,height:null,typemustmatch:["","typemustmatch"]}},ol:{attrs:{reversed:["","reversed"],start:null,type:["1","a","A","i","I"]}},optgroup:{attrs:{disabled:["","disabled"],label:null}},option:{attrs:{disabled:["","disabled"],label:null,selected:["","selected"],value:null}},output:{attrs:{"for":null,form:null,name:null}},p:s,param:{attrs:{name:null,value:null}},pre:s,progress:{attrs:{value:null,max:null}},q:{attrs:{cite:null}},rp:s,rt:s,ruby:s,s:s,samp:s,script:{attrs:{type:["text/javascript"],src:null,async:["","async"],defer:["","defer"],charset:charsets}},section:s,select:{attrs:{form:null,name:null,size:null,autofocus:["","autofocus"],disabled:["","disabled"],multiple:["","multiple"]}},small:s,source:{attrs:{src:null,type:null,media:null}},span:s,strike:s,strong:s,style:{attrs:{type:["text/css"],media:media,scoped:null}},sub:s,summary:s,sup:s,table:s,tbody:s,td:{attrs:{colspan:null,rowspan:null,headers:null}},textarea:{attrs:{dirname:null,form:null,maxlength:null,name:null,placeholder:null,rows:null,cols:null,autofocus:["","autofocus"],disabled:["","disabled"],readonly:["","readonly"],required:["","required"],wrap:["soft","hard"]}},tfoot:s,th:{attrs:{colspan:null,rowspan:null,headers:null,scope:["row","col","rowgroup","colgroup"]}},thead:s,time:{attrs:{datetime:null}},title:s,tr:s,track:{attrs:{src:null,label:null,"default":null,kind:["subtitles","captions","descriptions","chapters","metadata"],srclang:langs}},tt:s,u:s,ul:s,"var":s,video:{attrs:{src:null,poster:null,width:null,height:null,crossorigin:["anonymous","use-credentials"],preload:["auto","metadata","none"],autoplay:["","autoplay"],mediagroup:["movie"],muted:["","muted"],controls:["","controls"]}},wbr:s};var globalAttrs={accesskey:["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","0","1","2","3","4","5","6","7","8","9"],"class":null,contenteditable:["true","false"],contextmenu:null,dir:["ltr","rtl","auto"],draggable:["true","false","auto"],dropzone:["copy","move","link","string:","file:"],hidden:["hidden"],id:null,inert:["inert"],itemid:null,itemprop:null,itemref:null,itemscope:["itemscope"],itemtype:null,lang:["en","es"],spellcheck:["true","false"],style:null,tabindex:["1","2","3","4","5","6","7","8","9"],title:null,translate:["yes","no"],onclick:null,rel:["stylesheet","alternate","author","bookmark","help","license","next","nofollow","noreferrer","prefetch","prev","search","tag"]};function populate(obj){for(var attr in globalAttrs)if(globalAttrs.hasOwnProperty(attr))
6
- obj.attrs[attr]=globalAttrs[attr];}
7
- populate(s);for(var tag in data)if(data.hasOwnProperty(tag)&&data[tag]!=s)
8
- populate(data[tag]);CodeMirror.htmlSchema=data;function htmlHint(cm,options){var local={schemaInfo:data};if(options)for(var opt in options)local[opt]=options[opt];return CodeMirror.hint.xml(cm,local);}
9
- CodeMirror.registerHelper("hint","html",htmlHint);});
1
+ !function(l){"object"==typeof exports&&"object"==typeof module?l(require("../../lib/codemirror"),require("./xml-hint")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","./xml-hint"],l):l(CodeMirror)}(function(l){"use strict";function t(l){for(var t in c)c.hasOwnProperty(t)&&(l.attrs[t]=c[t])}function e(t,e){var a={schemaInfo:d};if(e)for(var n in e)a[n]=e[n];return l.hint.xml(t,a)}var a="ab aa af ak sq am ar an hy as av ae ay az bm ba eu be bn bh bi bs br bg my ca ch ce ny zh cv kw co cr hr cs da dv nl dz en eo et ee fo fj fi fr ff gl ka de el gn gu ht ha he hz hi ho hu ia id ie ga ig ik io is it iu ja jv kl kn kr ks kk km ki rw ky kv kg ko ku kj la lb lg li ln lo lt lu lv gv mk mg ms ml mt mi mr mh mn na nv nb nd ne ng nn no ii nr oc oj cu om or os pa pi fa pl ps pt qu rm rn ro ru sa sc sd se sm sg sr gd sn si sk sl so st es su sw ss sv ta te tg th ti bo tk tl tn to tr ts tt tw ty ug uk ur uz ve vi vo wa cy wo fy xh yi yo za zu".split(" "),n=["_blank","_self","_top","_parent"],r=["ascii","utf-8","utf-16","latin1","latin1"],o=["get","post","put","delete"],s=["application/x-www-form-urlencoded","multipart/form-data","text/plain"],u=["all","screen","print","embossed","braille","handheld","print","projection","screen","tty","tv","speech","3d-glasses","resolution [>][<][=] [X]","device-aspect-ratio: X/Y","orientation:portrait","orientation:landscape","device-height: [X]","device-width: [X]"],i={attrs:{}},d={a:{attrs:{href:null,ping:null,type:null,media:u,target:n,hreflang:a}},abbr:i,acronym:i,address:i,applet:i,area:{attrs:{alt:null,coords:null,href:null,target:null,ping:null,media:u,hreflang:a,type:null,shape:["default","rect","circle","poly"]}},article:i,aside:i,audio:{attrs:{src:null,mediagroup:null,crossorigin:["anonymous","use-credentials"],preload:["none","metadata","auto"],autoplay:["","autoplay"],loop:["","loop"],controls:["","controls"]}},b:i,base:{attrs:{href:null,target:n}},basefont:i,bdi:i,bdo:i,big:i,blockquote:{attrs:{cite:null}},body:i,br:i,button:{attrs:{form:null,formaction:null,name:null,value:null,autofocus:["","autofocus"],disabled:["","autofocus"],formenctype:s,formmethod:o,formnovalidate:["","novalidate"],formtarget:n,type:["submit","reset","button"]}},canvas:{attrs:{width:null,height:null}},caption:i,center:i,cite:i,code:i,col:{attrs:{span:null}},colgroup:{attrs:{span:null}},command:{attrs:{type:["command","checkbox","radio"],label:null,icon:null,radiogroup:null,command:null,title:null,disabled:["","disabled"],checked:["","checked"]}},data:{attrs:{value:null}},datagrid:{attrs:{disabled:["","disabled"],multiple:["","multiple"]}},datalist:{attrs:{data:null}},dd:i,del:{attrs:{cite:null,datetime:null}},details:{attrs:{open:["","open"]}},dfn:i,dir:i,div:i,dl:i,dt:i,em:i,embed:{attrs:{src:null,type:null,width:null,height:null}},eventsource:{attrs:{src:null}},fieldset:{attrs:{disabled:["","disabled"],form:null,name:null}},figcaption:i,figure:i,font:i,footer:i,form:{attrs:{action:null,name:null,"accept-charset":r,autocomplete:["on","off"],enctype:s,method:o,novalidate:["","novalidate"],target:n}},frame:i,frameset:i,h1:i,h2:i,h3:i,h4:i,h5:i,h6:i,head:{attrs:{},children:["title","base","link","style","meta","script","noscript","command"]},header:i,hgroup:i,hr:i,html:{attrs:{manifest:null},children:["head","body"]},i:i,iframe:{attrs:{src:null,srcdoc:null,name:null,width:null,height:null,sandbox:["allow-top-navigation","allow-same-origin","allow-forms","allow-scripts"],seamless:["","seamless"]}},img:{attrs:{alt:null,src:null,ismap:null,usemap:null,width:null,height:null,crossorigin:["anonymous","use-credentials"]}},input:{attrs:{alt:null,dirname:null,form:null,formaction:null,height:null,list:null,max:null,maxlength:null,min:null,name:null,pattern:null,placeholder:null,size:null,src:null,step:null,value:null,width:null,accept:["audio/*","video/*","image/*"],autocomplete:["on","off"],autofocus:["","autofocus"],checked:["","checked"],disabled:["","disabled"],formenctype:s,formmethod:o,formnovalidate:["","novalidate"],formtarget:n,multiple:["","multiple"],readonly:["","readonly"],required:["","required"],type:["hidden","text","search","tel","url","email","password","datetime","date","month","week","time","datetime-local","number","range","color","checkbox","radio","file","submit","image","reset","button"]}},ins:{attrs:{cite:null,datetime:null}},kbd:i,keygen:{attrs:{challenge:null,form:null,name:null,autofocus:["","autofocus"],disabled:["","disabled"],keytype:["RSA"]}},label:{attrs:{"for":null,form:null}},legend:i,li:{attrs:{value:null}},link:{attrs:{href:null,type:null,hreflang:a,media:u,sizes:["all","16x16","16x16 32x32","16x16 32x32 64x64"]}},map:{attrs:{name:null}},mark:i,menu:{attrs:{label:null,type:["list","context","toolbar"]}},meta:{attrs:{content:null,charset:r,name:["viewport","application-name","author","description","generator","keywords"],"http-equiv":["content-language","content-type","default-style","refresh"]}},meter:{attrs:{value:null,min:null,low:null,high:null,max:null,optimum:null}},nav:i,noframes:i,noscript:i,object:{attrs:{data:null,type:null,name:null,usemap:null,form:null,width:null,height:null,typemustmatch:["","typemustmatch"]}},ol:{attrs:{reversed:["","reversed"],start:null,type:["1","a","A","i","I"]}},optgroup:{attrs:{disabled:["","disabled"],label:null}},option:{attrs:{disabled:["","disabled"],label:null,selected:["","selected"],value:null}},output:{attrs:{"for":null,form:null,name:null}},p:i,param:{attrs:{name:null,value:null}},pre:i,progress:{attrs:{value:null,max:null}},q:{attrs:{cite:null}},rp:i,rt:i,ruby:i,s:i,samp:i,script:{attrs:{type:["text/javascript"],src:null,async:["","async"],defer:["","defer"],charset:r}},section:i,select:{attrs:{form:null,name:null,size:null,autofocus:["","autofocus"],disabled:["","disabled"],multiple:["","multiple"]}},small:i,source:{attrs:{src:null,type:null,media:null}},span:i,strike:i,strong:i,style:{attrs:{type:["text/css"],media:u,scoped:null}},sub:i,summary:i,sup:i,table:i,tbody:i,td:{attrs:{colspan:null,rowspan:null,headers:null}},textarea:{attrs:{dirname:null,form:null,maxlength:null,name:null,placeholder:null,rows:null,cols:null,autofocus:["","autofocus"],disabled:["","disabled"],readonly:["","readonly"],required:["","required"],wrap:["soft","hard"]}},tfoot:i,th:{attrs:{colspan:null,rowspan:null,headers:null,scope:["row","col","rowgroup","colgroup"]}},thead:i,time:{attrs:{datetime:null}},title:i,tr:i,track:{attrs:{src:null,label:null,"default":null,kind:["subtitles","captions","descriptions","chapters","metadata"],srclang:a}},tt:i,u:i,ul:i,"var":i,video:{attrs:{src:null,poster:null,width:null,height:null,crossorigin:["anonymous","use-credentials"],preload:["auto","metadata","none"],autoplay:["","autoplay"],mediagroup:["movie"],muted:["","muted"],controls:["","controls"]}},wbr:i},c={accesskey:["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","0","1","2","3","4","5","6","7","8","9"],"class":null,contenteditable:["true","false"],contextmenu:null,dir:["ltr","rtl","auto"],draggable:["true","false","auto"],dropzone:["copy","move","link","string:","file:"],hidden:["hidden"],id:null,inert:["inert"],itemid:null,itemprop:null,itemref:null,itemscope:["itemscope"],itemtype:null,lang:["en","es"],spellcheck:["true","false"],style:null,tabindex:["1","2","3","4","5","6","7","8","9"],title:null,translate:["yes","no"],onclick:null,rel:["stylesheet","alternate","author","bookmark","help","license","next","nofollow","noreferrer","prefetch","prev","search","tag"]};t(i);for(var m in d)d.hasOwnProperty(m)&&d[m]!=i&&t(d[m]);l.htmlSchema=d,l.registerHelper("hint","html",e)});
 
 
 
 
 
 
 
 
lib/codemirror/addon/hint/javascript-hint.min.js CHANGED
@@ -1,26 +1 @@
1
-
2
- (function(mod){if(typeof exports=="object"&&typeof module=="object")
3
- mod(require("../../lib/codemirror"));else if(typeof define=="function"&&define.amd)
4
- define(["../../lib/codemirror"],mod);else
5
- mod(CodeMirror);})(function(CodeMirror){var Pos=CodeMirror.Pos;function forEach(arr,f){for(var i=0,e=arr.length;i<e;++i)f(arr[i]);}
6
- function arrayContains(arr,item){if(!Array.prototype.indexOf){var i=arr.length;while(i--){if(arr[i]===item){return true;}}
7
- return false;}
8
- return arr.indexOf(item)!=-1;}
9
- function scriptHint(editor,keywords,getToken,options){var cur=editor.getCursor(),token=getToken(editor,cur);if(/\b(?:string|comment)\b/.test(token.type))return;token.state=CodeMirror.innerMode(editor.getMode(),token.state).state;if(!/^[\w$_]*$/.test(token.string)){token={start:cur.ch,end:cur.ch,string:"",state:token.state,type:token.string=="."?"property":null};}else if(token.end>cur.ch){token.end=cur.ch;token.string=token.string.slice(0,cur.ch-token.start);}
10
- var tprop=token;while(tprop.type=="property"){tprop=getToken(editor,Pos(cur.line,tprop.start));if(tprop.string!=".")return;tprop=getToken(editor,Pos(cur.line,tprop.start));if(!context)var context=[];context.push(tprop);}
11
- return{list:getCompletions(token,context,keywords,options),from:Pos(cur.line,token.start),to:Pos(cur.line,token.end)};}
12
- function javascriptHint(editor,options){return scriptHint(editor,javascriptKeywords,function(e,cur){return e.getTokenAt(cur);},options);};CodeMirror.registerHelper("hint","javascript",javascriptHint);function getCoffeeScriptToken(editor,cur){var token=editor.getTokenAt(cur);if(cur.ch==token.start+1&&token.string.charAt(0)=='.'){token.end=token.start;token.string='.';token.type="property";}
13
- else if(/^\.[\w$_]*$/.test(token.string)){token.type="property";token.start++;token.string=token.string.replace(/\./,'');}
14
- return token;}
15
- function coffeescriptHint(editor,options){return scriptHint(editor,coffeescriptKeywords,getCoffeeScriptToken,options);}
16
- CodeMirror.registerHelper("hint","coffeescript",coffeescriptHint);var stringProps=("charAt charCodeAt indexOf lastIndexOf substring substr slice trim trimLeft trimRight "+"toUpperCase toLowerCase split concat match replace search").split(" ");var arrayProps=("length concat join splice push pop shift unshift slice reverse sort indexOf "+"lastIndexOf every some filter forEach map reduce reduceRight ").split(" ");var funcProps="prototype apply call bind".split(" ");var javascriptKeywords=("break case catch continue debugger default delete do else false finally for function "+"if in instanceof new null return switch throw true try typeof var void while with").split(" ");var coffeescriptKeywords=("and break catch class continue delete do else extends false finally for "+"if in instanceof isnt new no not null of off on or return switch then throw true try typeof until void while with yes").split(" ");function getCompletions(token,context,keywords,options){var found=[],start=token.string,global=options&&options.globalScope||window;function maybeAdd(str){if(str.lastIndexOf(start,0)==0&&!arrayContains(found,str))found.push(str);}
17
- function gatherCompletions(obj){if(typeof obj=="string")forEach(stringProps,maybeAdd);else if(obj instanceof Array)forEach(arrayProps,maybeAdd);else if(obj instanceof Function)forEach(funcProps,maybeAdd);for(var name in obj)maybeAdd(name);}
18
- if(context&&context.length){var obj=context.pop(),base;if(obj.type&&obj.type.indexOf("variable")===0){if(options&&options.additionalContext)
19
- base=options.additionalContext[obj.string];if(!options||options.useGlobalScope!==false)
20
- base=base||global[obj.string];}else if(obj.type=="string"){base="";}else if(obj.type=="atom"){base=1;}else if(obj.type=="function"){if(global.jQuery!=null&&(obj.string=='$'||obj.string=='jQuery')&&(typeof global.jQuery=='function'))
21
- base=global.jQuery();else if(global._!=null&&(obj.string=='_')&&(typeof global._=='function'))
22
- base=global._();}
23
- while(base!=null&&context.length)
24
- base=base[context.pop().string];if(base!=null)gatherCompletions(base);}else{for(var v=token.state.localVars;v;v=v.next)maybeAdd(v.name);for(var v=token.state.globalVars;v;v=v.next)maybeAdd(v.name);if(!options||options.useGlobalScope!==false)
25
- gatherCompletions(global);forEach(keywords,maybeAdd);}
26
- return found;}});
1
+ !function(t){"object"==typeof exports&&"object"==typeof module?t(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],t):t(CodeMirror)}(function(t){function e(t,e){for(var r=0,n=t.length;n>r;++r)e(t[r])}function r(t,e){if(!Array.prototype.indexOf){for(var r=t.length;r--;)if(t[r]===e)return!0;return!1}return-1!=t.indexOf(e)}function n(e,r,n,i){var o=e.getCursor(),s=n(e,o);if(!/\b(?:string|comment)\b/.test(s.type)){s.state=t.innerMode(e.getMode(),s.state).state,/^[\w$_]*$/.test(s.string)?s.end>o.ch&&(s.end=o.ch,s.string=s.string.slice(0,o.ch-s.start)):s={start:o.ch,end:o.ch,string:"",state:s.state,type:"."==s.string?"property":null};for(var f=s;"property"==f.type;){if(f=n(e,l(o.line,f.start)),"."!=f.string)return;if(f=n(e,l(o.line,f.start)),!c)var c=[];c.push(f)}return{list:a(s,c,r,i),from:l(o.line,s.start),to:l(o.line,s.end)}}}function i(t,e){return n(t,u,function(t,e){return t.getTokenAt(e)},e)}function o(t,e){var r=t.getTokenAt(e);return e.ch==r.start+1&&"."==r.string.charAt(0)?(r.end=r.start,r.string=".",r.type="property"):/^\.[\w$_]*$/.test(r.string)&&(r.type="property",r.start++,r.string=r.string.replace(/\./,"")),r}function s(t,e){return n(t,d,o,e)}function a(t,n,i,o){function s(t){0!=t.lastIndexOf(u,0)||r(l,t)||l.push(t)}function a(t){"string"==typeof t?e(f,s):t instanceof Array?e(c,s):t instanceof Function&&e(p,s);for(var r in t)s(r)}var l=[],u=t.string,d=o&&o.globalScope||window;if(n&&n.length){var g,h=n.pop();for(h.type&&0===h.type.indexOf("variable")?(o&&o.additionalContext&&(g=o.additionalContext[h.string]),o&&o.useGlobalScope===!1||(g=g||d[h.string])):"string"==h.type?g="":"atom"==h.type?g=1:"function"==h.type&&(null==d.jQuery||"$"!=h.string&&"jQuery"!=h.string||"function"!=typeof d.jQuery?null!=d._&&"_"==h.string&&"function"==typeof d._&&(g=d._()):g=d.jQuery());null!=g&&n.length;)g=g[n.pop().string];null!=g&&a(g)}else{for(var y=t.state.localVars;y;y=y.next)s(y.name);for(var y=t.state.globalVars;y;y=y.next)s(y.name);o&&o.useGlobalScope===!1||a(d),e(i,s)}return l}var l=t.Pos;t.registerHelper("hint","javascript",i),t.registerHelper("hint","coffeescript",s);var f="charAt charCodeAt indexOf lastIndexOf substring substr slice trim trimLeft trimRight toUpperCase toLowerCase split concat match replace search".split(" "),c="length concat join splice push pop shift unshift slice reverse sort indexOf lastIndexOf every some filter forEach map reduce reduceRight ".split(" "),p="prototype apply call bind".split(" "),u="break case catch continue debugger default delete do else false finally for function if in instanceof new null return switch throw true try typeof var void while with".split(" "),d="and break catch class continue delete do else extends false finally for if in instanceof isnt new no not null of off on or return switch then throw true try typeof until void while with yes".split(" ")});
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
lib/codemirror/addon/hint/show-hint.min.js CHANGED
@@ -1,35 +1 @@
1
-
2
- (function(mod){if(typeof exports=="object"&&typeof module=="object")
3
- mod(require("../../lib/codemirror"));else if(typeof define=="function"&&define.amd)
4
- define(["../../lib/codemirror"],mod);else
5
- mod(CodeMirror);})(function(CodeMirror){"use strict";var HINT_ELEMENT_CLASS="CodeMirror-hint";var ACTIVE_HINT_ELEMENT_CLASS="CodeMirror-hint-active";CodeMirror.showHint=function(cm,getHints,options){if(!getHints)return cm.showHint(options);if(options&&options.async)getHints.async=true;var newOpts={hint:getHints};if(options)for(var prop in options)newOpts[prop]=options[prop];return cm.showHint(newOpts);};CodeMirror.defineExtension("showHint",function(options){if(this.listSelections().length>1||this.somethingSelected())return;if(this.state.completionActive)this.state.completionActive.close();var completion=this.state.completionActive=new Completion(this,options);if(!completion.options.hint)return;CodeMirror.signal(this,"startCompletion",this);completion.update();});function Completion(cm,options){this.cm=cm;this.options=this.buildOptions(options);this.widget=null;this.debounce=0;this.tick=0;this.startPos=this.cm.getCursor();this.startLen=this.cm.getLine(this.startPos.line).length;var self=this;cm.on("cursorActivity",this.activityFunc=function(){self.cursorActivity();});}
6
- var requestAnimationFrame=window.requestAnimationFrame||function(fn){return setTimeout(fn,1000/60);};var cancelAnimationFrame=window.cancelAnimationFrame||clearTimeout;Completion.prototype={close:function(){if(!this.active())return;this.cm.state.completionActive=null;this.tick=null;this.cm.off("cursorActivity",this.activityFunc);if(this.widget)this.widget.close();CodeMirror.signal(this.cm,"endCompletion",this.cm);},active:function(){return this.cm.state.completionActive==this;},pick:function(data,i){var completion=data.list[i];if(completion.hint)completion.hint(this.cm,data,completion);else this.cm.replaceRange(getText(completion),completion.from||data.from,completion.to||data.to,"complete");CodeMirror.signal(data,"pick",completion);this.close();},showHints:function(data){if(!data||!data.list.length||!this.active())return this.close();if(this.options.completeSingle&&data.list.length==1)
7
- this.pick(data,0);else
8
- this.showWidget(data);},cursorActivity:function(){if(this.debounce){cancelAnimationFrame(this.debounce);this.debounce=0;}
9
- var pos=this.cm.getCursor(),line=this.cm.getLine(pos.line);if(pos.line!=this.startPos.line||line.length-pos.ch!=this.startLen-this.startPos.ch||pos.ch<this.startPos.ch||this.cm.somethingSelected()||(pos.ch&&this.options.closeCharacters.test(line.charAt(pos.ch-1)))){this.close();}else{var self=this;this.debounce=requestAnimationFrame(function(){self.update();});if(this.widget)this.widget.disable();}},update:function(){if(this.tick==null)return;if(this.data)CodeMirror.signal(this.data,"update");if(!this.options.hint.async){this.finishUpdate(this.options.hint(this.cm,this.options),myTick);}else{var myTick=++this.tick,self=this;this.options.hint(this.cm,function(data){if(self.tick==myTick)self.finishUpdate(data);},this.options);}},finishUpdate:function(data){this.data=data;var picked=this.widget&&this.widget.picked;if(this.widget)this.widget.close();if(data&&data.list.length){if(picked&&data.list.length==1)this.pick(data,0);else this.widget=new Widget(this,data);}},showWidget:function(data){this.data=data;this.widget=new Widget(this,data);CodeMirror.signal(data,"shown");},buildOptions:function(options){var editor=this.cm.options.hintOptions;var out={};for(var prop in defaultOptions)out[prop]=defaultOptions[prop];if(editor)for(var prop in editor)
10
- if(editor[prop]!==undefined)out[prop]=editor[prop];if(options)for(var prop in options)
11
- if(options[prop]!==undefined)out[prop]=options[prop];return out;}};function getText(completion){if(typeof completion=="string")return completion;else return completion.text;}
12
- function buildKeyMap(completion,handle){var baseMap={Up:function(){handle.moveFocus(-1);},Down:function(){handle.moveFocus(1);},PageUp:function(){handle.moveFocus(-handle.menuSize()+1,true);},PageDown:function(){handle.moveFocus(handle.menuSize()-1,true);},Home:function(){handle.setFocus(0);},End:function(){handle.setFocus(handle.length-1);},Enter:handle.pick,Tab:handle.pick,Esc:handle.close};var custom=completion.options.customKeys;var ourMap=custom?{}:baseMap;function addBinding(key,val){var bound;if(typeof val!="string")
13
- bound=function(cm){return val(cm,handle);};else if(baseMap.hasOwnProperty(val))
14
- bound=baseMap[val];else
15
- bound=val;ourMap[key]=bound;}
16
- if(custom)
17
- for(var key in custom)if(custom.hasOwnProperty(key))
18
- addBinding(key,custom[key]);var extra=completion.options.extraKeys;if(extra)
19
- for(var key in extra)if(extra.hasOwnProperty(key))
20
- addBinding(key,extra[key]);return ourMap;}
21
- function getHintElement(hintsElement,el){while(el&&el!=hintsElement){if(el.nodeName.toUpperCase()==="LI"&&el.parentNode==hintsElement)return el;el=el.parentNode;}}
22
- function Widget(completion,data){this.completion=completion;this.data=data;this.picked=false;var widget=this,cm=completion.cm;var hints=this.hints=document.createElement("ul");hints.className="CodeMirror-hints";this.selectedHint=data.selectedHint||0;var completions=data.list;for(var i=0;i<completions.length;++i){var elt=hints.appendChild(document.createElement("li")),cur=completions[i];var className=HINT_ELEMENT_CLASS+(i!=this.selectedHint?"":" "+ACTIVE_HINT_ELEMENT_CLASS);if(cur.className!=null)className=cur.className+" "+className;elt.className=className;if(cur.render)cur.render(elt,data,cur);else elt.appendChild(document.createTextNode(cur.displayText||getText(cur)));elt.hintId=i;}
23
- var pos=cm.cursorCoords(completion.options.alignWithWord?data.from:null);var left=pos.left,top=pos.bottom,below=true;hints.style.left=left+"px";hints.style.top=top+"px";var winW=window.innerWidth||Math.max(document.body.offsetWidth,document.documentElement.offsetWidth);var winH=window.innerHeight||Math.max(document.body.offsetHeight,document.documentElement.offsetHeight);(completion.options.container||document.body).appendChild(hints);var box=hints.getBoundingClientRect(),overlapY=box.bottom-winH;if(overlapY>0){var height=box.bottom-box.top,curTop=pos.top-(pos.bottom-box.top);if(curTop-height>0){hints.style.top=(top=pos.top-height)+"px";below=false;}else if(height>winH){hints.style.height=(winH-5)+"px";hints.style.top=(top=pos.bottom-box.top)+"px";var cursor=cm.getCursor();if(data.from.ch!=cursor.ch){pos=cm.cursorCoords(cursor);hints.style.left=(left=pos.left)+"px";box=hints.getBoundingClientRect();}}}
24
- var overlapX=box.right-winW;if(overlapX>0){if(box.right-box.left>winW){hints.style.width=(winW-5)+"px";overlapX-=(box.right-box.left)-winW;}
25
- hints.style.left=(left=pos.left-overlapX)+"px";}
26
- cm.addKeyMap(this.keyMap=buildKeyMap(completion,{moveFocus:function(n,avoidWrap){widget.changeActive(widget.selectedHint+n,avoidWrap);},setFocus:function(n){widget.changeActive(n);},menuSize:function(){return widget.screenAmount();},length:completions.length,close:function(){completion.close();},pick:function(){widget.pick();},data:data}));if(completion.options.closeOnUnfocus){var closingOnBlur;cm.on("blur",this.onBlur=function(){closingOnBlur=setTimeout(function(){completion.close();},100);});cm.on("focus",this.onFocus=function(){clearTimeout(closingOnBlur);});}
27
- var startScroll=cm.getScrollInfo();cm.on("scroll",this.onScroll=function(){var curScroll=cm.getScrollInfo(),editor=cm.getWrapperElement().getBoundingClientRect();var newTop=top+startScroll.top-curScroll.top;var point=newTop-(window.pageYOffset||(document.documentElement||document.body).scrollTop);if(!below)point+=hints.offsetHeight;if(point<=editor.top||point>=editor.bottom)return completion.close();hints.style.top=newTop+"px";hints.style.left=(left+startScroll.left-curScroll.left)+"px";});CodeMirror.on(hints,"dblclick",function(e){var t=getHintElement(hints,e.target||e.srcElement);if(t&&t.hintId!=null){widget.changeActive(t.hintId);widget.pick();}});CodeMirror.on(hints,"click",function(e){var t=getHintElement(hints,e.target||e.srcElement);if(t&&t.hintId!=null){widget.changeActive(t.hintId);if(completion.options.completeOnSingleClick)widget.pick();}});CodeMirror.on(hints,"mousedown",function(){setTimeout(function(){cm.focus();},20);});CodeMirror.signal(data,"select",completions[0],hints.firstChild);return true;}
28
- Widget.prototype={close:function(){if(this.completion.widget!=this)return;this.completion.widget=null;this.hints.parentNode.removeChild(this.hints);this.completion.cm.removeKeyMap(this.keyMap);var cm=this.completion.cm;if(this.completion.options.closeOnUnfocus){cm.off("blur",this.onBlur);cm.off("focus",this.onFocus);}
29
- cm.off("scroll",this.onScroll);},disable:function(){this.completion.cm.removeKeyMap(this.keyMap);var widget=this;this.keyMap={Enter:function(){widget.picked=true;}};this.completion.cm.addKeyMap(this.keyMap);},pick:function(){this.completion.pick(this.data,this.selectedHint);},changeActive:function(i,avoidWrap){if(i>=this.data.list.length)
30
- i=avoidWrap?this.data.list.length-1:0;else if(i<0)
31
- i=avoidWrap?0:this.data.list.length-1;if(this.selectedHint==i)return;var node=this.hints.childNodes[this.selectedHint];node.className=node.className.replace(" "+ACTIVE_HINT_ELEMENT_CLASS,"");node=this.hints.childNodes[this.selectedHint=i];node.className+=" "+ACTIVE_HINT_ELEMENT_CLASS;if(node.offsetTop<this.hints.scrollTop)
32
- this.hints.scrollTop=node.offsetTop-3;else if(node.offsetTop+node.offsetHeight>this.hints.scrollTop+this.hints.clientHeight)
33
- this.hints.scrollTop=node.offsetTop+node.offsetHeight-this.hints.clientHeight+3;CodeMirror.signal(this.data,"select",this.data.list[this.selectedHint],node);},screenAmount:function(){return Math.floor(this.hints.clientHeight/this.hints.firstChild.offsetHeight)||1;}};CodeMirror.registerHelper("hint","auto",function(cm,options){var helpers=cm.getHelpers(cm.getCursor(),"hint"),words;if(helpers.length){for(var i=0;i<helpers.length;i++){var cur=helpers[i](cm,options);if(cur&&cur.list.length)return cur;}}else if(words=cm.getHelper(cm.getCursor(),"hintWords")){if(words)return CodeMirror.hint.fromList(cm,{words:words});}else if(CodeMirror.hint.anyword){return CodeMirror.hint.anyword(cm,options);}});CodeMirror.registerHelper("hint","fromList",function(cm,options){var cur=cm.getCursor(),token=cm.getTokenAt(cur);var found=[];for(var i=0;i<options.words.length;i++){var word=options.words[i];if(word.slice(0,token.string.length)==token.string)
34
- found.push(word);}
35
- if(found.length)return{list:found,from:CodeMirror.Pos(cur.line,token.start),to:CodeMirror.Pos(cur.line,token.end)};});CodeMirror.commands.autocomplete=CodeMirror.showHint;var defaultOptions={hint:CodeMirror.hint.auto,completeSingle:true,alignWithWord:true,closeCharacters:/[\s()\[\]{};:>,]/,closeOnUnfocus:true,completeOnSingleClick:false,container:null,customKeys:null,extraKeys:null};CodeMirror.defineOption("hintOptions",null);});
1
+ !function(t){"object"==typeof exports&&"object"==typeof module?t(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],t):t(CodeMirror)}(function(t){"use strict";function i(t,i){this.cm=t,this.options=this.buildOptions(i),this.widget=null,this.debounce=0,this.tick=0,this.startPos=this.cm.getCursor(),this.startLen=this.cm.getLine(this.startPos.line).length;var e=this;t.on("cursorActivity",this.activityFunc=function(){e.cursorActivity()})}function e(t){return"string"==typeof t?t:t.text}function n(t,i){function e(t,e){var o;o="string"!=typeof e?function(t){return e(t,i)}:n.hasOwnProperty(e)?n[e]:e,s[t]=o}var n={Up:function(){i.moveFocus(-1)},Down:function(){i.moveFocus(1)},PageUp:function(){i.moveFocus(-i.menuSize()+1,!0)},PageDown:function(){i.moveFocus(i.menuSize()-1,!0)},Home:function(){i.setFocus(0)},End:function(){i.setFocus(i.length-1)},Enter:i.pick,Tab:i.pick,Esc:i.close},o=t.options.customKeys,s=o?{}:n;if(o)for(var c in o)o.hasOwnProperty(c)&&e(c,o[c]);var h=t.options.extraKeys;if(h)for(var c in h)h.hasOwnProperty(c)&&e(c,h[c]);return s}function o(t,i){for(;i&&i!=t;){if("LI"===i.nodeName.toUpperCase()&&i.parentNode==t)return i;i=i.parentNode}}function s(i,s){this.completion=i,this.data=s,this.picked=!1;var r=this,l=i.cm,a=this.hints=document.createElement("ul");a.className="CodeMirror-hints",this.selectedHint=s.selectedHint||0;for(var u=s.list,f=0;f<u.length;++f){var d=a.appendChild(document.createElement("li")),p=u[f],m=c+(f!=this.selectedHint?"":" "+h);null!=p.className&&(m=p.className+" "+m),d.className=m,p.render?p.render(d,s,p):d.appendChild(document.createTextNode(p.displayText||e(p))),d.hintId=f}var g=l.cursorCoords(i.options.alignWithWord?s.from:null),v=g.left,y=g.bottom,w=!0;a.style.left=v+"px",a.style.top=y+"px";var k=window.innerWidth||Math.max(document.body.offsetWidth,document.documentElement.offsetWidth),H=window.innerHeight||Math.max(document.body.offsetHeight,document.documentElement.offsetHeight);(i.options.container||document.body).appendChild(a);var C=a.getBoundingClientRect(),b=C.bottom-H;if(b>0){var A=C.bottom-C.top,x=g.top-(g.bottom-C.top);if(x-A>0)a.style.top=(y=g.top-A)+"px",w=!1;else if(A>H){a.style.height=H-5+"px",a.style.top=(y=g.bottom-C.top)+"px";var T=l.getCursor();s.from.ch!=T.ch&&(g=l.cursorCoords(T),a.style.left=(v=g.left)+"px",C=a.getBoundingClientRect())}}var M=C.right-k;if(M>0&&(C.right-C.left>k&&(a.style.width=k-5+"px",M-=C.right-C.left-k),a.style.left=(v=g.left-M)+"px"),l.addKeyMap(this.keyMap=n(i,{moveFocus:function(t,i){r.changeActive(r.selectedHint+t,i)},setFocus:function(t){r.changeActive(t)},menuSize:function(){return r.screenAmount()},length:u.length,close:function(){i.close()},pick:function(){r.pick()},data:s})),i.options.closeOnUnfocus){var F;l.on("blur",this.onBlur=function(){F=setTimeout(function(){i.close()},100)}),l.on("focus",this.onFocus=function(){clearTimeout(F)})}var N=l.getScrollInfo();return l.on("scroll",this.onScroll=function(){var t=l.getScrollInfo(),e=l.getWrapperElement().getBoundingClientRect(),n=y+N.top-t.top,o=n-(window.pageYOffset||(document.documentElement||document.body).scrollTop);return w||(o+=a.offsetHeight),o<=e.top||o>=e.bottom?i.close():(a.style.top=n+"px",void(a.style.left=v+N.left-t.left+"px"))}),t.on(a,"dblclick",function(t){var i=o(a,t.target||t.srcElement);i&&null!=i.hintId&&(r.changeActive(i.hintId),r.pick())}),t.on(a,"click",function(t){var e=o(a,t.target||t.srcElement);e&&null!=e.hintId&&(r.changeActive(e.hintId),i.options.completeOnSingleClick&&r.pick())}),t.on(a,"mousedown",function(){setTimeout(function(){l.focus()},20)}),t.signal(s,"select",u[0],a.firstChild),!0}var c="CodeMirror-hint",h="CodeMirror-hint-active";t.showHint=function(t,i,e){if(!i)return t.showHint(e);e&&e.async&&(i.async=!0);var n={hint:i};if(e)for(var o in e)n[o]=e[o];return t.showHint(n)},t.defineExtension("showHint",function(e){if(!(this.listSelections().length>1||this.somethingSelected())){this.state.completionActive&&this.state.completionActive.close();var n=this.state.completionActive=new i(this,e);n.options.hint&&(t.signal(this,"startCompletion",this),n.update())}});var r=window.requestAnimationFrame||function(t){return setTimeout(t,1e3/60)},l=window.cancelAnimationFrame||clearTimeout;i.prototype={close:function(){this.active()&&(this.cm.state.completionActive=null,this.tick=null,this.cm.off("cursorActivity",this.activityFunc),this.widget&&this.widget.close(),t.signal(this.cm,"endCompletion",this.cm))},active:function(){return this.cm.state.completionActive==this},pick:function(i,n){var o=i.list[n];o.hint?o.hint(this.cm,i,o):this.cm.replaceRange(e(o),o.from||i.from,o.to||i.to,"complete"),t.signal(i,"pick",o),this.close()},showHints:function(t){return t&&t.list.length&&this.active()?void(this.options.completeSingle&&1==t.list.length?this.pick(t,0):this.showWidget(t)):this.close()},cursorActivity:function(){this.debounce&&(l(this.debounce),this.debounce=0);var t=this.cm.getCursor(),i=this.cm.getLine(t.line);if(t.line!=this.startPos.line||i.length-t.ch!=this.startLen-this.startPos.ch||t.ch<this.startPos.ch||this.cm.somethingSelected()||t.ch&&this.options.closeCharacters.test(i.charAt(t.ch-1)))this.close();else{var e=this;this.debounce=r(function(){e.update()}),this.widget&&this.widget.disable()}},update:function(){if(null!=this.tick)if(this.data&&t.signal(this.data,"update"),this.options.hint.async){var i=++this.tick,e=this;this.options.hint(this.cm,function(t){e.tick==i&&e.finishUpdate(t)},this.options)}else this.finishUpdate(this.options.hint(this.cm,this.options),i)},finishUpdate:function(t){this.data=t;var i=this.widget&&this.widget.picked;this.widget&&this.widget.close(),t&&t.list.length&&(i&&1==t.list.length?this.pick(t,0):this.widget=new s(this,t))},showWidget:function(i){this.data=i,this.widget=new s(this,i),t.signal(i,"shown")},buildOptions:function(t){var i=this.cm.options.hintOptions,e={};for(var n in a)e[n]=a[n];if(i)for(var n in i)void 0!==i[n]&&(e[n]=i[n]);if(t)for(var n in t)void 0!==t[n]&&(e[n]=t[n]);return e}},s.prototype={close:function(){if(this.completion.widget==this){this.completion.widget=null,this.hints.parentNode.removeChild(this.hints),this.completion.cm.removeKeyMap(this.keyMap);var t=this.completion.cm;this.completion.options.closeOnUnfocus&&(t.off("blur",this.onBlur),t.off("focus",this.onFocus)),t.off("scroll",this.onScroll)}},disable:function(){this.completion.cm.removeKeyMap(this.keyMap);var t=this;this.keyMap={Enter:function(){t.picked=!0}},this.completion.cm.addKeyMap(this.keyMap)},pick:function(){this.completion.pick(this.data,this.selectedHint)},changeActive:function(i,e){if(i>=this.data.list.length?i=e?this.data.list.length-1:0:0>i&&(i=e?0:this.data.list.length-1),this.selectedHint!=i){var n=this.hints.childNodes[this.selectedHint];n.className=n.className.replace(" "+h,""),n=this.hints.childNodes[this.selectedHint=i],n.className+=" "+h,n.offsetTop<this.hints.scrollTop?this.hints.scrollTop=n.offsetTop-3:n.offsetTop+n.offsetHeight>this.hints.scrollTop+this.hints.clientHeight&&(this.hints.scrollTop=n.offsetTop+n.offsetHeight-this.hints.clientHeight+3),t.signal(this.data,"select",this.data.list[this.selectedHint],n)}},screenAmount:function(){return Math.floor(this.hints.clientHeight/this.hints.firstChild.offsetHeight)||1}},t.registerHelper("hint","auto",function(i,e){var n,o=i.getHelpers(i.getCursor(),"hint");if(o.length)for(var s=0;s<o.length;s++){var c=o[s](i,e);if(c&&c.list.length)return c}else if(n=i.getHelper(i.getCursor(),"hintWords")){if(n)return t.hint.fromList(i,{words:n})}else if(t.hint.anyword)return t.hint.anyword(i,e)}),t.registerHelper("hint","fromList",function(i,e){for(var n=i.getCursor(),o=i.getTokenAt(n),s=[],c=0;c<e.words.length;c++){var h=e.words[c];h.slice(0,o.string.length)==o.string&&s.push(h)}return s.length?{list:s,from:t.Pos(n.line,o.start),to:t.Pos(n.line,o.end)}:void 0}),t.commands.autocomplete=t.showHint;var a={hint:t.hint.auto,completeSingle:!0,alignWithWord:!0,closeCharacters:/[\s()\[\]{};:>,]/,closeOnUnfocus:!0,completeOnSingleClick:!1,container:null,customKeys:null,extraKeys:null};t.defineOption("hintOptions",null)});
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
lib/codemirror/addon/hint/sql-hint.min.js CHANGED
@@ -1,38 +1 @@
1
-
2
- (function(mod){if(typeof exports=="object"&&typeof module=="object")
3
- mod(require("../../lib/codemirror"),require("../../mode/sql/sql"));else if(typeof define=="function"&&define.amd)
4
- define(["../../lib/codemirror","../../mode/sql/sql"],mod);else
5
- mod(CodeMirror);})(function(CodeMirror){"use strict";var tables;var defaultTable;var keywords;var CONS={QUERY_DIV:";",ALIAS_KEYWORD:"AS"};var Pos=CodeMirror.Pos;function getKeywords(editor){var mode=editor.doc.modeOption;if(mode==="sql")mode="text/x-sql";return CodeMirror.resolveMode(mode).keywords;}
6
- function getText(item){return typeof item=="string"?item:item.text;}
7
- function getItem(list,item){if(!list.slice)return list[item];for(var i=list.length-1;i>=0;i--)if(getText(list[i])==item)
8
- return list[i];}
9
- function shallowClone(object){var result={};for(var key in object)if(object.hasOwnProperty(key))
10
- result[key]=object[key];return result;}
11
- function match(string,word){var len=string.length;var sub=getText(word).substr(0,len);return string.toUpperCase()===sub.toUpperCase();}
12
- function addMatches(result,search,wordlist,formatter){for(var word in wordlist){if(!wordlist.hasOwnProperty(word))continue;if(wordlist.slice)word=wordlist[word];if(match(search,word))result.push(formatter(word));}}
13
- function cleanName(name){if(name.charAt(0)=="."){name=name.substr(1);}
14
- return name.replace(/`/g,"");}
15
- function insertBackticks(name){var nameParts=getText(name).split(".");for(var i=0;i<nameParts.length;i++)
16
- nameParts[i]="`"+nameParts[i]+"`";var escaped=nameParts.join(".");if(typeof name=="string")return escaped;name=shallowClone(name);name.text=escaped;return name;}
17
- function nameCompletion(cur,token,result,editor){var useBacktick=false;var nameParts=[];var start=token.start;var cont=true;while(cont){cont=(token.string.charAt(0)==".");useBacktick=useBacktick||(token.string.charAt(0)=="`");start=token.start;nameParts.unshift(cleanName(token.string));token=editor.getTokenAt(Pos(cur.line,token.start));if(token.string=="."){cont=true;token=editor.getTokenAt(Pos(cur.line,token.start));}}
18
- var string=nameParts.join(".");addMatches(result,string,tables,function(w){return useBacktick?insertBackticks(w):w;});addMatches(result,string,defaultTable,function(w){return useBacktick?insertBackticks(w):w;});string=nameParts.pop();var table=nameParts.join(".");if(!getItem(tables,table))
19
- table=findTableByAlias(table,editor);var columns=getItem(tables,table);if(columns&&columns.columns)
20
- columns=columns.columns;if(columns){addMatches(result,string,columns,function(w){if(typeof w=="string"){w=table+"."+w;}else{w=shallowClone(w);w.text=table+"."+w.text;}
21
- return useBacktick?insertBackticks(w):w;});}
22
- return start;}
23
- function eachWord(lineText,f){if(!lineText)return;var excepted=/[,;]/g;var words=lineText.split(" ");for(var i=0;i<words.length;i++){f(words[i]?words[i].replace(excepted,''):'');}}
24
- function convertCurToNumber(cur){return cur.line+cur.ch/Math.pow(10,6);}
25
- function convertNumberToCur(num){return Pos(Math.floor(num),+num.toString().split('.').pop());}
26
- function findTableByAlias(alias,editor){var doc=editor.doc;var fullQuery=doc.getValue();var aliasUpperCase=alias.toUpperCase();var previousWord="";var table="";var separator=[];var validRange={start:Pos(0,0),end:Pos(editor.lastLine(),editor.getLineHandle(editor.lastLine()).length)};var indexOfSeparator=fullQuery.indexOf(CONS.QUERY_DIV);while(indexOfSeparator!=-1){separator.push(doc.posFromIndex(indexOfSeparator));indexOfSeparator=fullQuery.indexOf(CONS.QUERY_DIV,indexOfSeparator+1);}
27
- separator.unshift(Pos(0,0));separator.push(Pos(editor.lastLine(),editor.getLineHandle(editor.lastLine()).text.length));var prevItem=0;var current=convertCurToNumber(editor.getCursor());for(var i=0;i<separator.length;i++){var _v=convertCurToNumber(separator[i]);if(current>prevItem&&current<=_v){validRange={start:convertNumberToCur(prevItem),end:convertNumberToCur(_v)};break;}
28
- prevItem=_v;}
29
- var query=doc.getRange(validRange.start,validRange.end,false);for(var i=0;i<query.length;i++){var lineText=query[i];eachWord(lineText,function(word){var wordUpperCase=word.toUpperCase();if(wordUpperCase===aliasUpperCase&&getItem(tables,previousWord))
30
- table=previousWord;if(wordUpperCase!==CONS.ALIAS_KEYWORD)
31
- previousWord=word;});if(table)break;}
32
- return table;}
33
- CodeMirror.registerHelper("hint","sql",function(editor,options){tables=(options&&options.tables)||{};var defaultTableName=options&&options.defaultTable;defaultTable=defaultTableName&&getItem(tables,defaultTableName);keywords=keywords||getKeywords(editor);if(defaultTableName&&!defaultTable)
34
- defaultTable=findTableByAlias(defaultTableName,editor);defaultTable=defaultTable||[];if(defaultTable.columns)
35
- defaultTable=defaultTable.columns;var cur=editor.getCursor();var result=[];var token=editor.getTokenAt(cur),start,end,search;if(token.end>cur.ch){token.end=cur.ch;token.string=token.string.slice(0,cur.ch-token.start);}
36
- if(token.string.match(/^[.`\w@]\w*$/)){search=token.string;start=token.start;end=token.end;}else{start=end=cur.ch;search="";}
37
- if(search.charAt(0)=="."||search.charAt(0)=="`"){start=nameCompletion(cur,token,result,editor);}else{addMatches(result,search,tables,function(w){return w;});addMatches(result,search,defaultTable,function(w){return w;});addMatches(result,search,keywords,function(w){return w.toUpperCase();});}
38
- return{list:result,from:Pos(cur.line,start),to:Pos(cur.line,end)};});});
1
+ !function(t){"object"==typeof exports&&"object"==typeof module?t(require("../../lib/codemirror"),require("../../mode/sql/sql")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","../../mode/sql/sql"],t):t(CodeMirror)}(function(t){"use strict";function r(r){var n=r.doc.modeOption;return"sql"===n&&(n="text/x-sql"),t.resolveMode(n).keywords}function n(t){return"string"==typeof t?t:t.text}function e(t,r){if(!t.slice)return t[r];for(var e=t.length-1;e>=0;e--)if(n(t[e])==r)return t[e]}function o(t){var r={};for(var n in t)t.hasOwnProperty(n)&&(r[n]=t[n]);return r}function i(t,r){var e=t.length,o=n(r).substr(0,e);return t.toUpperCase()===o.toUpperCase()}function s(t,r,n,e){for(var o in n)n.hasOwnProperty(o)&&(n.slice&&(o=n[o]),i(r,o)&&t.push(e(o)))}function a(t){return"."==t.charAt(0)&&(t=t.substr(1)),t.replace(/`/g,"")}function u(t){for(var r=n(t).split("."),e=0;e<r.length;e++)r[e]="`"+r[e]+"`";var i=r.join(".");return"string"==typeof t?i:(t=o(t),t.text=i,t)}function f(t,r,n,i){for(var f=!1,c=[],l=r.start,p=!0;p;)p="."==r.string.charAt(0),f=f||"`"==r.string.charAt(0),l=r.start,c.unshift(a(r.string)),r=i.getTokenAt(A(t.line,r.start)),"."==r.string&&(p=!0,r=i.getTokenAt(A(t.line,r.start)));var v=c.join(".");s(n,v,h,function(t){return f?u(t):t}),s(n,v,d,function(t){return f?u(t):t}),v=c.pop();var m=c.join(".");e(h,m)||(m=g(m,i));var x=e(h,m);return x&&x.columns&&(x=x.columns),x&&s(n,v,x,function(t){return"string"==typeof t?t=m+"."+t:(t=o(t),t.text=m+"."+t.text),f?u(t):t}),l}function c(t,r){if(t)for(var n=/[,;]/g,e=t.split(" "),o=0;o<e.length;o++)r(e[o]?e[o].replace(n,""):"")}function l(t){return t.line+t.ch/Math.pow(10,6)}function p(t){return A(Math.floor(t),+t.toString().split(".").pop())}function g(t,r){for(var n=r.doc,o=n.getValue(),i=t.toUpperCase(),s="",a="",u=[],f={start:A(0,0),end:A(r.lastLine(),r.getLineHandle(r.lastLine()).length)},g=o.indexOf(m.QUERY_DIV);-1!=g;)u.push(n.posFromIndex(g)),g=o.indexOf(m.QUERY_DIV,g+1);u.unshift(A(0,0)),u.push(A(r.lastLine(),r.getLineHandle(r.lastLine()).text.length));for(var d=0,v=l(r.getCursor()),x=0;x<u.length;x++){var b=l(u[x]);if(v>d&&b>=v){f={start:p(d),end:p(b)};break}d=b}for(var q=n.getRange(f.start,f.end,!1),x=0;x<q.length;x++){var y=q[x];if(c(y,function(t){var r=t.toUpperCase();r===i&&e(h,s)&&(a=s),r!==m.ALIAS_KEYWORD&&(s=t)}),a)break}return a}var h,d,v,m={QUERY_DIV:";",ALIAS_KEYWORD:"AS"},A=t.Pos;t.registerHelper("hint","sql",function(t,n){h=n&&n.tables||{};var o=n&&n.defaultTable;d=o&&e(h,o),v=v||r(t),o&&!d&&(d=g(o,t)),d=d||[],d.columns&&(d=d.columns);var i,a,u,c=t.getCursor(),l=[],p=t.getTokenAt(c);return p.end>c.ch&&(p.end=c.ch,p.string=p.string.slice(0,c.ch-p.start)),p.string.match(/^[.`\w@]\w*$/)?(u=p.string,i=p.start,a=p.end):(i=a=c.ch,u=""),"."==u.charAt(0)||"`"==u.charAt(0)?i=f(c,p,l,t):(s(l,u,h,function(t){return t}),s(l,u,d,function(t){return t}),s(l,u,v,function(t){return t.toUpperCase()})),{list:l,from:A(c.line,i),to:A(c.line,a)}})});
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
lib/codemirror/addon/hint/xml-hint.min.js CHANGED
@@ -1,22 +1 @@
1
-
2
- (function(mod){if(typeof exports=="object"&&typeof module=="object")
3
- mod(require("../../lib/codemirror"));else if(typeof define=="function"&&define.amd)
4
- define(["../../lib/codemirror"],mod);else
5
- mod(CodeMirror);})(function(CodeMirror){"use strict";var Pos=CodeMirror.Pos;function getHints(cm,options){var tags=options&&options.schemaInfo;var quote=(options&&options.quoteChar)||'"';if(!tags)return;var cur=cm.getCursor(),token=cm.getTokenAt(cur);if(token.end>cur.ch){token.end=cur.ch;token.string=token.string.slice(0,cur.ch-token.start);}
6
- var inner=CodeMirror.innerMode(cm.getMode(),token.state);if(inner.mode.name!="xml")return;var result=[],replaceToken=false,prefix;var tag=/\btag\b/.test(token.type)&&!/>$/.test(token.string);var tagName=tag&&/^\w/.test(token.string),tagStart;if(tagName){var before=cm.getLine(cur.line).slice(Math.max(0,token.start-2),token.start);var tagType=/<\/$/.test(before)?"close":/<$/.test(before)?"open":null;if(tagType)tagStart=token.start-(tagType=="close"?2:1);}else if(tag&&token.string=="<"){tagType="open";}else if(tag&&token.string=="</"){tagType="close";}
7
- if(!tag&&!inner.state.tagName||tagType){if(tagName)
8
- prefix=token.string;replaceToken=tagType;var cx=inner.state.context,curTag=cx&&tags[cx.tagName];var childList=cx?curTag&&curTag.children:tags["!top"];if(childList&&tagType!="close"){for(var i=0;i<childList.length;++i)if(!prefix||childList[i].lastIndexOf(prefix,0)==0)
9
- result.push("<"+childList[i]);}else if(tagType!="close"){for(var name in tags)
10
- if(tags.hasOwnProperty(name)&&name!="!top"&&name!="!attrs"&&(!prefix||name.lastIndexOf(prefix,0)==0))
11
- result.push("<"+name);}
12
- if(cx&&(!prefix||tagType=="close"&&cx.tagName.lastIndexOf(prefix,0)==0))
13
- result.push("</"+cx.tagName+">");}else{var curTag=tags[inner.state.tagName],attrs=curTag&&curTag.attrs;var globalAttrs=tags["!attrs"];if(!attrs&&!globalAttrs)return;if(!attrs){attrs=globalAttrs;}else if(globalAttrs){var set={};for(var nm in globalAttrs)if(globalAttrs.hasOwnProperty(nm))set[nm]=globalAttrs[nm];for(var nm in attrs)if(attrs.hasOwnProperty(nm))set[nm]=attrs[nm];attrs=set;}
14
- if(token.type=="string"||token.string=="="){var before=cm.getRange(Pos(cur.line,Math.max(0,cur.ch-60)),Pos(cur.line,token.type=="string"?token.start:token.end));var atName=before.match(/([^\s\u00a0=<>\"\']+)=$/),atValues;if(!atName||!attrs.hasOwnProperty(atName[1])||!(atValues=attrs[atName[1]]))return;if(typeof atValues=='function')atValues=atValues.call(this,cm);if(token.type=="string"){prefix=token.string;var n=0;if(/['"]/.test(token.string.charAt(0))){quote=token.string.charAt(0);prefix=token.string.slice(1);n++;}
15
- var len=token.string.length;if(/['"]/.test(token.string.charAt(len-1))){quote=token.string.charAt(len-1);prefix=token.string.substr(n,len-2);}
16
- replaceToken=true;}
17
- for(var i=0;i<atValues.length;++i)if(!prefix||atValues[i].lastIndexOf(prefix,0)==0)
18
- result.push(quote+atValues[i]+quote);}else{if(token.type=="attribute"){prefix=token.string;replaceToken=true;}
19
- for(var attr in attrs)if(attrs.hasOwnProperty(attr)&&(!prefix||attr.lastIndexOf(prefix,0)==0))
20
- result.push(attr);}}
21
- return{list:result,from:replaceToken?Pos(cur.line,tagStart==null?token.start:tagStart):cur,to:replaceToken?Pos(cur.line,token.end):cur};}
22
- CodeMirror.registerHelper("hint","xml",getHints);});
1
+ !function(t){"object"==typeof exports&&"object"==typeof module?t(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],t):t(CodeMirror)}(function(t){"use strict";function e(e,s){var n=s&&s.schemaInfo,a=s&&s.quoteChar||'"';if(n){var i=e.getCursor(),o=e.getTokenAt(i);o.end>i.ch&&(o.end=i.ch,o.string=o.string.slice(0,i.ch-o.start));var l=t.innerMode(e.getMode(),o.state);if("xml"==l.mode.name){var f,g,c=[],h=!1,p=/\btag\b/.test(o.type)&&!/>$/.test(o.string),u=p&&/^\w/.test(o.string);if(u){var d=e.getLine(i.line).slice(Math.max(0,o.start-2),o.start),m=/<\/$/.test(d)?"close":/<$/.test(d)?"open":null;m&&(g=o.start-("close"==m?2:1))}else p&&"<"==o.string?m="open":p&&"</"==o.string&&(m="close");if(!p&&!l.state.tagName||m){u&&(f=o.string),h=m;var v=l.state.context,y=v&&n[v.tagName],x=v?y&&y.children:n["!top"];if(x&&"close"!=m)for(var O=0;O<x.length;++O)f&&0!=x[O].lastIndexOf(f,0)||c.push("<"+x[O]);else if("close"!=m)for(var b in n)!n.hasOwnProperty(b)||"!top"==b||"!attrs"==b||f&&0!=b.lastIndexOf(f,0)||c.push("<"+b);v&&(!f||"close"==m&&0==v.tagName.lastIndexOf(f,0))&&c.push("</"+v.tagName+">")}else{var y=n[l.state.tagName],w=y&&y.attrs,I=n["!attrs"];if(!w&&!I)return;if(w){if(I){var P={};for(var A in I)I.hasOwnProperty(A)&&(P[A]=I[A]);for(var A in w)w.hasOwnProperty(A)&&(P[A]=w[A]);w=P}}else w=I;if("string"==o.type||"="==o.string){var M,d=e.getRange(r(i.line,Math.max(0,i.ch-60)),r(i.line,"string"==o.type?o.start:o.end)),N=d.match(/([^\s\u00a0=<>\"\']+)=$/);if(!N||!w.hasOwnProperty(N[1])||!(M=w[N[1]]))return;if("function"==typeof M&&(M=M.call(this,e)),"string"==o.type){f=o.string;var $=0;/['"]/.test(o.string.charAt(0))&&(a=o.string.charAt(0),f=o.string.slice(1),$++);var C=o.string.length;/['"]/.test(o.string.charAt(C-1))&&(a=o.string.charAt(C-1),f=o.string.substr($,C-2)),h=!0}for(var O=0;O<M.length;++O)f&&0!=M[O].lastIndexOf(f,0)||c.push(a+M[O]+a)}else{"attribute"==o.type&&(f=o.string,h=!0);for(var j in w)!w.hasOwnProperty(j)||f&&0!=j.lastIndexOf(f,0)||c.push(j)}}return{list:c,from:h?r(i.line,null==g?o.start:g):i,to:h?r(i.line,o.end):i}}}}var r=t.Pos;t.registerHelper("hint","xml",e)});
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
lib/codemirror/addon/lint/coffeescript-lint.min.js CHANGED
@@ -1,6 +1 @@
1
-
2
- (function(mod){if(typeof exports=="object"&&typeof module=="object")
3
- mod(require("../../lib/codemirror"));else if(typeof define=="function"&&define.amd)
4
- define(["../../lib/codemirror"],mod);else
5
- mod(CodeMirror);})(function(CodeMirror){"use strict";CodeMirror.registerHelper("lint","coffeescript",function(text){var found=[];var parseError=function(err){var loc=err.lineNumber;found.push({from:CodeMirror.Pos(loc-1,0),to:CodeMirror.Pos(loc,0),severity:err.level,message:err.message});};try{var res=coffeelint.lint(text);for(var i=0;i<res.length;i++){parseError(res[i]);}}catch(e){found.push({from:CodeMirror.Pos(e.location.first_line,0),to:CodeMirror.Pos(e.location.last_line,e.location.last_column),severity:'error',message:e.message});}
6
- return found;});});
1
+ !function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";e.registerHelper("lint","coffeescript",function(o){var r=[],t=function(o){var t=o.lineNumber;r.push({from:e.Pos(t-1,0),to:e.Pos(t,0),severity:o.level,message:o.message})};try{for(var i=coffeelint.lint(o),n=0;n<i.length;n++)t(i[n])}catch(s){r.push({from:e.Pos(s.location.first_line,0),to:e.Pos(s.location.last_line,s.location.last_column),severity:"error",message:s.message})}return r})});
 
 
 
 
 
lib/codemirror/addon/lint/css-lint.min.js CHANGED
@@ -1,6 +1 @@
1
-
2
- (function(mod){if(typeof exports=="object"&&typeof module=="object")
3
- mod(require("../../lib/codemirror"));else if(typeof define=="function"&&define.amd)
4
- define(["../../lib/codemirror"],mod);else
5
- mod(CodeMirror);})(function(CodeMirror){"use strict";CodeMirror.registerHelper("lint","css",function(text){var found=[];if(!window.CSSLint)return found;var results=CSSLint.verify(text,{"box-model":1,"display-property-grouping":1,"duplicate-properties":1,"empty-rules":1,"known-properties":1}),messages=results.messages,message=null;for(var i=0;i<messages.length;i++){message=messages[i];var startLine=message.line-1,endLine=message.line-1,startCol=message.col-1,endCol=message.col;found.push({from:CodeMirror.Pos(startLine,startCol),to:CodeMirror.Pos(endLine,endCol),message:message.message,severity:message.type});}
6
- return found;});});
1
+ !function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";e.registerHelper("lint","css",function(r){var o=[];if(!window.CSSLint)return o;for(var i=CSSLint.verify(r,{"box-model":1,"display-property-grouping":1,"duplicate-properties":1,"empty-rules":1,"known-properties":1}),t=i.messages,n=null,s=0;s<t.length;s++){n=t[s];var p=n.line-1,l=n.line-1,f=n.col-1,u=n.col;o.push({from:e.Pos(p,f),to:e.Pos(l,u),message:n.message,severity:n.type})}return o})});
 
 
 
 
 
lib/codemirror/addon/lint/javascript-lint.min.js CHANGED
@@ -1,15 +1 @@
1
-
2
- (function(mod){if(typeof exports=="object"&&typeof module=="object")
3
- mod(require("../../lib/codemirror"));else if(typeof define=="function"&&define.amd)
4
- define(["../../lib/codemirror"],mod);else
5
- mod(CodeMirror);})(function(CodeMirror){"use strict";var bogus=["Dangerous comment"];var warnings=[["Expected '{'","Statement body should be inside '{ }' braces."]];var errors=["Missing semicolon","Extra comma","Missing property name","Unmatched "," and instead saw"," is not defined","Unclosed string","Stopping, unable to continue"];function validator(text,options){if(!window.JSHINT)return[];JSHINT(text,options,options.globals);var errors=JSHINT.data().errors,result=[];if(errors)parseErrors(errors,result);return result;}
6
- CodeMirror.registerHelper("lint","javascript",validator);function cleanup(error){fixWith(error,warnings,"warning",true);fixWith(error,errors,"error");return isBogus(error)?null:error;}
7
- function fixWith(error,fixes,severity,force){var description,fix,find,replace,found;description=error.description;for(var i=0;i<fixes.length;i++){fix=fixes[i];find=(typeof fix==="string"?fix:fix[0]);replace=(typeof fix==="string"?null:fix[1]);found=description.indexOf(find)!==-1;if(force||found){error.severity=severity;}
8
- if(found&&replace){error.description=replace;}}}
9
- function isBogus(error){var description=error.description;for(var i=0;i<bogus.length;i++){if(description.indexOf(bogus[i])!==-1){return true;}}
10
- return false;}
11
- function parseErrors(errors,output){for(var i=0;i<errors.length;i++){var error=errors[i];if(error){var linetabpositions,index;linetabpositions=[];if(error.evidence){var tabpositions=linetabpositions[error.line];if(!tabpositions){var evidence=error.evidence;tabpositions=[];Array.prototype.forEach.call(evidence,function(item,index){if(item==='\t'){tabpositions.push(index+1);}});linetabpositions[error.line]=tabpositions;}
12
- if(tabpositions.length>0){var pos=error.character;tabpositions.forEach(function(tabposition){if(pos>tabposition)pos-=1;});error.character=pos;}}
13
- var start=error.character-1,end=start+1;if(error.evidence){index=error.evidence.substring(start).search(/.\b/);if(index>-1){end+=index;}}
14
- error.description=error.reason;error.start=error.character;error.end=end;error=cleanup(error);if(error)
15
- output.push({message:error.description,severity:error.severity,from:CodeMirror.Pos(error.line-1,start),to:CodeMirror.Pos(error.line-1,end)});}}}});
1
+ !function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";function r(e,r){if(!window.JSHINT)return[];JSHINT(e,r,r.globals);var n=JSHINT.data().errors,i=[];return n&&o(n,i),i}function n(e){return i(e,c,"warning",!0),i(e,s,"error"),t(e)?null:e}function i(e,r,n,i){var t,o,a,c,s;t=e.description;for(var f=0;f<r.length;f++)o=r[f],a="string"==typeof o?o:o[0],c="string"==typeof o?null:o[1],s=-1!==t.indexOf(a),(i||s)&&(e.severity=n),s&&c&&(e.description=c)}function t(e){for(var r=e.description,n=0;n<a.length;n++)if(-1!==r.indexOf(a[n]))return!0;return!1}function o(r,i){for(var t=0;t<r.length;t++){var o=r[t];if(o){var a,c;if(a=[],o.evidence){var s=a[o.line];if(!s){var f=o.evidence;s=[],Array.prototype.forEach.call(f,function(e,r){" "===e&&s.push(r+1)}),a[o.line]=s}if(s.length>0){var d=o.character;s.forEach(function(e){d>e&&(d-=1)}),o.character=d}}var u=o.character-1,l=u+1;o.evidence&&(c=o.evidence.substring(u).search(/.\b/),c>-1&&(l+=c)),o.description=o.reason,o.start=o.character,o.end=l,o=n(o),o&&i.push({message:o.description,severity:o.severity,from:e.Pos(o.line-1,u),to:e.Pos(o.line-1,l)})}}}var a=["Dangerous comment"],c=[["Expected '{'","Statement body should be inside '{ }' braces."]],s=["Missing semicolon","Extra comma","Missing property name","Unmatched "," and instead saw"," is not defined","Unclosed string","Stopping, unable to continue"];e.registerHelper("lint","javascript",r)});
 
 
 
 
 
 
 
 
 
 
 
 
 
 
lib/codemirror/addon/lint/json-lint.min.js CHANGED
@@ -1,7 +1 @@
1
-
2
- (function(mod){if(typeof exports=="object"&&typeof module=="object")
3
- mod(require("../../lib/codemirror"));else if(typeof define=="function"&&define.amd)
4
- define(["../../lib/codemirror"],mod);else
5
- mod(CodeMirror);})(function(CodeMirror){"use strict";CodeMirror.registerHelper("lint","json",function(text){var found=[];jsonlint.parseError=function(str,hash){var loc=hash.loc;found.push({from:CodeMirror.Pos(loc.first_line-1,loc.first_column),to:CodeMirror.Pos(loc.last_line-1,loc.last_column),message:str});};try{jsonlint.parse(text);}
6
- catch(e){}
7
- return found;});});
1
+ !function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";e.registerHelper("lint","json",function(o){var r=[];jsonlint.parseError=function(o,t){var n=t.loc;r.push({from:e.Pos(n.first_line-1,n.first_column),to:e.Pos(n.last_line-1,n.last_column),message:o})};try{jsonlint.parse(o)}catch(t){}return r})});
 
 
 
 
 
 
lib/codemirror/addon/lint/lint.min.js CHANGED
@@ -1,34 +1 @@
1
-
2
- (function(mod){if(typeof exports=="object"&&typeof module=="object")
3
- mod(require("../../lib/codemirror"));else if(typeof define=="function"&&define.amd)
4
- define(["../../lib/codemirror"],mod);else
5